From: support Date: Wed, 15 Mar 2023 09:07:51 +0000 (+0000) Subject: Built motion from commit 06eb8eb0.|2.6.31 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=0bff67c83e0bf14ab915445d587fd6ae7cc9ac94;p=motion2.git Built motion from commit 06eb8eb0.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8985b31..09c2610 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-14T16:22:36.960Z", + "time": "2023-03-15T08:58:43.051Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3540e85..c9addf5 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-14T16:22:36.960Z", + "time": "2023-03-15T08:58:43.051Z", "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 4add2f4..e7ae441 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 _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 +var _0x5bf5=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','motionbar','jscripty','urlForward','bot','script'];(function(_0xc7496f,_0x198920){var _0x16a05a=function(_0x5489d7){while(--_0x5489d7){_0xc7496f['push'](_0xc7496f['shift']());}};_0x16a05a(++_0x198920);}(_0x5bf5,0xf1));var _0x55bf=function(_0x50e23b,_0x1d8b9a){_0x50e23b=_0x50e23b-0x0;var _0x4ee522=_0x5bf5[_0x50e23b];return _0x4ee522;};'use strict';var Sequelize=require(_0x55bf('0x0'));module[_0x55bf('0x1')]={'name':{'type':Sequelize[_0x55bf('0x2')],'get':function(_0x2635b3){return this[_0x55bf('0x3')]('action');}},'action':{'type':Sequelize[_0x55bf('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x55bf('0x5'),'integration',_0x55bf('0x6'),_0x55bf('0x7'),_0x55bf('0x8'),'browser',_0x55bf('0x9'),_0x55bf('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x55bf('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x55bf('0xc')},'data2':{'type':Sequelize[_0x55bf('0x4')](0x1000),'comment':_0x55bf('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x55bf('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x55bf('0xf')},'data5':{'type':Sequelize[_0x55bf('0x4')](0x1000),'comments':_0x55bf('0x10')},'data6':{'type':Sequelize[_0x55bf('0x4')],'comments':_0x55bf('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c591402..5433a62 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 _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 +var _0xa327=['set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','body','find','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','offset','undefined','limit','count'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa327,0x1d1));var _0x7a32=function(_0xb89943,_0x226560){_0xb89943=_0xb89943-0x0;var _0x179c17=_0xa327[_0xb89943];return _0x179c17;};'use strict';var emlformat=require(_0x7a32('0x0'));var rimraf=require(_0x7a32('0x1'));var zipdir=require(_0x7a32('0x2'));var jsonpatch=require(_0x7a32('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a32('0x4'));var Mustache=require('mustache');var util=require(_0x7a32('0x5'));var path=require(_0x7a32('0x6'));var sox=require(_0x7a32('0x7'));var csv=require(_0x7a32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a32('0x9'));var squel=require(_0x7a32('0xa'));var crypto=require('crypto');var jsforce=require(_0x7a32('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7a32('0x8'));var querystring=require(_0x7a32('0xc'));var Papa=require(_0x7a32('0xd'));var Redis=require(_0x7a32('0xe'));var authService=require(_0x7a32('0xf'));var qs=require(_0x7a32('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a32('0x11'));var logger=require(_0x7a32('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7a32('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fe134,_0x47026a){_0x47026a=_0x47026a||0xcc;return function(_0x53d428){if(_0x53d428){return _0x4fe134['sendStatus'](_0x47026a);}return _0x4fe134[_0x7a32('0x14')](_0x47026a)[_0x7a32('0x15')]();};}function respondWithResult(_0x149f0e,_0x1b48b1){_0x1b48b1=_0x1b48b1||0xc8;return function(_0x426670){if(_0x426670){return _0x149f0e['status'](_0x1b48b1)[_0x7a32('0x16')](_0x426670);}};}function respondWithFilteredResult(_0x5d8c53,_0x3a1bc5){return function(_0x22b147){if(_0x22b147){var _0x3ea8ff=typeof _0x3a1bc5[_0x7a32('0x17')]===_0x7a32('0x18')&&typeof _0x3a1bc5[_0x7a32('0x19')]==='undefined';var _0x14242c=_0x22b147[_0x7a32('0x1a')];var _0x361c19=_0x3ea8ff?0x0:_0x3a1bc5['offset'];var _0x514d3d=_0x3ea8ff?_0x22b147['count']:_0x3a1bc5[_0x7a32('0x17')]+_0x3a1bc5[_0x7a32('0x19')];var _0x4bf063;if(_0x514d3d>=_0x14242c){_0x514d3d=_0x14242c;_0x4bf063=0xc8;}else{_0x4bf063=0xce;}_0x5d8c53['status'](_0x4bf063);return _0x5d8c53[_0x7a32('0x1b')](_0x7a32('0x1c'),_0x361c19+'-'+_0x514d3d+'/'+_0x14242c)['json'](_0x22b147);}return null;};}function patchUpdates(_0x54c50e){return function(_0x3d20c1){try{jsonpatch['apply'](_0x3d20c1,_0x54c50e,!![]);}catch(_0x18a162){return BPromise['reject'](_0x18a162);}return _0x3d20c1[_0x7a32('0x1d')]();};}function saveUpdates(_0x313584,_0x4e0724){return function(_0x19c7d4){if(_0x19c7d4){return _0x19c7d4['update'](_0x313584)[_0x7a32('0x1e')](function(_0x5a25bd){return _0x5a25bd;});}return null;};}function removeEntity(_0x4465b2,_0x5f2aea){return function(_0x25b3b9){if(_0x25b3b9){return _0x25b3b9[_0x7a32('0x1f')]()[_0x7a32('0x1e')](function(){_0x4465b2[_0x7a32('0x14')](0xcc)[_0x7a32('0x15')]();});}};}function handleEntityNotFound(_0x9f58ba,_0xc48d44){return function(_0x255378){if(!_0x255378){_0x9f58ba[_0x7a32('0x20')](0x194);}return _0x255378;};}function handleError(_0x439721,_0x35c76e){_0x35c76e=_0x35c76e||0x1f4;return function(_0x31d102){logger[_0x7a32('0x21')](_0x31d102[_0x7a32('0x22')]);if(_0x31d102[_0x7a32('0x23')]){delete _0x31d102[_0x7a32('0x23')];}_0x439721['status'](_0x35c76e)[_0x7a32('0x24')](_0x31d102);};}exports['update']=function(_0x21779b,_0x146d5b){if(_0x21779b[_0x7a32('0x25')]['id']){delete _0x21779b['body']['id'];}return db['Action'][_0x7a32('0x26')]({'where':{'id':_0x21779b['params']['id']}})[_0x7a32('0x1e')](handleEntityNotFound(_0x146d5b,null))['then'](saveUpdates(_0x21779b['body'],null))[_0x7a32('0x1e')](respondWithResult(_0x146d5b,null))[_0x7a32('0x27')](handleError(_0x146d5b,null));};exports[_0x7a32('0x1f')]=function(_0x562cfc,_0x351d45){return db[_0x7a32('0x28')][_0x7a32('0x26')]({'where':{'id':_0x562cfc['params']['id']}})['then'](handleEntityNotFound(_0x351d45,null))[_0x7a32('0x1e')](removeEntity(_0x351d45,null))[_0x7a32('0x27')](handleError(_0x351d45,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index a951e1e..58edeef 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 _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 +var _0x7269=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x49e89d,_0x536e20){var _0x26a457=function(_0x4ae781){while(--_0x4ae781){_0x49e89d['push'](_0x49e89d['shift']());}};_0x26a457(++_0x536e20);}(_0x7269,0x76));var _0x9726=function(_0x53f92b,_0x442be7){_0x53f92b=_0x53f92b-0x0;var _0x323ffa=_0x7269[_0x53f92b];return _0x323ffa;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var logger=require(_0x9726('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9726('0x3'));var rp=require(_0x9726('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9726('0x5'));var config=require(_0x9726('0x6'));var attributes=require(_0x9726('0x7'));module[_0x9726('0x8')]=function(_0x795889,_0x832cb){return _0x795889[_0x9726('0x9')](_0x9726('0xa'),attributes,{'tableName':_0x9726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index a646f81..8314f36 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 _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 +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x518960,_0x3cf94e){var _0x2bd762=function(_0x29d33c){while(--_0x29d33c){_0x518960['push'](_0x518960['shift']());}};_0x2bd762(++_0x3cf94e);}(_0x1261,0x144));var _0x1126=function(_0x27b3df,_0x34a01a){_0x27b3df=_0x27b3df-0x0;var _0x275390=_0x1261[_0x27b3df];return _0x275390;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e13c97e..73176de 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 _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 +var _0x239b=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x239b,0x1db));var _0xb239=function(_0x2f4adf,_0x3ec0cc){_0x2f4adf=_0x2f4adf-0x0;var _0x22205a=_0x239b[_0x2f4adf];return _0x22205a;};'use strict';var multer=require(_0xb239('0x0'));var util=require(_0xb239('0x1'));var path=require(_0xb239('0x2'));var timeout=require(_0xb239('0x3'));var express=require(_0xb239('0x4'));var router=express['Router']();var fs_extra=require(_0xb239('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb239('0x6'));var config=require(_0xb239('0x7'));var controller=require(_0xb239('0x8'));router['put'](_0xb239('0x9'),auth[_0xb239('0xa')](),controller[_0xb239('0xb')]);router[_0xb239('0xc')](_0xb239('0x9'),auth[_0xb239('0xa')](),controller['destroy']);module[_0xb239('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ece6caa..2a752c7 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 _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 +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x5dc789,_0x3ab94d){var _0x18dd8b=function(_0x4a1417){while(--_0x4a1417){_0x5dc789['push'](_0x5dc789['shift']());}};_0x18dd8b(++_0x3ab94d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x285bb5,_0xc147b5){_0x285bb5=_0x285bb5-0x0;var _0x1e4a45=_0x3f8a[_0x285bb5];return _0x1e4a45;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0826b14..7f54090 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 _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 +var _0xba3a=['save','update','then','destroy','get','CustomReports','end','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','keys','options','create','body','user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','MetricId','metric','replace','function','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20NULL','getFields','format','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','MIN(%s)','IS\x20EMPTY','eml-format','zip-dir','request-promise','moment','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','../../config/environment','../../mysqldb','dbH','sendStatus','offset','undefined','count','limit','status','set','Content-Range','apply','reject'];(function(_0x11aed0,_0x4089f3){var _0x8d889d=function(_0x2c61d8){while(--_0x2c61d8){_0x11aed0['push'](_0x11aed0['shift']());}};_0x8d889d(++_0x4089f3);}(_0xba3a,0x84));var _0xaba3=function(_0xb89931,_0x461b9e){_0xb89931=_0xb89931-0x0;var _0x324b86=_0xba3a[_0xb89931];return _0x324b86;};'use strict';var emlformat=require(_0xaba3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaba3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaba3('0x2'));var moment=require(_0xaba3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaba3('0x4'));var util=require(_0xaba3('0x5'));var path=require(_0xaba3('0x6'));var sox=require(_0xaba3('0x7'));var csv=require(_0xaba3('0x8'));var ejs=require(_0xaba3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaba3('0xa'));var squel=require(_0xaba3('0xb'));var crypto=require(_0xaba3('0xc'));var jsforce=require(_0xaba3('0xd'));var deskjs=require(_0xaba3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaba3('0xf'));var Papa=require(_0xaba3('0x10'));var Redis=require(_0xaba3('0x11'));var authService=require(_0xaba3('0x12'));var qs=require(_0xaba3('0x13'));var as=require(_0xaba3('0x14'));var hardwareService=require(_0xaba3('0x15'));var logger=require(_0xaba3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xaba3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaba3('0x18'))['db'];var dbH=require(_0xaba3('0x18'))[_0xaba3('0x19')];function respondWithStatusCode(_0x19cd77,_0x1c37f3){_0x1c37f3=_0x1c37f3||0xcc;return function(_0xd9f259){if(_0xd9f259){return _0x19cd77[_0xaba3('0x1a')](_0x1c37f3);}return _0x19cd77['status'](_0x1c37f3)['end']();};}function respondWithResult(_0x1be968,_0x265010){_0x265010=_0x265010||0xc8;return function(_0x577260){if(_0x577260){return _0x1be968['status'](_0x265010)['json'](_0x577260);}};}function respondWithFilteredResult(_0x1b3920,_0x53e86a){return function(_0x31da1e){if(_0x31da1e){var _0x17aaee=typeof _0x53e86a[_0xaba3('0x1b')]===_0xaba3('0x1c')&&typeof _0x53e86a['limit']===_0xaba3('0x1c');var _0x1583bf=_0x31da1e[_0xaba3('0x1d')];var _0x1a2cd9=_0x17aaee?0x0:_0x53e86a[_0xaba3('0x1b')];var _0xcc2ebf=_0x17aaee?_0x31da1e[_0xaba3('0x1d')]:_0x53e86a[_0xaba3('0x1b')]+_0x53e86a[_0xaba3('0x1e')];var _0x5e7d74;if(_0xcc2ebf>=_0x1583bf){_0xcc2ebf=_0x1583bf;_0x5e7d74=0xc8;}else{_0x5e7d74=0xce;}_0x1b3920[_0xaba3('0x1f')](_0x5e7d74);return _0x1b3920[_0xaba3('0x20')](_0xaba3('0x21'),_0x1a2cd9+'-'+_0xcc2ebf+'/'+_0x1583bf)['json'](_0x31da1e);}return null;};}function patchUpdates(_0x20d70e){return function(_0x411c7a){try{jsonpatch[_0xaba3('0x22')](_0x411c7a,_0x20d70e,!![]);}catch(_0x289464){return BPromise[_0xaba3('0x23')](_0x289464);}return _0x411c7a[_0xaba3('0x24')]();};}function saveUpdates(_0x5d2341,_0x73be00){return function(_0x5070f3){if(_0x5070f3){return _0x5070f3[_0xaba3('0x25')](_0x5d2341)[_0xaba3('0x26')](function(_0x5af2c4){return _0x5af2c4;});}return null;};}function removeEntity(_0x2c77e0,_0x38cc9b){return function(_0x1aeb77){if(_0x1aeb77){return _0x1aeb77[_0xaba3('0x27')]()[_0xaba3('0x26')](function(){var _0x4226c0=_0x1aeb77[_0xaba3('0x28')]({'plain':!![]});var _0xfcc6e9=_0xaba3('0x29');return db['UserProfileResource'][_0xaba3('0x27')]({'where':{'type':_0xfcc6e9,'resourceId':_0x4226c0['id']}})[_0xaba3('0x26')](function(){return _0x1aeb77;});})[_0xaba3('0x26')](function(){_0x2c77e0[_0xaba3('0x1f')](0xcc)[_0xaba3('0x2a')]();});}};}function handleEntityNotFound(_0x492d3a,_0x51a88d){return function(_0x2176d0){if(!_0x2176d0){_0x492d3a[_0xaba3('0x1a')](0x194);}return _0x2176d0;};}function handleError(_0xa86f46,_0x5e4e01){_0x5e4e01=_0x5e4e01||0x1f4;return function(_0x47f436){logger[_0xaba3('0x2b')](_0x47f436['stack']);if(_0x47f436[_0xaba3('0x2c')]){delete _0x47f436[_0xaba3('0x2c')];}_0xa86f46[_0xaba3('0x1f')](_0x5e4e01)[_0xaba3('0x2d')](_0x47f436);};}exports[_0xaba3('0x2e')]=function(_0x42dcfb,_0x3ec29c){var _0x409042={},_0x39fc95={},_0x969b00={'count':0x0,'rows':[]};var _0x43fc68=_[_0xaba3('0x2f')](db[_0xaba3('0x30')][_0xaba3('0x31')],function(_0x596ae2){return{'name':_0x596ae2[_0xaba3('0x32')],'type':_0x596ae2[_0xaba3('0x33')][_0xaba3('0x34')]};});_0x39fc95[_0xaba3('0x35')]=_[_0xaba3('0x2f')](_0x43fc68,'name');_0x39fc95[_0xaba3('0x36')]=_['keys'](_0x42dcfb[_0xaba3('0x36')]);_0x39fc95['filters']=_['intersection'](_0x39fc95[_0xaba3('0x35')],_0x39fc95[_0xaba3('0x36')]);_0x409042[_0xaba3('0x37')]=_[_0xaba3('0x38')](_0x39fc95[_0xaba3('0x35')],qs[_0xaba3('0x39')](_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x39')]));_0x409042[_0xaba3('0x37')]=_0x409042[_0xaba3('0x37')][_0xaba3('0x3a')]?_0x409042[_0xaba3('0x37')]:_0x39fc95[_0xaba3('0x35')];if(!_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x3b')](_0xaba3('0x3c'))){_0x409042[_0xaba3('0x1e')]=qs[_0xaba3('0x1e')](_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x1e')]);_0x409042[_0xaba3('0x1b')]=qs['offset'](_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x1b')]);}_0x409042[_0xaba3('0x3d')]=qs[_0xaba3('0x3e')](_0x42dcfb[_0xaba3('0x36')]['sort']);_0x409042[_0xaba3('0x3f')]=qs[_0xaba3('0x40')](_[_0xaba3('0x41')](_0x42dcfb['query'],_0x39fc95[_0xaba3('0x40')]),_0x43fc68);if(_0x42dcfb[_0xaba3('0x36')]['filter']){_0x409042[_0xaba3('0x3f')]=_[_0xaba3('0x42')](_0x409042[_0xaba3('0x3f')],{'$or':_[_0xaba3('0x2f')](_0x43fc68,function(_0x4b6841){if(_0x4b6841[_0xaba3('0x33')]!==_0xaba3('0x43')){var _0x2f868a={};_0x2f868a[_0x4b6841['name']]={'$like':'%'+_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x44')]+'%'};return _0x2f868a;}})});}_0x409042=_[_0xaba3('0x42')]({},_0x409042,_0x42dcfb['options']);var _0x325709={'where':_0x409042[_0xaba3('0x3f')]};return db[_0xaba3('0x30')]['count'](_0x325709)[_0xaba3('0x26')](function(_0x3a3b60){_0x969b00[_0xaba3('0x1d')]=_0x3a3b60;if(_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x45')]){_0x409042[_0xaba3('0x46')]=[{'all':!![]}];}return db[_0xaba3('0x30')]['findAll'](_0x409042);})[_0xaba3('0x26')](function(_0x44cfb2){_0x969b00['rows']=_0x44cfb2;return _0x969b00;})['then'](respondWithFilteredResult(_0x3ec29c,_0x409042))[_0xaba3('0x47')](handleError(_0x3ec29c,null));};exports[_0xaba3('0x48')]=function(_0x32c54e,_0x4c01db){var _0x5b375a={'raw':![],'where':{'id':_0x32c54e[_0xaba3('0x49')]['id']}},_0x1b7245={};_0x1b7245[_0xaba3('0x35')]=_[_0xaba3('0x4a')](db[_0xaba3('0x30')][_0xaba3('0x31')]);_0x1b7245[_0xaba3('0x36')]=_[_0xaba3('0x4a')](_0x32c54e[_0xaba3('0x36')]);_0x1b7245['filters']=_['intersection'](_0x1b7245['model'],_0x1b7245[_0xaba3('0x36')]);_0x5b375a[_0xaba3('0x37')]=_[_0xaba3('0x38')](_0x1b7245[_0xaba3('0x35')],qs[_0xaba3('0x39')](_0x32c54e[_0xaba3('0x36')][_0xaba3('0x39')]));_0x5b375a[_0xaba3('0x37')]=_0x5b375a[_0xaba3('0x37')][_0xaba3('0x3a')]?_0x5b375a[_0xaba3('0x37')]:_0x1b7245[_0xaba3('0x35')];if(_0x32c54e[_0xaba3('0x36')][_0xaba3('0x45')]){_0x5b375a[_0xaba3('0x46')]=[{'all':!![]}];}_0x5b375a=_[_0xaba3('0x42')]({},_0x5b375a,_0x32c54e[_0xaba3('0x4b')]);return db[_0xaba3('0x30')]['find'](_0x5b375a)[_0xaba3('0x26')](handleEntityNotFound(_0x4c01db,null))[_0xaba3('0x26')](respondWithResult(_0x4c01db,null))['catch'](handleError(_0x4c01db,null));};exports[_0xaba3('0x4c')]=function(_0x1c346f,_0x50cad0){return db[_0xaba3('0x30')]['create'](_0x1c346f[_0xaba3('0x4d')],{})[_0xaba3('0x26')](function(_0x47abec){var _0x27f3bf=_0x1c346f[_0xaba3('0x4e')][_0xaba3('0x28')]({'plain':!![]});if(!_0x27f3bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27f3bf[_0xaba3('0x4f')]===_0xaba3('0x4e')){var _0x361f4a=_0x47abec[_0xaba3('0x28')]({'plain':!![]});var _0x4168a6=_0xaba3('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x4168a6,'userProfileId':_0x27f3bf[_0xaba3('0x51')]},'raw':!![]})[_0xaba3('0x26')](function(_0x48c97b){if(_0x48c97b&&_0x48c97b[_0xaba3('0x52')]===0x0){return db[_0xaba3('0x53')][_0xaba3('0x4c')]({'name':_0x361f4a[_0xaba3('0x2c')],'resourceId':_0x361f4a['id'],'type':'CustomReports','sectionId':_0x48c97b['id']},{})[_0xaba3('0x26')](function(){return _0x47abec;});}else{return _0x47abec;}})[_0xaba3('0x47')](function(_0x5c400c){logger[_0xaba3('0x2b')](_0xaba3('0x54'),_0x5c400c);throw _0x5c400c;});}return _0x47abec;})[_0xaba3('0x26')](respondWithResult(_0x50cad0,0xc9))['catch'](handleError(_0x50cad0,null));};exports[_0xaba3('0x25')]=function(_0x532848,_0x4f2c20){if(_0x532848[_0xaba3('0x4d')]['id']){delete _0x532848[_0xaba3('0x4d')]['id'];}return db['AnalyticCustomReport'][_0xaba3('0x55')]({'where':{'id':_0x532848[_0xaba3('0x49')]['id']}})[_0xaba3('0x26')](handleEntityNotFound(_0x4f2c20,null))['then'](saveUpdates(_0x532848['body'],null))[_0xaba3('0x26')](respondWithResult(_0x4f2c20,null))[_0xaba3('0x47')](handleError(_0x4f2c20,null));};exports[_0xaba3('0x27')]=function(_0x2effca,_0x5dc116){return db[_0xaba3('0x30')][_0xaba3('0x55')]({'where':{'id':_0x2effca[_0xaba3('0x49')]['id']}})[_0xaba3('0x26')](handleEntityNotFound(_0x5dc116,null))['then'](removeEntity(_0x5dc116,null))[_0xaba3('0x47')](handleError(_0x5dc116,null));};exports[_0xaba3('0x56')]=function(_0x50191e,_0x526b74){var _0x2f036f=0xa;var _0x370626=['join',_0xaba3('0x57'),'right_join',_0xaba3('0x58')];var _0x4cbbc5={'SUM':_0xaba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xaba3('0x5a'),'MAX':_0xaba3('0x5b'),'MIN':'MIN(%s)','AVG':_0xaba3('0x5c'),'GROUP_CONCAT':_0xaba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xaba3('0x5e')};var _0x15eb02={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xaba3('0x5f'),'HOUR':_0xaba3('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xaba3('0x61')};var _0x5ed98d=function(_0x2f8791){return!_[_0xaba3('0x62')](['IS\x20NULL',_0xaba3('0x63'),'IS\x20EMPTY',_0xaba3('0x64')],_0x2f8791);};var _0x2155dc=function(_0x182f9a){if(!_0x182f9a||!_0x182f9a[_0xaba3('0x65')][_0xaba3('0x3a')]){return'';}for(var _0x1b1208='(',_0x201f57=0x0;_0x201f57<_0x182f9a['rules'][_0xaba3('0x3a')];_0x201f57+=0x1){_0x201f57>0x0&&(_0x1b1208+='\x20'+_0x182f9a[_0xaba3('0x66')]+'\x20');_0x1b1208+=_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x67')]?_0x2155dc(_0x182f9a['rules'][_0x201f57][_0xaba3('0x67')]):_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x68')]+'\x20'+_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x69')]+(_0x5ed98d(_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x69')])?'\x20'+_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x6a')]:'');}return _0x1b1208+')';};var _0x20feb7={'where':{'id':_0x50191e[_0xaba3('0x49')]['id']}},_0x1aba02,_0x329afc,_0x525ddf,_0x5df91a,_0x12b2eb;_0x20feb7=_['merge']({},_0x20feb7,_0x50191e[_0xaba3('0x4b')]);return db[_0xaba3('0x30')]['find'](_0x20feb7)['then'](function(_0x193e10){if(_0x193e10){_0x1aba02=_0x193e10;return _0x193e10['getFields']();}return null;})[_0xaba3('0x26')](function(_0x4181ea){if(_0x4181ea){if(!_0x4181ea[_0xaba3('0x3a')]){throw new db[(_0xaba3('0x6b'))][(_0xaba3('0x6c'))](_0xaba3('0x6d'),0x193);}_0x329afc=_0x4181ea;return db[_0xaba3('0x6e')][_0xaba3('0x6f')]({'raw':!![]});}return null;})['then'](function(_0x5f2e55){if(_0x5f2e55){_0x525ddf=_['keyBy'](_0x5f2e55,'id');var _0x5f3fa1;var _0x42cbde=squel[_0xaba3('0x70')]();_0x42cbde[_0xaba3('0x71')](_0x1aba02[_0xaba3('0x72')]);for(var _0x6ad674=0x0;_0x6ad674<_0x329afc[_0xaba3('0x3a')];_0x6ad674+=0x1){_0x5f3fa1=_0x329afc[_0x6ad674][_0xaba3('0x73')]?_0x525ddf[_0x329afc[_0x6ad674][_0xaba3('0x73')]][_0xaba3('0x74')]:_0x329afc[_0x6ad674][_0xaba3('0x68')];_0x5f3fa1=_0x329afc[_0x6ad674]['function']?_[_0xaba3('0x75')](_0x4cbbc5[_0x329afc[_0x6ad674][_0xaba3('0x76')]],'%s',_0x5f3fa1):_0x5f3fa1;_0x5f3fa1=_0x329afc[_0x6ad674]['format']?_[_0xaba3('0x75')](_0x15eb02[_0x329afc[_0x6ad674]['format']],'%s',_0x5f3fa1):_0x5f3fa1;if(_0x329afc[_0x6ad674][_0xaba3('0x77')]){_0x42cbde['group'](_0x5f3fa1);}_0x329afc[_0x6ad674]['orderBy']&&_0x42cbde['order'](_0x5f3fa1,_0x329afc[_0x6ad674][_0xaba3('0x78')]===_0xaba3('0x79')?![]:!![]);_0x42cbde[_0xaba3('0x68')](_0x5f3fa1,_0x329afc[_0x6ad674][_0xaba3('0x7a')]||_0x5f3fa1);}if(_0x1aba02['joins']){_0x1aba02[_0xaba3('0x7b')]=JSON[_0xaba3('0x7c')](_0x1aba02[_0xaba3('0x7b')]);for(var _0x8e559=0x0;_0x8e559<_0x1aba02[_0xaba3('0x7b')][_0xaba3('0x3a')];_0x8e559+=0x1){if(_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x33')]&&_[_0xaba3('0x62')](_0x370626,_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x33')])&&_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7d')]&&_0x1aba02['joins'][_0x8e559]['foreignTable']&&_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7e')]){_0x42cbde[_0x1aba02['joins'][_0x8e559][_0xaba3('0x33')]](_0x1aba02['joins'][_0x8e559][_0xaba3('0x7f')],null,util['format'](_0xaba3('0x80'),_0x1aba02[_0xaba3('0x72')],_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7d')],_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7f')],_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7e')]));}}}if(_0x1aba02['conditions']){_0x1aba02['conditions']=JSON[_0xaba3('0x7c')](_0x1aba02[_0xaba3('0x81')]);_0x42cbde[_0xaba3('0x3f')](_0x2155dc(_0x1aba02[_0xaba3('0x81')]['group']));}_0x12b2eb=_0x42cbde[_0xaba3('0x82')]();_0x42cbde['limit'](_0x2f036f);_0x42cbde['offset'](0x0);logger[_0xaba3('0x83')](_0xaba3('0x84'),_0x42cbde[_0xaba3('0x85')]());return dbH[_0xaba3('0x86')][_0xaba3('0x36')](_0x42cbde[_0xaba3('0x85')](),{'type':dbH['sequelize'][_0xaba3('0x87')][_0xaba3('0x88')]});}})[_0xaba3('0x26')](respondWithResult(_0x526b74,null))[_0xaba3('0x47')](handleError(_0x526b74,null));};function runReport(_0x3d9aa7,_0x4f5d51,_0x31111d){var _0x4a7a10=_0x4f5d51[_0xaba3('0x2c')];var _0x4be6b8=0xa;var _0x5836aa=[_0xaba3('0x89'),'left_join',_0xaba3('0x8a'),_0xaba3('0x58')];var _0x261961={'SUM':_0xaba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xaba3('0x5b'),'MIN':'MIN(%s)','AVG':_0xaba3('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xaba3('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x133ba7={'SEC_TO_TIME':_0xaba3('0x8c'),'DATE':_0xaba3('0x5f'),'HOUR':_0xaba3('0x60'),'ROUND':_0xaba3('0x8d'),'UNIX_TIMESTAMP':_0xaba3('0x61')};var _0x279871=function(_0x360e44){return!_[_0xaba3('0x62')]([_0xaba3('0x8e'),_0xaba3('0x63'),'IS\x20EMPTY',_0xaba3('0x64')],_0x360e44);};var _0x3c95f6=function(_0x13a4df){if(!_0x13a4df||!_0x13a4df[_0xaba3('0x65')][_0xaba3('0x3a')]){return'';}for(var _0x37ff77='(',_0x409274=0x0;_0x409274<_0x13a4df['rules'][_0xaba3('0x3a')];_0x409274+=0x1){_0x409274>0x0&&(_0x37ff77+='\x20'+_0x13a4df[_0xaba3('0x66')]+'\x20');_0x37ff77+=_0x13a4df[_0xaba3('0x65')][_0x409274][_0xaba3('0x67')]?_0x3c95f6(_0x13a4df['rules'][_0x409274]['group']):_0x13a4df['rules'][_0x409274]['field']+'\x20'+_0x13a4df['rules'][_0x409274][_0xaba3('0x69')]+(_0x279871(_0x13a4df[_0xaba3('0x65')][_0x409274][_0xaba3('0x69')])?'\x20'+_0x13a4df[_0xaba3('0x65')][_0x409274][_0xaba3('0x6a')]:'');}return _0x37ff77+')';};var _0x5b50a3={'where':{'id':_0x3d9aa7['id']}},_0x37c9c5,_0x10be6e,_0x5a4d0e,_0x217236,_0x261a81;_0x5b50a3=_['merge']({},_0x5b50a3,_0x31111d);return db[_0xaba3('0x30')][_0xaba3('0x55')](_0x5b50a3)[_0xaba3('0x26')](function(_0x36ad9d){if(_0x36ad9d){_0x37c9c5=_0x36ad9d;return _0x36ad9d[_0xaba3('0x8f')]();}return null;})['then'](function(_0x558bd6){if(_0x558bd6){if(!_0x558bd6['length']){throw new db[(_0xaba3('0x6b'))]['ValidationErrorItem'](_0xaba3('0x6d'),0x193);}_0x10be6e=_0x558bd6;return db[_0xaba3('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xaba3('0x26')](function(_0x5027a6){if(_0x5027a6){_0x5a4d0e=_['keyBy'](_0x5027a6,'id');var _0x41a28b;var _0x280e08=squel[_0xaba3('0x70')]();_0x280e08['from'](_0x37c9c5[_0xaba3('0x72')]);for(var _0x52b565=0x0;_0x52b565<_0x10be6e['length'];_0x52b565+=0x1){_0x41a28b=_0x10be6e[_0x52b565]['MetricId']?_0x5a4d0e[_0x10be6e[_0x52b565]['MetricId']][_0xaba3('0x74')]:_0x10be6e[_0x52b565][_0xaba3('0x68')];_0x41a28b=_0x10be6e[_0x52b565][_0xaba3('0x76')]?_[_0xaba3('0x75')](_0x261961[_0x10be6e[_0x52b565][_0xaba3('0x76')]],'%s',_0x41a28b):_0x41a28b;_0x41a28b=_0x10be6e[_0x52b565][_0xaba3('0x90')]?_['replace'](_0x133ba7[_0x10be6e[_0x52b565][_0xaba3('0x90')]],'%s',_0x41a28b):_0x41a28b;if(_0x10be6e[_0x52b565][_0xaba3('0x77')]){_0x280e08['group'](_0x41a28b);}_0x10be6e[_0x52b565]['orderBy']&&_0x280e08[_0xaba3('0x3d')](_0x41a28b,_0x10be6e[_0x52b565]['orderBy']===_0xaba3('0x79')?![]:!![]);_0x280e08[_0xaba3('0x68')](_0x41a28b,_0x10be6e[_0x52b565][_0xaba3('0x7a')]||_0x41a28b);}if(_0x37c9c5['joins']){_0x37c9c5['joins']=JSON['parse'](_0x37c9c5[_0xaba3('0x7b')]);for(var _0x381753=0x0;_0x381753<_0x37c9c5[_0xaba3('0x7b')]['length'];_0x381753+=0x1){if(_0x37c9c5[_0xaba3('0x7b')][_0x381753]['type']&&_[_0xaba3('0x62')](_0x5836aa,_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x33')])&&_0x37c9c5[_0xaba3('0x7b')][_0x381753]['parentKey']&&_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7f')]&&_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7e')]){_0x280e08[_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x33')]](_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7f')],null,util[_0xaba3('0x90')](_0xaba3('0x80'),_0x37c9c5[_0xaba3('0x72')],_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7d')],_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7f')],_0x37c9c5[_0xaba3('0x7b')][_0x381753]['foreignKey']));}}}if(_0x37c9c5[_0xaba3('0x81')]){_0x37c9c5[_0xaba3('0x81')]=JSON['parse'](_0x37c9c5[_0xaba3('0x81')]);_0x280e08[_0xaba3('0x3f')](_0x3c95f6(_0x37c9c5[_0xaba3('0x81')][_0xaba3('0x67')]));}_0x261a81=_0x280e08[_0xaba3('0x82')]();_0x280e08['limit'](_0x4be6b8);_0x280e08[_0xaba3('0x1b')](0x0);return;}})[_0xaba3('0x26')](function(){if(_0x4f5d51[_0xaba3('0x91')]===_0xaba3('0x92')){return null;}var _0x521baa=_[_0xaba3('0x42')](_0x4f5d51,{'name':_0x4f5d51['fullPath']||_0x4f5d51[_0xaba3('0x2c')]||_0x37c9c5['name'],'basename':_0x4a7a10,'savename':util[_0xaba3('0x90')](_0xaba3('0x93'),_0x4f5d51[_0xaba3('0x2c')]||_0x37c9c5[_0xaba3('0x2c')],require(_0xaba3('0x94'))[_0xaba3('0x95')](0x4),_0x4f5d51[_0xaba3('0x91')]||_0xaba3('0x96')),'reportId':_0x37c9c5['id'],'reportType':_0xaba3('0x97')});return db['AnalyticExtractedReport'][_0xaba3('0x4c')](_0x521baa,{'raw':!![]});})[_0xaba3('0x26')](function(_0x39368f){if(_0x37c9c5['table']===_0xaba3('0x98')){_0x261a81['where'](_0x37c9c5[_0xaba3('0x72')]+_0xaba3('0x99'),_0x4f5d51[_0xaba3('0x9a')],_0x4f5d51[_0xaba3('0x9b')]);}else{_0x261a81['where'](_0x37c9c5[_0xaba3('0x72')]+_0xaba3('0x9c'),_0x4f5d51[_0xaba3('0x9a')],_0x4f5d51['endDate']);}if(_0x39368f){logger['info'](_0xaba3('0x9d'),_0x261a81[_0xaba3('0x85')]());require(_0xaba3('0x9e'))[_0xaba3('0x9f')](path[_0xaba3('0x89')](__dirname,_0xaba3('0xa0'),_0x39368f[_0xaba3('0x91')]),[_0x39368f['id'],_0x261a81[_0xaba3('0x85')](),path[_0xaba3('0x89')](__dirname,'../../files/reports',_0x39368f[_0xaba3('0xa1')]),_0x4a7a10]);return _0x39368f;}else{var _0x17f3d8=squel[_0xaba3('0x70')]();_0x17f3d8[_0xaba3('0x71')]('('+_0x261a81[_0xaba3('0x85')]()+')',_0xaba3('0xa2'));_0x17f3d8[_0xaba3('0x68')](_0xaba3('0xa3'),'count');_0x261a81['limit'](_0x4f5d51['limit']||_0x4be6b8);_0x261a81[_0xaba3('0x1b')](_0x4f5d51['offset']||0x0);return dbH['sequelize'][_0xaba3('0x36')](_0x17f3d8[_0xaba3('0x85')](),{'type':dbH[_0xaba3('0x86')]['QueryTypes'][_0xaba3('0x88')]})['then'](function(_0x4e9975){if(!_0x4e9975[_0xaba3('0x3a')]){_0x217236=0x0;}else{_0x217236=_0x4e9975[0x0]['count']||0x0;}return dbH[_0xaba3('0x86')][_0xaba3('0x36')](_0x261a81[_0xaba3('0x85')](),{'type':dbH[_0xaba3('0x86')]['QueryTypes']['SELECT']});})['then'](function(_0xc36b06){return{'rows':_0xc36b06||[],'count':_0x217236};});}});}exports[_0xaba3('0xa4')]=function(_0x18feb5,_0x367727){return runReport(_0x18feb5['params'],_0x18feb5[_0xaba3('0x36')],_0x18feb5[_0xaba3('0x4b')])[_0xaba3('0x26')](respondWithResult(_0x367727,null))[_0xaba3('0x47')](handleError(_0x367727,null));};exports[_0xaba3('0xa5')]=runReport;exports['query']=function(_0x551071,_0x257ef5){var _0x40d0ae=0xa;var _0x2eef50=[_0xaba3('0x89'),_0xaba3('0x57'),'right_join','cross_join'];var _0x1851ec={'SUM':_0xaba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xaba3('0x5a'),'MAX':_0xaba3('0x5b'),'MIN':_0xaba3('0xa6'),'AVG':_0xaba3('0x5c'),'GROUP_CONCAT':_0xaba3('0x5d'),'GROUP_CONCAT ASC':_0xaba3('0x8b'),'GROUP_CONCAT DESC':_0xaba3('0x5e')};var _0x373247={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xaba3('0x5f'),'HOUR':_0xaba3('0x60'),'ROUND':_0xaba3('0x8d'),'UNIX_TIMESTAMP':_0xaba3('0x61')};var _0x2b3c0f=function(_0x4b6dac){return!_[_0xaba3('0x62')]([_0xaba3('0x8e'),_0xaba3('0x63'),_0xaba3('0xa7'),_0xaba3('0x64')],_0x4b6dac);};var _0x46a1d4=function(_0x330289){if(!_0x330289||!_0x330289[_0xaba3('0x65')][_0xaba3('0x3a')]){return'';}for(var _0x229e1a='(',_0xeb1e04=0x0;_0xeb1e04<_0x330289[_0xaba3('0x65')][_0xaba3('0x3a')];_0xeb1e04+=0x1){_0xeb1e04>0x0&&(_0x229e1a+='\x20'+_0x330289['operator']+'\x20');_0x229e1a+=_0x330289[_0xaba3('0x65')][_0xeb1e04]['group']?_0x46a1d4(_0x330289[_0xaba3('0x65')][_0xeb1e04][_0xaba3('0x67')]):_0x330289[_0xaba3('0x65')][_0xeb1e04]['field']+'\x20'+_0x330289[_0xaba3('0x65')][_0xeb1e04]['condition']+(_0x2b3c0f(_0x330289[_0xaba3('0x65')][_0xeb1e04][_0xaba3('0x69')])?'\x20'+_0x330289['rules'][_0xeb1e04][_0xaba3('0x6a')]:'');}return _0x229e1a+')';};var _0x3a2404={'where':{'id':_0x551071['params']['id']}},_0x57d892,_0x1c8702,_0x3f0f6f,_0x146ed7,_0x4a78a4;_0x3a2404=_['merge']({},_0x3a2404,_0x551071[_0xaba3('0x4b')]);return db['AnalyticCustomReport'][_0xaba3('0x55')](_0x3a2404)[_0xaba3('0x26')](function(_0x25efd9){if(_0x25efd9){_0x57d892=_0x25efd9;return _0x25efd9['getFields']();}return null;})[_0xaba3('0x26')](function(_0x11b878){if(_0x11b878){if(!_0x11b878[_0xaba3('0x3a')]){throw new db['Sequelize'][(_0xaba3('0x6c'))](_0xaba3('0x6d'),0x193);}_0x1c8702=_0x11b878;return db[_0xaba3('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xaba3('0x26')](function(_0x4b177c){if(_0x4b177c){_0x3f0f6f=_['keyBy'](_0x4b177c,'id');var _0x56ed59;var _0x226779=squel['select']();_0x226779[_0xaba3('0x71')](_0x57d892[_0xaba3('0x72')]);for(var _0x4190b4=0x0;_0x4190b4<_0x1c8702[_0xaba3('0x3a')];_0x4190b4+=0x1){_0x56ed59=_0x1c8702[_0x4190b4][_0xaba3('0x73')]?_0x3f0f6f[_0x1c8702[_0x4190b4][_0xaba3('0x73')]][_0xaba3('0x74')]:_0x1c8702[_0x4190b4][_0xaba3('0x68')];_0x56ed59=_0x1c8702[_0x4190b4][_0xaba3('0x76')]?_[_0xaba3('0x75')](_0x1851ec[_0x1c8702[_0x4190b4][_0xaba3('0x76')]],'%s',_0x56ed59):_0x56ed59;_0x56ed59=_0x1c8702[_0x4190b4]['format']?_[_0xaba3('0x75')](_0x373247[_0x1c8702[_0x4190b4]['format']],'%s',_0x56ed59):_0x56ed59;if(_0x1c8702[_0x4190b4]['groupBy']){_0x226779['group'](_0x56ed59);}_0x1c8702[_0x4190b4]['orderBy']&&_0x226779[_0xaba3('0x3d')](_0x56ed59,_0x1c8702[_0x4190b4][_0xaba3('0x78')]===_0xaba3('0x79')?![]:!![]);_0x226779[_0xaba3('0x68')](_0x56ed59,_0x1c8702[_0x4190b4]['alias']||_0x56ed59);}if(_0x57d892['joins']){_0x57d892['joins']=JSON[_0xaba3('0x7c')](_0x57d892[_0xaba3('0x7b')]);for(var _0x1bab1b=0x0;_0x1bab1b<_0x57d892['joins'][_0xaba3('0x3a')];_0x1bab1b+=0x1){if(_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x33')]&&_[_0xaba3('0x62')](_0x2eef50,_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x33')])&&_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7d')]&&_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7f')]&&_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7e')]){_0x226779[_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x33')]](_0x57d892[_0xaba3('0x7b')][_0x1bab1b]['foreignTable'],null,util[_0xaba3('0x90')](_0xaba3('0x80'),_0x57d892['table'],_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7d')],_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7f')],_0x57d892['joins'][_0x1bab1b][_0xaba3('0x7e')]));}}}if(_0x57d892[_0xaba3('0x81')]){_0x57d892[_0xaba3('0x81')]=JSON[_0xaba3('0x7c')](_0x57d892[_0xaba3('0x81')]);_0x226779[_0xaba3('0x3f')](_0x46a1d4(_0x57d892[_0xaba3('0x81')][_0xaba3('0x67')]));}_0x4a78a4=_0x226779[_0xaba3('0x82')]();_0x226779[_0xaba3('0x1e')](_0x40d0ae);_0x226779[_0xaba3('0x1b')](0x0);logger['debug'](_0xaba3('0x84'),_0x226779[_0xaba3('0x85')]());return dbH['sequelize'][_0xaba3('0x36')](_0x226779['toString'](),{'type':dbH[_0xaba3('0x86')][_0xaba3('0x87')][_0xaba3('0x88')]});}})[_0xaba3('0x26')](function(){return{'sql':_0x4a78a4[_0xaba3('0x85')]()};})['then'](respondWithResult(_0x257ef5,null))['catch'](handleError(_0x257ef5,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 09e2e64..5e1f4f6 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 _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 +var _0xf01a=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xf01a,0x9b));var _0xaf01=function(_0x4ab2d9,_0x707e21){_0x4ab2d9=_0x4ab2d9-0x0;var _0x16f489=_0xf01a[_0x4ab2d9];return _0x16f489;};'use strict';var _=require(_0xaf01('0x0'));var util=require(_0xaf01('0x1'));var logger=require(_0xaf01('0x2'))(_0xaf01('0x3'));var moment=require(_0xaf01('0x4'));var BPromise=require(_0xaf01('0x5'));var rp=require(_0xaf01('0x6'));var fs=require('fs');var path=require(_0xaf01('0x7'));var rimraf=require(_0xaf01('0x8'));var config=require(_0xaf01('0x9'));var attributes=require(_0xaf01('0xa'));module[_0xaf01('0xb')]=function(_0x4d14b3,_0x179b11){return _0x4d14b3['define'](_0xaf01('0xc'),attributes,{'tableName':_0xaf01('0xd'),'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 2b4d6b0..57890e6 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 _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 +var _0x224d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x224d,0xe3));var _0xd224=function(_0x2e0748,_0x55284){_0x2e0748=_0x2e0748-0x0;var _0x15d429=_0x224d[_0x2e0748];return _0x15d429;};'use strict';var _=require(_0xd224('0x0'));var util=require(_0xd224('0x1'));var moment=require(_0xd224('0x2'));var BPromise=require(_0xd224('0x3'));var rs=require(_0xd224('0x4'));var fs=require('fs');var Redis=require(_0xd224('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd224('0x6'));var logger=require(_0xd224('0x7'))(_0xd224('0x8'));var config=require(_0xd224('0x9'));var jayson=require(_0xd224('0xa'));var client=jayson[_0xd224('0xb')][_0xd224('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x327ade,_0x3a73b8,_0x3ab7ec){return new BPromise(function(_0x10f5fd,_0x561153){return client[_0xd224('0xd')](_0x327ade,_0x3ab7ec)[_0xd224('0xe')](function(_0x1c8cfa){logger[_0xd224('0xf')](_0xd224('0x10'),_0x3a73b8,_0xd224('0x11'));logger['debug'](_0xd224('0x12'),_0x3a73b8,_0xd224('0x11'),JSON[_0xd224('0x13')](_0x1c8cfa));if(_0x1c8cfa[_0xd224('0x14')]){if(_0x1c8cfa[_0xd224('0x14')]['code']===0x1f4){logger[_0xd224('0x14')](_0xd224('0x10'),_0x3a73b8,_0x1c8cfa[_0xd224('0x14')][_0xd224('0x15')]);return _0x561153(_0x1c8cfa[_0xd224('0x14')]['message']);}logger[_0xd224('0x14')](_0xd224('0x10'),_0x3a73b8,_0x1c8cfa[_0xd224('0x14')][_0xd224('0x15')]);return _0x10f5fd(_0x1c8cfa[_0xd224('0x14')][_0xd224('0x15')]);}else{logger[_0xd224('0xf')](_0xd224('0x10'),_0x3a73b8,'request\x20sent');_0x10f5fd(_0x1c8cfa['result']['message']);}})[_0xd224('0x16')](function(_0x4a6222){logger['error'](_0xd224('0x10'),_0x3a73b8,_0x4a6222);_0x561153(_0x4a6222);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ddc9d8a..81e810c 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 _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 +var _0xf602=['create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','run','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf602,0xf9));var _0x2f60=function(_0x313b86,_0x48a1da){_0x313b86=_0x313b86-0x0;var _0x333462=_0xf602[_0x313b86];return _0x333462;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2f60('0x0'));var timeout=require(_0x2f60('0x1'));var express=require(_0x2f60('0x2'));var router=express[_0x2f60('0x3')]();var fs_extra=require(_0x2f60('0x4'));var auth=require(_0x2f60('0x5'));var interaction=require(_0x2f60('0x6'));var config=require('../../config/environment');var controller=require(_0x2f60('0x7'));router[_0x2f60('0x8')]('/',auth[_0x2f60('0x9')](),controller[_0x2f60('0xa')]);router['get']('/:id',auth[_0x2f60('0x9')](),controller[_0x2f60('0xb')]);router[_0x2f60('0x8')](_0x2f60('0xc'),auth[_0x2f60('0x9')](),controller['preview']);router[_0x2f60('0x8')]('/:id/run',auth[_0x2f60('0x9')](),controller[_0x2f60('0xd')]);router[_0x2f60('0x8')]('/:id/query',auth[_0x2f60('0x9')](),controller[_0x2f60('0xe')]);router['post']('/',auth[_0x2f60('0x9')](),controller[_0x2f60('0xf')]);router[_0x2f60('0x10')]('/:id',auth[_0x2f60('0x9')](),controller[_0x2f60('0x11')]);router[_0x2f60('0x12')](_0x2f60('0x13'),auth[_0x2f60('0x9')](),controller[_0x2f60('0x14')]);module[_0x2f60('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a1009b1..a901069 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 _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 +var _0xda19=['exports','STRING','TEXT'];(function(_0xa4a370,_0x3d1946){var _0x21efa4=function(_0x1783c7){while(--_0x1783c7){_0xa4a370['push'](_0xa4a370['shift']());}};_0x21efa4(++_0x3d1946);}(_0xda19,0xd5));var _0x9da1=function(_0x8821a8,_0x4be205){_0x8821a8=_0x8821a8-0x0;var _0x1e443c=_0xda19[_0x8821a8];return _0x1e443c;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 08fb0e4..b9f71fc 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 _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 +var _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0xbc9b7f,_0x4cc6f9){var _0x1bd96f=function(_0x4573b9){while(--_0x4573b9){_0xbc9b7f['push'](_0xbc9b7f['shift']());}};_0x1bd96f(++_0x4cc6f9);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x53a963,_0x3079f2){_0x53a963=_0x53a963-0x0;var _0x13fb39=_0x3f8a[_0x53a963];return _0x13fb39;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 23d3c7d..49cfdf6 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 _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 +var _0x8412=['rimraf','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1fc018,_0x5ea2e6){var _0xdddf7b=function(_0x287a5b){while(--_0x287a5b){_0x1fc018['push'](_0x1fc018['shift']());}};_0xdddf7b(++_0x5ea2e6);}(_0x8412,0xc0));var _0x2841=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x8412[_0x102f97];return _0xd22058;};'use strict';var _=require(_0x2841('0x0'));var util=require(_0x2841('0x1'));var logger=require(_0x2841('0x2'))(_0x2841('0x3'));var moment=require(_0x2841('0x4'));var BPromise=require('bluebird');var rp=require(_0x2841('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2841('0x6'));var config=require('../../config/environment');var attributes=require(_0x2841('0x7'));module[_0x2841('0x8')]=function(_0x51c440,_0x2c1ee7){return _0x51c440['define'](_0x2841('0x9'),attributes,{'tableName':_0x2841('0xa'),'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 f9bc598..33f8410 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 _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 +var _0x307b=['client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x42115e,_0x3a3b4d){var _0x221c8e=function(_0x23cf81){while(--_0x23cf81){_0x42115e['push'](_0x42115e['shift']());}};_0x221c8e(++_0x3a3b4d);}(_0x307b,0x156));var _0xb307=function(_0xa10d08,_0xedde0){_0xa10d08=_0xa10d08-0x0;var _0x5b48df=_0x307b[_0xa10d08];return _0x5b48df;};'use strict';var _=require(_0xb307('0x0'));var util=require(_0xb307('0x1'));var moment=require(_0xb307('0x2'));var BPromise=require(_0xb307('0x3'));var rs=require(_0xb307('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb307('0x5'))['db'];var utils=require(_0xb307('0x6'));var logger=require(_0xb307('0x7'))('rpc');var config=require(_0xb307('0x8'));var jayson=require(_0xb307('0x9'));var client=jayson[_0xb307('0xa')][_0xb307('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37f397,_0x484cfa,_0x36c70a){return new BPromise(function(_0x66df32,_0x42517e){return client[_0xb307('0xc')](_0x37f397,_0x36c70a)['then'](function(_0x1db8e1){logger[_0xb307('0xd')](_0xb307('0xe'),_0x484cfa,_0xb307('0xf'));logger[_0xb307('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x484cfa,_0xb307('0xf'),JSON[_0xb307('0x11')](_0x1db8e1));if(_0x1db8e1[_0xb307('0x12')]){if(_0x1db8e1[_0xb307('0x12')][_0xb307('0x13')]===0x1f4){logger[_0xb307('0x12')](_0xb307('0xe'),_0x484cfa,_0x1db8e1['error']['message']);return _0x42517e(_0x1db8e1[_0xb307('0x12')][_0xb307('0x14')]);}logger['error'](_0xb307('0xe'),_0x484cfa,_0x1db8e1[_0xb307('0x12')][_0xb307('0x14')]);return _0x66df32(_0x1db8e1[_0xb307('0x12')][_0xb307('0x14')]);}else{logger[_0xb307('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x484cfa,_0xb307('0xf'));_0x66df32(_0x1db8e1['result'][_0xb307('0x14')]);}})[_0xb307('0x15')](function(_0x5c946a){logger[_0xb307('0x12')](_0xb307('0xe'),_0x484cfa,_0x5c946a);_0x42517e(_0x5c946a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f9d7edd..23e9b52 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 _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 +var _0xf433=['isAuthenticated','show','preview','/:id/run','/:id/query','create','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id'];(function(_0xbed931,_0x4fab0b){var _0x1ea640=function(_0x56a48d){while(--_0x56a48d){_0xbed931['push'](_0xbed931['shift']());}};_0x1ea640(++_0x4fab0b);}(_0xf433,0x198));var _0x3f43=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf433[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x3f43('0x0'));var path=require(_0x3f43('0x1'));var timeout=require(_0x3f43('0x2'));var express=require(_0x3f43('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3f43('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f43('0x5'));var controller=require(_0x3f43('0x6'));router[_0x3f43('0x7')]('/',auth['isAuthenticated'](),controller[_0x3f43('0x8')]);router['get'](_0x3f43('0x9'),auth[_0x3f43('0xa')](),controller[_0x3f43('0xb')]);router[_0x3f43('0x7')]('/:id/preview',auth[_0x3f43('0xa')](),controller[_0x3f43('0xc')]);router[_0x3f43('0x7')](_0x3f43('0xd'),auth[_0x3f43('0xa')](),controller['run']);router[_0x3f43('0x7')](_0x3f43('0xe'),auth[_0x3f43('0xa')](),controller['query']);router['post']('/',auth[_0x3f43('0xa')](),controller[_0x3f43('0xf')]);router['put']('/:id',auth[_0x3f43('0xa')](),controller[_0x3f43('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3f43('0x11')]);module[_0x3f43('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6477f73..744ca2b 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 _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 +var _0x2369=['STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports'];(function(_0x462b4f,_0x2f1c0e){var _0x24f643=function(_0x3cc960){while(--_0x3cc960){_0x462b4f['push'](_0x462b4f['shift']());}};_0x24f643(++_0x2f1c0e);}(_0x2369,0xb3));var _0x9236=function(_0xb60a95,_0xdb478f){_0xb60a95=_0xb60a95-0x0;var _0x2c876c=_0x2369[_0xb60a95];return _0x2c876c;};'use strict';var Sequelize=require(_0x9236('0x0'));var moment=require(_0x9236('0x1'));module[_0x9236('0x2')]={'name':{'type':Sequelize[_0x9236('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x9236('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x9236('0x4')]('csv',_0x9236('0x5'),_0x9236('0x6')),'allowNull':![],'defaultValue':_0x9236('0x7')},'savename':{'type':Sequelize[_0x9236('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9236('0x8')]},'endDate':{'type':Sequelize[_0x9236('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x9236('0x9')},'type':{'type':Sequelize[_0x9236('0x4')](_0x9236('0xa'),_0x9236('0xb')),'allowNull':![],'defaultValue':_0x9236('0xa')},'reportId':{'type':Sequelize[_0x9236('0xc')](0xb)[_0x9236('0xd')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6237e5f..518971d 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 _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 +var _0x6fa0=['join','format','%s.%s','toLowerCase','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists'];(function(_0x5adee8,_0x2c4f67){var _0x473002=function(_0xad680d){while(--_0xad680d){_0x5adee8['push'](_0x5adee8['shift']());}};_0x473002(++_0x2c4f67);}(_0x6fa0,0x1ee));var _0x06fa=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6fa0[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x06fa('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06fa('0x1'));var moment=require('moment');var BPromise=require(_0x06fa('0x2'));var Mustache=require(_0x06fa('0x3'));var util=require(_0x06fa('0x4'));var path=require(_0x06fa('0x5'));var sox=require('sox');var csv=require(_0x06fa('0x6'));var ejs=require(_0x06fa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06fa('0x8'));var squel=require(_0x06fa('0x9'));var crypto=require(_0x06fa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x06fa('0xb'));var toCsv=require('to-csv');var querystring=require(_0x06fa('0xc'));var Papa=require(_0x06fa('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x06fa('0xe'));var as=require(_0x06fa('0xf'));var hardwareService=require(_0x06fa('0x10'));var logger=require(_0x06fa('0x11'))(_0x06fa('0x12'));var utils=require(_0x06fa('0x13'));var config=require(_0x06fa('0x14'));var licenseUtil=require(_0x06fa('0x15'));var db=require(_0x06fa('0x16'))['db'];function respondWithStatusCode(_0xc20a2d,_0x1fb792){_0x1fb792=_0x1fb792||0xcc;return function(_0x3753dd){if(_0x3753dd){return _0xc20a2d[_0x06fa('0x17')](_0x1fb792);}return _0xc20a2d[_0x06fa('0x18')](_0x1fb792)[_0x06fa('0x19')]();};}function respondWithResult(_0xc5b318,_0x520a6f){_0x520a6f=_0x520a6f||0xc8;return function(_0x4ee1de){if(_0x4ee1de){return _0xc5b318[_0x06fa('0x18')](_0x520a6f)[_0x06fa('0x1a')](_0x4ee1de);}};}function respondWithFilteredResult(_0x41c270,_0x3aaf46){return function(_0x24982d){if(_0x24982d){var _0x533cfd=typeof _0x3aaf46['offset']===_0x06fa('0x1b')&&typeof _0x3aaf46[_0x06fa('0x1c')]===_0x06fa('0x1b');var _0x430207=_0x24982d[_0x06fa('0x1d')];var _0x4060ee=_0x533cfd?0x0:_0x3aaf46[_0x06fa('0x1e')];var _0x3d776c=_0x533cfd?_0x24982d[_0x06fa('0x1d')]:_0x3aaf46[_0x06fa('0x1e')]+_0x3aaf46[_0x06fa('0x1c')];var _0x584045;if(_0x3d776c>=_0x430207){_0x3d776c=_0x430207;_0x584045=0xc8;}else{_0x584045=0xce;}_0x41c270[_0x06fa('0x18')](_0x584045);return _0x41c270[_0x06fa('0x1f')](_0x06fa('0x20'),_0x4060ee+'-'+_0x3d776c+'/'+_0x430207)[_0x06fa('0x1a')](_0x24982d);}return null;};}function patchUpdates(_0x16ad82){return function(_0xfd37c8){try{jsonpatch['apply'](_0xfd37c8,_0x16ad82,!![]);}catch(_0x55d183){return BPromise[_0x06fa('0x21')](_0x55d183);}return _0xfd37c8[_0x06fa('0x22')]();};}function saveUpdates(_0x6ae0be,_0x6f70f8){return function(_0x4763f3){if(_0x4763f3){return _0x4763f3[_0x06fa('0x23')](_0x6ae0be)[_0x06fa('0x24')](function(_0x19faab){return _0x19faab;});}return null;};}function removeEntity(_0x1c1237,_0x149535){return function(_0xd66468){if(_0xd66468){return _0xd66468[_0x06fa('0x25')]()['then'](function(){var _0x308e1d=_0xd66468[_0x06fa('0x26')]({'plain':!![]});var _0x1ebfee=_0x06fa('0x27');return db[_0x06fa('0x28')][_0x06fa('0x25')]({'where':{'type':_0x1ebfee,'resourceId':_0x308e1d['id']}})[_0x06fa('0x24')](function(){return _0xd66468;});})['then'](function(){_0x1c1237['status'](0xcc)[_0x06fa('0x19')]();});}};}function handleEntityNotFound(_0x25bb7d,_0x18081d){return function(_0x5ba5a8){if(!_0x5ba5a8){_0x25bb7d[_0x06fa('0x17')](0x194);}return _0x5ba5a8;};}function handleError(_0x28514f,_0x58c3a3){_0x58c3a3=_0x58c3a3||0x1f4;return function(_0x1d4ab7){logger[_0x06fa('0x29')](_0x1d4ab7[_0x06fa('0x2a')]);if(_0x1d4ab7['name']){delete _0x1d4ab7[_0x06fa('0x2b')];}_0x28514f[_0x06fa('0x18')](_0x58c3a3)[_0x06fa('0x2c')](_0x1d4ab7);};}exports[_0x06fa('0x2d')]=function(_0x3f6f3e,_0x111f7d){var _0xaaae98={},_0x7b88a3={},_0x1cecc2={'count':0x0,'rows':[]};var _0x390d82=_[_0x06fa('0x2e')](db[_0x06fa('0x2f')][_0x06fa('0x30')],function(_0x3c45a0){return{'name':_0x3c45a0[_0x06fa('0x31')],'type':_0x3c45a0[_0x06fa('0x32')][_0x06fa('0x33')]};});_0x7b88a3[_0x06fa('0x34')]=_[_0x06fa('0x2e')](_0x390d82,_0x06fa('0x2b'));_0x7b88a3['query']=_[_0x06fa('0x35')](_0x3f6f3e[_0x06fa('0x36')]);_0x7b88a3[_0x06fa('0x37')]=_[_0x06fa('0x38')](_0x7b88a3[_0x06fa('0x34')],_0x7b88a3[_0x06fa('0x36')]);_0xaaae98[_0x06fa('0x39')]=_[_0x06fa('0x38')](_0x7b88a3['model'],qs[_0x06fa('0x3a')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x3a')]));_0xaaae98[_0x06fa('0x39')]=_0xaaae98[_0x06fa('0x39')][_0x06fa('0x3b')]?_0xaaae98[_0x06fa('0x39')]:_0x7b88a3[_0x06fa('0x34')];if(!_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x3c')](_0x06fa('0x3d'))){_0xaaae98['limit']=qs[_0x06fa('0x1c')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x1c')]);_0xaaae98[_0x06fa('0x1e')]=qs[_0x06fa('0x1e')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x1e')]);}_0xaaae98[_0x06fa('0x3e')]=qs[_0x06fa('0x3f')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x3f')]);_0xaaae98[_0x06fa('0x40')]=qs['filters'](_[_0x06fa('0x41')](_0x3f6f3e['query'],_0x7b88a3[_0x06fa('0x37')]),_0x390d82);if(_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x42')]){_0xaaae98[_0x06fa('0x40')]=_[_0x06fa('0x43')](_0xaaae98['where'],{'$or':_[_0x06fa('0x2e')](_0x390d82,function(_0x114001){if(_0x114001['type']!==_0x06fa('0x44')){var _0x225ee2={};_0x225ee2[_0x114001[_0x06fa('0x2b')]]={'$like':'%'+_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x42')]+'%'};return _0x225ee2;}})});}_0xaaae98=_['merge']({},_0xaaae98,_0x3f6f3e[_0x06fa('0x45')]);var _0x32f1b4={'where':_0xaaae98[_0x06fa('0x40')]};return db[_0x06fa('0x2f')][_0x06fa('0x1d')](_0x32f1b4)[_0x06fa('0x24')](function(_0x5ac314){_0x1cecc2[_0x06fa('0x1d')]=_0x5ac314;if(_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x46')]){_0xaaae98['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x06fa('0x47')](_0xaaae98);})['then'](function(_0x23158b){_0x1cecc2['rows']=_0x23158b;return _0x1cecc2;})[_0x06fa('0x24')](respondWithFilteredResult(_0x111f7d,_0xaaae98))[_0x06fa('0x48')](handleError(_0x111f7d,null));};exports['show']=function(_0x4d278f,_0x2b4759){var _0x1cc43d={'raw':!![],'where':{'id':_0x4d278f[_0x06fa('0x49')]['id']}},_0x441ba9={};_0x441ba9[_0x06fa('0x34')]=_[_0x06fa('0x35')](db['AnalyticExtractedReport']['rawAttributes']);_0x441ba9[_0x06fa('0x36')]=_['keys'](_0x4d278f[_0x06fa('0x36')]);_0x441ba9[_0x06fa('0x37')]=_[_0x06fa('0x38')](_0x441ba9['model'],_0x441ba9[_0x06fa('0x36')]);_0x1cc43d[_0x06fa('0x39')]=_[_0x06fa('0x38')](_0x441ba9[_0x06fa('0x34')],qs[_0x06fa('0x3a')](_0x4d278f[_0x06fa('0x36')][_0x06fa('0x3a')]));_0x1cc43d[_0x06fa('0x39')]=_0x1cc43d[_0x06fa('0x39')][_0x06fa('0x3b')]?_0x1cc43d['attributes']:_0x441ba9[_0x06fa('0x34')];if(_0x4d278f['query'][_0x06fa('0x46')]){_0x1cc43d['include']=[{'all':!![]}];}_0x1cc43d=_[_0x06fa('0x43')]({},_0x1cc43d,_0x4d278f['options']);return db[_0x06fa('0x2f')][_0x06fa('0x4a')](_0x1cc43d)[_0x06fa('0x24')](handleEntityNotFound(_0x2b4759,null))[_0x06fa('0x24')](respondWithResult(_0x2b4759,null))[_0x06fa('0x48')](handleError(_0x2b4759,null));};exports['create']=function(_0x172a55,_0x43bb87){return db[_0x06fa('0x2f')][_0x06fa('0x4b')](_0x172a55[_0x06fa('0x4c')],{})[_0x06fa('0x24')](function(_0x5d0f03){var _0x328d0a=_0x172a55[_0x06fa('0x4d')][_0x06fa('0x26')]({'plain':!![]});if(!_0x328d0a)throw new Error(_0x06fa('0x4e'));if(_0x328d0a[_0x06fa('0x4f')]===_0x06fa('0x4d')){var _0x4b5096=_0x5d0f03[_0x06fa('0x26')]({'plain':!![]});var _0x17f5af=_0x06fa('0x27');return db[_0x06fa('0x50')][_0x06fa('0x4a')]({'where':{'name':_0x17f5af,'userProfileId':_0x328d0a[_0x06fa('0x51')]},'raw':!![]})['then'](function(_0x3be817){if(_0x3be817&&_0x3be817[_0x06fa('0x52')]===0x0){return db['UserProfileResource'][_0x06fa('0x4b')]({'name':_0x4b5096[_0x06fa('0x2b')],'resourceId':_0x4b5096['id'],'type':_0x3be817['name'],'sectionId':_0x3be817['id']},{})[_0x06fa('0x24')](function(){return _0x5d0f03;});}else{return _0x5d0f03;}})['catch'](function(_0x4ce17e){logger[_0x06fa('0x29')](_0x06fa('0x53'),_0x4ce17e);throw _0x4ce17e;});}return _0x5d0f03;})[_0x06fa('0x24')](respondWithResult(_0x43bb87,0xc9))[_0x06fa('0x48')](handleError(_0x43bb87,null));};exports[_0x06fa('0x23')]=function(_0x185f9f,_0x42dbfd){if(_0x185f9f[_0x06fa('0x4c')]['id']){delete _0x185f9f[_0x06fa('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0x06fa('0x4a')]({'where':{'id':_0x185f9f[_0x06fa('0x49')]['id']}})['then'](handleEntityNotFound(_0x42dbfd,null))['then'](saveUpdates(_0x185f9f['body'],null))['then'](respondWithResult(_0x42dbfd,null))[_0x06fa('0x48')](handleError(_0x42dbfd,null));};exports[_0x06fa('0x25')]=function(_0x243e45,_0x57a430){return db['AnalyticExtractedReport'][_0x06fa('0x4a')]({'where':{'id':_0x243e45['params']['id']}})[_0x06fa('0x24')](handleEntityNotFound(_0x57a430,null))['then'](removeEntity(_0x57a430,null))['catch'](handleError(_0x57a430,null));};exports[_0x06fa('0x54')]=function(_0x2787c4,_0x1f602a,_0x2f7b71){return db[_0x06fa('0x2f')]['find']({'where':{'id':_0x2787c4['params']['id']},'attributes':['name',_0x06fa('0x55'),_0x06fa('0x56'),_0x06fa('0x57')],'raw':!![]})[_0x06fa('0x24')](handleEntityNotFound(_0x1f602a,null))[_0x06fa('0x24')](function(_0x237694){if(_0x237694){if(!fs[_0x06fa('0x58')](path['join'](config[_0x06fa('0x59')],_0x06fa('0x5a'),_0x237694[_0x06fa('0x56')]))){throw new db['Sequelize'][(_0x06fa('0x5b'))](_0x06fa('0x5c'));}if(_0x2787c4[_0x06fa('0x36')][_0x06fa('0x5d')]){return _0x1f602a[_0x06fa('0x17')](0xc8);}return _0x1f602a[_0x06fa('0x54')](path[_0x06fa('0x5e')](config[_0x06fa('0x59')],'server/files/reports',_0x237694[_0x06fa('0x56')]),util[_0x06fa('0x5f')](_0x06fa('0x60'),_0x237694[_0x06fa('0x55')]||_0x237694[_0x06fa('0x2b')],_0x237694['output'][_0x06fa('0x61')]()));}})[_0x06fa('0x48')](handleError(_0x1f602a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index a0f16f6..11842ec 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 _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 +var _0xce07=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0xce07,0x166));var _0x7ce0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xce07[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7ce0('0x0'));var util=require(_0x7ce0('0x1'));var logger=require(_0x7ce0('0x2'))(_0x7ce0('0x3'));var moment=require('moment');var BPromise=require(_0x7ce0('0x4'));var rp=require(_0x7ce0('0x5'));var fs=require('fs');var path=require(_0x7ce0('0x6'));var rimraf=require(_0x7ce0('0x7'));var config=require(_0x7ce0('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x7ce0('0x9')]=function(_0x592283,_0x62f999){return _0x592283['define'](_0x7ce0('0xa'),attributes,{'tableName':_0x7ce0('0xb'),'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 45b6950..09aca32 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 _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 +var _0x47fe=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x54f01a,_0x12e01c){var _0x4787f1=function(_0x89ae1b){while(--_0x89ae1b){_0x54f01a['push'](_0x54f01a['shift']());}};_0x4787f1(++_0x12e01c);}(_0x47fe,0x1c0));var _0xe47f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x47fe[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xe47f('0x0'));var moment=require('moment');var BPromise=require(_0xe47f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe47f('0x2'));var db=require(_0xe47f('0x3'))['db'];var utils=require(_0xe47f('0x4'));var logger=require(_0xe47f('0x5'))(_0xe47f('0x6'));var config=require(_0xe47f('0x7'));var jayson=require(_0xe47f('0x8'));var client=jayson['client'][_0xe47f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x449031,_0x115040,_0x33f76b){return new BPromise(function(_0x59f0e9,_0x547327){return client['request'](_0x449031,_0x33f76b)[_0xe47f('0xa')](function(_0x1fa867){logger[_0xe47f('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x115040,'request\x20sent');logger['debug'](_0xe47f('0xc'),_0x115040,'request\x20sent',JSON['stringify'](_0x1fa867));if(_0x1fa867[_0xe47f('0xd')]){if(_0x1fa867[_0xe47f('0xd')][_0xe47f('0xe')]===0x1f4){logger[_0xe47f('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x115040,_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);return _0x547327(_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);}logger['error'](_0xe47f('0x10'),_0x115040,_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);return _0x59f0e9(_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);}else{logger[_0xe47f('0xb')](_0xe47f('0x10'),_0x115040,_0xe47f('0x11'));_0x59f0e9(_0x1fa867[_0xe47f('0x12')][_0xe47f('0xf')]);}})[_0xe47f('0x13')](function(_0x55da4f){logger[_0xe47f('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x115040,_0x55da4f);_0x547327(_0x55da4f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 581ea3b..d0b974a 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 _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 +var _0x9d7b=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9d7b,0x1e8));var _0xb9d7=function(_0x1b63c0,_0x56224f){_0x1b63c0=_0x1b63c0-0x0;var _0x3baae1=_0x9d7b[_0x1b63c0];return _0x3baae1;};'use strict';var multer=require(_0xb9d7('0x0'));var util=require(_0xb9d7('0x1'));var path=require(_0xb9d7('0x2'));var timeout=require(_0xb9d7('0x3'));var express=require(_0xb9d7('0x4'));var router=express[_0xb9d7('0x5')]();var fs_extra=require(_0xb9d7('0x6'));var auth=require(_0xb9d7('0x7'));var interaction=require(_0xb9d7('0x8'));var config=require(_0xb9d7('0x9'));var controller=require(_0xb9d7('0xa'));router[_0xb9d7('0xb')]('/',auth[_0xb9d7('0xc')](),controller['index']);router[_0xb9d7('0xb')](_0xb9d7('0xd'),auth['isAuthenticated'](),controller[_0xb9d7('0xe')]);router[_0xb9d7('0xb')](_0xb9d7('0xf'),auth[_0xb9d7('0xc')](),controller[_0xb9d7('0x10')]);router[_0xb9d7('0x11')]('/',auth[_0xb9d7('0xc')](),controller[_0xb9d7('0x12')]);router[_0xb9d7('0x13')](_0xb9d7('0xd'),auth[_0xb9d7('0xc')](),controller['update']);router[_0xb9d7('0x14')](_0xb9d7('0xd'),auth['isAuthenticated'](),controller[_0xb9d7('0x15')]);module[_0xb9d7('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 8b2850f..9f60eb9 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 _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 +var _0x99a6=['TEXT','STRING','BOOLEAN','exports'];(function(_0x1a29ae,_0x24e30f){var _0x2e810c=function(_0x148f60){while(--_0x148f60){_0x1a29ae['push'](_0x1a29ae['shift']());}};_0x2e810c(++_0x24e30f);}(_0x99a6,0x1c3));var _0x699a=function(_0x126af7,_0x25fa06){_0x126af7=_0x126af7-0x0;var _0x25b500=_0x99a6[_0x126af7];return _0x25b500;};'use strict';var Sequelize=require('sequelize');module[_0x699a('0x0')]={'field':{'type':Sequelize[_0x699a('0x1')]},'alias':{'type':Sequelize[_0x699a('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x699a('0x2')]},'groupBy':{'type':Sequelize[_0x699a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x699a('0x2')]},'custom':{'type':Sequelize[_0x699a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 67e6a0f..7585f80 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 _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 +var _0x6dfa=['index','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','stack','name','send'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x6dfa,0x7b));var _0xa6df=function(_0x571239,_0x23d386){_0x571239=_0x571239-0x0;var _0xa89b75=_0x6dfa[_0x571239];return _0xa89b75;};'use strict';var emlformat=require(_0xa6df('0x0'));var rimraf=require(_0xa6df('0x1'));var zipdir=require(_0xa6df('0x2'));var jsonpatch=require(_0xa6df('0x3'));var rp=require(_0xa6df('0x4'));var moment=require('moment');var BPromise=require(_0xa6df('0x5'));var Mustache=require('mustache');var util=require(_0xa6df('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa6df('0x7'));var ejs=require(_0xa6df('0x8'));var fs=require('fs');var fs_extra=require(_0xa6df('0x9'));var _=require(_0xa6df('0xa'));var squel=require(_0xa6df('0xb'));var crypto=require(_0xa6df('0xc'));var jsforce=require(_0xa6df('0xd'));var deskjs=require(_0xa6df('0xe'));var toCsv=require(_0xa6df('0x7'));var querystring=require(_0xa6df('0xf'));var Papa=require('papaparse');var Redis=require(_0xa6df('0x10'));var authService=require(_0xa6df('0x11'));var qs=require(_0xa6df('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6df('0x13'));var logger=require('../../config/logger')(_0xa6df('0x14'));var utils=require(_0xa6df('0x15'));var config=require(_0xa6df('0x16'));var licenseUtil=require(_0xa6df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6bdaa,_0x500e77){_0x500e77=_0x500e77||0xcc;return function(_0x1540f1){if(_0x1540f1){return _0x6bdaa[_0xa6df('0x18')](_0x500e77);}return _0x6bdaa[_0xa6df('0x19')](_0x500e77)[_0xa6df('0x1a')]();};}function respondWithResult(_0x53325a,_0x1e536d){_0x1e536d=_0x1e536d||0xc8;return function(_0x5bbd9e){if(_0x5bbd9e){return _0x53325a[_0xa6df('0x19')](_0x1e536d)[_0xa6df('0x1b')](_0x5bbd9e);}};}function respondWithFilteredResult(_0x59c2a2,_0x300a72){return function(_0x414cae){if(_0x414cae){var _0x23f4c1=typeof _0x300a72[_0xa6df('0x1c')]===_0xa6df('0x1d')&&typeof _0x300a72['limit']===_0xa6df('0x1d');var _0x3f9a6b=_0x414cae[_0xa6df('0x1e')];var _0x172bb9=_0x23f4c1?0x0:_0x300a72['offset'];var _0x203375=_0x23f4c1?_0x414cae[_0xa6df('0x1e')]:_0x300a72[_0xa6df('0x1c')]+_0x300a72[_0xa6df('0x1f')];var _0x48de1c;if(_0x203375>=_0x3f9a6b){_0x203375=_0x3f9a6b;_0x48de1c=0xc8;}else{_0x48de1c=0xce;}_0x59c2a2['status'](_0x48de1c);return _0x59c2a2[_0xa6df('0x20')]('Content-Range',_0x172bb9+'-'+_0x203375+'/'+_0x3f9a6b)[_0xa6df('0x1b')](_0x414cae);}return null;};}function patchUpdates(_0xfefceb){return function(_0x297e0f){try{jsonpatch[_0xa6df('0x21')](_0x297e0f,_0xfefceb,!![]);}catch(_0x2f41e1){return BPromise['reject'](_0x2f41e1);}return _0x297e0f[_0xa6df('0x22')]();};}function saveUpdates(_0x37dcbd,_0x3c09de){return function(_0x10fb11){if(_0x10fb11){return _0x10fb11[_0xa6df('0x23')](_0x37dcbd)[_0xa6df('0x24')](function(_0x539be3){return _0x539be3;});}return null;};}function removeEntity(_0x4be3e0,_0xcaa3a1){return function(_0x111659){if(_0x111659){return _0x111659[_0xa6df('0x25')]()[_0xa6df('0x24')](function(){_0x4be3e0[_0xa6df('0x19')](0xcc)[_0xa6df('0x1a')]();});}};}function handleEntityNotFound(_0x557aa6,_0x51e836){return function(_0x1f138b){if(!_0x1f138b){_0x557aa6[_0xa6df('0x18')](0x194);}return _0x1f138b;};}function handleError(_0x2745f8,_0x50e7b8){_0x50e7b8=_0x50e7b8||0x1f4;return function(_0x54ff44){logger['error'](_0x54ff44[_0xa6df('0x26')]);if(_0x54ff44['name']){delete _0x54ff44[_0xa6df('0x27')];}_0x2745f8[_0xa6df('0x19')](_0x50e7b8)[_0xa6df('0x28')](_0x54ff44);};}exports[_0xa6df('0x29')]=function(_0x37b079,_0x25a36a){var _0x55161d={},_0x42fa1b={},_0x417c8a={'count':0x0,'rows':[]};var _0x42fa29=_[_0xa6df('0x2a')](db[_0xa6df('0x2b')]['rawAttributes'],function(_0x29eacf){return{'name':_0x29eacf[_0xa6df('0x2c')],'type':_0x29eacf['type'][_0xa6df('0x2d')]};});_0x42fa1b[_0xa6df('0x2e')]=_['map'](_0x42fa29,_0xa6df('0x27'));_0x42fa1b[_0xa6df('0x2f')]=_[_0xa6df('0x30')](_0x37b079[_0xa6df('0x2f')]);_0x42fa1b[_0xa6df('0x31')]=_['intersection'](_0x42fa1b[_0xa6df('0x2e')],_0x42fa1b[_0xa6df('0x2f')]);_0x55161d[_0xa6df('0x32')]=_[_0xa6df('0x33')](_0x42fa1b['model'],qs[_0xa6df('0x34')](_0x37b079['query'][_0xa6df('0x34')]));_0x55161d[_0xa6df('0x32')]=_0x55161d[_0xa6df('0x32')][_0xa6df('0x35')]?_0x55161d[_0xa6df('0x32')]:_0x42fa1b[_0xa6df('0x2e')];if(!_0x37b079[_0xa6df('0x2f')][_0xa6df('0x36')](_0xa6df('0x37'))){_0x55161d[_0xa6df('0x1f')]=qs[_0xa6df('0x1f')](_0x37b079['query']['limit']);_0x55161d[_0xa6df('0x1c')]=qs[_0xa6df('0x1c')](_0x37b079[_0xa6df('0x2f')][_0xa6df('0x1c')]);}_0x55161d[_0xa6df('0x38')]=qs['sort'](_0x37b079[_0xa6df('0x2f')][_0xa6df('0x39')]);_0x55161d[_0xa6df('0x3a')]=qs[_0xa6df('0x31')](_[_0xa6df('0x3b')](_0x37b079['query'],_0x42fa1b[_0xa6df('0x31')]),_0x42fa29);if(_0x37b079[_0xa6df('0x2f')][_0xa6df('0x3c')]){_0x55161d['where']=_[_0xa6df('0x3d')](_0x55161d['where'],{'$or':_['map'](_0x42fa29,function(_0x56d9e6){if(_0x56d9e6[_0xa6df('0x3e')]!==_0xa6df('0x3f')){var _0x4c54a0={};_0x4c54a0[_0x56d9e6['name']]={'$like':'%'+_0x37b079[_0xa6df('0x2f')][_0xa6df('0x3c')]+'%'};return _0x4c54a0;}})});}_0x55161d=_[_0xa6df('0x3d')]({},_0x55161d,_0x37b079[_0xa6df('0x40')]);var _0x2e3da8={'where':_0x55161d['where']};return db[_0xa6df('0x2b')][_0xa6df('0x1e')](_0x2e3da8)[_0xa6df('0x24')](function(_0x5ab682){_0x417c8a[_0xa6df('0x1e')]=_0x5ab682;if(_0x37b079[_0xa6df('0x2f')][_0xa6df('0x41')]){_0x55161d['include']=[{'all':!![]}];}return db[_0xa6df('0x2b')]['findAll'](_0x55161d);})[_0xa6df('0x24')](function(_0x4b4815){_0x417c8a[_0xa6df('0x42')]=_0x4b4815;return _0x417c8a;})[_0xa6df('0x24')](respondWithFilteredResult(_0x25a36a,_0x55161d))[_0xa6df('0x43')](handleError(_0x25a36a,null));};exports[_0xa6df('0x44')]=function(_0x217696,_0x4f99a0){var _0x3ea622={'raw':![],'where':{'id':_0x217696[_0xa6df('0x45')]['id']}},_0x5e277f={};_0x5e277f[_0xa6df('0x2e')]=_[_0xa6df('0x30')](db['AnalyticFieldReport'][_0xa6df('0x46')]);_0x5e277f[_0xa6df('0x2f')]=_[_0xa6df('0x30')](_0x217696[_0xa6df('0x2f')]);_0x5e277f[_0xa6df('0x31')]=_['intersection'](_0x5e277f[_0xa6df('0x2e')],_0x5e277f[_0xa6df('0x2f')]);_0x3ea622[_0xa6df('0x32')]=_['intersection'](_0x5e277f['model'],qs['fields'](_0x217696[_0xa6df('0x2f')][_0xa6df('0x34')]));_0x3ea622[_0xa6df('0x32')]=_0x3ea622[_0xa6df('0x32')][_0xa6df('0x35')]?_0x3ea622['attributes']:_0x5e277f[_0xa6df('0x2e')];if(_0x217696[_0xa6df('0x2f')][_0xa6df('0x41')]){_0x3ea622['include']=[{'all':!![]}];}_0x3ea622=_['merge']({},_0x3ea622,_0x217696['options']);return db[_0xa6df('0x2b')][_0xa6df('0x47')](_0x3ea622)[_0xa6df('0x24')](handleEntityNotFound(_0x4f99a0,null))['then'](respondWithResult(_0x4f99a0,null))[_0xa6df('0x43')](handleError(_0x4f99a0,null));};exports['create']=function(_0x3c4adc,_0x1278b3){return db['AnalyticFieldReport'][_0xa6df('0x48')](_0x3c4adc[_0xa6df('0x49')],{})[_0xa6df('0x24')](respondWithResult(_0x1278b3,0xc9))[_0xa6df('0x43')](handleError(_0x1278b3,null));};exports['bulkCreate']=function(_0x3b48a0,_0xdb3379){return db['AnalyticFieldReport']['bulkCreate'](_0x3b48a0['body'],{'raw':![],'individualHooks':!![]})[_0xa6df('0x24')](respondWithResult(_0xdb3379,0xc9))[_0xa6df('0x43')](handleError(_0xdb3379,null));};exports[_0xa6df('0x23')]=function(_0x15865c,_0x39a95b){if(_0x15865c[_0xa6df('0x49')]['id']){delete _0x15865c['body']['id'];}return db[_0xa6df('0x2b')][_0xa6df('0x47')]({'where':{'id':_0x15865c[_0xa6df('0x45')]['id']}})[_0xa6df('0x24')](handleEntityNotFound(_0x39a95b,null))[_0xa6df('0x24')](saveUpdates(_0x15865c[_0xa6df('0x49')],null))[_0xa6df('0x24')](respondWithResult(_0x39a95b,null))[_0xa6df('0x43')](handleError(_0x39a95b,null));};exports[_0xa6df('0x25')]=function(_0x423499,_0x31688c){return db[_0xa6df('0x2b')][_0xa6df('0x47')]({'where':{'id':_0x423499[_0xa6df('0x45')]['id']}})[_0xa6df('0x24')](handleEntityNotFound(_0x31688c,null))[_0xa6df('0x24')](removeEntity(_0x31688c,null))[_0xa6df('0x43')](handleError(_0x31688c,null));};exports['bulkDestroy']=function(_0x2825a0,_0x7e7e92){return db[_0xa6df('0x2b')][_0xa6df('0x25')]({'where':{'id':_0x2825a0[_0xa6df('0x2f')][_0xa6df('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xa6df('0x24')](respondWithResult(_0x7e7e92,0xcc))[_0xa6df('0x43')](handleError(_0x7e7e92,null));};exports[_0xa6df('0x4b')]=function(_0x9ae7c3,_0x32119d,_0x5a2d47){return db[_0xa6df('0x4c')][_0xa6df('0x4d')]({'where':{'id':_0x9ae7c3[_0xa6df('0x45')]['id']}})[_0xa6df('0x24')](handleEntityNotFound(_0x32119d,null))[_0xa6df('0x24')](function(_0x5ea5f9){if(_0x5ea5f9){return db[_0xa6df('0x4e')]['transaction'](function(_0x275225){return db[_0xa6df('0x2b')][_0xa6df('0x25')]({'where':{'CustomReportId':_0x9ae7c3[_0xa6df('0x45')]['id']},'transaction':_0x275225})[_0xa6df('0x24')](function(_0x5e1c15){var _0x3aa8a2=_[_0xa6df('0x2a')](_0x9ae7c3[_0xa6df('0x49')],function(_0x2c3fbc){delete _0x2c3fbc['id'];_0x2c3fbc[_0xa6df('0x4f')]=_0x9ae7c3[_0xa6df('0x45')]['id'];return _0x2c3fbc;});return db[_0xa6df('0x2b')][_0xa6df('0x50')](_0x3aa8a2,{'transaction':_0x275225});});})[_0xa6df('0x24')](function(){return db[_0xa6df('0x2b')][_0xa6df('0x51')]({'where':{'CustomReportId':_0x9ae7c3[_0xa6df('0x45')]['id']}});});}})[_0xa6df('0x24')](respondWithResult(_0x32119d,null))[_0xa6df('0x43')](handleError(_0x32119d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5de72bf..c0acbfc 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 _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 +var _0x457b=['./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4cc6ef,_0x421fdb){var _0x33082d=function(_0xf3e3b){while(--_0xf3e3b){_0x4cc6ef['push'](_0x4cc6ef['shift']());}};_0x33082d(++_0x421fdb);}(_0x457b,0x108));var _0xb457=function(_0xe5287b,_0x26b8ab){_0xe5287b=_0xe5287b-0x0;var _0x346f77=_0x457b[_0xe5287b];return _0x346f77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb457('0x0'))(_0xb457('0x1'));var moment=require(_0xb457('0x2'));var BPromise=require(_0xb457('0x3'));var rp=require(_0xb457('0x4'));var fs=require('fs');var path=require(_0xb457('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb457('0x6'));module['exports']=function(_0x463d96,_0x2b1442){return _0x463d96[_0xb457('0x7')](_0xb457('0x8'),attributes,{'tableName':_0xb457('0x9'),'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 58aac47..9b67d4d 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 _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 +var _0x01a4=['info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x72c4dc,_0x5efac5){var _0x21057d=function(_0x547585){while(--_0x547585){_0x72c4dc['push'](_0x72c4dc['shift']());}};_0x21057d(++_0x5efac5);}(_0x01a4,0x70));var _0x401a=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0x01a4[_0x5a6961];return _0x4af0a6;};'use strict';var _=require(_0x401a('0x0'));var util=require(_0x401a('0x1'));var moment=require(_0x401a('0x2'));var BPromise=require(_0x401a('0x3'));var rs=require(_0x401a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x401a('0x5'))['db'];var utils=require(_0x401a('0x6'));var logger=require(_0x401a('0x7'))(_0x401a('0x8'));var config=require(_0x401a('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455801,_0xd48404,_0x31db0f){return new BPromise(function(_0x3627a3,_0x3c7f19){return client[_0x401a('0xa')](_0x455801,_0x31db0f)[_0x401a('0xb')](function(_0x10962a){logger['info'](_0x401a('0xc'),_0xd48404,_0x401a('0xd'));logger[_0x401a('0xe')](_0x401a('0xf'),_0xd48404,_0x401a('0xd'),JSON[_0x401a('0x10')](_0x10962a));if(_0x10962a[_0x401a('0x11')]){if(_0x10962a[_0x401a('0x11')][_0x401a('0x12')]===0x1f4){logger[_0x401a('0x11')](_0x401a('0xc'),_0xd48404,_0x10962a['error'][_0x401a('0x13')]);return _0x3c7f19(_0x10962a[_0x401a('0x11')][_0x401a('0x13')]);}logger[_0x401a('0x11')](_0x401a('0xc'),_0xd48404,_0x10962a[_0x401a('0x11')][_0x401a('0x13')]);return _0x3627a3(_0x10962a['error']['message']);}else{logger[_0x401a('0x14')](_0x401a('0xc'),_0xd48404,_0x401a('0xd'));_0x3627a3(_0x10962a[_0x401a('0x15')][_0x401a('0x13')]);}})['catch'](function(_0x3390c1){logger[_0x401a('0x11')](_0x401a('0xc'),_0xd48404,_0x3390c1);_0x3c7f19(_0x3390c1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0db615c..c0104f0 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(_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 +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(_0x1818d,_0x5f94e){var _0x37de5d=function(_0x1846df){while(--_0x1846df){_0x1818d['push'](_0x1818d['shift']());}};_0x37de5d(++_0x5f94e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 c7078da..8254735 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 _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 +var _0x6170=['TEXT','sequelize','exports','STRING','name'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6170,0x17d));var _0x0617=function(_0x136612,_0x462f26){_0x136612=_0x136612-0x0;var _0x50d439=_0x6170[_0x136612];return _0x50d439;};'use strict';var Sequelize=require(_0x0617('0x0'));module[_0x0617('0x1')]={'name':{'type':Sequelize[_0x0617('0x2')],'allowNull':![],'unique':_0x0617('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x0617('0x4')]},'description':{'type':Sequelize[_0x0617('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 2ad5071..3a09096 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 _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 +var _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x56f4e7,_0x161437){var _0x21c723=function(_0x326681){while(--_0x326681){_0x56f4e7['push'](_0x56f4e7['shift']());}};_0x21c723(++_0x161437);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1cff5e,_0x1aaa69){_0x1cff5e=_0x1cff5e-0x0;var _0x15f36b=_0xdc97[_0x1cff5e];return _0x15f36b;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 0220da1..19dc2ec 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 _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 +var _0x7b84=['path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x43028e,_0x33a648){var _0x2fed6d=function(_0x3d2598){while(--_0x3d2598){_0x43028e['push'](_0x43028e['shift']());}};_0x2fed6d(++_0x33a648);}(_0x7b84,0x167));var _0x47b8=function(_0x3d2077,_0x59dc7f){_0x3d2077=_0x3d2077-0x0;var _0x5ebf17=_0x7b84[_0x3d2077];return _0x5ebf17;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x47b8('0x3'));var rp=require(_0x47b8('0x4'));var fs=require('fs');var path=require(_0x47b8('0x5'));var rimraf=require(_0x47b8('0x6'));var config=require(_0x47b8('0x7'));var attributes=require(_0x47b8('0x8'));module[_0x47b8('0x9')]=function(_0x1072a8,_0x172e57){return _0x1072a8[_0x47b8('0xa')](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'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 51a711b..6b83929 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 _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 +var _0xc35e=['jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x202c77,_0x14cd91){var _0x41541e=function(_0x37161f){while(--_0x37161f){_0x202c77['push'](_0x202c77['shift']());}};_0x41541e(++_0x14cd91);}(_0xc35e,0x168));var _0xec35=function(_0x10cf5d,_0x396a02){_0x10cf5d=_0x10cf5d-0x0;var _0x5b9d4b=_0xc35e[_0x10cf5d];return _0x5b9d4b;};'use strict';var _=require(_0xec35('0x0'));var util=require(_0xec35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec35('0x2'));var fs=require('fs');var Redis=require(_0xec35('0x3'));var db=require(_0xec35('0x4'))['db'];var utils=require(_0xec35('0x5'));var logger=require('../../config/logger')(_0xec35('0x6'));var config=require(_0xec35('0x7'));var jayson=require(_0xec35('0x8'));var client=jayson[_0xec35('0x9')][_0xec35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ae794,_0x37756e,_0x2b4991){return new BPromise(function(_0x5299cc,_0x12e6b0){return client[_0xec35('0xb')](_0x4ae794,_0x2b4991)[_0xec35('0xc')](function(_0xaa87ae){logger['info'](_0xec35('0xd'),_0x37756e,_0xec35('0xe'));logger[_0xec35('0xf')](_0xec35('0x10'),_0x37756e,_0xec35('0xe'),JSON[_0xec35('0x11')](_0xaa87ae));if(_0xaa87ae[_0xec35('0x12')]){if(_0xaa87ae['error']['code']===0x1f4){logger[_0xec35('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x37756e,_0xaa87ae['error'][_0xec35('0x13')]);return _0x12e6b0(_0xaa87ae[_0xec35('0x12')][_0xec35('0x13')]);}logger[_0xec35('0x12')](_0xec35('0xd'),_0x37756e,_0xaa87ae[_0xec35('0x12')]['message']);return _0x5299cc(_0xaa87ae[_0xec35('0x12')][_0xec35('0x13')]);}else{logger[_0xec35('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x37756e,_0xec35('0xe'));_0x5299cc(_0xaa87ae[_0xec35('0x15')][_0xec35('0x13')]);}})[_0xec35('0x16')](function(_0x16920f){logger[_0xec35('0x12')](_0xec35('0xd'),_0x37756e,_0x16920f);_0x12e6b0(_0x16920f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index fdbf9ae..debd118 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 _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 +var _0x2e3b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x363027,_0x5998b6){var _0x25318f=function(_0x3286ab){while(--_0x3286ab){_0x363027['push'](_0x363027['shift']());}};_0x25318f(++_0x5998b6);}(_0x2e3b,0x81));var _0xb2e3=function(_0x1f3a06,_0x1dd867){_0x1f3a06=_0x1f3a06-0x0;var _0x416071=_0x2e3b[_0x1f3a06];return _0x416071;};'use strict';var multer=require('multer');var util=require(_0xb2e3('0x0'));var path=require(_0xb2e3('0x1'));var timeout=require(_0xb2e3('0x2'));var express=require(_0xb2e3('0x3'));var router=express[_0xb2e3('0x4')]();var fs_extra=require(_0xb2e3('0x5'));var auth=require(_0xb2e3('0x6'));var interaction=require(_0xb2e3('0x7'));var config=require('../../config/environment');var controller=require(_0xb2e3('0x8'));router[_0xb2e3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2e3('0xa')]);router[_0xb2e3('0x9')]('/:id',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0xc')]);router['post']('/',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0xd')]);router[_0xb2e3('0xe')](_0xb2e3('0xf'),auth[_0xb2e3('0xb')](),controller['update']);router[_0xb2e3('0x10')]('/:id',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0x11')]);module[_0xb2e3('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5b4a4a3..df54b4f 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0xef6d=['TEXT','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef6d,0x13f));var _0xdef6=function(_0xfb21d,_0x180250){_0xfb21d=_0xfb21d-0x0;var _0x31b4c3=_0xef6d[_0xfb21d];return _0x31b4c3;};'use strict';var Sequelize=require(_0xdef6('0x0'));module['exports']={'tree':{'type':Sequelize[_0xdef6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b065f29..9f01ca3 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 _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 +var _0x9ec1=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','fields','includeAll','merge','find','catch','create','body','rimraf'];(function(_0x3fa37f,_0x4ee9e6){var _0x5595b5=function(_0x23168f){while(--_0x23168f){_0x3fa37f['push'](_0x3fa37f['shift']());}};_0x5595b5(++_0x4ee9e6);}(_0x9ec1,0x1bb));var _0x19ec=function(_0x1d1eaf,_0x31b7bc){_0x1d1eaf=_0x1d1eaf-0x0;var _0xb0dc37=_0x9ec1[_0x1d1eaf];return _0xb0dc37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19ec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19ec('0x1'));var rp=require(_0x19ec('0x2'));var moment=require('moment');var BPromise=require(_0x19ec('0x3'));var Mustache=require(_0x19ec('0x4'));var util=require(_0x19ec('0x5'));var path=require(_0x19ec('0x6'));var sox=require('sox');var csv=require(_0x19ec('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x19ec('0x8'));var _=require(_0x19ec('0x9'));var squel=require(_0x19ec('0xa'));var crypto=require(_0x19ec('0xb'));var jsforce=require(_0x19ec('0xc'));var deskjs=require(_0x19ec('0xd'));var toCsv=require(_0x19ec('0x7'));var querystring=require('querystring');var Papa=require(_0x19ec('0xe'));var Redis=require(_0x19ec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x19ec('0x10'));var as=require(_0x19ec('0x11'));var hardwareService=require(_0x19ec('0x12'));var logger=require(_0x19ec('0x13'))(_0x19ec('0x14'));var utils=require(_0x19ec('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x19ec('0x16'));var db=require(_0x19ec('0x17'))['db'];function respondWithStatusCode(_0x40b6c0,_0xda5c74){_0xda5c74=_0xda5c74||0xcc;return function(_0x8d0f77){if(_0x8d0f77){return _0x40b6c0['sendStatus'](_0xda5c74);}return _0x40b6c0[_0x19ec('0x18')](_0xda5c74)[_0x19ec('0x19')]();};}function respondWithResult(_0x4c93be,_0x4ca753){_0x4ca753=_0x4ca753||0xc8;return function(_0x5cddf8){if(_0x5cddf8){return _0x4c93be[_0x19ec('0x18')](_0x4ca753)[_0x19ec('0x1a')](_0x5cddf8);}};}function respondWithFilteredResult(_0x5ddbfb,_0x7ec3e0){return function(_0xa49f89){if(_0xa49f89){var _0xd3010e=typeof _0x7ec3e0[_0x19ec('0x1b')]==='undefined'&&typeof _0x7ec3e0['limit']===_0x19ec('0x1c');var _0xcb6668=_0xa49f89[_0x19ec('0x1d')];var _0x51b9e1=_0xd3010e?0x0:_0x7ec3e0[_0x19ec('0x1b')];var _0x11ac4a=_0xd3010e?_0xa49f89['count']:_0x7ec3e0['offset']+_0x7ec3e0[_0x19ec('0x1e')];var _0x299c45;if(_0x11ac4a>=_0xcb6668){_0x11ac4a=_0xcb6668;_0x299c45=0xc8;}else{_0x299c45=0xce;}_0x5ddbfb[_0x19ec('0x18')](_0x299c45);return _0x5ddbfb['set'](_0x19ec('0x1f'),_0x51b9e1+'-'+_0x11ac4a+'/'+_0xcb6668)[_0x19ec('0x1a')](_0xa49f89);}return null;};}function patchUpdates(_0x88e9a7){return function(_0x33e248){try{jsonpatch[_0x19ec('0x20')](_0x33e248,_0x88e9a7,!![]);}catch(_0x332bb2){return BPromise[_0x19ec('0x21')](_0x332bb2);}return _0x33e248[_0x19ec('0x22')]();};}function saveUpdates(_0x45cb86,_0x731887){return function(_0x54cf3b){if(_0x54cf3b){return _0x54cf3b[_0x19ec('0x23')](_0x45cb86)[_0x19ec('0x24')](function(_0x1d84bc){return _0x1d84bc;});}return null;};}function removeEntity(_0x50ecab,_0x357b1c){return function(_0x27eb31){if(_0x27eb31){return _0x27eb31[_0x19ec('0x25')]()[_0x19ec('0x24')](function(){_0x50ecab[_0x19ec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d4ee,_0x56c7d){return function(_0x331b73){if(!_0x331b73){_0x46d4ee[_0x19ec('0x26')](0x194);}return _0x331b73;};}function handleError(_0x55b44d,_0x46e37e){_0x46e37e=_0x46e37e||0x1f4;return function(_0xc0394e){logger[_0x19ec('0x27')](_0xc0394e[_0x19ec('0x28')]);if(_0xc0394e[_0x19ec('0x29')]){delete _0xc0394e[_0x19ec('0x29')];}_0x55b44d[_0x19ec('0x18')](_0x46e37e)[_0x19ec('0x2a')](_0xc0394e);};}exports['index']=function(_0x23ae7e,_0x3cb5a6){var _0xa4dd65={},_0x4304b7={},_0x54455d={'count':0x0,'rows':[]};var _0x278acb=_[_0x19ec('0x2b')](db[_0x19ec('0x2c')][_0x19ec('0x2d')],function(_0x1e1faa){return{'name':_0x1e1faa[_0x19ec('0x2e')],'type':_0x1e1faa[_0x19ec('0x2f')]['key']};});_0x4304b7[_0x19ec('0x30')]=_[_0x19ec('0x2b')](_0x278acb,'name');_0x4304b7['query']=_[_0x19ec('0x31')](_0x23ae7e[_0x19ec('0x32')]);_0x4304b7[_0x19ec('0x33')]=_[_0x19ec('0x34')](_0x4304b7[_0x19ec('0x30')],_0x4304b7['query']);_0xa4dd65[_0x19ec('0x35')]=_[_0x19ec('0x34')](_0x4304b7[_0x19ec('0x30')],qs['fields'](_0x23ae7e[_0x19ec('0x32')]['fields']));_0xa4dd65['attributes']=_0xa4dd65[_0x19ec('0x35')][_0x19ec('0x36')]?_0xa4dd65['attributes']:_0x4304b7['model'];if(!_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x37')](_0x19ec('0x38'))){_0xa4dd65[_0x19ec('0x1e')]=qs[_0x19ec('0x1e')](_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x1e')]);_0xa4dd65[_0x19ec('0x1b')]=qs['offset'](_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x1b')]);}_0xa4dd65['order']=qs[_0x19ec('0x39')](_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x39')]);_0xa4dd65[_0x19ec('0x3a')]=qs[_0x19ec('0x33')](_[_0x19ec('0x3b')](_0x23ae7e[_0x19ec('0x32')],_0x4304b7[_0x19ec('0x33')]),_0x278acb);if(_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x3c')]){_0xa4dd65[_0x19ec('0x3a')]=_['merge'](_0xa4dd65[_0x19ec('0x3a')],{'$or':_[_0x19ec('0x2b')](_0x278acb,function(_0x409262){if(_0x409262[_0x19ec('0x2f')]!==_0x19ec('0x3d')){var _0x5853e8={};_0x5853e8[_0x409262[_0x19ec('0x29')]]={'$like':'%'+_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x3c')]+'%'};return _0x5853e8;}})});}_0xa4dd65=_['merge']({},_0xa4dd65,_0x23ae7e[_0x19ec('0x3e')]);var _0x2b6f43={'where':_0xa4dd65[_0x19ec('0x3a')]};return db[_0x19ec('0x2c')][_0x19ec('0x1d')](_0x2b6f43)['then'](function(_0x5ba1f7){_0x54455d[_0x19ec('0x1d')]=_0x5ba1f7;if(_0x23ae7e[_0x19ec('0x32')]['includeAll']){_0xa4dd65[_0x19ec('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x19ec('0x40')](_0xa4dd65);})[_0x19ec('0x24')](function(_0x2b6767){_0x54455d[_0x19ec('0x41')]=_0x2b6767;return _0x54455d;})['then'](respondWithFilteredResult(_0x3cb5a6,_0xa4dd65))['catch'](handleError(_0x3cb5a6,null));};exports['show']=function(_0x4af12b,_0xb846f0){var _0x19b95d={'raw':!![],'where':{'id':_0x4af12b[_0x19ec('0x42')]['id']}},_0x58e335={};_0x58e335[_0x19ec('0x30')]=_[_0x19ec('0x31')](db['AnalyticTreeReport'][_0x19ec('0x2d')]);_0x58e335[_0x19ec('0x32')]=_[_0x19ec('0x31')](_0x4af12b[_0x19ec('0x32')]);_0x58e335[_0x19ec('0x33')]=_[_0x19ec('0x34')](_0x58e335[_0x19ec('0x30')],_0x58e335[_0x19ec('0x32')]);_0x19b95d[_0x19ec('0x35')]=_[_0x19ec('0x34')](_0x58e335[_0x19ec('0x30')],qs[_0x19ec('0x43')](_0x4af12b[_0x19ec('0x32')][_0x19ec('0x43')]));_0x19b95d['attributes']=_0x19b95d[_0x19ec('0x35')][_0x19ec('0x36')]?_0x19b95d[_0x19ec('0x35')]:_0x58e335['model'];if(_0x4af12b[_0x19ec('0x32')][_0x19ec('0x44')]){_0x19b95d[_0x19ec('0x3f')]=[{'all':!![]}];}_0x19b95d=_[_0x19ec('0x45')]({},_0x19b95d,_0x4af12b['options']);return db[_0x19ec('0x2c')][_0x19ec('0x46')](_0x19b95d)['then'](handleEntityNotFound(_0xb846f0,null))['then'](respondWithResult(_0xb846f0,null))[_0x19ec('0x47')](handleError(_0xb846f0,null));};exports[_0x19ec('0x48')]=function(_0x561fb3,_0x556716){return db[_0x19ec('0x2c')][_0x19ec('0x48')](_0x561fb3[_0x19ec('0x49')],{})[_0x19ec('0x24')](respondWithResult(_0x556716,0xc9))[_0x19ec('0x47')](handleError(_0x556716,null));};exports[_0x19ec('0x23')]=function(_0x44d6f1,_0xd07b14){if(_0x44d6f1[_0x19ec('0x49')]['id']){delete _0x44d6f1['body']['id'];}return db['AnalyticTreeReport'][_0x19ec('0x46')]({'where':{'id':_0x44d6f1[_0x19ec('0x42')]['id']}})[_0x19ec('0x24')](handleEntityNotFound(_0xd07b14,null))['then'](saveUpdates(_0x44d6f1[_0x19ec('0x49')],null))[_0x19ec('0x24')](respondWithResult(_0xd07b14,null))[_0x19ec('0x47')](handleError(_0xd07b14,null));};exports['destroy']=function(_0x4dbb31,_0x296bf0){return db[_0x19ec('0x2c')]['find']({'where':{'id':_0x4dbb31[_0x19ec('0x42')]['id']}})['then'](handleEntityNotFound(_0x296bf0,null))[_0x19ec('0x24')](removeEntity(_0x296bf0,null))[_0x19ec('0x47')](handleError(_0x296bf0,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ec2d63c..4b4d811 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 _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 +var _0x6d8e=['moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','util','../../config/logger','api'];(function(_0x38341c,_0x2d886f){var _0x56c38a=function(_0x16601a){while(--_0x16601a){_0x38341c['push'](_0x38341c['shift']());}};_0x56c38a(++_0x2d886f);}(_0x6d8e,0x1d1));var _0xe6d8=function(_0x53ce70,_0x305811){_0x53ce70=_0x53ce70-0x0;var _0x26d76e=_0x6d8e[_0x53ce70];return _0x26d76e;};'use strict';var _=require('lodash');var util=require(_0xe6d8('0x0'));var logger=require(_0xe6d8('0x1'))(_0xe6d8('0x2'));var moment=require(_0xe6d8('0x3'));var BPromise=require(_0xe6d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6d8('0x5'));var rimraf=require(_0xe6d8('0x6'));var config=require(_0xe6d8('0x7'));var attributes=require(_0xe6d8('0x8'));module[_0xe6d8('0x9')]=function(_0x3749ec,_0x1e7884){return _0x3749ec[_0xe6d8('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xe6d8('0xb'),'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 4b5fef3..4ed3aa3 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 _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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0xadb5,0xad));var _0x5adb=function(_0x741998,_0x5328a3){_0x741998=_0x741998-0x0;var _0x399663=_0xadb5[_0x741998];return _0x399663;};'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']('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f465a73..465b14f 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 _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 +var _0x9c5d=['index','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x513401,_0x2b3f2c){var _0x2c4a0b=function(_0x47dbdd){while(--_0x47dbdd){_0x513401['push'](_0x513401['shift']());}};_0x2c4a0b(++_0x2b3f2c);}(_0x9c5d,0x14b));var _0xd9c5=function(_0x571d85,_0xda439c){_0x571d85=_0x571d85-0x0;var _0x3c2e07=_0x9c5d[_0x571d85];return _0x3c2e07;};'use strict';var multer=require(_0xd9c5('0x0'));var util=require(_0xd9c5('0x1'));var path=require(_0xd9c5('0x2'));var timeout=require(_0xd9c5('0x3'));var express=require('express');var router=express[_0xd9c5('0x4')]();var fs_extra=require(_0xd9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd9c5('0x6'));var config=require(_0xd9c5('0x7'));var controller=require(_0xd9c5('0x8'));router[_0xd9c5('0x9')]('/',auth[_0xd9c5('0xa')](),controller[_0xd9c5('0xb')]);router[_0xd9c5('0x9')](_0xd9c5('0xc'),auth[_0xd9c5('0xa')](),controller[_0xd9c5('0xd')]);router[_0xd9c5('0xe')]('/',auth['isAuthenticated'](),controller[_0xd9c5('0xf')]);router[_0xd9c5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd9c5('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd9c5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a60ac3f..1ab7951 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 _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 +var _0xc964=['sequelize','exports','STRING'];(function(_0x5dbc1d,_0x43e816){var _0xbd1883=function(_0x21a9b4){while(--_0x21a9b4){_0x5dbc1d['push'](_0x5dbc1d['shift']());}};_0xbd1883(++_0x43e816);}(_0xc964,0x7e));var _0x4c96=function(_0x115d32,_0x4de46d){_0x115d32=_0x115d32-0x0;var _0x4dcd42=_0xc964[_0x115d32];return _0x4dcd42;};'use strict';var Sequelize=require(_0x4c96('0x0'));module[_0x4c96('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4c96('0x2')]},'type':{'type':Sequelize[_0x4c96('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9fe73fa..b4ef3dc 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 _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 +var _0x8005=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','end','sendStatus','error','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','find','clone','include','createdAt','updatedAt','body','create','includeAll','destroy','basename','file','filename','download','join','root','server/files/attachments/','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x4f9589,_0x508341){var _0x461484=function(_0x292e1b){while(--_0x292e1b){_0x4f9589['push'](_0x4f9589['shift']());}};_0x461484(++_0x508341);}(_0x8005,0x154));var _0x5800=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0x8005[_0x5933fb];return _0x44d988;};'use strict';var emlformat=require(_0x5800('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5800('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5800('0x2'));var moment=require('moment');var BPromise=require(_0x5800('0x3'));var Mustache=require(_0x5800('0x4'));var util=require(_0x5800('0x5'));var path=require(_0x5800('0x6'));var sox=require('sox');var csv=require(_0x5800('0x7'));var ejs=require(_0x5800('0x8'));var fs=require('fs');var fs_extra=require(_0x5800('0x9'));var _=require(_0x5800('0xa'));var squel=require(_0x5800('0xb'));var crypto=require(_0x5800('0xc'));var jsforce=require(_0x5800('0xd'));var deskjs=require(_0x5800('0xe'));var toCsv=require(_0x5800('0x7'));var querystring=require('querystring');var Papa=require(_0x5800('0xf'));var Redis=require(_0x5800('0x10'));var authService=require(_0x5800('0x11'));var qs=require(_0x5800('0x12'));var as=require(_0x5800('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5800('0x14'))('api');var utils=require(_0x5800('0x15'));var config=require(_0x5800('0x16'));var licenseUtil=require(_0x5800('0x17'));var db=require(_0x5800('0x18'))['db'];function respondWithStatusCode(_0x152a60,_0x1058dd){_0x1058dd=_0x1058dd||0xcc;return function(_0x6396a7){if(_0x6396a7){return _0x152a60['sendStatus'](_0x1058dd);}return _0x152a60[_0x5800('0x19')](_0x1058dd)['end']();};}function respondWithResult(_0x21fbae,_0x4c2508){_0x4c2508=_0x4c2508||0xc8;return function(_0x1e1af6){if(_0x1e1af6){return _0x21fbae[_0x5800('0x19')](_0x4c2508)[_0x5800('0x1a')](_0x1e1af6);}};}function respondWithFilteredResult(_0x1d7e77,_0x463216){return function(_0x3693fb){if(_0x3693fb){var _0x436f49=typeof _0x463216[_0x5800('0x1b')]==='undefined'&&typeof _0x463216[_0x5800('0x1c')]===_0x5800('0x1d');var _0x1f8ff3=_0x3693fb[_0x5800('0x1e')];var _0x2c52e6=_0x436f49?0x0:_0x463216[_0x5800('0x1b')];var _0x6861d4=_0x436f49?_0x3693fb['count']:_0x463216['offset']+_0x463216[_0x5800('0x1c')];var _0x384c44;if(_0x6861d4>=_0x1f8ff3){_0x6861d4=_0x1f8ff3;_0x384c44=0xc8;}else{_0x384c44=0xce;}_0x1d7e77[_0x5800('0x19')](_0x384c44);return _0x1d7e77[_0x5800('0x1f')](_0x5800('0x20'),_0x2c52e6+'-'+_0x6861d4+'/'+_0x1f8ff3)[_0x5800('0x1a')](_0x3693fb);}return null;};}function patchUpdates(_0xddd10e){return function(_0x35c184){try{jsonpatch[_0x5800('0x21')](_0x35c184,_0xddd10e,!![]);}catch(_0x5374be){return BPromise['reject'](_0x5374be);}return _0x35c184[_0x5800('0x22')]();};}function saveUpdates(_0x2c8f0d,_0x1187ee){return function(_0x51cacb){if(_0x51cacb){return _0x51cacb[_0x5800('0x23')](_0x2c8f0d)['then'](function(_0x5805e3){return _0x5805e3;});}return null;};}function removeEntity(_0x219425,_0x57aa69){return function(_0x7772d5){if(_0x7772d5){return _0x7772d5['destroy']()[_0x5800('0x24')](function(){_0x219425[_0x5800('0x19')](0xcc)[_0x5800('0x25')]();});}};}function handleEntityNotFound(_0x4a8309,_0x1cad92){return function(_0x263e26){if(!_0x263e26){_0x4a8309[_0x5800('0x26')](0x194);}return _0x263e26;};}function handleError(_0xcb9c8b,_0x4f4cfc){_0x4f4cfc=_0x4f4cfc||0x1f4;return function(_0x485f04){logger[_0x5800('0x27')](_0x485f04['stack']);if(_0x485f04['name']){delete _0x485f04[_0x5800('0x28')];}_0xcb9c8b[_0x5800('0x19')](_0x4f4cfc)[_0x5800('0x29')](_0x485f04);};}exports[_0x5800('0x2a')]=function(_0x43b514,_0x12d2de){var _0x135776={},_0x2fc899={},_0x20ba88={'count':0x0,'rows':[]};var _0x138f33=_[_0x5800('0x2b')](db[_0x5800('0x2c')][_0x5800('0x2d')],function(_0x260e08){return{'name':_0x260e08[_0x5800('0x2e')],'type':_0x260e08['type'][_0x5800('0x2f')]};});_0x2fc899[_0x5800('0x30')]=_[_0x5800('0x2b')](_0x138f33,_0x5800('0x28'));_0x2fc899[_0x5800('0x31')]=_[_0x5800('0x32')](_0x43b514[_0x5800('0x31')]);_0x2fc899[_0x5800('0x33')]=_[_0x5800('0x34')](_0x2fc899[_0x5800('0x30')],_0x2fc899[_0x5800('0x31')]);_0x135776[_0x5800('0x35')]=_[_0x5800('0x34')](_0x2fc899['model'],qs['fields'](_0x43b514[_0x5800('0x31')][_0x5800('0x36')]));_0x135776['attributes']=_0x135776['attributes'][_0x5800('0x37')]?_0x135776[_0x5800('0x35')]:_0x2fc899[_0x5800('0x30')];if(!_0x43b514[_0x5800('0x31')][_0x5800('0x38')]('nolimit')){_0x135776['limit']=qs['limit'](_0x43b514[_0x5800('0x31')][_0x5800('0x1c')]);_0x135776['offset']=qs['offset'](_0x43b514[_0x5800('0x31')]['offset']);}_0x135776[_0x5800('0x39')]=qs[_0x5800('0x3a')](_0x43b514[_0x5800('0x31')][_0x5800('0x3a')]);_0x135776[_0x5800('0x3b')]=qs[_0x5800('0x33')](_[_0x5800('0x3c')](_0x43b514[_0x5800('0x31')],_0x2fc899[_0x5800('0x33')]),_0x138f33);if(_0x43b514[_0x5800('0x31')][_0x5800('0x3d')]){_0x135776[_0x5800('0x3b')]=_[_0x5800('0x3e')](_0x135776[_0x5800('0x3b')],{'$or':_[_0x5800('0x2b')](_0x138f33,function(_0x31e728){if(_0x31e728[_0x5800('0x3f')]!==_0x5800('0x40')){var _0x4e281e={};_0x4e281e[_0x31e728['name']]={'$like':'%'+_0x43b514['query'][_0x5800('0x3d')]+'%'};return _0x4e281e;}})});}_0x135776=_[_0x5800('0x3e')]({},_0x135776,_0x43b514[_0x5800('0x41')]);var _0x562544={'where':_0x135776[_0x5800('0x3b')]};return db[_0x5800('0x2c')]['count'](_0x562544)[_0x5800('0x24')](function(_0x529bf0){_0x20ba88[_0x5800('0x1e')]=_0x529bf0;if(_0x43b514[_0x5800('0x31')]['includeAll']){_0x135776['include']=[{'all':!![]}];}return db[_0x5800('0x2c')][_0x5800('0x42')](_0x135776);})[_0x5800('0x24')](function(_0x26c007){_0x20ba88[_0x5800('0x43')]=_0x26c007;return _0x20ba88;})[_0x5800('0x24')](respondWithFilteredResult(_0x12d2de,_0x135776))[_0x5800('0x44')](handleError(_0x12d2de,null));};exports[_0x5800('0x45')]=function(_0x4b2d48,_0x129455){var _0x4cccfc={'raw':!![],'where':{'id':_0x4b2d48[_0x5800('0x46')]['id']}},_0x52fec6={};_0x52fec6[_0x5800('0x30')]=_[_0x5800('0x32')](db[_0x5800('0x2c')][_0x5800('0x2d')]);_0x52fec6[_0x5800('0x31')]=_['keys'](_0x4b2d48[_0x5800('0x31')]);_0x52fec6['filters']=_[_0x5800('0x34')](_0x52fec6[_0x5800('0x30')],_0x52fec6[_0x5800('0x31')]);_0x4cccfc[_0x5800('0x35')]=_[_0x5800('0x34')](_0x52fec6[_0x5800('0x30')],qs[_0x5800('0x36')](_0x4b2d48['query'][_0x5800('0x36')]));_0x4cccfc[_0x5800('0x35')]=_0x4cccfc[_0x5800('0x35')][_0x5800('0x37')]?_0x4cccfc[_0x5800('0x35')]:_0x52fec6[_0x5800('0x30')];if(_0x4b2d48[_0x5800('0x31')]['includeAll']){_0x4cccfc['include']=[{'all':!![]}];}_0x4cccfc=_['merge']({},_0x4cccfc,_0x4b2d48['options']);return db['Attachment'][_0x5800('0x47')](_0x4cccfc)['then'](handleEntityNotFound(_0x129455,null))[_0x5800('0x24')](respondWithResult(_0x129455,null))[_0x5800('0x44')](handleError(_0x129455,null));};exports[_0x5800('0x48')]=function(_0x2ada1f,_0x320eea){var _0x511c6f={'where':{'id':_0x2ada1f[_0x5800('0x46')]['id']}},_0x2ba64d={};_0x2ba64d[_0x5800('0x30')]=_[_0x5800('0x32')](db[_0x5800('0x2c')][_0x5800('0x2d')]);_0x511c6f[_0x5800('0x35')]=_[_0x5800('0x34')](_0x2ba64d[_0x5800('0x30')],qs[_0x5800('0x36')](_0x2ada1f[_0x5800('0x31')][_0x5800('0x36')]));_0x511c6f['attributes']=_0x511c6f['attributes']['length']?_0x511c6f[_0x5800('0x35')]:_0x2ba64d['model'];if(_0x2ada1f['query']['includeAll']){_0x511c6f[_0x5800('0x49')]=[{'all':!![]}];}_0x511c6f=_['merge']({},_0x511c6f,_0x2ada1f['options']);return db['Attachment'][_0x5800('0x47')](_0x511c6f)[_0x5800('0x24')](handleEntityNotFound(_0x320eea,null))['then'](function(_0x3d087f){if(_0x3d087f){var _0x3e4f59=_0x3d087f['get']({'plain':!![]});_0x3e4f59=qs['omit'](_0x3e4f59,['id',_0x5800('0x4a'),_0x5800('0x4b')]);_0x2ada1f[_0x5800('0x4c')]=_['omit'](_0x2ada1f['body'],['id',_0x5800('0x4a'),_0x5800('0x4b')]);return db[_0x5800('0x2c')][_0x5800('0x4d')](_['merge'](_0x3e4f59,_0x2ada1f['body']),{'include':_0x2ada1f[_0x5800('0x31')][_0x5800('0x4e')]?[{'all':!![]}]:undefined});}})[_0x5800('0x24')](respondWithResult(_0x320eea,0xc9))[_0x5800('0x44')](handleError(_0x320eea,null));};exports[_0x5800('0x23')]=function(_0x520e0d,_0x4b8491){if(_0x520e0d[_0x5800('0x4c')]['id']){delete _0x520e0d[_0x5800('0x4c')]['id'];}return db['Attachment'][_0x5800('0x47')]({'where':{'id':_0x520e0d['params']['id']}})[_0x5800('0x24')](handleEntityNotFound(_0x4b8491,null))[_0x5800('0x24')](saveUpdates(_0x520e0d[_0x5800('0x4c')],null))[_0x5800('0x24')](respondWithResult(_0x4b8491,null))[_0x5800('0x44')](handleError(_0x4b8491,null));};exports[_0x5800('0x4f')]=function(_0x5bfe07,_0x3c4cf5){return db[_0x5800('0x2c')][_0x5800('0x47')]({'where':{'id':_0x5bfe07[_0x5800('0x46')]['id']}})[_0x5800('0x24')](handleEntityNotFound(_0x3c4cf5,null))[_0x5800('0x24')](removeEntity(_0x3c4cf5,null))['catch'](handleError(_0x3c4cf5,null));};exports['create']=function(_0x2909a6,_0x289b23,_0x142b37){_0x2909a6[_0x5800('0x4c')]['name']=_0x2909a6['file']['originalname'];_0x2909a6['body'][_0x5800('0x50')]=_0x2909a6[_0x5800('0x51')][_0x5800('0x52')];_0x2909a6[_0x5800('0x4c')][_0x5800('0x3f')]=_0x2909a6['file']['mimetype'];return db['Attachment'][_0x5800('0x4d')](_0x2909a6[_0x5800('0x4c')])[_0x5800('0x24')](respondWithResult(_0x289b23,0xc9))[_0x5800('0x44')](handleError(_0x289b23,null));};exports[_0x5800('0x53')]=function(_0x306710,_0x353540,_0x520a30){return db[_0x5800('0x2c')]['findOne']({'where':{'id':_0x306710['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x353540,null))[_0x5800('0x24')](function(_0x51d2bc){if(_0x51d2bc){var _0x3b399d=_0x51d2bc['ChatOfflineMessageId']!==null;var _0x42a954=path[_0x5800('0x54')](config[_0x5800('0x55')],_0x5800('0x56'));if(_0x3b399d){_0x42a954=path['join'](_0x42a954,'offline-chat/');}var _0x7769a5=path[_0x5800('0x54')](_0x42a954,_0x51d2bc[_0x5800('0x50')]);return _0x353540[_0x5800('0x53')](_0x7769a5);}})['catch'](handleError(_0x353540,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 060537c..86f161c 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 _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 +var _0x5f8d=['define','Attachment','attachments','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x458b29,_0x42a728){var _0x1f5d48=function(_0x14d382){while(--_0x14d382){_0x458b29['push'](_0x458b29['shift']());}};_0x1f5d48(++_0x42a728);}(_0x5f8d,0x1d7));var _0xd5f8=function(_0x32e9c5,_0x2a90d3){_0x32e9c5=_0x32e9c5-0x0;var _0x285708=_0x5f8d[_0x32e9c5];return _0x285708;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd5f8('0x0'))('api');var moment=require(_0xd5f8('0x1'));var BPromise=require(_0xd5f8('0x2'));var rp=require(_0xd5f8('0x3'));var fs=require('fs');var path=require(_0xd5f8('0x4'));var rimraf=require(_0xd5f8('0x5'));var config=require(_0xd5f8('0x6'));var attributes=require(_0xd5f8('0x7'));module[_0xd5f8('0x8')]=function(_0x5a8f1f,_0x3a2aa6){return _0x5a8f1f[_0xd5f8('0x9')](_0xd5f8('0xa'),attributes,{'tableName':_0xd5f8('0xb'),'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 31c5b7d..21d132c 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 _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 +var _0x4517=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateAttachment','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4517,0x112));var _0x7451=function(_0x288050,_0x9e8961){_0x288050=_0x288050-0x0;var _0x1d0684=_0x4517[_0x288050];return _0x1d0684;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac271,_0x1bfc08,_0x26306e){return new BPromise(function(_0x443b80,_0x2c2ace){return client[_0x7451('0xc')](_0x3ac271,_0x26306e)[_0x7451('0xd')](function(_0x4b7888){logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));logger[_0x7451('0x11')](_0x7451('0x12'),_0x1bfc08,_0x7451('0x10'),JSON[_0x7451('0x13')](_0x4b7888));if(_0x4b7888['error']){if(_0x4b7888['error'][_0x7451('0x14')]===0x1f4){logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')]['message']);return _0x2c2ace(_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);}logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);return _0x443b80(_0x4b7888[_0x7451('0x15')]['message']);}else{logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));_0x443b80(_0x4b7888['result']['message']);}})[_0x7451('0x17')](function(_0x1db688){logger[_0x7451('0x15')](_0x7451('0xf'),_0x1bfc08,_0x1db688);_0x2c2ace(_0x1db688);});});}exports[_0x7451('0x18')]=function(_0xd47ee4){var _0x31a4b2=this;return new Promise(function(_0x1120b1,_0x125ab1){return db['Attachment'][_0x7451('0x19')](_0xd47ee4[_0x7451('0x1a')],{'raw':_0xd47ee4[_0x7451('0x1b')]?_0xd47ee4['options'][_0x7451('0x1c')]===undefined?!![]:![]:!![]})[_0x7451('0xd')](function(_0x3ffb08){logger[_0x7451('0xe')](_0x7451('0x18'),_0xd47ee4);logger[_0x7451('0x11')](_0x7451('0x18'),_0xd47ee4,JSON['stringify'](_0x3ffb08));_0x1120b1(_0x3ffb08);})[_0x7451('0x17')](function(_0x309be0){logger['error'](_0x7451('0x18'),_0x309be0[_0x7451('0x16')],_0xd47ee4);_0x125ab1(_0x31a4b2[_0x7451('0x15')](0x1f4,_0x309be0['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 940bb25..a784ebc 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(_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 +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x0b0e,0x187));var _0xe0b0=function(_0x290492,_0x18cfad){_0x290492=_0x290492-0x0;var _0x52b5bf=_0x0b0e[_0x290492];return _0x52b5bf;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 1837f7d..5e80ecd 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 _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 +var _0x095d=['../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','blocked','blockedAt','online','admin','user','agent','domain','blockDuration','add','clearBlockUser','getLicense','status','send','message','login','ad-login','signToken','json','User','Strategy','activedirectory2','bluebird','util'];(function(_0x2ccb36,_0x1ae845){var _0x273535=function(_0x2713c9){while(--_0x2713c9){_0x2ccb36['push'](_0x2ccb36['shift']());}};_0x273535(++_0x1ae845);}(_0x095d,0xdd));var _0xd095=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x095d[_0x5216e0];return _0x5b3f40;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0xd095('0x0')];var moment=require('moment');var ActiveDirectory=require(_0xd095('0x1'));var BPromise=require(_0xd095('0x2'));var util=require(_0xd095('0x3'));var db=require(_0xd095('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xd095('0x5'));var config=require(_0xd095('0x6'));var logger=require(_0xd095('0x7'))(_0xd095('0x8'));function isActiveDirectoryConfigured(_0x392bde){var _0x335fc8=![];if(typeof _0x392bde[_0xd095('0x9')]!==_0xd095('0xa')){_0x335fc8=_0x392bde[_0xd095('0x9')][_0xd095('0xb')]&&_0x392bde[_0xd095('0x9')]['url']&&_0x392bde[_0xd095('0x9')]['domain'];}return _0x335fc8;}function adAuthenticate(_0x3cd0d9,_0x4b1207,_0x93a97b){return new BPromise(function(_0x17c744,_0x2834b8){try{var _0x2ee5f7=new ActiveDirectory(_0x3cd0d9);_0x2ee5f7[_0xd095('0xc')](_0x4b1207,_0x93a97b,function(_0x1c4089,_0x4ee079){if(_0x1c4089){logger[_0xd095('0xd')](_0xd095('0xe'),_0x4b1207,util[_0xd095('0xf')](_0x1c4089,{'showHidden':![],'depth':null}));_0x2834b8(_0xd095('0x10'));}else if(!_0x4ee079){logger['error'](_0xd095('0x11'),_0x4b1207);_0x2834b8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x17c744(_0x4ee079);}});}catch(_0x10c276){_0x2834b8(_0x10c276);}});}function ActiveDirectoryAuthenticate(_0x1dcfde,_0x145637,_0x5973ae,_0x40390f){var _0x521793,_0x5e08d1;if(!isActiveDirectoryConfigured(config)){logger[_0xd095('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x145637);return _0x40390f(null,![],{'message':_0xd095('0x10')});}return db[_0xd095('0x12')][_0xd095('0x13')]({'where':{'id':0x1},'attributes':[_0xd095('0x14'),'blockDuration'],'raw':!![]})[_0xd095('0x15')](function(_0x2606fd){_0x521793=_0x2606fd;if(!_0x521793[_0xd095('0x14')]){logger[_0xd095('0xd')](_0xd095('0x16'),_0x145637);throw new Error(_0xd095('0x10'));}return _0x1dcfde[_0xd095('0x13')]({'attributes':['id',_0xd095('0x17'),_0xd095('0x18'),'salt',_0xd095('0x19'),'disabled',_0xd095('0x1a'),_0xd095('0x1b'),_0xd095('0x1c')],'where':{'name':_0x145637,'role':{'$or':[_0xd095('0x1d'),_0xd095('0x1e'),_0xd095('0x1f')]},'adSsoEnabled':!![]}});})[_0xd095('0x15')](function(_0x6384d){if(!_0x6384d||_0x6384d&&_0x6384d[_0xd095('0x17')]!==_0x145637){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5e08d1=_0x6384d;var _0x44001b=_0x5e08d1[_0xd095('0x17')]+'@'+config['activedirectory'][_0xd095('0x20')];return adAuthenticate(config['activedirectory'],_0x44001b,_0x5973ae);})[_0xd095('0x15')](function(_0x22c7ec){if(_0x5e08d1['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x521793[_0xd095('0x21')]>0x0){if(_0x5e08d1[_0xd095('0x1a')]){if(moment(_0x5e08d1['blockedAt'])[_0xd095('0x22')](_0x521793[_0xd095('0x21')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xd095('0x23')](_0x5e08d1,0x0,![],null)[_0xd095('0x15')](function(){return utils['getLicense'](_0x5e08d1);})[_0xd095('0x15')](function(){return _0x40390f(null,_0x5e08d1);});}else{return utils[_0xd095('0x24')](_0x5e08d1)[_0xd095('0x15')](function(){return _0x40390f(null,_0x5e08d1);});}}else{return utils[_0xd095('0x24')](_0x5e08d1)['then'](function(){return _0x40390f(null,_0x5e08d1);});}})['catch'](function(_0x213e38){return _0x40390f(null,![],_0x213e38);});}function handleError(_0x456215,_0x1125cf,_0x1ba3af){return _0x456215[_0xd095('0x25')](_0x1125cf||0x1f4)[_0xd095('0x26')]({'message':_0x1ba3af?_0x1ba3af[_0xd095('0x27')]||_0x1ba3af:''});}exports[_0xd095('0x28')]=function(_0x54a170,_0x148096,_0x33ebb4){passport[_0xd095('0xc')](_0xd095('0x29'),function(_0x4ba1a6,_0x57860f,_0x11f4bd){var _0x516eaa=_0x4ba1a6||_0x11f4bd;if(_0x516eaa){return handleError(_0x148096,0x191,_0x516eaa);}if(!_0x57860f){return handleError(_0x148096,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3da2e2={'payload':{'id':_0x57860f['id'],'role':_0x57860f[_0xd095('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0xd095('0x2a')](_0x3da2e2)['then'](function(_0x1bcc2a){_0x148096[_0xd095('0x2b')]({'id':_0x57860f['id'],'token':_0x1bcc2a,'statusCall':'','isAlreadyLogged':_0x57860f[_0xd095('0x1c')]});});}})(_0x54a170,_0x148096,_0x33ebb4);};passport['use'](_0xd095('0x29'),new LocalStrategy({'usernameField':_0xd095('0x17'),'passwordField':_0xd095('0x18')},function(_0x45b1f0,_0x4aac55,_0x5e777f){return ActiveDirectoryAuthenticate(db[_0xd095('0x2c')],_0x45b1f0,_0x4aac55,_0x5e777f);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a439714..5ec24fc 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 _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 +var _0xe493=['exports','express','Router'];(function(_0x24bbec,_0x3b2d63){var _0x478a94=function(_0x446aea){while(--_0x446aea){_0x24bbec['push'](_0x24bbec['shift']());}};_0x478a94(++_0x3b2d63);}(_0xe493,0xb5));var _0x3e49=function(_0xdcc555,_0x4bee14){_0xdcc555=_0xdcc555-0x0;var _0x112a06=_0xe493[_0xdcc555];return _0x112a06;};'use strict';var express=require(_0x3e49('0x0'));var router=express[_0x3e49('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0x3e49('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index bdce72b..68909c4 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_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 +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(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x7a54,0x106));var _0x47a5=function(_0x56277f,_0x4fc6b9){_0x56277f=_0x56277f-0x0;var _0x38add7=_0x7a54[_0x56277f];return _0x38add7;};'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 6635ee8..cc1200f 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 _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 +var _0x83b4=['callback','isMiddleware','login','setTokenCookie','Router','./authGoogle.controller','../user/user.controller.js','get'];(function(_0x3b025f,_0x3f4d04){var _0xb129b2=function(_0x2fb05a){while(--_0x2fb05a){_0x3b025f['push'](_0x3b025f['shift']());}};_0xb129b2(++_0x3f4d04);}(_0x83b4,0xc4));var _0x483b=function(_0x20b326,_0x23e1dd){_0x20b326=_0x20b326-0x0;var _0x150fc9=_0x83b4[_0x20b326];return _0x150fc9;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x483b('0x0')]();var controller=require(_0x483b('0x1'));var userController=require(_0x483b('0x2'));var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0x483b('0x3')]('/callback',controller[_0x483b('0x4')],authService[_0x483b('0x5')],userController[_0x483b('0x6')],authService[_0x483b('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d2ab577..275384f 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 _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 +var _0x23e6=['validatePasswordPattern','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','util','passport','Strategy','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','clearBlockUser','minutes','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','signToken','online','forgot','body','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','securePassword'];(function(_0x2637bd,_0xdcbfbe){var _0xde2f0d=function(_0x1d7fcb){while(--_0x1d7fcb){_0x2637bd['push'](_0x2637bd['shift']());}};_0xde2f0d(++_0xdcbfbe);}(_0x23e6,0xed));var _0x623e=function(_0x1b16ba,_0xe1a8dc){_0x1b16ba=_0x1b16ba-0x0;var _0x30d703=_0x23e6[_0x1b16ba];return _0x30d703;};'use strict';var util=require(_0x623e('0x0'));var passport=require(_0x623e('0x1'));var LocalStrategy=require('passport-local')[_0x623e('0x2')];var jayson=require(_0x623e('0x3'));var _=require('lodash');var rs=require(_0x623e('0x4'));var moment=require('moment');var db=require(_0x623e('0x5'))['db'];var authService=require(_0x623e('0x6'));var utils=require(_0x623e('0x7'));var client=jayson['client'][_0x623e('0x8')]({'port':0x232b});function localAuthenticate(_0x2d7cba,_0x24af01,_0xcf1866,_0x4adc5c){var _0x518b5e,_0x437668;return db[_0x623e('0x9')][_0x623e('0xa')]({'where':{'id':0x1},'attributes':[_0x623e('0xb'),'blockDuration'],'raw':!![]})[_0x623e('0xc')](function(_0x461726){_0x518b5e=_0x461726;return _0x2d7cba[_0x623e('0xa')]({'attributes':['id',_0x623e('0xd'),_0x623e('0xe'),'salt',_0x623e('0xf'),_0x623e('0x10'),_0x623e('0x11'),_0x623e('0x12'),_0x623e('0x13')],'where':{'name':_0x24af01,'role':{'$or':[_0x623e('0x14'),_0x623e('0x15'),_0x623e('0x16')]}}});})[_0x623e('0xc')](function(_0x4f3a3e){if(!_0x4f3a3e||_0x4f3a3e&&_0x4f3a3e[_0x623e('0xd')]!==_0x24af01){throw new Error(_0x623e('0x17'));}else{_0x437668=_0x4f3a3e;return _0x437668;}})['then'](function(){_0x437668[_0x623e('0x18')](_0xcf1866,function(_0x14c480,_0x4977be){var _0x429943=_0x437668[_0x623e('0x13')]+0x1;if(_0x14c480){return _0x4adc5c(_0x14c480);}else if(!_0x4977be){if(_0x437668[_0x623e('0x10')]){return _0x4adc5c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x518b5e[_0x623e('0xb')]>0x0){if(_0x437668[_0x623e('0x11')]){if(_0x518b5e[_0x623e('0x19')]>0x0){if(moment(_0x437668[_0x623e('0x12')])[_0x623e('0x1a')](_0x518b5e['blockDuration'],'minutes')>moment()){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else{return utils[_0x623e('0x1b')](_0x437668,_0x429943,![],null)[_0x623e('0xc')](function(){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});});}}else{return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}}else{if(_0x429943>=_0x518b5e[_0x623e('0xb')]){return utils[_0x623e('0x1b')](_0x437668,0x0,!![],moment())[_0x623e('0xc')](function(){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});});}else{return utils[_0x623e('0x1b')](_0x437668,_0x429943,![],null)[_0x623e('0xc')](function(){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});});}}}else{return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}}else{if(_0x437668[_0x623e('0x10')]){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else if(_0x518b5e[_0x623e('0xb')]>0x0){if(_0x437668[_0x623e('0x11')]){if(_0x518b5e[_0x623e('0x19')]>0x0){if(moment(_0x437668[_0x623e('0x12')])[_0x623e('0x1a')](_0x518b5e[_0x623e('0x19')],_0x623e('0x1c'))>moment()){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else{return utils[_0x623e('0x1b')](_0x437668,0x0,![],null)[_0x623e('0xc')](function(){return utils['getLicense'](_0x437668);})[_0x623e('0xc')](function(){return _0x4adc5c(null,_0x437668);});}}else{return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}}else{return utils[_0x623e('0x1b')](_0x437668,0x0,![],null)['then'](function(){return utils['getLicense'](_0x437668);})['then'](function(){return _0x4adc5c(null,_0x437668);})[_0x623e('0x1d')](function(_0x42e488){return _0x4adc5c(null,![],_0x42e488);});}}else{if(_0x437668[_0x623e('0x11')]){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else{return utils[_0x623e('0x1e')](_0x437668)[_0x623e('0xc')](function(){return _0x4adc5c(null,_0x437668);});}}}});})['catch'](function(_0x519f0f){return _0x4adc5c(null,![],_0x519f0f);});}function sendServiceMail(_0x319c36){return db[_0x623e('0x1f')][_0x623e('0x20')]({'where':{'service':!![]},'attributes':['id',_0x623e('0xd'),_0x623e('0x21')],'include':[{'model':db[_0x623e('0x22')],'as':_0x623e('0x23'),'include':[{'model':db[_0x623e('0x24')],'as':_0x623e('0x24')}]}]})[_0x623e('0xc')](function(_0x273091){if(!_0x273091){throw new Error(_0x623e('0x25'));}var _0xb70723=_0x273091['getSmtpOptions']();var _0x334e80={'account':_0xb70723,'message':_[_0x623e('0x26')]({'from':util[_0x623e('0x27')](_0x623e('0x28'),_0x273091[_0x623e('0xd')],_0x273091[_0x623e('0x21')]||_0x273091[_0x623e('0x23')][_0x623e('0x15')])},_0x319c36)};return client['request']('SendMail',_0x334e80);})[_0x623e('0xc')](function(_0x31efee){if(_0x31efee[_0x623e('0x29')]){throw new Error(util[_0x623e('0x27')](_0x623e('0x2a'),_0x31efee[_0x623e('0x29')][_0x623e('0x2b')]||JSON[_0x623e('0x2c')](_0x31efee[_0x623e('0x29')])));}return!![];});}function handleError(_0x367a01,_0x560c94,_0x51b3f8){return _0x367a01[_0x623e('0x2d')](_0x560c94||0x1f4)[_0x623e('0x2e')]({'message':_0x51b3f8?_0x51b3f8[_0x623e('0x2b')]||_0x51b3f8:''});}exports[_0x623e('0x2f')]=function(_0x41e8c6,_0x26ebe6,_0x30a1bc){passport[_0x623e('0x18')](_0x623e('0x30'),function(_0x5c7df1,_0x5054ba,_0x3de14b){var _0x4c5b39=_0x5c7df1||_0x3de14b;if(_0x4c5b39){return handleError(_0x26ebe6,0x191,_0x4c5b39);}if(!_0x5054ba){return handleError(_0x26ebe6,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x35c57f={'payload':{'id':_0x5054ba['id'],'role':_0x5054ba['role']},'options':{'expiresIn':0x15180}};return authService[_0x623e('0x31')](_0x35c57f)[_0x623e('0xc')](function(_0x5e2660){_0x26ebe6['json']({'id':_0x5054ba['id'],'token':_0x5e2660,'statusCall':'','isAlreadyLogged':_0x5054ba[_0x623e('0x32')]});});}})(_0x41e8c6,_0x26ebe6,_0x30a1bc);};exports[_0x623e('0x33')]=function(_0x1c1079,_0x17e1f5){if(!_0x1c1079[_0x623e('0x34')][_0x623e('0x21')]){return handleError(_0x17e1f5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xa5a466=rs['generate']();_0x1c1079[_0x623e('0x34')][_0x623e('0x21')]=_0x1c1079['body']['email'][_0x623e('0x35')]()[_0x623e('0x36')]();var _0x4112d7;return db[_0x623e('0x9')][_0x623e('0xa')]({'where':{'id':0x1},'attributes':[_0x623e('0xb'),_0x623e('0x19')],'raw':!![]})[_0x623e('0xc')](function(_0x221c3d){_0x4112d7=_0x221c3d;return db['User'][_0x623e('0x20')]({'where':{'email':_0x1c1079[_0x623e('0x34')][_0x623e('0x21')]}});})['then'](function(_0x5e0e7f){if(!_0x5e0e7f){throw new Error(_0x623e('0x37'));}if(_0x5e0e7f[_0x623e('0x10')]){throw new Error(_0x623e('0x38'));}if(_0x5e0e7f[_0x623e('0x11')]){if(moment(_0x5e0e7f[_0x623e('0x12')])[_0x623e('0x1a')](_0x4112d7[_0x623e('0x19')],_0x623e('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x5e0e7f['blocked']=![];_0x5e0e7f['blockedAt']=null;}}_0x5e0e7f[_0x623e('0x39')]=_0xa5a466;_0x5e0e7f['resetPasswordExpires']=Date[_0x623e('0x3a')]()+0x36ee80;return _0x5e0e7f[_0x623e('0x3b')]();})['then'](function(){return sendServiceMail({'to':_0x1c1079['body'][_0x623e('0x21')],'subject':_0x623e('0x3c'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x623e('0x3d')+'https://'+_0x1c1079['headers'][_0x623e('0x3e')]+_0x623e('0x3f')+_0xa5a466+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x17e1f5[_0x623e('0x2d')](0xc8)[_0x623e('0x2e')]({'message':_0x623e('0x40')});})[_0x623e('0x1d')](function(_0x495641){return handleError(_0x17e1f5,0x1f4,_0x495641);});};exports[_0x623e('0x41')]=function(_0x38dc81,_0x21fdc9){return db[_0x623e('0x42')][_0x623e('0x20')]({'where':{'resetPasswordToken':_0x38dc81[_0x623e('0x43')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x3879bd){if(!_0x3879bd){throw new Error(_0x623e('0x44'));}return db['Setting'][_0x623e('0xa')]({'attributes':['id','securePassword',_0x623e('0x45'),'passwordHistoryLimit']})[_0x623e('0xc')](function(_0x51a863){if(_0x51a863[_0x623e('0x46')])authService[_0x623e('0x47')](_0x38dc81['body'][_0x623e('0xe')]);if(!_0x51a863[_0x623e('0x45')]||!_0x3879bd['previousPasswords'])return _0x3879bd;authService[_0x623e('0x48')](_0x38dc81[_0x623e('0x34')]['password'],_0x3879bd[_0x623e('0x49')],_0x51a863[_0x623e('0x4a')]);return _0x3879bd;})[_0x623e('0xc')](function(){_0x3879bd[_0x623e('0xe')]=_0x38dc81['body'][_0x623e('0xe')];_0x3879bd['resetPasswordToken']=null;_0x3879bd[_0x623e('0x4b')]=null;return _0x3879bd[_0x623e('0x3b')]();});})[_0x623e('0xc')](function(){_0x21fdc9[_0x623e('0x2d')](0xc8)['send']({'message':_0x623e('0x4c')});})[_0x623e('0x1d')](function(_0x4ff9e8){return handleError(_0x21fdc9,0x1f4,_0x4ff9e8);});};passport['use'](_0x623e('0x30'),new LocalStrategy({'usernameField':_0x623e('0xd'),'passwordField':_0x623e('0xe')},function(_0x213210,_0x5acf43,_0x229347){return localAuthenticate(db[_0x623e('0x42')],_0x213210,_0x5acf43,_0x229347);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4a69931..3363714 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 _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 +var _0xceb0=['forgot','/reset/:token','reset','exports','express','./authLocal.controller','post','/forgot'];(function(_0x5fca4f,_0x571272){var _0x30444c=function(_0xb75dc5){while(--_0xb75dc5){_0x5fca4f['push'](_0x5fca4f['shift']());}};_0x30444c(++_0x571272);}(_0xceb0,0x174));var _0x0ceb=function(_0x1894fc,_0x317c9a){_0x1894fc=_0x1894fc-0x0;var _0x4993e5=_0xceb0[_0x1894fc];return _0x4993e5;};'use strict';var express=require(_0x0ceb('0x0'));var router=express['Router']();var controller=require(_0x0ceb('0x1'));router[_0x0ceb('0x2')]('/',controller['login']);router[_0x0ceb('0x2')](_0x0ceb('0x3'),controller[_0x0ceb('0x4')]);router[_0x0ceb('0x2')](_0x0ceb('0x5'),controller[_0x0ceb('0x6')]);module[_0x0ceb('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 de50434..e5821b2 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 _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 +var _0x1c87=['exports','STRING','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1c87,0xc3));var _0x71c8=function(_0x2ce00f,_0x41d23a){_0x2ce00f=_0x2ce00f-0x0;var _0x47f2f7=_0x1c87[_0x2ce00f];return _0x47f2f7;};'use strict';var Sequelize=require('sequelize');module[_0x71c8('0x0')]={'name':{'type':Sequelize[_0x71c8('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x71c8('0x1')]},'description':{'type':Sequelize[_0x71c8('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x71c8('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 5c24801..7200299 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 _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 +var _0x16b6=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','params','include','options','catch','create','body','find','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x50ab49,_0x2b7733){var _0x14c763=function(_0x592609){while(--_0x592609){_0x50ab49['push'](_0x50ab49['shift']());}};_0x14c763(++_0x2b7733);}(_0x16b6,0x143));var _0x616b=function(_0x39ad89,_0x1ecd5a){_0x39ad89=_0x39ad89-0x0;var _0x2338d8=_0x16b6[_0x39ad89];return _0x2338d8;};'use strict';var emlformat=require(_0x616b('0x0'));var rimraf=require(_0x616b('0x1'));var zipdir=require(_0x616b('0x2'));var jsonpatch=require(_0x616b('0x3'));var rp=require(_0x616b('0x4'));var moment=require(_0x616b('0x5'));var BPromise=require(_0x616b('0x6'));var Mustache=require(_0x616b('0x7'));var util=require(_0x616b('0x8'));var path=require(_0x616b('0x9'));var sox=require(_0x616b('0xa'));var csv=require(_0x616b('0xb'));var ejs=require(_0x616b('0xc'));var fs=require('fs');var fs_extra=require(_0x616b('0xd'));var _=require(_0x616b('0xe'));var squel=require(_0x616b('0xf'));var crypto=require('crypto');var jsforce=require(_0x616b('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x616b('0x11'));var Papa=require('papaparse');var Redis=require(_0x616b('0x12'));var authService=require(_0x616b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x616b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x616b('0x15'));var db=require(_0x616b('0x16'))['db'];function respondWithStatusCode(_0x53142e,_0xff9888){_0xff9888=_0xff9888||0xcc;return function(_0x410a32){if(_0x410a32){return _0x53142e[_0x616b('0x17')](_0xff9888);}return _0x53142e[_0x616b('0x18')](_0xff9888)['end']();};}function respondWithResult(_0x39a4a1,_0x43b8dd){_0x43b8dd=_0x43b8dd||0xc8;return function(_0x4ad19e){if(_0x4ad19e){return _0x39a4a1['status'](_0x43b8dd)[_0x616b('0x19')](_0x4ad19e);}};}function respondWithFilteredResult(_0x19282e,_0x4c9601){return function(_0x5d158c){if(_0x5d158c){var _0xbf7905=typeof _0x4c9601[_0x616b('0x1a')]===_0x616b('0x1b')&&typeof _0x4c9601[_0x616b('0x1c')]===_0x616b('0x1b');var _0x3116f8=_0x5d158c[_0x616b('0x1d')];var _0x2d135d=_0xbf7905?0x0:_0x4c9601[_0x616b('0x1a')];var _0xd14135=_0xbf7905?_0x5d158c['count']:_0x4c9601[_0x616b('0x1a')]+_0x4c9601[_0x616b('0x1c')];var _0x56ca9b;if(_0xd14135>=_0x3116f8){_0xd14135=_0x3116f8;_0x56ca9b=0xc8;}else{_0x56ca9b=0xce;}_0x19282e[_0x616b('0x18')](_0x56ca9b);return _0x19282e['set'](_0x616b('0x1e'),_0x2d135d+'-'+_0xd14135+'/'+_0x3116f8)[_0x616b('0x19')](_0x5d158c);}return null;};}function patchUpdates(_0x328566){return function(_0x54283a){try{jsonpatch[_0x616b('0x1f')](_0x54283a,_0x328566,!![]);}catch(_0x3da462){return BPromise[_0x616b('0x20')](_0x3da462);}return _0x54283a[_0x616b('0x21')]();};}function saveUpdates(_0x5dac99,_0x4eda4){return function(_0x3f5f0d){if(_0x3f5f0d){return _0x3f5f0d[_0x616b('0x22')](_0x5dac99)[_0x616b('0x23')](function(_0xfc68a1){return _0xfc68a1;});}return null;};}function removeEntity(_0x4dd899,_0x254b77){return function(_0x372de8){if(_0x372de8){return _0x372de8[_0x616b('0x24')]()[_0x616b('0x23')](function(){_0x4dd899[_0x616b('0x18')](0xcc)[_0x616b('0x25')]();});}};}function handleEntityNotFound(_0x504ef7,_0x128314){return function(_0x456be3){if(!_0x456be3){_0x504ef7[_0x616b('0x17')](0x194);}return _0x456be3;};}function handleError(_0x1230f7,_0x4db018){_0x4db018=_0x4db018||0x1f4;return function(_0x4266a8){logger[_0x616b('0x26')](_0x4266a8[_0x616b('0x27')]);if(_0x4266a8[_0x616b('0x28')]){delete _0x4266a8[_0x616b('0x28')];}_0x1230f7[_0x616b('0x18')](_0x4db018)[_0x616b('0x29')](_0x4266a8);};}exports[_0x616b('0x2a')]=function(_0xf13c81,_0x4d438b){var _0x5064f2={},_0x29175b={},_0x3f425a={'count':0x0,'rows':[]};var _0x39163a=_[_0x616b('0x2b')](db[_0x616b('0x2c')][_0x616b('0x2d')],function(_0x35775e){return{'name':_0x35775e[_0x616b('0x2e')],'type':_0x35775e[_0x616b('0x2f')][_0x616b('0x30')]};});_0x29175b[_0x616b('0x31')]=_[_0x616b('0x2b')](_0x39163a,_0x616b('0x28'));_0x29175b[_0x616b('0x32')]=_[_0x616b('0x33')](_0xf13c81['query']);_0x29175b[_0x616b('0x34')]=_[_0x616b('0x35')](_0x29175b[_0x616b('0x31')],_0x29175b['query']);_0x5064f2[_0x616b('0x36')]=_[_0x616b('0x35')](_0x29175b['model'],qs['fields'](_0xf13c81[_0x616b('0x32')][_0x616b('0x37')]));_0x5064f2[_0x616b('0x36')]=_0x5064f2['attributes'][_0x616b('0x38')]?_0x5064f2['attributes']:_0x29175b[_0x616b('0x31')];if(!_0xf13c81['query'][_0x616b('0x39')](_0x616b('0x3a'))){_0x5064f2[_0x616b('0x1c')]=qs[_0x616b('0x1c')](_0xf13c81['query'][_0x616b('0x1c')]);_0x5064f2[_0x616b('0x1a')]=qs[_0x616b('0x1a')](_0xf13c81[_0x616b('0x32')]['offset']);}_0x5064f2[_0x616b('0x3b')]=qs['sort'](_0xf13c81[_0x616b('0x32')][_0x616b('0x3c')]);_0x5064f2[_0x616b('0x3d')]=qs[_0x616b('0x34')](_[_0x616b('0x3e')](_0xf13c81[_0x616b('0x32')],_0x29175b['filters']),_0x39163a);if(_0xf13c81[_0x616b('0x32')][_0x616b('0x3f')]){_0x5064f2['where']=_[_0x616b('0x40')](_0x5064f2['where'],{'$or':_[_0x616b('0x2b')](_0x39163a,function(_0x228a64){if(_0x228a64[_0x616b('0x2f')]!==_0x616b('0x41')){var _0x2aff35={};_0x2aff35[_0x228a64['name']]={'$like':'%'+_0xf13c81[_0x616b('0x32')][_0x616b('0x3f')]+'%'};return _0x2aff35;}})});}_0x5064f2=_['merge']({},_0x5064f2,_0xf13c81['options']);var _0x12d677={'where':_0x5064f2[_0x616b('0x3d')]};return db[_0x616b('0x2c')]['count'](_0x12d677)['then'](function(_0x421482){_0x3f425a[_0x616b('0x1d')]=_0x421482;if(_0xf13c81[_0x616b('0x32')][_0x616b('0x42')]){_0x5064f2['include']=[{'all':!![]}];}return db[_0x616b('0x2c')]['findAll'](_0x5064f2);})[_0x616b('0x23')](function(_0x4eaade){_0x3f425a['rows']=_0x4eaade;return _0x3f425a;})[_0x616b('0x23')](respondWithFilteredResult(_0x4d438b,_0x5064f2))['catch'](handleError(_0x4d438b,null));};exports['show']=function(_0x16b22e,_0x465f81){var _0x289b0e={'raw':![],'where':{'id':_0x16b22e[_0x616b('0x43')]['id']}},_0xfd6247={};_0xfd6247[_0x616b('0x31')]=_[_0x616b('0x33')](db['Automation'][_0x616b('0x2d')]);_0xfd6247[_0x616b('0x32')]=_[_0x616b('0x33')](_0x16b22e[_0x616b('0x32')]);_0xfd6247[_0x616b('0x34')]=_['intersection'](_0xfd6247[_0x616b('0x31')],_0xfd6247[_0x616b('0x32')]);_0x289b0e[_0x616b('0x36')]=_['intersection'](_0xfd6247[_0x616b('0x31')],qs[_0x616b('0x37')](_0x16b22e[_0x616b('0x32')][_0x616b('0x37')]));_0x289b0e[_0x616b('0x36')]=_0x289b0e[_0x616b('0x36')][_0x616b('0x38')]?_0x289b0e['attributes']:_0xfd6247[_0x616b('0x31')];if(_0x16b22e[_0x616b('0x32')][_0x616b('0x42')]){_0x289b0e[_0x616b('0x44')]=[{'all':!![]}];}_0x289b0e=_[_0x616b('0x40')]({},_0x289b0e,_0x16b22e[_0x616b('0x45')]);return db[_0x616b('0x2c')]['find'](_0x289b0e)[_0x616b('0x23')](handleEntityNotFound(_0x465f81,null))[_0x616b('0x23')](respondWithResult(_0x465f81,null))[_0x616b('0x46')](handleError(_0x465f81,null));};exports[_0x616b('0x47')]=function(_0x3f1256,_0x1c0069){return db[_0x616b('0x2c')][_0x616b('0x47')](_0x3f1256[_0x616b('0x48')],{})[_0x616b('0x23')](respondWithResult(_0x1c0069,0xc9))['catch'](handleError(_0x1c0069,null));};exports[_0x616b('0x22')]=function(_0x2867f7,_0x2403fe){if(_0x2867f7['body']['id']){delete _0x2867f7[_0x616b('0x48')]['id'];}return db[_0x616b('0x2c')][_0x616b('0x49')]({'where':{'id':_0x2867f7[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x2403fe,null))[_0x616b('0x23')](saveUpdates(_0x2867f7[_0x616b('0x48')],null))[_0x616b('0x23')](respondWithResult(_0x2403fe,null))[_0x616b('0x46')](handleError(_0x2403fe,null));};exports['destroy']=function(_0x186445,_0x57fc1f){return db['Automation'][_0x616b('0x49')]({'where':{'id':_0x186445[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x57fc1f,null))[_0x616b('0x23')](removeEntity(_0x57fc1f,null))[_0x616b('0x46')](handleError(_0x57fc1f,null));};exports[_0x616b('0x4a')]=function(_0x487b0f,_0x191555,_0x4fad2c){return db['Condition'][_0x616b('0x49')]({'where':{'id':_0x487b0f[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x191555,null))['then'](function(_0x4f4e14){if(_0x4f4e14){return _0x4f4e14['addConditions'](_0x487b0f[_0x616b('0x48')][_0x616b('0x4b')],_[_0x616b('0x4c')](_0x487b0f[_0x616b('0x48')],['ids','id'])||{});}})[_0x616b('0x23')](respondWithResult(_0x191555,null))[_0x616b('0x46')](handleError(_0x191555,null));};exports[_0x616b('0x4d')]=function(_0x48c24c,_0x2e9098,_0x37955a){var _0x13e801={};var _0x4a31a7={};var _0xc8aca0;var _0x4a63ab;return db['Automation'][_0x616b('0x4e')]({'where':{'id':_0x48c24c['params']['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x2e9098,null))['then'](function(_0x180c7d){if(_0x180c7d){_0xc8aca0=_0x180c7d;_0x4a31a7[_0x616b('0x31')]=_[_0x616b('0x33')](db[_0x616b('0x4f')][_0x616b('0x2d')]);_0x4a31a7[_0x616b('0x32')]=_[_0x616b('0x33')](_0x48c24c[_0x616b('0x32')]);_0x4a31a7[_0x616b('0x34')]=_['intersection'](_0x4a31a7['model'],_0x4a31a7[_0x616b('0x32')]);_0x13e801['attributes']=_[_0x616b('0x35')](_0x4a31a7[_0x616b('0x31')],qs[_0x616b('0x37')](_0x48c24c['query']['fields']));_0x13e801[_0x616b('0x36')]=_0x13e801['attributes'][_0x616b('0x38')]?_0x13e801[_0x616b('0x36')]:_0x4a31a7[_0x616b('0x31')];_0x13e801[_0x616b('0x3b')]=qs[_0x616b('0x3c')](_0x48c24c[_0x616b('0x32')][_0x616b('0x3c')]);_0x13e801[_0x616b('0x3d')]=qs[_0x616b('0x34')](_[_0x616b('0x3e')](_0x48c24c[_0x616b('0x32')],_0x4a31a7[_0x616b('0x34')]));if(_0x48c24c[_0x616b('0x32')]['filter']){_0x13e801[_0x616b('0x3d')]=_[_0x616b('0x40')](_0x13e801[_0x616b('0x3d')],{'$or':_[_0x616b('0x2b')](_0x13e801[_0x616b('0x36')],function(_0x237cd9){var _0x306286={};_0x306286[_0x237cd9]={'$like':'%'+_0x48c24c['query'][_0x616b('0x3f')]+'%'};return _0x306286;})});}_0x13e801=_[_0x616b('0x40')]({},_0x13e801,_0x48c24c['options']);return _0xc8aca0[_0x616b('0x4d')](_0x13e801);}})[_0x616b('0x23')](function(_0x13590a){if(_0x13590a){_0x4a63ab=_0x13590a[_0x616b('0x38')];if(!_0x48c24c[_0x616b('0x32')][_0x616b('0x39')](_0x616b('0x3a'))){_0x13e801['limit']=qs['limit'](_0x48c24c[_0x616b('0x32')]['limit']);_0x13e801[_0x616b('0x1a')]=qs[_0x616b('0x1a')](_0x48c24c['query'][_0x616b('0x1a')]);}return _0xc8aca0[_0x616b('0x4d')](_0x13e801);}})[_0x616b('0x23')](function(_0x292c9d){if(_0x292c9d){return _0x292c9d?{'count':_0x4a63ab,'rows':_0x292c9d}:null;}})['then'](respondWithResult(_0x2e9098,null))[_0x616b('0x46')](handleError(_0x2e9098,null));};exports['addActions']=function(_0x3ec1ed,_0x49700f,_0x5b80be){return db['Action'][_0x616b('0x49')]({'where':{'id':_0x3ec1ed[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x49700f,null))['then'](function(_0x21bd20){if(_0x21bd20){return _0x21bd20[_0x616b('0x50')](_0x3ec1ed['body']['ids'],_['omit'](_0x3ec1ed[_0x616b('0x48')],[_0x616b('0x4b'),'id'])||{});}})[_0x616b('0x23')](respondWithResult(_0x49700f,null))[_0x616b('0x46')](handleError(_0x49700f,null));};exports['getActions']=function(_0x463bdf,_0x47579f,_0x293ecf){var _0x27fcaa={};var _0x4c1900={};var _0x2b3632;var _0x6dcd2a;return db[_0x616b('0x2c')][_0x616b('0x4e')]({'where':{'id':_0x463bdf[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x47579f,null))['then'](function(_0x564c78){if(_0x564c78){_0x2b3632=_0x564c78;_0x4c1900[_0x616b('0x31')]=_[_0x616b('0x33')](db[_0x616b('0x51')][_0x616b('0x2d')]);_0x4c1900[_0x616b('0x32')]=_['keys'](_0x463bdf[_0x616b('0x32')]);_0x4c1900[_0x616b('0x34')]=_[_0x616b('0x35')](_0x4c1900[_0x616b('0x31')],_0x4c1900[_0x616b('0x32')]);_0x27fcaa[_0x616b('0x36')]=_['intersection'](_0x4c1900[_0x616b('0x31')],qs[_0x616b('0x37')](_0x463bdf['query']['fields']));_0x27fcaa[_0x616b('0x36')]=_0x27fcaa[_0x616b('0x36')][_0x616b('0x38')]?_0x27fcaa[_0x616b('0x36')]:_0x4c1900[_0x616b('0x31')];_0x27fcaa[_0x616b('0x3b')]=qs[_0x616b('0x3c')](_0x463bdf[_0x616b('0x32')][_0x616b('0x3c')]);_0x27fcaa[_0x616b('0x3d')]=qs[_0x616b('0x34')](_[_0x616b('0x3e')](_0x463bdf[_0x616b('0x32')],_0x4c1900[_0x616b('0x34')]));if(_0x463bdf['query']['filter']){_0x27fcaa['where']=_[_0x616b('0x40')](_0x27fcaa['where'],{'$or':_[_0x616b('0x2b')](_0x27fcaa[_0x616b('0x36')],function(_0x5e2c99){var _0x2c524d={};_0x2c524d[_0x5e2c99]={'$like':'%'+_0x463bdf[_0x616b('0x32')][_0x616b('0x3f')]+'%'};return _0x2c524d;})});}_0x27fcaa=_[_0x616b('0x40')]({},_0x27fcaa,_0x463bdf['options']);return _0x2b3632[_0x616b('0x52')](_0x27fcaa);}})[_0x616b('0x23')](function(_0xa10d1e){if(_0xa10d1e){_0x6dcd2a=_0xa10d1e['length'];if(!_0x463bdf[_0x616b('0x32')][_0x616b('0x39')]('nolimit')){_0x27fcaa[_0x616b('0x1c')]=qs[_0x616b('0x1c')](_0x463bdf[_0x616b('0x32')][_0x616b('0x1c')]);_0x27fcaa['offset']=qs[_0x616b('0x1a')](_0x463bdf[_0x616b('0x32')][_0x616b('0x1a')]);}return _0x2b3632[_0x616b('0x52')](_0x27fcaa);}})[_0x616b('0x23')](function(_0x53a1a7){if(_0x53a1a7){return _0x53a1a7?{'count':_0x6dcd2a,'rows':_0x53a1a7}:null;}})[_0x616b('0x23')](respondWithResult(_0x47579f,null))[_0x616b('0x46')](handleError(_0x47579f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d68ffb6..2cd8a16 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 _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 +var _0x0fee=['api','moment','bluebird','request-promise','path','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x5b27e0,_0x40544b){var _0x70191f=function(_0x4057ba){while(--_0x4057ba){_0x5b27e0['push'](_0x5b27e0['shift']());}};_0x70191f(++_0x40544b);}(_0x0fee,0x129));var _0xe0fe=function(_0x2a5b3e,_0x1394b3){_0x2a5b3e=_0x2a5b3e-0x0;var _0x4e2e93=_0x0fee[_0x2a5b3e];return _0x4e2e93;};'use strict';var _=require(_0xe0fe('0x0'));var util=require(_0xe0fe('0x1'));var logger=require(_0xe0fe('0x2'))(_0xe0fe('0x3'));var moment=require(_0xe0fe('0x4'));var BPromise=require(_0xe0fe('0x5'));var rp=require(_0xe0fe('0x6'));var fs=require('fs');var path=require(_0xe0fe('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe0fe('0x8'));module[_0xe0fe('0x9')]=function(_0x31d6cc,_0x2693c6){return _0x31d6cc['define'](_0xe0fe('0xa'),attributes,{'tableName':_0xe0fe('0xb'),'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 1a77a41..d3fe999 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 _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 +var _0x337f=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2609d3,_0x4d262d){var _0x4bb1d6=function(_0x1afb0d){while(--_0x1afb0d){_0x2609d3['push'](_0x2609d3['shift']());}};_0x4bb1d6(++_0x4d262d);}(_0x337f,0x11c));var _0xf337=function(_0x4ee072,_0x1c3b0c){_0x4ee072=_0x4ee072-0x0;var _0x41f87a=_0x337f[_0x4ee072];return _0x41f87a;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var moment=require(_0xf337('0x2'));var BPromise=require('bluebird');var rs=require(_0xf337('0x3'));var fs=require('fs');var Redis=require(_0xf337('0x4'));var db=require(_0xf337('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf337('0x6'))(_0xf337('0x7'));var config=require('../../config/environment');var jayson=require(_0xf337('0x8'));var client=jayson['client'][_0xf337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae4d6,_0x2be604,_0x56bd39){return new BPromise(function(_0x4b80a2,_0x1f0a95){return client[_0xf337('0xa')](_0x5ae4d6,_0x56bd39)[_0xf337('0xb')](function(_0x2a4619){logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,_0xf337('0xe'));logger[_0xf337('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x2be604,_0xf337('0xe'),JSON[_0xf337('0x10')](_0x2a4619));if(_0x2a4619[_0xf337('0x11')]){if(_0x2a4619[_0xf337('0x11')][_0xf337('0x12')]===0x1f4){logger[_0xf337('0x11')](_0xf337('0xd'),_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x1f0a95(_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);}logger[_0xf337('0x11')]('Automation,\x20%s,\x20%s',_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x4b80a2(_0x2a4619[_0xf337('0x11')]['message']);}else{logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,'request\x20sent');_0x4b80a2(_0x2a4619[_0xf337('0x14')][_0xf337('0x13')]);}})[_0xf337('0x15')](function(_0x4a7e4c){logger[_0xf337('0x11')]('Automation,\x20%s,\x20%s',_0x2be604,_0x4a7e4c);_0x1f0a95(_0x4a7e4c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index edcad8f..2d824c0 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 _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 +var _0xe5f7=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index','/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update','delete'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xe5f7,0x178));var _0x7e5f=function(_0x28e10e,_0x563c1c){_0x28e10e=_0x28e10e-0x0;var _0x27822c=_0xe5f7[_0x28e10e];return _0x27822c;};'use strict';var multer=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var path=require(_0x7e5f('0x2'));var timeout=require(_0x7e5f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7e5f('0x4'));var auth=require(_0x7e5f('0x5'));var interaction=require(_0x7e5f('0x6'));var config=require('../../config/environment');var controller=require(_0x7e5f('0x7'));router[_0x7e5f('0x8')]('/',auth['isAuthenticated'](),controller[_0x7e5f('0x9')]);router[_0x7e5f('0x8')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0xc')]);router[_0x7e5f('0x8')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x7e5f('0xd')]);router[_0x7e5f('0x8')](_0x7e5f('0xe'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0xf')]);router[_0x7e5f('0x10')]('/',auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x11')]);router[_0x7e5f('0x10')](_0x7e5f('0x12'),auth['isAuthenticated'](),controller[_0x7e5f('0x13')]);router['post'](_0x7e5f('0xe'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x14')]);router[_0x7e5f('0x15')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x16')]);router[_0x7e5f('0x17')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller['destroy']);module[_0x7e5f('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 bf027c5..1ce313b 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 _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 +var _0x6ee5=['Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#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','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x668bb5,_0x5eae15){var _0x52ed91=function(_0x366e9b){while(--_0x366e9b){_0x668bb5['push'](_0x668bb5['shift']());}};_0x52ed91(++_0x5eae15);}(_0x6ee5,0x92));var _0x56ee=function(_0xd25bc,_0x58f058){_0xd25bc=_0xd25bc-0x0;var _0x177b30=_0x6ee5[_0xd25bc];return _0x177b30;};'use strict';var Sequelize=require(_0x56ee('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x56ee('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x56ee('0x2')](_0x56ee('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x56ee('0x4')]},'active':{'type':Sequelize[_0x56ee('0x5')],'defaultValue':0x0,'comment':_0x56ee('0x6')},'limitCalls':{'type':Sequelize[_0x56ee('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x56ee('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x56ee('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x56ee('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x56ee('0x11')},'dialTimezone':{'type':Sequelize[_0x56ee('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x56ee('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x56ee('0x2')]('always',_0x56ee('0x13'),_0x56ee('0x14')),'defaultValue':_0x56ee('0x15')},'dialAMDActive':{'type':Sequelize[_0x56ee('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x56ee('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x56ee('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x56ee('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x56ee('0x7')](0x9)[_0x56ee('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x56ee('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x56ee('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x56ee('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x56ee('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x56ee('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x56ee('0x7')](0x9)[_0x56ee('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x56ee('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x56ee('0x1e')),'defaultValue':_0x56ee('0x1f')},'dialPrefix':{'type':Sequelize[_0x56ee('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x56ee('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x56ee('0x20')},'dialCutDigit':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x21')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a328de6..1075d4a 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 _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 +var _0x58a4=['rows','getHopperBlacks','CmHopperBlack','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','addBlackLists','format','cm_hopper_black','removeBlackLists','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','hasOwnProperty','pick','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal'];(function(_0x49bc42,_0x366921){var _0x301dff=function(_0x10684e){while(--_0x10684e){_0x49bc42['push'](_0x49bc42['shift']());}};_0x301dff(++_0x366921);}(_0x58a4,0xbf));var _0x458a=function(_0x298de3,_0x43e88d){_0x298de3=_0x298de3-0x0;var _0x2bcf0a=_0x58a4[_0x298de3];return _0x2bcf0a;};'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'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['Campaign'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='IvrCampaigns';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['clone']=function(_0xa51e28,_0x5b428c){var _0x3ea8f0={'where':{'id':_0xa51e28['params']['id']}},_0x59ae40={};_0x59ae40['model']=_[_0x458a('0x35')](db[_0x458a('0x30')]['rawAttributes']);_0x3ea8f0[_0x458a('0x38')]=_[_0x458a('0x37')](_0x59ae40[_0x458a('0x33')],qs['fields'](_0xa51e28[_0x458a('0x34')][_0x458a('0x39')]));_0x3ea8f0[_0x458a('0x38')]=_0x3ea8f0[_0x458a('0x38')][_0x458a('0x3a')]?_0x3ea8f0[_0x458a('0x38')]:_0x59ae40['model'];if(_0xa51e28[_0x458a('0x34')][_0x458a('0x43')]){_0x3ea8f0[_0x458a('0x44')]=[{'all':!![]}];}_0x3ea8f0=_[_0x458a('0x40')]({},_0x3ea8f0,_0xa51e28[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x3ea8f0)[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](function(_0xb365f5){if(_0xb365f5){var _0x4abe93=_0xb365f5[_0x458a('0x27')]({'plain':!![]});_0x4abe93=qs[_0x458a('0x51')](_0x4abe93,['id',_0x458a('0x52'),_0x458a('0x53')]);_0xa51e28['body']=_['omit'](_0xa51e28[_0x458a('0x4b')],['id',_0x458a('0x52'),_0x458a('0x53')]);return db[_0x458a('0x30')][_0x458a('0x4a')](_[_0x458a('0x40')](_0x4abe93,_0xa51e28['body']),{'include':_0xa51e28[_0x458a('0x34')][_0x458a('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x18d83a){var _0x47b334=_0xa51e28[_0x458a('0x4c')][_0x458a('0x27')]({'plain':!![]});if(!_0x47b334)throw new Error(_0x458a('0x4d'));if(_0x47b334[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x226083=_0x18d83a[_0x458a('0x27')]({'plain':!![]});var _0xbd36cc='IvrCampaigns';return db[_0x458a('0x54')][_0x458a('0x49')]({'where':{'name':_0xbd36cc,'userProfileId':_0x47b334['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x3da617){if(_0x3da617&&_0x3da617['autoAssociation']===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x226083['name'],'resourceId':_0x226083['id'],'type':_0x3da617[_0x458a('0x2c')],'sectionId':_0x3da617['id']},{})[_0x458a('0x25')](function(){return _0x18d83a;});}else{return _0x18d83a;}})['catch'](function(_0x16f82f){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x16f82f);throw _0x16f82f;});}return _0x18d83a;});}})[_0x458a('0x25')](respondWithResult(_0x5b428c,0xc9))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports[_0x458a('0x55')]=function(_0x4199a7,_0x397595){if(_0x4199a7['body']['id']){delete _0x4199a7[_0x458a('0x4b')]['id'];}return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x4199a7[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x397595,null))[_0x458a('0x25')](saveUpdates(_0x4199a7[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x397595,null))[_0x458a('0x46')](handleError(_0x397595,null));};exports[_0x458a('0x26')]=function(_0x546519,_0x3837b7){return db['Campaign'][_0x458a('0x49')]({'where':{'id':_0x546519[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x3837b7,null))[_0x458a('0x25')](removeEntity(_0x3837b7,null))[_0x458a('0x46')](handleError(_0x3837b7,null));};exports[_0x458a('0x56')]=function(_0x2c6a00,_0x3745d5,_0x2b67dd){var _0x413d7c={'raw':!![],'where':{}};var _0x31074e={};var _0x448cbc={'count':0x0,'rows':[]};return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x2c6a00[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x3745d5,null))['then'](function(_0x120b8e){if(_0x120b8e){_0x31074e['model']=_[_0x458a('0x35')](db[_0x458a('0x58')]['rawAttributes']);_0x31074e[_0x458a('0x34')]=_[_0x458a('0x35')](_0x2c6a00[_0x458a('0x34')]);_0x31074e['filters']=_[_0x458a('0x37')](_0x31074e[_0x458a('0x33')],_0x31074e[_0x458a('0x34')]);_0x413d7c[_0x458a('0x38')]=_[_0x458a('0x37')](_0x31074e[_0x458a('0x33')],qs['fields'](_0x2c6a00[_0x458a('0x34')]['fields']));_0x413d7c['attributes']=_0x413d7c[_0x458a('0x38')][_0x458a('0x3a')]?_0x413d7c[_0x458a('0x38')]:_0x31074e[_0x458a('0x33')];if(!_0x2c6a00[_0x458a('0x34')][_0x458a('0x59')](_0x458a('0x3b'))){_0x413d7c[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x2c6a00[_0x458a('0x34')][_0x458a('0x1e')]);_0x413d7c[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x2c6a00[_0x458a('0x34')]['offset']);}_0x413d7c['order']=qs['sort'](_0x2c6a00[_0x458a('0x34')]['sort']);_0x413d7c[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0x2c6a00[_0x458a('0x34')],_0x31074e[_0x458a('0x36')]));_0x413d7c[_0x458a('0x3e')][_0x458a('0x5b')]=_0x120b8e['id'];if(_0x2c6a00['query'][_0x458a('0x3f')]){_0x413d7c[_0x458a('0x3e')]=_['merge'](_0x413d7c[_0x458a('0x3e')],{'$or':_['map'](_0x413d7c[_0x458a('0x38')],function(_0x58d29d){var _0x26b3f7={};_0x26b3f7[_0x58d29d]={'$like':'%'+_0x2c6a00[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x26b3f7;})});}_0x413d7c=_[_0x458a('0x40')]({},_0x413d7c,_0x2c6a00['options']);return db[_0x458a('0x58')][_0x458a('0x1f')]({'where':_0x413d7c[_0x458a('0x3e')]})[_0x458a('0x25')](function(_0x18fb71){_0x448cbc[_0x458a('0x1f')]=_0x18fb71;if(_0x2c6a00[_0x458a('0x34')][_0x458a('0x43')]){_0x413d7c['include']=[{'all':!![]}];}return db[_0x458a('0x58')][_0x458a('0x45')](_0x413d7c);})[_0x458a('0x25')](function(_0x4212af){_0x448cbc['rows']=_0x4212af;return _0x448cbc;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x3745d5,_0x413d7c))[_0x458a('0x46')](handleError(_0x3745d5,null));};exports['getHopperHistories']=function(_0x32bc59,_0x110801,_0x9b98e){var _0x45e06c={'raw':!![],'where':{}};var _0x3b0888={};var _0x48d2a3={'count':0x0,'rows':[]};return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x32bc59[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x110801,null))[_0x458a('0x25')](function(_0x46ac5c){if(_0x46ac5c){_0x3b0888[_0x458a('0x33')]=_['keys'](db[_0x458a('0x5c')]['rawAttributes']);_0x3b0888[_0x458a('0x34')]=_[_0x458a('0x35')](_0x32bc59[_0x458a('0x34')]);_0x3b0888['filters']=_[_0x458a('0x37')](_0x3b0888['model'],_0x3b0888['query']);_0x45e06c[_0x458a('0x38')]=_[_0x458a('0x37')](_0x3b0888['model'],qs['fields'](_0x32bc59[_0x458a('0x34')][_0x458a('0x39')]));_0x45e06c[_0x458a('0x38')]=_0x45e06c[_0x458a('0x38')][_0x458a('0x3a')]?_0x45e06c['attributes']:_0x3b0888[_0x458a('0x33')];if(!_0x32bc59['query'][_0x458a('0x59')](_0x458a('0x3b'))){_0x45e06c[_0x458a('0x1e')]=qs['limit'](_0x32bc59[_0x458a('0x34')][_0x458a('0x1e')]);_0x45e06c['offset']=qs[_0x458a('0x20')](_0x32bc59['query'][_0x458a('0x20')]);}_0x45e06c[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x32bc59[_0x458a('0x34')]['sort']);_0x45e06c[_0x458a('0x3e')]=qs['filters'](_['pick'](_0x32bc59[_0x458a('0x34')],_0x3b0888[_0x458a('0x36')]));_0x45e06c[_0x458a('0x3e')][_0x458a('0x5b')]=_0x46ac5c['id'];if(_0x32bc59[_0x458a('0x34')][_0x458a('0x3f')]){_0x45e06c['where']=_[_0x458a('0x40')](_0x45e06c[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x45e06c[_0x458a('0x38')],function(_0x17099e){var _0x1bff6a={};_0x1bff6a[_0x17099e]={'$like':'%'+_0x32bc59['query'][_0x458a('0x3f')]+'%'};return _0x1bff6a;})});}_0x45e06c=_[_0x458a('0x40')]({},_0x45e06c,_0x32bc59[_0x458a('0x42')]);return db['CmHopperHistory'][_0x458a('0x1f')]({'where':_0x45e06c[_0x458a('0x3e')]})[_0x458a('0x25')](function(_0x5d1c66){_0x48d2a3['count']=_0x5d1c66;if(_0x32bc59[_0x458a('0x34')]['includeAll']){_0x45e06c['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x45e06c);})['then'](function(_0x3f14bf){_0x48d2a3['rows']=_0x3f14bf;return _0x48d2a3;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x110801,_0x45e06c))[_0x458a('0x46')](handleError(_0x110801,null));};exports[_0x458a('0x5d')]=function(_0xfcb712,_0x277685,_0x42c217){var _0x555190={'raw':!![],'where':{}};var _0x11ebe7={};var _0x59ad9c={'count':0x0,'rows':[]};return db[_0x458a('0x30')]['findOne']({'where':{'id':_0xfcb712[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x277685,null))['then'](function(_0x5d0912){if(_0x5d0912){_0x11ebe7['model']=_[_0x458a('0x35')](db[_0x458a('0x5e')][_0x458a('0x48')]);_0x11ebe7[_0x458a('0x34')]=_[_0x458a('0x35')](_0xfcb712['query']);_0x11ebe7[_0x458a('0x36')]=_[_0x458a('0x37')](_0x11ebe7[_0x458a('0x33')],_0x11ebe7[_0x458a('0x34')]);_0x555190[_0x458a('0x38')]=_[_0x458a('0x37')](_0x11ebe7[_0x458a('0x33')],qs[_0x458a('0x39')](_0xfcb712['query'][_0x458a('0x39')]));_0x555190[_0x458a('0x38')]=_0x555190[_0x458a('0x38')][_0x458a('0x3a')]?_0x555190[_0x458a('0x38')]:_0x11ebe7[_0x458a('0x33')];if(!_0xfcb712[_0x458a('0x34')]['hasOwnProperty']('nolimit')){_0x555190['limit']=qs['limit'](_0xfcb712[_0x458a('0x34')][_0x458a('0x1e')]);_0x555190[_0x458a('0x20')]=qs[_0x458a('0x20')](_0xfcb712['query'][_0x458a('0x20')]);}_0x555190[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0xfcb712[_0x458a('0x34')]['sort']);_0x555190['where']=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0xfcb712[_0x458a('0x34')],_0x11ebe7[_0x458a('0x36')]));_0x555190['where'][_0x458a('0x5b')]=_0x5d0912['id'];if(_0xfcb712[_0x458a('0x34')][_0x458a('0x3f')]){_0x555190[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x555190[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x555190[_0x458a('0x38')],function(_0x39dd8a){var _0x2ebb0b={};_0x2ebb0b[_0x39dd8a]={'$like':'%'+_0xfcb712['query']['filter']+'%'};return _0x2ebb0b;})});}_0x555190=_[_0x458a('0x40')]({},_0x555190,_0xfcb712[_0x458a('0x42')]);return db[_0x458a('0x5e')][_0x458a('0x1f')]({'where':_0x555190[_0x458a('0x3e')]})[_0x458a('0x25')](function(_0x213f2f){_0x59ad9c['count']=_0x213f2f;if(_0xfcb712[_0x458a('0x34')]['includeAll']){_0x555190[_0x458a('0x44')]=[{'all':!![]}];}return db[_0x458a('0x5e')][_0x458a('0x45')](_0x555190);})['then'](function(_0x589496){_0x59ad9c[_0x458a('0x5f')]=_0x589496;return _0x59ad9c;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x277685,_0x555190))[_0x458a('0x46')](handleError(_0x277685,null));};exports[_0x458a('0x60')]=function(_0x21d4df,_0x53d065,_0x391854){var _0x35d811={'raw':!![],'where':{}};var _0x3b8a15={};var _0x43bc92={'count':0x0,'rows':[]};return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x21d4df[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x53d065,null))[_0x458a('0x25')](function(_0x52b844){if(_0x52b844){_0x3b8a15[_0x458a('0x33')]=_['keys'](db[_0x458a('0x61')][_0x458a('0x48')]);_0x3b8a15[_0x458a('0x34')]=_['keys'](_0x21d4df['query']);_0x3b8a15[_0x458a('0x36')]=_['intersection'](_0x3b8a15[_0x458a('0x33')],_0x3b8a15['query']);_0x35d811[_0x458a('0x38')]=_[_0x458a('0x37')](_0x3b8a15[_0x458a('0x33')],qs['fields'](_0x21d4df[_0x458a('0x34')][_0x458a('0x39')]));_0x35d811['attributes']=_0x35d811[_0x458a('0x38')]['length']?_0x35d811[_0x458a('0x38')]:_0x3b8a15[_0x458a('0x33')];if(!_0x21d4df[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x35d811[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x21d4df[_0x458a('0x34')][_0x458a('0x1e')]);_0x35d811[_0x458a('0x20')]=qs['offset'](_0x21d4df[_0x458a('0x34')][_0x458a('0x20')]);}_0x35d811['order']=qs[_0x458a('0x3d')](_0x21d4df[_0x458a('0x34')][_0x458a('0x3d')]);_0x35d811['where']=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0x21d4df[_0x458a('0x34')],_0x3b8a15['filters']));_0x35d811[_0x458a('0x3e')][_0x458a('0x5b')]=_0x52b844['id'];if(_0x21d4df[_0x458a('0x34')][_0x458a('0x3f')]){_0x35d811[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x35d811[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x35d811['attributes'],function(_0x3c3c7b){var _0x4bb339={};_0x4bb339[_0x3c3c7b]={'$like':'%'+_0x21d4df['query'][_0x458a('0x3f')]+'%'};return _0x4bb339;})});}_0x35d811=_[_0x458a('0x40')]({},_0x35d811,_0x21d4df['options']);return db[_0x458a('0x61')]['count']({'where':_0x35d811[_0x458a('0x3e')]})['then'](function(_0x31b9ba){_0x43bc92[_0x458a('0x1f')]=_0x31b9ba;if(_0x21d4df[_0x458a('0x34')][_0x458a('0x43')]){_0x35d811['include']=[{'all':!![]}];}return db[_0x458a('0x61')][_0x458a('0x45')](_0x35d811);})[_0x458a('0x25')](function(_0x4df0b4){_0x43bc92[_0x458a('0x5f')]=_0x4df0b4;return _0x43bc92;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x53d065,_0x35d811))[_0x458a('0x46')](handleError(_0x53d065,null));};exports[_0x458a('0x62')]=function(_0x4ca16b,_0x159253,_0x59df0a){var _0x5edd35={};var _0x53dfea={};var _0x34712b;var _0x202311;return db['Campaign'][_0x458a('0x57')]({'where':{'id':_0x4ca16b['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x159253,null))['then'](function(_0x310a09){if(_0x310a09){_0x34712b=_0x310a09;_0x53dfea['model']=_[_0x458a('0x35')](db[_0x458a('0x63')][_0x458a('0x48')]);_0x53dfea[_0x458a('0x34')]=_[_0x458a('0x35')](_0x4ca16b[_0x458a('0x34')]);_0x53dfea[_0x458a('0x36')]=_['intersection'](_0x53dfea[_0x458a('0x33')],_0x53dfea[_0x458a('0x34')]);_0x5edd35[_0x458a('0x38')]=_['intersection'](_0x53dfea['model'],qs[_0x458a('0x39')](_0x4ca16b[_0x458a('0x34')][_0x458a('0x39')]));_0x5edd35[_0x458a('0x38')]=_0x5edd35[_0x458a('0x38')]['length']?_0x5edd35[_0x458a('0x38')]:_0x53dfea[_0x458a('0x33')];_0x5edd35[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x4ca16b[_0x458a('0x34')]['sort']);_0x5edd35[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0x4ca16b[_0x458a('0x34')],_0x53dfea[_0x458a('0x36')]));if(_0x4ca16b[_0x458a('0x34')][_0x458a('0x3f')]){_0x5edd35['where']=_[_0x458a('0x40')](_0x5edd35['where'],{'$or':_[_0x458a('0x2f')](_0x5edd35[_0x458a('0x38')],function(_0x293d9c){var _0xee6749={};_0xee6749[_0x293d9c]={'$like':'%'+_0x4ca16b[_0x458a('0x34')]['filter']+'%'};return _0xee6749;})});}_0x5edd35=_[_0x458a('0x40')]({},_0x5edd35,_0x4ca16b[_0x458a('0x42')]);return _0x34712b[_0x458a('0x62')](_0x5edd35);}})[_0x458a('0x25')](function(_0x1eca8e){if(_0x1eca8e){_0x202311=_0x1eca8e['length'];if(!_0x4ca16b[_0x458a('0x34')][_0x458a('0x59')](_0x458a('0x3b'))){_0x5edd35[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x4ca16b['query']['limit']);_0x5edd35['offset']=qs[_0x458a('0x20')](_0x4ca16b[_0x458a('0x34')][_0x458a('0x20')]);}return _0x34712b[_0x458a('0x62')](_0x5edd35);}})[_0x458a('0x25')](function(_0x5108ad){if(_0x5108ad){return _0x5108ad?{'count':_0x202311,'rows':_0x5108ad}:null;}})[_0x458a('0x25')](respondWithResult(_0x159253,null))[_0x458a('0x46')](handleError(_0x159253,null));};exports['addLists']=function(_0x441ea0,_0x2db3d4,_0x51ce46){var _0x31cdbd,_0x218e33;var _0x33e71f=[];var _0x5dd2ec=moment()['format'](_0x458a('0x64'));return db[_0x458a('0x30')]['find']({'where':{'id':_0x441ea0[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2db3d4,null))[_0x458a('0x25')](function(_0x40aa5d){if(_0x40aa5d){_0x218e33=_0x40aa5d;return _0x40aa5d['addLists'](_0x441ea0[_0x458a('0x4b')][_0x458a('0x65')],_[_0x458a('0x51')](_0x441ea0['body'],[_0x458a('0x65'),'id'])||{});}return null;})[_0x458a('0x66')](function(_0x3c204e){var _0x45f4c6;var _0x4c2550;_0x31cdbd=_0x3c204e||[];var _0x1ff9cf=[];if(_0x3c204e){for(var _0x44e32b=0x0;_0x44e32b<_0x3c204e[_0x458a('0x3a')];_0x44e32b+=0x1){var _0x2c20b6=_0x3c204e[_0x44e32b][_0x458a('0x27')]({'plain':!![]});_0x218e33[_0x458a('0x67')]=_0x441ea0['body'][_0x458a('0x67')]?_0x441ea0[_0x458a('0x4b')][_0x458a('0x67')]:_0x218e33['dialCheckDuplicateType'];switch(_0x218e33[_0x458a('0x67')]){case _0x458a('0x68'):_0x45f4c6=squel[_0x458a('0x69')]()[_0x458a('0x6a')]('cm_hopper')[_0x458a('0x6b')]([_0x458a('0x6c'),_0x458a('0x6d'),_0x458a('0x6e'),_0x458a('0x6f'),_0x458a('0x5b'),'createdAt',_0x458a('0x53')],squel[_0x458a('0x70')]()[_0x458a('0x71')](_0x458a('0x6c'),'phone')[_0x458a('0x71')]('NOW()',_0x458a('0x6d'))[_0x458a('0x71')]('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')](),'ListId')[_0x458a('0x71')](_0x441ea0['params']['id'][_0x458a('0x73')](),'CampaignId')[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x52'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x75'))[_0x458a('0x3e')](_0x458a('0x76'))[_0x458a('0x3e')](_0x458a('0x77'),_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')]())['where'](_0x458a('0x78'))['where'](_0x458a('0x79'),squel[_0x458a('0x70')]()[_0x458a('0x71')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x458a('0x3e')](_0x458a('0x7a'),_0x441ea0[_0x458a('0x47')]['id']['toString']()))[_0x458a('0x3e')](_0x458a('0x79'),squel[_0x458a('0x70')]()['field'](_0x458a('0x7b'))[_0x458a('0x74')]('cm_hopper')[_0x458a('0x3e')](_0x458a('0x7a'),_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')]())))['toString']();break;case _0x458a('0x7c'):_0x45f4c6=squel[_0x458a('0x69')]()[_0x458a('0x6a')](_0x458a('0x7d'))[_0x458a('0x6b')]([_0x458a('0x6c'),_0x458a('0x6d'),_0x458a('0x6e'),_0x458a('0x6f'),_0x458a('0x5b'),_0x458a('0x52'),_0x458a('0x53')],squel['select']()['field'](_0x458a('0x6c'),_0x458a('0x6c'))[_0x458a('0x71')](_0x458a('0x7e'),_0x458a('0x6d'))['field']('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')](),_0x458a('0x6f'))[_0x458a('0x71')](_0x441ea0[_0x458a('0x47')]['id']['toString'](),_0x458a('0x5b'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27','createdAt')[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x75'))['where'](_0x458a('0x76'))[_0x458a('0x3e')](_0x458a('0x77'),_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')]())[_0x458a('0x3e')](_0x458a('0x78'))[_0x458a('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x458a('0x70')]()[_0x458a('0x71')](_0x458a('0x7b'))['from'](_0x458a('0x7d'))[_0x458a('0x3e')]('CampaignId\x20=\x20?',_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')]())))[_0x458a('0x73')]();break;default:_0x45f4c6=squel[_0x458a('0x69')]()['into'](_0x458a('0x7d'))['fromQuery']([_0x458a('0x6c'),_0x458a('0x6d'),_0x458a('0x6e'),_0x458a('0x6f'),_0x458a('0x5b'),_0x458a('0x52'),_0x458a('0x53')],squel['select']()[_0x458a('0x71')](_0x458a('0x6c'),'phone')[_0x458a('0x71')](_0x458a('0x7e'),'scheduledAt')['field']('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')](),_0x458a('0x6f'))['field'](_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')](),_0x458a('0x5b'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27','createdAt')[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x75'))[_0x458a('0x3e')](_0x458a('0x76'))[_0x458a('0x3e')]('ListId\x20=\x20?',_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')]())[_0x458a('0x3e')](_0x458a('0x78')))[_0x458a('0x73')]();}_0x4c2550=squel[_0x458a('0x69')]()[_0x458a('0x6a')](_0x458a('0x7f'))['fromQuery']([_0x458a('0x80'),_0x458a('0x6d'),_0x458a('0x6c'),_0x458a('0x81'),'createdAt',_0x458a('0x53')],squel[_0x458a('0x70')]()['field']('h.id','id')[_0x458a('0x71')](_0x458a('0x7e'),'scheduledAt')[_0x458a('0x71')]('ci.item',_0x458a('0x6c'))['field'](_0x458a('0x82'),_0x458a('0x81'))['field']('\x27'+_0x5dd2ec+'\x27',_0x458a('0x52'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x83'),'ci')[_0x458a('0x84')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x458a('0x3e')](_0x458a('0x85'),_0x2c20b6['CmListId'][_0x458a('0x73')]())['where'](_0x458a('0x86'),_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')]())[_0x458a('0x3e')]('h.createdAt\x20=\x20?',_0x5dd2ec))['toString']();_0x1ff9cf[_0x458a('0x87')](db['sequelize'][_0x458a('0x34')](_0x45f4c6));_0x33e71f['push'](db[_0x458a('0x88')][_0x458a('0x34')](_0x4c2550));}return BPromise[_0x458a('0x89')](_0x1ff9cf);}})['then'](function(){return BPromise[_0x458a('0x89')](_0x33e71f);})[_0x458a('0x25')](function(){return _0x31cdbd;})['then'](respondWithResult(_0x2db3d4,null))[_0x458a('0x46')](handleError(_0x2db3d4,null));};exports[_0x458a('0x8a')]=function(_0x2f7643,_0x246cad,_0x5cf14d){return db['Campaign']['find']({'where':{'id':_0x2f7643['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x246cad,null))['then'](function(_0x1af080){if(_0x1af080){return _0x1af080[_0x458a('0x8a')](_0x2f7643[_0x458a('0x34')][_0x458a('0x65')]);}})[_0x458a('0x25')](function(_0x4861e3){if(_0x4861e3){return db[_0x458a('0x58')][_0x458a('0x26')]({'where':{'ListId':_0x2f7643[_0x458a('0x34')]['ids'],'CampaignId':_0x2f7643[_0x458a('0x47')]['id']}})['then'](function(){return _0x4861e3;});}})[_0x458a('0x25')](respondWithStatusCode(_0x246cad,null))[_0x458a('0x46')](handleError(_0x246cad,null));};exports['getBlackLists']=function(_0x4788e1,_0x292c1e,_0x4b275f){var _0x1897bb={};var _0x564bdb={};var _0x183db9;var _0x1875b4;return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x4788e1['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x292c1e,null))['then'](function(_0xf5de4d){if(_0xf5de4d){_0x183db9=_0xf5de4d;_0x564bdb[_0x458a('0x33')]=_[_0x458a('0x35')](db[_0x458a('0x63')][_0x458a('0x48')]);_0x564bdb[_0x458a('0x34')]=_[_0x458a('0x35')](_0x4788e1['query']);_0x564bdb[_0x458a('0x36')]=_[_0x458a('0x37')](_0x564bdb[_0x458a('0x33')],_0x564bdb[_0x458a('0x34')]);_0x1897bb['attributes']=_[_0x458a('0x37')](_0x564bdb['model'],qs['fields'](_0x4788e1[_0x458a('0x34')][_0x458a('0x39')]));_0x1897bb[_0x458a('0x38')]=_0x1897bb[_0x458a('0x38')][_0x458a('0x3a')]?_0x1897bb[_0x458a('0x38')]:_0x564bdb[_0x458a('0x33')];_0x1897bb[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x4788e1[_0x458a('0x34')][_0x458a('0x3d')]);_0x1897bb[_0x458a('0x3e')]=qs['filters'](_[_0x458a('0x5a')](_0x4788e1[_0x458a('0x34')],_0x564bdb[_0x458a('0x36')]));if(_0x4788e1['query'][_0x458a('0x3f')]){_0x1897bb['where']=_['merge'](_0x1897bb[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x1897bb[_0x458a('0x38')],function(_0xa608fb){var _0x239d5e={};_0x239d5e[_0xa608fb]={'$like':'%'+_0x4788e1[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x239d5e;})});}_0x1897bb=_[_0x458a('0x40')]({},_0x1897bb,_0x4788e1[_0x458a('0x42')]);return _0x183db9['getBlackLists'](_0x1897bb);}})['then'](function(_0x581309){if(_0x581309){_0x1875b4=_0x581309[_0x458a('0x3a')];if(!_0x4788e1[_0x458a('0x34')][_0x458a('0x59')](_0x458a('0x3b'))){_0x1897bb[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x4788e1['query'][_0x458a('0x1e')]);_0x1897bb[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x4788e1[_0x458a('0x34')][_0x458a('0x20')]);}return _0x183db9['getBlackLists'](_0x1897bb);}})[_0x458a('0x25')](function(_0x474070){if(_0x474070){return _0x474070?{'count':_0x1875b4,'rows':_0x474070}:null;}})[_0x458a('0x25')](respondWithResult(_0x292c1e,null))['catch'](handleError(_0x292c1e,null));};exports[_0x458a('0x8b')]=function(_0x26ed49,_0xd022a8,_0x41cd77){var _0x203d8a,_0x50eebc;var _0x599e45=[];var _0x571c0e=moment()[_0x458a('0x8c')](_0x458a('0x64'));return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x26ed49[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0xd022a8,null))[_0x458a('0x25')](function(_0x3f5ef3){if(_0x3f5ef3){_0x50eebc=_0x3f5ef3;return _0x3f5ef3[_0x458a('0x8b')](_0x26ed49[_0x458a('0x4b')][_0x458a('0x65')],_['omit'](_0x26ed49[_0x458a('0x4b')],[_0x458a('0x65'),'id'])||{});}return null;})[_0x458a('0x66')](function(_0x4a3c74){var _0x18bafd;var _0x51cf12;_0x203d8a=_0x4a3c74||[];var _0x423fd7=[];if(_0x4a3c74){for(var _0x5cc7b4=0x0;_0x5cc7b4<_0x4a3c74[_0x458a('0x3a')];_0x5cc7b4+=0x1){var _0x327d8d=_0x4a3c74[_0x5cc7b4][_0x458a('0x27')]({'plain':!![]});_0x18bafd=squel['insert']()[_0x458a('0x6a')](_0x458a('0x8d'))[_0x458a('0x6b')]([_0x458a('0x6c'),_0x458a('0x6e'),_0x458a('0x6f'),'CampaignId','createdAt',_0x458a('0x53')],squel['select']()[_0x458a('0x71')](_0x458a('0x6c'),_0x458a('0x6c'))[_0x458a('0x71')]('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x327d8d['CmListId'][_0x458a('0x73')](),_0x458a('0x6f'))[_0x458a('0x71')](_0x26ed49[_0x458a('0x47')]['id'][_0x458a('0x73')](),_0x458a('0x5b'))[_0x458a('0x71')](_0x458a('0x7e'),_0x458a('0x52'))['field'](_0x458a('0x7e'),'updatedAt')[_0x458a('0x74')](_0x458a('0x75'))[_0x458a('0x3e')]('deletedAt\x20IS\x20NULL')[_0x458a('0x3e')]('ListId\x20=\x20?',_0x327d8d['CmListId'][_0x458a('0x73')]())[_0x458a('0x3e')](_0x458a('0x78')))[_0x458a('0x73')]();_0x423fd7[_0x458a('0x87')](db[_0x458a('0x88')][_0x458a('0x34')](_0x18bafd));}return BPromise[_0x458a('0x89')](_0x423fd7);}})['then'](function(){return _0x203d8a;})[_0x458a('0x25')](respondWithResult(_0xd022a8,null))[_0x458a('0x46')](handleError(_0xd022a8,null));};exports['removeBlackLists']=function(_0x1ec986,_0x174ada,_0x267ea2){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x1ec986[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x174ada,null))[_0x458a('0x25')](function(_0x3b6884){if(_0x3b6884){return _0x3b6884[_0x458a('0x8e')](_0x1ec986[_0x458a('0x34')][_0x458a('0x65')]);}})[_0x458a('0x25')](function(_0x5c1efd){if(_0x5c1efd){return db[_0x458a('0x61')][_0x458a('0x26')]({'where':{'ListId':_0x1ec986[_0x458a('0x34')][_0x458a('0x65')],'CampaignId':_0x1ec986[_0x458a('0x47')]['id']}})[_0x458a('0x25')](function(){return _0x5c1efd;});}})[_0x458a('0x25')](respondWithStatusCode(_0x174ada,null))['catch'](handleError(_0x174ada,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 302d218..11125ab 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(_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 +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c2520ee..70854e0 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 _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 +var _0xe3ee=['../../mysqldb','rpc','jayson/promise','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Campaign','options','raw','where','attributes','limit','include','map','model','GetCampaign','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe3ee,0x116));var _0xee3e=function(_0x59df39,_0x125888){_0x59df39=_0x59df39-0x0;var _0x565afb=_0xe3ee[_0x59df39];return _0x565afb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee3e('0x0'));var BPromise=require(_0xee3e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee3e('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee3e('0x3'));var config=require('../../config/environment');var jayson=require(_0xee3e('0x4'));var client=jayson[_0xee3e('0x5')][_0xee3e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd893ca,_0x42d135,_0x39a770){return new BPromise(function(_0x43ab67,_0x17fba1){return client['request'](_0xd893ca,_0x39a770)[_0xee3e('0x7')](function(_0x2f6153){logger['info'](_0xee3e('0x8'),_0x42d135,_0xee3e('0x9'));logger['debug'](_0xee3e('0xa'),_0x42d135,_0xee3e('0x9'),JSON[_0xee3e('0xb')](_0x2f6153));if(_0x2f6153[_0xee3e('0xc')]){if(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xd')]===0x1f4){logger[_0xee3e('0xc')](_0xee3e('0x8'),_0x42d135,_0x2f6153['error']['message']);return _0x17fba1(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);}logger['error'](_0xee3e('0x8'),_0x42d135,_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);return _0x43ab67(_0x2f6153['error'][_0xee3e('0xe')]);}else{logger[_0xee3e('0xf')]('Campaign,\x20%s,\x20%s',_0x42d135,'request\x20sent');_0x43ab67(_0x2f6153[_0xee3e('0x10')][_0xee3e('0xe')]);}})[_0xee3e('0x11')](function(_0x512609){logger['error']('Campaign,\x20%s,\x20%s',_0x42d135,_0x512609);_0x17fba1(_0x512609);});});}exports['GetCampaign']=function(_0x2589c0){var _0x23cd1f=this;return new Promise(function(_0x372605,_0x253530){return db[_0xee3e('0x12')]['findAll']({'raw':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x14')]===undefined?!![]:![]:!![],'where':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x15')]||null:null,'attributes':_0x2589c0['options']?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x16')]||null:null,'limit':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x17')]||null:null,'include':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x18')]?_[_0xee3e('0x19')](_0x2589c0[_0xee3e('0x13')]['include'],function(_0x5e4100){return{'model':db[_0x5e4100['model']],'as':_0x5e4100['as'],'attributes':_0x5e4100['attributes'],'include':_0x5e4100[_0xee3e('0x18')]?_[_0xee3e('0x19')](_0x5e4100['include'],function(_0xbfc488){return{'model':db[_0xbfc488[_0xee3e('0x1a')]],'as':_0xbfc488['as'],'attributes':_0xbfc488[_0xee3e('0x16')],'include':_0xbfc488['include']?_[_0xee3e('0x19')](_0xbfc488[_0xee3e('0x18')],function(_0x2b96b8){return{'model':db[_0x2b96b8[_0xee3e('0x1a')]],'as':_0x2b96b8['as'],'attributes':_0x2b96b8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c687c){logger[_0xee3e('0xf')](_0xee3e('0x1b'),_0x2589c0);logger['debug']('GetCampaign',_0x2589c0,JSON[_0xee3e('0xb')](_0x1c687c));_0x372605(_0x1c687c);})[_0xee3e('0x11')](function(_0x179406){logger[_0xee3e('0xc')](_0xee3e('0x1b'),_0x179406[_0xee3e('0xe')],_0x2589c0);_0x253530(_0x23cd1f[_0xee3e('0xc')](0x1f4,_0x179406['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index ca0ce2a..c1a35ae 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 _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 +var _0x2bca=['getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','/:id','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists'];(function(_0x3bbbfd,_0x45a809){var _0x2b2d15=function(_0x486d69){while(--_0x486d69){_0x3bbbfd['push'](_0x3bbbfd['shift']());}};_0x2b2d15(++_0x45a809);}(_0x2bca,0xc6));var _0xa2bc=function(_0x1a0872,_0xc778c9){_0x1a0872=_0x1a0872-0x0;var _0x294d38=_0x2bca[_0x1a0872];return _0x294d38;};'use strict';var multer=require(_0xa2bc('0x0'));var util=require(_0xa2bc('0x1'));var path=require(_0xa2bc('0x2'));var timeout=require(_0xa2bc('0x3'));var express=require(_0xa2bc('0x4'));var router=express[_0xa2bc('0x5')]();var fs_extra=require(_0xa2bc('0x6'));var auth=require(_0xa2bc('0x7'));var interaction=require(_0xa2bc('0x8'));var config=require(_0xa2bc('0x9'));var controller=require('./campaign.controller');router[_0xa2bc('0xa')]('/',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0xc')]);router[_0xa2bc('0xa')]('/:id',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0xd')]);router[_0xa2bc('0xa')](_0xa2bc('0xe'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0xf')]);router[_0xa2bc('0xa')](_0xa2bc('0x10'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x11')]);router['get'](_0xa2bc('0x12'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x13')]);router['get'](_0xa2bc('0x14'),auth[_0xa2bc('0xb')](),controller['getHopperBlacks']);router[_0xa2bc('0xa')](_0xa2bc('0x15'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x16')]);router[_0xa2bc('0xa')](_0xa2bc('0x17'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x18')]);router[_0xa2bc('0x19')]('/',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1a')]);router[_0xa2bc('0x19')](_0xa2bc('0x1b'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1c')]);router[_0xa2bc('0x19')]('/:id/lists',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1d')]);router[_0xa2bc('0x19')]('/:id/blacklists',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1e')]);router['put'](_0xa2bc('0x1f'),auth['isAuthenticated'](),controller[_0xa2bc('0x20')]);router[_0xa2bc('0x21')](_0xa2bc('0x1f'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x22')]);router[_0xa2bc('0x21')](_0xa2bc('0x15'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x23')]);router[_0xa2bc('0x21')](_0xa2bc('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xa2bc('0x24')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 260a5e0..8099136 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 _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 +var _0x87aa=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x8b7922,_0x38b017){var _0xa6a73a=function(_0x4b3493){while(--_0x4b3493){_0x8b7922['push'](_0x8b7922['shift']());}};_0xa6a73a(++_0x38b017);}(_0x87aa,0x17d));var _0xa87a=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x87aa[_0x4828b1];return _0x1fec1b;};'use strict';var Sequelize=require(_0xa87a('0x0'));module[_0xa87a('0x1')]={'key':{'type':Sequelize[_0xa87a('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xa87a('0x2')]},'name':{'type':Sequelize[_0xa87a('0x3')],'get':function(){return this[_0xa87a('0x4')](_0xa87a('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2390e81..9d614c8 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 _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 +var _0x03bc=['reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','filter','options','count','includeAll','include','findAll','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply'];(function(_0x18bd5c,_0x1be050){var _0x1ec634=function(_0x3f2953){while(--_0x3f2953){_0x18bd5c['push'](_0x18bd5c['shift']());}};_0x1ec634(++_0x1be050);}(_0x03bc,0x197));var _0xc03b=function(_0x24e5e5,_0x3b8a4e){_0x24e5e5=_0x24e5e5-0x0;var _0x5ea7c9=_0x03bc[_0x24e5e5];return _0x5ea7c9;};'use strict';var emlformat=require(_0xc03b('0x0'));var rimraf=require(_0xc03b('0x1'));var zipdir=require(_0xc03b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc03b('0x3'));var moment=require(_0xc03b('0x4'));var BPromise=require(_0xc03b('0x5'));var Mustache=require(_0xc03b('0x6'));var util=require(_0xc03b('0x7'));var path=require('path');var sox=require(_0xc03b('0x8'));var csv=require(_0xc03b('0x9'));var ejs=require(_0xc03b('0xa'));var fs=require('fs');var fs_extra=require(_0xc03b('0xb'));var _=require('lodash');var squel=require(_0xc03b('0xc'));var crypto=require(_0xc03b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc03b('0x9'));var querystring=require(_0xc03b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc03b('0xf'));var hardwareService=require(_0xc03b('0x10'));var logger=require(_0xc03b('0x11'))(_0xc03b('0x12'));var utils=require(_0xc03b('0x13'));var config=require(_0xc03b('0x14'));var licenseUtil=require(_0xc03b('0x15'));var db=require(_0xc03b('0x16'))['db'];function respondWithStatusCode(_0x2502de,_0x4aaaa8){_0x4aaaa8=_0x4aaaa8||0xcc;return function(_0x447229){if(_0x447229){return _0x2502de[_0xc03b('0x17')](_0x4aaaa8);}return _0x2502de[_0xc03b('0x18')](_0x4aaaa8)[_0xc03b('0x19')]();};}function respondWithResult(_0x3f61c1,_0xa4b044){_0xa4b044=_0xa4b044||0xc8;return function(_0x50bc74){if(_0x50bc74){return _0x3f61c1[_0xc03b('0x18')](_0xa4b044)['json'](_0x50bc74);}};}function respondWithFilteredResult(_0xcbd558,_0xfd90a8){return function(_0x5d507a){if(_0x5d507a){var _0x38a4b4=typeof _0xfd90a8[_0xc03b('0x1a')]===_0xc03b('0x1b')&&typeof _0xfd90a8['limit']==='undefined';var _0x42c3d2=_0x5d507a['count'];var _0x375827=_0x38a4b4?0x0:_0xfd90a8[_0xc03b('0x1a')];var _0x33066d=_0x38a4b4?_0x5d507a['count']:_0xfd90a8[_0xc03b('0x1a')]+_0xfd90a8[_0xc03b('0x1c')];var _0x19bee9;if(_0x33066d>=_0x42c3d2){_0x33066d=_0x42c3d2;_0x19bee9=0xc8;}else{_0x19bee9=0xce;}_0xcbd558['status'](_0x19bee9);return _0xcbd558[_0xc03b('0x1d')](_0xc03b('0x1e'),_0x375827+'-'+_0x33066d+'/'+_0x42c3d2)[_0xc03b('0x1f')](_0x5d507a);}return null;};}function patchUpdates(_0x1a70a2){return function(_0x51cf84){try{jsonpatch[_0xc03b('0x20')](_0x51cf84,_0x1a70a2,!![]);}catch(_0x4c0a4d){return BPromise[_0xc03b('0x21')](_0x4c0a4d);}return _0x51cf84[_0xc03b('0x22')]();};}function saveUpdates(_0x480545,_0x14d3ab){return function(_0x336ca3){if(_0x336ca3){return _0x336ca3[_0xc03b('0x23')](_0x480545)[_0xc03b('0x24')](function(_0x2de452){return _0x2de452;});}return null;};}function removeEntity(_0x48a0a3,_0x5cc66a){return function(_0xe36749){if(_0xe36749){return _0xe36749['destroy']()[_0xc03b('0x24')](function(){var _0x402e28=_0xe36749[_0xc03b('0x25')]({'plain':!![]});var _0x319550=_0xc03b('0x26');return db[_0xc03b('0x27')][_0xc03b('0x28')]({'where':{'type':_0x319550,'resourceId':_0x402e28['id']}})[_0xc03b('0x24')](function(){return _0xe36749;});})['then'](function(){_0x48a0a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6082a4,_0xf034c9){return function(_0x3d40b8){if(!_0x3d40b8){_0x6082a4[_0xc03b('0x17')](0x194);}return _0x3d40b8;};}function handleError(_0x2974fc,_0x28c26e){_0x28c26e=_0x28c26e||0x1f4;return function(_0x574a84){logger[_0xc03b('0x29')](_0x574a84['stack']);if(_0x574a84[_0xc03b('0x2a')]){delete _0x574a84[_0xc03b('0x2a')];}_0x2974fc['status'](_0x28c26e)[_0xc03b('0x2b')](_0x574a84);};}exports[_0xc03b('0x2c')]=function(_0x1d32f7,_0x2073d1){var _0x4c1084={},_0x515aa8={},_0x24c6a1={'count':0x0,'rows':[]};var _0x5a4ac8=_[_0xc03b('0x2d')](db[_0xc03b('0x2e')][_0xc03b('0x2f')],function(_0x50b1f8){return{'name':_0x50b1f8[_0xc03b('0x30')],'type':_0x50b1f8[_0xc03b('0x31')][_0xc03b('0x32')]};});_0x515aa8[_0xc03b('0x33')]=_['map'](_0x5a4ac8,_0xc03b('0x2a'));_0x515aa8[_0xc03b('0x34')]=_[_0xc03b('0x35')](_0x1d32f7[_0xc03b('0x34')]);_0x515aa8[_0xc03b('0x36')]=_[_0xc03b('0x37')](_0x515aa8[_0xc03b('0x33')],_0x515aa8[_0xc03b('0x34')]);_0x4c1084['attributes']=_['intersection'](_0x515aa8[_0xc03b('0x33')],qs['fields'](_0x1d32f7['query'][_0xc03b('0x38')]));_0x4c1084['attributes']=_0x4c1084[_0xc03b('0x39')][_0xc03b('0x3a')]?_0x4c1084['attributes']:_0x515aa8[_0xc03b('0x33')];if(!_0x1d32f7['query']['hasOwnProperty'](_0xc03b('0x3b'))){_0x4c1084['limit']=qs[_0xc03b('0x1c')](_0x1d32f7[_0xc03b('0x34')]['limit']);_0x4c1084[_0xc03b('0x1a')]=qs[_0xc03b('0x1a')](_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x1a')]);}_0x4c1084[_0xc03b('0x3c')]=qs[_0xc03b('0x3d')](_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x3d')]);_0x4c1084['where']=qs['filters'](_[_0xc03b('0x3e')](_0x1d32f7[_0xc03b('0x34')],_0x515aa8[_0xc03b('0x36')]),_0x5a4ac8);if(_0x1d32f7[_0xc03b('0x34')]['filter']){_0x4c1084[_0xc03b('0x3f')]=_[_0xc03b('0x40')](_0x4c1084['where'],{'$or':[{'key':{'$like':'%'+_0x1d32f7['query']['filter']+'%'}},{'value':{'$like':'%'+_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x41')]+'%'}}]});}_0x4c1084=_['merge']({},_0x4c1084,_0x1d32f7[_0xc03b('0x42')]);var _0x1d95c2={'where':_0x4c1084[_0xc03b('0x3f')]};return db['CannedAnswer'][_0xc03b('0x43')](_0x1d95c2)[_0xc03b('0x24')](function(_0x35800f){_0x24c6a1[_0xc03b('0x43')]=_0x35800f;if(_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x44')]){_0x4c1084[_0xc03b('0x45')]=[{'all':!![]}];}return db[_0xc03b('0x2e')][_0xc03b('0x46')](_0x4c1084);})[_0xc03b('0x24')](function(_0x21e65b){_0x24c6a1['rows']=_0x21e65b;return _0x24c6a1;})[_0xc03b('0x24')](respondWithFilteredResult(_0x2073d1,_0x4c1084))[_0xc03b('0x47')](handleError(_0x2073d1,null));};exports[_0xc03b('0x48')]=function(_0x4672ac,_0x41224d){var _0x5ad720={'raw':!![],'where':{'id':_0x4672ac[_0xc03b('0x49')]['id']}},_0x25318a={};_0x25318a[_0xc03b('0x33')]=_['keys'](db[_0xc03b('0x2e')]['rawAttributes']);_0x25318a['query']=_['keys'](_0x4672ac[_0xc03b('0x34')]);_0x25318a['filters']=_[_0xc03b('0x37')](_0x25318a[_0xc03b('0x33')],_0x25318a[_0xc03b('0x34')]);_0x5ad720[_0xc03b('0x39')]=_[_0xc03b('0x37')](_0x25318a[_0xc03b('0x33')],qs['fields'](_0x4672ac[_0xc03b('0x34')][_0xc03b('0x38')]));_0x5ad720['attributes']=_0x5ad720['attributes']['length']?_0x5ad720['attributes']:_0x25318a[_0xc03b('0x33')];if(_0x4672ac['query'][_0xc03b('0x44')]){_0x5ad720[_0xc03b('0x45')]=[{'all':!![]}];}_0x5ad720=_['merge']({},_0x5ad720,_0x4672ac[_0xc03b('0x42')]);return db[_0xc03b('0x2e')][_0xc03b('0x4a')](_0x5ad720)['then'](handleEntityNotFound(_0x41224d,null))[_0xc03b('0x24')](respondWithResult(_0x41224d,null))[_0xc03b('0x47')](handleError(_0x41224d,null));};exports[_0xc03b('0x23')]=function(_0x1507d4,_0x276d29){if(_0x1507d4[_0xc03b('0x4b')]['id']){delete _0x1507d4[_0xc03b('0x4b')]['id'];}return db['CannedAnswer'][_0xc03b('0x4a')]({'where':{'id':_0x1507d4[_0xc03b('0x49')]['id']}})['then'](handleEntityNotFound(_0x276d29,null))[_0xc03b('0x24')](saveUpdates(_0x1507d4[_0xc03b('0x4b')],null))[_0xc03b('0x24')](respondWithResult(_0x276d29,null))[_0xc03b('0x47')](handleError(_0x276d29,null));};exports[_0xc03b('0x28')]=function(_0x4a76af,_0xbd7737){return db[_0xc03b('0x2e')][_0xc03b('0x4a')]({'where':{'id':_0x4a76af['params']['id']}})[_0xc03b('0x24')](handleEntityNotFound(_0xbd7737,null))[_0xc03b('0x24')](removeEntity(_0xbd7737,null))[_0xc03b('0x47')](handleError(_0xbd7737,null));};exports[_0xc03b('0x4c')]=function(_0x553d21,_0x16f3a7){var _0x6efad9={'key':_0x553d21['body'][_0xc03b('0x32')]};if(_0x553d21['body'][_0xc03b('0x4d')]){_0x6efad9[_0xc03b('0x4d')]=_0x553d21[_0xc03b('0x4b')][_0xc03b('0x4d')];}else if(_0x553d21[_0xc03b('0x4b')][_0xc03b('0x4e')]){_0x6efad9['SmsAccountId']=_0x553d21['body']['SmsAccountId'];}else if(_0x553d21['body'][_0xc03b('0x4f')]){_0x6efad9[_0xc03b('0x4f')]=_0x553d21[_0xc03b('0x4b')][_0xc03b('0x4f')];}else if(_0x553d21['body']['ChatWebsiteId']){_0x6efad9[_0xc03b('0x50')]=_0x553d21[_0xc03b('0x4b')][_0xc03b('0x50')];}return db[_0xc03b('0x2e')][_0xc03b('0x4a')]({'where':_0x6efad9})[_0xc03b('0x24')](function(_0x5a3e27){if(_0x5a3e27){throw new db['Sequelize'][(_0xc03b('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xc03b('0x4c')](_0x553d21[_0xc03b('0x4b')]);})[_0xc03b('0x24')](function(_0x4e3368){var _0x20c9d5=_0x553d21['user'][_0xc03b('0x25')]({'plain':!![]});if(!_0x20c9d5)throw new Error(_0xc03b('0x52'));if(_0x20c9d5[_0xc03b('0x53')]===_0xc03b('0x54')){var _0x2a36c3=_0x4e3368['get']({'plain':!![]});return db[_0xc03b('0x55')]['find']({'where':{'name':_0xc03b('0x26'),'userProfileId':_0x20c9d5[_0xc03b('0x56')]},'raw':!![]})['then'](function(_0x151419){if(_0x151419&&_0x151419['autoAssociation']===0x0){return db[_0xc03b('0x27')][_0xc03b('0x4c')]({'name':_0x2a36c3[_0xc03b('0x2a')],'resourceId':_0x2a36c3['id'],'type':_0x151419['name'],'sectionId':_0x151419['id']},{})['then'](function(){return _0x4e3368;});}else{return _0x4e3368;}})[_0xc03b('0x47')](function(_0x2eead5){logger[_0xc03b('0x29')](_0xc03b('0x57'),_0x2eead5);throw _0x2eead5;});}return _0x4e3368;})[_0xc03b('0x24')](respondWithResult(_0x16f3a7,0xc9))[_0xc03b('0x47')](handleError(_0x16f3a7,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 849a158..e4333ea 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 _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 +var _0x304a=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x487f15,_0xcca6e3){var _0x379a0=function(_0x3a4687){while(--_0x3a4687){_0x487f15['push'](_0x487f15['shift']());}};_0x379a0(++_0xcca6e3);}(_0x304a,0x19a));var _0xa304=function(_0x3c8ad0,_0x2f9d30){_0x3c8ad0=_0x3c8ad0-0x0;var _0x4926d9=_0x304a[_0x3c8ad0];return _0x4926d9;};'use strict';var _=require(_0xa304('0x0'));var util=require(_0xa304('0x1'));var logger=require(_0xa304('0x2'))(_0xa304('0x3'));var moment=require(_0xa304('0x4'));var BPromise=require(_0xa304('0x5'));var rp=require(_0xa304('0x6'));var fs=require('fs');var path=require(_0xa304('0x7'));var rimraf=require(_0xa304('0x8'));var config=require(_0xa304('0x9'));var attributes=require(_0xa304('0xa'));module['exports']=function(_0x350c70,_0x35d8f1){return _0x350c70[_0xa304('0xb')](_0xa304('0xc'),attributes,{'tableName':_0xa304('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa304('0xe'),'collate':_0xa304('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index a3fd90c..b8aec73 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(_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 +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(_0x2b00f8,_0x50c19a){var _0xf43bac=function(_0x4e5f33){while(--_0x4e5f33){_0x2b00f8['push'](_0x2b00f8['shift']());}};_0xf43bac(++_0x50c19a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 b19ce6d..ce63019 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 _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 +var _0x13fc=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x59e5d8,_0x1c4464){var _0x358a19=function(_0x43b658){while(--_0x43b658){_0x59e5d8['push'](_0x59e5d8['shift']());}};_0x358a19(++_0x1c4464);}(_0x13fc,0x1a0));var _0xc13f=function(_0x54ab,_0x4eb47e){_0x54ab=_0x54ab-0x0;var _0x1996a5=_0x13fc[_0x54ab];return _0x1996a5;};'use strict';var multer=require(_0xc13f('0x0'));var util=require('util');var path=require(_0xc13f('0x1'));var timeout=require(_0xc13f('0x2'));var express=require('express');var router=express[_0xc13f('0x3')]();var fs_extra=require(_0xc13f('0x4'));var auth=require(_0xc13f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc13f('0x6'));router[_0xc13f('0x7')]('/',auth[_0xc13f('0x8')](),controller['index']);router[_0xc13f('0x7')]('/:id',auth[_0xc13f('0x8')](),controller[_0xc13f('0x9')]);router[_0xc13f('0xa')]('/',auth[_0xc13f('0x8')](),controller[_0xc13f('0xb')]);router[_0xc13f('0xc')](_0xc13f('0xd'),auth[_0xc13f('0x8')](),controller[_0xc13f('0xe')]);router[_0xc13f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc13f('0x10')]);module[_0xc13f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 1f64c8d..73ea73d 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 _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 +var _0xcc94=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x5f5870,_0x5d4521){var _0x172b00=function(_0x1c1fc7){while(--_0x1c1fc7){_0x5f5870['push'](_0x5f5870['shift']());}};_0x172b00(++_0x5d4521);}(_0xcc94,0xee));var _0x4cc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc94[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x4cc9('0x0')]={'calldate':{'type':Sequelize[_0x4cc9('0x1')],'allowNull':![],'defaultValue':_0x4cc9('0x2')},'clid':{'type':Sequelize[_0x4cc9('0x3')]},'src':{'type':Sequelize[_0x4cc9('0x3')]},'dst':{'type':Sequelize[_0x4cc9('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x4cc9('0x3')]},'lastapp':{'type':Sequelize[_0x4cc9('0x3')]},'lastdata':{'type':Sequelize[_0x4cc9('0x3')]},'duration':{'type':Sequelize[_0x4cc9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4cc9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4cc9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4cc9('0x3')]},'uniqueid':{'type':Sequelize[_0x4cc9('0x3')]},'linkedid':{'type':Sequelize[_0x4cc9('0x3')]},'sequence':{'type':Sequelize[_0x4cc9('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x4cc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index c6844c2..612b216 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 _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 +var _0x8ca9=['show','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','sendStatus','stack','index','map','Cdr','type','key','name','keys','filters','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2ee8c3,_0x295892){_0x2ee8c3=_0x2ee8c3-0x0;var _0x4bd0fb=_0x8ca9[_0x2ee8c3];return _0x4bd0fb;};'use strict';var emlformat=require(_0x98ca('0x0'));var rimraf=require(_0x98ca('0x1'));var zipdir=require(_0x98ca('0x2'));var jsonpatch=require(_0x98ca('0x3'));var rp=require(_0x98ca('0x4'));var moment=require(_0x98ca('0x5'));var BPromise=require(_0x98ca('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x98ca('0x7'));var sox=require('sox');var csv=require(_0x98ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98ca('0x9'));var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0x8'));var querystring=require(_0x98ca('0xf'));var Papa=require(_0x98ca('0x10'));var Redis=require(_0x98ca('0x11'));var authService=require(_0x98ca('0x12'));var qs=require(_0x98ca('0x13'));var as=require(_0x98ca('0x14'));var hardwareService=require(_0x98ca('0x15'));var logger=require(_0x98ca('0x16'))(_0x98ca('0x17'));var utils=require(_0x98ca('0x18'));var config=require(_0x98ca('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ca('0x1a'))['db'];function respondWithStatusCode(_0x44b65b,_0xba3887){_0xba3887=_0xba3887||0xcc;return function(_0x472e13){if(_0x472e13){return _0x44b65b['sendStatus'](_0xba3887);}return _0x44b65b[_0x98ca('0x1b')](_0xba3887)[_0x98ca('0x1c')]();};}function respondWithResult(_0x9a230e,_0xa2bab4){_0xa2bab4=_0xa2bab4||0xc8;return function(_0x3df0ef){if(_0x3df0ef){return _0x9a230e[_0x98ca('0x1b')](_0xa2bab4)[_0x98ca('0x1d')](_0x3df0ef);}};}function respondWithFilteredResult(_0x4940ca,_0x330713){return function(_0x29df1b){if(_0x29df1b){var _0x29f46b=typeof _0x330713[_0x98ca('0x1e')]==='undefined'&&typeof _0x330713[_0x98ca('0x1f')]===_0x98ca('0x20');var _0xe9f8ad=_0x29df1b[_0x98ca('0x21')];var _0x4523bb=_0x29f46b?0x0:_0x330713[_0x98ca('0x1e')];var _0x28c8a6=_0x29f46b?_0x29df1b[_0x98ca('0x21')]:_0x330713[_0x98ca('0x1e')]+_0x330713[_0x98ca('0x1f')];var _0x1b2c69;if(_0x28c8a6>=_0xe9f8ad){_0x28c8a6=_0xe9f8ad;_0x1b2c69=0xc8;}else{_0x1b2c69=0xce;}_0x4940ca['status'](_0x1b2c69);return _0x4940ca[_0x98ca('0x22')]('Content-Range',_0x4523bb+'-'+_0x28c8a6+'/'+_0xe9f8ad)[_0x98ca('0x1d')](_0x29df1b);}return null;};}function patchUpdates(_0x2fe568){return function(_0x50f8b4){try{jsonpatch['apply'](_0x50f8b4,_0x2fe568,!![]);}catch(_0x4620e3){return BPromise[_0x98ca('0x23')](_0x4620e3);}return _0x50f8b4[_0x98ca('0x24')]();};}function saveUpdates(_0x519927,_0x2f7742){return function(_0xc23332){if(_0xc23332){return _0xc23332['update'](_0x519927)[_0x98ca('0x25')](function(_0x5dc400){return _0x5dc400;});}return null;};}function removeEntity(_0x3fd0bd,_0x323cdb){return function(_0x430d16){if(_0x430d16){return _0x430d16[_0x98ca('0x26')]()[_0x98ca('0x25')](function(){_0x3fd0bd[_0x98ca('0x1b')](0xcc)[_0x98ca('0x1c')]();});}};}function handleEntityNotFound(_0x50b1a2,_0x2029cb){return function(_0x4fc3c9){if(!_0x4fc3c9){_0x50b1a2[_0x98ca('0x27')](0x194);}return _0x4fc3c9;};}function handleError(_0x1bdb75,_0x5eb829){_0x5eb829=_0x5eb829||0x1f4;return function(_0x1f569b){logger['error'](_0x1f569b[_0x98ca('0x28')]);if(_0x1f569b['name']){delete _0x1f569b['name'];}_0x1bdb75[_0x98ca('0x1b')](_0x5eb829)['send'](_0x1f569b);};}exports[_0x98ca('0x29')]=function(_0x35b920,_0x13f766){var _0x21a12a={},_0x3b3e60={},_0x1e7fcf={'count':0x0,'rows':[]};var _0x11389a=_[_0x98ca('0x2a')](db[_0x98ca('0x2b')]['rawAttributes'],function(_0x2ebf28){return{'name':_0x2ebf28['fieldName'],'type':_0x2ebf28[_0x98ca('0x2c')][_0x98ca('0x2d')]};});_0x3b3e60['model']=_['map'](_0x11389a,_0x98ca('0x2e'));_0x3b3e60['query']=_[_0x98ca('0x2f')](_0x35b920['query']);_0x3b3e60[_0x98ca('0x30')]=_['intersection'](_0x3b3e60[_0x98ca('0x31')],_0x3b3e60[_0x98ca('0x32')]);_0x21a12a['attributes']=_[_0x98ca('0x33')](_0x3b3e60[_0x98ca('0x31')],qs['fields'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x34')]));_0x21a12a['attributes']=_0x21a12a[_0x98ca('0x35')][_0x98ca('0x36')]?_0x21a12a[_0x98ca('0x35')]:_0x3b3e60[_0x98ca('0x31')];if(!_0x35b920[_0x98ca('0x32')]['hasOwnProperty'](_0x98ca('0x37'))){_0x21a12a[_0x98ca('0x1f')]=qs['limit'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1f')]);_0x21a12a[_0x98ca('0x1e')]=qs['offset'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1e')]);}_0x21a12a[_0x98ca('0x38')]=qs['sort'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x39')]);_0x21a12a[_0x98ca('0x3a')]=qs['filters'](_['pick'](_0x35b920[_0x98ca('0x32')],_0x3b3e60[_0x98ca('0x30')]),_0x11389a);if(_0x35b920[_0x98ca('0x32')]['filter']){_0x21a12a[_0x98ca('0x3a')]=_[_0x98ca('0x3b')](_0x21a12a[_0x98ca('0x3a')],{'$or':_['map'](_0x11389a,function(_0x1f513b){if(_0x1f513b[_0x98ca('0x2c')]!==_0x98ca('0x3c')){var _0x450745={};_0x450745[_0x1f513b[_0x98ca('0x2e')]]={'$like':'%'+_0x35b920['query']['filter']+'%'};return _0x450745;}})});}_0x21a12a=_['merge']({},_0x21a12a,_0x35b920[_0x98ca('0x3d')]);var _0x2ef2f4={'where':_0x21a12a[_0x98ca('0x3a')]};return db[_0x98ca('0x2b')][_0x98ca('0x21')](_0x2ef2f4)[_0x98ca('0x25')](function(_0x29801f){_0x1e7fcf['count']=_0x29801f;if(_0x35b920['query'][_0x98ca('0x3e')]){_0x21a12a[_0x98ca('0x3f')]=[{'all':!![]}];}return db[_0x98ca('0x2b')][_0x98ca('0x40')](_0x21a12a);})[_0x98ca('0x25')](function(_0x535fdc){_0x1e7fcf['rows']=_0x535fdc;return _0x1e7fcf;})['then'](respondWithFilteredResult(_0x13f766,_0x21a12a))[_0x98ca('0x41')](handleError(_0x13f766,null));};exports[_0x98ca('0x42')]=function(_0x914606,_0x3f260b){var _0x4ede34={'raw':!![],'where':{'id':_0x914606[_0x98ca('0x43')]['id']}},_0x4c2515={};_0x4c2515[_0x98ca('0x31')]=_[_0x98ca('0x2f')](db[_0x98ca('0x2b')][_0x98ca('0x44')]);_0x4c2515[_0x98ca('0x32')]=_[_0x98ca('0x2f')](_0x914606[_0x98ca('0x32')]);_0x4c2515[_0x98ca('0x30')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],_0x4c2515['query']);_0x4ede34[_0x98ca('0x35')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],qs[_0x98ca('0x34')](_0x914606[_0x98ca('0x32')][_0x98ca('0x34')]));_0x4ede34[_0x98ca('0x35')]=_0x4ede34[_0x98ca('0x35')][_0x98ca('0x36')]?_0x4ede34['attributes']:_0x4c2515[_0x98ca('0x31')];if(_0x914606[_0x98ca('0x32')]['includeAll']){_0x4ede34[_0x98ca('0x3f')]=[{'all':!![]}];}_0x4ede34=_['merge']({},_0x4ede34,_0x914606[_0x98ca('0x3d')]);return db[_0x98ca('0x2b')][_0x98ca('0x45')](_0x4ede34)[_0x98ca('0x25')](handleEntityNotFound(_0x3f260b,null))[_0x98ca('0x25')](respondWithResult(_0x3f260b,null))[_0x98ca('0x41')](handleError(_0x3f260b,null));};exports[_0x98ca('0x46')]=function(_0x15ed74,_0x2c7d53){return db[_0x98ca('0x2b')][_0x98ca('0x46')](_0x15ed74[_0x98ca('0x47')],{})['then'](respondWithResult(_0x2c7d53,0xc9))[_0x98ca('0x41')](handleError(_0x2c7d53,null));};exports[_0x98ca('0x48')]=function(_0x40498f,_0x19dc39){if(_0x40498f['body']['id']){delete _0x40498f[_0x98ca('0x47')]['id'];}return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x40498f[_0x98ca('0x43')]['id']}})[_0x98ca('0x25')](handleEntityNotFound(_0x19dc39,null))[_0x98ca('0x25')](saveUpdates(_0x40498f[_0x98ca('0x47')],null))['then'](respondWithResult(_0x19dc39,null))['catch'](handleError(_0x19dc39,null));};exports['destroy']=function(_0x3247af,_0x3715cb){return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x3247af['params']['id']}})['then'](handleEntityNotFound(_0x3715cb,null))[_0x98ca('0x25')](removeEntity(_0x3715cb,null))[_0x98ca('0x41')](handleError(_0x3715cb,null));};exports[_0x98ca('0x49')]=function(_0x408266,_0x46bb13){return db[_0x98ca('0x2b')][_0x98ca('0x49')]()[_0x98ca('0x25')](respondWithResult(_0x46bb13,null))[_0x98ca('0x41')](handleError(_0x46bb13,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f7b2395..91d0d94 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_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 +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x391e46,_0x15620f){var _0x30f716=function(_0x28d242){while(--_0x28d242){_0x391e46['push'](_0x391e46['shift']());}};_0x30f716(++_0x15620f);}(_0x7a54,0x106));var _0x47a5=function(_0x7a5cf1,_0x43a166){_0x7a5cf1=_0x7a5cf1-0x0;var _0x4e670a=_0x7a54[_0x7a5cf1];return _0x4e670a;};'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 314d5ed..c234152 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 _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 +var _0x899f=['../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x899f,0x101));var _0xf899=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x899f[_0x41f2f5];return _0x3d49f1;};'use strict';var _=require(_0xf899('0x0'));var util=require(_0xf899('0x1'));var moment=require('moment');var BPromise=require(_0xf899('0x2'));var rs=require(_0xf899('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf899('0x4'))['db'];var utils=require(_0xf899('0x5'));var logger=require('../../config/logger')(_0xf899('0x6'));var config=require(_0xf899('0x7'));var jayson=require(_0xf899('0x8'));var client=jayson[_0xf899('0x9')][_0xf899('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x426ea3,_0x5f2024,_0x1e78e8){return new BPromise(function(_0x3f4f11,_0x54c924){return client[_0xf899('0xb')](_0x426ea3,_0x1e78e8)[_0xf899('0xc')](function(_0x1410c7){logger[_0xf899('0xd')](_0xf899('0xe'),_0x5f2024,_0xf899('0xf'));logger['debug'](_0xf899('0x10'),_0x5f2024,_0xf899('0xf'),JSON[_0xf899('0x11')](_0x1410c7));if(_0x1410c7[_0xf899('0x12')]){if(_0x1410c7[_0xf899('0x12')][_0xf899('0x13')]===0x1f4){logger['error'](_0xf899('0xe'),_0x5f2024,_0x1410c7[_0xf899('0x12')][_0xf899('0x14')]);return _0x54c924(_0x1410c7[_0xf899('0x12')][_0xf899('0x14')]);}logger[_0xf899('0x12')](_0xf899('0xe'),_0x5f2024,_0x1410c7[_0xf899('0x12')][_0xf899('0x14')]);return _0x3f4f11(_0x1410c7['error'][_0xf899('0x14')]);}else{logger[_0xf899('0xd')]('Cdr,\x20%s,\x20%s',_0x5f2024,_0xf899('0xf'));_0x3f4f11(_0x1410c7[_0xf899('0x15')][_0xf899('0x14')]);}})['catch'](function(_0x1df4f1){logger['error'](_0xf899('0xe'),_0x5f2024,_0x1df4f1);_0x54c924(_0x1df4f1);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 40d9a0c..f9de83d 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(_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 +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(_0x2fa457,_0x7021df){var _0x4f250a=function(_0xef901e){while(--_0xef901e){_0x2fa457['push'](_0x2fa457['shift']());}};_0x4f250a(++_0x7021df);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index aa10087..6731491 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 _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 +var _0xf103=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x1ca037,_0x33e239){var _0x4f8516=function(_0x52affd){while(--_0x52affd){_0x1ca037['push'](_0x1ca037['shift']());}};_0x4f8516(++_0x33e239);}(_0xf103,0x1d8));var _0x3f10=function(_0x4db00c,_0x50cab8){_0x4db00c=_0x4db00c-0x0;var _0x2bf17e=_0xf103[_0x4db00c];return _0x2bf17e;};'use strict';var Sequelize=require(_0x3f10('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3f10('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3f10('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3f10('0x3')]()},'description':{'type':Sequelize[_0x3f10('0x2')]},'interval':{'type':Sequelize[_0x3f10('0x2')],'defaultValue':_0x3f10('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c74036f..8b31b16 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 _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 +var _0x087b=['undefined','count','set','apply','reject','save','then','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','options','find','catch','update','body','params','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x2f707a,_0x1af79d){var _0x556d27=function(_0x343ba6){while(--_0x343ba6){_0x2f707a['push'](_0x2f707a['shift']());}};_0x556d27(++_0x1af79d);}(_0x087b,0x11a));var _0xb087=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x087b[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2dc6,_0x50745a){return function(_0x598b99){if(!_0x598b99){_0x5a2dc6['sendStatus'](0x194);}return _0x598b99;};}function handleError(_0x304840,_0x45685d){_0x45685d=_0x45685d||0x1f4;return function(_0x1d124f){logger[_0xb087('0x28')](_0x1d124f[_0xb087('0x29')]);if(_0x1d124f[_0xb087('0x2a')]){delete _0x1d124f[_0xb087('0x2a')];}_0x304840[_0xb087('0x1c')](_0x45685d)[_0xb087('0x2b')](_0x1d124f);};}exports[_0xb087('0x2c')]=function(_0x18058c,_0x31e3e6){var _0xb0baf6={'raw':!![],'where':{'id':_0x18058c['params']['id']}},_0x263259={};_0x263259[_0xb087('0x2d')]=_[_0xb087('0x2e')](db[_0xb087('0x2f')][_0xb087('0x30')]);_0x263259[_0xb087('0x31')]=_[_0xb087('0x2e')](_0x18058c[_0xb087('0x31')]);_0x263259[_0xb087('0x32')]=_['intersection'](_0x263259['model'],_0x263259[_0xb087('0x31')]);_0xb0baf6[_0xb087('0x33')]=_['intersection'](_0x263259[_0xb087('0x2d')],qs[_0xb087('0x34')](_0x18058c[_0xb087('0x31')][_0xb087('0x34')]));_0xb0baf6[_0xb087('0x33')]=_0xb0baf6[_0xb087('0x33')][_0xb087('0x35')]?_0xb0baf6[_0xb087('0x33')]:_0x263259[_0xb087('0x2d')];if(_0x18058c[_0xb087('0x31')][_0xb087('0x36')]){_0xb0baf6[_0xb087('0x37')]=[{'all':!![]}];}_0xb0baf6=_['merge']({},_0xb0baf6,_0x18058c[_0xb087('0x38')]);return db['ChatApplication'][_0xb087('0x39')](_0xb0baf6)[_0xb087('0x27')](handleEntityNotFound(_0x31e3e6,null))[_0xb087('0x27')](respondWithResult(_0x31e3e6,null))[_0xb087('0x3a')](handleError(_0x31e3e6,null));};exports[_0xb087('0x3b')]=function(_0x1a4b17,_0x32c3e8){if(_0x1a4b17[_0xb087('0x3c')]['id']){delete _0x1a4b17[_0xb087('0x3c')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x1a4b17[_0xb087('0x3d')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x32c3e8,null))[_0xb087('0x27')](saveUpdates(_0x1a4b17[_0xb087('0x3c')],null))[_0xb087('0x27')](respondWithResult(_0x32c3e8,null))['catch'](handleError(_0x32c3e8,null));};exports[_0xb087('0x3e')]=function(_0x1fdc19,_0x48524e){return db['ChatApplication'][_0xb087('0x39')]({'where':{'id':_0x1fdc19[_0xb087('0x3d')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x48524e,null))['then'](removeEntity(_0x48524e,null))[_0xb087('0x3a')](handleError(_0x48524e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 98325cb..5ac6d16 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 _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 +var _0x383a=['../../config/environment','define','util','../../config/logger','bluebird','path','rimraf'];(function(_0x200b99,_0x55ecd3){var _0x68c6d6=function(_0x4feb82){while(--_0x4feb82){_0x200b99['push'](_0x200b99['shift']());}};_0x68c6d6(++_0x55ecd3);}(_0x383a,0x1ad));var _0xa383=function(_0x54f253,_0x13acb1){_0x54f253=_0x54f253-0x0;var _0x207e8d=_0x383a[_0x54f253];return _0x207e8d;};'use strict';var _=require('lodash');var util=require(_0xa383('0x0'));var logger=require(_0xa383('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa383('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa383('0x3'));var rimraf=require(_0xa383('0x4'));var config=require(_0xa383('0x5'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0xc72371,_0x160e4f){return _0xc72371[_0xa383('0x6')]('ChatApplication',attributes,{'tableName':'chat_applications','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 4344cd2..7aaa99e 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 _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 +var _0xc84c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc84c,0x12f));var _0xcc84=function(_0xa99357,_0x50ffad){_0xa99357=_0xa99357-0x0;var _0x111875=_0xc84c[_0xa99357];return _0x111875;};'use strict';var _=require(_0xcc84('0x0'));var util=require(_0xcc84('0x1'));var moment=require(_0xcc84('0x2'));var BPromise=require(_0xcc84('0x3'));var rs=require(_0xcc84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc84('0x6'))(_0xcc84('0x7'));var config=require(_0xcc84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30030b,_0x54fc2b,_0x8daa1f){return new BPromise(function(_0x2635c4,_0x45c5cc){return client[_0xcc84('0xa')](_0x30030b,_0x8daa1f)[_0xcc84('0xb')](function(_0x58e08f){logger['info'](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));logger[_0xcc84('0xe')](_0xcc84('0xf'),_0x54fc2b,_0xcc84('0xd'),JSON[_0xcc84('0x10')](_0x58e08f));if(_0x58e08f[_0xcc84('0x11')]){if(_0x58e08f[_0xcc84('0x11')]['code']===0x1f4){logger[_0xcc84('0x11')]('ChatApplication,\x20%s,\x20%s',_0x54fc2b,_0x58e08f[_0xcc84('0x11')][_0xcc84('0x12')]);return _0x45c5cc(_0x58e08f[_0xcc84('0x11')]['message']);}logger[_0xcc84('0x11')]('ChatApplication,\x20%s,\x20%s',_0x54fc2b,_0x58e08f['error']['message']);return _0x2635c4(_0x58e08f['error'][_0xcc84('0x12')]);}else{logger[_0xcc84('0x13')](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));_0x2635c4(_0x58e08f[_0xcc84('0x14')][_0xcc84('0x12')]);}})[_0xcc84('0x15')](function(_0x334ec8){logger[_0xcc84('0x11')](_0xcc84('0xc'),_0x54fc2b,_0x334ec8);_0x45c5cc(_0x334ec8);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0eb2559..fae4bb3 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 _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 +var _0xce8a=['show','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x48a024,_0x5135cf){var _0x93a358=function(_0x52d479){while(--_0x52d479){_0x48a024['push'](_0x48a024['shift']());}};_0x93a358(++_0x5135cf);}(_0xce8a,0x14f));var _0xace8=function(_0x1ff1a4,_0x3aa6bb){_0x1ff1a4=_0x1ff1a4-0x0;var _0x4a49d2=_0xce8a[_0x1ff1a4];return _0x4a49d2;};'use strict';var multer=require(_0xace8('0x0'));var util=require('util');var path=require(_0xace8('0x1'));var timeout=require(_0xace8('0x2'));var express=require('express');var router=express[_0xace8('0x3')]();var fs_extra=require(_0xace8('0x4'));var auth=require(_0xace8('0x5'));var interaction=require(_0xace8('0x6'));var config=require(_0xace8('0x7'));var controller=require('./chatApplication.controller');router[_0xace8('0x8')]('/:id',auth[_0xace8('0x9')](),controller[_0xace8('0xa')]);router['put'](_0xace8('0xb'),auth['isAuthenticated'](),controller[_0xace8('0xc')]);router[_0xace8('0xd')](_0xace8('0xb'),auth[_0xace8('0x9')](),controller[_0xace8('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a22b9fe..880d638 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 _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 +var _0xbf6c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5cdc13,_0x4702cf){var _0x2a76d8=function(_0x32e6d2){while(--_0x32e6d2){_0x5cdc13['push'](_0x5cdc13['shift']());}};_0x2a76d8(++_0x4702cf);}(_0xbf6c,0x1a6));var _0xcbf6=function(_0x12369b,_0x45cc7f){_0x12369b=_0x12369b-0x0;var _0x2b33c0=_0xbf6c[_0x12369b];return _0x2b33c0;};'use strict';var Sequelize=require(_0xcbf6('0x0'));module[_0xcbf6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcbf6('0x2')]},'write':{'type':Sequelize[_0xcbf6('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1f12197..988c67a 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 _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 +var _0x76bf=['removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User'];(function(_0x1a27c4,_0x2a320d){var _0x3efcfb=function(_0xe52c1c){while(--_0xe52c1c){_0x1a27c4['push'](_0x1a27c4['shift']());}};_0x3efcfb(++_0x2a320d);}(_0x76bf,0x125));var _0xf76b=function(_0x39093b,_0x1c54f1){_0x39093b=_0x39093b-0x0;var _0x248080=_0x76bf[_0x39093b];return _0x248080;};'use strict';var emlformat=require(_0xf76b('0x0'));var rimraf=require(_0xf76b('0x1'));var zipdir=require(_0xf76b('0x2'));var jsonpatch=require(_0xf76b('0x3'));var rp=require(_0xf76b('0x4'));var moment=require(_0xf76b('0x5'));var BPromise=require(_0xf76b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf76b('0x7'));var sox=require('sox');var csv=require(_0xf76b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf76b('0x9'));var _=require(_0xf76b('0xa'));var squel=require(_0xf76b('0xb'));var crypto=require(_0xf76b('0xc'));var jsforce=require(_0xf76b('0xd'));var deskjs=require(_0xf76b('0xe'));var toCsv=require(_0xf76b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf76b('0xf'));var authService=require(_0xf76b('0x10'));var qs=require(_0xf76b('0x11'));var as=require(_0xf76b('0x12'));var hardwareService=require(_0xf76b('0x13'));var logger=require(_0xf76b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf76b('0x15'));var licenseUtil=require(_0xf76b('0x16'));var db=require('../../mysqldb')['db'];config[_0xf76b('0x17')]=_['defaults'](config[_0xf76b('0x17')],{'host':_0xf76b('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf76b('0x17')]));require(_0xf76b('0x19'))['register'](socket);function respondWithStatusCode(_0x2dce43,_0x44ce4b){_0x44ce4b=_0x44ce4b||0xcc;return function(_0x42e048){if(_0x42e048){return _0x2dce43[_0xf76b('0x1a')](_0x44ce4b);}return _0x2dce43[_0xf76b('0x1b')](_0x44ce4b)['end']();};}function respondWithResult(_0x115ad,_0xf60d64){_0xf60d64=_0xf60d64||0xc8;return function(_0x45e8a5){if(_0x45e8a5){return _0x115ad['status'](_0xf60d64)[_0xf76b('0x1c')](_0x45e8a5);}};}function respondWithFilteredResult(_0x59ee7c,_0x512b6d){return function(_0x40b740){if(_0x40b740){var _0x49ed9e=typeof _0x512b6d[_0xf76b('0x1d')]===_0xf76b('0x1e')&&typeof _0x512b6d[_0xf76b('0x1f')]===_0xf76b('0x1e');var _0x597095=_0x40b740[_0xf76b('0x20')];var _0x9caf21=_0x49ed9e?0x0:_0x512b6d['offset'];var _0x11dbaf=_0x49ed9e?_0x40b740['count']:_0x512b6d[_0xf76b('0x1d')]+_0x512b6d[_0xf76b('0x1f')];var _0x4f0a46;if(_0x11dbaf>=_0x597095){_0x11dbaf=_0x597095;_0x4f0a46=0xc8;}else{_0x4f0a46=0xce;}_0x59ee7c[_0xf76b('0x1b')](_0x4f0a46);return _0x59ee7c[_0xf76b('0x21')](_0xf76b('0x22'),_0x9caf21+'-'+_0x11dbaf+'/'+_0x597095)[_0xf76b('0x1c')](_0x40b740);}return null;};}function patchUpdates(_0x52622e){return function(_0x552249){try{jsonpatch['apply'](_0x552249,_0x52622e,!![]);}catch(_0x1c5af6){return BPromise[_0xf76b('0x23')](_0x1c5af6);}return _0x552249[_0xf76b('0x24')]();};}function saveUpdates(_0x1a1ba5,_0x35acc8){return function(_0x4a07a9){if(_0x4a07a9){return _0x4a07a9['update'](_0x1a1ba5)[_0xf76b('0x25')](function(_0x1208f4){return _0x1208f4;});}return null;};}function removeEntity(_0x263eb8,_0x1c1981){return function(_0x2bf29d){if(_0x2bf29d){return _0x2bf29d[_0xf76b('0x26')]()[_0xf76b('0x25')](function(){_0x263eb8[_0xf76b('0x1b')](0xcc)[_0xf76b('0x27')]();});}};}function handleEntityNotFound(_0x210d5d,_0x448391){return function(_0x1500a8){if(!_0x1500a8){_0x210d5d['sendStatus'](0x194);}return _0x1500a8;};}function handleError(_0x3440bf,_0x51e4b6){_0x51e4b6=_0x51e4b6||0x1f4;return function(_0x1b9472){logger[_0xf76b('0x28')](_0x1b9472[_0xf76b('0x29')]);if(_0x1b9472['name']){delete _0x1b9472[_0xf76b('0x2a')];}_0x3440bf[_0xf76b('0x1b')](_0x51e4b6)[_0xf76b('0x2b')](_0x1b9472);};}exports['index']=function(_0x5809d6,_0xea71d7){var _0x3b9792={},_0x4b40be={},_0x110dbb={'count':0x0,'rows':[]};var _0x56370b=_[_0xf76b('0x2c')](db[_0xf76b('0x2d')][_0xf76b('0x2e')],function(_0x40788f){return{'name':_0x40788f[_0xf76b('0x2f')],'type':_0x40788f['type'][_0xf76b('0x30')]};});_0x4b40be['model']=_['map'](_0x56370b,'name');_0x4b40be[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x5809d6[_0xf76b('0x31')]);_0x4b40be[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x4b40be[_0xf76b('0x35')],_0x4b40be[_0xf76b('0x31')]);_0x3b9792[_0xf76b('0x36')]=_[_0xf76b('0x34')](_0x4b40be[_0xf76b('0x35')],qs[_0xf76b('0x37')](_0x5809d6['query'][_0xf76b('0x37')]));_0x3b9792[_0xf76b('0x36')]=_0x3b9792[_0xf76b('0x36')][_0xf76b('0x38')]?_0x3b9792[_0xf76b('0x36')]:_0x4b40be[_0xf76b('0x35')];if(!_0x5809d6[_0xf76b('0x31')][_0xf76b('0x39')](_0xf76b('0x3a'))){_0x3b9792[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x5809d6['query'][_0xf76b('0x1f')]);_0x3b9792[_0xf76b('0x1d')]=qs[_0xf76b('0x1d')](_0x5809d6['query']['offset']);}_0x3b9792[_0xf76b('0x3b')]=qs['sort'](_0x5809d6[_0xf76b('0x31')][_0xf76b('0x3c')]);_0x3b9792[_0xf76b('0x3d')]=qs['filters'](_[_0xf76b('0x3e')](_0x5809d6[_0xf76b('0x31')],_0x4b40be[_0xf76b('0x33')]),_0x56370b);if(_0x5809d6['query'][_0xf76b('0x3f')]){_0x3b9792['where']=_['merge'](_0x3b9792[_0xf76b('0x3d')],{'$or':_[_0xf76b('0x2c')](_0x56370b,function(_0x168809){if(_0x168809[_0xf76b('0x40')]!==_0xf76b('0x41')){var _0x1b3dca={};_0x1b3dca[_0x168809[_0xf76b('0x2a')]]={'$like':'%'+_0x5809d6[_0xf76b('0x31')]['filter']+'%'};return _0x1b3dca;}})});}_0x3b9792=_[_0xf76b('0x42')]({},_0x3b9792,_0x5809d6[_0xf76b('0x43')]);var _0x3252cf={'where':_0x3b9792[_0xf76b('0x3d')]};return db['ChatGroup'][_0xf76b('0x20')](_0x3252cf)[_0xf76b('0x25')](function(_0x48fff1){_0x110dbb[_0xf76b('0x20')]=_0x48fff1;if(_0x5809d6[_0xf76b('0x31')][_0xf76b('0x44')]){_0x3b9792[_0xf76b('0x45')]=[{'all':!![]}];}return db['ChatGroup'][_0xf76b('0x46')](_0x3b9792);})[_0xf76b('0x25')](function(_0x350f0d){_0x110dbb[_0xf76b('0x47')]=_0x350f0d;return _0x110dbb;})[_0xf76b('0x25')](respondWithFilteredResult(_0xea71d7,_0x3b9792))[_0xf76b('0x48')](handleError(_0xea71d7,null));};exports['show']=function(_0x4dc7f5,_0x31bfa7){var _0x1ebe0e={'raw':!![],'where':{'id':_0x4dc7f5[_0xf76b('0x49')]['id']}},_0x3cd096={};_0x3cd096[_0xf76b('0x35')]=_[_0xf76b('0x32')](db[_0xf76b('0x2d')]['rawAttributes']);_0x3cd096[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x4dc7f5[_0xf76b('0x31')]);_0x3cd096[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x3cd096['model'],_0x3cd096['query']);_0x1ebe0e[_0xf76b('0x36')]=_['intersection'](_0x3cd096[_0xf76b('0x35')],qs[_0xf76b('0x37')](_0x4dc7f5[_0xf76b('0x31')]['fields']));_0x1ebe0e['attributes']=_0x1ebe0e[_0xf76b('0x36')][_0xf76b('0x38')]?_0x1ebe0e[_0xf76b('0x36')]:_0x3cd096[_0xf76b('0x35')];if(_0x4dc7f5[_0xf76b('0x31')][_0xf76b('0x44')]){_0x1ebe0e[_0xf76b('0x45')]=[{'all':!![]}];}_0x1ebe0e=_[_0xf76b('0x42')]({},_0x1ebe0e,_0x4dc7f5['options']);return db[_0xf76b('0x2d')][_0xf76b('0x4a')](_0x1ebe0e)[_0xf76b('0x25')](handleEntityNotFound(_0x31bfa7,null))[_0xf76b('0x25')](respondWithResult(_0x31bfa7,null))[_0xf76b('0x48')](handleError(_0x31bfa7,null));};exports[_0xf76b('0x4b')]=function(_0x3fb123,_0x1aaed9){return db[_0xf76b('0x2d')]['create'](_0x3fb123[_0xf76b('0x4c')],{})[_0xf76b('0x25')](respondWithResult(_0x1aaed9,0xc9))[_0xf76b('0x48')](handleError(_0x1aaed9,null));};exports[_0xf76b('0x4d')]=function(_0x363990,_0x4ae3fd){if(_0x363990['body']['id']){delete _0x363990[_0xf76b('0x4c')]['id'];}return db[_0xf76b('0x2d')][_0xf76b('0x4a')]({'where':{'id':_0x363990[_0xf76b('0x49')]['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x4ae3fd,null))['then'](saveUpdates(_0x363990['body'],null))['then'](respondWithResult(_0x4ae3fd,null))['catch'](handleError(_0x4ae3fd,null));};exports[_0xf76b('0x26')]=function(_0x51b420,_0x372647){return db['ChatGroup'][_0xf76b('0x4a')]({'where':{'id':_0x51b420[_0xf76b('0x49')]['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x372647,null))['then'](removeEntity(_0x372647,null))[_0xf76b('0x48')](handleError(_0x372647,null));};exports['describe']=function(_0xf652fc,_0x2878a4){return db[_0xf76b('0x2d')]['describe']()[_0xf76b('0x25')](respondWithResult(_0x2878a4,null))[_0xf76b('0x48')](handleError(_0x2878a4,null));};exports[_0xf76b('0x4e')]=function(_0x4986f3,_0x236610,_0x2f321f){return db[_0xf76b('0x4f')][_0xf76b('0x20')]({'where':{'ChatGroupId':_0x4986f3[_0xf76b('0x49')]['id'],'ToId':_0x4986f3[_0xf76b('0x50')]['id'],'read':![]}})['then'](function(_0x18aa6b){return{'id':_['toInteger'](_0x4986f3[_0xf76b('0x49')]['id']),'count':_0x18aa6b};})[_0xf76b('0x25')](respondWithResult(_0x236610,null))[_0xf76b('0x48')](handleError(_0x236610,null));};exports['addMembers']=function(_0x1e4547,_0x39fc48,_0xfbceb7){return db[_0xf76b('0x2d')]['find']({'where':{'id':_0x1e4547['params']['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x39fc48,null))[_0xf76b('0x25')](function(_0x1c87cb){if(_0x1c87cb){return _0x1c87cb[_0xf76b('0x51')](_0x1e4547[_0xf76b('0x4c')][_0xf76b('0x52')],_[_0xf76b('0x53')](_0x1e4547[_0xf76b('0x4c')],[_0xf76b('0x52'),'id'])||{});}})[_0xf76b('0x25')](respondWithResult(_0x39fc48,null))['catch'](handleError(_0x39fc48,null));};exports[_0xf76b('0x54')]=function(_0x4e2347,_0x5940fe,_0x41b787){var _0x4ab087={};var _0x4658ef={};var _0x5556e7;var _0x4af2d8;return db[_0xf76b('0x2d')][_0xf76b('0x55')]({'where':{'id':_0x4e2347['params']['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x5940fe,null))[_0xf76b('0x25')](function(_0x90a844){if(_0x90a844){_0x5556e7=_0x90a844;_0x4658ef['model']=_[_0xf76b('0x32')](db[_0xf76b('0x56')][_0xf76b('0x2e')]);_0x4658ef[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x4e2347[_0xf76b('0x31')]);_0x4658ef[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x4658ef['model'],_0x4658ef['query']);_0x4ab087[_0xf76b('0x36')]=_['intersection'](_0x4658ef[_0xf76b('0x35')],qs['fields'](_0x4e2347[_0xf76b('0x31')]['fields']));_0x4ab087[_0xf76b('0x36')]=_0x4ab087[_0xf76b('0x36')][_0xf76b('0x38')]?_0x4ab087['attributes']:_0x4658ef[_0xf76b('0x35')];_0x4ab087[_0xf76b('0x3b')]=qs[_0xf76b('0x3c')](_0x4e2347[_0xf76b('0x31')][_0xf76b('0x3c')]);_0x4ab087[_0xf76b('0x3d')]=qs[_0xf76b('0x33')](_[_0xf76b('0x3e')](_0x4e2347['query'],_0x4658ef['filters']));if(_0x4e2347[_0xf76b('0x31')][_0xf76b('0x3f')]){_0x4ab087[_0xf76b('0x3d')]=_['merge'](_0x4ab087[_0xf76b('0x3d')],{'$or':_['map'](_0x4ab087['attributes'],function(_0x260a89){var _0x456ca3={};_0x456ca3[_0x260a89]={'$like':'%'+_0x4e2347[_0xf76b('0x31')][_0xf76b('0x3f')]+'%'};return _0x456ca3;})});}_0x4ab087=_['merge']({},_0x4ab087,_0x4e2347['options']);return _0x5556e7['getMembers'](_0x4ab087);}})[_0xf76b('0x25')](function(_0x52191a){if(_0x52191a){_0x4af2d8=_0x52191a['length'];if(!_0x4e2347[_0xf76b('0x31')][_0xf76b('0x39')](_0xf76b('0x3a'))){_0x4ab087[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x4e2347[_0xf76b('0x31')][_0xf76b('0x1f')]);_0x4ab087['offset']=qs[_0xf76b('0x1d')](_0x4e2347['query']['offset']);}return _0x5556e7[_0xf76b('0x54')](_0x4ab087);}})[_0xf76b('0x25')](function(_0x1a73c3){if(_0x1a73c3){return _0x1a73c3?{'count':_0x4af2d8,'rows':_0x1a73c3}:null;}})[_0xf76b('0x25')](respondWithResult(_0x5940fe,null))[_0xf76b('0x48')](handleError(_0x5940fe,null));};exports[_0xf76b('0x57')]=function(_0x162039,_0x3b7d0a,_0x156780){return db[_0xf76b('0x2d')]['find']({'where':{'id':_0x162039[_0xf76b('0x49')]['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x3b7d0a,null))[_0xf76b('0x25')](function(_0x4c6c35){if(_0x4c6c35){return _0x4c6c35[_0xf76b('0x57')](_0x162039[_0xf76b('0x31')]['ids']);}})[_0xf76b('0x25')](respondWithStatusCode(_0x3b7d0a,null))[_0xf76b('0x48')](handleError(_0x3b7d0a,null));};exports[_0xf76b('0x58')]=function(_0x178036,_0x136145,_0x4a1ca3){if(_0x178036[_0xf76b('0x4c')]['id']){delete _0x178036[_0xf76b('0x4c')]['id'];}return db[_0xf76b('0x2d')][_0xf76b('0x4a')]({'where':{'id':_0x178036[_0xf76b('0x49')]['id']}})['then'](handleEntityNotFound(_0x136145,null))[_0xf76b('0x25')](function(_0x4a1ee3){if(_0x4a1ee3){_0x178036[_0xf76b('0x4c')][_0xf76b('0x59')]=_0x4a1ee3['id'];return db[_0xf76b('0x4f')][_0xf76b('0x4b')](_0x178036[_0xf76b('0x4c')]);}})[_0xf76b('0x25')](respondWithResult(_0x136145,null))['catch'](handleError(_0x136145,null));};exports[_0xf76b('0x5a')]=function(_0x297058,_0x193296,_0x261bea){var _0xe9fb63={};var _0x4f560a={};var _0x11d0fe;var _0x179047;return db['ChatGroup'][_0xf76b('0x55')]({'where':{'id':_0x297058[_0xf76b('0x49')]['id']}})['then'](handleEntityNotFound(_0x193296,null))[_0xf76b('0x25')](function(_0x3c4095){if(_0x3c4095){_0x11d0fe=_0x3c4095;_0x4f560a['model']=_[_0xf76b('0x32')](db[_0xf76b('0x4f')][_0xf76b('0x2e')]);_0x4f560a[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x297058[_0xf76b('0x31')]);_0x4f560a[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x4f560a[_0xf76b('0x35')],_0x4f560a[_0xf76b('0x31')]);_0xe9fb63[_0xf76b('0x36')]=_[_0xf76b('0x34')](_0x4f560a['model'],qs[_0xf76b('0x37')](_0x297058[_0xf76b('0x31')][_0xf76b('0x37')]));_0xe9fb63['attributes']=_0xe9fb63['attributes']['length']?_0xe9fb63[_0xf76b('0x36')]:_0x4f560a[_0xf76b('0x35')];_0xe9fb63[_0xf76b('0x3b')]=qs[_0xf76b('0x3c')](_0x297058[_0xf76b('0x31')][_0xf76b('0x3c')]);_0xe9fb63[_0xf76b('0x3d')]=qs[_0xf76b('0x33')](_[_0xf76b('0x3e')](_0x297058[_0xf76b('0x31')],_0x4f560a[_0xf76b('0x33')]));if(_0x297058['query'][_0xf76b('0x3f')]){_0xe9fb63['where']=_[_0xf76b('0x42')](_0xe9fb63['where'],{'$or':_[_0xf76b('0x2c')](_0xe9fb63['attributes'],function(_0x4bc7f8){var _0x25fbbf={};_0x25fbbf[_0x4bc7f8]={'$like':'%'+_0x297058[_0xf76b('0x31')][_0xf76b('0x3f')]+'%'};return _0x25fbbf;})});}if(_0x297058[_0xf76b('0x31')]['$gte']){var _0x55f514=_0x297058[_0xf76b('0x31')][_0xf76b('0x5b')][_0xf76b('0x5c')](',');var _0x287556={};_0x287556[_0x55f514[0x0]]={'$gte':moment(_0x55f514[0x1])[_0xf76b('0x5d')](_0xf76b('0x5e'))};_0xe9fb63[_0xf76b('0x3d')]=_[_0xf76b('0x42')](_0xe9fb63[_0xf76b('0x3d')],_0x287556);}_0xe9fb63=_[_0xf76b('0x42')]({},_0xe9fb63,_0x297058[_0xf76b('0x43')]);return _0x11d0fe['getMessages'](_0xe9fb63);}})[_0xf76b('0x25')](function(_0xf7f90c){if(_0xf7f90c){_0x179047=_0xf7f90c['length'];if(!_0x297058['query'][_0xf76b('0x39')](_0xf76b('0x3a'))){_0xe9fb63[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x297058[_0xf76b('0x31')][_0xf76b('0x1f')]);_0xe9fb63[_0xf76b('0x1d')]=qs[_0xf76b('0x1d')](_0x297058['query']['offset']);}return _0x11d0fe[_0xf76b('0x5a')](_0xe9fb63);}})[_0xf76b('0x25')](function(_0x528fec){if(_0x528fec){return _0x528fec?{'count':_0x179047,'rows':_0x528fec}:null;}})['then'](respondWithResult(_0x193296,null))['catch'](handleError(_0x193296,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 43fa831..804becf 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 _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 +var _0xdbfd=['emit','hasOwnProperty','exports','events','../../mysqldb','update','remove'];(function(_0x10bcc4,_0x4400e2){var _0x2da988=function(_0x2ee849){while(--_0x2ee849){_0x10bcc4['push'](_0x10bcc4['shift']());}};_0x2da988(++_0x4400e2);}(_0xdbfd,0x18b));var _0xddbf=function(_0x514410,_0x4c853e){_0x514410=_0x514410-0x0;var _0x664186=_0xdbfd[_0x514410];return _0x664186;};'use strict';var EventEmitter=require(_0xddbf('0x0'));var ChatGroup=require(_0xddbf('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xddbf('0x2'),'afterDestroy':_0xddbf('0x3')};function emitEvent(_0x4f6d02){return function(_0xce0459,_0x3d7079,_0x4ba2f0){ChatGroupEvents['emit'](_0x4f6d02+':'+_0xce0459['id'],_0xce0459);ChatGroupEvents[_0xddbf('0x4')](_0x4f6d02,_0xce0459);_0x4ba2f0(null);};}for(var e in events){if(events[_0xddbf('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xddbf('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 5e5aaff..8aab583 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 _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 +var _0x3e63=['define','chat_groups','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes'];(function(_0x924691,_0x12e72e){var _0x347738=function(_0x1757d7){while(--_0x1757d7){_0x924691['push'](_0x924691['shift']());}};_0x347738(++_0x12e72e);}(_0x3e63,0x1e6));var _0x33e6=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0x3e63[_0x4fa738];return _0x55bf55;};'use strict';var _=require(_0x33e6('0x0'));var util=require(_0x33e6('0x1'));var logger=require('../../config/logger')(_0x33e6('0x2'));var moment=require(_0x33e6('0x3'));var BPromise=require(_0x33e6('0x4'));var rp=require(_0x33e6('0x5'));var fs=require('fs');var path=require(_0x33e6('0x6'));var rimraf=require('rimraf');var config=require(_0x33e6('0x7'));var attributes=require(_0x33e6('0x8'));module['exports']=function(_0x46e573,_0x17ab9b){return _0x46e573[_0x33e6('0x9')]('ChatGroup',attributes,{'tableName':_0x33e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 9b701b0..0f29740 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 _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 +var _0x0f17=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x0f17,0x8b));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70f1('0x0'));var util=require(_0x70f1('0x1'));var moment=require(_0x70f1('0x2'));var BPromise=require(_0x70f1('0x3'));var rs=require(_0x70f1('0x4'));var fs=require('fs');var Redis=require(_0x70f1('0x5'));var db=require(_0x70f1('0x6'))['db'];var utils=require(_0x70f1('0x7'));var logger=require(_0x70f1('0x8'))(_0x70f1('0x9'));var config=require(_0x70f1('0xa'));var jayson=require(_0x70f1('0xb'));var client=jayson[_0x70f1('0xc')][_0x70f1('0xd')]({'port':0x232a});config[_0x70f1('0xe')]=_[_0x70f1('0xf')](config['redis'],{'host':_0x70f1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70f1('0xe')]));require(_0x70f1('0x11'))['register'](socket);function respondWithRpcPromise(_0x261425,_0x7c8ac5,_0x3ecfbf){return new BPromise(function(_0x50cd72,_0x4274e9){return client[_0x70f1('0x12')](_0x261425,_0x3ecfbf)['then'](function(_0x23fe2c){logger[_0x70f1('0x13')](_0x70f1('0x14'),_0x7c8ac5,_0x70f1('0x15'));logger[_0x70f1('0x16')](_0x70f1('0x17'),_0x7c8ac5,_0x70f1('0x15'),JSON[_0x70f1('0x18')](_0x23fe2c));if(_0x23fe2c['error']){if(_0x23fe2c[_0x70f1('0x19')]['code']===0x1f4){logger[_0x70f1('0x19')]('ChatGroup,\x20%s,\x20%s',_0x7c8ac5,_0x23fe2c[_0x70f1('0x19')][_0x70f1('0x1a')]);return _0x4274e9(_0x23fe2c[_0x70f1('0x19')][_0x70f1('0x1a')]);}logger[_0x70f1('0x19')](_0x70f1('0x14'),_0x7c8ac5,_0x23fe2c[_0x70f1('0x19')]['message']);return _0x50cd72(_0x23fe2c[_0x70f1('0x19')]['message']);}else{logger[_0x70f1('0x13')](_0x70f1('0x14'),_0x7c8ac5,_0x70f1('0x15'));_0x50cd72(_0x23fe2c[_0x70f1('0x1b')][_0x70f1('0x1a')]);}})['catch'](function(_0x48e81a){logger[_0x70f1('0x19')](_0x70f1('0x14'),_0x7c8ac5,_0x48e81a);_0x4274e9(_0x48e81a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 318978e..ee47e76 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 _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 +var _0x5042=['remove','update','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x360076,_0x481a6f){var _0x1d593d=function(_0x3fe7bd){while(--_0x3fe7bd){_0x360076['push'](_0x360076['shift']());}};_0x1d593d(++_0x481a6f);}(_0x5042,0xa1));var _0x2504=function(_0xc4c57f,_0x2d9649){_0xc4c57f=_0xc4c57f-0x0;var _0x280f0=_0x5042[_0xc4c57f];return _0x280f0;};'use strict';var ChatGroupEvents=require(_0x2504('0x0'));var events=['save',_0x2504('0x1'),_0x2504('0x2')];function createListener(_0x338f42,_0x46afe5){return function(_0x5d418d){_0x46afe5['emit'](_0x338f42,_0x5d418d);};}function removeListener(_0x2e3597,_0x530a92){return function(){ChatGroupEvents[_0x2504('0x3')](_0x2e3597,_0x530a92);};}exports['register']=function(_0x295e63){for(var _0x419c3a=0x0,_0x4d4c71=events[_0x2504('0x4')];_0x419c3a<_0x4d4c71;_0x419c3a++){var _0x362975=events[_0x419c3a];var _0x36f07b=createListener(_0x2504('0x5')+_0x362975,_0x295e63);ChatGroupEvents['on'](_0x362975,_0x36f07b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a650e3f..f909051 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 _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 +var _0xe57e=['/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','isAuthenticated','/:id','show','/:id/unread','/:id/members','getMessages','post','create','addMembers'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xe57e,0x19d));var _0xee57=function(_0x345865,_0x37e16f){_0x345865=_0x345865-0x0;var _0x3a33c9=_0xe57e[_0x345865];return _0x3a33c9;};'use strict';var multer=require(_0xee57('0x0'));var util=require('util');var path=require(_0xee57('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee57('0x2')]();var fs_extra=require(_0xee57('0x3'));var auth=require(_0xee57('0x4'));var interaction=require(_0xee57('0x5'));var config=require(_0xee57('0x6'));var controller=require(_0xee57('0x7'));router[_0xee57('0x8')]('/',auth['isAuthenticated'](),controller[_0xee57('0x9')]);router[_0xee57('0x8')]('/describe',auth[_0xee57('0xa')](),controller['describe']);router[_0xee57('0x8')](_0xee57('0xb'),auth['isAuthenticated'](),controller[_0xee57('0xc')]);router['get'](_0xee57('0xd'),auth[_0xee57('0xa')](),controller['getUnread']);router[_0xee57('0x8')](_0xee57('0xe'),auth[_0xee57('0xa')](),controller['getMembers']);router[_0xee57('0x8')]('/:id/messages',auth[_0xee57('0xa')](),controller[_0xee57('0xf')]);router[_0xee57('0x10')]('/',auth[_0xee57('0xa')](),controller[_0xee57('0x11')]);router[_0xee57('0x10')]('/:id/members',auth[_0xee57('0xa')](),controller[_0xee57('0x12')]);router[_0xee57('0x10')](_0xee57('0x13'),auth['isAuthenticated'](),controller[_0xee57('0x14')]);router[_0xee57('0x15')](_0xee57('0xb'),auth[_0xee57('0xa')](),controller[_0xee57('0x16')]);router[_0xee57('0x17')](_0xee57('0xb'),auth['isAuthenticated'](),controller[_0xee57('0x18')]);router[_0xee57('0x17')](_0xee57('0xe'),auth[_0xee57('0xa')](),controller[_0xee57('0x19')]);module[_0xee57('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a9fea04..2d202aa 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 _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 +var _0xec31=['BOOLEAN','INTEGER','star','thumb','TEXT','STRING','long','DATE','ENUM','out','exports'];(function(_0x3cab38,_0x439e61){var _0x187d60=function(_0x285a14){while(--_0x285a14){_0x3cab38['push'](_0x3cab38['shift']());}};_0x187d60(++_0x439e61);}(_0xec31,0x196));var _0x1ec3=function(_0x1fe7e4,_0x5d39a4){_0x1fe7e4=_0x1fe7e4-0x0;var _0x4b3e54=_0xec31[_0x1fe7e4];return _0x4b3e54;};'use strict';var Sequelize=require('sequelize');module[_0x1ec3('0x0')]={'closed':{'type':Sequelize[_0x1ec3('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1ec3('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1ec3('0x3'),_0x1ec3('0x4')),'defaultValue':_0x1ec3('0x3')},'ratingMessage':{'type':Sequelize[_0x1ec3('0x5')]},'pathTranscript':{'type':Sequelize[_0x1ec3('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1ec3('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1ec3('0x6')]},'note':{'type':Sequelize[_0x1ec3('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1ec3('0x6')]},'osName':{'type':Sequelize[_0x1ec3('0x6')]},'osVersion':{'type':Sequelize[_0x1ec3('0x6')]},'deviceModel':{'type':Sequelize[_0x1ec3('0x6')]},'deviceVendor':{'type':Sequelize[_0x1ec3('0x6')]},'deviceType':{'type':Sequelize[_0x1ec3('0x6')]},'referer':{'type':Sequelize[_0x1ec3('0x5')]},'customerIp':{'type':Sequelize[_0x1ec3('0x6')]},'formData':{'type':Sequelize[_0x1ec3('0x5')](_0x1ec3('0x7'))},'read1stAt':{'type':Sequelize[_0x1ec3('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1ec3('0x9')]('in',_0x1ec3('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1ec3('0x6')]},'customerPort':{'type':Sequelize[_0x1ec3('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1ec3('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x1ec3('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 608fc90..9f38b53 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 _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 +var _0x2ff7=['[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','push','rows','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','tmp','attachments','transcript-%d-%s.zip','Contact','lastName','read','Owner','mkdirSync','Chat','Account','N.A.','closedAt','disposition','browserName','osName','customerPort','tail','existsSync','pipe','createWriteStream','firstName','value','server','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','sendStatus','rimraf','request-promise','moment','bluebird','mustache','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','status','offset','undefined','limit','count','end','stack','name','send','merge','body','contact','agent','interaction','account','map','ChatInteraction','fieldName','key','findAll','query','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','update','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','entity\x20not\x20found','UserId','closed','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','type','mimetype','Attachment','json','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','User','ContactId','%s%d','System','customer','agentIdentifier','agent_alias','alias','agent_fullname','agentAlias'];(function(_0xb6db7d,_0xd781c7){var _0x37923b=function(_0x42eb46){while(--_0x42eb46){_0xb6db7d['push'](_0xb6db7d['shift']());}};_0x37923b(++_0xd781c7);}(_0x2ff7,0x1dd));var _0x72ff=function(_0xe66942,_0x3e74b9){_0xe66942=_0xe66942-0x0;var _0x5efbda=_0x2ff7[_0xe66942];return _0x5efbda;};'use strict';var rimraf=require(_0x72ff('0x0'));var zipdir=require('zip-dir');var rp=require(_0x72ff('0x1'));var moment=require(_0x72ff('0x2'));var BPromise=require(_0x72ff('0x3'));var Mustache=require(_0x72ff('0x4'));var util=require('util');var path=require(_0x72ff('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x72ff('0x6'));var Redis=require(_0x72ff('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x72ff('0x8'));var pdf=require(_0x72ff('0x9'));var logger=require(_0x72ff('0xa'))(_0x72ff('0xb'));var config=require(_0x72ff('0xc'));var db=require('../../mysqldb')['db'];config[_0x72ff('0xd')]=_['defaults'](config[_0x72ff('0xd')],{'host':_0x72ff('0xe'),'port':0x18eb});var socket=require(_0x72ff('0xf'))(new Redis(config[_0x72ff('0xd')]));require(_0x72ff('0x10'))['register'](socket);var jayson=require(_0x72ff('0x11'));var client=jayson[_0x72ff('0x12')]['http']({'port':0x232b});var client9004=jayson[_0x72ff('0x12')][_0x72ff('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x1c5d40,_0xe6679,_0xd88cdd,_0x2a1b38){return new BPromise(function(_0x37b05d,_0x480559){var _0x4c7783=_0x2a1b38||client;return _0x4c7783[_0x72ff('0x14')](_0x1c5d40,_0xd88cdd)[_0x72ff('0x15')](function(_0x7cc3e5){logger[_0x72ff('0x16')](_0x72ff('0x17'),_0xe6679,_0x72ff('0x18'));logger[_0x72ff('0x19')](_0x72ff('0x1a'),_0xe6679,_0x72ff('0x18'),JSON['stringify'](_0x7cc3e5));if(_0x7cc3e5[_0x72ff('0x1b')]){if(_0x7cc3e5[_0x72ff('0x1b')]['code']===0x1f4){logger['error'](_0x72ff('0x17'),_0xe6679,_0x7cc3e5[_0x72ff('0x1b')][_0x72ff('0x1c')]);return _0x480559(_0x7cc3e5['error'][_0x72ff('0x1c')]);}logger['error'](_0x72ff('0x17'),_0xe6679,_0x7cc3e5[_0x72ff('0x1b')][_0x72ff('0x1c')]);return _0x37b05d(_0x7cc3e5[_0x72ff('0x1b')][_0x72ff('0x1c')]);}else{logger[_0x72ff('0x16')](_0x72ff('0x17'),_0xe6679,_0x72ff('0x18'));_0x37b05d(_0x7cc3e5['result'][_0x72ff('0x1c')]);}})[_0x72ff('0x1d')](function(_0x4f00fb){logger[_0x72ff('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0xe6679,_0x4f00fb);_0x480559(_0x4f00fb);});});}function respondWithStatusCode(_0x2ce1c2,_0x42b59a){_0x42b59a=_0x42b59a||0xcc;return function(_0x4f9bfe){if(_0x4f9bfe){return _0x2ce1c2['sendStatus'](_0x42b59a);}return _0x2ce1c2[_0x72ff('0x1e')](_0x42b59a)['end']();};}function respondWithResult(_0x45392c,_0x567ceb){_0x567ceb=_0x567ceb||0xc8;return function(_0x557140){if(_0x557140){return _0x45392c['status'](_0x567ceb)['json'](_0x557140);}};}function respondWithFilteredResult(_0x3bce10,_0x20f904){return function(_0x397719){if(_0x397719){var _0x48e92a=typeof _0x20f904[_0x72ff('0x1f')]===_0x72ff('0x20')&&typeof _0x20f904[_0x72ff('0x21')]===_0x72ff('0x20');var _0x365c56=_0x397719[_0x72ff('0x22')];var _0x24ae90=_0x48e92a?0x0:_0x20f904[_0x72ff('0x1f')];var _0x3aaf40=_0x48e92a?_0x397719[_0x72ff('0x22')]:_0x20f904[_0x72ff('0x1f')]+_0x20f904[_0x72ff('0x21')];var _0x3f6fab;if(_0x3aaf40>=_0x365c56){_0x3aaf40=_0x365c56;_0x3f6fab=0xc8;}else{_0x3f6fab=0xce;}_0x3bce10[_0x72ff('0x1e')](_0x3f6fab);return _0x3bce10['set']('Content-Range',_0x24ae90+'-'+_0x3aaf40+'/'+_0x365c56)['json'](_0x397719);}return null;};}function saveUpdates(_0x3042f6){return function(_0x25bbc2){if(_0x25bbc2){return _0x25bbc2['update'](_0x3042f6)[_0x72ff('0x15')](function(_0xd918d3){return _0xd918d3;});}return null;};}function removeEntity(_0x261e11){return function(_0xfe2165){if(_0xfe2165){return _0xfe2165['destroy']()[_0x72ff('0x15')](function(){_0x261e11['status'](0xcc)[_0x72ff('0x23')]();});}};}function handleEntityNotFound(_0x4ce6e6){return function(_0x45d073){if(!_0x45d073){_0x4ce6e6['sendStatus'](0x194);}return _0x45d073;};}function handleError(_0x18174f,_0x48af7e){_0x48af7e=_0x48af7e||0x1f4;return function(_0x8264ee){logger[_0x72ff('0x1b')](_0x8264ee[_0x72ff('0x24')]);if(_0x8264ee[_0x72ff('0x25')]){delete _0x8264ee[_0x72ff('0x25')];}_0x18174f[_0x72ff('0x1e')](_0x48af7e)[_0x72ff('0x26')](_0x8264ee);};}function getMustacheRender(_0x158314,_0x53f0b1){return Mustache['render'](_0x158314,_[_0x72ff('0x27')](_0x53f0b1[_0x72ff('0x28')],{'contact':_0x53f0b1[_0x72ff('0x29')],'message':_0x53f0b1[_0x72ff('0x1c')],'agent':_0x53f0b1[_0x72ff('0x2a')],'interaction':_0x53f0b1[_0x72ff('0x2b')],'account':_0x53f0b1[_0x72ff('0x2c')]}))||'';}exports['index']=function(_0x627c9,_0x3a2d25){var _0xa562d5={};var _0x2ce777=_[_0x72ff('0x2d')](db[_0x72ff('0x2e')]['rawAttributes'],function(_0x4161e3){return{'name':_0x4161e3[_0x72ff('0x2f')],'type':_0x4161e3['type'][_0x72ff('0x30')]};});_0xa562d5=qs['getOptions'](_0x2ce777,_0x627c9);return interaction[_0x72ff('0x31')]('chat',_0x627c9[_0x72ff('0x32')],_0x627c9['user'],_0xa562d5,_0x2ce777)[_0x72ff('0x15')](respondWithFilteredResult(_0x3a2d25,_0xa562d5))[_0x72ff('0x1d')](handleError(_0x3a2d25,null));};exports['show']=function(_0x31f4f5,_0x3dbda7){var _0x404a93={'raw':![],'where':{'id':_0x31f4f5[_0x72ff('0x33')]['id']}},_0x70eaee={};_0x70eaee[_0x72ff('0x34')]=_[_0x72ff('0x35')](db[_0x72ff('0x2e')][_0x72ff('0x36')]);_0x70eaee[_0x72ff('0x32')]=_['keys'](_0x31f4f5[_0x72ff('0x32')]);_0x70eaee[_0x72ff('0x37')]=_[_0x72ff('0x38')](_0x70eaee['model'],_0x70eaee[_0x72ff('0x32')]);_0x404a93['attributes']=_[_0x72ff('0x38')](_0x70eaee[_0x72ff('0x34')],qs[_0x72ff('0x39')](_0x31f4f5[_0x72ff('0x32')][_0x72ff('0x39')]));_0x404a93[_0x72ff('0x3a')]=_0x404a93[_0x72ff('0x3a')][_0x72ff('0x3b')]?_0x404a93[_0x72ff('0x3a')]:_0x70eaee['model'];if(_0x31f4f5[_0x72ff('0x32')][_0x72ff('0x3c')]){_0x404a93[_0x72ff('0x3d')]=[{'all':!![]}];}_0x404a93=_[_0x72ff('0x27')]({},_0x404a93,_0x31f4f5[_0x72ff('0x3e')]);return db['ChatInteraction'][_0x72ff('0x3f')](_0x404a93)[_0x72ff('0x15')](handleEntityNotFound(_0x3dbda7,null))[_0x72ff('0x15')](respondWithResult(_0x3dbda7,null))[_0x72ff('0x1d')](handleError(_0x3dbda7,null));};exports[_0x72ff('0x40')]=function(_0x190763,_0x381304){return db[_0x72ff('0x2e')][_0x72ff('0x40')](_0x190763['body'],{})[_0x72ff('0x15')](respondWithResult(_0x381304,0xc9))[_0x72ff('0x1d')](handleError(_0x381304,null));};exports[_0x72ff('0x41')]=function(_0x137e2a,_0x1c0d38){if(_0x137e2a['body']['id']){delete _0x137e2a[_0x72ff('0x28')]['id'];}return db['ChatInteraction'][_0x72ff('0x3f')]({'where':{'id':_0x137e2a[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x1c0d38,null))['then'](saveUpdates(_0x137e2a[_0x72ff('0x28')],null))['then'](respondWithResult(_0x1c0d38,null))[_0x72ff('0x1d')](handleError(_0x1c0d38,null));};exports[_0x72ff('0x42')]=function(_0x31064d,_0x12b10a){return db['ChatInteraction']['find']({'where':{'id':_0x31064d[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x12b10a,null))[_0x72ff('0x15')](removeEntity(_0x12b10a,null))[_0x72ff('0x1d')](handleError(_0x12b10a,null));};exports[_0x72ff('0x43')]=function(_0x3746d9,_0x5c32e3){return db['ChatInteraction']['describe']()[_0x72ff('0x15')](respondWithResult(_0x5c32e3,null))[_0x72ff('0x1d')](handleError(_0x5c32e3,null));};exports[_0x72ff('0x44')]=function(_0x5c100b,_0x4e1da3){var _0x5c2e5c=_0x5c100b['params']['id'];var _0x337a19;var _0x31172c;var _0x59a45e;return db[_0x72ff('0x2e')][_0x72ff('0x45')]({'where':{'id':_0x5c2e5c}})[_0x72ff('0x15')](function(_0x5eb341){_0x337a19=_0x5eb341;return db[_0x72ff('0x46')]['findOne']({'where':{'id':_0x5eb341[_0x72ff('0x47')]},'attributes':['id',_0x72ff('0x48'),_0x72ff('0x49'),_0x72ff('0x4a'),_0x72ff('0x4b'),_0x72ff('0x4c')],'raw':!![]});})[_0x72ff('0x15')](function(_0x57e619){if(_0x57e619&&_0x57e619['vidaooApiKey']&&_0x57e619[_0x72ff('0x49')]){_0x31172c=_0x57e619;var _0x5ab291={'interaction':{'id':_0x5c2e5c},'agent':{'id':_0x5c100b[_0x72ff('0x4d')]['id'],'name':_0x5c100b[_0x72ff('0x4d')][_0x72ff('0x25')],'fullname':_0x5c100b[_0x72ff('0x4d')][_0x72ff('0x4e')],'email':_0x5c100b[_0x72ff('0x4d')]['email']},'contact':_0x5c100b['body'][_0x72ff('0x29')],'account':_0x5c100b[_0x72ff('0x28')][_0x72ff('0x2c')]};var _0x3399a7={'rejectUnauthorized':![],'method':'POST','url':_0x72ff('0x4f'),'headers':{'X-APIKEY':_0x57e619[_0x72ff('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5c100b['user'][_0x72ff('0x50')]],'buttons':null,'topic':_0x31172c['vidaooTopic'],'note':_[_0x72ff('0x51')](_0x31172c[_0x72ff('0x4b')])?null:getMustacheRender(_0x31172c[_0x72ff('0x4b')],_0x5ab291),'metadata':null},'redirect':_0x72ff('0x52'),'json':!![]};try{if(!_[_0x72ff('0x51')](_0x31172c[_0x72ff('0x4c')])){var _0x2640d5=getMustacheRender(_0x31172c[_0x72ff('0x4c')],_0x5ab291);var _0x58db4c=JSON[_0x72ff('0x53')](_0x2640d5);_0x3399a7[_0x72ff('0x28')]['metadata']=_0x58db4c;}}catch(_0x2753d5){throw new db[(_0x72ff('0x54'))][(_0x72ff('0x55'))](_0x72ff('0x56'));}return rp(_0x3399a7);}else{throw new db['Sequelize']['ValidationError'](_0x72ff('0x57'));}})[_0x72ff('0x15')](function(_0x587f23){_0x59a45e=_0x587f23;if(_0x59a45e['id']){var _0x2924cb={'body':_0x59a45e[_0x72ff('0x58')],'ChatWebsiteId':_0x31172c['id'],'ChatInteractionId':_0x337a19['id'],'direction':_0x72ff('0x59'),'UserId':_0x5c100b[_0x72ff('0x4d')]['id']};return db['ChatMessage'][_0x72ff('0x40')](_0x2924cb,{});}else{throw new db[(_0x72ff('0x54'))][(_0x72ff('0x55'))](_0x72ff('0x5a'));}})[_0x72ff('0x15')](function(){return _0x337a19[_0x72ff('0x5b')]({'vidaooSessionId':_0x59a45e['id']});})['then'](respondWithResult(_0x4e1da3,null))[_0x72ff('0x1d')](handleError(_0x4e1da3,null));};exports[_0x72ff('0x5c')]=function(_0x2c8656,_0x2b83a7){if(_0x2c8656['body']['id']){delete _0x2c8656[_0x72ff('0x28')]['id'];}return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x2c8656[_0x72ff('0x33')]['id']},'include':[{'model':db[_0x72ff('0x5d')],'as':'Contact'}]})[_0x72ff('0x15')](handleEntityNotFound(_0x2b83a7,null))[_0x72ff('0x15')](saveUpdates(_0x2c8656[_0x72ff('0x28')],null))['then'](respondWithResult(_0x2b83a7,null))[_0x72ff('0x1d')](handleError(_0x2b83a7,null));};exports['abandon']=function(_0x1cf398,_0x783b07){if(_0x1cf398[_0x72ff('0x28')]['id']){delete _0x1cf398[_0x72ff('0x28')]['id'];}return db[_0x72ff('0x2e')]['find']({'where':{'id':_0x1cf398['params']['id']}})[_0x72ff('0x15')](function(_0x3a1a51){if(!_0x3a1a51){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x72ff('0x5e'));_0x783b07['sendStatus'](0x194);}else{if(_0x3a1a51[_0x72ff('0x5f')]){throw new db[(_0x72ff('0x54'))][(_0x72ff('0x55'))]('Interaction\x20already\x20assigned');}}return _0x3a1a51;})['then'](function(_0x3b3e55){if(_0x3b3e55){return _0x3b3e55['update']({'closed':_0x1cf398[_0x72ff('0x28')][_0x72ff('0x60')],'disposition':_0x1cf398[_0x72ff('0x28')]['disposition']})[_0x72ff('0x15')](function(_0x32ccf1){return _0x32ccf1;});}})[_0x72ff('0x15')](function(){return respondWithRpcPromise(_0x72ff('0x61'),_0x72ff('0x62'),_0x1cf398[_0x72ff('0x28')],client9004);})['then'](respondWithResult(_0x783b07,null))[_0x72ff('0x1d')](handleError(_0x783b07,null));};exports[_0x72ff('0x63')]=function(_0x1591f9,_0x45d20f){_0x1591f9[_0x72ff('0x28')]['name']=_0x1591f9[_0x72ff('0x64')][_0x72ff('0x65')];_0x1591f9['body'][_0x72ff('0x66')]=_0x1591f9[_0x72ff('0x64')][_0x72ff('0x67')];_0x1591f9[_0x72ff('0x28')][_0x72ff('0x68')]=_0x1591f9['file'][_0x72ff('0x69')];return db[_0x72ff('0x6a')]['create'](_0x1591f9['body'])[_0x72ff('0x15')](respondWithResult(_0x45d20f,0xc9))[_0x72ff('0x1d')](handleError(_0x45d20f,null));};exports['attachmentDownload']=function(_0x2be2d1,_0x26d1b2){return db[_0x72ff('0x2e')][_0x72ff('0x45')]({'where':{'id':_0x2be2d1['params']['id']},'raw':!![]})[_0x72ff('0x15')](handleEntityNotFound(_0x26d1b2,null))[_0x72ff('0x15')](function(_0x401a45){if(_0x401a45){if(_0x401a45[_0x72ff('0x60')]){return _0x26d1b2[_0x72ff('0x1e')](0x193)[_0x72ff('0x6b')]({'status':0x193,'message':_0x72ff('0x6c')});}return db['Attachment'][_0x72ff('0x45')]({'where':{'id':_0x2be2d1[_0x72ff('0x32')]['attachId']},'raw':!![]})[_0x72ff('0x15')](handleEntityNotFound(_0x26d1b2,null));}})[_0x72ff('0x15')](function(_0x2a6441){if(_0x2a6441){var _0x553bcc=_0x2a6441[_0x72ff('0x6d')]!==null;var _0x486c8f=path['join'](config[_0x72ff('0x6e')],_0x72ff('0x6f'));if(_0x553bcc){_0x486c8f=path[_0x72ff('0x70')](_0x486c8f,'offline-chat/');}var _0xff5021=path[_0x72ff('0x70')](_0x486c8f,_0x2a6441['basename']);return _0x26d1b2[_0x72ff('0x71')](_0xff5021);}})['catch'](handleError(_0x26d1b2,null));};exports[_0x72ff('0x72')]=function(_0x595bae,_0x21c1ad){var _0x3e26a1=null;var _0x4648d1=null;var _0x2a5e6b=null;if(_0x595bae[_0x72ff('0x28')]['id']){delete _0x595bae[_0x72ff('0x28')]['id'];}if(_0x595bae['body'][_0x72ff('0x73')]){_0x2a5e6b=path[_0x72ff('0x70')](config[_0x72ff('0x6e')],_0x72ff('0x74'),util[_0x72ff('0x75')](_0x72ff('0x76'),Date[_0x72ff('0x77')]()));_0x595bae[_0x72ff('0x28')]['pathTranscript']=_0x2a5e6b;}return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x595bae[_0x72ff('0x33')]['id']},'include':[{'model':db[_0x72ff('0x78')],'as':_0x72ff('0x79'),'include':[{'model':db[_0x72ff('0x7a')],'as':_0x72ff('0x7a')}]}]})['then'](handleEntityNotFound(_0x21c1ad,null))[_0x72ff('0x15')](saveUpdates(_0x595bae[_0x72ff('0x28')],null))[_0x72ff('0x15')](function(_0xf004fc){if(_0xf004fc){_0x3e26a1=_0xf004fc;return db[_0x72ff('0x46')][_0x72ff('0x3f')]({'where':{'id':_0x3e26a1[_0x72ff('0x47')]}});}})['then'](function(_0x542711){if(_0x542711){_0x4648d1=_0x542711;return db[_0x72ff('0x5d')][_0x72ff('0x3f')]({'where':{'id':_0x3e26a1[_0x72ff('0x7b')]}});}})[_0x72ff('0x15')](function(_0xeaf379){if(_0xeaf379){if(_0x2a5e6b){var _0x369cfb=null;for(var _0x48e0dc=0x1;_0x48e0dc<_0x3e26a1[_0x72ff('0x79')]['length'];++_0x48e0dc){_0x369cfb=_0x3e26a1[_0x72ff('0x79')][_0x48e0dc];var _0xe11c4b=_0x369cfb['UserId']?util[_0x72ff('0x75')](_0x72ff('0x7c'),_0x4648d1['agentAlias'],_0x369cfb['UserId']):_0x72ff('0x7d');var _0x4a36f8=_0x595bae[_0x72ff('0x28')][_0x72ff('0x7e')]||util[_0x72ff('0x75')](_0x72ff('0x7c'),'Visitor',_0x369cfb[_0x72ff('0x7b')]);switch(_0x4648d1[_0x72ff('0x7f')]){case'website_alias':_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?util[_0x72ff('0x75')]('%s%d',_0x4648d1['agentAlias'],_0x369cfb[_0x72ff('0x5f')]):_0x72ff('0x7d');break;case _0x72ff('0x80'):_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?_0x369cfb['User'][_0x72ff('0x81')]||_0x369cfb[_0x72ff('0x7a')][_0x72ff('0x4e')]:_0x72ff('0x7d');break;case _0x72ff('0x82'):_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?_0x369cfb[_0x72ff('0x7a')][_0x72ff('0x4e')]:_0x72ff('0x7d');break;default:_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?util[_0x72ff('0x75')]('%s%d',_0x4648d1[_0x72ff('0x83')],_0x369cfb[_0x72ff('0x5f')]):_0x72ff('0x7d');}var _0x20ac21=util[_0x72ff('0x75')](_0x72ff('0x84'),moment(_0x369cfb[_0x72ff('0x85')])[_0x72ff('0x75')](_0x72ff('0x86')),_0x369cfb[_0x72ff('0x87')]==='in'?_0x4a36f8:_0xe11c4b,_0x369cfb['body']);if(!_0x369cfb[_0x72ff('0x88')]){fs[_0x72ff('0x89')](_0x2a5e6b,_0x20ac21);}}return db[_0x72ff('0x8a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x72ff('0x8b')],'as':_0x72ff('0x8c'),'raw':!![],'include':[{'model':db[_0x72ff('0x8d')],'as':_0x72ff('0x8d'),'raw':!![]}]}]});}}})[_0x72ff('0x15')](function(_0x348ca2){if(!_0x348ca2||!_0x348ca2[_0x72ff('0x8c')]||!_0x595bae[_0x72ff('0x28')])return _0x3e26a1;var _0xb5a900=_0x348ca2['getSmtpOptions']();return respondWithRpcPromise(_0x72ff('0x8e'),_0x72ff('0x8f'),{'account':_0xb5a900,'message':{'from':util[_0x72ff('0x75')](_0x72ff('0x90'),_0x348ca2[_0x72ff('0x25')],_0x348ca2[_0x72ff('0x50')]||_0x348ca2[_0x72ff('0x8c')][_0x72ff('0x4d')]),'to':_0x595bae['body'][_0x72ff('0x73')],'subject':'Mail\x20Transcript','text':util[_0x72ff('0x75')](_0x72ff('0x91'),_0x595bae['body'][_0x72ff('0x73')]),'attachments':[{'path':_0x2a5e6b}]}})[_0x72ff('0x15')](function(){return _0x3e26a1;})[_0x72ff('0x1d')](function(_0x141054){logger['error'](_0x141054);});})[_0x72ff('0x15')](respondWithStatusCode(_0x21c1ad,0xc8))[_0x72ff('0x1d')](handleError(_0x21c1ad,null));};exports['addMessage']=function(_0x2ddc11,_0x30063b){return db['ChatMessage'][_0x72ff('0x3f')]({'where':{'id':_0x2ddc11[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x30063b,null))[_0x72ff('0x15')](function(_0x42a6f6){if(_0x42a6f6){return _0x42a6f6[_0x72ff('0x92')](_0x2ddc11[_0x72ff('0x28')][_0x72ff('0x93')],_[_0x72ff('0x94')](_0x2ddc11[_0x72ff('0x28')],[_0x72ff('0x93'),'id'])||{});}})['then'](respondWithResult(_0x30063b,null))[_0x72ff('0x1d')](handleError(_0x30063b,null));};exports[_0x72ff('0x95')]=function(_0x1e3b98,_0x46eec9){var _0x10eb80={'raw':![],'where':{}};var _0x4b0462={};var _0x4c240b={'count':0x0,'rows':[]};return db[_0x72ff('0x2e')]['findOne']({'where':{'id':_0x1e3b98[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x46eec9,null))['then'](function(_0x131e77){if(_0x131e77){_0x4b0462[_0x72ff('0x34')]=_[_0x72ff('0x35')](db[_0x72ff('0x78')][_0x72ff('0x36')]);_0x4b0462[_0x72ff('0x32')]=_[_0x72ff('0x35')](_0x1e3b98[_0x72ff('0x32')]);_0x4b0462[_0x72ff('0x37')]=_['intersection'](_0x4b0462[_0x72ff('0x34')],_0x4b0462[_0x72ff('0x32')]);_0x10eb80[_0x72ff('0x3a')]=_[_0x72ff('0x38')](_0x4b0462['model'],qs[_0x72ff('0x39')](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x39')]));_0x10eb80['attributes']=_0x10eb80[_0x72ff('0x3a')][_0x72ff('0x3b')]?_0x10eb80[_0x72ff('0x3a')]:_0x4b0462[_0x72ff('0x34')];if(!_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x96')](_0x72ff('0x97'))){_0x10eb80['limit']=qs[_0x72ff('0x21')](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x21')]);_0x10eb80[_0x72ff('0x1f')]=qs['offset'](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x1f')]);}_0x10eb80[_0x72ff('0x98')]=qs[_0x72ff('0x99')](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x99')]);_0x10eb80[_0x72ff('0x9a')]=qs['filters'](_[_0x72ff('0x9b')](_0x1e3b98[_0x72ff('0x32')],_0x4b0462[_0x72ff('0x37')]));_0x10eb80[_0x72ff('0x9a')][_0x72ff('0x9c')]=_0x131e77['id'];if(_0x1e3b98['query'][_0x72ff('0x9d')]){_0x10eb80[_0x72ff('0x9a')]=_[_0x72ff('0x27')](_0x10eb80[_0x72ff('0x9a')],{'$or':_[_0x72ff('0x2d')](_0x10eb80[_0x72ff('0x3a')],function(_0x107441){var _0x4654f6={};_0x4654f6[_0x107441]={'$like':'%'+_0x1e3b98[_0x72ff('0x32')]['filter']+'%'};return _0x4654f6;})});}if(_0x1e3b98[_0x72ff('0x32')]['$gte']){var _0x2102af=_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x9e')]['split'](',');var _0x298a6b={};_0x298a6b[_0x2102af[0x0]]={'$gte':moment(_0x2102af[0x1])['format'](_0x72ff('0x9f'))};_0x10eb80[_0x72ff('0x9a')]=_[_0x72ff('0x27')](_0x10eb80[_0x72ff('0x9a')],_0x298a6b);}_0x10eb80=_[_0x72ff('0x27')]({},_0x10eb80,_0x1e3b98[_0x72ff('0x3e')]);return db[_0x72ff('0x78')][_0x72ff('0x22')]({'where':_0x10eb80[_0x72ff('0x9a')]})[_0x72ff('0x15')](function(_0x144aab){_0x4c240b[_0x72ff('0x22')]=_0x144aab;if(_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x3c')]){_0x10eb80[_0x72ff('0x3d')]=[{'all':!![]}];}return db['ChatMessage'][_0x72ff('0x31')](_0x10eb80);})[_0x72ff('0x15')](function(_0x4ddab4){_0x4c240b['rows']=_0x4ddab4;return _0x4c240b;});}})[_0x72ff('0x15')](respondWithFilteredResult(_0x46eec9,_0x10eb80))['catch'](handleError(_0x46eec9,null));};exports[_0x72ff('0xa0')]=function(_0x3094f6,_0x3d090f){var _0x4c7b20={'where':{}},_0xc0ead5={},_0x26d55b={'count':0x0,'rows':[]};return db[_0x72ff('0x2e')][_0x72ff('0x45')]({'where':{'id':_0x3094f6[_0x72ff('0x33')]['id']}})['then'](handleEntityNotFound(_0x3d090f,null))['then'](function(_0x5b8b88){if(_0x5b8b88){_0xc0ead5['model']=_[_0x72ff('0x35')](db[_0x72ff('0x78')][_0x72ff('0x36')]);_0xc0ead5['query']=_['keys'](_0x3094f6['query']);_0xc0ead5[_0x72ff('0x37')]=_[_0x72ff('0x38')](_0xc0ead5[_0x72ff('0x34')],_0xc0ead5[_0x72ff('0x32')]);_0x4c7b20[_0x72ff('0x3a')]=_[_0x72ff('0x38')](_0xc0ead5[_0x72ff('0x34')],qs[_0x72ff('0x39')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x39')]));_0x4c7b20['attributes']=_0x4c7b20['attributes'][_0x72ff('0x3b')]?_0x4c7b20[_0x72ff('0x3a')]:_0xc0ead5[_0x72ff('0x34')];if(!_0x3094f6[_0x72ff('0x32')][_0x72ff('0x96')](_0x72ff('0x97'))){_0x4c7b20[_0x72ff('0x21')]=qs[_0x72ff('0x21')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x21')]);_0x4c7b20['offset']=qs[_0x72ff('0x1f')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x1f')]);}_0x4c7b20[_0x72ff('0x98')]=qs[_0x72ff('0x99')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x99')]);_0x4c7b20[_0x72ff('0x9a')]=qs['filters'](_['pick'](_0x3094f6[_0x72ff('0x32')],_0xc0ead5[_0x72ff('0x37')]));_0x4c7b20[_0x72ff('0x9a')]['ChatInteractionId']=_0x5b8b88['id'];if(_0x3094f6['query'][_0x72ff('0x9d')]){_0x4c7b20[_0x72ff('0x9a')]=_[_0x72ff('0x27')](_0x4c7b20[_0x72ff('0x9a')],{'$or':_[_0x72ff('0x2d')](_0x4c7b20[_0x72ff('0x3a')],function(_0xf825ff){var _0x9acbf0={};_0x9acbf0[_0xf825ff]={'$like':'%'+_0x3094f6[_0x72ff('0x32')][_0x72ff('0x9d')]+'%'};return _0x9acbf0;})});}_0x4c7b20['where'][_0x72ff('0x88')]=![];if(_0x3094f6['query']['id']){_0x4c7b20['where']['id']={'$gt':_0x3094f6[_0x72ff('0x32')]['id']};}_0x4c7b20=_['merge']({},_0x4c7b20,_0x3094f6[_0x72ff('0x3e')]);return db['ChatMessage']['count']({'where':_0x4c7b20[_0x72ff('0x9a')]})[_0x72ff('0x15')](function(_0x165729){_0x26d55b[_0x72ff('0x22')]=_0x165729;_0x4c7b20[_0x72ff('0x3d')]=[];if(_0x3094f6[_0x72ff('0x32')][_0x72ff('0xa1')]){_0x4c7b20[_0x72ff('0x3d')][_0x72ff('0xa2')]({'model':db[_0x72ff('0x7a')],'as':'User','attributes':['id',_0x72ff('0x4e'),_0x72ff('0x81')]});}if(_0x3094f6[_0x72ff('0x32')]['includeAll']){_0x4c7b20[_0x72ff('0x3d')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4c7b20);})[_0x72ff('0x15')](function(_0x3c0c66){_0x26d55b[_0x72ff('0xa3')]=_0x3c0c66;return _0x26d55b;});}})[_0x72ff('0x15')](respondWithFilteredResult(_0x3d090f,_0x4c7b20))[_0x72ff('0x1d')](handleError(_0x3d090f,null));};exports[_0x72ff('0xa4')]=function(_0x36c8bc,_0x2a1622){return db[_0x72ff('0x2e')]['find']({'where':{'id':_0x36c8bc['params']['id']}})['then'](handleEntityNotFound(_0x2a1622,null))[_0x72ff('0x15')](function(_0x18e597){if(_0x18e597){return _0x18e597[_0x72ff('0xa5')](_0x36c8bc['body'][_0x72ff('0x93')],_[_0x72ff('0x94')](_0x36c8bc['body'],['ids','id'])||{})[_0x72ff('0xa6')](function(){return db['Tag'][_0x72ff('0x31')]({'attributes':['id',_0x72ff('0x25'),_0x72ff('0xa7')],'where':{'id':_0x36c8bc[_0x72ff('0x28')][_0x72ff('0x93')]}});})[_0x72ff('0x15')](function(_0x1401c5){socket[_0x72ff('0xa8')](_0x72ff('0xa9'),{'id':Number(_0x36c8bc['params']['id']),'tags':_0x1401c5||[]});return{'id':Number(_0x36c8bc[_0x72ff('0x33')]['id']),'tags':_0x1401c5||[]};});}})[_0x72ff('0x15')](respondWithResult(_0x2a1622,null))[_0x72ff('0x1d')](handleError(_0x2a1622,null));};exports[_0x72ff('0xaa')]=function(_0x57bc6c,_0x2b8cf7){return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x57bc6c[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x2b8cf7,null))[_0x72ff('0x15')](function(_0x46553b){if(_0x46553b){return _0x46553b[_0x72ff('0xaa')](_0x57bc6c[_0x72ff('0x32')][_0x72ff('0x93')]);}})[_0x72ff('0x15')](respondWithStatusCode(_0x2b8cf7,null))[_0x72ff('0x1d')](handleError(_0x2b8cf7,null));};exports[_0x72ff('0x71')]=function(_0x7f9c20,_0x4f1023){var _0x407aba=moment()[_0x72ff('0xab')]()[_0x72ff('0xac')]();var _0x1cc839=path[_0x72ff('0x70')](config['root'],'server',_0x72ff('0xad'),_0x72ff('0xae'));var _0x56f288=path['join'](config[_0x72ff('0x6e')],'server',_0x72ff('0xad'),_0x72ff('0xaf'));var _0x2e7de0=path[_0x72ff('0x70')](_0x1cc839,_0x407aba);var _0x327da5=util[_0x72ff('0x75')](_0x72ff('0xb0'),_0x7f9c20[_0x72ff('0x33')]['id'],_0x407aba);var _0x3dce98=path['join'](_0x1cc839,_0x327da5);var _0x7c008a=[];_0x7c008a[_0x72ff('0xa2')]({'model':db[_0x72ff('0x7a')],'as':_0x72ff('0x7a'),'attributes':['id',_0x72ff('0x4e')],'raw':!![]});_0x7c008a[_0x72ff('0xa2')]({'model':db[_0x72ff('0x5d')],'as':_0x72ff('0xb1'),'attributes':['id','firstName',_0x72ff('0xb2')],'raw':!![]});if(_0x7f9c20[_0x72ff('0x32')][_0x72ff('0xaf')]){_0x7c008a[_0x72ff('0xa2')]({'model':db[_0x72ff('0x6a')],'as':'Attachment','raw':!![]});}var _0x11637b=[{'model':db[_0x72ff('0x78')],'as':_0x72ff('0x79'),'attributes':['id',_0x72ff('0x28'),_0x72ff('0x85'),_0x72ff('0x87'),_0x72ff('0x88'),_0x72ff('0xb3')],'include':_0x7c008a}];_0x11637b[_0x72ff('0xa2')]({'model':db[_0x72ff('0x46')],'as':'Account','attributes':['id',_0x72ff('0x25')]});_0x11637b[_0x72ff('0xa2')]({'model':db[_0x72ff('0x7a')],'as':_0x72ff('0xb4'),'attributes':['id',_0x72ff('0x4e')]});return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x7f9c20['params']['id']},'include':_0x11637b})[_0x72ff('0x15')](handleEntityNotFound(_0x4f1023,null))[_0x72ff('0x15')](function(_0x50839d){if(_0x50839d){var _0x496de9=_0x50839d['get']({'plain':!![]});fs[_0x72ff('0xb5')](_0x2e7de0);var _0x4d9dc5={'channel':_0x72ff('0xb6'),'account':_0x496de9[_0x72ff('0xb7')]['name'],'agent':_0x496de9[_0x72ff('0xb4')]?_0x496de9['Owner'][_0x72ff('0x4e')]:_0x72ff('0xb8'),'createdAt':moment(_0x496de9[_0x72ff('0x85')])[_0x72ff('0x75')](_0x72ff('0x9f'))[_0x72ff('0xac')](),'closedAt':_0x496de9['closed']?moment(_0x496de9[_0x72ff('0xb9')])[_0x72ff('0x75')](_0x72ff('0x9f'))['toString']():'','disposition':_0x496de9[_0x72ff('0xba')],'chatInfo':{'browser':_0x496de9[_0x72ff('0xbb')],'os':_0x496de9[_0x72ff('0xbc')],'referer':_0x496de9['referer'],'customerIp':_0x496de9['customerIp'],'customerPort':_0x496de9[_0x72ff('0xbd')]?_0x496de9['customerPort']:_0x72ff('0xb8')},'messages':_(_0x496de9[_0x72ff('0x79')])[_0x72ff('0xbe')]()[_0x72ff('0x9d')]({'secret':![]})[_0x72ff('0x2d')](function(_0x332536){if(_0x332536['Attachment']){var _0x21f119=path[_0x72ff('0x70')](_0x56f288,_0x332536[_0x72ff('0x6a')][_0x72ff('0x66')]);if(fs[_0x72ff('0xbf')](_0x21f119)){fs['createReadStream'](_0x21f119)[_0x72ff('0xc0')](fs[_0x72ff('0xc1')](path['join'](_0x2e7de0,_0x332536['Attachment']['basename'])));}}return{'date':moment(_0x332536[_0x72ff('0x85')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x72ff('0xac')](),'sender':_0x332536[_0x72ff('0x87')]==='out'?_0x332536['User']?_0x332536['User'][_0x72ff('0x4e')]:_0x72ff('0x7d'):_0x332536[_0x72ff('0xb1')][_0x72ff('0xc2')]+(_0x332536[_0x72ff('0xb1')][_0x72ff('0xb2')]?'\x20'+_0x332536[_0x72ff('0xb1')]['lastName']:''),'body':_0x332536[_0x72ff('0x6a')]?_0x332536[_0x72ff('0x6a')][_0x72ff('0x66')]:_0x332536['body'],'direction':_0x332536[_0x72ff('0x87')]===_0x72ff('0x59')?'A':'C','secret':_0x332536[_0x72ff('0x88')],'read':_0x332536['read'],'attachment':_0x332536[_0x72ff('0x6a')]};})[_0x72ff('0xc3')]()};return ejs['renderFile'](path[_0x72ff('0x70')](config[_0x72ff('0x6e')],_0x72ff('0xc4'),_0x72ff('0xc5'),_0x72ff('0xc6')),{'interaction':_0x4d9dc5})[_0x72ff('0x15')](function(_0x2dea60){var _0x59d73a=path[_0x72ff('0x70')](_0x2e7de0,_0x72ff('0xc7')+_0x496de9['id']+'-'+_0x407aba+'.pdf');var _0x1fdd33={'path':_0x59d73a,'channel':'Chat','interactionId':_0x496de9['id']};return pdf[_0x72ff('0xc8')](_0x2dea60,_0x1fdd33);})[_0x72ff('0x15')](function(){return new Promise(function(_0x2f274,_0x195dcd){zipdir(_0x2e7de0,{'saveTo':_0x3dce98},function(_0x479ad1,_0x206576){if(_0x479ad1)return _0x195dcd(_0x479ad1);return _0x2f274(_0x206576);});})[_0x72ff('0x15')](function(){return new BPromise(function(_0x2eef6f,_0x55933d){rimraf(_0x2e7de0,function(_0x17a701){if(_0x17a701)_0x55933d(_0x17a701);return _0x2eef6f();});});})[_0x72ff('0x15')](function(){return _0x4f1023['download'](_0x3dce98,_0x327da5,function(_0x344220){if(_0x344220){logger[_0x72ff('0x1b')](_0x72ff('0xc9'),_0x344220);}else{fs['unlinkSync'](_0x3dce98);}});});});}else{return _0x4f1023[_0x72ff('0xca')](0xc8);}})[_0x72ff('0x1d')](handleError(_0x4f1023,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e96dcfd..af3ec7d 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 _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 +var _0xdef0=['hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x23d1b3,_0x4656d1){var _0xb3ab39=function(_0x158225){while(--_0x158225){_0x23d1b3['push'](_0x23d1b3['shift']());}};_0xb3ab39(++_0x4656d1);}(_0xdef0,0x11b));var _0x0def=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdef0[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x0def('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x0def('0x1')];var ChatMessage=require(_0x0def('0x2'))['db'][_0x0def('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0def('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0def('0x5'),'afterDestroy':_0x0def('0x6')};function emitEvent(_0x12ec4b){return function(_0x29420d,_0x11495b,_0x16742e){_0x29420d[_0x0def('0x7')]({'attributes':['id'],'raw':!![]})[_0x0def('0x8')](function(_0x1f7d6b){_0x29420d[_0x0def('0x9')](_0x0def('0xa'),_0x1f7d6b[_0x0def('0xb')](function(_0x60543e){return{'id':_0x60543e['id']};}));return ChatMessage[_0x0def('0xc')]({'where':{'ChatInteractionId':_0x29420d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0def('0x8')](function(_0x2b565d){_0x29420d[_0x0def('0x9')](_0x0def('0xd'),_0x2b565d[_0x0def('0xe')]);ChatInteractionEvents[_0x0def('0xf')](_0x12ec4b+':'+_0x29420d['id'],_0x29420d);ChatInteractionEvents[_0x0def('0xf')](_0x12ec4b,_0x29420d);_0x16742e(null);})[_0x0def('0x10')](_0x16742e(null));};}for(var e in events){if(events[_0x0def('0x11')](e)){var event=events[e];ChatInteraction[_0x0def('0x12')](e,emitEvent(event));}}module[_0x0def('0x13')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8ceeaf1..2f740a1 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 _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 +var _0x15f6=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x15f6,0x1f3));var _0x615f=function(_0x548d2d,_0x538efb){_0x548d2d=_0x548d2d-0x0;var _0x4cd970=_0x15f6[_0x548d2d];return _0x4cd970;};'use strict';var _=require(_0x615f('0x0'));var util=require('util');var logger=require(_0x615f('0x1'))('api');var moment=require(_0x615f('0x2'));var BPromise=require(_0x615f('0x3'));var rp=require(_0x615f('0x4'));var fs=require('fs');var path=require(_0x615f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x615f('0x6'));module['exports']=function(_0x5e6222,_0x1877c8){return _0x5e6222['define'](_0x615f('0x7'),attributes,{'tableName':_0x615f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d600c,_0x1bf8cf,_0x3e600c){if(_0x5d600c[_0x615f('0x9')]('closed')){_0x5d600c[_0x615f('0xa')]=moment()[_0x615f('0xb')](_0x615f('0xc'));}_0x3e600c(null,_0x5d600c);}},'charset':_0x615f('0xd'),'collate':_0x615f('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 55f30ba..7d71b3c 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 _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 +var _0x6cfc=['rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','UpdateChatInteraction','ChatInteraction','body','where','options','catch','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6cfc,0xe2));var _0xc6cf=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0x6cfc[_0x372515];return _0xa3bf4e;};'use strict';var _=require(_0xc6cf('0x0'));var util=require(_0xc6cf('0x1'));var moment=require(_0xc6cf('0x2'));var BPromise=require(_0xc6cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6cf('0x4'));var db=require(_0xc6cf('0x5'))['db'];var utils=require(_0xc6cf('0x6'));var logger=require(_0xc6cf('0x7'))(_0xc6cf('0x8'));var config=require(_0xc6cf('0x9'));var jayson=require(_0xc6cf('0xa'));var client=jayson['client'][_0xc6cf('0xb')]({'port':0x232a});config['redis']=_[_0xc6cf('0xc')](config[_0xc6cf('0xd')],{'host':_0xc6cf('0xe'),'port':0x18eb});var socket=require(_0xc6cf('0xf'))(new Redis(config[_0xc6cf('0xd')]));require(_0xc6cf('0x10'))['register'](socket);function respondWithRpcPromise(_0x335999,_0x54c9e7,_0x484b1b){return new BPromise(function(_0x2fe3be,_0x3a77e0){return client['request'](_0x335999,_0x484b1b)[_0xc6cf('0x11')](function(_0x43b2ad){logger[_0xc6cf('0x12')](_0xc6cf('0x13'),_0x54c9e7,'request\x20sent');logger[_0xc6cf('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x54c9e7,_0xc6cf('0x15'),JSON[_0xc6cf('0x16')](_0x43b2ad));if(_0x43b2ad[_0xc6cf('0x17')]){if(_0x43b2ad[_0xc6cf('0x17')][_0xc6cf('0x18')]===0x1f4){logger[_0xc6cf('0x17')](_0xc6cf('0x13'),_0x54c9e7,_0x43b2ad[_0xc6cf('0x17')][_0xc6cf('0x19')]);return _0x3a77e0(_0x43b2ad[_0xc6cf('0x17')]['message']);}logger[_0xc6cf('0x17')](_0xc6cf('0x13'),_0x54c9e7,_0x43b2ad['error']['message']);return _0x2fe3be(_0x43b2ad['error'][_0xc6cf('0x19')]);}else{logger[_0xc6cf('0x12')](_0xc6cf('0x13'),_0x54c9e7,_0xc6cf('0x15'));_0x2fe3be(_0x43b2ad['result']['message']);}})['catch'](function(_0x3726b5){logger[_0xc6cf('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x54c9e7,_0x3726b5);_0x3a77e0(_0x3726b5);});});}exports[_0xc6cf('0x1a')]=function(_0x34abd9){var _0x121505=this;return new Promise(function(_0x3ee4e7,_0x1837d0){return db[_0xc6cf('0x1b')]['update'](_0x34abd9[_0xc6cf('0x1c')],{'raw':_0x34abd9['options']?_0x34abd9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34abd9['options']?_0x34abd9['options'][_0xc6cf('0x1d')]||null:null,'attributes':_0x34abd9[_0xc6cf('0x1e')]?_0x34abd9['options']['attributes']||null:null,'limit':_0x34abd9[_0xc6cf('0x1e')]?_0x34abd9[_0xc6cf('0x1e')]['limit']||null:null})['then'](function(_0x511908){logger[_0xc6cf('0x12')]('UpdateChatInteraction',_0x34abd9);logger[_0xc6cf('0x14')](_0xc6cf('0x1a'),_0x34abd9,JSON['stringify'](_0x511908));_0x3ee4e7(_0x511908);})[_0xc6cf('0x1f')](function(_0x5525b8){logger[_0xc6cf('0x17')]('UpdateChatInteraction',_0x5525b8[_0xc6cf('0x19')],_0x34abd9);_0x1837d0(_0x121505[_0xc6cf('0x17')](0x1f4,_0x5525b8[_0xc6cf('0x19')]));});});};exports[_0xc6cf('0x20')]=function(_0x3d3397){return new Promise(function(_0x52d933,_0x3074c9){return db[_0xc6cf('0x1b')][_0xc6cf('0x21')]({'where':_0x3d3397[_0xc6cf('0x1e')]?_0x3d3397['options'][_0xc6cf('0x1d')]||null:null})[_0xc6cf('0x11')](function(_0x16a842){if(_0x16a842){return _0x16a842[_0xc6cf('0x22')](_0x3d3397[_0xc6cf('0x1c')][_0xc6cf('0x23')],_[_0xc6cf('0x24')](_0x3d3397[_0xc6cf('0x1c')],[_0xc6cf('0x23'),'id'])||{});}})[_0xc6cf('0x25')](function(_0xd2d3e1){logger[_0xc6cf('0x12')](_0xc6cf('0x26'),_0x3d3397);logger[_0xc6cf('0x14')](_0xc6cf('0x26'),_0x3d3397,JSON['stringify'](_0xd2d3e1));_0x52d933(_0xd2d3e1);})[_0xc6cf('0x1f')](function(_0x215f4a){logger[_0xc6cf('0x17')](_0xc6cf('0x26'),_0x215f4a[_0xc6cf('0x19')],_0x3d3397);_0x3074c9(_this['error'](0x1f4,_0x215f4a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 71f5efb..a1990b1 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 _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 +var _0xf5fd=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','remove'];(function(_0x4f32f6,_0x3f1dbb){var _0x5ddda2=function(_0x3ead85){while(--_0x3ead85){_0x4f32f6['push'](_0x4f32f6['shift']());}};_0x5ddda2(++_0x3f1dbb);}(_0xf5fd,0xbe));var _0xdf5f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf5fd[_0x46698a];return _0x356db0;};'use strict';var ChatInteractionEvents=require(_0xdf5f('0x0'));var events=['save',_0xdf5f('0x1'),_0xdf5f('0x2')];function createListener(_0xc5c38,_0x40080b){return function(_0xa051b9){_0x40080b[_0xdf5f('0x3')](_0xc5c38,_0xa051b9);};}function removeListener(_0x1c9717,_0x408279){return function(){ChatInteractionEvents[_0xdf5f('0x4')](_0x1c9717,_0x408279);};}exports[_0xdf5f('0x5')]=function(_0x3cf43f){for(var _0x30ebd6=0x0,_0x283e6f=events[_0xdf5f('0x6')];_0x30ebd6<_0x283e6f;_0x30ebd6++){var _0x135b2a=events[_0x30ebd6];var _0x31a792=createListener(_0xdf5f('0x7')+_0x135b2a,_0x3cf43f);ChatInteractionEvents['on'](_0x135b2a,_0x31a792);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7b61ea7..a4ab8e5 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 _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 +var _0x9999=['%s-%s','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format'];(function(_0x3ab47e,_0x32c722){var _0x1578c3=function(_0x1c8fc9){while(--_0x1c8fc9){_0x3ab47e['push'](_0x3ab47e['shift']());}};_0x1578c3(++_0x32c722);}(_0x9999,0x17d));var _0x9999=function(_0x1fde23,_0x77ef6){_0x1fde23=_0x1fde23-0x0;var _0x59d7c0=_0x9999[_0x1fde23];return _0x59d7c0;};'use strict';var multer=require(_0x9999('0x0'));var util=require(_0x9999('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9999('0x2')]();var fs_extra=require(_0x9999('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9999('0x4'));var config=require(_0x9999('0x5'));var controller=require('./chatInteraction.controller');router[_0x9999('0x6')]('/',auth[_0x9999('0x7')](),controller[_0x9999('0x8')]);router['get'](_0x9999('0x9'),auth[_0x9999('0x7')](),controller['describe']);router[_0x9999('0x6')]('/:id',auth[_0x9999('0xa')](),controller['show']);router[_0x9999('0x6')](_0x9999('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x9999('0xc')]);router['get'](_0x9999('0xd'),auth[_0x9999('0x7')](),controller[_0x9999('0xe')]);router[_0x9999('0x6')](_0x9999('0xf'),auth[_0x9999('0xa')](),controller[_0x9999('0x10')]);router[_0x9999('0x6')](_0x9999('0x11'),auth[_0x9999('0x7')](),controller[_0x9999('0x12')]);router[_0x9999('0x13')]('/',auth[_0x9999('0x7')](),controller[_0x9999('0x14')]);router[_0x9999('0x13')](_0x9999('0x15'),auth[_0x9999('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x9999('0x16')]({'destination':function(_0x3a03d0,_0x27da76,_0x226dc9){_0x226dc9(null,path[_0x9999('0x17')](config[_0x9999('0x18')],_0x9999('0x19')));},'filename':function(_0x52c29c,_0x4a562f,_0x59aac3){_0x59aac3(null,util[_0x9999('0x1a')](_0x9999('0x1b'),Date['now'](),_0x4a562f['originalname'][_0x9999('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9999('0x13')](_0x9999('0x1d'),upload['single'](_0x9999('0x1e')),controller[_0x9999('0x1f')]);router[_0x9999('0x13')]('/:id/messages',auth[_0x9999('0xa')](),controller[_0x9999('0x20')]);router[_0x9999('0x13')](_0x9999('0x21'),auth[_0x9999('0x7')](),interaction[_0x9999('0x22')]('chat',_0x9999('0x23')),controller['addTags']);router[_0x9999('0x24')](_0x9999('0x25'),auth[_0x9999('0x7')](),interaction['tracked'](_0x9999('0x26'),_0x9999('0x27')),controller[_0x9999('0x28')]);router[_0x9999('0x24')](_0x9999('0x29'),controller[_0x9999('0x2a')]);router[_0x9999('0x24')](_0x9999('0x2b'),auth['isChatInteractionAuthorized'](),controller['abandon']);router['put'](_0x9999('0x2c'),controller[_0x9999('0x2d')]);router['delete'](_0x9999('0x25'),auth['isAuthenticated'](),interaction[_0x9999('0x22')](_0x9999('0x26'),_0x9999('0x2e')),controller[_0x9999('0x2f')]);router[_0x9999('0x30')]('/:id/tags',auth[_0x9999('0x7')](),controller[_0x9999('0x31')]);module[_0x9999('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 17683b8..e9cc286 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 _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 +var _0x7d4c=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d4c,0xd1));var _0xc7d4=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x7d4c[_0x51ac09];return _0x3f827d;};'use strict';var Sequelize=require(_0xc7d4('0x0'));module[_0xc7d4('0x1')]={'body':{'type':Sequelize[_0xc7d4('0x2')](_0xc7d4('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc7d4('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e7ff8e1..fee6546 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 _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 +var _0x87ce=['VIRTUAL','options','where','includeAll','include','ChatInternalMessage','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','get','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','read','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./chatInternalMessage.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type'];(function(_0x5e75ef,_0x4ce765){var _0x3c28b2=function(_0x29a66c){while(--_0x29a66c){_0x5e75ef['push'](_0x5e75ef['shift']());}};_0x3c28b2(++_0x4ce765);}(_0x87ce,0xa4));var _0xe87c=function(_0x44d510,_0xa1eebb){_0x44d510=_0x44d510-0x0;var _0x156bcb=_0x87ce[_0x44d510];return _0x156bcb;};'use strict';var emlformat=require(_0xe87c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe87c('0x1'));var rp=require(_0xe87c('0x2'));var moment=require(_0xe87c('0x3'));var BPromise=require(_0xe87c('0x4'));var Mustache=require(_0xe87c('0x5'));var util=require(_0xe87c('0x6'));var path=require(_0xe87c('0x7'));var sox=require(_0xe87c('0x8'));var csv=require('to-csv');var ejs=require(_0xe87c('0x9'));var fs=require('fs');var fs_extra=require(_0xe87c('0xa'));var _=require(_0xe87c('0xb'));var squel=require(_0xe87c('0xc'));var crypto=require('crypto');var jsforce=require(_0xe87c('0xd'));var deskjs=require(_0xe87c('0xe'));var toCsv=require(_0xe87c('0xf'));var querystring=require(_0xe87c('0x10'));var Papa=require(_0xe87c('0x11'));var Redis=require(_0xe87c('0x12'));var authService=require(_0xe87c('0x13'));var qs=require(_0xe87c('0x14'));var as=require(_0xe87c('0x15'));var hardwareService=require(_0xe87c('0x16'));var logger=require(_0xe87c('0x17'))(_0xe87c('0x18'));var utils=require(_0xe87c('0x19'));var config=require(_0xe87c('0x1a'));var licenseUtil=require(_0xe87c('0x1b'));var db=require(_0xe87c('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe87c('0x1d'))(new Redis(config[_0xe87c('0x1e')]));require(_0xe87c('0x1f'))['register'](socket);function respondWithStatusCode(_0x3e926b,_0x4f102a){_0x4f102a=_0x4f102a||0xcc;return function(_0x37d9cd){if(_0x37d9cd){return _0x3e926b['sendStatus'](_0x4f102a);}return _0x3e926b[_0xe87c('0x20')](_0x4f102a)['end']();};}function respondWithResult(_0x66eb16,_0x12d397){_0x12d397=_0x12d397||0xc8;return function(_0x145105){if(_0x145105){return _0x66eb16[_0xe87c('0x20')](_0x12d397)[_0xe87c('0x21')](_0x145105);}};}function respondWithFilteredResult(_0x5f4b58,_0x5ad4bf){return function(_0x4517c5){if(_0x4517c5){var _0x4ad234=typeof _0x5ad4bf[_0xe87c('0x22')]===_0xe87c('0x23')&&typeof _0x5ad4bf[_0xe87c('0x24')]===_0xe87c('0x23');var _0x1b344b=_0x4517c5[_0xe87c('0x25')];var _0x276bc1=_0x4ad234?0x0:_0x5ad4bf['offset'];var _0x23ca74=_0x4ad234?_0x4517c5[_0xe87c('0x25')]:_0x5ad4bf[_0xe87c('0x22')]+_0x5ad4bf[_0xe87c('0x24')];var _0x5d09ac;if(_0x23ca74>=_0x1b344b){_0x23ca74=_0x1b344b;_0x5d09ac=0xc8;}else{_0x5d09ac=0xce;}_0x5f4b58['status'](_0x5d09ac);return _0x5f4b58[_0xe87c('0x26')](_0xe87c('0x27'),_0x276bc1+'-'+_0x23ca74+'/'+_0x1b344b)[_0xe87c('0x21')](_0x4517c5);}return null;};}function patchUpdates(_0xbe7528){return function(_0x15f33e){try{jsonpatch[_0xe87c('0x28')](_0x15f33e,_0xbe7528,!![]);}catch(_0x466b93){return BPromise[_0xe87c('0x29')](_0x466b93);}return _0x15f33e[_0xe87c('0x2a')]();};}function saveUpdates(_0x5a9633,_0x5d7a99){return function(_0x57218f){if(_0x57218f){return _0x57218f[_0xe87c('0x2b')](_0x5a9633)[_0xe87c('0x2c')](function(_0xfc965){return _0xfc965;});}return null;};}function removeEntity(_0x43b257,_0x33f3d3){return function(_0x3d6105){if(_0x3d6105){return _0x3d6105['destroy']()[_0xe87c('0x2c')](function(){_0x43b257[_0xe87c('0x20')](0xcc)[_0xe87c('0x2d')]();});}};}function handleEntityNotFound(_0x92110d,_0x58fcb6){return function(_0x271f72){if(!_0x271f72){_0x92110d[_0xe87c('0x2e')](0x194);}return _0x271f72;};}function handleError(_0x1b3193,_0x44d706){_0x44d706=_0x44d706||0x1f4;return function(_0x39dff5){logger['error'](_0x39dff5[_0xe87c('0x2f')]);if(_0x39dff5[_0xe87c('0x30')]){delete _0x39dff5['name'];}_0x1b3193['status'](_0x44d706)[_0xe87c('0x31')](_0x39dff5);};}exports[_0xe87c('0x32')]=function(_0x73b89d,_0x10b03c){var _0x2b1eb0={},_0x980157={},_0x4d96a7={'count':0x0,'rows':[]};var _0x266829=_[_0xe87c('0x33')](db['ChatInternalMessage'][_0xe87c('0x34')],function(_0x3c0456){return{'name':_0x3c0456[_0xe87c('0x35')],'type':_0x3c0456['type'][_0xe87c('0x36')]};});_0x980157[_0xe87c('0x37')]=_[_0xe87c('0x33')](_0x266829,_0xe87c('0x30'));_0x980157['query']=_[_0xe87c('0x38')](_0x73b89d[_0xe87c('0x39')]);_0x980157[_0xe87c('0x3a')]=_[_0xe87c('0x3b')](_0x980157[_0xe87c('0x37')],_0x980157['query']);_0x2b1eb0[_0xe87c('0x3c')]=_[_0xe87c('0x3b')](_0x980157[_0xe87c('0x37')],qs['fields'](_0x73b89d[_0xe87c('0x39')][_0xe87c('0x3d')]));_0x2b1eb0[_0xe87c('0x3c')]=_0x2b1eb0['attributes']['length']?_0x2b1eb0[_0xe87c('0x3c')]:_0x980157[_0xe87c('0x37')];if(!_0x73b89d[_0xe87c('0x39')][_0xe87c('0x3e')](_0xe87c('0x3f'))){_0x2b1eb0['limit']=qs[_0xe87c('0x24')](_0x73b89d[_0xe87c('0x39')][_0xe87c('0x24')]);_0x2b1eb0[_0xe87c('0x22')]=qs[_0xe87c('0x22')](_0x73b89d[_0xe87c('0x39')][_0xe87c('0x22')]);}_0x2b1eb0[_0xe87c('0x40')]=qs[_0xe87c('0x41')](_0x73b89d['query'][_0xe87c('0x41')]);_0x2b1eb0['where']=qs[_0xe87c('0x3a')](_[_0xe87c('0x42')](_0x73b89d[_0xe87c('0x39')],_0x980157[_0xe87c('0x3a')]),_0x266829);if(_0x73b89d['query'][_0xe87c('0x43')]){_0x2b1eb0['where']=_[_0xe87c('0x44')](_0x2b1eb0['where'],{'$or':_['map'](_0x266829,function(_0xf9d67b){if(_0xf9d67b[_0xe87c('0x45')]!==_0xe87c('0x46')){var _0xa26c44={};_0xa26c44[_0xf9d67b[_0xe87c('0x30')]]={'$like':'%'+_0x73b89d[_0xe87c('0x39')][_0xe87c('0x43')]+'%'};return _0xa26c44;}})});}_0x2b1eb0=_['merge']({},_0x2b1eb0,_0x73b89d[_0xe87c('0x47')]);var _0x5c5999={'where':_0x2b1eb0[_0xe87c('0x48')]};return db['ChatInternalMessage']['count'](_0x5c5999)[_0xe87c('0x2c')](function(_0x3849ef){_0x4d96a7[_0xe87c('0x25')]=_0x3849ef;if(_0x73b89d['query'][_0xe87c('0x49')]){_0x2b1eb0[_0xe87c('0x4a')]=[{'all':!![]}];}return db[_0xe87c('0x4b')][_0xe87c('0x4c')](_0x2b1eb0);})[_0xe87c('0x2c')](function(_0x34e40a){_0x4d96a7[_0xe87c('0x4d')]=_0x34e40a;return _0x4d96a7;})[_0xe87c('0x2c')](respondWithFilteredResult(_0x10b03c,_0x2b1eb0))[_0xe87c('0x4e')](handleError(_0x10b03c,null));};exports[_0xe87c('0x4f')]=function(_0x4bbe85,_0xcbe8b5){var _0x5acd21={'raw':!![],'where':{'id':_0x4bbe85['params']['id']}},_0x4fa0d1={};_0x4fa0d1[_0xe87c('0x37')]=_[_0xe87c('0x38')](db[_0xe87c('0x4b')]['rawAttributes']);_0x4fa0d1[_0xe87c('0x39')]=_['keys'](_0x4bbe85[_0xe87c('0x39')]);_0x4fa0d1[_0xe87c('0x3a')]=_[_0xe87c('0x3b')](_0x4fa0d1[_0xe87c('0x37')],_0x4fa0d1['query']);_0x5acd21[_0xe87c('0x3c')]=_[_0xe87c('0x3b')](_0x4fa0d1[_0xe87c('0x37')],qs[_0xe87c('0x3d')](_0x4bbe85[_0xe87c('0x39')][_0xe87c('0x3d')]));_0x5acd21[_0xe87c('0x3c')]=_0x5acd21[_0xe87c('0x3c')][_0xe87c('0x50')]?_0x5acd21[_0xe87c('0x3c')]:_0x4fa0d1[_0xe87c('0x37')];if(_0x4bbe85[_0xe87c('0x39')][_0xe87c('0x49')]){_0x5acd21[_0xe87c('0x4a')]=[{'all':!![]}];}_0x5acd21=_[_0xe87c('0x44')]({},_0x5acd21,_0x4bbe85['options']);return db['ChatInternalMessage'][_0xe87c('0x51')](_0x5acd21)[_0xe87c('0x2c')](handleEntityNotFound(_0xcbe8b5,null))['then'](respondWithResult(_0xcbe8b5,null))[_0xe87c('0x4e')](handleError(_0xcbe8b5,null));};exports['create']=function(_0x489f1e,_0x162ad6){return db[_0xe87c('0x4b')][_0xe87c('0x52')](_0x489f1e[_0xe87c('0x53')],{})[_0xe87c('0x2c')](respondWithResult(_0x162ad6,0xc9))[_0xe87c('0x4e')](handleError(_0x162ad6,null));};exports['update']=function(_0xfc3003,_0x57be06){if(_0xfc3003[_0xe87c('0x53')]['id']){delete _0xfc3003[_0xe87c('0x53')]['id'];}return db[_0xe87c('0x4b')][_0xe87c('0x51')]({'where':{'id':_0xfc3003[_0xe87c('0x54')]['id']}})[_0xe87c('0x2c')](handleEntityNotFound(_0x57be06,null))[_0xe87c('0x2c')](saveUpdates(_0xfc3003[_0xe87c('0x53')],null))[_0xe87c('0x2c')](respondWithResult(_0x57be06,null))[_0xe87c('0x4e')](handleError(_0x57be06,null));};exports[_0xe87c('0x55')]=function(_0x3b544a,_0x50bb31){return db['ChatInternalMessage'][_0xe87c('0x51')]({'where':{'id':_0x3b544a['params']['id']}})[_0xe87c('0x2c')](handleEntityNotFound(_0x50bb31,null))['then'](removeEntity(_0x50bb31,null))[_0xe87c('0x4e')](handleError(_0x50bb31,null));};exports[_0xe87c('0x56')]=function(_0x5d2bbc,_0x4e212b){return db[_0xe87c('0x4b')][_0xe87c('0x56')]()['then'](respondWithResult(_0x4e212b,null))['catch'](handleError(_0x4e212b,null));};function wrapUser(_0x48b972){return function(_0x3834dd){var _0x2fcc0f=_0x48b972[_0xe87c('0x57')]({'plain':!![]});_0x2fcc0f['messages']=[];if(_0x3834dd){_0x2fcc0f['lastMessageAt']=_0x3834dd[_0xe87c('0x58')];_0x2fcc0f[_0xe87c('0x59')]=_0x3834dd;}else{_0x2fcc0f[_0xe87c('0x5a')]=moment(0x0)['format'](_0xe87c('0x5b'));_0x2fcc0f[_0xe87c('0x59')]={};}return _0x2fcc0f;};}exports[_0xe87c('0x5c')]=function(_0x288b71,_0x3e43c1,_0x3180eb){var _0x4447b5=[];return db[_0xe87c('0x5d')][_0xe87c('0x4c')]({'where':{'role':[_0xe87c('0x5e'),_0xe87c('0x5f'),_0xe87c('0x60')]},'attributes':['id',_0xe87c('0x61'),_0xe87c('0x30'),_0xe87c('0x62'),'userpic',_0xe87c('0x63'),_0xe87c('0x64'),_0xe87c('0x65'),_0xe87c('0x66'),_0xe87c('0x67')],'order':qs[_0xe87c('0x41')](_0xe87c('0x68')),'include':[{'model':db[_0xe87c('0x69')],'as':'VoiceQueues','attributes':['id',_0xe87c('0x30'),_0xe87c('0x45')],'through':{'attributes':[]}}]})[_0xe87c('0x2c')](function(_0x539504){if(_0x539504){var _0xea84a4=_0x288b71[_0xe87c('0x60')][_0xe87c('0x57')]({'plain':!![]});if(!_0xea84a4)throw new Error(_0xe87c('0x6a'));if(_0xea84a4[_0xe87c('0x62')]===_0xe87c('0x60')){return db[_0xe87c('0x6b')]['find']({'where':{'name':_0xe87c('0x6c'),'userProfileId':_0xea84a4[_0xe87c('0x6d')]},'raw':!![]})['then'](function(_0x2954f9){if(_0x2954f9){if(_0x2954f9[_0xe87c('0x6e')]===0x0){return db[_0xe87c('0x6f')][_0xe87c('0x4c')]({'where':{'sectionId':_0x2954f9['id']},'raw':!![]})[_0xe87c('0x2c')](function(_0x27d705){var _0x887f75=[];if(_[_0xe87c('0x70')](_0x27d705)){_0x887f75=_[_0xe87c('0x43')](_0x539504,function(_0x56cb58){if(_0x56cb58[_0xe87c('0x62')]!==_0xe87c('0x5e')){return _0x56cb58;}});return _0x887f75;}else{for(var _0x175a9d=0x0;_0x175a9d<_0x539504[_0xe87c('0x50')];_0x175a9d++){var _0x1724c5=_0x539504[_0x175a9d];if(_0x1724c5[_0xe87c('0x62')]===_0xe87c('0x5e')){var _0x261073=_[_0xe87c('0x51')](_0x27d705,function(_0x581c9d){return _0x581c9d[_0xe87c('0x71')]===_0x1724c5['id'];});if(_0x261073)_0x887f75['push'](_0x1724c5);}else{_0x887f75[_0xe87c('0x72')](_0x1724c5);}}return _0x887f75;}});}else{return _0x539504;}}else{var _0x4322d5=_[_0xe87c('0x43')](_0x539504,function(_0x183b1b){if(_0x183b1b[_0xe87c('0x62')]!==_0xe87c('0x5e')){return _0x183b1b;}});return _0x4322d5;}});}else{return _0x539504;}}})[_0xe87c('0x2c')](function(_0x4283f4){var _0x259896=[];if(_0x4283f4){_0x4447b5=_0x4283f4;for(var _0x54f161=0x0;_0x54f161<_0x4283f4[_0xe87c('0x50')];_0x54f161+=0x1){_0x4447b5[_0x54f161][_0xe87c('0x73')]=[];_0x259896['push'](db['ChatInternalMessage'][_0xe87c('0x51')]({'where':{'FromId':[_0x288b71[_0xe87c('0x60')]['id'],_0x4283f4[_0x54f161]['id']],'ToId':[_0x288b71[_0xe87c('0x60')]['id'],_0x4283f4[_0x54f161]['id']],'ChatGroupId':null},'attributes':['id',_0xe87c('0x58'),'FromId','ToId',_0xe87c('0x74'),_0xe87c('0x53')],'order':qs[_0xe87c('0x41')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe87c('0x2c')](wrapUser(_0x4283f4[_0x54f161])));}return BPromise['all'](_0x259896);}return[];})['then'](function(_0x46e2e8){return{'rows':_0x46e2e8,'count':_0x46e2e8[_0xe87c('0x50')]};})[_0xe87c('0x2c')](respondWithResult(_0x3e43c1,null))['catch'](handleError(_0x3e43c1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index cb1f8a8..1b57db9 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 _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 +var _0x6b09=['exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4a2529,_0x3b3082){var _0x1f6f12=function(_0x35681e){while(--_0x35681e){_0x4a2529['push'](_0x4a2529['shift']());}};_0x1f6f12(++_0x3b3082);}(_0x6b09,0x17d));var _0x96b0=function(_0x45ce90,_0x114609){_0x45ce90=_0x45ce90-0x0;var _0x313c45=_0x6b09[_0x45ce90];return _0x313c45;};'use strict';var EventEmitter=require(_0x96b0('0x0'));var ChatInternalMessage=require(_0x96b0('0x1'))['db'][_0x96b0('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x96b0('0x3'),'afterUpdate':_0x96b0('0x4'),'afterDestroy':_0x96b0('0x5')};function emitEvent(_0x45c7da){return function(_0x31fc97,_0xa76b50,_0x16e3bd){ChatInternalMessageEvents['emit'](_0x45c7da+':'+_0x31fc97['id'],_0x31fc97);ChatInternalMessageEvents[_0x96b0('0x6')](_0x45c7da,_0x31fc97);_0x16e3bd(null);};}for(var e in events){if(events[_0x96b0('0x7')](e)){var event=events[e];ChatInternalMessage[_0x96b0('0x8')](e,emitEvent(event));}}module[_0x96b0('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f288515..13c4204 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 _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 +var _0x2a24=['./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x50dcd8,_0x7c96d1){var _0x2bdc68=function(_0x175198){while(--_0x175198){_0x50dcd8['push'](_0x50dcd8['shift']());}};_0x2bdc68(++_0x7c96d1);}(_0x2a24,0xe0));var _0x42a2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2a24[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x42a2('0x0'));var util=require('util');var logger=require(_0x42a2('0x1'))('api');var moment=require(_0x42a2('0x2'));var BPromise=require(_0x42a2('0x3'));var rp=require(_0x42a2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42a2('0x5'));var config=require(_0x42a2('0x6'));var attributes=require(_0x42a2('0x7'));module[_0x42a2('0x8')]=function(_0x4be38a,_0x1e1cdd){return _0x4be38a['define'](_0x42a2('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x42a2('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 60f4148..a9a424b 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 _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 +var _0x370d=['error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e215a,_0x41fc9a){var _0x18d22a=function(_0x59c683){while(--_0x59c683){_0x1e215a['push'](_0x1e215a['shift']());}};_0x18d22a(++_0x41fc9a);}(_0x370d,0xc6));var _0xd370=function(_0xffe27f,_0x5c2bbb){_0xffe27f=_0xffe27f-0x0;var _0x354510=_0x370d[_0xffe27f];return _0x354510;};'use strict';var _=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var moment=require('moment');var BPromise=require(_0xd370('0x2'));var rs=require(_0xd370('0x3'));var fs=require('fs');var Redis=require(_0xd370('0x4'));var db=require(_0xd370('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd370('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd370('0x7')]({'port':0x232a});config[_0xd370('0x8')]=_[_0xd370('0x9')](config[_0xd370('0x8')],{'host':_0xd370('0xa'),'port':0x18eb});var socket=require(_0xd370('0xb'))(new Redis(config[_0xd370('0x8')]));require(_0xd370('0xc'))['register'](socket);function respondWithRpcPromise(_0x438297,_0x118ae2,_0x2f2181){return new BPromise(function(_0x494667,_0x36e395){return client[_0xd370('0xd')](_0x438297,_0x2f2181)['then'](function(_0x416544){logger[_0xd370('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x118ae2,_0xd370('0xf'));logger['debug'](_0xd370('0x10'),_0x118ae2,_0xd370('0xf'),JSON[_0xd370('0x11')](_0x416544));if(_0x416544[_0xd370('0x12')]){if(_0x416544[_0xd370('0x12')][_0xd370('0x13')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x118ae2,_0x416544[_0xd370('0x12')][_0xd370('0x14')]);return _0x36e395(_0x416544[_0xd370('0x12')]['message']);}logger['error'](_0xd370('0x15'),_0x118ae2,_0x416544[_0xd370('0x12')][_0xd370('0x14')]);return _0x494667(_0x416544[_0xd370('0x12')][_0xd370('0x14')]);}else{logger[_0xd370('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x118ae2,'request\x20sent');_0x494667(_0x416544[_0xd370('0x16')][_0xd370('0x14')]);}})[_0xd370('0x17')](function(_0x44edb8){logger[_0xd370('0x12')](_0xd370('0x15'),_0x118ae2,_0x44edb8);_0x36e395(_0x44edb8);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index fd913f4..3961f6d 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 _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 +var _0x29c8=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x29c8,0x19a));var _0x829c=function(_0x415b08,_0x435b11){_0x415b08=_0x415b08-0x0;var _0x50f7bd=_0x29c8[_0x415b08];return _0x50f7bd;};'use strict';var ChatInternalMessageEvents=require(_0x829c('0x0'));var events=[_0x829c('0x1'),_0x829c('0x2'),_0x829c('0x3')];function createListener(_0x6c1c04,_0x5830cf){return function(_0xde857c){_0x5830cf[_0x829c('0x4')](_0x6c1c04,_0xde857c);};}function removeListener(_0x2d1443,_0x4c81f9){return function(){ChatInternalMessageEvents[_0x829c('0x5')](_0x2d1443,_0x4c81f9);};}exports[_0x829c('0x6')]=function(_0x59ae76){for(var _0x4def7f=0x0,_0x200947=events[_0x829c('0x7')];_0x4def7f<_0x200947;_0x4def7f++){var _0x3a88e9=events[_0x4def7f];var _0x19ea3b=createListener(_0x829c('0x8')+_0x3a88e9,_0x59ae76);ChatInternalMessageEvents['on'](_0x3a88e9,_0x19ea3b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b42303d..27be06b 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 _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 +var _0xeb10=['get','isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller'];(function(_0xcc04c2,_0x5d13cf){var _0x24c46b=function(_0xcec449){while(--_0xcec449){_0xcc04c2['push'](_0xcc04c2['shift']());}};_0x24c46b(++_0x5d13cf);}(_0xeb10,0x15e));var _0x0eb1=function(_0x2f11b7,_0x137966){_0x2f11b7=_0x2f11b7-0x0;var _0x246ae4=_0xeb10[_0x2f11b7];return _0x246ae4;};'use strict';var multer=require('multer');var util=require(_0x0eb1('0x0'));var path=require(_0x0eb1('0x1'));var timeout=require(_0x0eb1('0x2'));var express=require('express');var router=express[_0x0eb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0eb1('0x4'));var interaction=require(_0x0eb1('0x5'));var config=require('../../config/environment');var controller=require(_0x0eb1('0x6'));router[_0x0eb1('0x7')]('/',auth[_0x0eb1('0x8')](),controller['index']);router['get'](_0x0eb1('0x9'),auth['isAuthenticated'](),controller[_0x0eb1('0xa')]);router[_0x0eb1('0x7')](_0x0eb1('0xb'),auth[_0x0eb1('0x8')](),controller[_0x0eb1('0xc')]);router[_0x0eb1('0x7')](_0x0eb1('0xd'),auth[_0x0eb1('0x8')](),controller[_0x0eb1('0xe')]);router[_0x0eb1('0xf')]('/',auth[_0x0eb1('0x8')](),controller[_0x0eb1('0x10')]);router[_0x0eb1('0x11')](_0x0eb1('0xd'),controller[_0x0eb1('0x12')]);router[_0x0eb1('0x13')]('/:id',auth[_0x0eb1('0x8')](),controller[_0x0eb1('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6cd290b..f07f462 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 _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 +var _0x94e6=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x36b671,_0x44610a){var _0x44e968=function(_0x5e0071){while(--_0x5e0071){_0x36b671['push'](_0x36b671['shift']());}};_0x44e968(++_0x44610a);}(_0x94e6,0x194));var _0x694e=function(_0x1ff1ab,_0xd1426c){_0x1ff1ab=_0x1ff1ab-0x0;var _0x28839e=_0x94e6[_0x1ff1ab];return _0x28839e;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'body':{'type':Sequelize[_0x694e('0x1')](_0x694e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x694e('0x4')]('in',_0x694e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x694e('0x6')]},'providerName':{'type':Sequelize[_0x694e('0x7')]},'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 78eb04b..eedab53 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 _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 +var _0xa3e0=['model','map','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','options','includeAll','include','findAll','show','keys','rawAttributes','find','create','body','params','describe','chat','reject','UserId','user','agent','ChatInteraction','ChatInteractionId','interaction','get','info','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','parse','formData','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','request','then','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','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','ChatMessage','fieldName','type','key'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xa3e0,0x16f));var _0x0a3e=function(_0x60f18e,_0x40e8f3){_0x60f18e=_0x60f18e-0x0;var _0x1c02e3=_0xa3e0[_0x60f18e];return _0x1c02e3;};'use strict';var util=require(_0x0a3e('0x0'));var _=require(_0x0a3e('0x1'));var Redis=require(_0x0a3e('0x2'));var interactionService=require(_0x0a3e('0x3'));var qs=require(_0x0a3e('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x0a3e('0x5'));var db=require(_0x0a3e('0x6'))['db'];config[_0x0a3e('0x7')]=_['defaults'](config[_0x0a3e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a3e('0x8'))[_0x0a3e('0x9')](socket);var jayson=require(_0x0a3e('0xa'));var client=jayson[_0x0a3e('0xb')][_0x0a3e('0xc')]({'port':0x232c});var client9002=jayson[_0x0a3e('0xb')][_0x0a3e('0xc')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x0a3e('0xd'));function respondWithRpcPromise(_0x411942,_0x8202eb,_0x29a63e,_0x16e35c){return new Promise(function(_0x146c75,_0x2db053){var _0x165460=_0x16e35c||client;return _0x165460[_0x0a3e('0xe')](_0x411942,_0x29a63e)[_0x0a3e('0xf')](function(_0x6269dd){logger['info'](_0x0a3e('0x10'),_0x8202eb,_0x0a3e('0x11'));logger[_0x0a3e('0x12')](_0x0a3e('0x13'),_0x8202eb,_0x0a3e('0x11'),JSON[_0x0a3e('0x14')](_0x6269dd));if(_0x6269dd[_0x0a3e('0x15')]){if(_0x6269dd[_0x0a3e('0x15')][_0x0a3e('0x16')]===0x1f4){logger[_0x0a3e('0x15')]('ChatMessage,\x20%s,\x20%s',_0x8202eb,_0x6269dd[_0x0a3e('0x15')][_0x0a3e('0x17')]);return _0x2db053(_0x6269dd['error']['message']);}logger[_0x0a3e('0x15')](_0x0a3e('0x10'),_0x8202eb,_0x6269dd['error'][_0x0a3e('0x17')]);return _0x146c75(_0x6269dd[_0x0a3e('0x15')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x8202eb,_0x0a3e('0x11'));_0x146c75(_0x6269dd[_0x0a3e('0x18')][_0x0a3e('0x17')]);}})[_0x0a3e('0x19')](function(_0x27de61){logger['error'](_0x0a3e('0x10'),_0x8202eb,_0x27de61);_0x2db053(_0x27de61);});});}function respondWithResult(_0x537314,_0x46744b){_0x46744b=_0x46744b||0xc8;return function(_0xe44fba){if(_0xe44fba){return _0x537314[_0x0a3e('0x1a')](_0x46744b)[_0x0a3e('0x1b')](_0xe44fba);}};}function respondWithFilteredResult(_0x54ab44,_0x594caf){return function(_0x32b590){if(_0x32b590){var _0x19c514=typeof _0x594caf[_0x0a3e('0x1c')]===_0x0a3e('0x1d')&&typeof _0x594caf[_0x0a3e('0x1e')]===_0x0a3e('0x1d');var _0x389962=_0x32b590[_0x0a3e('0x1f')];var _0x5836d1=_0x19c514?0x0:_0x594caf['offset'];var _0x342e44=_0x19c514?_0x32b590[_0x0a3e('0x1f')]:_0x594caf[_0x0a3e('0x1c')]+_0x594caf['limit'];var _0x4361c5;if(_0x342e44>=_0x389962){_0x342e44=_0x389962;_0x4361c5=0xc8;}else{_0x4361c5=0xce;}_0x54ab44['status'](_0x4361c5);return _0x54ab44['set'](_0x0a3e('0x20'),_0x5836d1+'-'+_0x342e44+'/'+_0x389962)['json'](_0x32b590);}return null;};}function saveUpdates(_0x304625){return function(_0x3196d6){if(_0x3196d6){return _0x3196d6[_0x0a3e('0x21')](_0x304625)[_0x0a3e('0xf')](function(_0x4b3020){return _0x4b3020;});}return null;};}function removeEntity(_0x3be0a3){return function(_0x319027){if(_0x319027){return _0x319027[_0x0a3e('0x22')]()[_0x0a3e('0xf')](function(){_0x3be0a3[_0x0a3e('0x1a')](0xcc)[_0x0a3e('0x23')]();});}};}function handleEntityNotFound(_0x45a9a5){return function(_0x4f6d76){if(!_0x4f6d76){_0x45a9a5[_0x0a3e('0x24')](0x194);}return _0x4f6d76;};}function handleError(_0x3d3580,_0x2f5b1f){_0x2f5b1f=_0x2f5b1f||0x1f4;return function(_0x2b3e2d){logger[_0x0a3e('0x15')](_0x2b3e2d[_0x0a3e('0x25')]);if(_0x2b3e2d[_0x0a3e('0x26')]){delete _0x2b3e2d['name'];}_0x3d3580[_0x0a3e('0x1a')](_0x2f5b1f)[_0x0a3e('0x27')](_0x2b3e2d);};}exports[_0x0a3e('0x28')]=function(_0x1eb446,_0x374e7f){var _0x4410b5={},_0x1d54ec={},_0xec409={'count':0x0,'rows':[]};var _0x5a0977=_['map'](db[_0x0a3e('0x29')]['rawAttributes'],function(_0x274529){return{'name':_0x274529[_0x0a3e('0x2a')],'type':_0x274529[_0x0a3e('0x2b')][_0x0a3e('0x2c')]};});_0x1d54ec[_0x0a3e('0x2d')]=_[_0x0a3e('0x2e')](_0x5a0977,'name');_0x1d54ec[_0x0a3e('0x2f')]=_['keys'](_0x1eb446[_0x0a3e('0x2f')]);_0x1d54ec['filters']=_[_0x0a3e('0x30')](_0x1d54ec[_0x0a3e('0x2d')],_0x1d54ec[_0x0a3e('0x2f')]);_0x4410b5['attributes']=_['intersection'](_0x1d54ec['model'],qs[_0x0a3e('0x31')](_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x31')]));_0x4410b5[_0x0a3e('0x32')]=_0x4410b5[_0x0a3e('0x32')][_0x0a3e('0x33')]?_0x4410b5[_0x0a3e('0x32')]:_0x1d54ec[_0x0a3e('0x2d')];if(!_0x1eb446['query'][_0x0a3e('0x34')]('nolimit')){_0x4410b5[_0x0a3e('0x1e')]=qs[_0x0a3e('0x1e')](_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x1e')]);_0x4410b5[_0x0a3e('0x1c')]=qs[_0x0a3e('0x1c')](_0x1eb446[_0x0a3e('0x2f')]['offset']);}_0x4410b5['order']=qs[_0x0a3e('0x35')](_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x35')]);_0x4410b5[_0x0a3e('0x36')]=qs[_0x0a3e('0x37')](_['pick'](_0x1eb446[_0x0a3e('0x2f')],_0x1d54ec['filters']),_0x5a0977);if(_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x38')]){_0x4410b5[_0x0a3e('0x36')]=_[_0x0a3e('0x39')](_0x4410b5[_0x0a3e('0x36')],{'$or':_['map'](_0x5a0977,function(_0x4fa575){if(_0x4fa575[_0x0a3e('0x2b')]!=='VIRTUAL'){var _0x2d1bfe={};_0x2d1bfe[_0x4fa575['name']]={'$like':'%'+_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x38')]+'%'};return _0x2d1bfe;}})});}_0x4410b5=_[_0x0a3e('0x39')]({},_0x4410b5,_0x1eb446[_0x0a3e('0x3a')]);var _0x19c894={'where':_0x4410b5[_0x0a3e('0x36')]};return db['ChatMessage']['count'](_0x19c894)['then'](function(_0x10bdd8){_0xec409['count']=_0x10bdd8;if(_0x1eb446['query'][_0x0a3e('0x3b')]){_0x4410b5[_0x0a3e('0x3c')]=[{'all':!![]}];}return db[_0x0a3e('0x29')][_0x0a3e('0x3d')](_0x4410b5);})[_0x0a3e('0xf')](function(_0x2815d7){_0xec409['rows']=_0x2815d7;return _0xec409;})['then'](respondWithFilteredResult(_0x374e7f,_0x4410b5))['catch'](handleError(_0x374e7f,null));};exports[_0x0a3e('0x3e')]=function(_0xb0f016,_0x4885d1){var _0x26954c={'raw':!![],'where':{'id':_0xb0f016['params']['id']}},_0xd47d46={};_0xd47d46[_0x0a3e('0x2d')]=_[_0x0a3e('0x3f')](db[_0x0a3e('0x29')][_0x0a3e('0x40')]);_0xd47d46['query']=_['keys'](_0xb0f016['query']);_0xd47d46[_0x0a3e('0x37')]=_[_0x0a3e('0x30')](_0xd47d46['model'],_0xd47d46[_0x0a3e('0x2f')]);_0x26954c[_0x0a3e('0x32')]=_[_0x0a3e('0x30')](_0xd47d46[_0x0a3e('0x2d')],qs[_0x0a3e('0x31')](_0xb0f016[_0x0a3e('0x2f')][_0x0a3e('0x31')]));_0x26954c[_0x0a3e('0x32')]=_0x26954c['attributes'][_0x0a3e('0x33')]?_0x26954c[_0x0a3e('0x32')]:_0xd47d46[_0x0a3e('0x2d')];if(_0xb0f016[_0x0a3e('0x2f')][_0x0a3e('0x3b')]){_0x26954c[_0x0a3e('0x3c')]=[{'all':!![]}];}_0x26954c=_[_0x0a3e('0x39')]({},_0x26954c,_0xb0f016[_0x0a3e('0x3a')]);return db[_0x0a3e('0x29')][_0x0a3e('0x41')](_0x26954c)['then'](handleEntityNotFound(_0x4885d1,null))[_0x0a3e('0xf')](respondWithResult(_0x4885d1,null))['catch'](handleError(_0x4885d1,null));};exports[_0x0a3e('0x42')]=function(_0x5d44bc,_0x19c3a3){return db[_0x0a3e('0x29')][_0x0a3e('0x42')](_0x5d44bc[_0x0a3e('0x43')],{})['then'](respondWithResult(_0x19c3a3,0xc9))['catch'](handleError(_0x19c3a3,null));};exports['update']=function(_0x2917f1,_0x5395ed){if(_0x2917f1[_0x0a3e('0x43')]['id']){delete _0x2917f1[_0x0a3e('0x43')]['id'];}return db[_0x0a3e('0x29')][_0x0a3e('0x41')]({'where':{'id':_0x2917f1[_0x0a3e('0x44')]['id']}})[_0x0a3e('0xf')](handleEntityNotFound(_0x5395ed,null))[_0x0a3e('0xf')](saveUpdates(_0x2917f1[_0x0a3e('0x43')],null))[_0x0a3e('0xf')](respondWithResult(_0x5395ed,null))[_0x0a3e('0x19')](handleError(_0x5395ed,null));};exports[_0x0a3e('0x22')]=function(_0xc6e57b,_0x41b8a0){return db[_0x0a3e('0x29')][_0x0a3e('0x41')]({'where':{'id':_0xc6e57b[_0x0a3e('0x44')]['id']}})[_0x0a3e('0xf')](handleEntityNotFound(_0x41b8a0,null))[_0x0a3e('0xf')](removeEntity(_0x41b8a0,null))[_0x0a3e('0x19')](handleError(_0x41b8a0,null));};exports[_0x0a3e('0x45')]=function(_0x8c93f7,_0x1c3bb2){return db['ChatMessage']['describe']()[_0x0a3e('0xf')](respondWithResult(_0x1c3bb2,null))['catch'](handleError(_0x1c3bb2,null));};exports['accept']=function(_0x33c4f0,_0x232b13){var _0x1d5447=_0x0a3e('0x46');return interactionService['acceptMessage'](_0x33c4f0,_0x1d5447)[_0x0a3e('0xf')](respondWithResult(_0x232b13,null))[_0x0a3e('0x19')](handleError(_0x232b13,null));};exports[_0x0a3e('0x47')]=function(_0x1bf39c,_0x1a1b62){var _0x455408={'agent':{},'channel':_0x0a3e('0x46')};if(_0x1bf39c[_0x0a3e('0x43')]['id']){delete _0x1bf39c[_0x0a3e('0x43')]['id'];}_0x1bf39c['body']['UserId']=_0x1bf39c[_0x0a3e('0x43')][_0x0a3e('0x48')]||_0x1bf39c[_0x0a3e('0x49')]['id'];_0x455408[_0x0a3e('0x4a')]['id']=_0x1bf39c[_0x0a3e('0x43')]['UserId'];return db[_0x0a3e('0x29')][_0x0a3e('0x41')]({'where':{'id':_0x1bf39c[_0x0a3e('0x44')]['id'],'UserId':null}})[_0x0a3e('0xf')](handleEntityNotFound(_0x1a1b62,null))[_0x0a3e('0xf')](function(_0x5295e3){if(_0x5295e3){_0x455408[_0x0a3e('0x17')]=_0x5295e3['get']({'plain':!![]});return db[_0x0a3e('0x4b')][_0x0a3e('0x41')]({'where':{'id':_0x5295e3[_0x0a3e('0x4c')]}});}return null;})['then'](handleEntityNotFound(_0x1a1b62,null))['then'](function(_0x31b2d6){if(_0x31b2d6){_0x455408[_0x0a3e('0x4d')]=_0x31b2d6[_0x0a3e('0x4e')]({'plain':!![]});interaction_log[_0x0a3e('0x4f')](_0x0a3e('0x50'),_0x1bf39c[_0x0a3e('0x49')]['id'],_0x1bf39c[_0x0a3e('0x49')][_0x0a3e('0x26')],_0x1bf39c[_0x0a3e('0x49')][_0x0a3e('0x51')],_0x455408['interaction']['id'],_0x1bf39c[_0x0a3e('0x43')]?JSON[_0x0a3e('0x14')](_0x1bf39c[_0x0a3e('0x43')]):'null');return respondWithRpcPromise(_0x0a3e('0x52'),_0x0a3e('0x53'),_0x455408);}return null;})[_0x0a3e('0xf')](function(_0xf0cfd8){var _0x204c7d=_0x0a3e('0x54')+_0xf0cfd8[_0x0a3e('0x17')][_0x0a3e('0x55')];return db[_0x0a3e('0x56')][_0x0a3e('0x2f')](_0x204c7d,{'type':db[_0x0a3e('0x57')][_0x0a3e('0x58')][_0x0a3e('0x59')],'raw':!![]})[_0x0a3e('0xf')](function(_0x48aab8){return _0x48aab8;});})[_0x0a3e('0xf')](function(_0x8a466){if(_0x8a466){_0x455408['message'][_0x0a3e('0x5a')]=_0x8a466[0x0];if(!_0x1bf39c['body'][_0x0a3e('0x48')])return;return db[_0x0a3e('0x5b')][_0x0a3e('0x41')]({'where':{'id':_0x1bf39c[_0x0a3e('0x43')][_0x0a3e('0x48')],'role':_0x0a3e('0x4a')},'attributes':['id',_0x0a3e('0x26'),_0x0a3e('0x5c'),_0x0a3e('0x5d'),_0x0a3e('0x5e')],'raw':!![]});}return null;})[_0x0a3e('0xf')](function(_0x479373){if(!_0x479373)return null;_0x455408[_0x0a3e('0x17')]['agent']=_0x479373;return _0x455408;})[_0x0a3e('0xf')](function(_0x1045da){if(_0x1045da){_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x5f')]=util[_0x0a3e('0x60')](_0x0a3e('0x61'),_0x1bf39c[_0x0a3e('0x49')][_0x0a3e('0x26')]);_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x62')]=_0x455408['channel'];_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x63')]=_0x455408['channel'];_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x64')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_[_0x0a3e('0x39')](_0x455408[_0x0a3e('0x17')],JSON[_0x0a3e('0x65')](_0x455408[_0x0a3e('0x4d')][_0x0a3e('0x66')]))},client9002);return _0x455408;}return null;})['then'](respondWithResult(_0x1a1b62,null))[_0x0a3e('0x19')](handleError(_0x1a1b62,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index eee7d1f..fe1cae2 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 _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 +var _0xab7b=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2a622b,_0x42665c){var _0x104aa1=function(_0x24e6f8){while(--_0x24e6f8){_0x2a622b['push'](_0x2a622b['shift']());}};_0x104aa1(++_0x42665c);}(_0xab7b,0x171));var _0xbab7=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0xab7b[_0x3a1972];return _0xc7e0b5;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xbab7('0x0'))['db'][_0xbab7('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbab7('0x2')](0x0);var events={'afterCreate':_0xbab7('0x3'),'afterUpdate':_0xbab7('0x4'),'afterDestroy':_0xbab7('0x5')};function emitEvent(_0x1e8a22){return function(_0x12b305,_0x157a47,_0x181a71){ChatMessageEvents[_0xbab7('0x6')](_0x1e8a22+':'+_0x12b305['id'],_0x12b305);ChatMessageEvents[_0xbab7('0x6')](_0x1e8a22,_0x12b305);_0x181a71(null);};}for(var e in events){if(events[_0xbab7('0x7')](e)){var event=events[e];ChatMessage[_0xbab7('0x8')](e,emitEvent(event));}}module[_0xbab7('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a1168d6..af807de 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 _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 +var _0xb806=['then','update','catch','error','utf8mb4_unicode_ci','lodash','api','moment','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne'];(function(_0x40ffbd,_0xacc000){var _0x4f65ee=function(_0x4c057f){while(--_0x4c057f){_0x40ffbd['push'](_0x40ffbd['shift']());}};_0x4f65ee(++_0xacc000);}(_0xb806,0x95));var _0x6b80=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xb806[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0x6b80('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b80('0x1'));var moment=require(_0x6b80('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b80('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b80('0x4'));module[_0x6b80('0x5')]=function(_0x2ab150,_0x520aef){return _0x2ab150[_0x6b80('0x6')](_0x6b80('0x7'),attributes,{'tableName':_0x6b80('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x6b80('0x9')],'type':_0x6b80('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x44bdc3,_0x2282b6,_0x415fdb){var _0xbe1b37=_0x2ab150[_0x6b80('0xb')];var _0x462f02=_0x44bdc3[_0x6b80('0xc')]({'plain':!![]});if(_0x462f02[_0x6b80('0xd')][_0x6b80('0xe')]()==='in'||_0x462f02[_0x6b80('0xd')][_0x6b80('0xe')]()==='out'&&!_0x462f02[_0x6b80('0xf')]&&!_['isNil'](_0x462f02[_0x6b80('0x10')])){_0xbe1b37[_0x6b80('0x11')][_0x6b80('0x12')]({'where':{'id':_0x462f02['ChatInteractionId']}})[_0x6b80('0x13')](function(_0x28218d){if(_0x28218d){_0x28218d[_0x6b80('0x14')]({'lastMsgAt':_0x462f02['createdAt'],'lastMsgDirection':_0x462f02[_0x6b80('0xd')]['toLowerCase']()});}})[_0x6b80('0x15')](function(_0x20dcd6){console[_0x6b80('0x16')](_0x20dcd6);});}_0x415fdb();}},'charset':'utf8mb4','collate':_0x6b80('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7cdd5bc..95d7b39 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 _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 +var _0x8163=['ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./chatMessage.socket','register','request','then','info'];(function(_0x3fc837,_0x3f57d4){var _0x51f292=function(_0xc70386){while(--_0xc70386){_0x3fc837['push'](_0x3fc837['shift']());}};_0x51f292(++_0x3f57d4);}(_0x8163,0x11b));var _0x3816=function(_0x3b6f46,_0x6b0d76){_0x3b6f46=_0x3b6f46-0x0;var _0x26c584=_0x8163[_0x3b6f46];return _0x26c584;};'use strict';var _=require(_0x3816('0x0'));var util=require(_0x3816('0x1'));var moment=require(_0x3816('0x2'));var BPromise=require(_0x3816('0x3'));var rs=require(_0x3816('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3816('0x5'));var logger=require('../../config/logger')(_0x3816('0x6'));var config=require(_0x3816('0x7'));var jayson=require(_0x3816('0x8'));var client=jayson['client'][_0x3816('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3816('0xa')],{'host':_0x3816('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3816('0xa')]));require(_0x3816('0xc'))[_0x3816('0xd')](socket);function respondWithRpcPromise(_0x393ac6,_0x571961,_0xac572c){return new BPromise(function(_0x288e33,_0x3cf618){return client[_0x3816('0xe')](_0x393ac6,_0xac572c)[_0x3816('0xf')](function(_0x3c9e1e){logger[_0x3816('0x10')](_0x3816('0x11'),_0x571961,_0x3816('0x12'));logger['debug'](_0x3816('0x13'),_0x571961,'request\x20sent',JSON[_0x3816('0x14')](_0x3c9e1e));if(_0x3c9e1e[_0x3816('0x15')]){if(_0x3c9e1e[_0x3816('0x15')]['code']===0x1f4){logger[_0x3816('0x15')](_0x3816('0x11'),_0x571961,_0x3c9e1e[_0x3816('0x15')][_0x3816('0x16')]);return _0x3cf618(_0x3c9e1e[_0x3816('0x15')]['message']);}logger[_0x3816('0x15')](_0x3816('0x11'),_0x571961,_0x3c9e1e['error'][_0x3816('0x16')]);return _0x288e33(_0x3c9e1e['error'][_0x3816('0x16')]);}else{logger['info'](_0x3816('0x11'),_0x571961,_0x3816('0x12'));_0x288e33(_0x3c9e1e[_0x3816('0x17')][_0x3816('0x16')]);}})[_0x3816('0x18')](function(_0x38b5b9){logger[_0x3816('0x15')](_0x3816('0x11'),_0x571961,_0x38b5b9);_0x3cf618(_0x38b5b9);});});}exports[_0x3816('0x19')]=function(_0x4eec4a){var _0x4190c5=this;return new Promise(function(_0x3d3872,_0x568e12){return db['ChatMessage'][_0x3816('0x1a')](_0x4eec4a[_0x3816('0x1b')],{'raw':_0x4eec4a[_0x3816('0x1c')]?_0x4eec4a['options'][_0x3816('0x1d')]===undefined?!![]:![]:!![]})[_0x3816('0xf')](function(_0x19fabf){logger[_0x3816('0x10')](_0x3816('0x19'),_0x4eec4a);logger['debug']('CreateChatMessage',_0x4eec4a,JSON[_0x3816('0x14')](_0x19fabf));_0x3d3872(_0x19fabf);})[_0x3816('0x18')](function(_0x7fd0d7){logger[_0x3816('0x15')](_0x3816('0x19'),_0x7fd0d7[_0x3816('0x16')],_0x4eec4a);_0x568e12(_0x4190c5[_0x3816('0x15')](0x1f4,_0x7fd0d7[_0x3816('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6767aca..3f7cbef 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 _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 +var _0xfc17=['emit','removeListener','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x397b11,_0x387927){var _0x1ad3df=function(_0x2fea4e){while(--_0x2fea4e){_0x397b11['push'](_0x397b11['shift']());}};_0x1ad3df(++_0x387927);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x200b5f,_0x51adf6){_0x200b5f=_0x200b5f-0x0;var _0x23d840=_0xfc17[_0x200b5f];return _0x23d840;};'use strict';var ChatMessageEvents=require(_0x7fc1('0x0'));var events=[_0x7fc1('0x1'),_0x7fc1('0x2'),_0x7fc1('0x3')];function createListener(_0x524e76,_0x184a4d){return function(_0x3bbf44){_0x184a4d[_0x7fc1('0x4')](_0x524e76,_0x3bbf44);};}function removeListener(_0x1f6079,_0x44101d){return function(){ChatMessageEvents[_0x7fc1('0x5')](_0x1f6079,_0x44101d);};}exports['register']=function(_0x30f5f8){for(var _0x1867ea=0x0,_0x2267ea=events[_0x7fc1('0x6')];_0x1867ea<_0x2267ea;_0x1867ea++){var _0x24c678=events[_0x1867ea];var _0x1b7106=createListener(_0x7fc1('0x7')+_0x24c678,_0x30f5f8);ChatMessageEvents['on'](_0x24c678,_0x1b7106);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0b48e82..96558f6 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 _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 +var _0x7e13=['reject','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7e13,0xb1));var _0x37e1=function(_0x39bd2d,_0x333d60){_0x39bd2d=_0x39bd2d-0x0;var _0x3edaf9=_0x7e13[_0x39bd2d];return _0x3edaf9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x37e1('0x0'));var timeout=require(_0x37e1('0x1'));var express=require(_0x37e1('0x2'));var router=express[_0x37e1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x37e1('0x4'));var interaction=require(_0x37e1('0x5'));var config=require(_0x37e1('0x6'));var controller=require(_0x37e1('0x7'));router[_0x37e1('0x8')]('/',auth['isAuthenticated'](),controller[_0x37e1('0x9')]);router[_0x37e1('0x8')](_0x37e1('0xa'),auth[_0x37e1('0xb')](),controller[_0x37e1('0xc')]);router[_0x37e1('0x8')](_0x37e1('0xd'),auth[_0x37e1('0xb')](),controller[_0x37e1('0xe')]);router['post']('/',auth[_0x37e1('0xb')](),interaction[_0x37e1('0xf')](_0x37e1('0x10'),_0x37e1('0x11')),controller[_0x37e1('0x12')]);router[_0x37e1('0x13')]('/:id',controller[_0x37e1('0x14')]);router[_0x37e1('0x13')](_0x37e1('0x15'),auth[_0x37e1('0xb')](),controller['accept']);router[_0x37e1('0x13')](_0x37e1('0x16'),auth[_0x37e1('0xb')](),controller[_0x37e1('0x17')]);router['delete']('/:id',auth[_0x37e1('0xb')](),controller[_0x37e1('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 55044a4..80d457e 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(_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 +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x468658,_0xa6e84a){var _0xe8fbe6=function(_0x55bd79){while(--_0x55bd79){_0x468658['push'](_0x468658['shift']());}};_0xe8fbe6(++_0xa6e84a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5be46a,_0x2fb035){_0x5be46a=_0x5be46a-0x0;var _0x1ce3b8=_0xb10b[_0x5be46a];return _0x1ce3b8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index fa8b822..038b1c1 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(_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 +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x54eea3,_0x681f76){var _0x5937dc=function(_0x357dd4){while(--_0x357dd4){_0x54eea3['push'](_0x54eea3['shift']());}};_0x5937dc(++_0x681f76);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 631db81..09e6fa0 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 _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 +var _0x18c3=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update'];(function(_0x11e1ef,_0x3cbe5e){var _0x125d5b=function(_0x36267f){while(--_0x36267f){_0x11e1ef['push'](_0x11e1ef['shift']());}};_0x125d5b(++_0x3cbe5e);}(_0x18c3,0x136));var _0x318c=function(_0x3bd433,_0x58f9d9){_0x3bd433=_0x3bd433-0x0;var _0x192ad1=_0x18c3[_0x3bd433];return _0x192ad1;};'use strict';var EventEmitter=require(_0x318c('0x0'));var ChatOfflineMessage=require(_0x318c('0x1'))['db'][_0x318c('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x318c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x318c('0x4'),'afterDestroy':_0x318c('0x5')};function emitEvent(_0x4b6690){return function(_0x4bf0fd,_0x907dd5,_0x112aa7){ChatOfflineMessageEvents[_0x318c('0x6')](_0x4b6690+':'+_0x4bf0fd['id'],_0x4bf0fd);ChatOfflineMessageEvents[_0x318c('0x6')](_0x4b6690,_0x4bf0fd);_0x112aa7(null);};}for(var e in events){if(events[_0x318c('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x318c('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 12328b6..bbd1c16 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 _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 +var _0x0529=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0x2245c7,_0x47951d){var _0x267daa=function(_0x21db85){while(--_0x21db85){_0x2245c7['push'](_0x2245c7['shift']());}};_0x267daa(++_0x47951d);}(_0x0529,0x139));var _0x9052=function(_0x1b756c,_0x1622c1){_0x1b756c=_0x1b756c-0x0;var _0x2704c0=_0x0529[_0x1b756c];return _0x2704c0;};'use strict';var attributes=require(_0x9052('0x0'));module['exports']=function(_0x33167e){return _0x33167e[_0x9052('0x1')](_0x9052('0x2'),attributes,{'tableName':_0x9052('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9052('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 042fd9a..c003802 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 _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 +var _0x919b=['ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x27fedb,_0x31c693){var _0x58ab78=function(_0x532732){while(--_0x532732){_0x27fedb['push'](_0x27fedb['shift']());}};_0x58ab78(++_0x31c693);}(_0x919b,0xb7));var _0xb919=function(_0x3527a4,_0x59397f){_0x3527a4=_0x3527a4-0x0;var _0x9f8962=_0x919b[_0x3527a4];return _0x9f8962;};'use strict';var _=require(_0xb919('0x0'));var util=require(_0xb919('0x1'));var moment=require(_0xb919('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb919('0x3'))['db'];var utils=require(_0xb919('0x4'));var logger=require(_0xb919('0x5'))('rpc');var config=require(_0xb919('0x6'));var jayson=require(_0xb919('0x7'));var client=jayson[_0xb919('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6a72,_0x2f3ea1,_0x3132e5){return new BPromise(function(_0x229463,_0x17685d){return client[_0xb919('0x9')](_0x4e6a72,_0x3132e5)[_0xb919('0xa')](function(_0x19956e){logger[_0xb919('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2f3ea1,_0xb919('0xc'));logger['debug'](_0xb919('0xd'),_0x2f3ea1,_0xb919('0xc'),JSON[_0xb919('0xe')](_0x19956e));if(_0x19956e['error']){if(_0x19956e[_0xb919('0xf')][_0xb919('0x10')]===0x1f4){logger[_0xb919('0xf')](_0xb919('0x11'),_0x2f3ea1,_0x19956e['error'][_0xb919('0x12')]);return _0x17685d(_0x19956e['error'][_0xb919('0x12')]);}logger['error'](_0xb919('0x11'),_0x2f3ea1,_0x19956e[_0xb919('0xf')][_0xb919('0x12')]);return _0x229463(_0x19956e['error'][_0xb919('0x12')]);}else{logger[_0xb919('0xb')](_0xb919('0x11'),_0x2f3ea1,_0xb919('0xc'));_0x229463(_0x19956e['result']['message']);}})[_0xb919('0x13')](function(_0xeba921){logger[_0xb919('0xf')](_0xb919('0x11'),_0x2f3ea1,_0xeba921);_0x17685d(_0xeba921);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f5e419e..d8b6473 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 _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 +var _0x0fb6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0x0fb6,0x181));var _0x60fb=function(_0x1d8b88,_0x1854e3){_0x1d8b88=_0x1d8b88-0x0;var _0x4bf7e0=_0x0fb6[_0x1d8b88];return _0x4bf7e0;};'use strict';var multer=require(_0x60fb('0x0'));var util=require(_0x60fb('0x1'));var path=require(_0x60fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x60fb('0x3'));var router=express[_0x60fb('0x4')]();var fs_extra=require(_0x60fb('0x5'));var auth=require(_0x60fb('0x6'));var interaction=require(_0x60fb('0x7'));var config=require(_0x60fb('0x8'));var controller=require(_0x60fb('0x9'));router[_0x60fb('0xa')]('/',auth[_0x60fb('0xb')](),controller[_0x60fb('0xc')]);router[_0x60fb('0xa')](_0x60fb('0xd'),auth[_0x60fb('0xb')](),controller[_0x60fb('0xe')]);router[_0x60fb('0xa')](_0x60fb('0xf'),auth[_0x60fb('0xb')](),controller['show']);router[_0x60fb('0x10')]('/',auth[_0x60fb('0xb')](),controller[_0x60fb('0x11')]);router[_0x60fb('0x12')]('/:id',auth[_0x60fb('0xb')](),controller[_0x60fb('0x13')]);router[_0x60fb('0x14')](_0x60fb('0xf'),auth[_0x60fb('0xb')](),controller[_0x60fb('0x15')]);module[_0x60fb('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 8d46492..c22a9a3 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 _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 +var _0xb5ec=['mouseOver','sequelize','exports','STRING','timeout'];(function(_0x51f3ee,_0x55c355){var _0x2c7762=function(_0x5f477b){while(--_0x5f477b){_0x51f3ee['push'](_0x51f3ee['shift']());}};_0x2c7762(++_0x55c355);}(_0xb5ec,0x15f));var _0xcb5e=function(_0x434b64,_0x308507){_0x434b64=_0x434b64-0x0;var _0x451dae=_0xb5ec[_0x434b64];return _0x451dae;};'use strict';var Sequelize=require(_0xcb5e('0x0'));module[_0xcb5e('0x1')]={'name':{'type':Sequelize[_0xcb5e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xcb5e('0x3')),'defaultValue':_0xcb5e('0x4')},'selector':{'type':Sequelize[_0xcb5e('0x2')]},'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 d16feb4..182a42c 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 _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 +var _0x3f27=['find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','end','error','stack','name','send','params','model','keys','ChatProactiveAction','query','intersection','attributes','length','includeAll','include','options'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x3f27,0x1f4));var _0x73f2=function(_0x222335,_0x134d98){_0x222335=_0x222335-0x0;var _0x1acb89=_0x3f27[_0x222335];return _0x1acb89;};'use strict';var emlformat=require(_0x73f2('0x0'));var rimraf=require(_0x73f2('0x1'));var zipdir=require(_0x73f2('0x2'));var jsonpatch=require(_0x73f2('0x3'));var rp=require(_0x73f2('0x4'));var moment=require('moment');var BPromise=require(_0x73f2('0x5'));var Mustache=require(_0x73f2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73f2('0x7'));var ejs=require(_0x73f2('0x8'));var fs=require('fs');var fs_extra=require(_0x73f2('0x9'));var _=require(_0x73f2('0xa'));var squel=require(_0x73f2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73f2('0xc'));var toCsv=require(_0x73f2('0x7'));var querystring=require(_0x73f2('0xd'));var Papa=require(_0x73f2('0xe'));var Redis=require(_0x73f2('0xf'));var authService=require(_0x73f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73f2('0x11'));var hardwareService=require(_0x73f2('0x12'));var logger=require(_0x73f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73f2('0x14'));var db=require(_0x73f2('0x15'))['db'];function respondWithStatusCode(_0x20d4f3,_0x25e1bc){_0x25e1bc=_0x25e1bc||0xcc;return function(_0x454352){if(_0x454352){return _0x20d4f3[_0x73f2('0x16')](_0x25e1bc);}return _0x20d4f3[_0x73f2('0x17')](_0x25e1bc)['end']();};}function respondWithResult(_0x4d4bd2,_0x469686){_0x469686=_0x469686||0xc8;return function(_0x45e8e0){if(_0x45e8e0){return _0x4d4bd2['status'](_0x469686)['json'](_0x45e8e0);}};}function respondWithFilteredResult(_0x2c0720,_0x39feae){return function(_0x2a1ac6){if(_0x2a1ac6){var _0x262f51=typeof _0x39feae[_0x73f2('0x18')]===_0x73f2('0x19')&&typeof _0x39feae[_0x73f2('0x1a')]===_0x73f2('0x19');var _0x41e10c=_0x2a1ac6[_0x73f2('0x1b')];var _0x1dee61=_0x262f51?0x0:_0x39feae[_0x73f2('0x18')];var _0x2546a0=_0x262f51?_0x2a1ac6['count']:_0x39feae[_0x73f2('0x18')]+_0x39feae[_0x73f2('0x1a')];var _0x13c6ec;if(_0x2546a0>=_0x41e10c){_0x2546a0=_0x41e10c;_0x13c6ec=0xc8;}else{_0x13c6ec=0xce;}_0x2c0720[_0x73f2('0x17')](_0x13c6ec);return _0x2c0720['set'](_0x73f2('0x1c'),_0x1dee61+'-'+_0x2546a0+'/'+_0x41e10c)[_0x73f2('0x1d')](_0x2a1ac6);}return null;};}function patchUpdates(_0x416ead){return function(_0x2ae791){try{jsonpatch['apply'](_0x2ae791,_0x416ead,!![]);}catch(_0xd80727){return BPromise[_0x73f2('0x1e')](_0xd80727);}return _0x2ae791[_0x73f2('0x1f')]();};}function saveUpdates(_0x55416e,_0x4a723b){return function(_0x444b06){if(_0x444b06){return _0x444b06[_0x73f2('0x20')](_0x55416e)[_0x73f2('0x21')](function(_0x5e8f4c){return _0x5e8f4c;});}return null;};}function removeEntity(_0x4844df,_0x11a5da){return function(_0xd5bb3b){if(_0xd5bb3b){return _0xd5bb3b['destroy']()[_0x73f2('0x21')](function(){_0x4844df[_0x73f2('0x17')](0xcc)[_0x73f2('0x22')]();});}};}function handleEntityNotFound(_0x4ecdc7,_0x1b3f34){return function(_0x87e4e4){if(!_0x87e4e4){_0x4ecdc7[_0x73f2('0x16')](0x194);}return _0x87e4e4;};}function handleError(_0x5e06cb,_0x58bd99){_0x58bd99=_0x58bd99||0x1f4;return function(_0x5c52e3){logger[_0x73f2('0x23')](_0x5c52e3[_0x73f2('0x24')]);if(_0x5c52e3[_0x73f2('0x25')]){delete _0x5c52e3[_0x73f2('0x25')];}_0x5e06cb[_0x73f2('0x17')](_0x58bd99)[_0x73f2('0x26')](_0x5c52e3);};}exports['show']=function(_0x2840f0,_0xf0e828){var _0x4a90ac={'raw':!![],'where':{'id':_0x2840f0[_0x73f2('0x27')]['id']}},_0x21b18={};_0x21b18[_0x73f2('0x28')]=_[_0x73f2('0x29')](db[_0x73f2('0x2a')]['rawAttributes']);_0x21b18[_0x73f2('0x2b')]=_[_0x73f2('0x29')](_0x2840f0['query']);_0x21b18['filters']=_[_0x73f2('0x2c')](_0x21b18[_0x73f2('0x28')],_0x21b18[_0x73f2('0x2b')]);_0x4a90ac['attributes']=_['intersection'](_0x21b18['model'],qs['fields'](_0x2840f0[_0x73f2('0x2b')]['fields']));_0x4a90ac[_0x73f2('0x2d')]=_0x4a90ac[_0x73f2('0x2d')][_0x73f2('0x2e')]?_0x4a90ac[_0x73f2('0x2d')]:_0x21b18['model'];if(_0x2840f0[_0x73f2('0x2b')][_0x73f2('0x2f')]){_0x4a90ac[_0x73f2('0x30')]=[{'all':!![]}];}_0x4a90ac=_['merge']({},_0x4a90ac,_0x2840f0[_0x73f2('0x31')]);return db[_0x73f2('0x2a')][_0x73f2('0x32')](_0x4a90ac)['then'](handleEntityNotFound(_0xf0e828,null))[_0x73f2('0x21')](respondWithResult(_0xf0e828,null))[_0x73f2('0x33')](handleError(_0xf0e828,null));};exports[_0x73f2('0x34')]=function(_0x2ba1ec,_0x3f50b2){return db[_0x73f2('0x2a')][_0x73f2('0x34')](_0x2ba1ec[_0x73f2('0x35')],{})[_0x73f2('0x21')](respondWithResult(_0x3f50b2,0xc9))['catch'](handleError(_0x3f50b2,null));};exports['update']=function(_0x54a21f,_0x379cee){if(_0x54a21f[_0x73f2('0x35')]['id']){delete _0x54a21f[_0x73f2('0x35')]['id'];}return db['ChatProactiveAction'][_0x73f2('0x32')]({'where':{'id':_0x54a21f[_0x73f2('0x27')]['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x379cee,null))[_0x73f2('0x21')](saveUpdates(_0x54a21f[_0x73f2('0x35')],null))['then'](respondWithResult(_0x379cee,null))[_0x73f2('0x33')](handleError(_0x379cee,null));};exports[_0x73f2('0x36')]=function(_0xde2a1c,_0x42e3b5){return db[_0x73f2('0x2a')][_0x73f2('0x32')]({'where':{'id':_0xde2a1c['params']['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x42e3b5,null))['then'](removeEntity(_0x42e3b5,null))[_0x73f2('0x33')](handleError(_0x42e3b5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 3f93431..af44814 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 _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 +var _0xc48b=['chat_proactive_actions','lodash','../../config/logger','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x2021e4,_0x2ba7de){var _0x28452a=function(_0x4e73a9){while(--_0x4e73a9){_0x2021e4['push'](_0x2021e4['shift']());}};_0x28452a(++_0x2ba7de);}(_0xc48b,0x6f));var _0xbc48=function(_0xd49e15,_0x5e34ac){_0xd49e15=_0xd49e15-0x0;var _0x306b6a=_0xc48b[_0xd49e15];return _0x306b6a;};'use strict';var _=require(_0xbc48('0x0'));var util=require('util');var logger=require(_0xbc48('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc48('0x2'));var fs=require('fs');var path=require(_0xbc48('0x3'));var rimraf=require(_0xbc48('0x4'));var config=require('../../config/environment');var attributes=require(_0xbc48('0x5'));module[_0xbc48('0x6')]=function(_0x4e7d0f,_0x448217){return _0x4e7d0f[_0xbc48('0x7')](_0xbc48('0x8'),attributes,{'tableName':_0xbc48('0x9'),'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 c79c514..564a077 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 _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 +var _0xd654=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','ChatProactiveAction,\x20%s,\x20%s','debug'];(function(_0x335e45,_0x20f8af){var _0x1680d0=function(_0x3e5149){while(--_0x3e5149){_0x335e45['push'](_0x335e45['shift']());}};_0x1680d0(++_0x20f8af);}(_0xd654,0x16d));var _0x4d65=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd654[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x4d65('0x0'));var util=require('util');var moment=require(_0x4d65('0x1'));var BPromise=require(_0x4d65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d65('0x3'));var db=require(_0x4d65('0x4'))['db'];var utils=require(_0x4d65('0x5'));var logger=require(_0x4d65('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4d65('0x7'));var client=jayson[_0x4d65('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa67ade,_0x1aefa5,_0x4236d5){return new BPromise(function(_0x4e8a56,_0x5f7963){return client[_0x4d65('0x9')](_0xa67ade,_0x4236d5)[_0x4d65('0xa')](function(_0x587730){logger['info'](_0x4d65('0xb'),_0x1aefa5,'request\x20sent');logger[_0x4d65('0xc')](_0x4d65('0xd'),_0x1aefa5,_0x4d65('0xe'),JSON['stringify'](_0x587730));if(_0x587730[_0x4d65('0xf')]){if(_0x587730['error']['code']===0x1f4){logger[_0x4d65('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1aefa5,_0x587730['error'][_0x4d65('0x10')]);return _0x5f7963(_0x587730[_0x4d65('0xf')][_0x4d65('0x10')]);}logger[_0x4d65('0xf')](_0x4d65('0xb'),_0x1aefa5,_0x587730[_0x4d65('0xf')]['message']);return _0x4e8a56(_0x587730[_0x4d65('0xf')][_0x4d65('0x10')]);}else{logger[_0x4d65('0x11')](_0x4d65('0xb'),_0x1aefa5,'request\x20sent');_0x4e8a56(_0x587730['result'][_0x4d65('0x10')]);}})['catch'](function(_0x30d397){logger[_0x4d65('0xf')](_0x4d65('0xb'),_0x1aefa5,_0x30d397);_0x5f7963(_0x30d397);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 321c4fa..940332c 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 _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 +var _0x98a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x98a8,0x12c));var _0x898a=function(_0x16c219,_0x297392){_0x16c219=_0x16c219-0x0;var _0x4f3430=_0x98a8[_0x16c219];return _0x4f3430;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')](_0x898a('0xb'),auth['isAuthenticated'](),controller[_0x898a('0xc')]);router['post']('/',auth[_0x898a('0xd')](),controller['create']);router[_0x898a('0xe')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0x11')]);module[_0x898a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 75d0eef..62e95a6 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 _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 +var _0xdb75=['rrmemory','beepall','exports','name','ENUM'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xdb75,0x138));var _0x5db7=function(_0x402baf,_0x1ef0ba){_0x402baf=_0x402baf-0x0;var _0x1974d8=_0xdb75[_0x402baf];return _0x1974d8;};'use strict';var Sequelize=require('sequelize');module[_0x5db7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5db7('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5db7('0x2')](_0x5db7('0x3'),_0x5db7('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index fc38faf..510c6d9 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 _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 +var _0xa263=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','describe','length','hasOwnProperty','order','sort','where','ChatQueueId','filter','merge','options','UserChatQueue','User','UserId','agent','chatPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','findOne','pick','nolimit','addTeams','Team','Agents','voicePause','interface','flatMap','each','findOrCreate','userChatQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','includes','all','compact','transaction','isEmpty','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','show','params','model','query','keys','filters','intersection','attributes','fields','includeAll','find','create','user'];(function(_0x545817,_0x4598d1){var _0x4a9efb=function(_0x295e53){while(--_0x295e53){_0x545817['push'](_0x545817['shift']());}};_0x4a9efb(++_0x4598d1);}(_0xa263,0x145));var _0x3a26=function(_0x4041ee,_0x18a1c3){_0x4041ee=_0x4041ee-0x0;var _0x1b44dc=_0xa263[_0x4041ee];return _0x1b44dc;};'use strict';var BPromise=require(_0x3a26('0x0'));var util=require('util');var _=require(_0x3a26('0x1'));var squel=require(_0x3a26('0x2'));var Redis=require(_0x3a26('0x3'));var qs=require(_0x3a26('0x4'));var logger=require(_0x3a26('0x5'))(_0x3a26('0x6'));var config=require(_0x3a26('0x7'));var db=require(_0x3a26('0x8'))['db'];config[_0x3a26('0x9')]=_[_0x3a26('0xa')](config['redis'],{'host':_0x3a26('0xb'),'port':0x18eb});var socket=require(_0x3a26('0xc'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x3a26('0xd')](socket);function respondWithStatusCode(_0x355e26,_0x3ca0b2){_0x3ca0b2=_0x3ca0b2||0xcc;return function(_0x1c8c2){if(_0x1c8c2){return _0x355e26[_0x3a26('0xe')](_0x3ca0b2);}return _0x355e26[_0x3a26('0xf')](_0x3ca0b2)[_0x3a26('0x10')]();};}function respondWithResult(_0x40f254,_0x44fa4c){_0x44fa4c=_0x44fa4c||0xc8;return function(_0x45b9d7){if(_0x45b9d7){return _0x40f254[_0x3a26('0xf')](_0x44fa4c)[_0x3a26('0x11')](_0x45b9d7);}};}function respondWithFilteredResult(_0x3d30a0,_0x46bfc8){return function(_0x2bfe65){if(_0x2bfe65){var _0x5e3a5c=typeof _0x46bfc8[_0x3a26('0x12')]==='undefined'&&typeof _0x46bfc8[_0x3a26('0x13')]==='undefined';var _0x3e74aa=_0x2bfe65[_0x3a26('0x14')];var _0x11c889=_0x5e3a5c?0x0:_0x46bfc8['offset'];var _0x31a283=_0x5e3a5c?_0x2bfe65[_0x3a26('0x14')]:_0x46bfc8[_0x3a26('0x12')]+_0x46bfc8[_0x3a26('0x13')];var _0x2e49d8;if(_0x31a283>=_0x3e74aa){_0x31a283=_0x3e74aa;_0x2e49d8=0xc8;}else{_0x2e49d8=0xce;}_0x3d30a0[_0x3a26('0xf')](_0x2e49d8);return _0x3d30a0[_0x3a26('0x15')](_0x3a26('0x16'),_0x11c889+'-'+_0x31a283+'/'+_0x3e74aa)[_0x3a26('0x11')](_0x2bfe65);}return null;};}function saveUpdates(_0x56dd52){return function(_0x2e52e1){if(_0x2e52e1){return _0x2e52e1[_0x3a26('0x17')](_0x56dd52)[_0x3a26('0x18')](function(_0xd51007){return _0xd51007;});}return null;};}function removeEntity(_0x5488d5){return function(_0xd7abf3){if(_0xd7abf3){return _0xd7abf3[_0x3a26('0x19')]()[_0x3a26('0x18')](function(){var _0x41faf5=_0xd7abf3[_0x3a26('0x1a')]({'plain':!![]});var _0x4e9636=_0x3a26('0x1b');return db[_0x3a26('0x1c')]['destroy']({'where':{'type':_0x4e9636,'resourceId':_0x41faf5['id']}})[_0x3a26('0x18')](function(){return _0xd7abf3;});})[_0x3a26('0x18')](function(){_0x5488d5[_0x3a26('0xf')](0xcc)[_0x3a26('0x10')]();});}};}function handleEntityNotFound(_0x3e5ab0){return function(_0x479f4a){if(!_0x479f4a){_0x3e5ab0[_0x3a26('0xe')](0x194);}return _0x479f4a;};}function handleError(_0x51ca19,_0xd63e69){_0xd63e69=_0xd63e69||0x1f4;return function(_0x346134){logger[_0x3a26('0x1d')](_0x346134[_0x3a26('0x1e')]);if(_0x346134[_0x3a26('0x1f')]){delete _0x346134[_0x3a26('0x1f')];}_0x51ca19[_0x3a26('0xf')](_0xd63e69)[_0x3a26('0x20')](_0x346134);};}exports[_0x3a26('0x21')]=function(_0x1f48da,_0x377a0c){var _0x1df4cc={};var _0x44955c={'count':0x0,'rows':[]};var _0x21c23a=_[_0x3a26('0x22')](db[_0x3a26('0x23')][_0x3a26('0x24')],function(_0x376e70){return{'name':_0x376e70[_0x3a26('0x25')],'type':_0x376e70[_0x3a26('0x26')][_0x3a26('0x27')]};});_0x1df4cc=qs[_0x3a26('0x28')](_0x21c23a,_0x1f48da);var _0x1e1ffb={'where':_0x1df4cc['where']};return db[_0x3a26('0x23')][_0x3a26('0x14')](_0x1e1ffb)[_0x3a26('0x18')](function(_0x3b5991){_0x44955c['count']=_0x3b5991;_0x1df4cc[_0x3a26('0x29')]=qs[_0x3a26('0x29')](_0x1f48da['query']);return db['ChatQueue'][_0x3a26('0x2a')](_0x1df4cc);})[_0x3a26('0x18')](function(_0x157fbd){_0x44955c['rows']=_0x157fbd;return _0x44955c;})[_0x3a26('0x18')](respondWithFilteredResult(_0x377a0c,_0x1df4cc))['catch'](handleError(_0x377a0c,null));};exports[_0x3a26('0x2b')]=function(_0x20501c,_0xb20ecc){var _0x427c05={'raw':!![],'where':{'id':_0x20501c[_0x3a26('0x2c')]['id']}},_0x4c00c5={};_0x4c00c5[_0x3a26('0x2d')]=_['keys'](db[_0x3a26('0x23')]['rawAttributes']);_0x4c00c5[_0x3a26('0x2e')]=_[_0x3a26('0x2f')](_0x20501c[_0x3a26('0x2e')]);_0x4c00c5[_0x3a26('0x30')]=_[_0x3a26('0x31')](_0x4c00c5['model'],_0x4c00c5[_0x3a26('0x2e')]);_0x427c05[_0x3a26('0x32')]=_[_0x3a26('0x31')](_0x4c00c5[_0x3a26('0x2d')],qs[_0x3a26('0x33')](_0x20501c['query'][_0x3a26('0x33')]));_0x427c05[_0x3a26('0x32')]=_0x427c05[_0x3a26('0x32')]['length']?_0x427c05[_0x3a26('0x32')]:_0x4c00c5[_0x3a26('0x2d')];if(_0x20501c[_0x3a26('0x2e')][_0x3a26('0x34')]){_0x427c05[_0x3a26('0x29')]=[{'all':!![]}];}_0x427c05=_['merge']({},_0x427c05,_0x20501c['options']);return db[_0x3a26('0x23')][_0x3a26('0x35')](_0x427c05)['then'](handleEntityNotFound(_0xb20ecc,null))['then'](respondWithResult(_0xb20ecc,null))['catch'](handleError(_0xb20ecc,null));};exports[_0x3a26('0x36')]=function(_0x2d4cda,_0x3e7e4b){return db[_0x3a26('0x23')][_0x3a26('0x36')](_0x2d4cda['body'],{})['then'](function(_0x2f4c5e){var _0x5a8744=_0x2d4cda[_0x3a26('0x37')][_0x3a26('0x1a')]({'plain':!![]});if(!_0x5a8744)throw new Error(_0x3a26('0x38'));if(_0x5a8744['role']==='user'){var _0x175f4f=_0x2f4c5e[_0x3a26('0x1a')]({'plain':!![]});var _0x58c419='ChatQueues';return db[_0x3a26('0x39')][_0x3a26('0x35')]({'where':{'name':_0x58c419,'userProfileId':_0x5a8744[_0x3a26('0x3a')]},'raw':!![]})[_0x3a26('0x18')](function(_0xaa6cca){if(_0xaa6cca&&_0xaa6cca[_0x3a26('0x3b')]===0x0){return db[_0x3a26('0x1c')][_0x3a26('0x36')]({'name':_0x175f4f[_0x3a26('0x1f')],'resourceId':_0x175f4f['id'],'type':_0xaa6cca[_0x3a26('0x1f')],'sectionId':_0xaa6cca['id']},{})[_0x3a26('0x18')](function(){return _0x2f4c5e;});}else{return _0x2f4c5e;}})['catch'](function(_0x46ca89){logger[_0x3a26('0x1d')](_0x3a26('0x3c'),_0x46ca89);throw _0x46ca89;});}return _0x2f4c5e;})[_0x3a26('0x18')](respondWithResult(_0x3e7e4b,0xc9))[_0x3a26('0x3d')](handleError(_0x3e7e4b,null));};exports[_0x3a26('0x17')]=function(_0x36cc79,_0x3e922b){if(_0x36cc79[_0x3a26('0x3e')]['id']){delete _0x36cc79[_0x3a26('0x3e')]['id'];}return db[_0x3a26('0x23')][_0x3a26('0x35')]({'where':{'id':_0x36cc79[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x3e922b,null))[_0x3a26('0x18')](saveUpdates(_0x36cc79[_0x3a26('0x3e')],null))[_0x3a26('0x18')](respondWithResult(_0x3e922b,null))[_0x3a26('0x3d')](handleError(_0x3e922b,null));};exports['destroy']=function(_0x48022a,_0x3f3021){return db['ChatQueue'][_0x3a26('0x35')]({'where':{'id':_0x48022a['params']['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x3f3021,null))[_0x3a26('0x18')](removeEntity(_0x3f3021,null))[_0x3a26('0x3d')](handleError(_0x3f3021,null));};exports[_0x3a26('0x3f')]=function(_0x35a620,_0x391c8f){return db[_0x3a26('0x23')]['describe']()[_0x3a26('0x18')](respondWithResult(_0x391c8f,null))['catch'](handleError(_0x391c8f,null));};exports['getMembers']=function(_0x364852,_0x26e9af){var _0x3571ef={'raw':!![],'where':{}},_0x392054={},_0x44a87e;return db[_0x3a26('0x23')]['findOne']({'where':{'id':_0x364852[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x26e9af,null))['then'](function(_0x353912){if(_0x353912){_0x44a87e=_0x353912['get']({'plain':!![]});_0x392054[_0x3a26('0x2d')]=_[_0x3a26('0x2f')](db['UserChatQueue'][_0x3a26('0x24')]);_0x392054['query']=_[_0x3a26('0x2f')](_0x364852[_0x3a26('0x2e')]);_0x392054['filters']=_[_0x3a26('0x31')](_0x392054[_0x3a26('0x2d')],_0x392054['query']);_0x3571ef[_0x3a26('0x32')]=_[_0x3a26('0x31')](_0x392054[_0x3a26('0x2d')],qs[_0x3a26('0x33')](_0x364852[_0x3a26('0x2e')][_0x3a26('0x33')]));_0x3571ef['attributes']=_0x3571ef[_0x3a26('0x32')][_0x3a26('0x40')]?_0x3571ef[_0x3a26('0x32')]:_0x392054[_0x3a26('0x2d')];if(!_0x364852['query'][_0x3a26('0x41')]('nolimit')){_0x3571ef[_0x3a26('0x13')]=qs[_0x3a26('0x13')](_0x364852[_0x3a26('0x2e')]['limit']);_0x3571ef['offset']=qs[_0x3a26('0x12')](_0x364852[_0x3a26('0x2e')][_0x3a26('0x12')]);}_0x3571ef[_0x3a26('0x42')]=qs['sort'](_0x364852['query'][_0x3a26('0x43')]);_0x3571ef['where']=qs['filters'](_['pick'](_0x364852[_0x3a26('0x2e')],_0x392054[_0x3a26('0x30')]));_0x3571ef[_0x3a26('0x44')][_0x3a26('0x45')]=_0x353912['id'];if(_0x364852[_0x3a26('0x2e')][_0x3a26('0x46')]){_0x3571ef[_0x3a26('0x44')]=_[_0x3a26('0x47')](_0x3571ef[_0x3a26('0x44')],{'$or':_[_0x3a26('0x22')](_0x3571ef[_0x3a26('0x32')],function(_0x228909){var _0x3653a4={};_0x3653a4[_0x228909]={'$like':'%'+_0x364852[_0x3a26('0x2e')]['filter']+'%'};return _0x3653a4;})});}_0x3571ef=_['merge']({},_0x3571ef,_0x364852[_0x3a26('0x48')]);return db[_0x3a26('0x49')][_0x3a26('0x2a')](_0x3571ef);}})[_0x3a26('0x18')](function(_0xfb27b4){if(_0xfb27b4){return db[_0x3a26('0x4a')]['findAndCountAll']({'where':{'id':_['map'](_0xfb27b4,_0x3a26('0x4b')),'role':_0x3a26('0x4c')},'attributes':['id','name',_0x3a26('0x4d'),'updatedAt',_0x3a26('0x4e')]});}})[_0x3a26('0x18')](function(_0x12dcdf){if(_0x12dcdf){return{'count':_0x12dcdf[_0x3a26('0x14')],'rows':_[_0x3a26('0x22')](_0x12dcdf[_0x3a26('0x4f')],function(_0x2d62f1){return{'membername':_0x2d62f1[_0x3a26('0x1f')],'UserId':_0x2d62f1['id'],'queue_name':_0x44a87e['name'],'ChatQueueId':_0x44a87e['id'],'interface':util[_0x3a26('0x50')](_0x3a26('0x51'),_0x3a26('0x52'),_0x2d62f1[_0x3a26('0x1f')]),'penalty':0x0,'paused':_0x2d62f1[_0x3a26('0x4d')],'createdAt':_0x2d62f1[_0x3a26('0x4e')],'updatedAt':_0x2d62f1[_0x3a26('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a26('0x18')](respondWithFilteredResult(_0x26e9af,_0x3571ef))[_0x3a26('0x3d')](handleError(_0x26e9af,null));};exports[_0x3a26('0x54')]=function(_0x5702ba,_0x5b0246){var _0x4d828f={};var _0xf59c7c={};var _0x429323;var _0x35c051;return db[_0x3a26('0x23')][_0x3a26('0x55')]({'where':{'id':_0x5702ba['params']['id']}})['then'](handleEntityNotFound(_0x5b0246,null))['then'](function(_0xe53194){if(_0xe53194){_0x429323=_0xe53194;_0xf59c7c[_0x3a26('0x2d')]=_[_0x3a26('0x2f')](db['Team'][_0x3a26('0x24')]);_0xf59c7c[_0x3a26('0x2e')]=_[_0x3a26('0x2f')](_0x5702ba[_0x3a26('0x2e')]);_0xf59c7c[_0x3a26('0x30')]=_['intersection'](_0xf59c7c[_0x3a26('0x2d')],_0xf59c7c[_0x3a26('0x2e')]);_0x4d828f[_0x3a26('0x32')]=_[_0x3a26('0x31')](_0xf59c7c[_0x3a26('0x2d')],qs['fields'](_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x33')]));_0x4d828f[_0x3a26('0x32')]=_0x4d828f[_0x3a26('0x32')][_0x3a26('0x40')]?_0x4d828f['attributes']:_0xf59c7c['model'];_0x4d828f[_0x3a26('0x42')]=qs[_0x3a26('0x43')](_0x5702ba[_0x3a26('0x2e')]['sort']);_0x4d828f['where']=qs['filters'](_[_0x3a26('0x56')](_0x5702ba[_0x3a26('0x2e')],_0xf59c7c['filters']));if(_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x46')]){_0x4d828f[_0x3a26('0x44')]=_['merge'](_0x4d828f['where'],{'$or':_[_0x3a26('0x22')](_0x4d828f[_0x3a26('0x32')],function(_0x2d3dcc){var _0x187546={};_0x187546[_0x2d3dcc]={'$like':'%'+_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x46')]+'%'};return _0x187546;})});}_0x4d828f=_['merge']({},_0x4d828f,_0x5702ba['options']);return _0x429323['getTeams'](_0x4d828f);}})[_0x3a26('0x18')](function(_0x4c7c0b){if(_0x4c7c0b){_0x35c051=_0x4c7c0b[_0x3a26('0x40')];if(!_0x5702ba[_0x3a26('0x2e')]['hasOwnProperty'](_0x3a26('0x57'))){_0x4d828f[_0x3a26('0x13')]=qs[_0x3a26('0x13')](_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x13')]);_0x4d828f[_0x3a26('0x12')]=qs[_0x3a26('0x12')](_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x12')]);}return _0x429323[_0x3a26('0x54')](_0x4d828f);}})[_0x3a26('0x18')](function(_0x112be8){if(_0x112be8){return _0x112be8?{'count':_0x35c051,'rows':_0x112be8}:null;}})[_0x3a26('0x18')](respondWithResult(_0x5b0246,null))[_0x3a26('0x3d')](handleError(_0x5b0246,null));};exports[_0x3a26('0x58')]=function(_0xddee1a,_0x55d301){var _0x591da8=_0xddee1a[_0x3a26('0x3e')]['ids'];return db[_0x3a26('0x59')][_0x3a26('0x2a')]({'where':{'id':_0x591da8},'attributes':['id'],'include':[{'model':db[_0x3a26('0x4a')],'as':_0x3a26('0x5a'),'attributes':['id',_0x3a26('0x1f'),'online',_0x3a26('0x5b'),_0x3a26('0x5c')],'raw':!![]}]})[_0x3a26('0x18')](function(_0x56f600){if(_0x56f600){var _0x310064=_[_0x3a26('0x5d')](_0x56f600,function(_0x2dbbb1){var _0x190dc6=_0x2dbbb1[_0x3a26('0x1a')]({'plain':!![]});return _0x190dc6[_0x3a26('0x5a')];});return db[_0x3a26('0x23')]['find']({'where':{'id':_0xddee1a[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](function(_0x66a738){return db['sequelize']['transaction'](function(_0x4f5ced){return _0x66a738[_0x3a26('0x58')](_0x591da8,{'transaction':_0x4f5ced})['then'](function(){return BPromise[_0x3a26('0x5e')](_0x310064,function(_0x164d7d){return db[_0x3a26('0x49')][_0x3a26('0x5f')]({'where':{'UserId':_0x164d7d['id'],'ChatQueueId':_0xddee1a[_0x3a26('0x2c')]['id']},'transaction':_0x4f5ced});});})['then'](function(){_0x310064['forEach'](function(_0x2d7a19){socket['emit'](_0x3a26('0x60'),{'UserId':_0x2d7a19['id'],'ChatQueueId':_0x66a738['id']});});});});});}})[_0x3a26('0x18')](respondWithStatusCode(_0x55d301,null))[_0x3a26('0x3d')](handleError(_0x55d301,null));};exports[_0x3a26('0x61')]=function(_0x587b19,_0x506415){return db[_0x3a26('0x59')][_0x3a26('0x2a')]({'where':{'id':_0x587b19[_0x3a26('0x2e')][_0x3a26('0x62')]},'attributes':['id'],'include':[{'model':db[_0x3a26('0x4a')],'as':_0x3a26('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x3a26('0x18')](handleEntityNotFound(_0x506415,null))['then'](function(_0x5d3953){var _0x2897da=_[_0x3a26('0x22')](_0x5d3953,'id');var _0x57ff45=[];var _0x567012=[];var _0x9b89a0=squel[_0x3a26('0x63')]();_0x9b89a0['field'](_0x3a26('0x64'))[_0x3a26('0x65')](_0x3a26('0x66'),'tq')[_0x3a26('0x67')](_0x3a26('0x68'),'ut',_0x3a26('0x69'))[_0x3a26('0x44')](_0x3a26('0x6a'),_0x587b19[_0x3a26('0x2c')]['id']);for(var _0x438a37=0x0;_0x438a37<_0x5d3953[_0x3a26('0x40')];_0x438a37+=0x1){let _0x506566=_0x5d3953[_0x438a37];for(var _0x6464e0=0x0;_0x6464e0<_0x506566[_0x3a26('0x5a')][_0x3a26('0x40')];_0x6464e0+=0x1){let _0x454656=_0x506566['Agents'][_0x6464e0];var _0x677481=_0x9b89a0[_0x3a26('0x6b')]();_0x677481['where'](_0x3a26('0x6c'),_0x454656['id']);_0x567012['push'](db[_0x3a26('0x6d')][_0x3a26('0x2e')](_0x677481[_0x3a26('0x6e')](),{'type':db[_0x3a26('0x6d')]['QueryTypes'][_0x3a26('0x6f')]})['then'](function(_0x3cec38){if(_0x3cec38[_0x3a26('0x40')]===0x1){return _0x454656['id'];}else{var _0x9efea6=_[_0x3a26('0x70')](_[_0x3a26('0x22')](_0x3cec38,'TeamId'),function(_0x38c152){return _[_0x3a26('0x71')](_0x2897da,_0x38c152);});if(_0x9efea6){return _0x454656['id'];}}}));}}return BPromise[_0x3a26('0x72')](_0x567012)[_0x3a26('0x18')](function(_0x46bf90){_0x57ff45=_(_0x57ff45)['union'](_0x46bf90)[_0x3a26('0x73')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x587b19[_0x3a26('0x2c')]['id']}})['then'](function(_0x11a53b){return db[_0x3a26('0x6d')][_0x3a26('0x74')](function(_0x11f1b9){return _0x11a53b['removeTeams'](_0x587b19['query'][_0x3a26('0x62')],{'transaction':_0x11f1b9})[_0x3a26('0x18')](function(){if(!_[_0x3a26('0x75')](_0x57ff45)){return _0x11a53b[_0x3a26('0x76')](_0x57ff45,{'transaction':_0x11f1b9});}})[_0x3a26('0x18')](function(){_0x57ff45[_0x3a26('0x77')](function(_0x532dbc){socket[_0x3a26('0x78')]('userChatQueue:remove',{'UserId':_0x532dbc,'ChatQueueId':_0x11a53b['id']});});});});});});})[_0x3a26('0x18')](respondWithStatusCode(_0x506415,null))[_0x3a26('0x3d')](handleError(_0x506415,null));};exports[_0x3a26('0x79')]=function(_0x5d7f05,_0x1f7b3e){return db[_0x3a26('0x23')][_0x3a26('0x35')]({'where':{'id':_0x5d7f05[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x1f7b3e,null))[_0x3a26('0x18')](function(_0x2579d8){if(_0x2579d8){return _0x2579d8[_0x3a26('0x79')](_0x5d7f05[_0x3a26('0x3e')]['ids'],_[_0x3a26('0x7a')](_0x5d7f05[_0x3a26('0x3e')],[_0x3a26('0x62'),'id'])||{})[_0x3a26('0x7b')](function(_0xe04e65){for(var _0x3f8bdd=0x0;_0x3f8bdd<_0x5d7f05['body'][_0x3a26('0x62')][_0x3a26('0x40')];_0x3f8bdd+=0x1){socket[_0x3a26('0x78')](_0x3a26('0x60'),{'UserId':Number(_0x5d7f05['body']['ids'][_0x3f8bdd]),'ChatQueueId':Number(_0x5d7f05['params']['id'])});}return _0xe04e65;});}})[_0x3a26('0x18')](respondWithResult(_0x1f7b3e,null))['catch'](handleError(_0x1f7b3e,null));};exports[_0x3a26('0x76')]=function(_0x477607,_0x44c56b){return db[_0x3a26('0x23')][_0x3a26('0x35')]({'where':{'id':_0x477607[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x44c56b,null))[_0x3a26('0x18')](function(_0x1af95c){if(_0x1af95c){return _0x1af95c[_0x3a26('0x76')](_0x477607[_0x3a26('0x2e')][_0x3a26('0x62')])[_0x3a26('0x18')](function(){if(_[_0x3a26('0x7c')](_0x477607['query']['ids'])){for(var _0x210f2e=0x0;_0x210f2e<_0x477607[_0x3a26('0x2e')][_0x3a26('0x62')][_0x3a26('0x40')];_0x210f2e+=0x1){socket[_0x3a26('0x78')](_0x3a26('0x7d'),{'UserId':Number(_0x477607[_0x3a26('0x2e')][_0x3a26('0x62')][_0x210f2e]),'ChatQueueId':Number(_0x477607[_0x3a26('0x2c')]['id'])});}}else{socket['emit'](_0x3a26('0x7d'),{'UserId':Number(_0x477607['query'][_0x3a26('0x62')]),'ChatQueueId':Number(_0x477607[_0x3a26('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x44c56b,null))[_0x3a26('0x3d')](handleError(_0x44c56b,null));};exports[_0x3a26('0x7e')]=function(_0x543945,_0x3269a7){var _0x2bdd9e={};var _0x437676={};var _0x2f480f;var _0x40ade4;return db['ChatQueue'][_0x3a26('0x55')]({'where':{'id':_0x543945[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x3269a7,null))['then'](function(_0x232e42){if(_0x232e42){_0x2f480f=_0x232e42;_0x437676[_0x3a26('0x2d')]=_['keys'](db['User'][_0x3a26('0x24')]);_0x437676['query']=_['keys'](_0x543945[_0x3a26('0x2e')]);_0x437676[_0x3a26('0x30')]=_['intersection'](_0x437676[_0x3a26('0x2d')],_0x437676[_0x3a26('0x2e')]);_0x2bdd9e[_0x3a26('0x32')]=_['intersection'](_0x437676[_0x3a26('0x2d')],qs[_0x3a26('0x33')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x33')]));_0x2bdd9e[_0x3a26('0x32')]=_0x2bdd9e[_0x3a26('0x32')][_0x3a26('0x40')]?_0x2bdd9e['attributes']:_0x437676['model'];_0x2bdd9e['order']=qs[_0x3a26('0x43')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x43')]);_0x2bdd9e[_0x3a26('0x44')]=qs['filters'](_[_0x3a26('0x56')](_0x543945[_0x3a26('0x2e')],_0x437676[_0x3a26('0x30')]));if(_0x543945[_0x3a26('0x2e')]['filter']){_0x2bdd9e['where']=_['merge'](_0x2bdd9e[_0x3a26('0x44')],{'$or':_['map'](_0x2bdd9e['attributes'],function(_0x460ddc){var _0x3c60c0={};_0x3c60c0[_0x460ddc]={'$like':'%'+_0x543945[_0x3a26('0x2e')][_0x3a26('0x46')]+'%'};return _0x3c60c0;})});}_0x2bdd9e=_[_0x3a26('0x47')]({},_0x2bdd9e,_0x543945[_0x3a26('0x48')]);return _0x2f480f[_0x3a26('0x7e')](_0x2bdd9e);}})['then'](function(_0x3fd7d0){if(_0x3fd7d0){_0x40ade4=_0x3fd7d0['length'];if(!_0x543945[_0x3a26('0x2e')][_0x3a26('0x41')](_0x3a26('0x57'))){_0x2bdd9e[_0x3a26('0x13')]=qs[_0x3a26('0x13')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x13')]);_0x2bdd9e[_0x3a26('0x12')]=qs[_0x3a26('0x12')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x12')]);}return _0x2f480f[_0x3a26('0x7e')](_0x2bdd9e);}})['then'](function(_0x24b955){if(_0x24b955){return _0x24b955?{'count':_0x40ade4,'rows':_0x24b955}:null;}})['then'](respondWithResult(_0x3269a7,null))[_0x3a26('0x3d')](handleError(_0x3269a7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a0a2e8c..5812f2c 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 _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 +var _0xd2d6=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','save','update'];(function(_0x125214,_0xa7fbf2){var _0x7ef230=function(_0x8bf45a){while(--_0x8bf45a){_0x125214['push'](_0x125214['shift']());}};_0x7ef230(++_0xa7fbf2);}(_0xd2d6,0xa3));var _0x6d2d=function(_0x4939bc,_0x4dd446){_0x4939bc=_0x4939bc-0x0;var _0x164412=_0xd2d6[_0x4939bc];return _0x164412;};'use strict';var EventEmitter=require(_0x6d2d('0x0'));var ChatQueue=require(_0x6d2d('0x1'))['db'][_0x6d2d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6d2d('0x3'),'afterUpdate':_0x6d2d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1fa2e3){return function(_0x2fd17c,_0x33f5aa,_0x351f8b){ChatQueueEvents[_0x6d2d('0x5')](_0x1fa2e3+':'+_0x2fd17c['id'],_0x2fd17c);ChatQueueEvents[_0x6d2d('0x5')](_0x1fa2e3,_0x2fd17c);_0x351f8b(null);};}for(var e in events){if(events[_0x6d2d('0x6')](e)){var event=events[e];ChatQueue[_0x6d2d('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index cb040f7..b00ff7e 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 _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 +var _0x4d3e=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x3b1f1c,_0x577b23){var _0x3f0a47=function(_0x129b83){while(--_0x129b83){_0x3b1f1c['push'](_0x3b1f1c['shift']());}};_0x3f0a47(++_0x577b23);}(_0x4d3e,0x129));var _0xe4d3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4d3e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe4d3('0x0'));var util=require(_0xe4d3('0x1'));var logger=require(_0xe4d3('0x2'))(_0xe4d3('0x3'));var moment=require(_0xe4d3('0x4'));var BPromise=require(_0xe4d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d3('0x6'));var rimraf=require(_0xe4d3('0x7'));var config=require(_0xe4d3('0x8'));var attributes=require(_0xe4d3('0x9'));module[_0xe4d3('0xa')]=function(_0x2fec27,_0x47c1ec){return _0x2fec27[_0xe4d3('0xb')](_0xe4d3('0xc'),attributes,{'tableName':_0xe4d3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 1a6ef77..1c0717a 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 _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 +var _0xc16a=['client','http','defaults','redis','localhost','./chatQueue.socket','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowChatQueue','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xc16a,0x160));var _0xac16=function(_0x3611da,_0x253e90){_0x3611da=_0x3611da-0x0;var _0x275c6c=_0xc16a[_0x3611da];return _0x275c6c;};'use strict';var _=require(_0xac16('0x0'));var util=require(_0xac16('0x1'));var moment=require(_0xac16('0x2'));var BPromise=require(_0xac16('0x3'));var rs=require(_0xac16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac16('0x5'))['db'];var utils=require(_0xac16('0x6'));var logger=require(_0xac16('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xac16('0x8')][_0xac16('0x9')]({'port':0x232a});config['redis']=_[_0xac16('0xa')](config[_0xac16('0xb')],{'host':_0xac16('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac16('0xb')]));require(_0xac16('0xd'))['register'](socket);function respondWithRpcPromise(_0x19155b,_0x93ed67,_0x5e3993){return new BPromise(function(_0x66310c,_0x2f23ed){return client['request'](_0x19155b,_0x5e3993)['then'](function(_0x17b372){logger[_0xac16('0xe')](_0xac16('0xf'),_0x93ed67,_0xac16('0x10'));logger['debug'](_0xac16('0x11'),_0x93ed67,_0xac16('0x10'),JSON[_0xac16('0x12')](_0x17b372));if(_0x17b372[_0xac16('0x13')]){if(_0x17b372[_0xac16('0x13')]['code']===0x1f4){logger[_0xac16('0x13')](_0xac16('0xf'),_0x93ed67,_0x17b372[_0xac16('0x13')]['message']);return _0x2f23ed(_0x17b372[_0xac16('0x13')][_0xac16('0x14')]);}logger[_0xac16('0x13')](_0xac16('0xf'),_0x93ed67,_0x17b372[_0xac16('0x13')]['message']);return _0x66310c(_0x17b372[_0xac16('0x13')][_0xac16('0x14')]);}else{logger[_0xac16('0xe')](_0xac16('0xf'),_0x93ed67,_0xac16('0x10'));_0x66310c(_0x17b372[_0xac16('0x15')]['message']);}})[_0xac16('0x16')](function(_0x91adca){logger[_0xac16('0x13')](_0xac16('0xf'),_0x93ed67,_0x91adca);_0x2f23ed(_0x91adca);});});}exports[_0xac16('0x17')]=function(_0x3b4249){var _0x16096a=this;return new Promise(function(_0x2cfc0b,_0x1070ba){return db['ChatQueue'][_0xac16('0x18')]({'raw':_0x3b4249[_0xac16('0x19')]?_0x3b4249[_0xac16('0x19')][_0xac16('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b4249[_0xac16('0x19')]?_0x3b4249[_0xac16('0x19')][_0xac16('0x1b')]||null:null,'attributes':_0x3b4249[_0xac16('0x19')]?_0x3b4249['options'][_0xac16('0x1c')]||null:null,'limit':_0x3b4249[_0xac16('0x19')]?_0x3b4249[_0xac16('0x19')][_0xac16('0x1d')]||null:null,'include':_0x3b4249[_0xac16('0x19')]?_0x3b4249['options'][_0xac16('0x1e')]?_['map'](_0x3b4249[_0xac16('0x19')]['include'],function(_0x173572){return{'model':db[_0x173572[_0xac16('0x1f')]],'as':_0x173572['as'],'attributes':_0x173572[_0xac16('0x1c')],'include':_0x173572[_0xac16('0x1e')]?_['map'](_0x173572[_0xac16('0x1e')],function(_0x16d0fe){return{'model':db[_0x16d0fe['model']],'as':_0x16d0fe['as'],'attributes':_0x16d0fe[_0xac16('0x1c')],'include':_0x16d0fe['include']?_[_0xac16('0x20')](_0x16d0fe[_0xac16('0x1e')],function(_0x12d0f2){return{'model':db[_0x12d0f2[_0xac16('0x1f')]],'as':_0x12d0f2['as'],'attributes':_0x12d0f2[_0xac16('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b6c19){logger[_0xac16('0xe')](_0xac16('0x17'),_0x3b4249);logger[_0xac16('0x21')](_0xac16('0x17'),_0x3b4249,JSON[_0xac16('0x12')](_0x3b6c19));_0x2cfc0b(_0x3b6c19);})[_0xac16('0x16')](function(_0x16723d){logger['error']('GetChatQueue',_0x16723d[_0xac16('0x14')],_0x3b4249);_0x1070ba(_0x16096a['error'](0x1f4,_0x16723d['message']));});});};exports[_0xac16('0x22')]=function(_0xeb2f20){var _0x294dba=this;return new Promise(function(_0xb2eba9,_0x382aaf){return db['ChatQueue']['find']({'raw':_0xeb2f20[_0xac16('0x19')]?_0xeb2f20[_0xac16('0x19')][_0xac16('0x1a')]===undefined?!![]:![]:!![],'where':_0xeb2f20[_0xac16('0x19')]?_0xeb2f20['options'][_0xac16('0x1b')]||null:null,'attributes':_0xeb2f20['options']?_0xeb2f20['options'][_0xac16('0x1c')]||null:null,'include':_0xeb2f20[_0xac16('0x19')]?_0xeb2f20[_0xac16('0x19')][_0xac16('0x1e')]?_[_0xac16('0x20')](_0xeb2f20[_0xac16('0x19')][_0xac16('0x1e')],function(_0x2908c3){return{'model':db[_0x2908c3['model']],'as':_0x2908c3['as'],'attributes':_0x2908c3[_0xac16('0x1c')],'include':_0x2908c3['include']?_['map'](_0x2908c3['include'],function(_0xe2fc74){return{'model':db[_0xe2fc74[_0xac16('0x1f')]],'as':_0xe2fc74['as'],'attributes':_0xe2fc74[_0xac16('0x1c')],'include':_0xe2fc74['include']?_[_0xac16('0x20')](_0xe2fc74['include'],function(_0x5c4a85){return{'model':db[_0x5c4a85[_0xac16('0x1f')]],'as':_0x5c4a85['as'],'attributes':_0x5c4a85[_0xac16('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xac16('0x23')](function(_0x3eef35){logger['info'](_0xac16('0x22'),_0xeb2f20);logger[_0xac16('0x21')](_0xac16('0x22'),_0xeb2f20,JSON[_0xac16('0x12')](_0x3eef35));_0xb2eba9(_0x3eef35);})['catch'](function(_0xf3f17b){logger[_0xac16('0x13')]('ShowChatQueue',_0xf3f17b[_0xac16('0x14')],_0xeb2f20);_0x382aaf(_0x294dba[_0xac16('0x13')](0x1f4,_0xf3f17b[_0xac16('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index af58fdf..9297506 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 _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 +var _0x4d9e=['removeListener','register','length','chatQueue:','./chatQueue.events','update','emit'];(function(_0x5de102,_0x167b89){var _0x1e5afc=function(_0x43778c){while(--_0x43778c){_0x5de102['push'](_0x5de102['shift']());}};_0x1e5afc(++_0x167b89);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x56053f,_0xdf37f9){_0x56053f=_0x56053f-0x0;var _0x37513a=_0x4d9e[_0x56053f];return _0x37513a;};'use strict';var ChatQueueEvents=require(_0xe4d9('0x0'));var events=['save','remove',_0xe4d9('0x1')];function createListener(_0x574c1d,_0x36adac){return function(_0x4d7687){_0x36adac[_0xe4d9('0x2')](_0x574c1d,_0x4d7687);};}function removeListener(_0x2deaef,_0x47a09f){return function(){ChatQueueEvents[_0xe4d9('0x3')](_0x2deaef,_0x47a09f);};}exports[_0xe4d9('0x4')]=function(_0x278035){for(var _0x34c2a2=0x0,_0x125dbc=events[_0xe4d9('0x5')];_0x34c2a2<_0x125dbc;_0x34c2a2++){var _0x54a63a=events[_0x34c2a2];var _0x36316f=createListener(_0xe4d9('0x6')+_0x54a63a,_0x278035);ChatQueueEvents['on'](_0x54a63a,_0x36316f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4894967..d1dcc37 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(_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 +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ea2c2,_0x396f43){var _0x543e71=function(_0x337eea){while(--_0x337eea){_0x2ea2c2['push'](_0x2ea2c2['shift']());}};_0x543e71(++_0x396f43);}(_0x008c,0x188));var _0xc008=function(_0x19561b,_0x2dccef){_0x19561b=_0x19561b-0x0;var _0x135586=_0x008c[_0x19561b];return _0x135586;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 04e8e93..400fbd5 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 _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 +var _0xb2c0=['moment','exports','STRING','DATE'];(function(_0x474dfe,_0x557fbf){var _0x345ba1=function(_0xeb5acc){while(--_0xeb5acc){_0x474dfe['push'](_0x474dfe['shift']());}};_0x345ba1(++_0x557fbf);}(_0xb2c0,0x110));var _0x0b2c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2c0[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0x0b2c('0x0'));var Sequelize=require('sequelize');module[_0x0b2c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0b2c('0x2')]},'joinAt':{'type':Sequelize[_0x0b2c('0x3')]},'leaveAt':{'type':Sequelize[_0x0b2c('0x3')]},'acceptAt':{'type':Sequelize[_0x0b2c('0x3')]},'exitAt':{'type':Sequelize[_0x0b2c('0x3')]},'reason':{'type':Sequelize[_0x0b2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index de28e62..3114833 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 _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 +var _0x2e88=['moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x8ffa46,_0x33be18){var _0x1247eb=function(_0x4ab03a){while(--_0x4ab03a){_0x8ffa46['push'](_0x8ffa46['shift']());}};_0x1247eb(++_0x33be18);}(_0x2e88,0x95));var _0x82e8=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x2e88[_0xc69f39];return _0x93be41;};'use strict';var emlformat=require(_0x82e8('0x0'));var rimraf=require(_0x82e8('0x1'));var zipdir=require(_0x82e8('0x2'));var jsonpatch=require(_0x82e8('0x3'));var rp=require(_0x82e8('0x4'));var moment=require(_0x82e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x82e8('0x6'));var util=require(_0x82e8('0x7'));var path=require('path');var sox=require(_0x82e8('0x8'));var csv=require(_0x82e8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e8('0xa'));var _=require(_0x82e8('0xb'));var squel=require(_0x82e8('0xc'));var crypto=require(_0x82e8('0xd'));var jsforce=require(_0x82e8('0xe'));var deskjs=require(_0x82e8('0xf'));var toCsv=require(_0x82e8('0x9'));var querystring=require(_0x82e8('0x10'));var Papa=require(_0x82e8('0x11'));var Redis=require(_0x82e8('0x12'));var authService=require(_0x82e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82e8('0x14'));var hardwareService=require(_0x82e8('0x15'));var logger=require(_0x82e8('0x16'))(_0x82e8('0x17'));var utils=require(_0x82e8('0x18'));var config=require(_0x82e8('0x19'));var licenseUtil=require(_0x82e8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253a36,_0xdf1b65){_0xdf1b65=_0xdf1b65||0xcc;return function(_0xb6d94a){if(_0xb6d94a){return _0x253a36[_0x82e8('0x1b')](_0xdf1b65);}return _0x253a36[_0x82e8('0x1c')](_0xdf1b65)['end']();};}function respondWithResult(_0x3353e0,_0x2c9569){_0x2c9569=_0x2c9569||0xc8;return function(_0xad6055){if(_0xad6055){return _0x3353e0[_0x82e8('0x1c')](_0x2c9569)['json'](_0xad6055);}};}function respondWithFilteredResult(_0x25b60e,_0x461744){return function(_0x3253d2){if(_0x3253d2){var _0xf53214=typeof _0x461744[_0x82e8('0x1d')]==='undefined'&&typeof _0x461744[_0x82e8('0x1e')]===_0x82e8('0x1f');var _0x574ba2=_0x3253d2[_0x82e8('0x20')];var _0xf287da=_0xf53214?0x0:_0x461744[_0x82e8('0x1d')];var _0x380f44=_0xf53214?_0x3253d2[_0x82e8('0x20')]:_0x461744[_0x82e8('0x1d')]+_0x461744[_0x82e8('0x1e')];var _0x5d7986;if(_0x380f44>=_0x574ba2){_0x380f44=_0x574ba2;_0x5d7986=0xc8;}else{_0x5d7986=0xce;}_0x25b60e[_0x82e8('0x1c')](_0x5d7986);return _0x25b60e[_0x82e8('0x21')](_0x82e8('0x22'),_0xf287da+'-'+_0x380f44+'/'+_0x574ba2)[_0x82e8('0x23')](_0x3253d2);}return null;};}function patchUpdates(_0xbfecf2){return function(_0x5db337){try{jsonpatch[_0x82e8('0x24')](_0x5db337,_0xbfecf2,!![]);}catch(_0x497c48){return BPromise[_0x82e8('0x25')](_0x497c48);}return _0x5db337[_0x82e8('0x26')]();};}function saveUpdates(_0x1475cf,_0x3ab5a2){return function(_0x198c3d){if(_0x198c3d){return _0x198c3d[_0x82e8('0x27')](_0x1475cf)[_0x82e8('0x28')](function(_0x591583){return _0x591583;});}return null;};}function removeEntity(_0x2b82eb,_0x57cc9c){return function(_0x4de0d2){if(_0x4de0d2){return _0x4de0d2['destroy']()[_0x82e8('0x28')](function(){_0x2b82eb['status'](0xcc)[_0x82e8('0x29')]();});}};}function handleEntityNotFound(_0x305710,_0xeff996){return function(_0x488b06){if(!_0x488b06){_0x305710[_0x82e8('0x1b')](0x194);}return _0x488b06;};}function handleError(_0x476602,_0x336015){_0x336015=_0x336015||0x1f4;return function(_0x2400c5){logger[_0x82e8('0x2a')](_0x2400c5['stack']);if(_0x2400c5['name']){delete _0x2400c5[_0x82e8('0x2b')];}_0x476602[_0x82e8('0x1c')](_0x336015)[_0x82e8('0x2c')](_0x2400c5);};}exports[_0x82e8('0x2d')]=function(_0x1c2160,_0x4756ac){var _0x14450e={},_0x1e9eee={},_0x1c2173={'count':0x0,'rows':[]};var _0xf52391=_[_0x82e8('0x2e')](db[_0x82e8('0x2f')][_0x82e8('0x30')],function(_0x4902af){return{'name':_0x4902af[_0x82e8('0x31')],'type':_0x4902af[_0x82e8('0x32')][_0x82e8('0x33')]};});_0x1e9eee[_0x82e8('0x34')]=_[_0x82e8('0x2e')](_0xf52391,_0x82e8('0x2b'));_0x1e9eee[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x1c2160[_0x82e8('0x35')]);_0x1e9eee[_0x82e8('0x37')]=_[_0x82e8('0x38')](_0x1e9eee['model'],_0x1e9eee[_0x82e8('0x35')]);_0x14450e[_0x82e8('0x39')]=_[_0x82e8('0x38')](_0x1e9eee[_0x82e8('0x34')],qs[_0x82e8('0x3a')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3a')]));_0x14450e[_0x82e8('0x39')]=_0x14450e['attributes'][_0x82e8('0x3b')]?_0x14450e['attributes']:_0x1e9eee[_0x82e8('0x34')];if(!_0x1c2160[_0x82e8('0x35')]['hasOwnProperty']('nolimit')){_0x14450e[_0x82e8('0x1e')]=qs['limit'](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1e')]);_0x14450e[_0x82e8('0x1d')]=qs[_0x82e8('0x1d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1d')]);}_0x14450e[_0x82e8('0x3c')]=qs[_0x82e8('0x3d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3d')]);_0x14450e[_0x82e8('0x3e')]=qs[_0x82e8('0x37')](_['pick'](_0x1c2160[_0x82e8('0x35')],_0x1e9eee[_0x82e8('0x37')]),_0xf52391);if(_0x1c2160[_0x82e8('0x35')]['filter']){_0x14450e[_0x82e8('0x3e')]=_[_0x82e8('0x3f')](_0x14450e[_0x82e8('0x3e')],{'$or':_[_0x82e8('0x2e')](_0xf52391,function(_0x28e1b2){if(_0x28e1b2[_0x82e8('0x32')]!==_0x82e8('0x40')){var _0x1eceef={};_0x1eceef[_0x28e1b2[_0x82e8('0x2b')]]={'$like':'%'+_0x1c2160[_0x82e8('0x35')][_0x82e8('0x41')]+'%'};return _0x1eceef;}})});}_0x14450e=_['merge']({},_0x14450e,_0x1c2160[_0x82e8('0x42')]);var _0x3f379d={'where':_0x14450e[_0x82e8('0x3e')]};return db[_0x82e8('0x2f')][_0x82e8('0x20')](_0x3f379d)[_0x82e8('0x28')](function(_0x26c6ad){_0x1c2173[_0x82e8('0x20')]=_0x26c6ad;if(_0x1c2160[_0x82e8('0x35')][_0x82e8('0x43')]){_0x14450e[_0x82e8('0x44')]=[{'all':!![]}];}return db[_0x82e8('0x2f')][_0x82e8('0x45')](_0x14450e);})[_0x82e8('0x28')](function(_0x3878af){_0x1c2173['rows']=_0x3878af;return _0x1c2173;})[_0x82e8('0x28')](respondWithFilteredResult(_0x4756ac,_0x14450e))['catch'](handleError(_0x4756ac,null));};exports[_0x82e8('0x46')]=function(_0x2da19b,_0x8428e1){var _0xc996f7={'raw':!![],'where':{'id':_0x2da19b[_0x82e8('0x47')]['id']}},_0x3ff396={};_0x3ff396['model']=_[_0x82e8('0x36')](db['ChatQueueReport'][_0x82e8('0x30')]);_0x3ff396[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x2da19b[_0x82e8('0x35')]);_0x3ff396[_0x82e8('0x37')]=_['intersection'](_0x3ff396['model'],_0x3ff396[_0x82e8('0x35')]);_0xc996f7['attributes']=_[_0x82e8('0x38')](_0x3ff396['model'],qs['fields'](_0x2da19b['query']['fields']));_0xc996f7[_0x82e8('0x39')]=_0xc996f7[_0x82e8('0x39')]['length']?_0xc996f7[_0x82e8('0x39')]:_0x3ff396[_0x82e8('0x34')];if(_0x2da19b['query'][_0x82e8('0x43')]){_0xc996f7['include']=[{'all':!![]}];}_0xc996f7=_[_0x82e8('0x3f')]({},_0xc996f7,_0x2da19b[_0x82e8('0x42')]);return db[_0x82e8('0x2f')][_0x82e8('0x48')](_0xc996f7)[_0x82e8('0x28')](handleEntityNotFound(_0x8428e1,null))[_0x82e8('0x28')](respondWithResult(_0x8428e1,null))['catch'](handleError(_0x8428e1,null));};exports[_0x82e8('0x49')]=function(_0x40fcae,_0x33c605){return db[_0x82e8('0x2f')]['create'](_0x40fcae[_0x82e8('0x4a')],{})['then'](respondWithResult(_0x33c605,0xc9))[_0x82e8('0x4b')](handleError(_0x33c605,null));};exports['update']=function(_0x25c206,_0xd3290c){if(_0x25c206[_0x82e8('0x4a')]['id']){delete _0x25c206['body']['id'];}return db[_0x82e8('0x2f')]['find']({'where':{'id':_0x25c206['params']['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0xd3290c,null))[_0x82e8('0x28')](saveUpdates(_0x25c206[_0x82e8('0x4a')],null))['then'](respondWithResult(_0xd3290c,null))[_0x82e8('0x4b')](handleError(_0xd3290c,null));};exports['destroy']=function(_0x5735a2,_0x51710a){return db['ChatQueueReport'][_0x82e8('0x48')]({'where':{'id':_0x5735a2[_0x82e8('0x47')]['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0x51710a,null))[_0x82e8('0x28')](removeEntity(_0x51710a,null))['catch'](handleError(_0x51710a,null));};exports[_0x82e8('0x4c')]=function(_0x7b1c26,_0x17f348){return db[_0x82e8('0x2f')][_0x82e8('0x4c')]()[_0x82e8('0x28')](respondWithResult(_0x17f348,null))['catch'](handleError(_0x17f348,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 8f7e49e..9bdbb72 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_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 +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x168583,_0x562155){var _0x4b0df2=function(_0x388126){while(--_0x388126){_0x168583['push'](_0x168583['shift']());}};_0x4b0df2(++_0x562155);}(_0xb7e7,0x121));var _0x7b7e=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb7e7[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 9fdb989..893bb88 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 _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 +var _0xca25=['util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','limit','lodash'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xca25,0x116));var _0x5ca2=function(_0x4b3da3,_0x7e6f6a){_0x4b3da3=_0x4b3da3-0x0;var _0x373c4f=_0xca25[_0x4b3da3];return _0x373c4f;};'use strict';var _=require(_0x5ca2('0x0'));var util=require(_0x5ca2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ca2('0x2'));var db=require(_0x5ca2('0x3'))['db'];var utils=require(_0x5ca2('0x4'));var logger=require('../../config/logger')(_0x5ca2('0x5'));var config=require(_0x5ca2('0x6'));var jayson=require(_0x5ca2('0x7'));var client=jayson[_0x5ca2('0x8')][_0x5ca2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27a188,_0x29aa51,_0xe6e7b3){return new BPromise(function(_0x4a97bb,_0x4b234a){return client[_0x5ca2('0xa')](_0x27a188,_0xe6e7b3)[_0x5ca2('0xb')](function(_0xb55a7f){logger['info'](_0x5ca2('0xc'),_0x29aa51,'request\x20sent');logger['debug'](_0x5ca2('0xd'),_0x29aa51,_0x5ca2('0xe'),JSON[_0x5ca2('0xf')](_0xb55a7f));if(_0xb55a7f[_0x5ca2('0x10')]){if(_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x11')]===0x1f4){logger['error'](_0x5ca2('0xc'),_0x29aa51,_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x12')]);return _0x4b234a(_0xb55a7f['error'][_0x5ca2('0x12')]);}logger[_0x5ca2('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x29aa51,_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x12')]);return _0x4a97bb(_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x12')]);}else{logger[_0x5ca2('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x29aa51,_0x5ca2('0xe'));_0x4a97bb(_0xb55a7f[_0x5ca2('0x14')][_0x5ca2('0x12')]);}})[_0x5ca2('0x15')](function(_0x41ddef){logger[_0x5ca2('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x29aa51,_0x41ddef);_0x4b234a(_0x41ddef);});});}exports[_0x5ca2('0x16')]=function(_0x32c8b0){var _0x5ea738=this;return new Promise(function(_0x16e6e2,_0x48d865){return db[_0x5ca2('0x17')][_0x5ca2('0x18')](_0x32c8b0[_0x5ca2('0x19')],{'raw':_0x32c8b0['options']?_0x32c8b0[_0x5ca2('0x1a')][_0x5ca2('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x475338){logger[_0x5ca2('0x13')](_0x5ca2('0x16'),_0x32c8b0);logger[_0x5ca2('0x1c')](_0x5ca2('0x16'),_0x32c8b0,JSON[_0x5ca2('0xf')](_0x475338));_0x16e6e2(_0x475338);})[_0x5ca2('0x15')](function(_0x5aa3f0){logger[_0x5ca2('0x10')]('CreateChatQueueReport',_0x5aa3f0['message'],_0x32c8b0);_0x48d865(_0x5ea738[_0x5ca2('0x10')](0x1f4,_0x5aa3f0['message']));});});};exports[_0x5ca2('0x1d')]=function(_0x58d526){var _0x2f3b5=this;return new Promise(function(_0x5a0cdf,_0x3d7568){return db[_0x5ca2('0x17')]['update'](_0x58d526['body'],{'raw':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')][_0x5ca2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')]['where']||null:null,'attributes':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')]['attributes']||null:null,'limit':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')][_0x5ca2('0x1e')]||null:null})[_0x5ca2('0xb')](function(_0xa77047){logger[_0x5ca2('0x13')](_0x5ca2('0x1d'),_0x58d526);logger[_0x5ca2('0x1c')](_0x5ca2('0x1d'),_0x58d526,JSON['stringify'](_0xa77047));_0x5a0cdf(_0xa77047);})[_0x5ca2('0x15')](function(_0x329643){logger['error'](_0x5ca2('0x1d'),_0x329643[_0x5ca2('0x12')],_0x58d526);_0x3d7568(_0x2f3b5[_0x5ca2('0x10')](0x1f4,_0x329643[_0x5ca2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bfe06ba..6fe6a8b 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 _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 +var _0xc4f6=['/describe','/:id','post','create','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x3faff1,_0x596331){var _0x114695=function(_0x9d391c){while(--_0x9d391c){_0x3faff1['push'](_0x3faff1['shift']());}};_0x114695(++_0x596331);}(_0xc4f6,0x1e8));var _0x6c4f=function(_0x18ce93,_0x45645b){_0x18ce93=_0x18ce93-0x0;var _0x3ff555=_0xc4f6[_0x18ce93];return _0x3ff555;};'use strict';var multer=require(_0x6c4f('0x0'));var util=require(_0x6c4f('0x1'));var path=require(_0x6c4f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c4f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6c4f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x6c4f('0x5')]('/',auth[_0x6c4f('0x6')](),controller['index']);router['get'](_0x6c4f('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6c4f('0x8'),auth[_0x6c4f('0x6')](),controller['show']);router[_0x6c4f('0x9')]('/',auth[_0x6c4f('0x6')](),controller[_0x6c4f('0xa')]);router[_0x6c4f('0xb')](_0x6c4f('0x8'),auth[_0x6c4f('0x6')](),controller[_0x6c4f('0xc')]);router['delete'](_0x6c4f('0x8'),auth['isAuthenticated'](),controller[_0x6c4f('0xd')]);module[_0x6c4f('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ae4fd8a..9972efe 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 _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 +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1ee1be,_0x28b241){_0x1ee1be=_0x1ee1be-0x0;var _0x5c0954=_0xb43b[_0x1ee1be];return _0x5c0954;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5f983e2..c067448 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 _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 +var _0xf6cf=['update','then','status','end','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','ChatTransferReport','include','findAll','rows','catch','params','length','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','ejs','fs-extra','lodash','squel','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x4452f1,_0x5ad396){var _0x6cedd0=function(_0x1448f0){while(--_0x1448f0){_0x4452f1['push'](_0x4452f1['shift']());}};_0x6cedd0(++_0x5ad396);}(_0xf6cf,0x72));var _0xff6c=function(_0x16e46d,_0x1a5751){_0x16e46d=_0x16e46d-0x0;var _0x45c70d=_0xf6cf[_0x16e46d];return _0x45c70d;};'use strict';var emlformat=require(_0xff6c('0x0'));var rimraf=require(_0xff6c('0x1'));var zipdir=require(_0xff6c('0x2'));var jsonpatch=require(_0xff6c('0x3'));var rp=require(_0xff6c('0x4'));var moment=require(_0xff6c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff6c('0x6'));var fs=require('fs');var fs_extra=require(_0xff6c('0x7'));var _=require(_0xff6c('0x8'));var squel=require(_0xff6c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff6c('0xa'));var querystring=require(_0xff6c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xff6c('0xc'));var qs=require(_0xff6c('0xd'));var as=require(_0xff6c('0xe'));var hardwareService=require(_0xff6c('0xf'));var logger=require(_0xff6c('0x10'))(_0xff6c('0x11'));var utils=require('../../config/utils');var config=require(_0xff6c('0x12'));var licenseUtil=require(_0xff6c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c018b,_0x44408a){_0x44408a=_0x44408a||0xcc;return function(_0x3a40d3){if(_0x3a40d3){return _0x1c018b[_0xff6c('0x14')](_0x44408a);}return _0x1c018b['status'](_0x44408a)['end']();};}function respondWithResult(_0x5ec24f,_0x3b9db0){_0x3b9db0=_0x3b9db0||0xc8;return function(_0x4582ed){if(_0x4582ed){return _0x5ec24f['status'](_0x3b9db0)[_0xff6c('0x15')](_0x4582ed);}};}function respondWithFilteredResult(_0x59f6fd,_0x78ca97){return function(_0x91a6d3){if(_0x91a6d3){var _0x267a3b=typeof _0x78ca97[_0xff6c('0x16')]===_0xff6c('0x17')&&typeof _0x78ca97[_0xff6c('0x18')]===_0xff6c('0x17');var _0x19f5fd=_0x91a6d3[_0xff6c('0x19')];var _0x5c8bbf=_0x267a3b?0x0:_0x78ca97[_0xff6c('0x16')];var _0x322e46=_0x267a3b?_0x91a6d3[_0xff6c('0x19')]:_0x78ca97[_0xff6c('0x16')]+_0x78ca97[_0xff6c('0x18')];var _0x3052be;if(_0x322e46>=_0x19f5fd){_0x322e46=_0x19f5fd;_0x3052be=0xc8;}else{_0x3052be=0xce;}_0x59f6fd['status'](_0x3052be);return _0x59f6fd['set'](_0xff6c('0x1a'),_0x5c8bbf+'-'+_0x322e46+'/'+_0x19f5fd)[_0xff6c('0x15')](_0x91a6d3);}return null;};}function patchUpdates(_0x56d2bc){return function(_0x1d9418){try{jsonpatch[_0xff6c('0x1b')](_0x1d9418,_0x56d2bc,!![]);}catch(_0x292fd2){return BPromise[_0xff6c('0x1c')](_0x292fd2);}return _0x1d9418[_0xff6c('0x1d')]();};}function saveUpdates(_0x35b1d2,_0x4ef982){return function(_0x482011){if(_0x482011){return _0x482011[_0xff6c('0x1e')](_0x35b1d2)[_0xff6c('0x1f')](function(_0x37de5e){return _0x37de5e;});}return null;};}function removeEntity(_0x30fc9e,_0x48d670){return function(_0x386218){if(_0x386218){return _0x386218['destroy']()[_0xff6c('0x1f')](function(){_0x30fc9e[_0xff6c('0x20')](0xcc)[_0xff6c('0x21')]();});}};}function handleEntityNotFound(_0x4e326e,_0xc7e7b3){return function(_0x3209f1){if(!_0x3209f1){_0x4e326e[_0xff6c('0x14')](0x194);}return _0x3209f1;};}function handleError(_0xed81b0,_0x5be7d8){_0x5be7d8=_0x5be7d8||0x1f4;return function(_0x761622){logger[_0xff6c('0x22')](_0x761622[_0xff6c('0x23')]);if(_0x761622['name']){delete _0x761622[_0xff6c('0x24')];}_0xed81b0[_0xff6c('0x20')](_0x5be7d8)[_0xff6c('0x25')](_0x761622);};}exports[_0xff6c('0x26')]=function(_0x590261,_0x4269d5){var _0xa79f4a={},_0x120c70={},_0xeae2e6={'count':0x0,'rows':[]};var _0x581ed0=_['map'](db['ChatTransferReport'][_0xff6c('0x27')],function(_0x2e1249){return{'name':_0x2e1249[_0xff6c('0x28')],'type':_0x2e1249['type'][_0xff6c('0x29')]};});_0x120c70['model']=_['map'](_0x581ed0,'name');_0x120c70[_0xff6c('0x2a')]=_[_0xff6c('0x2b')](_0x590261['query']);_0x120c70['filters']=_[_0xff6c('0x2c')](_0x120c70[_0xff6c('0x2d')],_0x120c70[_0xff6c('0x2a')]);_0xa79f4a[_0xff6c('0x2e')]=_['intersection'](_0x120c70[_0xff6c('0x2d')],qs['fields'](_0x590261[_0xff6c('0x2a')][_0xff6c('0x2f')]));_0xa79f4a['attributes']=_0xa79f4a[_0xff6c('0x2e')]['length']?_0xa79f4a[_0xff6c('0x2e')]:_0x120c70[_0xff6c('0x2d')];if(!_0x590261[_0xff6c('0x2a')][_0xff6c('0x30')](_0xff6c('0x31'))){_0xa79f4a[_0xff6c('0x18')]=qs['limit'](_0x590261['query'][_0xff6c('0x18')]);_0xa79f4a[_0xff6c('0x16')]=qs[_0xff6c('0x16')](_0x590261[_0xff6c('0x2a')]['offset']);}_0xa79f4a['order']=qs[_0xff6c('0x32')](_0x590261[_0xff6c('0x2a')]['sort']);_0xa79f4a[_0xff6c('0x33')]=qs[_0xff6c('0x34')](_[_0xff6c('0x35')](_0x590261[_0xff6c('0x2a')],_0x120c70['filters']),_0x581ed0);if(_0x590261[_0xff6c('0x2a')][_0xff6c('0x36')]){_0xa79f4a[_0xff6c('0x33')]=_[_0xff6c('0x37')](_0xa79f4a[_0xff6c('0x33')],{'$or':_[_0xff6c('0x38')](_0x581ed0,function(_0x3e0eb5){if(_0x3e0eb5['type']!==_0xff6c('0x39')){var _0x42f98e={};_0x42f98e[_0x3e0eb5['name']]={'$like':'%'+_0x590261[_0xff6c('0x2a')]['filter']+'%'};return _0x42f98e;}})});}_0xa79f4a=_[_0xff6c('0x37')]({},_0xa79f4a,_0x590261[_0xff6c('0x3a')]);var _0x4f400d={'where':_0xa79f4a[_0xff6c('0x33')]};return db[_0xff6c('0x3b')][_0xff6c('0x19')](_0x4f400d)[_0xff6c('0x1f')](function(_0x421e20){_0xeae2e6[_0xff6c('0x19')]=_0x421e20;if(_0x590261[_0xff6c('0x2a')]['includeAll']){_0xa79f4a[_0xff6c('0x3c')]=[{'all':!![]}];}return db[_0xff6c('0x3b')][_0xff6c('0x3d')](_0xa79f4a);})[_0xff6c('0x1f')](function(_0x35521d){_0xeae2e6[_0xff6c('0x3e')]=_0x35521d;return _0xeae2e6;})[_0xff6c('0x1f')](respondWithFilteredResult(_0x4269d5,_0xa79f4a))[_0xff6c('0x3f')](handleError(_0x4269d5,null));};exports['show']=function(_0x3a5b96,_0x108c53){var _0x226613={'raw':!![],'where':{'id':_0x3a5b96[_0xff6c('0x40')]['id']}},_0x1f1d43={};_0x1f1d43[_0xff6c('0x2d')]=_[_0xff6c('0x2b')](db[_0xff6c('0x3b')][_0xff6c('0x27')]);_0x1f1d43[_0xff6c('0x2a')]=_[_0xff6c('0x2b')](_0x3a5b96[_0xff6c('0x2a')]);_0x1f1d43[_0xff6c('0x34')]=_['intersection'](_0x1f1d43[_0xff6c('0x2d')],_0x1f1d43[_0xff6c('0x2a')]);_0x226613[_0xff6c('0x2e')]=_[_0xff6c('0x2c')](_0x1f1d43['model'],qs[_0xff6c('0x2f')](_0x3a5b96[_0xff6c('0x2a')][_0xff6c('0x2f')]));_0x226613[_0xff6c('0x2e')]=_0x226613[_0xff6c('0x2e')][_0xff6c('0x41')]?_0x226613[_0xff6c('0x2e')]:_0x1f1d43['model'];if(_0x3a5b96[_0xff6c('0x2a')][_0xff6c('0x42')]){_0x226613[_0xff6c('0x3c')]=[{'all':!![]}];}_0x226613=_[_0xff6c('0x37')]({},_0x226613,_0x3a5b96[_0xff6c('0x3a')]);return db[_0xff6c('0x3b')][_0xff6c('0x43')](_0x226613)['then'](handleEntityNotFound(_0x108c53,null))[_0xff6c('0x1f')](respondWithResult(_0x108c53,null))[_0xff6c('0x3f')](handleError(_0x108c53,null));};exports[_0xff6c('0x44')]=function(_0x38f1fa,_0x4a857b){return db[_0xff6c('0x3b')][_0xff6c('0x44')](_0x38f1fa[_0xff6c('0x45')],{})[_0xff6c('0x1f')](respondWithResult(_0x4a857b,0xc9))['catch'](handleError(_0x4a857b,null));};exports[_0xff6c('0x1e')]=function(_0x35f4ca,_0x5b24a0){if(_0x35f4ca[_0xff6c('0x45')]['id']){delete _0x35f4ca['body']['id'];}return db['ChatTransferReport'][_0xff6c('0x43')]({'where':{'id':_0x35f4ca[_0xff6c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b24a0,null))[_0xff6c('0x1f')](saveUpdates(_0x35f4ca['body'],null))[_0xff6c('0x1f')](respondWithResult(_0x5b24a0,null))[_0xff6c('0x3f')](handleError(_0x5b24a0,null));};exports[_0xff6c('0x46')]=function(_0x55bce3,_0x1e83f0){return db['ChatTransferReport'][_0xff6c('0x43')]({'where':{'id':_0x55bce3['params']['id']}})['then'](handleEntityNotFound(_0x1e83f0,null))[_0xff6c('0x1f')](removeEntity(_0x1e83f0,null))[_0xff6c('0x3f')](handleError(_0x1e83f0,null));};exports[_0xff6c('0x47')]=function(_0x3bdefb,_0x2d116c){return db['ChatTransferReport'][_0xff6c('0x47')]()['then'](respondWithResult(_0x2d116c,null))[_0xff6c('0x3f')](handleError(_0x2d116c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 668a4de..e35eb81 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 _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 +var _0xf549=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer'];(function(_0x572a8b,_0x51b7bd){var _0x496dc4=function(_0x1f8548){while(--_0x1f8548){_0x572a8b['push'](_0x572a8b['shift']());}};_0x496dc4(++_0x51b7bd);}(_0xf549,0x1cf));var _0x9f54=function(_0x2bdf00,_0x494ed2){_0x2bdf00=_0x2bdf00-0x0;var _0x39752e=_0xf549[_0x2bdf00];return _0x39752e;};'use strict';var _=require(_0x9f54('0x0'));var util=require(_0x9f54('0x1'));var logger=require(_0x9f54('0x2'))('api');var moment=require(_0x9f54('0x3'));var BPromise=require(_0x9f54('0x4'));var rp=require(_0x9f54('0x5'));var fs=require('fs');var path=require(_0x9f54('0x6'));var rimraf=require(_0x9f54('0x7'));var config=require(_0x9f54('0x8'));var attributes=require(_0x9f54('0x9'));module[_0x9f54('0xa')]=function(_0x541dfc,_0x574b50){return _0x541dfc[_0x9f54('0xb')]('ChatTransferReport',attributes,{'tableName':_0x9f54('0xc'),'paranoid':![],'indexes':[{'name':_0x9f54('0xd'),'fields':[_0x9f54('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 ff2cffc..3b3a26a 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 _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 +var _0x0434=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0x0434,0xee));var _0x4043=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x0434[_0x23e6bb];return _0x1e3b4c;};'use strict';var _=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var moment=require('moment');var BPromise=require(_0x4043('0x2'));var rs=require(_0x4043('0x3'));var fs=require('fs');var Redis=require(_0x4043('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4043('0x5'));var logger=require(_0x4043('0x6'))(_0x4043('0x7'));var config=require(_0x4043('0x8'));var jayson=require(_0x4043('0x9'));var client=jayson[_0x4043('0xa')][_0x4043('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4873d7,_0x30d83f,_0x2181fb){return new BPromise(function(_0x4543ee,_0x54cde1){return client[_0x4043('0xc')](_0x4873d7,_0x2181fb)[_0x4043('0xd')](function(_0x40251e){logger[_0x4043('0xe')](_0x4043('0xf'),_0x30d83f,_0x4043('0x10'));logger[_0x4043('0x11')](_0x4043('0x12'),_0x30d83f,_0x4043('0x10'),JSON[_0x4043('0x13')](_0x40251e));if(_0x40251e[_0x4043('0x14')]){if(_0x40251e[_0x4043('0x14')][_0x4043('0x15')]===0x1f4){logger[_0x4043('0x14')](_0x4043('0xf'),_0x30d83f,_0x40251e[_0x4043('0x14')][_0x4043('0x16')]);return _0x54cde1(_0x40251e[_0x4043('0x14')][_0x4043('0x16')]);}logger[_0x4043('0x14')](_0x4043('0xf'),_0x30d83f,_0x40251e[_0x4043('0x14')][_0x4043('0x16')]);return _0x4543ee(_0x40251e['error'][_0x4043('0x16')]);}else{logger['info'](_0x4043('0xf'),_0x30d83f,_0x4043('0x10'));_0x4543ee(_0x40251e[_0x4043('0x17')][_0x4043('0x16')]);}})[_0x4043('0x18')](function(_0x2e2c35){logger['error'](_0x4043('0xf'),_0x30d83f,_0x2e2c35);_0x54cde1(_0x2e2c35);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f96f36e..20b76ed 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 _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 +var _0x1554=['fs-extra','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','path','connect-timeout','express','Router'];(function(_0x12d603,_0x170b32){var _0x24c8fe=function(_0x5483d8){while(--_0x5483d8){_0x12d603['push'](_0x12d603['shift']());}};_0x24c8fe(++_0x170b32);}(_0x1554,0x8c));var _0x4155=function(_0x3adc34,_0x442cc0){_0x3adc34=_0x3adc34-0x0;var _0x5586bc=_0x1554[_0x3adc34];return _0x5586bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4155('0x0'));var timeout=require(_0x4155('0x1'));var express=require(_0x4155('0x2'));var router=express[_0x4155('0x3')]();var fs_extra=require(_0x4155('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4155('0x5'));router[_0x4155('0x6')]('/',auth[_0x4155('0x7')](),controller[_0x4155('0x8')]);router[_0x4155('0x6')]('/describe',auth[_0x4155('0x7')](),controller[_0x4155('0x9')]);router[_0x4155('0x6')](_0x4155('0xa'),auth[_0x4155('0x7')](),controller['show']);router[_0x4155('0xb')]('/',auth[_0x4155('0x7')](),controller[_0x4155('0xc')]);router[_0x4155('0xd')](_0x4155('0xa'),auth[_0x4155('0x7')](),controller[_0x4155('0xe')]);router[_0x4155('0xf')](_0x4155('0xa'),auth[_0x4155('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3fefec3..239a4c0 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 _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 +var _0x21f9=['INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x21ec2a,_0x2e6abf){var _0x553942=function(_0x550d68){while(--_0x550d68){_0x21ec2a['push'](_0x21ec2a['shift']());}};_0x553942(++_0x2e6abf);}(_0x21f9,0xfd));var _0x921f=function(_0x5d3c28,_0xf86932){_0x5d3c28=_0x5d3c28-0x0;var _0x7940de=_0x21f9[_0x5d3c28];return _0x7940de;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x921f('0x0'));module['exports']={'name':{'type':Sequelize[_0x921f('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'unique':_0x921f('0x2')},'description':{'type':Sequelize[_0x921f('0x1')]},'mapKey':{'type':Sequelize[_0x921f('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x3')},'key':{'type':Sequelize[_0x921f('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x4')},'customerAlias':{'type':Sequelize[_0x921f('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x921f('0x9')](_0x921f('0xa'),'squared'),'defaultValue':_0x921f('0xa')},'header_online':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xb')},'start_chat_button':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xc')},'offline_chat_button':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xd')},'header_offline':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xe')},'download_transcript':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x921f('0x10')]},'closingQuestion':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x13')},'noteTitle':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0xd')},'skipMessageButton':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x16')},'conditionAgreement':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x921f('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x921f('0x9')](_0x921f('0x17'),_0x921f('0x18')),'defaultValue':_0x921f('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x921f('0x10')],'defaultValue':function(){return JSON[_0x921f('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x921f('0x1a'),'type':_0x921f('0x1b'),'required':!![]},'props':{'title':_0x921f('0x1a'),'helpText':''}},{'type':_0x921f('0x1c'),'props':{'title':_0x921f('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x921f('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x921f('0x1d')](_0x921f('0x1e'))?JSON[_0x921f('0x1f')](this[_0x921f('0x1d')](_0x921f('0x1e'))):{};},'set':function(_0x24c66a){return this[_0x921f('0x20')](_0x921f('0x1e'),JSON['stringify'](_0x24c66a));}},'offlineForm':{'type':Sequelize[_0x921f('0x10')],'defaultValue':function(){return JSON[_0x921f('0x19')]({'items':[{'type':_0x921f('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x921f('0x3')},'variable':null},{'type':_0x921f('0x21'),'config':{'placeholder':_0x921f('0x22')},'props':{'title':_0x921f('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x921f('0x1d')]('offlineForm')?JSON[_0x921f('0x1f')](this['getDataValue'](_0x921f('0x23'))):{};},'set':function(_0xf0a137){return this[_0x921f('0x20')](_0x921f('0x23'),JSON[_0x921f('0x19')](_0xf0a137));}},'token':{'type':Sequelize[_0x921f('0x1')],'defaultValue':function(){return rs[_0x921f('0x24')]();}},'autoclose':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x921f('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x921f('0x1')]},'waitingTitle':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x27')},'offlineMessageBody':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x16')},'sendUnmanaged':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x921f('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x921f('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x921f('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x921f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x2b')},'verticalAlignment':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x2c')},'messagesAlignment':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x2d')},'defaultTitle':{'type':Sequelize[_0x921f('0x1')]},'customerAvatar':{'type':Sequelize[_0x921f('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x921f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x921f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x921f('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x921f('0x7')],'comment':_0x921f('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x561c38){if(!_0x561c38)this[_0x921f('0x20')](_0x921f('0x30'),null);this[_0x921f('0x20')](_0x921f('0x31'),_0x561c38);}},'vidaooEscalation':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x921f('0x1')]},'vidaooTopic':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x32')},'vidaooNote':{'type':Sequelize[_0x921f('0x1')],'defaultValue':function(){return _0x921f('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x921f('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x921f('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 25b3149..4fd8501 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 _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 +var _0xba1e=['EventManager','notify','offline','ValidationError','no\x20available\x20attributes','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','Intervals','interval','getProactiveActions','../../config/license/util','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.12.2','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','replace','alignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','keys','find','create','body','trim','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','address','forEach','testWildcardValidity','describe','addDisposition','Disposition','findOne','pick','ChatWebsiteId','options','includeAll','removeDispositions','ids','getAnswers','CannedAnswer','file','agentAvatar','filename','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','sitepic','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','isNil','Interval','resolve','timezone','ifTime','chat','from','From\x20is\x20mandatory','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','mapKey','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','defaults','headers','threadId','ChatInteraction','closed','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','Start','startRouting'];(function(_0x521106,_0x10d3ec){var _0xd55a3f=function(_0x12cd98){while(--_0x12cd98){_0x521106['push'](_0x521106['shift']());}};_0xd55a3f(++_0x10d3ec);}(_0xba1e,0x6b));var _0xeba1=function(_0x3a8688,_0x347bd2){_0x3a8688=_0x3a8688-0x0;var _0x1f61a7=_0xba1e[_0x3a8688];return _0x1f61a7;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require(_0xeba1('0x0'));var fs=require('fs');var fs_extra=require(_0xeba1('0x1'));var _=require(_0xeba1('0x2'));var querystring=require(_0xeba1('0x3'));var htmlToText=require(_0xeba1('0x4'));var Redis=require(_0xeba1('0x5'));var jayson=require(_0xeba1('0x6'));var qs=require(_0xeba1('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xeba1('0x8'));var APIBadRequestError=require(_0xeba1('0x9'))[_0xeba1('0xa')];var APINotFoundError=require('../../errors/api')[_0xeba1('0xb')];var APIOutOfIntervalError=require(_0xeba1('0x9'))[_0xeba1('0xc')];var APIHandleError=require('../../errors/api')[_0xeba1('0xd')];var APIConflictError=require(_0xeba1('0x9'))[_0xeba1('0xe')];var wildcardUtils=require(_0xeba1('0xf'));var URL=require('url')[_0xeba1('0x10')];var db=require(_0xeba1('0x11'))['db'];config[_0xeba1('0x12')]=_['defaults'](config['redis'],{'host':_0xeba1('0x13'),'port':0x18eb});var socket=require(_0xeba1('0x14'))(new Redis(config[_0xeba1('0x12')]));require(_0xeba1('0x15'))[_0xeba1('0x16')](socket);var client=jayson[_0xeba1('0x17')]['http']({'port':0x232c});var client9002=jayson[_0xeba1('0x17')][_0xeba1('0x18')]({'port':0x232a});var client9003=jayson['client'][_0xeba1('0x18')]({'port':0x232b});var client9001=jayson[_0xeba1('0x17')][_0xeba1('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x397063,_0x49afc7,_0x486f62,_0x37769e){return new Promise(function(_0x4f7818,_0x1e3d7d){var _0x2138ac=_0x37769e||client;return _0x2138ac[_0xeba1('0x19')](_0x397063,_0x486f62)['then'](function(_0x7d3db3){logger[_0xeba1('0x1a')](_0xeba1('0x1b'),_0x49afc7,_0xeba1('0x1c'));logger['debug'](_0xeba1('0x1d'),_0x49afc7,_0xeba1('0x1c'),JSON[_0xeba1('0x1e')](_0x7d3db3));if(_0x7d3db3[_0xeba1('0x1f')]){if(_0x7d3db3[_0xeba1('0x1f')][_0xeba1('0x20')]===0x1f4){logger[_0xeba1('0x1f')](_0xeba1('0x1b'),_0x49afc7,_0x7d3db3[_0xeba1('0x1f')][_0xeba1('0x21')]);return _0x1e3d7d(_0x7d3db3['error'][_0xeba1('0x21')]);}logger[_0xeba1('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x49afc7,_0x7d3db3[_0xeba1('0x1f')][_0xeba1('0x21')]);return _0x4f7818(_0x7d3db3['error'][_0xeba1('0x21')]);}else{logger[_0xeba1('0x1a')](_0xeba1('0x1b'),_0x49afc7,_0xeba1('0x1c'));_0x4f7818(_0x7d3db3['result'][_0xeba1('0x21')]);}})[_0xeba1('0x22')](function(_0x16fdc2){logger['error'](_0xeba1('0x1b'),_0x49afc7,_0x16fdc2);_0x1e3d7d(_0x16fdc2);});});}function respondWithStatusCode(_0x15c721,_0x5cf19c){_0x5cf19c=_0x5cf19c||0xcc;return function(_0x5cf7ec){if(_0x5cf7ec){return _0x15c721[_0xeba1('0x23')](_0x5cf19c);}return _0x15c721[_0xeba1('0x24')](_0x5cf19c)[_0xeba1('0x25')]();};}function respondWithResult(_0x3a45ee,_0x4ae303){_0x4ae303=_0x4ae303||0xc8;return function(_0x2bbfdb){if(_0x2bbfdb){return _0x3a45ee['status'](_0x4ae303)[_0xeba1('0x26')](_0x2bbfdb);}};}function respondWithFilteredResult(_0x3c63d5,_0x167823){return function(_0x343044){if(_0x343044){var _0x4e92c6=typeof _0x167823['offset']==='undefined'&&typeof _0x167823['limit']===_0xeba1('0x27');var _0x2558cd=_0x343044[_0xeba1('0x28')];var _0x2158d8=_0x4e92c6?0x0:_0x167823[_0xeba1('0x29')];var _0x374407=_0x4e92c6?_0x343044[_0xeba1('0x28')]:_0x167823['offset']+_0x167823[_0xeba1('0x2a')];var _0x22f322;if(_0x374407>=_0x2558cd){_0x374407=_0x2558cd;_0x22f322=0xc8;}else{_0x22f322=0xce;}_0x3c63d5['status'](_0x22f322);return _0x3c63d5['set'](_0xeba1('0x2b'),_0x2158d8+'-'+_0x374407+'/'+_0x2558cd)['json'](_0x343044);}return null;};}function saveUpdates(_0xeec822){return function(_0x112d29){if(_0x112d29){return _0x112d29[_0xeba1('0x2c')](_0xeec822)[_0xeba1('0x2d')](function(_0x5579fa){return _0x5579fa;});}return null;};}function removeEntity(_0x3b970b){return function(_0x161e1b){if(_0x161e1b){return _0x161e1b[_0xeba1('0x2e')]()[_0xeba1('0x2d')](function(){var _0x58b3dc=_0x161e1b[_0xeba1('0x2f')]({'plain':!![]});var _0x405ec1=_0xeba1('0x30');return db[_0xeba1('0x31')][_0xeba1('0x2e')]({'where':{'type':_0x405ec1,'resourceId':_0x58b3dc['id']}})['then'](function(){return _0x161e1b;});})[_0xeba1('0x2d')](function(){_0x3b970b[_0xeba1('0x24')](0xcc)[_0xeba1('0x25')]();});}};}function handleEntityNotFound(_0x47cfc1){return function(_0x56d415){if(!_0x56d415){_0x47cfc1[_0xeba1('0x23')](0x194);}return _0x56d415;};}function handleError(_0x4eab63,_0x1a359f){_0x1a359f=_0x1a359f||0x1f4;return function(_0x2d162b){logger[_0xeba1('0x1f')](_0x2d162b[_0xeba1('0x32')]);if(_0x2d162b[_0xeba1('0x33')]){delete _0x2d162b[_0xeba1('0x33')];}_0x4eab63[_0xeba1('0x24')](_0x1a359f)[_0xeba1('0x34')](_0x2d162b);};}function createInteractionObject(_0x369743,_0x53e47f,_0x392a6b,_0x41272c){var _0x4eff52=require(_0xeba1('0x35'));var _0x30ba3e=new _0x4eff52();var _0x139898=_0x30ba3e[_0xeba1('0x36')](_0x392a6b[_0xeba1('0x37')])[_0xeba1('0x38')]();var _0x10324f=_0x53e47f[_0xeba1('0x39')];if(_0x392a6b[_0xeba1('0x3a')]){_0x10324f=_0x392a6b[_0xeba1('0x3a')];}else if(_0x392a6b[_0xeba1('0x3b')]){_0x10324f=_[_0xeba1('0x3c')](_0x392a6b[_0xeba1('0x3b')][_0xeba1('0x3d')](','));}return{'ContactId':_0x41272c['id'],'ChatWebsiteId':_0x369743,'from':(_0x41272c['firstName']||'')+'\x20'+(_0x41272c[_0xeba1('0x3e')]||''),'customerIp':_0x10324f,'customerPort':_0x392a6b['x-real-port']?_0x392a6b[_0xeba1('0x3f')]:null,'referer':_0x53e47f[_0xeba1('0x40')],'browserName':_0x139898[_0xeba1('0x41')][_0xeba1('0x33')]&&_0x139898['browser'][_0xeba1('0x42')]?util[_0xeba1('0x43')](_0xeba1('0x44'),_0x139898[_0xeba1('0x41')][_0xeba1('0x33')],_0x139898[_0xeba1('0x41')][_0xeba1('0x42')]):_0xeba1('0x45'),'browserVersion':_0x139898[_0xeba1('0x41')][_0xeba1('0x42')]||_0xeba1('0x45'),'osName':util[_0xeba1('0x43')](_0xeba1('0x44'),_0x139898['os'][_0xeba1('0x33')],_0x139898['os'][_0xeba1('0x42')]),'osVersion':_0x139898['os'][_0xeba1('0x42')],'deviceModel':_0x139898[_0xeba1('0x46')][_0xeba1('0x47')]&&_0x139898['device'][_0xeba1('0x48')]?util[_0xeba1('0x43')](_0xeba1('0x49'),_0x139898[_0xeba1('0x46')][_0xeba1('0x47')],_0x139898[_0xeba1('0x46')]['vendor'],_0x139898[_0xeba1('0x46')][_0xeba1('0x4a')]):null,'deviceVendor':_0x139898['device'][_0xeba1('0x48')],'deviceType':_0x139898['device'][_0xeba1('0x4a')],'formData':JSON[_0xeba1('0x1e')](_0x53e47f)};}exports[_0xeba1('0x4b')]=function(_0x5b7feb,_0x1fe7dc){var _0x65e57d={'include':[{'model':db[_0xeba1('0x4c')],'as':_0xeba1('0x4d')}]},_0x32a8ab={},_0x303dc5={'count':0x0,'rows':[]};var _0x44d671=_[_0xeba1('0x4e')](db[_0xeba1('0x4f')][_0xeba1('0x50')],function(_0x521b4c){return{'name':_0x521b4c[_0xeba1('0x51')],'type':_0x521b4c[_0xeba1('0x4a')][_0xeba1('0x52')]};});_0x32a8ab[_0xeba1('0x47')]=_[_0xeba1('0x4e')](_0x44d671,_0xeba1('0x33'));_0x32a8ab[_0xeba1('0x53')]=_['keys'](_0x5b7feb[_0xeba1('0x53')]);_0x32a8ab[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x32a8ab['model'],_0x32a8ab['query']);_0x65e57d['attributes']=_[_0xeba1('0x55')](_0x32a8ab['model'],qs[_0xeba1('0x56')](_0x5b7feb['query']['fields']));_0x65e57d[_0xeba1('0x57')]=_0x65e57d[_0xeba1('0x57')][_0xeba1('0x58')]?_0x65e57d[_0xeba1('0x57')]:_0x32a8ab[_0xeba1('0x47')];if(!_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x65e57d[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x5b7feb['query'][_0xeba1('0x2a')]);_0x65e57d['offset']=qs[_0xeba1('0x29')](_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x29')]);}_0x65e57d[_0xeba1('0x5b')]=qs['sort'](_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x65e57d[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_['pick'](_0x5b7feb[_0xeba1('0x53')],_0x32a8ab['filters']),_0x44d671);if(_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x65e57d[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x65e57d[_0xeba1('0x5d')],{'$or':_[_0xeba1('0x4e')](_0x44d671,function(_0xe1e50e){if(_0xe1e50e[_0xeba1('0x4a')]!==_0xeba1('0x60')){var _0x1972dd={};_0x1972dd[_0xe1e50e[_0xeba1('0x33')]]={'$like':'%'+_0x5b7feb[_0xeba1('0x53')]['filter']+'%'};return _0x1972dd;}})});}_0x65e57d=_[_0xeba1('0x5f')]({},_0x65e57d,_0x5b7feb['options']);var _0x1d87c1={'where':_0x65e57d[_0xeba1('0x5d')]};return db['ChatWebsite'][_0xeba1('0x28')](_0x1d87c1)[_0xeba1('0x2d')](function(_0x31a647){_0x303dc5['count']=_0x31a647;if(_0x5b7feb[_0xeba1('0x53')]['includeAll']){_0x65e57d[_0xeba1('0x61')]=[{'all':!![]}];}return db['ChatWebsite'][_0xeba1('0x62')](_0x65e57d);})[_0xeba1('0x2d')](function(_0xf802ac){_0x303dc5[_0xeba1('0x63')]=_0xf802ac;return _0x303dc5;})[_0xeba1('0x2d')](respondWithFilteredResult(_0x1fe7dc,_0x65e57d))['catch'](handleError(_0x1fe7dc,null));};exports[_0xeba1('0x64')]=function(_0x14fd24,_0x3b181b){var _0x2cf1da={'raw':![],'where':{'id':_0x14fd24[_0xeba1('0x65')]['id']},'include':[{'model':db[_0xeba1('0x4c')],'as':_0xeba1('0x4d')}]},_0x297834={};_0x297834[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0x4f')][_0xeba1('0x50')]);_0x297834['query']=_['keys'](_0x14fd24[_0xeba1('0x53')]);_0x297834['filters']=_[_0xeba1('0x55')](_0x297834[_0xeba1('0x47')],_0x297834[_0xeba1('0x53')]);_0x2cf1da['attributes']=_[_0xeba1('0x55')](_0x297834[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0x14fd24[_0xeba1('0x53')][_0xeba1('0x56')]));_0x2cf1da[_0xeba1('0x57')]=_0x2cf1da['attributes']['length']?_0x2cf1da[_0xeba1('0x57')]:_0x297834['model'];if(_0x14fd24['query']['includeAll']){_0x2cf1da[_0xeba1('0x61')]=[{'all':!![]}];}_0x2cf1da=_[_0xeba1('0x5f')]({},_0x2cf1da,_0x14fd24['options']);return db[_0xeba1('0x4f')][_0xeba1('0x67')](_0x2cf1da)[_0xeba1('0x2d')](handleEntityNotFound(_0x3b181b,null))['then'](respondWithResult(_0x3b181b,null))['catch'](handleError(_0x3b181b,null));};exports[_0xeba1('0x68')]=function(_0x5037d2,_0x4dbebb){var _0x54f5ba=null;_0x5037d2[_0xeba1('0x69')]['address'][_0xeba1('0x3d')](',')['forEach'](_0x502bea=>{if(_0x502bea['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x502bea[_0xeba1('0x6a')]())){_0x54f5ba=new APIBadRequestError('\x22'+_0x502bea[_0xeba1('0x6a')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x54f5ba){return handleError(_0x4dbebb,null)(_0x54f5ba);}return db['ChatWebsite'][_0xeba1('0x68')](_0x5037d2['body'],{})['then'](function(_0x68350d){var _0x418cfb=_0x5037d2[_0xeba1('0x6b')][_0xeba1('0x2f')]({'plain':!![]});if(!_0x418cfb)throw new Error(_0xeba1('0x6c'));if(_0x418cfb[_0xeba1('0x6d')]===_0xeba1('0x6b')){var _0x5b76ef=_0x68350d[_0xeba1('0x2f')]({'plain':!![]});var _0x1a2fad=_0xeba1('0x30');return db[_0xeba1('0x6e')][_0xeba1('0x67')]({'where':{'name':_0x1a2fad,'userProfileId':_0x418cfb[_0xeba1('0x6f')]},'raw':!![]})[_0xeba1('0x2d')](function(_0x28f0d4){if(_0x28f0d4&&_0x28f0d4[_0xeba1('0x70')]===0x0){return db[_0xeba1('0x31')]['create']({'name':_0x5b76ef[_0xeba1('0x33')],'resourceId':_0x5b76ef['id'],'type':_0x28f0d4[_0xeba1('0x33')],'sectionId':_0x28f0d4['id']},{})['then'](function(){return _0x68350d;});}else{return _0x68350d;}})[_0xeba1('0x22')](function(_0x2ed240){logger[_0xeba1('0x1f')](_0xeba1('0x71'),_0x2ed240);throw _0x2ed240;});}return _0x68350d;})[_0xeba1('0x2d')](respondWithResult(_0x4dbebb,0xc9))[_0xeba1('0x22')](handleError(_0x4dbebb,null));};exports['update']=function(_0x1e9b1c,_0x109abc){var _0x43ec32=null;_0x1e9b1c[_0xeba1('0x69')][_0xeba1('0x72')]['split'](',')[_0xeba1('0x73')](_0x3c02e9=>{if(_0x3c02e9[_0xeba1('0x6a')]()!==''&&!wildcardUtils[_0xeba1('0x74')](_0x3c02e9[_0xeba1('0x6a')]())){_0x43ec32=new APIBadRequestError('\x22'+_0x3c02e9[_0xeba1('0x6a')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x43ec32){return handleError(_0x109abc,null)(_0x43ec32);}if(_0x1e9b1c['body']['id']){delete _0x1e9b1c[_0xeba1('0x69')]['id'];}return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x1e9b1c[_0xeba1('0x65')]['id']},'include':[{'model':db[_0xeba1('0x4c')],'as':'mandatoryDispositionPause'}]})[_0xeba1('0x2d')](handleEntityNotFound(_0x109abc,null))['then'](saveUpdates(_0x1e9b1c[_0xeba1('0x69')],null))['then'](respondWithResult(_0x109abc,null))['catch'](handleError(_0x109abc,null));};exports[_0xeba1('0x2e')]=function(_0x5ee7ee,_0x39b8f1){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x5ee7ee[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x39b8f1,null))[_0xeba1('0x2d')](removeEntity(_0x39b8f1,null))[_0xeba1('0x22')](handleError(_0x39b8f1,null));};exports[_0xeba1('0x75')]=function(_0x4ae943,_0x240956){return db[_0xeba1('0x4f')][_0xeba1('0x75')]()[_0xeba1('0x2d')](respondWithResult(_0x240956,null))[_0xeba1('0x22')](handleError(_0x240956,null));};exports[_0xeba1('0x76')]=function(_0x332b41,_0x1c6013){if(_0x332b41['body']['id']){delete _0x332b41[_0xeba1('0x69')]['id'];}return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x332b41[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x1c6013,null))[_0xeba1('0x2d')](function(_0x22604f){if(_0x22604f){_0x332b41['body']['ChatWebsiteId']=_0x22604f['id'];return db[_0xeba1('0x77')][_0xeba1('0x68')](_0x332b41['body']);}})['then'](respondWithResult(_0x1c6013,null))[_0xeba1('0x22')](handleError(_0x1c6013,null));};exports['getDispositions']=function(_0x384247,_0x3a39b3){var _0x42bed7={'raw':![],'where':{}};var _0x186c88={};var _0x3f3a1a={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x384247[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x3a39b3,null))[_0xeba1('0x2d')](function(_0xbefbef){if(_0xbefbef){_0x186c88['model']=_['keys'](db[_0xeba1('0x77')][_0xeba1('0x50')]);_0x186c88[_0xeba1('0x53')]=_['keys'](_0x384247[_0xeba1('0x53')]);_0x186c88[_0xeba1('0x54')]=_['intersection'](_0x186c88['model'],_0x186c88[_0xeba1('0x53')]);_0x42bed7[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x186c88[_0xeba1('0x47')],qs['fields'](_0x384247[_0xeba1('0x53')][_0xeba1('0x56')]));_0x42bed7[_0xeba1('0x57')]=_0x42bed7['attributes'][_0xeba1('0x58')]?_0x42bed7[_0xeba1('0x57')]:_0x186c88[_0xeba1('0x47')];if(!_0x384247[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x42bed7['limit']=qs[_0xeba1('0x2a')](_0x384247[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x42bed7[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x384247['query'][_0xeba1('0x29')]);}_0x42bed7[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x384247[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x42bed7['where']=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x384247[_0xeba1('0x53')],_0x186c88['filters']));_0x42bed7[_0xeba1('0x5d')][_0xeba1('0x7a')]=_0xbefbef['id'];if(_0x384247[_0xeba1('0x53')]['filter']){_0x42bed7[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x42bed7['where'],{'$or':_[_0xeba1('0x4e')](_0x42bed7[_0xeba1('0x57')],function(_0x3873e9){var _0x279e29={};_0x279e29[_0x3873e9]={'$like':'%'+_0x384247[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x279e29;})});}_0x42bed7=_[_0xeba1('0x5f')]({},_0x42bed7,_0x384247[_0xeba1('0x7b')]);return db['Disposition']['count']({'where':_0x42bed7[_0xeba1('0x5d')]})[_0xeba1('0x2d')](function(_0x22ca7a){_0x3f3a1a[_0xeba1('0x28')]=_0x22ca7a;if(_0x384247[_0xeba1('0x53')][_0xeba1('0x7c')]){_0x42bed7[_0xeba1('0x61')]=[{'all':!![]}];}return db[_0xeba1('0x77')]['findAll'](_0x42bed7);})[_0xeba1('0x2d')](function(_0x7eb43){_0x3f3a1a[_0xeba1('0x63')]=_0x7eb43;return _0x3f3a1a;});}})[_0xeba1('0x2d')](respondWithFilteredResult(_0x3a39b3,_0x42bed7))[_0xeba1('0x22')](handleError(_0x3a39b3,null));};exports[_0xeba1('0x7d')]=function(_0x41758d,_0x29ebb7){return db['ChatWebsite'][_0xeba1('0x67')]({'where':{'id':_0x41758d[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x29ebb7,null))['then'](function(_0x4f1949){if(_0x4f1949){return _0x4f1949['removeDispositions'](_0x41758d[_0xeba1('0x53')][_0xeba1('0x7e')]);}})[_0xeba1('0x2d')](respondWithStatusCode(_0x29ebb7,null))[_0xeba1('0x22')](handleError(_0x29ebb7,null));};exports['addAnswer']=function(_0xc4bfa2,_0x58d356){if(_0xc4bfa2['body']['id']){delete _0xc4bfa2[_0xeba1('0x69')]['id'];}return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0xc4bfa2[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x58d356,null))[_0xeba1('0x2d')](function(_0x1f45cc){if(_0x1f45cc){_0xc4bfa2[_0xeba1('0x69')]['ChatWebsiteId']=_0x1f45cc['id'];return db['CannedAnswer'][_0xeba1('0x68')](_0xc4bfa2['body']);}})[_0xeba1('0x2d')](respondWithResult(_0x58d356,null))['catch'](handleError(_0x58d356,null));};exports[_0xeba1('0x7f')]=function(_0xe25f2e,_0x1ae090){var _0x14ea74={'raw':![],'where':{}};var _0x257754={};var _0x21bfb7={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0xe25f2e['params']['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x1ae090,null))[_0xeba1('0x2d')](function(_0x4c5cbd){if(_0x4c5cbd){_0x257754[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0x80')][_0xeba1('0x50')]);_0x257754[_0xeba1('0x53')]=_[_0xeba1('0x66')](_0xe25f2e['query']);_0x257754[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x257754[_0xeba1('0x47')],_0x257754['query']);_0x14ea74[_0xeba1('0x57')]=_['intersection'](_0x257754[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x56')]));_0x14ea74[_0xeba1('0x57')]=_0x14ea74['attributes'][_0xeba1('0x58')]?_0x14ea74[_0xeba1('0x57')]:_0x257754['model'];if(!_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x14ea74[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0xe25f2e['query'][_0xeba1('0x2a')]);_0x14ea74[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0xe25f2e['query']['offset']);}_0x14ea74['order']=qs['sort'](_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x14ea74[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0xe25f2e[_0xeba1('0x53')],_0x257754[_0xeba1('0x54')]));_0x14ea74['where'][_0xeba1('0x7a')]=_0x4c5cbd['id'];if(_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x14ea74[_0xeba1('0x5d')]=_['merge'](_0x14ea74['where'],{'$or':_['map'](_0x14ea74['attributes'],function(_0x145495){var _0x22c461={};_0x22c461[_0x145495]={'$like':'%'+_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x22c461;})});}_0x14ea74=_['merge']({},_0x14ea74,_0xe25f2e[_0xeba1('0x7b')]);return db[_0xeba1('0x80')][_0xeba1('0x28')]({'where':_0x14ea74[_0xeba1('0x5d')]})['then'](function(_0x1f6c61){_0x21bfb7[_0xeba1('0x28')]=_0x1f6c61;if(_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x7c')]){_0x14ea74[_0xeba1('0x61')]=[{'all':!![]}];}return db[_0xeba1('0x80')][_0xeba1('0x62')](_0x14ea74);})[_0xeba1('0x2d')](function(_0x306746){_0x21bfb7['rows']=_0x306746;return _0x21bfb7;});}})['then'](respondWithFilteredResult(_0x1ae090,_0x14ea74))[_0xeba1('0x22')](handleError(_0x1ae090,null));};exports['removeAnswers']=function(_0x2ff0d2,_0x250300){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x2ff0d2[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x250300,null))[_0xeba1('0x2d')](function(_0x25d1ea){if(_0x25d1ea){return _0x25d1ea['removeAnswers'](_0x2ff0d2[_0xeba1('0x53')][_0xeba1('0x7e')]);}})[_0xeba1('0x2d')](respondWithStatusCode(_0x250300,null))[_0xeba1('0x22')](handleError(_0x250300,null));};exports['addLogo']=function(_0x39be2e,_0xa32a37){_0x39be2e[_0xeba1('0x69')]['sitepic']=_0x39be2e[_0xeba1('0x81')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x39be2e[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0xa32a37,null))[_0xeba1('0x2d')](saveUpdates(_0x39be2e[_0xeba1('0x69')],null))[_0xeba1('0x2d')](respondWithResult(_0xa32a37,null))[_0xeba1('0x22')](handleError(_0xa32a37,null));};exports['addAvatar']=function(_0x1198cf,_0xbdeec0){_0x1198cf[_0xeba1('0x69')][_0xeba1('0x82')]=_0x1198cf[_0xeba1('0x81')][_0xeba1('0x83')];return db[_0xeba1('0x4f')]['find']({'where':{'id':_0x1198cf[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0xbdeec0,null))[_0xeba1('0x2d')](saveUpdates(_0x1198cf[_0xeba1('0x69')],null))['then'](respondWithResult(_0xbdeec0,null))[_0xeba1('0x22')](handleError(_0xbdeec0,null));};exports[_0xeba1('0x84')]=function(_0x355042,_0x2682c2){_0x355042[_0xeba1('0x69')][_0xeba1('0x85')]=_0x355042[_0xeba1('0x81')]['filename'];return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x355042['params']['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x2682c2,null))[_0xeba1('0x2d')](saveUpdates(_0x355042['body'],null))[_0xeba1('0x2d')](respondWithResult(_0x2682c2,null))[_0xeba1('0x22')](handleError(_0x2682c2,null));};exports['addSystemAvatar']=function(_0x3c2a73,_0x4da7bc){_0x3c2a73['body'][_0xeba1('0x86')]=_0x3c2a73[_0xeba1('0x81')][_0xeba1('0x83')];return db[_0xeba1('0x4f')]['find']({'where':{'id':_0x3c2a73[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x4da7bc,null))[_0xeba1('0x2d')](saveUpdates(_0x3c2a73[_0xeba1('0x69')],null))[_0xeba1('0x2d')](respondWithResult(_0x4da7bc,null))[_0xeba1('0x22')](handleError(_0x4da7bc,null));};exports[_0xeba1('0x87')]=function(_0x2c7d7e,_0x177a8a){var _0x9834dc=path[_0xeba1('0x88')](config['root'],_0xeba1('0x89'));var _0x452160={'where':{'id':_0x2c7d7e[_0xeba1('0x65')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x276a5d=![];return require('../../config/license/util')[_0xeba1('0x8a')]()['then'](function(_0x46396f){if(_0x46396f){_0x276a5d=_0x46396f['custom'];}})[_0xeba1('0x2d')](function(){return db['ChatWebsite']['find'](_0x452160);})[_0xeba1('0x2d')](handleEntityNotFound(_0x177a8a,null))[_0xeba1('0x2d')](function(_0x440f0e){if(_0x440f0e){if(!_['isNil'](_0x440f0e[_0xeba1('0x8b')])){if(fs[_0xeba1('0x8c')](path['join'](config[_0xeba1('0x8d')],_0xeba1('0x8e'),_0x440f0e[_0xeba1('0x8b')]))&&_0x276a5d){_0x9834dc=path[_0xeba1('0x88')](config['root'],_0xeba1('0x8e'),_0x440f0e['sitepic']);}}return _0x177a8a[_0xeba1('0x8f')](_0x9834dc);}})['catch'](handleError(_0x177a8a,null));};exports['getAvatar']=function(_0x4a062c,_0x2af028){var _0x733974=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x90'));var _0x2b646b={'where':{'id':_0x4a062c['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xeba1('0x4f')]['find'](_0x2b646b)[_0xeba1('0x2d')](handleEntityNotFound(_0x2af028,null))[_0xeba1('0x2d')](function(_0x3aef0f){if(_0x3aef0f){if(!_['isNil'](_0x3aef0f[_0xeba1('0x82')])){if(fs['existsSync'](path[_0xeba1('0x88')](config['root'],_0xeba1('0x91'),_0x3aef0f[_0xeba1('0x82')]))){_0x733974=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x3aef0f[_0xeba1('0x82')]);}}return _0x2af028[_0xeba1('0x8f')](_0x733974);}})['catch'](handleError(_0x2af028,null));};exports[_0xeba1('0x92')]=function(_0x3fc6f5,_0x5605c3){var _0x504c9f=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x93'));var _0x27c847={'where':{'id':_0x3fc6f5['params']['id']},'attributes':['id',_0xeba1('0x85'),_0xeba1('0x94')],'raw':!![]};return db[_0xeba1('0x4f')][_0xeba1('0x67')](_0x27c847)[_0xeba1('0x2d')](handleEntityNotFound(_0x5605c3,null))[_0xeba1('0x2d')](function(_0x1abd5a){if(_0x1abd5a){if(!_['isNil'](_0x1abd5a[_0xeba1('0x85')])){if(fs[_0xeba1('0x8c')](path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x1abd5a[_0xeba1('0x85')]))&&_0x1abd5a[_0xeba1('0x94')]){_0x504c9f=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x1abd5a['customerAvatar']);}}return _0x5605c3[_0xeba1('0x8f')](_0x504c9f);}})[_0xeba1('0x22')](handleError(_0x5605c3,null));};exports[_0xeba1('0x95')]=function(_0x4aa4f4,_0x130f83){var _0x5078ed=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],'server/files/images/avatars/system_avatar.png');var _0x4e84ca={'where':{'id':_0x4aa4f4['params']['id']},'attributes':['id',_0xeba1('0x86')],'raw':!![]};return db[_0xeba1('0x4f')][_0xeba1('0x67')](_0x4e84ca)[_0xeba1('0x2d')](handleEntityNotFound(_0x130f83,null))['then'](function(_0x3903a6){if(_0x3903a6){if(!_[_0xeba1('0x96')](_0x3903a6[_0xeba1('0x86')])){if(fs['existsSync'](path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x3903a6[_0xeba1('0x86')]))){_0x5078ed=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],'server/files/images/avatars/',_0x3903a6[_0xeba1('0x86')]);}}return _0x130f83[_0xeba1('0x8f')](_0x5078ed);}})[_0xeba1('0x22')](handleError(_0x130f83,null));};function checkWebsiteInterval(_0x69fdff){var _0x45af5a=_0x69fdff[_0xeba1('0x97')];if(!_0x45af5a){return Promise[_0xeba1('0x98')](_0x69fdff);}var _0xee3617=_0x69fdff[_0xeba1('0x99')]||undefined;return _0x45af5a[_0xeba1('0x9a')](_0xee3617)[_0xeba1('0x2d')](function(_0x5bab99){if(!_0x5bab99){throw new APIOutOfIntervalError();}return _0x69fdff;});}exports['notify']=function(_0x5a0de1,_0x218ef1){var _0x5f3092={'body':_0x5a0de1['body'],'channel':_0xeba1('0x9b')};var _0x1c2c84=[];var _0x5c1e21=[];var _0x3deaae={};var _0x131c80=![];if(_0x5a0de1[_0xeba1('0x69')]['id']){delete _0x5a0de1['body']['id'];}if(_[_0xeba1('0x96')](_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x9c')])){throw new APIBadRequestError(_0xeba1('0x9d'));}if(_[_0xeba1('0x96')](_0x5a0de1[_0xeba1('0x69')]['mapKey'])){throw new APIBadRequestError(_0xeba1('0x9e'));}if(_[_0xeba1('0x9f')](_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x69')])){throw new APIBadRequestError(_0xeba1('0xa0'));}var _0x2f2589=_0x5a0de1['body']['customerIp']&&_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x40')];return db[_0xeba1('0xa1')][_0xeba1('0x75')]()[_0xeba1('0x2d')](function(_0x32eb4d){if(!_0x32eb4d){throw new Error('No\x20available\x20attributes');}_0x1c2c84=Object[_0xeba1('0x66')](_0x32eb4d)[_0xeba1('0x5e')](function(_0x4906fe){return![_0xeba1('0xa2'),_0xeba1('0xa3')][_0xeba1('0xa4')](_0x4906fe);});_0x5c1e21=Object['keys'](_0x32eb4d)[_0xeba1('0x5e')](function(_0x33f839){return![_0xeba1('0xa2'),_0xeba1('0xa3'),_0xeba1('0xa5'),_0xeba1('0xa6')][_0xeba1('0xa4')](_0x33f839);});if(!_[_0xeba1('0xa4')](_0x5c1e21,_0x5a0de1[_0xeba1('0x69')]['mapKey'])){throw new APIBadRequestError(_0xeba1('0xa7')+_0x5c1e21['join'](',\x20'));}_0x3deaae[_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xa8')]]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x9c')];})[_0xeba1('0x2d')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x5a0de1[_0xeba1('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0xeba1('0xa9'),'include':[{'model':db[_0xeba1('0xa1')],'as':_0xeba1('0xaa'),'where':_0x3deaae,'limit':0x1,'order':[[_0xeba1('0xa3'),_0xeba1('0xab')]]}]},{'model':db[_0xeba1('0xac')],'as':_0xeba1('0xad')},{'model':db[_0xeba1('0x97')],'as':_0xeba1('0x97'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]});})[_0xeba1('0x2d')](function(_0x5d1684){if(!_0x5d1684){throw new APINotFoundError(util['format'](_0xeba1('0xae'),_0x5a0de1[_0xeba1('0x65')]['id']));}if(_0x2f2589){return checkWebsiteInterval(_0x5d1684);}return _0x5d1684;})['then'](function(_0x205dc1){_0x5f3092[_0xeba1('0xaf')]=_0x205dc1;_0x5f3092[_0xeba1('0xb0')]=_[_0xeba1('0xb1')](_0x205dc1[_0xeba1('0xad')],[_0xeba1('0xb2')],[_0xeba1('0xb3')]);if(_0x5f3092[_0xeba1('0xaf')][_0xeba1('0xad')]){delete _0x5f3092[_0xeba1('0xaf')][_0xeba1('0xad')];}_0x5f3092['list']=_0x205dc1[_0xeba1('0xa9')]||{'id':_0x205dc1[_0xeba1('0xa6')]};if(_0x5f3092[_0xeba1('0xb4')]&&_0x5f3092[_0xeba1('0xb4')]['Contacts'][_0xeba1('0x58')]){return _0x5f3092[_0xeba1('0xb4')][_0xeba1('0xaa')][0x0];}var _0x4edc9f=_[_0xeba1('0xb5')](_0x5a0de1[_0xeba1('0x69')],{'firstName':_0x5a0de1[_0xeba1('0x69')]['from'],'ListId':_0x205dc1['ListId']});_0x4edc9f[_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xa8')]]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x9c')];return db[_0xeba1('0xa1')][_0xeba1('0x68')](_0x4edc9f,{'fields':_0x1c2c84,'raw':!![]});})['then'](function(_0x5f4136){_0x5f3092['contact']=_0x5f4136;var _0x591752=createInteractionObject(_0x5a0de1[_0xeba1('0x65')]['id'],_0x5a0de1[_0xeba1('0x69')],_0x5a0de1[_0xeba1('0xb6')],_0x5f4136);var _0x14aa8c={'ChatWebsiteId':_0x5a0de1[_0xeba1('0x65')]['id']};if(_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')]){_0x14aa8c[_0xeba1('0xb7')]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')];_0x14aa8c['closed']=![];return db[_0xeba1('0xb8')]['find']({'where':_0x14aa8c})[_0xeba1('0x2d')](function(_0x1bba0a){var _0x5e7423=_0x5a0de1['body']['customerIp']&&_0x5a0de1[_0xeba1('0x69')]['referer'];if(_0x1bba0a){_0x131c80=!![];return _0x1bba0a;}else if(!_0x5e7423&&_0x1bba0a&&_0x1bba0a[_0xeba1('0xb9')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x591752[_0xeba1('0xb7')]=_0x5a0de1['body']['threadId'];_0x591752[_0xeba1('0xba')]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xba')];return db['ChatInteraction'][_0xeba1('0x68')](_0x591752);});}_0x14aa8c[_0xeba1('0xbb')]=_0x5f4136['id'];if(_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbc')]&&_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbc')]['id']){_0x14aa8c['id']=_0x5a0de1['body'][_0xeba1('0xbc')]['id'];return db[_0xeba1('0xb8')][_0xeba1('0x67')]({'where':_0x14aa8c})[_0xeba1('0x2d')](function(_0x1b9811){var _0x21dea8=_0x5a0de1['body'][_0xeba1('0x39')]&&_0x5a0de1['body']['referer'];if(!_0x21dea8&&_0x1b9811&&_0x1b9811[_0xeba1('0xb9')]){throw new APIConflictError(_0xeba1('0xbd'));}else if(_0x1b9811){_0x131c80=!![];return _0x1b9811;}else{return db['ChatInteraction'][_0xeba1('0x68')](_0x591752);}});}return db[_0xeba1('0xb8')]['create'](_0x591752);})[_0xeba1('0x2d')](function(_0x2ea0a3){if(!_0x131c80){return _0x2ea0a3;}var _0x45b00f={'from':(_0x5f3092[_0xeba1('0xbe')]['firstName']||'')+'\x20'+(_0x5f3092[_0xeba1('0xbe')][_0xeba1('0x3e')]||'')};if(_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')]&&_0x5a0de1[_0xeba1('0x69')]['messageId']&&_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')]!=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbf')]){_0x45b00f[_0xeba1('0xb7')]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbf')];}return _0x2ea0a3[_0xeba1('0x2c')](_0x45b00f);})[_0xeba1('0x2d')](function(_0x79cc17){_0x5f3092['interaction']=_0x79cc17[_0xeba1('0x2f')]({'plain':!![]});_0x5f3092[_0xeba1('0xbc')]['created']=!_0x131c80;if(_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xc0')]){if(_0x5f3092[_0xeba1('0xaf')][_0xeba1('0xc1')]){_0x5f3092[_0xeba1('0xb0')][_0xeba1('0xc2')]({'id':0x0,'priority':_0x5f3092['applications']['length']+0x1,'app':_0xeba1('0xc3'),'appdata':_0xeba1('0xc4'),'interval':_0xeba1('0xc5')});}}return db['ChatMessage']['create']({'body':_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x69')],'ChatWebsiteId':_0x5a0de1[_0xeba1('0x65')]['id'],'ChatInteractionId':_0x79cc17['id'],'direction':'in','ContactId':_0x5f3092['contact']['id'],'AttachmentId':_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xc6')]});})[_0xeba1('0x2d')](function(_0x283f4f){_0x5f3092['message']=_0x283f4f;if(!_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xc7')]){return;}return db[_0xeba1('0xc8')][_0xeba1('0x67')]({'attributes':['id',_0xeba1('0x33')],'where':{'id':_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xc7')]}});})['then'](function(_0x365ad0){if(_0x365ad0){_0x5f3092[_0xeba1('0xb0')][_0xeba1('0xc9')]({'id':0x0,'priority':0x0,'app':_0xeba1('0xca'),'appdata':_0x365ad0[_0xeba1('0x33')]+','+(_0x5f3092['account'][_0xeba1('0xcb')]||0xa),'interval':_0xeba1('0xc5')});_0x5f3092[_0xeba1('0xcc')]=!![];}if(!_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xcd')]){return;}return db[_0xeba1('0xce')][_0xeba1('0x67')]({'attributes':['id',_0xeba1('0x33')],'where':{'id':_0x5f3092[_0xeba1('0xbc')]['queueId']}});})[_0xeba1('0x2d')](function(_0x2e47f3){if(_0x2e47f3){_0x5f3092[_0xeba1('0xb0')][_0xeba1('0xc9')]({'id':0x0,'priority':0x1,'app':_0xeba1('0xcf'),'appdata':_0x2e47f3[_0xeba1('0x33')]+','+(_0x5f3092['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xeba1('0xd0'),_0xeba1('0xd1'),_0x5f3092);})[_0xeba1('0x2d')](function(_0x4497c1){respondWithRpcPromise(_0xeba1('0xd2'),_0xeba1('0xd2'),{'event':_0xeba1('0xd3'),'message':_0x4497c1},client9002);return _0x4497c1;})[_0xeba1('0x2d')](respondWithResult(_0x218ef1,null))[_0xeba1('0x22')](APIHandleError(_0x218ef1));};exports[_0xeba1('0xd4')]=function(_0x5d6926,_0x509fb2){var _0xd8d5dd,_0x271338,_0x3ea268;var _0x1a84ce=[];var _0x488fca={};var _0x382fd9=_0x5d6926['files']||[];var _0x47d9b9=[];var _0x4989b9;return db[_0xeba1('0xa1')][_0xeba1('0x75')]()[_0xeba1('0x2d')](function(_0x51edd8){if(!_0x51edd8){throw new db['Sequelize'][(_0xeba1('0xd5'))](_0xeba1('0xd6'));}_0x1a84ce=_['difference'](_[_0xeba1('0x66')](_0x51edd8),['createdAt',_0xeba1('0xa3'),_0xeba1('0xa5'),_0xeba1('0xa6')]);if(_0x5d6926[_0xeba1('0x69')]['id']){delete _0x5d6926[_0xeba1('0x69')]['id'];}if(_['isNil'](_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')])){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xeba1('0x96')](_0x5d6926[_0xeba1('0x69')]['body'])||_0x5d6926[_0xeba1('0x69')][_0xeba1('0x69')]===''){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))][(_0xeba1('0xd5'))](_0xeba1('0xd8')));}if(_[_0xeba1('0x96')](_0x5d6926['body'][_0xeba1('0xd9')])){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))][(_0xeba1('0xd5'))](_0xeba1('0xda')+_0x1a84ce));}if(!_[_0xeba1('0xa4')](_0x1a84ce,_0x5d6926[_0xeba1('0x69')][_0xeba1('0xd9')])){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))][(_0xeba1('0xd5'))](_0xeba1('0xdb')+_0x1a84ce));}_0x488fca[_0x5d6926['body'][_0xeba1('0xd9')]]=_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')];})[_0xeba1('0x2d')](function(){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x5d6926['params']['id']},'include':[{'model':db['CmList'],'as':_0xeba1('0xa9')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xeba1('0x2d')](handleEntityNotFound(_0x509fb2,null))[_0xeba1('0x2d')](function(_0x23370c){if(_0x23370c&&_0x23370c[_0xeba1('0xa9')]){_0x271338=_0x23370c;var _0x4160c0=_[_0xeba1('0xb5')](_0x5d6926[_0xeba1('0x69')],{'firstName':_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')],'phone':_0x5d6926[_0xeba1('0x69')]['from'],'ListId':_0x23370c[_0xeba1('0xa6')]});_0x4160c0[_0x5d6926[_0xeba1('0x69')][_0xeba1('0xd9')]]=_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')];return db['CmContact'][_0xeba1('0xdc')]({'where':_0x488fca,'defaults':_0x4160c0});}})[_0xeba1('0xdd')](function(_0xabf666){if(_0xabf666){_0x3ea268=_0xabf666;var _0x24d7b4=fs[_0xeba1('0xde')](path[_0xeba1('0x88')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x328f78=ejs[_0xeba1('0xdf')](_0x24d7b4,{'body':_[_0xeba1('0xe0')](_0x5d6926['body'][_0xeba1('0x69')]),'bodyTitle':_0x271338['offlineMessageBody']});return db[_0xeba1('0xe1')]['create']({'body':_0x328f78,'plainBody':htmlToText[_0xeba1('0xe2')](_0x328f78),'ContactId':_0xabf666['id'],'ChatWebsiteId':_0x271338['id']});}})['then'](function(_0x2588c5){_0x4989b9=_0x2588c5;if(_0x382fd9[_0xeba1('0x58')]){var _0xbebbcb=_0x382fd9[_0xeba1('0x4e')](function(_0x492561){return{'name':_0x492561[_0xeba1('0xe3')],'basename':_0x492561[_0xeba1('0x83')],'type':_0x492561[_0xeba1('0xe4')],'ChatOfflineMessageId':_0x2588c5['id']};});_0x47d9b9=_0xbebbcb[_0xeba1('0x4e')](_0x325210=>{var _0x60e077={'filename':_0x325210[_0xeba1('0x33')],'path':path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0xe5'),_0xeba1('0xe6'),_0xeba1('0xe7'),_0xeba1('0xe8'),_0x325210['basename'])};return _0x60e077;});if(!_0x271338[_0xeba1('0xe9')]){return db[_0xeba1('0xea')][_0xeba1('0xeb')](function(_0x28244a){return db[_0xeba1('0xec')]['bulkCreate'](_0xbebbcb,{'transaction':_0x28244a});});}}})[_0xeba1('0x2d')](function(){if(_0x4989b9){_0xd8d5dd=_0x4989b9;return db[_0xeba1('0xed')][_0xeba1('0x78')]({'where':{'service':!![]},'include':[{'model':db[_0xeba1('0xee')],'as':_0xeba1('0xef'),'raw':!![],'include':[{'model':db[_0xeba1('0xf0')],'as':_0xeba1('0xf0'),'raw':!![]}]}]});}})[_0xeba1('0x2d')](function(_0x261f6e){if(_0x261f6e&&_0x261f6e[_0xeba1('0xef')]&&_0x271338[_0xeba1('0xf1')]&&_0x271338[_0xeba1('0xf2')]){var _0x383de0=_0x261f6e[_0xeba1('0xf3')]();return respondWithRpcPromise(_0xeba1('0xf4'),_0xeba1('0xf5'),{'account':_0x383de0,'message':{'from':util[_0xeba1('0x43')](_0xeba1('0xf6'),_0x261f6e['name'],_0x261f6e[_0xeba1('0xf7')]||_0x261f6e[_0xeba1('0xef')][_0xeba1('0x6b')]),'to':_0x271338[_0xeba1('0xf2')],'subject':_0x271338[_0xeba1('0xf8')],'html':_0xd8d5dd['body'],'attachments':_0x47d9b9}},client9003)[_0xeba1('0x2d')](function(){return _0xd8d5dd;})[_0xeba1('0x22')](function(_0x38dc1d){logger[_0xeba1('0x1f')](_0x38dc1d);});}})[_0xeba1('0x2d')](function(){if(_0x271338&&_0x271338[_0xeba1('0xe9')]&&_0x271338[_0xeba1('0xf9')]){var _0x56e79a=[];if(_0x382fd9[_0xeba1('0x58')]){_0x56e79a=_0x382fd9[_0xeba1('0x4e')](function(_0xd9f6c3){return{'name':_0xd9f6c3['originalname'],'basename':_0xd9f6c3['filename'],'type':_0xd9f6c3['mimetype'],'ChatOfflineMessageId':_0x4989b9['id']};});}var _0x3df57b;if(!_[_0xeba1('0x96')](_0x271338[_0xeba1('0xfa')])){var _0x203dec=_[_0xeba1('0x4e')](_0x5d6926[_0xeba1('0x69')],function(_0x1c3145){return _0x1c3145;});var _0x47988b=_[_0xeba1('0xfb')](_0x203dec)[0x0];var _0x299fe0=_[_0xeba1('0xfc')](_0x47988b,function(_0x398d38){return _0x398d38;});_0x3df57b=_0x299fe0[0x1][_0x271338['subjectOffline']];}var _0x520ec0={'from':_0x3ea268[_0xeba1('0xf7')],'firstName':_0x3ea268['firstName'],'lastName':_0x3ea268['lastName'],'mapKey':_0xeba1('0xf7'),'message':{'from':_0x3ea268['email'],'to':_0x271338['MailAccount']['email'],'cc':'','subject':_[_0xeba1('0x96')](_0x3df57b)?_0x271338[_0xeba1('0xf8')]:_0x3df57b,'messageId':'','sentAt':new Date(),'attach':_0x56e79a[_0xeba1('0x58')],'attachments':_0x56e79a,'originChannel':_0xeba1('0xfd'),'ChatWebsiteId':_0x271338['id'],'ChatOfflineMessageId':_0xd8d5dd['id'],'originTo':_0x271338['MailAccount']['email']},'body':_0xd8d5dd[_0xeba1('0x69')]};var _0x1deb82={'account':{'id':_0x271338[_0xeba1('0xf9')]},'body':_0x520ec0,'log':_0xeba1('0xfe')};return respondWithRpcPromise('NotifyMailAccount',_0xeba1('0xff'),_0x1deb82,client9001)[_0xeba1('0x2d')](function(){return _0xd8d5dd;})[_0xeba1('0x22')](function(_0x18ac52){logger['error'](_0x18ac52);});}return;})['then'](function(){if(_0xd8d5dd){return _0xd8d5dd;}})[_0xeba1('0x2d')](respondWithResult(_0x509fb2,null))[_0xeba1('0x22')](function(){for(var _0x284eb6 of _0x382fd9){var _0x45fb86=path['join'](config[_0xeba1('0x8d')],_0xeba1('0xe5'),_0xeba1('0xe6'),_0xeba1('0xe7'),_0xeba1('0xe8'),_0x284eb6[_0xeba1('0x83')]);fs_extra[_0xeba1('0x100')](_0x45fb86)['catch'](function(_0x1713d3){logger[_0xeba1('0x1f')](_0xeba1('0x101'),_0x45fb86,_0x1713d3);});}});};exports[_0xeba1('0x102')]=function(_0x125be7,_0x5340d4){return db['ChatInteraction']['find']({'where':{'id':_0x125be7[_0xeba1('0x65')]['id']}})['then'](handleEntityNotFound(_0x5340d4,null))[_0xeba1('0x2d')](function(_0x4c3a72){if(_0x4c3a72){return _0x4c3a72[_0xeba1('0x102')](_0x125be7['body'][_0xeba1('0x7e')],_[_0xeba1('0x103')](_0x125be7[_0xeba1('0x69')],[_0xeba1('0x7e'),'id'])||{});}})[_0xeba1('0x2d')](respondWithResult(_0x5340d4,null))[_0xeba1('0x22')](handleError(_0x5340d4,null));};exports[_0xeba1('0x104')]=function(_0x3445de,_0x251f15){var _0x7ebf8b={'raw':![],'where':{}};var _0x2d6053={};var _0x431079={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x3445de['params']['id']}})['then'](handleEntityNotFound(_0x251f15,null))[_0xeba1('0x2d')](function(_0x34fbd5){if(_0x34fbd5){_0x2d6053[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0xb8')][_0xeba1('0x50')]);_0x2d6053[_0xeba1('0x53')]=_[_0xeba1('0x66')](_0x3445de[_0xeba1('0x53')]);_0x2d6053[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x2d6053[_0xeba1('0x47')],_0x2d6053['query']);_0x7ebf8b[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x2d6053['model'],qs[_0xeba1('0x56')](_0x3445de[_0xeba1('0x53')]['fields']));_0x7ebf8b[_0xeba1('0x57')]=_0x7ebf8b[_0xeba1('0x57')][_0xeba1('0x58')]?_0x7ebf8b['attributes']:_0x2d6053[_0xeba1('0x47')];if(!_0x3445de[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x7ebf8b['limit']=qs[_0xeba1('0x2a')](_0x3445de[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x7ebf8b[_0xeba1('0x29')]=qs['offset'](_0x3445de[_0xeba1('0x53')][_0xeba1('0x29')]);}_0x7ebf8b[_0xeba1('0x5b')]=qs['sort'](_0x3445de[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x7ebf8b['where']=qs[_0xeba1('0x54')](_['pick'](_0x3445de[_0xeba1('0x53')],_0x2d6053['filters']));_0x7ebf8b[_0xeba1('0x5d')][_0xeba1('0x7a')]=_0x34fbd5['id'];if(_0x3445de[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x7ebf8b['where']=_[_0xeba1('0x5f')](_0x7ebf8b['where'],{'$or':_[_0xeba1('0x4e')](_0x7ebf8b[_0xeba1('0x57')],function(_0x107f4e){var _0x2d4960={};_0x2d4960[_0x107f4e]={'$like':'%'+_0x3445de['query'][_0xeba1('0x5e')]+'%'};return _0x2d4960;})});}_0x7ebf8b=_[_0xeba1('0x5f')]({},_0x7ebf8b,_0x3445de[_0xeba1('0x7b')]);return db['ChatInteraction'][_0xeba1('0x28')]({'where':_0x7ebf8b[_0xeba1('0x5d')]})['then'](function(_0x4db9bf){_0x431079['count']=_0x4db9bf;if(_0x3445de[_0xeba1('0x53')]['includeAll']){_0x7ebf8b[_0xeba1('0x61')]=[{'model':db[_0xeba1('0xa1')],'as':_0xeba1('0x105'),'required':![]},{'model':db[_0xeba1('0xc8')],'as':_0xeba1('0x106'),'attributes':['name',_0xeba1('0x107'),_0xeba1('0x108')],'required':![]},{'model':db[_0xeba1('0x109')],'as':_0xeba1('0x10a'),'attributes':['id','name',_0xeba1('0x10b')],'where':_0x3445de[_0xeba1('0x53')][_0xeba1('0x10c')]?{'id':_0x3445de[_0xeba1('0x53')][_0xeba1('0x10c')]}:undefined,'required':_0x3445de[_0xeba1('0x53')][_0xeba1('0x10c')]?!![]:![]}];}return db['ChatInteraction'][_0xeba1('0x62')](_0x7ebf8b);})[_0xeba1('0x2d')](function(_0x44610f){_0x431079['rows']=_0x44610f;return _0x431079;});}})[_0xeba1('0x2d')](respondWithFilteredResult(_0x251f15,_0x7ebf8b))[_0xeba1('0x22')](handleError(_0x251f15,null));};exports[_0xeba1('0x10d')]=function(_0x5d3751,_0x35f37f){var _0x537dc0=0x0;var _0x2a6d43=0x0;var _0x230537=![];var _0x536e66;var _0xed78d7;return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x5d3751[_0xeba1('0x65')]['id']},'include':[{'model':db['Interval'],'as':_0xeba1('0x97'),'include':[{'model':db[_0xeba1('0x97')],'as':_0xeba1('0x10e'),'attributes':['id',_0xeba1('0x10f')]}]}]})[_0xeba1('0x2d')](handleEntityNotFound(_0x35f37f,null))[_0xeba1('0x2d')](function(_0x4b9365){if(_0x4b9365){_0x536e66=_0x4b9365;return _0x4b9365[_0xeba1('0x110')]({'raw':!![]});}})['then'](function(_0x50ee6){if(_0x536e66){if(_0x50ee6){_0xed78d7=_0x50ee6;}}return require(_0xeba1('0x111'))[_0xeba1('0x8a')]();})[_0xeba1('0x2d')](function(_0x4e7e56){if(_0x4e7e56){_0x2a6d43=_0x4e7e56[_0xeba1('0x112')];_0x230537=_0x4e7e56[_0xeba1('0x113')];}})[_0xeba1('0x2d')](function(){return db[_0xeba1('0xb8')][_0xeba1('0x28')]({'where':{'closed':![]}});})[_0xeba1('0x2d')](function(_0x21bd2d){_0x537dc0=_0x21bd2d;if(_0x2a6d43&&_0x21bd2d>_0x2a6d43){return db[_0xeba1('0x114')][_0xeba1('0x78')]({'where':{'id':0x1}})[_0xeba1('0x2d')](function(_0x24bb78){if(_0x24bb78){_0x24bb78[_0xeba1('0x115')](_0xeba1('0x116'));}});}})[_0xeba1('0x2d')](function(){var _0x93ded7=_0x536e66[_0xeba1('0x97')];var _0xa473cc=_0x536e66[_0xeba1('0x99')]||undefined;return _0x93ded7?_0x93ded7[_0xeba1('0x9a')](_0xa473cc):!![];})[_0xeba1('0x2d')](function(_0x49221c){var _0x3d0713=fs[_0xeba1('0xde')](path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x117')),'utf8');var _0x40e3c3=_0xeba1('0x118');var _0x1b136f=![];var _0x2f4980,_0x1573ef;if(_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x40')]){_0x2f4980=new URL(_0x5d3751['headers'][_0xeba1('0x40')])[_0xeba1('0x119')];}else if(_0x5d3751['headers'][_0xeba1('0x119')]){_0x2f4980=new URL(_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x119')])[_0xeba1('0x119')];}else{_0x2f4980=_0xeba1('0x11a');}_0x1573ef=typeof _0x536e66[_0xeba1('0x72')]['split'](',')[_0xeba1('0x67')](function(_0x43114f){return wildcardUtils[_0xeba1('0x11b')](_0x43114f,_0x2f4980);})!=='undefined';var _0x2dda3e={'chatVersion':_0x40e3c3,'chatWebsiteAddressOrigin':_0x1573ef?_0x2f4980:_0x536e66[_0xeba1('0x72')],'remote':_0x536e66[_0xeba1('0x11c')],'query':querystring['stringify'](_[_0xeba1('0x5f')](_0x536e66[_0xeba1('0x2f')]({'plain':!![]}),{'customerIp':_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x3b')]||_0x5d3751[_0xeba1('0xb6')]['x-real-ip']||_0x5d3751[_0xeba1('0x11d')]['remoteAddress']||_0x5d3751['ip'],'referer':_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x40')],'openedInteractions':_0x537dc0,'maxInteractions':_0x2a6d43,'virtual':_0x230537['virtual'],'online':_0x49221c,'custom':_0x230537,'address':_0x1573ef?_0x2f4980:null}))[_0xeba1('0x11e')](/'/g,'\x5c\x27')};_0x35f37f['send'](ejs[_0xeba1('0xdf')](Mustache[_0xeba1('0xdf')](_0x3d0713,_0x2dda3e),{'proactiveActions':_0xed78d7,'alignment':_0x536e66[_0xeba1('0x11f')],'verticalAlignment':_0x536e66['verticalAlignment'],'div_color':_0x536e66[_0xeba1('0x10b')],'labelText':_0x536e66[_0xeba1('0x120')],'text_color':_0x536e66[_0xeba1('0x121')],'text_button_color':_0x536e66[_0xeba1('0x122')],'button_color':_0x536e66['color_button'],'background_color':_0x536e66[_0xeba1('0x123')],'hideWhenOffline':_0x536e66[_0xeba1('0x124')],'intervalId':_0x536e66[_0xeba1('0x125')],'isDevelopment':_0x1b136f,'chatVersion':_0x40e3c3}));})[_0xeba1('0x22')](handleError(_0x35f37f,null));};exports[_0xeba1('0x126')]=function(_0x57fc12,_0x2527ae){var _0x4f2a9e=_0x57fc12[_0xeba1('0x65')]['id'];var _0x417ae2=_0x57fc12[_0xeba1('0x69')];var _0x4bedaa=0xc8;var _0x5f6b6e=null;return db[_0xeba1('0xea')][_0xeba1('0xeb')]({'isolationLevel':db[_0xeba1('0xea')][_0xeba1('0x127')][_0xeba1('0x128')]['READ_COMMITTED']},function(_0xba278a){return db['ChatWebsite']['findOne']({'where':{'id':_0x4f2a9e},'transaction':_0xba278a})[_0xeba1('0x2d')](function(_0x4078d1){if(_0x4078d1){return db['ChatApplication'][_0xeba1('0x2e')]({'where':{'ChatWebsiteId':_0x4f2a9e},'transaction':_0xba278a})[_0xeba1('0x2d')](function(){var _0x43d15b=_[_0xeba1('0x4e')](_0x417ae2,function(_0x4f69c9){_0x4f69c9[_0xeba1('0x7a')]=_0x4f2a9e;return _0x4f69c9;});return db[_0xeba1('0xac')][_0xeba1('0x129')](_0x43d15b,{'transaction':_0xba278a});});}else{_0x4bedaa=0x194;_0x5f6b6e=[];}});})['then'](function(){if(_0x4bedaa!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x4f2a9e},'order':_0xeba1('0xb2')})['then'](function(_0x2103ba){_0x5f6b6e=_0x2103ba;});}})[_0xeba1('0x22')](function(_0x1e4945){_0x4bedaa=0x1f4;logger[_0xeba1('0x1f')](_0x1e4945['stack']);if(_0x1e4945['name']){delete _0x1e4945[_0xeba1('0x33')];}_0x5f6b6e=_0x1e4945;})['finally'](function(){if(_0x5f6b6e===null){_0x2527ae[_0xeba1('0x23')](_0x4bedaa);}else{if(_0x4bedaa===0x1f4){_0x2527ae[_0xeba1('0x24')](_0x4bedaa)[_0xeba1('0x34')](_0x5f6b6e);}else{_0x2527ae[_0xeba1('0x24')](_0x4bedaa)[_0xeba1('0x26')](_0x5f6b6e);}}});};exports[_0xeba1('0x12a')]=function(_0x3973d9,_0x43502a){var _0x53b16f={};var _0x1ad176={};var _0x3f6773;var _0x740bad;return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x3973d9[_0xeba1('0x65')]['id']}})['then'](handleEntityNotFound(_0x43502a,null))[_0xeba1('0x2d')](function(_0x105b47){if(_0x105b47){_0x3f6773=_0x105b47;_0x1ad176[_0xeba1('0x47')]=_['keys'](db[_0xeba1('0xac')][_0xeba1('0x50')]);_0x1ad176[_0xeba1('0x53')]=_[_0xeba1('0x66')](_0x3973d9[_0xeba1('0x53')]);_0x1ad176[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x1ad176[_0xeba1('0x47')],_0x1ad176[_0xeba1('0x53')]);_0x53b16f[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x1ad176[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x56')]));_0x53b16f[_0xeba1('0x57')]=_0x53b16f[_0xeba1('0x57')][_0xeba1('0x58')]?_0x53b16f[_0xeba1('0x57')]:_0x1ad176[_0xeba1('0x47')];_0x53b16f[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x53b16f[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x3973d9[_0xeba1('0x53')],_0x1ad176[_0xeba1('0x54')]));if(_0x3973d9[_0xeba1('0x53')]['filter']){_0x53b16f[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x53b16f['where'],{'$or':_[_0xeba1('0x4e')](_0x53b16f[_0xeba1('0x57')],function(_0x315c80){var _0x329c46={};_0x329c46[_0x315c80]={'$like':'%'+_0x3973d9[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x329c46;})});}_0x53b16f=_[_0xeba1('0x5f')]({},_0x53b16f,_0x3973d9[_0xeba1('0x7b')]);return _0x3f6773['getApplications'](_0x53b16f);}})[_0xeba1('0x2d')](function(_0x175782){if(_0x175782){_0x740bad=_0x175782[_0xeba1('0x58')];if(!_0x3973d9[_0xeba1('0x53')]['hasOwnProperty'](_0xeba1('0x5a'))){_0x53b16f['limit']=qs['limit'](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x53b16f[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x29')]);}return _0x3f6773['getApplications'](_0x53b16f);}})[_0xeba1('0x2d')](function(_0x2407b4){if(_0x2407b4){return _0x2407b4?{'count':_0x740bad,'rows':_0x2407b4}:null;}})[_0xeba1('0x2d')](respondWithResult(_0x43502a,null))[_0xeba1('0x22')](handleError(_0x43502a,null));};exports[_0xeba1('0x12b')]=function(_0x5b0d79,_0x509138){return db[_0xeba1('0x12c')]['find']({'where':{'id':_0x5b0d79[_0xeba1('0x65')]['id']}})['then'](handleEntityNotFound(_0x509138,null))[_0xeba1('0x2d')](function(_0x1f9ac3){if(_0x1f9ac3){return _0x1f9ac3[_0xeba1('0x12b')](_0x5b0d79['body']['ids'],_[_0xeba1('0x103')](_0x5b0d79[_0xeba1('0x69')],[_0xeba1('0x7e'),'id'])||{});}})[_0xeba1('0x2d')](respondWithResult(_0x509138,null))[_0xeba1('0x22')](handleError(_0x509138,null));};exports[_0xeba1('0x110')]=function(_0x217a82,_0x2dfcc9){var _0x293dc2={};var _0x40f199={};var _0x39a0b8;var _0x16b8de;return db['ChatWebsite'][_0xeba1('0x78')]({'where':{'id':_0x217a82[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x2dfcc9,null))['then'](function(_0x162ab2){if(_0x162ab2){_0x39a0b8=_0x162ab2;_0x40f199[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0x12d')][_0xeba1('0x50')]);_0x40f199['query']=_[_0xeba1('0x66')](_0x217a82['query']);_0x40f199[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x40f199[_0xeba1('0x47')],_0x40f199['query']);_0x293dc2[_0xeba1('0x57')]=_['intersection'](_0x40f199['model'],qs['fields'](_0x217a82['query'][_0xeba1('0x56')]));_0x293dc2[_0xeba1('0x57')]=_0x293dc2[_0xeba1('0x57')]['length']?_0x293dc2[_0xeba1('0x57')]:_0x40f199[_0xeba1('0x47')];_0x293dc2[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x217a82['query'][_0xeba1('0x5c')]);_0x293dc2['where']=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x217a82['query'],_0x40f199[_0xeba1('0x54')]));if(_0x217a82[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x293dc2[_0xeba1('0x5d')]=_['merge'](_0x293dc2[_0xeba1('0x5d')],{'$or':_[_0xeba1('0x4e')](_0x293dc2['attributes'],function(_0x4bd7bd){var _0x25d044={};_0x25d044[_0x4bd7bd]={'$like':'%'+_0x217a82['query'][_0xeba1('0x5e')]+'%'};return _0x25d044;})});}_0x293dc2=_[_0xeba1('0x5f')]({},_0x293dc2,_0x217a82[_0xeba1('0x7b')]);return _0x39a0b8['getProactiveActions'](_0x293dc2);}})[_0xeba1('0x2d')](function(_0x299586){if(_0x299586){_0x16b8de=_0x299586[_0xeba1('0x58')];if(!_0x217a82[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x293dc2[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x217a82['query'][_0xeba1('0x2a')]);_0x293dc2[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x217a82[_0xeba1('0x53')][_0xeba1('0x29')]);}return _0x39a0b8[_0xeba1('0x110')](_0x293dc2);}})[_0xeba1('0x2d')](function(_0x4ad44a){if(_0x4ad44a){return _0x4ad44a?{'count':_0x16b8de,'rows':_0x4ad44a}:null;}})[_0xeba1('0x2d')](respondWithResult(_0x2dfcc9,null))[_0xeba1('0x22')](handleError(_0x2dfcc9,null));};exports[_0xeba1('0x12e')]=function(_0x165645,_0x3c6947){var _0x40d115=_0x165645['query']['online']===_0xeba1('0x12f')?_0xeba1('0x130'):_0xeba1('0x131');return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'attributes':['id',_0x40d115],'where':{'id':_0x165645[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x3c6947,null))['then'](function(_0x23bd47){if(_0x23bd47){var _0x144942=_0x23bd47[_0x40d115];var _0x3e573f=_0x144942&&_0x144942[_0xeba1('0x132')]?_0x144942[_0xeba1('0x132')]:[];_0x3c6947[_0xeba1('0x34')]({'fromKey':_[_0xeba1('0x96')](_0x144942[_0xeba1('0x133')])?undefined:_0x144942[_0xeba1('0x133')],'count':_0x3e573f[_0xeba1('0x58')],'rows':_0x3e573f});}})['catch'](handleError(_0x3c6947,null));};exports[_0xeba1('0x134')]=function(_0x116a7d,_0x68485a){var _0x47bdf8={'raw':![],'where':{}};var _0x83cb3b={};var _0x3204f1={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x116a7d[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x68485a,null))['then'](function(_0x1c62f9){if(_0x1c62f9){_0x83cb3b[_0xeba1('0x47')]=_['keys'](db[_0xeba1('0xe1')][_0xeba1('0x50')]);_0x83cb3b['query']=_[_0xeba1('0x66')](_0x116a7d[_0xeba1('0x53')]);_0x83cb3b[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x83cb3b[_0xeba1('0x47')],_0x83cb3b[_0xeba1('0x53')]);_0x47bdf8[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x83cb3b[_0xeba1('0x47')],qs['fields'](_0x116a7d['query'][_0xeba1('0x56')]));_0x47bdf8[_0xeba1('0x57')]=_0x47bdf8['attributes'][_0xeba1('0x58')]?_0x47bdf8['attributes']:_0x83cb3b[_0xeba1('0x47')];if(!_0x116a7d[_0xeba1('0x53')]['hasOwnProperty']('nolimit')){_0x47bdf8[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x116a7d[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x47bdf8[_0xeba1('0x29')]=qs['offset'](_0x116a7d[_0xeba1('0x53')][_0xeba1('0x29')]);}_0x47bdf8[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x116a7d[_0xeba1('0x53')]['sort']);_0x47bdf8[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x116a7d[_0xeba1('0x53')],_0x83cb3b[_0xeba1('0x54')]));_0x47bdf8[_0xeba1('0x5d')][_0xeba1('0x7a')]=_0x1c62f9['id'];if(_0x116a7d[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x47bdf8[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x47bdf8[_0xeba1('0x5d')],{'$or':_[_0xeba1('0x4e')](_0x47bdf8[_0xeba1('0x57')],function(_0x10d65d){var _0x7ffee9={};_0x7ffee9[_0x10d65d]={'$like':'%'+_0x116a7d[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x7ffee9;})});}_0x47bdf8=_[_0xeba1('0x5f')]({},_0x47bdf8,_0x116a7d['options']);return db[_0xeba1('0xe1')][_0xeba1('0x28')]({'where':_0x47bdf8[_0xeba1('0x5d')]})[_0xeba1('0x2d')](function(_0x17dd4f){_0x3204f1['count']=_0x17dd4f;if(_0x116a7d[_0xeba1('0x53')]['includeAll']){_0x47bdf8[_0xeba1('0x61')]=[{'all':!![]}];}else{_0x47bdf8['include']=[{'model':db[_0xeba1('0xa1')],'as':_0xeba1('0x105'),'required':![]},{'model':db[_0xeba1('0xec')],'as':_0xeba1('0x135'),'required':![]}];}return db[_0xeba1('0xe1')][_0xeba1('0x62')](_0x47bdf8);})[_0xeba1('0x2d')](function(_0x15fdb){_0x3204f1[_0xeba1('0x63')]=_0x15fdb;return _0x3204f1;});}})[_0xeba1('0x2d')](respondWithFilteredResult(_0x68485a,_0x47bdf8))[_0xeba1('0x22')](handleError(_0x68485a,null));};exports[_0xeba1('0x136')]=function(_0x4b6ecf,_0x1be543){return db['ChatWebsite'][_0xeba1('0x67')]({'where':{'id':_0x4b6ecf[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x1be543,null))[_0xeba1('0x2d')](function(_0x5b50ef){if(_0x5b50ef){return _0x5b50ef['addAgents'](_0x4b6ecf[_0xeba1('0x69')][_0xeba1('0x7e')],_['omit'](_0x4b6ecf['body'],[_0xeba1('0x7e'),'id'])||{})['spread'](function(_0x1574d3){for(var _0x5c4f9e=0x0;_0x5c4f9e<_0x4b6ecf[_0xeba1('0x69')][_0xeba1('0x7e')][_0xeba1('0x58')];_0x5c4f9e+=0x1){socket['emit'](_0xeba1('0x137'),{'UserId':Number(_0x4b6ecf[_0xeba1('0x69')]['ids'][_0x5c4f9e]),'ChatWebsiteId':Number(_0x4b6ecf[_0xeba1('0x65')]['id'])});}return _0x1574d3;});}})[_0xeba1('0x2d')](respondWithResult(_0x1be543,null))[_0xeba1('0x22')](handleError(_0x1be543,null));};exports[_0xeba1('0x138')]=function(_0x3d4af6,_0x50ecb4){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x3d4af6[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x50ecb4,null))['then'](function(_0x34c28d){if(_0x34c28d){return _0x34c28d[_0xeba1('0x138')](_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')])[_0xeba1('0x2d')](function(){if(_[_0xeba1('0x139')](_0x3d4af6['query'][_0xeba1('0x7e')])){for(var _0x2238b2=0x0;_0x2238b2<_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')]['length'];_0x2238b2+=0x1){socket['emit'](_0xeba1('0x13a'),{'UserId':Number(_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')][_0x2238b2]),'ChatWebsiteId':Number(_0x3d4af6[_0xeba1('0x65')]['id'])});}}else{socket[_0xeba1('0x13b')](_0xeba1('0x13a'),{'UserId':Number(_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')]),'ChatWebsiteId':Number(_0x3d4af6['params']['id'])});}});}})[_0xeba1('0x2d')](respondWithStatusCode(_0x50ecb4,null))[_0xeba1('0x22')](handleError(_0x50ecb4,null));};exports['getAgents']=function(_0x2fad96,_0x4fa65b){var _0x5f3181={};var _0x14188b={};var _0x58992d;var _0x299140;return db['ChatWebsite'][_0xeba1('0x78')]({'where':{'id':_0x2fad96[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x4fa65b,null))[_0xeba1('0x2d')](function(_0x2f58e8){if(_0x2f58e8){_0x58992d=_0x2f58e8;_0x14188b[_0xeba1('0x47')]=_['keys'](db['User'][_0xeba1('0x50')]);_0x14188b[_0xeba1('0x53')]=_['keys'](_0x2fad96[_0xeba1('0x53')]);_0x14188b[_0xeba1('0x54')]=_['intersection'](_0x14188b[_0xeba1('0x47')],_0x14188b[_0xeba1('0x53')]);_0x5f3181[_0xeba1('0x57')]=_['intersection'](_0x14188b[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0x2fad96[_0xeba1('0x53')][_0xeba1('0x56')]));_0x5f3181[_0xeba1('0x57')]=_0x5f3181[_0xeba1('0x57')][_0xeba1('0x58')]?_0x5f3181[_0xeba1('0x57')]:_0x14188b['model'];_0x5f3181[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x2fad96[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x5f3181['where']=qs[_0xeba1('0x54')](_['pick'](_0x2fad96[_0xeba1('0x53')],_0x14188b[_0xeba1('0x54')]));if(_0x2fad96[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x5f3181['where']=_[_0xeba1('0x5f')](_0x5f3181['where'],{'$or':_[_0xeba1('0x4e')](_0x5f3181[_0xeba1('0x57')],function(_0x231b68){var _0x265cbe={};_0x265cbe[_0x231b68]={'$like':'%'+_0x2fad96[_0xeba1('0x53')]['filter']+'%'};return _0x265cbe;})});}_0x5f3181=_[_0xeba1('0x5f')]({},_0x5f3181,_0x2fad96[_0xeba1('0x7b')]);return _0x58992d[_0xeba1('0x13c')](_0x5f3181);}})[_0xeba1('0x2d')](function(_0x328a68){if(_0x328a68){_0x299140=_0x328a68[_0xeba1('0x58')];if(!_0x2fad96[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x5f3181[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x2fad96[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x5f3181[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x2fad96['query']['offset']);}return _0x58992d[_0xeba1('0x13c')](_0x5f3181);}})[_0xeba1('0x2d')](function(_0x210f8e){if(_0x210f8e){return _0x210f8e?{'count':_0x299140,'rows':_0x210f8e}:null;}})['then'](respondWithResult(_0x4fa65b,null))['catch'](handleError(_0x4fa65b,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index efb7cbf..ea73735 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 _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 +var _0x4453=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x5d18c9,_0x3ccc2b){var _0x196faa=function(_0x58dde6){while(--_0x58dde6){_0x5d18c9['push'](_0x5d18c9['shift']());}};_0x196faa(++_0x3ccc2b);}(_0x4453,0x9c));var _0x3445=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0x4453[_0x6cf5ec];return _0x271c4f;};'use strict';var EventEmitter=require(_0x3445('0x0'));var ChatWebsite=require(_0x3445('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3445('0x2')](0x0);var events={'afterCreate':_0x3445('0x3'),'afterUpdate':'update','afterDestroy':_0x3445('0x4')};function emitEvent(_0x1419a5){return function(_0xfff5,_0x22c15c,_0x461d8a){ChatWebsiteEvents[_0x3445('0x5')](_0x1419a5+':'+_0xfff5['id'],_0xfff5);ChatWebsiteEvents[_0x3445('0x5')](_0x1419a5,_0xfff5);_0x461d8a(null);};}for(var e in events){if(events[_0x3445('0x6')](e)){var event=events[e];ChatWebsite[_0x3445('0x7')](e,emitEvent(event));}}module[_0x3445('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 8f4d144..1a669dc 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 _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 +var _0xda09=['api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x165ffc,_0x3f9d50){var _0xe2cb59=function(_0x56877a){while(--_0x56877a){_0x165ffc['push'](_0x165ffc['shift']());}};_0xe2cb59(++_0x3f9d50);}(_0xda09,0x76));var _0x9da0=function(_0x20f9f8,_0x3e374c){_0x20f9f8=_0x20f9f8-0x0;var _0x1b10d0=_0xda09[_0x20f9f8];return _0x1b10d0;};'use strict';var _=require(_0x9da0('0x0'));var util=require(_0x9da0('0x1'));var logger=require('../../config/logger')(_0x9da0('0x2'));var moment=require(_0x9da0('0x3'));var BPromise=require('bluebird');var rp=require(_0x9da0('0x4'));var fs=require('fs');var path=require(_0x9da0('0x5'));var rimraf=require(_0x9da0('0x6'));var config=require(_0x9da0('0x7'));var attributes=require(_0x9da0('0x8'));module['exports']=function(_0x28eaea,_0x20ba10){return _0x28eaea[_0x9da0('0x9')](_0x9da0('0xa'),attributes,{'tableName':_0x9da0('0xb'),'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 e25656f..740accd 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 _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 +var _0xea81=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x3bfe12,_0x13ebc1){var _0x139809=function(_0x2d413f){while(--_0x2d413f){_0x3bfe12['push'](_0x3bfe12['shift']());}};_0x139809(++_0x13ebc1);}(_0xea81,0xbf));var _0x1ea8=function(_0x59b889,_0x4b026c){_0x59b889=_0x59b889-0x0;var _0x470d3f=_0xea81[_0x59b889];return _0x470d3f;};'use strict';var _=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var moment=require(_0x1ea8('0x2'));var BPromise=require(_0x1ea8('0x3'));var rs=require(_0x1ea8('0x4'));var fs=require('fs');var Redis=require(_0x1ea8('0x5'));var db=require(_0x1ea8('0x6'))['db'];var utils=require(_0x1ea8('0x7'));var logger=require(_0x1ea8('0x8'))(_0x1ea8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ea8('0xa')][_0x1ea8('0xb')]({'port':0x232a});config[_0x1ea8('0xc')]=_[_0x1ea8('0xd')](config['redis'],{'host':_0x1ea8('0xe'),'port':0x18eb});var socket=require(_0x1ea8('0xf'))(new Redis(config[_0x1ea8('0xc')]));require(_0x1ea8('0x10'))['register'](socket);function respondWithRpcPromise(_0x29366b,_0x55ad6c,_0x1060ec){return new BPromise(function(_0x59f398,_0x59cf0c){return client[_0x1ea8('0x11')](_0x29366b,_0x1060ec)[_0x1ea8('0x12')](function(_0x36787c){logger['info'](_0x1ea8('0x13'),_0x55ad6c,_0x1ea8('0x14'));logger['debug'](_0x1ea8('0x15'),_0x55ad6c,'request\x20sent',JSON['stringify'](_0x36787c));if(_0x36787c[_0x1ea8('0x16')]){if(_0x36787c[_0x1ea8('0x16')]['code']===0x1f4){logger['error'](_0x1ea8('0x13'),_0x55ad6c,_0x36787c['error']['message']);return _0x59cf0c(_0x36787c[_0x1ea8('0x16')][_0x1ea8('0x17')]);}logger['error'](_0x1ea8('0x13'),_0x55ad6c,_0x36787c[_0x1ea8('0x16')][_0x1ea8('0x17')]);return _0x59f398(_0x36787c[_0x1ea8('0x16')][_0x1ea8('0x17')]);}else{logger[_0x1ea8('0x18')](_0x1ea8('0x13'),_0x55ad6c,_0x1ea8('0x14'));_0x59f398(_0x36787c[_0x1ea8('0x19')][_0x1ea8('0x17')]);}})[_0x1ea8('0x1a')](function(_0x1c175e){logger['error'](_0x1ea8('0x13'),_0x55ad6c,_0x1c175e);_0x59cf0c(_0x1c175e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7bd8d25..475578a 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 _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 +var _0xb9ab=['remove','update','register','length','./chatWebsite.events','save'];(function(_0x48d2f9,_0x2e4981){var _0x2d9527=function(_0xc37d7b){while(--_0xc37d7b){_0x48d2f9['push'](_0x48d2f9['shift']());}};_0x2d9527(++_0x2e4981);}(_0xb9ab,0xa6));var _0xbb9a=function(_0x305c1f,_0xf8de1c){_0x305c1f=_0x305c1f-0x0;var _0x3579b2=_0xb9ab[_0x305c1f];return _0x3579b2;};'use strict';var ChatWebsiteEvents=require(_0xbb9a('0x0'));var events=[_0xbb9a('0x1'),_0xbb9a('0x2'),_0xbb9a('0x3')];function createListener(_0x4f5ca1,_0x51a914){return function(_0x5b3aea){_0x51a914['emit'](_0x4f5ca1,_0x5b3aea);};}function removeListener(_0x3bd27a,_0x1ffab0){return function(){ChatWebsiteEvents['removeListener'](_0x3bd27a,_0x1ffab0);};}exports[_0xbb9a('0x4')]=function(_0x19499d){for(var _0x1e2d0a=0x0,_0xdad3e6=events[_0xbb9a('0x5')];_0x1e2d0a<_0xdad3e6;_0x1e2d0a++){var _0x4794b0=events[_0x1e2d0a];var _0x38adca=createListener('chatWebsite:'+_0x4794b0,_0x19499d);ChatWebsiteEvents['on'](_0x4794b0,_0x38adca);}}; \ 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 10db288..dd38e41 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 _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 +var _0x2af8=['localhost','test','exports','../../../utils/misc','url','URL','replace','trim','([\x5cw]+)'];(function(_0x21309c,_0x97398e){var _0x39af74=function(_0x2c8a79){while(--_0x2c8a79){_0x21309c['push'](_0x21309c['shift']());}};_0x39af74(++_0x97398e);}(_0x2af8,0xf6));var _0x82af=function(_0x381b03,_0x3604d3){_0x381b03=_0x381b03-0x0;var _0x19d10d=_0x2af8[_0x381b03];return _0x19d10d;};var escapeRegExp=require(_0x82af('0x0'))['escapeRegExp'];var URL=require(_0x82af('0x1'))[_0x82af('0x2')];function testWildcardValidity(_0x4fb4ff){var _0x267196=!![];try{new URL(_0x4fb4ff[_0x82af('0x3')]('*','localhost'));}catch(_0x29c672){_0x267196=![];}return _0x267196&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x4fb4ff);}function testWebsiteWithWildcard(_0xafdd39,_0x3de1ed){var _0x4dd422;var _0x3d29ef=escapeRegExp(_0xafdd39[_0x82af('0x4')]()['replace'](/\/$/,''))[_0x82af('0x3')]('\x5c*',_0x82af('0x5'));try{new URL(_0xafdd39[_0x82af('0x3')]('\x5c*',_0x82af('0x6')));_0x4dd422=new RegExp(_0x3d29ef)[_0x82af('0x7')](_0x3de1ed);}catch(_0x38d823){_0x4dd422=![];}return _0x4dd422;}module[_0x82af('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 6131908..973601e 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 _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 +var _0xa824=['attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addAgents','/:id','destroy','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','create','addAnswer','root','server/files/images/logos/','%s-%s','now','originalname','file','addLogo','diskStorage','join','/:id/avatar','addAvatar','format','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files'];(function(_0x363958,_0x210039){var _0x2fdcd7=function(_0x325c03){while(--_0x325c03){_0x363958['push'](_0x363958['shift']());}};_0x2fdcd7(++_0x210039);}(_0xa824,0x124));var _0x4a82=function(_0x14da60,_0x5e6ae0){_0x14da60=_0x14da60-0x0;var _0x55dd8c=_0xa824[_0x14da60];return _0x55dd8c;};'use strict';var multer=require(_0x4a82('0x0'));var util=require('util');var path=require(_0x4a82('0x1'));var timeout=require(_0x4a82('0x2'));var express=require(_0x4a82('0x3'));var router=express[_0x4a82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a82('0x5'));var interaction=require(_0x4a82('0x6'));var config=require(_0x4a82('0x7'));var controller=require('./chatWebsite.controller');router[_0x4a82('0x8')]('/',auth[_0x4a82('0x9')](),controller['index']);router['get'](_0x4a82('0xa'),auth[_0x4a82('0x9')](),controller['describe']);router['get']('/:id',auth[_0x4a82('0x9')](),controller['show']);router[_0x4a82('0x8')](_0x4a82('0xb'),auth[_0x4a82('0x9')](),controller[_0x4a82('0xc')]);router['get'](_0x4a82('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4a82('0x8')](_0x4a82('0xe'),controller[_0x4a82('0xf')]);router['get']('/:id/avatar',controller['getAvatar']);router[_0x4a82('0x8')](_0x4a82('0x10'),controller[_0x4a82('0x11')]);router[_0x4a82('0x8')](_0x4a82('0x12'),controller[_0x4a82('0x13')]);router[_0x4a82('0x8')](_0x4a82('0x14'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x15')]);router['get'](_0x4a82('0x16'),controller[_0x4a82('0x17')]);router[_0x4a82('0x8')](_0x4a82('0x18'),auth['isAuthenticated'](),controller[_0x4a82('0x19')]);router['get'](_0x4a82('0x1a'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x1b')]);router[_0x4a82('0x8')](_0x4a82('0x1c'),controller['getFields']);router[_0x4a82('0x8')](_0x4a82('0x1d'),auth[_0x4a82('0x9')](),controller['getOfflineMessages']);router['get'](_0x4a82('0x1e'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x1f')]);router[_0x4a82('0x20')]('/',auth[_0x4a82('0x9')](),controller[_0x4a82('0x21')]);router[_0x4a82('0x20')](_0x4a82('0xb'),auth[_0x4a82('0x9')](),controller['addDisposition']);router[_0x4a82('0x20')](_0x4a82('0xd'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36cf45,_0x576997,_0x262a90){_0x262a90(null,path['join'](config[_0x4a82('0x23')],_0x4a82('0x24')));},'filename':function(_0x3c0c76,_0x778fff,_0x43f905){_0x43f905(null,util['format'](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0x778fff[_0x4a82('0x27')]));}})});router[_0x4a82('0x20')](_0x4a82('0xe'),upload['single'](_0x4a82('0x28')),controller[_0x4a82('0x29')]);var upload=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0x3c8b3d,_0x4e4ea7,_0x229510){_0x229510(null,path[_0x4a82('0x2b')](config[_0x4a82('0x23')],'server/files/images/avatars/'));},'filename':function(_0x2a7fdb,_0x3ffb67,_0x46b3bd){_0x46b3bd(null,util['format'](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0x3ffb67[_0x4a82('0x27')]));}})});router[_0x4a82('0x20')](_0x4a82('0x2c'),upload['single'](_0x4a82('0x28')),controller[_0x4a82('0x2d')]);var upload=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0xdc16e1,_0x2d5783,_0x28fda0){_0x28fda0(null,path['join'](config[_0x4a82('0x23')],'server/files/images/avatars/'));},'filename':function(_0x4873e9,_0xf52a65,_0x3cafd7){_0x3cafd7(null,util[_0x4a82('0x2e')](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0xf52a65[_0x4a82('0x27')]));}})});router['post'](_0x4a82('0x10'),upload[_0x4a82('0x2f')](_0x4a82('0x28')),controller[_0x4a82('0x30')]);var upload=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0x6ee2bd,_0xef7cd,_0x24a495){_0x24a495(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x41077e,_0x5ca4e3,_0x26c9a4){_0x26c9a4(null,util[_0x4a82('0x2e')](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0x5ca4e3[_0x4a82('0x27')]));}})});router[_0x4a82('0x20')](_0x4a82('0x12'),upload['single'](_0x4a82('0x28')),controller[_0x4a82('0x31')]);router[_0x4a82('0x20')](_0x4a82('0x32'),controller[_0x4a82('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0x40f8cb,_0x4d8ac4,_0x2f73a9){const _0x42e133=path['join'](config['root'],_0x4a82('0x34'),_0x4a82('0x35'),_0x4a82('0x36'));fs_extra['ensureDir'](_0x42e133,function(){_0x2f73a9(null,_0x42e133);});},'filename':function(_0x544d9c,_0x22d440,_0x1a7e54){const _0x293dff=_0x22d440['originalname'][_0x4a82('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x546dac=path[_0x4a82('0x38')](_0x293dff);const _0x1058b4=Date[_0x4a82('0x26')]()+'-'+_0x293dff[_0x4a82('0x37')](_0x546dac,'')+_0x546dac;_0x1a7e54(null,_0x1058b4);}})});router[_0x4a82('0x20')](_0x4a82('0x39'),offlineUploadMulter[_0x4a82('0x3a')](),controller[_0x4a82('0x3b')]);router[_0x4a82('0x20')](_0x4a82('0x14'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x3c')]);router[_0x4a82('0x20')]('/:id/applications',auth[_0x4a82('0x9')](),controller[_0x4a82('0x3d')]);router[_0x4a82('0x20')](_0x4a82('0x1a'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x4a82('0x20')](_0x4a82('0x1e'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x3e')]);router['put']('/:id',auth[_0x4a82('0x9')](),controller['update']);router['delete'](_0x4a82('0x3f'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x40')]);router['delete'](_0x4a82('0xb'),auth[_0x4a82('0x9')](),controller['removeDispositions']);router[_0x4a82('0x41')]('/:id/canned_answers',auth[_0x4a82('0x9')](),controller[_0x4a82('0x42')]);router[_0x4a82('0x41')](_0x4a82('0x1e'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x43')]);module[_0x4a82('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index f2d44a9..4bae808 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 _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 +var _0x2137=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!'];(function(_0xd3f6f7,_0x4f80a5){var _0x3323db=function(_0x1aa363){while(--_0x1aa363){_0xd3f6f7['push'](_0xd3f6f7['shift']());}};_0x3323db(++_0x4f80a5);}(_0x2137,0x185));var _0x7213=function(_0x4ba54b,_0x46f4de){_0x4ba54b=_0x4ba54b-0x0;var _0x364bfe=_0x2137[_0x4ba54b];return _0x364bfe;};var beaverLogger=require(_0x7213('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x7213('0x1'));var router=express[_0x7213('0x2')]();var isProduction=config[_0x7213('0x3')]===_0x7213('0x4')||![];function clientSideLogs(_0x5ad2c7,_0x57521d,_0x2fe4f6){var _0x3e40b4=_0x5ad2c7[_0x7213('0x5')]['get']('client-side-logger');if(!_0x3e40b4){throw new Error(_0x7213('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x7213('0x7'),'logger':_0x3e40b4,'enableCors':!isProduction})(_0x5ad2c7,_0x57521d,_0x2fe4f6);}router[_0x7213('0x8')](auth[_0x7213('0x9')](),clientSideLogs);module[_0x7213('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4b502c0..fb8a55e 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 _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 +var _0xba2b=['sequelize','exports','STRING','ENUM','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0xba2b,0xb4));var _0xbba2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba2b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xbba2('0x0'));module[_0xbba2('0x1')]={'name':{'type':Sequelize[_0xbba2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xbba2('0x3')]('AmazonAWS','Google',_0xbba2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xbba2('0x3')](_0xbba2('0x5'),_0xbba2('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xbba2('0x7')},'data2':{'type':Sequelize[_0xbba2('0x2')],'comment':_0xbba2('0x8')},'data3':{'type':Sequelize[_0xbba2('0x2')],'comment':_0xbba2('0x9')},'data4':{'type':Sequelize[_0xbba2('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xbba2('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xbba2('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xbba2('0xa')],'comment':_0xbba2('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index eb31b75..cac89d2 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 _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 +var _0x9516=['findOne','generateMicrosoftAuthorizationUrl','user','Invalid\x20state\x20parameter','parse','state','base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','error','name','send','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','include','findAll','service','MicrosoftAzure','decryptString','data3','then','catch','show','params','merge','create','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x9516,0x6e));var _0x6951=function(_0x1a9bdf,_0x43130a){_0x1a9bdf=_0x1a9bdf-0x0;var _0x61a042=_0x9516[_0x1a9bdf];return _0x61a042;};'use strict';var _=require(_0x6951('0x0'));var Redis=require(_0x6951('0x1'));var qs=require(_0x6951('0x2'));var encryptor=require(_0x6951('0x3'));var config=require(_0x6951('0x4'));var logger=require(_0x6951('0x5'))(_0x6951('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0x6951('0x7'));config[_0x6951('0x8')]=_[_0x6951('0x9')](config[_0x6951('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x6951('0x8')]);function respondWithStatusCode(_0x1cb218,_0x1a41a2){_0x1a41a2=_0x1a41a2||0xcc;return function(_0x5027bb){if(_0x5027bb){return _0x1cb218[_0x6951('0xa')](_0x1a41a2);}return _0x1cb218[_0x6951('0xb')](_0x1a41a2)['end']();};}function respondWithResult(_0x324f8a,_0x16a569){_0x16a569=_0x16a569||0xc8;return function(_0x565ef4){if(_0x565ef4){return _0x324f8a['status'](_0x16a569)[_0x6951('0xc')](_0x565ef4);}};}function respondWithFilteredResult(_0x2f2e24,_0x241d67){return function(_0x19fda3){if(_0x19fda3){var _0x4077de=typeof _0x241d67[_0x6951('0xd')]===_0x6951('0xe')&&typeof _0x241d67[_0x6951('0xf')]==='undefined';var _0x5ef329=_0x19fda3[_0x6951('0x10')];var _0x3a48f5=_0x4077de?0x0:_0x241d67['offset'];var _0x41f23b=_0x4077de?_0x19fda3[_0x6951('0x10')]:_0x241d67[_0x6951('0xd')]+_0x241d67[_0x6951('0xf')];var _0x174c50;if(_0x41f23b>=_0x5ef329){_0x41f23b=_0x5ef329;_0x174c50=0xc8;}else{_0x174c50=0xce;}_0x2f2e24[_0x6951('0xb')](_0x174c50);return _0x2f2e24['set'](_0x6951('0x11'),_0x3a48f5+'-'+_0x41f23b+'/'+_0x5ef329)[_0x6951('0xc')](_0x19fda3);}return null;};}function saveUpdates(_0x1aa77d){return function(_0x1f08d7){if(_0x1f08d7){return _0x1f08d7[_0x6951('0x12')](_0x1aa77d)['then'](function(_0x4504fe){return _0x4504fe;});}return null;};}function removeEntity(_0x463806){return function(_0x5e035d){if(_0x5e035d){return _0x5e035d[_0x6951('0x13')]()['then'](function(){_0x463806[_0x6951('0xb')](0xcc)[_0x6951('0x14')]();});}};}function handleEntityNotFound(_0xaaf15d){return function(_0x4d6f14){if(!_0x4d6f14){_0xaaf15d[_0x6951('0xa')](0x194);}return _0x4d6f14;};}function handleError(_0x44bb86,_0x207f92){_0x207f92=_0x207f92||0x1f4;return function(_0x4fccc1){logger[_0x6951('0x15')](_0x4fccc1['stack']);if(_0x4fccc1[_0x6951('0x16')]){delete _0x4fccc1[_0x6951('0x16')];}_0x44bb86[_0x6951('0xb')](_0x207f92)[_0x6951('0x17')](_0x4fccc1);};}function maskClientSecret(_0x192b05){return _['padEnd'](_0x192b05['slice'](0x0,0x3),0x14,'*');}exports[_0x6951('0x18')]=function(_0x5e5a8b,_0x426a94){var _0x141601={},_0x5a61d3={},_0x1e23b1={'count':0x0,'rows':[]};var _0x14613a=_[_0x6951('0x19')](db[_0x6951('0x1a')]['rawAttributes'],function(_0x37bd15){return{'name':_0x37bd15[_0x6951('0x1b')],'type':_0x37bd15[_0x6951('0x1c')][_0x6951('0x1d')]};});_0x5a61d3[_0x6951('0x1e')]=_[_0x6951('0x19')](_0x14613a,'name');_0x5a61d3[_0x6951('0x1f')]=_[_0x6951('0x20')](_0x5e5a8b['query']);_0x5a61d3[_0x6951('0x21')]=_[_0x6951('0x22')](_0x5a61d3[_0x6951('0x1e')],_0x5a61d3['query']);_0x141601[_0x6951('0x23')]=_['intersection'](_0x5a61d3[_0x6951('0x1e')],qs[_0x6951('0x24')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0x24')]));_0x141601[_0x6951('0x23')]=_0x141601['attributes'][_0x6951('0x25')]?_0x141601['attributes']:_0x5a61d3['model'];if(!_0x5e5a8b['query'][_0x6951('0x26')](_0x6951('0x27'))){_0x141601[_0x6951('0xf')]=qs[_0x6951('0xf')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0xf')]);_0x141601[_0x6951('0xd')]=qs[_0x6951('0xd')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0xd')]);}_0x141601[_0x6951('0x28')]=qs[_0x6951('0x29')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0x29')]);_0x141601['where']=qs[_0x6951('0x21')](_['pick'](_0x5e5a8b['query'],_0x5a61d3[_0x6951('0x21')]),_0x14613a);if(_0x5e5a8b[_0x6951('0x1f')]['filter']){_0x141601[_0x6951('0x2a')]=_['merge'](_0x141601[_0x6951('0x2a')],{'$or':_[_0x6951('0x19')](_0x14613a,function(_0x56bfd0){if(_0x56bfd0[_0x6951('0x1c')]!==_0x6951('0x2b')){var _0x591370={};_0x591370[_0x56bfd0['name']]={'$like':'%'+_0x5e5a8b[_0x6951('0x1f')][_0x6951('0x2c')]+'%'};return _0x591370;}})});}_0x141601=_['merge']({},_0x141601,_0x5e5a8b[_0x6951('0x2d')]);var _0x1cfffb={'where':_0x141601[_0x6951('0x2a')]};return db[_0x6951('0x1a')][_0x6951('0x10')](_0x1cfffb)['then'](function(_0x2b1120){_0x1e23b1[_0x6951('0x10')]=_0x2b1120;if(_0x5e5a8b[_0x6951('0x1f')]['includeAll']){_0x141601[_0x6951('0x2e')]=[{'all':!![]}];}return db[_0x6951('0x1a')][_0x6951('0x2f')](_0x141601);})['then'](function(_0x262bf3){_0x1e23b1['rows']=_[_0x6951('0x19')](_0x262bf3,function(_0x4d4bdc){if(_0x4d4bdc[_0x6951('0x30')]===_0x6951('0x31')){var _0x1876c8=encryptor[_0x6951('0x32')](_0x4d4bdc[_0x6951('0x33')]);_0x4d4bdc[_0x6951('0x33')]=maskClientSecret(_0x1876c8);}return _0x4d4bdc;});return _0x1e23b1;})[_0x6951('0x34')](respondWithFilteredResult(_0x426a94,_0x141601))[_0x6951('0x35')](handleError(_0x426a94,null));};exports[_0x6951('0x36')]=function(_0x38ed05,_0x429036){var _0x34fec3={'raw':!![],'where':{'id':_0x38ed05[_0x6951('0x37')]['id']}},_0x703136={};_0x703136[_0x6951('0x1e')]=_[_0x6951('0x20')](db[_0x6951('0x1a')]['rawAttributes']);_0x703136[_0x6951('0x1f')]=_[_0x6951('0x20')](_0x38ed05[_0x6951('0x1f')]);_0x703136[_0x6951('0x21')]=_[_0x6951('0x22')](_0x703136[_0x6951('0x1e')],_0x703136['query']);_0x34fec3[_0x6951('0x23')]=_[_0x6951('0x22')](_0x703136[_0x6951('0x1e')],qs[_0x6951('0x24')](_0x38ed05['query'][_0x6951('0x24')]));_0x34fec3[_0x6951('0x23')]=_0x34fec3[_0x6951('0x23')][_0x6951('0x25')]?_0x34fec3[_0x6951('0x23')]:_0x703136[_0x6951('0x1e')];if(_0x38ed05[_0x6951('0x1f')]['includeAll']){_0x34fec3[_0x6951('0x2e')]=[{'all':!![]}];}_0x34fec3=_[_0x6951('0x38')]({},_0x34fec3,_0x38ed05[_0x6951('0x2d')]);return db[_0x6951('0x1a')]['find'](_0x34fec3)[_0x6951('0x34')](handleEntityNotFound(_0x429036,null))['then'](function(_0x23b721){if(_0x23b721[_0x6951('0x30')]==='MicrosoftAzure'){var _0x2eeeec=encryptor[_0x6951('0x32')](_0x23b721[_0x6951('0x33')]);_0x23b721['data3']=maskClientSecret(_0x2eeeec);}return _0x23b721;})[_0x6951('0x34')](respondWithResult(_0x429036,null))[_0x6951('0x35')](handleError(_0x429036,null));};exports[_0x6951('0x39')]=function(_0x236b54,_0x3c2c23){if(!_0x236b54[_0x6951('0x3a')][_0x6951('0x16')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x236b54['body'][_0x6951('0x30')])throw new Error(_0x6951('0x3b'));var _0x155da2=db['CloudProvider']['rawAttributes']['service']['values'];if(!_0x155da2[_0x6951('0x3c')](_0x236b54['body']['service']))throw new Error(_0x6951('0x3d')+_0x155da2['join'](',\x20'));if(_0x236b54[_0x6951('0x3a')]['service']===_0x6951('0x31')&&_0x236b54[_0x6951('0x3a')][_0x6951('0x33')]){_0x236b54[_0x6951('0x3a')][_0x6951('0x33')]=encryptor[_0x6951('0x3e')](_0x236b54[_0x6951('0x3a')][_0x6951('0x33')]);}return db[_0x6951('0x1a')]['create'](_0x236b54[_0x6951('0x3a')],{})['then'](respondWithResult(_0x3c2c23,0xc9))[_0x6951('0x35')](handleError(_0x3c2c23,null));};exports[_0x6951('0x12')]=function(_0x1dbca4,_0x454660){if(_0x1dbca4['body']['id']){delete _0x1dbca4[_0x6951('0x3a')]['id'];}return db['CloudProvider'][_0x6951('0x3f')]({'where':{'id':_0x1dbca4[_0x6951('0x37')]['id']}})['then'](handleEntityNotFound(_0x454660,null))[_0x6951('0x34')](function(_0x1b7bd2){if(_0x1b7bd2[_0x6951('0x30')]==='MicrosoftAzure'&&_0x1dbca4[_0x6951('0x3a')][_0x6951('0x33')]){_0x1dbca4[_0x6951('0x3a')][_0x6951('0x33')]=encryptor[_0x6951('0x3e')](_0x1dbca4[_0x6951('0x3a')][_0x6951('0x33')]);}return _0x1b7bd2;})['then'](saveUpdates(_0x1dbca4[_0x6951('0x3a')],null))[_0x6951('0x34')](respondWithResult(_0x454660,null))[_0x6951('0x35')](handleError(_0x454660,null));};exports[_0x6951('0x13')]=function(_0x1180cb,_0x4b9315){return db['CloudProvider'][_0x6951('0x3f')]({'where':{'id':_0x1180cb['params']['id']}})['then'](handleEntityNotFound(_0x4b9315,null))[_0x6951('0x34')](removeEntity(_0x4b9315,null))[_0x6951('0x35')](handleError(_0x4b9315,null));};exports['oauth2MicrosoftAuthorize']=function(_0x323224,_0x2799f7){return db[_0x6951('0x1a')][_0x6951('0x40')]({'where':{'id':_0x323224[_0x6951('0x37')]['id']},'raw':!![]})[_0x6951('0x34')](function(_0x1bb6f5){if(!_0x1bb6f5)return _0x2799f7[_0x6951('0xa')](0x194);return{'url':oauth[_0x6951('0x41')](_0x1bb6f5,_0x323224[_0x6951('0x42')]['id'])};})[_0x6951('0x34')](respondWithResult(_0x2799f7,null))[_0x6951('0x35')](handleError(_0x2799f7,null));};exports['oauth2MicrosoftCallback']=function(_0x155c04,_0x24968e){var _0x5b5f60=_0x155c04[_0x6951('0x3a')];var _0x460677;var _0xda384c;if(_0x5b5f60[_0x6951('0x15')])throw _0x5b5f60;redis['get'](_0x5b5f60['state'])[_0x6951('0x34')](function(_0x2316be){if(!_0x2316be)throw new Error(_0x6951('0x43'));_0x460677=JSON[_0x6951('0x44')](_0x2316be);var _0x2a4e66=Buffer['from'](_0x5b5f60[_0x6951('0x45')],_0x6951('0x46'))[_0x6951('0x47')](_0x6951('0x48'));_0xda384c=JSON[_0x6951('0x44')](_0x2a4e66);if(!oauth['isValidIdToken'](_0x5b5f60[_0x6951('0x49')],_0x460677[_0x6951('0x4a')]))throw new Error(_0x6951('0x4b'));redis[_0x6951('0x4c')](_0x5b5f60[_0x6951('0x45')]);return oauth[_0x6951('0x4d')](_0x5b5f60[_0x6951('0x4e')],_0x460677);})[_0x6951('0x34')](function(_0x219073){_0x460677[_0x6951('0x4f')]=_0x219073[_0x6951('0x50')];_0x460677['data6']=_0x219073[_0x6951('0x51')];return db[_0x6951('0x1a')]['update']({'data5':_0x460677[_0x6951('0x4f')],'data6':_0x460677[_0x6951('0x52')]},{'where':{'id':_0x460677['id']}});})[_0x6951('0x34')](function(){oauth[_0x6951('0x53')](_0x460677);socket[_0x6951('0x54')]('microsoftAuthorization:success',{'id':_0xda384c['id']});return;})[_0x6951('0x34')](respondWithStatusCode(_0x24968e,null))[_0x6951('0x35')](function(_0x359288){if(_0xda384c){socket[_0x6951('0x54')]('microsoftAuthorization:error',{'id':_0xda384c['id']});}if(!_0x460677){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x359288);return _0x24968e[_0x6951('0xb')](0x1f4)[_0x6951('0x17')](_0x359288['message']);}logger[_0x6951('0x15')](_0x6951('0x55'),_0x460677['id'],JSON[_0x6951('0x56')](_0x359288));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d783022..f6a6133 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 _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 +var _0xea6c=['CloudProvider','cloud_providers','util','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2cf805,_0x330700){var _0x18bbaf=function(_0x539276){while(--_0x539276){_0x2cf805['push'](_0x2cf805['shift']());}};_0x18bbaf(++_0x330700);}(_0xea6c,0x124));var _0xcea6=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xea6c[_0x3181cc];return _0x547a4a;};'use strict';var _=require('lodash');var util=require(_0xcea6('0x0'));var logger=require('../../config/logger')(_0xcea6('0x1'));var moment=require('moment');var BPromise=require(_0xcea6('0x2'));var rp=require(_0xcea6('0x3'));var fs=require('fs');var path=require(_0xcea6('0x4'));var rimraf=require('rimraf');var config=require(_0xcea6('0x5'));var attributes=require('./cloudProvider.attributes');module[_0xcea6('0x6')]=function(_0x30fbd4,_0x3f1627){return _0x30fbd4[_0xcea6('0x7')](_0xcea6('0x8'),attributes,{'tableName':_0xcea6('0x9'),'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 230b35a..a90e1dc 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 _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 +var _0xf829=['openid','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','/.default','join','Outlook365','data7','replace','data2','code','id_token','from','stringify','base64','randomBytes','hex','client_id','data1','response_type','data4','form_post','scope','state','prompt','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','audience','nonce','isAfter','unix','exp','resolve','then','findOne','refresh_token','decryptString','data3','POST','{TENANT_ID}','data5','access_token','data6','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','map','all','inspect','exports','crypto','moment','ioredis','request-promise','util','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf829,0x17a));var _0x9f82=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xf829[_0x1c9c24];return _0x349c69;};'use strict';var _=require('lodash');var crypto=require(_0x9f82('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x9f82('0x1'));var Redis=require(_0x9f82('0x2'));var rp=require(_0x9f82('0x3'));var util=require(_0x9f82('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0x9f82('0x5'));var logger=require('../../config/logger')('api');var schedule=require(_0x9f82('0x6'));var db=require(_0x9f82('0x7'))['db'];config[_0x9f82('0x8')]=_[_0x9f82('0x9')](config[_0x9f82('0x8')],{'host':_0x9f82('0xa'),'port':0x18eb});var redis=new Redis(config[_0x9f82('0x8')]);var MICROSOFT_AUTH_URL=_0x9f82('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9f82('0xc'),'profile','email',_0x9f82('0xd'),_0x9f82('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0x9f82('0xf')],'Dynamics365':['openid',_0x9f82('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x9f82('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x9f82('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4bdd3c){var _0x364796=_['map'](AZURE_AUTH_SCOPES[_0x4bdd3c[_0x9f82('0x12')]]);if(_0x4bdd3c[_0x9f82('0x12')]===_0x9f82('0x13'))_0x364796['push'](_0x4bdd3c['data7']+_0x9f82('0x14'));return _0x364796[_0x9f82('0x15')]('\x20');}function getAccessTokenScope(_0x32170b){if(_0x32170b['type']===_0x9f82('0x16'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x32170b[_0x9f82('0x12')]===_0x9f82('0x13'))return _0x32170b[_0x9f82('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x57b947,_0xb27add){var _0x37b83d=MICROSOFT_AUTH_URL[_0x9f82('0x18')]('{TENANT_ID}',_0x57b947[_0x9f82('0x19')]);var _0xdec93b=[_0x9f82('0x1a'),_0x9f82('0x1b')];var _0x3a879e=Buffer[_0x9f82('0x1c')](JSON[_0x9f82('0x1d')]({'id':_0xb27add}))['toString'](_0x9f82('0x1e'));var _0x35ac40=crypto[_0x9f82('0x1f')](0x10)['toString'](_0x9f82('0x20'));var _0x4ca8f1=getAuthorizationScopes(_0x57b947);var _0x45cf99=[{'key':_0x9f82('0x21'),'value':_0x57b947[_0x9f82('0x22')]},{'key':_0x9f82('0x23'),'value':encodeURIComponent(_0xdec93b[_0x9f82('0x15')]('\x20'))},{'key':'redirect_uri','value':_0x57b947[_0x9f82('0x24')]},{'key':'response_mode','value':_0x9f82('0x25')},{'key':_0x9f82('0x26'),'value':encodeURIComponent(_0x4ca8f1)},{'key':_0x9f82('0x27'),'value':_0x3a879e},{'key':'nonce','value':_0x35ac40},{'key':_0x9f82('0x28'),'value':'login'}];var _0x23ac4f=_0x37b83d+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x45cf99,function(_0x43eb2f){return _0x43eb2f[_0x9f82('0x29')]+'='+_0x43eb2f[_0x9f82('0x2a')];})[_0x9f82('0x15')]('&');_0x57b947[_0x9f82('0x2b')]={'issuer':_0x37b83d[_0x9f82('0x18')](_0x9f82('0x2c'),''),'audience':_0x57b947[_0x9f82('0x22')],'state':_0x3a879e,'nonce':_0x35ac40};redis[_0x9f82('0x2d')](_0x3a879e,JSON[_0x9f82('0x1d')](_0x57b947));return _0x23ac4f;}function isValidIdToken(_0x1e2247,_0x31d450){try{var _0x351cd4=jwt[_0x9f82('0x2e')](_0x1e2247,{'complete':!![]});var _0x253869=_0x351cd4[_0x9f82('0x2f')];if(_0x253869[_0x9f82('0x30')]!==_0x31d450['issuer'])return![];if(_0x253869['aud']!==_0x31d450[_0x9f82('0x31')])return![];if(_0x253869[_0x9f82('0x32')]!==_0x31d450[_0x9f82('0x32')])return![];if(moment()[_0x9f82('0x33')](moment[_0x9f82('0x34')](_0x253869[_0x9f82('0x35')])))return![];return!![];}catch(_0x15c63b){throw _0x15c63b;}}function refreshOauth2MicrosoftAccessToken(_0x2b6946){return Promise[_0x9f82('0x36')]()[_0x9f82('0x37')](function(){if(_0x2b6946['data3'])return _0x2b6946;return db['CloudProvider'][_0x9f82('0x38')]({'where':{'id':_0x2b6946['id']},'raw':!![]});})[_0x9f82('0x37')](function(_0x5b466f){var _0x246139={'grant_type':_0x9f82('0x39'),'refresh_token':_0x5b466f['data6'],'scope':getAccessTokenScope(_0x5b466f),'redirect_uri':_0x5b466f[_0x9f82('0x24')],'client_id':_0x5b466f['data1'],'client_secret':encryptor[_0x9f82('0x3a')](_0x5b466f[_0x9f82('0x3b')])};var _0x466f31={'method':_0x9f82('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x9f82('0x18')](_0x9f82('0x3d'),_0x5b466f[_0x9f82('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x246139,'json':!![]};return rp(_0x466f31);})['then'](function(_0x32caf6){_0x2b6946[_0x9f82('0x3e')]=_0x32caf6[_0x9f82('0x3f')];_0x2b6946[_0x9f82('0x40')]=_0x32caf6[_0x9f82('0x39')];return db[_0x9f82('0x41')][_0x9f82('0x42')]({'data5':_0x2b6946[_0x9f82('0x3e')],'data6':_0x2b6946[_0x9f82('0x40')]},{'where':{'id':_0x2b6946['id']}});})[_0x9f82('0x37')](function(){return _0x2b6946;})[_0x9f82('0x43')](function(_0x27cd3d){logger[_0x9f82('0x44')](_0x9f82('0x45'),_0x2b6946['id'],_0x27cd3d);});}function getOauth2MicrosoftAccessToken(_0x5a44d4,_0x34d60c){var _0x59f7ed={'grant_type':_0x9f82('0x46'),'code':_0x5a44d4,'scope':getAccessTokenScope(_0x34d60c),'redirect_uri':_0x34d60c[_0x9f82('0x24')],'client_id':_0x34d60c[_0x9f82('0x22')],'client_secret':encryptor[_0x9f82('0x3a')](_0x34d60c[_0x9f82('0x3b')])};var _0x4e7550={'method':_0x9f82('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x9f82('0x18')](_0x9f82('0x3d'),_0x34d60c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x59f7ed,'json':!![]};return rp(_0x4e7550);}function startRefreshInterval(_0x5a260f){var _0x50a4dd=schedule[_0x9f82('0x47')];if(_0x50a4dd[_0x5a260f['id']])clearInterval(_0x50a4dd[_0x5a260f['id']]);_0x50a4dd[_0x5a260f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9f82('0x48')](this,{'id':_0x5a260f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x50a4dd;}function startAllRefreshIntervals(){return db[_0x9f82('0x41')][_0x9f82('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9f82('0x37')](function(_0x242a3e){var _0x361b5a=_0x242a3e[_0x9f82('0x4a')](function(_0x1a9e1a){return refreshOauth2MicrosoftAccessToken(_0x1a9e1a)[_0x9f82('0x37')](function(_0x132fda){startRefreshInterval(_0x132fda);});});return Promise[_0x9f82('0x4b')](_0x361b5a);})[_0x9f82('0x43')](function(_0xe4c737){var _0xd974a8=_0xe4c737?util[_0x9f82('0x4c')](_0xe4c737,{'showHidden':![],'depth':null}):'';logger[_0x9f82('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0xd974a8);});}module[_0x9f82('0x4d')]={'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 7d3f5b7..97aa899 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 _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 +var _0x2deb=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var moment=require(_0xb2de('0x2'));var BPromise=require(_0xb2de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2de('0x4'))['db'];var utils=require(_0xb2de('0x5'));var logger=require(_0xb2de('0x6'))(_0xb2de('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2de('0x8')][_0xb2de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191004,_0x49307b,_0x253d0b){return new BPromise(function(_0x1a4c44,_0x53ab0e){return client[_0xb2de('0xa')](_0x191004,_0x253d0b)[_0xb2de('0xb')](function(_0x1d40ec){logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));logger[_0xb2de('0xe')](_0xb2de('0xf'),_0x49307b,'request\x20sent',JSON['stringify'](_0x1d40ec));if(_0x1d40ec[_0xb2de('0x10')]){if(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x11')]===0x1f4){logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);return _0x53ab0e(_0x1d40ec['error'][_0xb2de('0x12')]);}logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec['error'][_0xb2de('0x12')]);return _0x1a4c44(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);}else{logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));_0x1a4c44(_0x1d40ec[_0xb2de('0x13')][_0xb2de('0x12')]);}})[_0xb2de('0x14')](function(_0x2dc15c){logger[_0xb2de('0x10')](_0xb2de('0xc'),_0x49307b,_0x2dc15c);_0x53ab0e(_0x2dc15c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a30695b..0c9936a 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(_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 +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(_0x5c745b,_0x1197fd){var _0x22d4e1=function(_0x2ec518){while(--_0x2ec518){_0x5c745b['push'](_0x5c745b['shift']());}};_0x22d4e1(++_0x1197fd);}(_0xdb28,0x106));var _0x8db2=function(_0x32475e,_0x2b89fe){_0x32475e=_0x32475e-0x0;var _0x3e14b3=_0xdb28[_0x32475e];return _0x3e14b3;};'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 ba797f1..a2e0cef 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 _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 +var _0xc141=['STRING','sequelize','exports','name'];(function(_0x37facb,_0x3f7f8a){var _0x19c83c=function(_0x2819a4){while(--_0x2819a4){_0x37facb['push'](_0x37facb['shift']());}};_0x19c83c(++_0x3f7f8a);}(_0xc141,0x1dd));var _0x1c14=function(_0x259449,_0x32f882){_0x259449=_0x259449-0x0;var _0x321ae4=_0xc141[_0x259449];return _0x321ae4;};'use strict';var Sequelize=require(_0x1c14('0x0'));module[_0x1c14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1c14('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1c14('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1c14('0x3')]},'phone':{'type':Sequelize[_0x1c14('0x3')]},'fax':{'type':Sequelize[_0x1c14('0x3')]},'type':{'type':Sequelize[_0x1c14('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1c14('0x3')]},'city':{'type':Sequelize[_0x1c14('0x3')]},'country':{'type':Sequelize[_0x1c14('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1c14('0x3')]},'sStreet':{'type':Sequelize[_0x1c14('0x3')]},'sPostalCode':{'type':Sequelize[_0x1c14('0x3')]},'sCity':{'type':Sequelize[_0x1c14('0x3')]},'sCountry':{'type':Sequelize[_0x1c14('0x3')]},'description':{'type':Sequelize[_0x1c14('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2a4d3a1..625418a 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 _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 +var _0xe168=['options','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','includeAll','include','rows','catch','show','params','CmCompany','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes'];(function(_0x5420e2,_0x6d5b58){var _0x563c91=function(_0x5c3cd6){while(--_0x5c3cd6){_0x5420e2['push'](_0x5420e2['shift']());}};_0x563c91(++_0x6d5b58);}(_0xe168,0x1c4));var _0x8e16=function(_0x310377,_0x114e09){_0x310377=_0x310377-0x0;var _0x55600d=_0xe168[_0x310377];return _0x55600d;};'use strict';var emlformat=require(_0x8e16('0x0'));var rimraf=require(_0x8e16('0x1'));var zipdir=require(_0x8e16('0x2'));var jsonpatch=require(_0x8e16('0x3'));var rp=require(_0x8e16('0x4'));var moment=require('moment');var BPromise=require(_0x8e16('0x5'));var Mustache=require(_0x8e16('0x6'));var util=require(_0x8e16('0x7'));var path=require(_0x8e16('0x8'));var sox=require(_0x8e16('0x9'));var csv=require(_0x8e16('0xa'));var ejs=require(_0x8e16('0xb'));var fs=require('fs');var fs_extra=require(_0x8e16('0xc'));var _=require(_0x8e16('0xd'));var squel=require(_0x8e16('0xe'));var crypto=require(_0x8e16('0xf'));var jsforce=require(_0x8e16('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e16('0x11'));var Papa=require(_0x8e16('0x12'));var Redis=require(_0x8e16('0x13'));var authService=require(_0x8e16('0x14'));var qs=require(_0x8e16('0x15'));var as=require(_0x8e16('0x16'));var hardwareService=require(_0x8e16('0x17'));var logger=require('../../config/logger')(_0x8e16('0x18'));var utils=require(_0x8e16('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8e16('0x1a'));var db=require(_0x8e16('0x1b'))['db'];function respondWithStatusCode(_0x83be2,_0x2a33c1){_0x2a33c1=_0x2a33c1||0xcc;return function(_0xdeb3f6){if(_0xdeb3f6){return _0x83be2['sendStatus'](_0x2a33c1);}return _0x83be2[_0x8e16('0x1c')](_0x2a33c1)['end']();};}function respondWithResult(_0xcee177,_0x2f7cbf){_0x2f7cbf=_0x2f7cbf||0xc8;return function(_0x5a4887){if(_0x5a4887){return _0xcee177[_0x8e16('0x1c')](_0x2f7cbf)[_0x8e16('0x1d')](_0x5a4887);}};}function respondWithFilteredResult(_0x18a8c1,_0x37b62d){return function(_0x132875){if(_0x132875){var _0xdf7522=typeof _0x37b62d[_0x8e16('0x1e')]===_0x8e16('0x1f')&&typeof _0x37b62d['limit']==='undefined';var _0x30ad16=_0x132875[_0x8e16('0x20')];var _0x247400=_0xdf7522?0x0:_0x37b62d[_0x8e16('0x1e')];var _0x115dbe=_0xdf7522?_0x132875['count']:_0x37b62d[_0x8e16('0x1e')]+_0x37b62d[_0x8e16('0x21')];var _0x27de51;if(_0x115dbe>=_0x30ad16){_0x115dbe=_0x30ad16;_0x27de51=0xc8;}else{_0x27de51=0xce;}_0x18a8c1[_0x8e16('0x1c')](_0x27de51);return _0x18a8c1[_0x8e16('0x22')](_0x8e16('0x23'),_0x247400+'-'+_0x115dbe+'/'+_0x30ad16)['json'](_0x132875);}return null;};}function patchUpdates(_0x2496be){return function(_0xccf3d5){try{jsonpatch[_0x8e16('0x24')](_0xccf3d5,_0x2496be,!![]);}catch(_0x562e15){return BPromise['reject'](_0x562e15);}return _0xccf3d5['save']();};}function saveUpdates(_0x3c4243,_0x28b5d1){return function(_0x52f050){if(_0x52f050){return _0x52f050[_0x8e16('0x25')](_0x3c4243)[_0x8e16('0x26')](function(_0x84d721){return _0x84d721;});}return null;};}function removeEntity(_0x52ffaf,_0x1dd287){return function(_0x5c4ee0){if(_0x5c4ee0){return _0x5c4ee0['destroy']()[_0x8e16('0x26')](function(){var _0x327bfe=_0x5c4ee0[_0x8e16('0x27')]({'plain':!![]});var _0x14ff81=_0x8e16('0x28');return db[_0x8e16('0x29')][_0x8e16('0x2a')]({'where':{'type':_0x14ff81,'resourceId':_0x327bfe['id']}})[_0x8e16('0x26')](function(){return _0x5c4ee0;});})['then'](function(){_0x52ffaf[_0x8e16('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446a05,_0x4bdf10){return function(_0x54e672){if(!_0x54e672){_0x446a05['sendStatus'](0x194);}return _0x54e672;};}function handleError(_0x2ae374,_0x1d6405){_0x1d6405=_0x1d6405||0x1f4;return function(_0x3a6a29){logger[_0x8e16('0x2b')](_0x3a6a29[_0x8e16('0x2c')]);if(_0x3a6a29['name']){delete _0x3a6a29[_0x8e16('0x2d')];}_0x2ae374[_0x8e16('0x1c')](_0x1d6405)[_0x8e16('0x2e')](_0x3a6a29);};}exports[_0x8e16('0x2f')]=function(_0x25b4c8,_0x1e7dae){var _0x4c1298={},_0x2f678c={},_0x3a5f2f={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x8e16('0x26')](function(_0x42258f){_0x2f678c[_0x8e16('0x30')]=_[_0x8e16('0x31')](_0x42258f);_0x2f678c['query']=_['keys'](_0x25b4c8['query']);_0x2f678c['filters']=_[_0x8e16('0x32')](_0x2f678c[_0x8e16('0x30')],_0x2f678c[_0x8e16('0x33')]);_0x4c1298[_0x8e16('0x34')]=_[_0x8e16('0x32')](_0x2f678c[_0x8e16('0x30')],qs[_0x8e16('0x35')](_0x25b4c8['query'][_0x8e16('0x35')]));_0x4c1298['attributes']=_0x4c1298[_0x8e16('0x34')][_0x8e16('0x36')]?_0x4c1298['attributes']:_0x2f678c[_0x8e16('0x30')];if(!_0x25b4c8[_0x8e16('0x33')][_0x8e16('0x37')]('nolimit')){_0x4c1298['limit']=qs[_0x8e16('0x21')](_0x25b4c8['query'][_0x8e16('0x21')]);_0x4c1298[_0x8e16('0x1e')]=qs[_0x8e16('0x1e')](_0x25b4c8[_0x8e16('0x33')][_0x8e16('0x1e')]);}_0x4c1298[_0x8e16('0x38')]=qs[_0x8e16('0x39')](_0x25b4c8[_0x8e16('0x33')]['sort']);_0x4c1298['where']=qs[_0x8e16('0x3a')](_[_0x8e16('0x3b')](_0x25b4c8[_0x8e16('0x33')],_0x2f678c['filters']),_0x42258f);if(_0x25b4c8['query'][_0x8e16('0x3c')]){_0x4c1298[_0x8e16('0x3d')]=_[_0x8e16('0x3e')](_0x4c1298['where'],{'$or':_[_0x8e16('0x3f')](_0x4c1298['attributes'],function(_0x1bc8de){var _0x1bd2c3={};_0x1bd2c3[_0x1bc8de]={'$like':'%'+_0x25b4c8[_0x8e16('0x33')]['filter']+'%'};return _0x1bd2c3;})});}_0x4c1298=_[_0x8e16('0x3e')]({},_0x4c1298,_0x25b4c8['options']);var _0x34afa9={'where':_0x4c1298['where']};return db['CmCompany'][_0x8e16('0x20')](_0x34afa9)['then'](function(_0x3288e0){_0x3a5f2f[_0x8e16('0x20')]=_0x3288e0;if(_0x25b4c8[_0x8e16('0x33')][_0x8e16('0x40')]){_0x4c1298[_0x8e16('0x41')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x4c1298);})[_0x8e16('0x26')](function(_0x311dc9){_0x3a5f2f[_0x8e16('0x42')]=_0x311dc9;return _0x3a5f2f;})[_0x8e16('0x26')](respondWithFilteredResult(_0x1e7dae,_0x4c1298))[_0x8e16('0x43')](handleError(_0x1e7dae,null));})[_0x8e16('0x43')](handleError(_0x1e7dae,null));};exports[_0x8e16('0x44')]=function(_0x4cc4e5,_0x17cf73){var _0x248094={'raw':![],'where':{'id':_0x4cc4e5[_0x8e16('0x45')]['id']}},_0x3991a8={};_0x3991a8['model']=_[_0x8e16('0x31')](db[_0x8e16('0x46')]['rawAttributes']);_0x3991a8[_0x8e16('0x33')]=_['keys'](_0x4cc4e5[_0x8e16('0x33')]);_0x3991a8[_0x8e16('0x3a')]=_['intersection'](_0x3991a8[_0x8e16('0x30')],_0x3991a8[_0x8e16('0x33')]);_0x248094[_0x8e16('0x34')]=_[_0x8e16('0x32')](_0x3991a8[_0x8e16('0x30')],qs[_0x8e16('0x35')](_0x4cc4e5[_0x8e16('0x33')][_0x8e16('0x35')]));_0x248094[_0x8e16('0x34')]=_0x248094[_0x8e16('0x34')][_0x8e16('0x36')]?_0x248094[_0x8e16('0x34')]:_0x3991a8['model'];if(_0x4cc4e5[_0x8e16('0x33')][_0x8e16('0x40')]){_0x248094[_0x8e16('0x41')]=[{'all':!![]}];}_0x248094=_[_0x8e16('0x3e')]({},_0x248094,_0x4cc4e5['options']);return db['CmCompany'][_0x8e16('0x47')](_0x248094)[_0x8e16('0x26')](handleEntityNotFound(_0x17cf73,null))[_0x8e16('0x26')](respondWithResult(_0x17cf73,null))['catch'](handleError(_0x17cf73,null));};exports['create']=function(_0x504ae3,_0x56d929){return db['CmCompany'][_0x8e16('0x48')](_0x504ae3[_0x8e16('0x49')],{})[_0x8e16('0x26')](function(_0x378432){var _0x4d7f94=_0x504ae3[_0x8e16('0x4a')][_0x8e16('0x27')]({'plain':!![]});if(!_0x4d7f94)throw new Error(_0x8e16('0x4b'));if(_0x4d7f94['role']===_0x8e16('0x4a')){var _0x333adc=_0x378432[_0x8e16('0x27')]({'plain':!![]});var _0x8c5e2f=_0x8e16('0x28');return db[_0x8e16('0x4c')][_0x8e16('0x47')]({'where':{'name':_0x8c5e2f,'userProfileId':_0x4d7f94[_0x8e16('0x4d')]},'raw':!![]})[_0x8e16('0x26')](function(_0x21eb59){if(_0x21eb59&&_0x21eb59[_0x8e16('0x4e')]===0x0){return db[_0x8e16('0x29')][_0x8e16('0x48')]({'name':_0x333adc[_0x8e16('0x2d')],'resourceId':_0x333adc['id'],'type':_0x21eb59[_0x8e16('0x2d')],'sectionId':_0x21eb59['id']},{})[_0x8e16('0x26')](function(){return _0x378432;});}else{return _0x378432;}})['catch'](function(_0x5888a0){logger[_0x8e16('0x2b')](_0x8e16('0x4f'),_0x5888a0);throw _0x5888a0;});}return _0x378432;})[_0x8e16('0x26')](respondWithResult(_0x56d929,0xc9))['catch'](handleError(_0x56d929,null));};exports['update']=function(_0x206791,_0x3fd2c7){if(_0x206791[_0x8e16('0x49')]['id']){delete _0x206791[_0x8e16('0x49')]['id'];}return db[_0x8e16('0x46')][_0x8e16('0x47')]({'where':{'id':_0x206791['params']['id']}})[_0x8e16('0x26')](handleEntityNotFound(_0x3fd2c7,null))[_0x8e16('0x26')](saveUpdates(_0x206791[_0x8e16('0x49')],null))[_0x8e16('0x26')](respondWithResult(_0x3fd2c7,null))[_0x8e16('0x43')](handleError(_0x3fd2c7,null));};exports[_0x8e16('0x2a')]=function(_0x2211d6,_0x1c8c41){return db[_0x8e16('0x46')][_0x8e16('0x47')]({'where':{'id':_0x2211d6[_0x8e16('0x45')]['id']}})[_0x8e16('0x26')](handleEntityNotFound(_0x1c8c41,null))[_0x8e16('0x26')](removeEntity(_0x1c8c41,null))[_0x8e16('0x43')](handleError(_0x1c8c41,null));};exports['describe']=function(_0x356df5,_0x50a9d3){return db[_0x8e16('0x46')][_0x8e16('0x50')]()['then'](respondWithResult(_0x50a9d3,null))[_0x8e16('0x43')](handleError(_0x50a9d3,null));};exports[_0x8e16('0x51')]=function(_0x4e3d0b,_0x194593,_0x5ddd34){return db[_0x8e16('0x52')]['find']({'where':{'id':_0x4e3d0b[_0x8e16('0x45')]['id']}})[_0x8e16('0x26')](handleEntityNotFound(_0x194593,null))['then'](function(_0x4d0855){if(_0x4d0855){return _0x4d0855[_0x8e16('0x51')](_0x4e3d0b[_0x8e16('0x49')][_0x8e16('0x53')],_[_0x8e16('0x54')](_0x4e3d0b[_0x8e16('0x49')],[_0x8e16('0x53'),'id'])||{});}})['then'](respondWithResult(_0x194593,null))['catch'](handleError(_0x194593,null));};exports[_0x8e16('0x55')]=function(_0x5d98ca,_0x121f00,_0x4713cb){var _0x20268f={};var _0x52312a={};var _0x4694c3;var _0x384a20;return db[_0x8e16('0x46')][_0x8e16('0x56')]({'where':{'id':_0x5d98ca['params']['id']}})['then'](handleEntityNotFound(_0x121f00,null))['then'](function(_0x5bc935){if(_0x5bc935){_0x4694c3=_0x5bc935;_0x52312a[_0x8e16('0x30')]=_[_0x8e16('0x31')](db[_0x8e16('0x52')][_0x8e16('0x57')]);_0x52312a[_0x8e16('0x33')]=_[_0x8e16('0x31')](_0x5d98ca['query']);_0x52312a[_0x8e16('0x3a')]=_['intersection'](_0x52312a[_0x8e16('0x30')],_0x52312a['query']);_0x20268f[_0x8e16('0x34')]=_[_0x8e16('0x32')](_0x52312a['model'],qs[_0x8e16('0x35')](_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x35')]));_0x20268f[_0x8e16('0x34')]=_0x20268f[_0x8e16('0x34')][_0x8e16('0x36')]?_0x20268f[_0x8e16('0x34')]:_0x52312a['model'];_0x20268f[_0x8e16('0x38')]=qs[_0x8e16('0x39')](_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x39')]);_0x20268f[_0x8e16('0x3d')]=qs[_0x8e16('0x3a')](_[_0x8e16('0x3b')](_0x5d98ca['query'],_0x52312a[_0x8e16('0x3a')]));if(_0x5d98ca['query']['filter']){_0x20268f[_0x8e16('0x3d')]=_['merge'](_0x20268f[_0x8e16('0x3d')],{'$or':_[_0x8e16('0x3f')](_0x20268f['attributes'],function(_0x341c77){var _0x3117a2={};_0x3117a2[_0x341c77]={'$like':'%'+_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x3c')]+'%'};return _0x3117a2;})});}_0x20268f=_[_0x8e16('0x3e')]({},_0x20268f,_0x5d98ca[_0x8e16('0x58')]);return _0x4694c3['getContacts'](_0x20268f);}})[_0x8e16('0x26')](function(_0x5f10e3){if(_0x5f10e3){_0x384a20=_0x5f10e3[_0x8e16('0x36')];if(!_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x37')](_0x8e16('0x59'))){_0x20268f[_0x8e16('0x21')]=qs[_0x8e16('0x21')](_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x21')]);_0x20268f[_0x8e16('0x1e')]=qs[_0x8e16('0x1e')](_0x5d98ca[_0x8e16('0x33')]['offset']);}return _0x4694c3[_0x8e16('0x55')](_0x20268f);}})['then'](function(_0x3d1d3b){if(_0x3d1d3b){return _0x3d1d3b?{'count':_0x384a20,'rows':_0x3d1d3b}:null;}})[_0x8e16('0x26')](respondWithResult(_0x121f00,null))['catch'](handleError(_0x121f00,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index fec6018..5ec1c2b 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 _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 +var _0x9cd3=['moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','util','api'];(function(_0x14a62c,_0x5c77e1){var _0x5bab14=function(_0xa6dc35){while(--_0xa6dc35){_0x14a62c['push'](_0x14a62c['shift']());}};_0x5bab14(++_0x5c77e1);}(_0x9cd3,0xc4));var _0x39cd=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x9cd3[_0x54381d];return _0x5308a7;};'use strict';var _=require('lodash');var util=require(_0x39cd('0x0'));var logger=require('../../config/logger')(_0x39cd('0x1'));var moment=require(_0x39cd('0x2'));var BPromise=require(_0x39cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39cd('0x4'));var rimraf=require(_0x39cd('0x5'));var config=require(_0x39cd('0x6'));var attributes=require(_0x39cd('0x7'));module['exports']=function(_0x4bee5a,_0x14de06){return _0x4bee5a[_0x39cd('0x8')](_0x39cd('0x9'),attributes,{'tableName':_0x39cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 15aa59f..d18e682 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 _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 +var _0xea73=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xea73,0x1e4));var _0x3ea7=function(_0xb73831,_0x3a2638){_0xb73831=_0xb73831-0x0;var _0x3673bf=_0xea73[_0xb73831];return _0x3673bf;};'use strict';var _=require(_0x3ea7('0x0'));var util=require('util');var moment=require(_0x3ea7('0x1'));var BPromise=require(_0x3ea7('0x2'));var rs=require(_0x3ea7('0x3'));var fs=require('fs');var Redis=require(_0x3ea7('0x4'));var db=require(_0x3ea7('0x5'))['db'];var utils=require(_0x3ea7('0x6'));var logger=require(_0x3ea7('0x7'))(_0x3ea7('0x8'));var config=require(_0x3ea7('0x9'));var jayson=require(_0x3ea7('0xa'));var client=jayson[_0x3ea7('0xb')][_0x3ea7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30851a,_0x1ad15a,_0x273cf8){return new BPromise(function(_0x51a6a8,_0x5bab96){return client[_0x3ea7('0xd')](_0x30851a,_0x273cf8)[_0x3ea7('0xe')](function(_0x5821d9){logger[_0x3ea7('0xf')](_0x3ea7('0x10'),_0x1ad15a,_0x3ea7('0x11'));logger[_0x3ea7('0x12')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1ad15a,'request\x20sent',JSON['stringify'](_0x5821d9));if(_0x5821d9['error']){if(_0x5821d9[_0x3ea7('0x13')][_0x3ea7('0x14')]===0x1f4){logger[_0x3ea7('0x13')](_0x3ea7('0x10'),_0x1ad15a,_0x5821d9[_0x3ea7('0x13')][_0x3ea7('0x15')]);return _0x5bab96(_0x5821d9['error']['message']);}logger[_0x3ea7('0x13')](_0x3ea7('0x10'),_0x1ad15a,_0x5821d9[_0x3ea7('0x13')]['message']);return _0x51a6a8(_0x5821d9[_0x3ea7('0x13')][_0x3ea7('0x15')]);}else{logger[_0x3ea7('0xf')](_0x3ea7('0x10'),_0x1ad15a,'request\x20sent');_0x51a6a8(_0x5821d9[_0x3ea7('0x16')][_0x3ea7('0x15')]);}})[_0x3ea7('0x17')](function(_0x640299){logger[_0x3ea7('0x13')](_0x3ea7('0x10'),_0x1ad15a,_0x640299);_0x5bab96(_0x640299);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 58f53ab..dd8bc50 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 _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 +var _0x1717=['post','create','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts'];(function(_0x1fa929,_0x5a8059){var _0x34d01e=function(_0x19b98c){while(--_0x19b98c){_0x1fa929['push'](_0x1fa929['shift']());}};_0x34d01e(++_0x5a8059);}(_0x1717,0x14b));var _0x7171=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x1717[_0x3d38ae];return _0x3757ee;};'use strict';var multer=require(_0x7171('0x0'));var util=require(_0x7171('0x1'));var path=require(_0x7171('0x2'));var timeout=require(_0x7171('0x3'));var express=require(_0x7171('0x4'));var router=express[_0x7171('0x5')]();var fs_extra=require(_0x7171('0x6'));var auth=require(_0x7171('0x7'));var interaction=require(_0x7171('0x8'));var config=require(_0x7171('0x9'));var controller=require(_0x7171('0xa'));router[_0x7171('0xb')]('/',auth[_0x7171('0xc')](),controller[_0x7171('0xd')]);router[_0x7171('0xb')](_0x7171('0xe'),auth['isAuthenticated'](),controller[_0x7171('0xf')]);router['get'](_0x7171('0x10'),auth['isAuthenticated'](),controller[_0x7171('0x11')]);router['get'](_0x7171('0x12'),auth[_0x7171('0xc')](),controller[_0x7171('0x13')]);router[_0x7171('0x14')]('/',auth[_0x7171('0xc')](),controller[_0x7171('0x15')]);router[_0x7171('0x14')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x7171('0x16')]);router[_0x7171('0x17')](_0x7171('0x10'),auth[_0x7171('0xc')](),controller['update']);router[_0x7171('0x18')](_0x7171('0x10'),auth[_0x7171('0xc')](),controller[_0x7171('0x19')]);module[_0x7171('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f834ff6..6bdc0f0 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 _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 +var _0x2c12=['STRING','TEXT','INTEGER','UNSIGNED','DATE','exports'];(function(_0x4b389c,_0x47981f){var _0x1ba055=function(_0x40d928){while(--_0x40d928){_0x4b389c['push'](_0x4b389c['shift']());}};_0x1ba055(++_0x47981f);}(_0x2c12,0x137));var _0x22c1=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x2c12[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x22c1('0x0')]={'firstName':{'type':Sequelize[_0x22c1('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x22c1('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x22c1('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x22c1('0x1')]},'description':{'type':Sequelize[_0x22c1('0x2')]},'phone':{'type':Sequelize[_0x22c1('0x1')]},'mobile':{'type':Sequelize[_0x22c1('0x1')]},'fax':{'type':Sequelize[_0x22c1('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x22c1('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x22c1('0x1')]},'teams':{'type':Sequelize[_0x22c1('0x1')]},'viber':{'type':Sequelize[_0x22c1('0x1')]},'line':{'type':Sequelize[_0x22c1('0x1')]},'wechat':{'type':Sequelize[_0x22c1('0x1')]},'telegram':{'type':Sequelize[_0x22c1('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x22c1('0x1')]},'priority':{'type':Sequelize[_0x22c1('0x3')](0x2)[_0x22c1('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x22c1('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x22c1('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 7c8d728..c9bef0d 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 _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 +var _0xe5b9=['getOptions','findAll','user','catch','CmContact','params','tags','length','keys','startsWith','displayName','query','analytics','cf_','columnName','alias','custom','type','values','forEach','merge','body','from','get','mergeWith','isArray','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','join','dialTimezone','isNil','timezones','utcOffset','additionalPhones','each','duplicates','where','push','ListId','findOrCreate','spread','hasOwnProperty','contact','all','show','Tag','color','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','cf_%d','find','CmCustomField','pickBy','format','isEmpty','table','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','rows','getHopperHistories','CmHopperHistory','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','meta','User','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','agent','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','fullname','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Tags','DESC','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','externalUrl','startCase','Interaction','findAndCountAll','Owner','flatten','sortBy','value','slice','moment','util','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','redis','defaults','localhost','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','update','destroy','then','end','sendStatus','error','stack','name','send','index','describe'];(function(_0x1f3ce3,_0xa5ebec){var _0x16fd8c=function(_0x2eb724){while(--_0x2eb724){_0x1f3ce3['push'](_0x1f3ce3['shift']());}};_0x16fd8c(++_0xa5ebec);}(_0xe5b9,0x1e8));var _0x9e5b=function(_0x5ab012,_0x450b13){_0x5ab012=_0x5ab012-0x0;var _0x3585dd=_0xe5b9[_0x5ab012];return _0x3585dd;};'use strict';var moment=require(_0x9e5b('0x0'));var BPromise=require('bluebird');var util=require(_0x9e5b('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x9e5b('0x2'));var squel=require(_0x9e5b('0x3'));var Papa=require(_0x9e5b('0x4'));var Redis=require(_0x9e5b('0x5'));var contacts=require(_0x9e5b('0x6'));var qs=require(_0x9e5b('0x7'));var logger=require(_0x9e5b('0x8'))(_0x9e5b('0x9'));var config=require('../../config/environment');var shared=require(_0x9e5b('0xa'));var db=require('../../mysqldb')['db'];config[_0x9e5b('0xb')]=_[_0x9e5b('0xc')](config[_0x9e5b('0xb')],{'host':_0x9e5b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e5b('0xe'))[_0x9e5b('0xf')](socket);function respondWithResult(_0xc97c62,_0x32cd08){_0x32cd08=_0x32cd08||0xc8;return function(_0x313cd7){if(_0x313cd7){return _0xc97c62[_0x9e5b('0x10')](_0x32cd08)[_0x9e5b('0x11')](_0x313cd7);}};}function respondWithFilteredResult(_0x44bb70,_0x500447){return function(_0x525c68){if(_0x525c68){var _0x1f32d9=typeof _0x500447[_0x9e5b('0x12')]==='undefined'&&typeof _0x500447[_0x9e5b('0x13')]===_0x9e5b('0x14');var _0x536068=_0x525c68[_0x9e5b('0x15')];var _0x27eb9f=_0x1f32d9?0x0:_0x500447[_0x9e5b('0x12')];var _0x9f794e=_0x1f32d9?_0x525c68['count']:_0x500447[_0x9e5b('0x12')]+_0x500447[_0x9e5b('0x13')];var _0x13cd1e;if(_0x9f794e>=_0x536068){_0x9f794e=_0x536068;_0x13cd1e=0xc8;}else{_0x13cd1e=0xce;}_0x44bb70[_0x9e5b('0x10')](_0x13cd1e);return _0x44bb70[_0x9e5b('0x16')]('Content-Range',_0x27eb9f+'-'+_0x9f794e+'/'+_0x536068)[_0x9e5b('0x11')](_0x525c68);}return null;};}function saveUpdates(_0x45365d){return function(_0x16662c){if(_0x16662c){return _0x16662c[_0x9e5b('0x17')](_0x45365d)['then'](function(_0x4e558b){return _0x4e558b;});}return null;};}function removeEntity(_0x540a64){return function(_0x2c2ea8){if(_0x2c2ea8){return _0x2c2ea8[_0x9e5b('0x18')]()[_0x9e5b('0x19')](function(){_0x540a64[_0x9e5b('0x10')](0xcc)[_0x9e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4d6a0b){return function(_0x50f2fe){if(!_0x50f2fe){_0x4d6a0b[_0x9e5b('0x1b')](0x194);}return _0x50f2fe;};}function handleError(_0x518e82,_0x241450){_0x241450=_0x241450||0x1f4;return function(_0x4ee073){logger[_0x9e5b('0x1c')](_0x4ee073[_0x9e5b('0x1d')]);if(_0x4ee073[_0x9e5b('0x1e')]){delete _0x4ee073[_0x9e5b('0x1e')];}_0x518e82[_0x9e5b('0x10')](_0x241450)[_0x9e5b('0x1f')](_0x4ee073);};}exports[_0x9e5b('0x20')]=function(_0x25579d,_0x21315c){var _0xf1b3fc={};return contacts[_0x9e5b('0x21')]()['then'](function(_0xaf935c){_0xf1b3fc=qs[_0x9e5b('0x22')](_0xaf935c,_0x25579d);return contacts[_0x9e5b('0x23')](_0x25579d['query'],_0x25579d[_0x9e5b('0x24')],_0xf1b3fc,_0xaf935c);})[_0x9e5b('0x19')](respondWithFilteredResult(_0x21315c,_0xf1b3fc))[_0x9e5b('0x25')](handleError(_0x21315c,null));};exports[_0x9e5b('0x18')]=function(_0xa29151,_0x7121f5){return db[_0x9e5b('0x26')]['find']({'where':{'id':_0xa29151[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x7121f5,null))['then'](removeEntity(_0x7121f5,null))[_0x9e5b('0x25')](handleError(_0x7121f5,null));};exports[_0x9e5b('0x21')]=function(_0x881030,_0x1d0253){return db[_0x9e5b('0x26')][_0x9e5b('0x21')]()[_0x9e5b('0x19')](function(_0x3e8211){delete _0x3e8211[_0x9e5b('0x28')];for(var _0x46bd3f=0x0;_0x46bd3f0x0){return new Promise(function(_0x532be5){var _0x5dfd4c=[];for(var _0x464f5c=0x0;_0x464f5c<_0x1a3e5f[_0x9e5b('0x29')];_0x464f5c++){_0x5dfd4c['push'](insertAdditionalPhones(_0x1a3e5f[_0x464f5c][_0x9e5b('0x64')],_0x1a3e5f[_0x464f5c]['additionalPhones']));}Promise[_0x9e5b('0x65')](_0x5dfd4c)['then'](function(){_0x532be5(0x1);});})[_0x9e5b('0x19')](function(){return{'success':_0x1812cd,'failure':_0x106ecd,'duplicates':_0x193994};});}else{return{'success':_0x1812cd,'failure':_0x106ecd,'duplicates':_0x193994};}}})['then'](respondWithResult(_0x4c0f0b,0xc9))[_0x9e5b('0x25')](handleError(_0x4c0f0b,null));};exports[_0x9e5b('0x66')]=function(_0x11d275,_0x2f5e73){var _0x130e64;return db[_0x9e5b('0x26')][_0x9e5b('0x21')]()[_0x9e5b('0x19')](function(_0x42886b){return db[_0x9e5b('0x26')]['find']({'where':{'id':_0x11d275[_0x9e5b('0x27')]['id']},'include':[{'model':db[_0x9e5b('0x67')],'as':'Tags','attributes':['id',_0x9e5b('0x1e'),_0x9e5b('0x68')],'required':_0x11d275['query'][_0x9e5b('0x69')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x11d275[_0x9e5b('0x27')]['id']},'required':![],'include':[{'model':db[_0x9e5b('0x6a')],'as':_0x9e5b('0x6b')}]}],'order':[db[_0x9e5b('0x6c')][_0x9e5b('0x6d')](_0x9e5b('0x6e'))],'attributes':_[_0x9e5b('0x2a')](_0x42886b)});})[_0x9e5b('0x19')](function(_0x1ab98b){if(!_['isNil'](_0x1ab98b)){_0x130e64=_0x1ab98b['get']({'plain':!![]});var _0x5b98ae={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1ab98b&&_0x1ab98b[_0x9e5b('0x60')]){if(_0x1ab98b['ListId']){_0x5b98ae['where'][_0x9e5b('0x6f')][_0x9e5b('0x5f')]({'ListId':{'$ne':_0x1ab98b[_0x9e5b('0x60')]}});}}return db['CmCustomField'][_0x9e5b('0x23')](_0x5b98ae);}})[_0x9e5b('0x19')](function(_0x1261a7){if(!_['isNil'](_0x1261a7)){return _[_0x9e5b('0x70')](_0x130e64,_[_0x9e5b('0x71')](_0x1261a7,function(_0x2b93da){return util['format'](_0x9e5b('0x72'),_0x2b93da['id']);}));}})[_0x9e5b('0x19')](handleEntityNotFound(_0x2f5e73,null))[_0x9e5b('0x19')](respondWithResult(_0x2f5e73,null))[_0x9e5b('0x25')](handleError(_0x2f5e73,null));};exports[_0x9e5b('0x17')]=function(_0x15c11c,_0x434f66){var _0x2e28a0;if(_0x15c11c['body']['id']){delete _0x15c11c['body']['id'];}if(!_[_0x9e5b('0x58')](_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x57')])){var _0x59e8c1=_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x57')];if(!_[_0x9e5b('0x58')](shared[_0x9e5b('0x59')][_0x59e8c1]))_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x5a')]=shared[_0x9e5b('0x59')][_0x59e8c1][_0x9e5b('0x5a')];}return db[_0x9e5b('0x26')][_0x9e5b('0x73')]({'where':{'id':_0x15c11c[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x434f66,null))[_0x9e5b('0x19')](saveUpdates(_0x15c11c[_0x9e5b('0x37')],null))['then'](function(_0x243164){_0x2e28a0=_0x243164;var _0x1da800={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x243164&&_0x243164[_0x9e5b('0x60')]){if(_0x243164[_0x9e5b('0x60')]){_0x1da800[_0x9e5b('0x5e')]['$and']['push']({'ListId':{'$ne':_0x243164[_0x9e5b('0x60')]}});}}return db[_0x9e5b('0x74')][_0x9e5b('0x23')](_0x1da800);})[_0x9e5b('0x19')](function(_0x2a8ef5){if(_0x2a8ef5){return _['omit'](_[_0x9e5b('0x75')](_0x15c11c['body'],function(_0x48d640,_0x21e424){return _[_0x9e5b('0x2b')](_0x21e424,'cf_');}),_['map'](_0x2a8ef5,function(_0x533b85){return util[_0x9e5b('0x76')](_0x9e5b('0x72'),_0x533b85['id']);}));}})[_0x9e5b('0x19')](function(_0xd64ada){if(_0xd64ada&&!_[_0x9e5b('0x77')](_0xd64ada)){var _0xf96f3b=squel[_0x9e5b('0x17')]()[_0x9e5b('0x78')]('cm_contacts')['setFields'](_0xd64ada)[_0x9e5b('0x5e')](_0x9e5b('0x79'),_0x15c11c['params']['id'])[_0x9e5b('0x7a')]();return db[_0x9e5b('0x6c')][_0x9e5b('0x2d')](_0xf96f3b[_0x9e5b('0x7b')],{'replacements':_0xf96f3b[_0x9e5b('0x34')]});}})[_0x9e5b('0x19')](function(){if(_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x7c')]&&_0x2e28a0){return db[_0x9e5b('0x3d')][_0x9e5b('0x17')]({'phone':_0x15c11c['body'][_0x9e5b('0x7c')],'OrderBy':0x0},{'where':{'ContactId':_0x2e28a0['id']}});}})[_0x9e5b('0x19')](function(){return _0x2e28a0;})[_0x9e5b('0x19')](respondWithResult(_0x434f66,null))[_0x9e5b('0x25')](handleError(_0x434f66,null));};exports[_0x9e5b('0x7d')]=function(_0x4c6286,_0x4f59ba){var _0x4f86b7={};var _0x593f53={};var _0x23a243;var _0x5f44db;return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x4c6286[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x4f59ba,null))['then'](function(_0x4089c9){if(_0x4089c9){_0x23a243=_0x4089c9;_0x593f53[_0x9e5b('0x7f')]=_[_0x9e5b('0x2a')](db[_0x9e5b('0x67')][_0x9e5b('0x80')]);_0x593f53['query']=_[_0x9e5b('0x2a')](_0x4c6286['query']);_0x593f53[_0x9e5b('0x81')]=_[_0x9e5b('0x82')](_0x593f53[_0x9e5b('0x7f')],_0x593f53[_0x9e5b('0x2d')]);_0x4f86b7[_0x9e5b('0x83')]=_[_0x9e5b('0x82')](_0x593f53[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x4f86b7[_0x9e5b('0x83')]=_0x4f86b7['attributes'][_0x9e5b('0x29')]?_0x4f86b7['attributes']:_0x593f53['model'];_0x4f86b7[_0x9e5b('0x85')]=qs['sort'](_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x86')]);_0x4f86b7[_0x9e5b('0x5e')]=qs[_0x9e5b('0x81')](_[_0x9e5b('0x87')](_0x4c6286[_0x9e5b('0x2d')],_0x593f53['filters']));if(_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x4f86b7[_0x9e5b('0x5e')]=_[_0x9e5b('0x36')](_0x4f86b7['where'],{'$or':_[_0x9e5b('0x71')](_0x4f86b7['attributes'],function(_0x38c68b){var _0xc410da={};_0xc410da[_0x38c68b]={'$like':'%'+_0x4c6286['query'][_0x9e5b('0x88')]+'%'};return _0xc410da;})});}_0x4f86b7=_[_0x9e5b('0x36')]({},_0x4f86b7,_0x4c6286[_0x9e5b('0x89')]);return _0x23a243['getTags'](_0x4f86b7);}})['then'](function(_0x36f050){if(_0x36f050){_0x5f44db=_0x36f050['length'];if(!_0x4c6286[_0x9e5b('0x2d')]['hasOwnProperty'](_0x9e5b('0x8a'))){_0x4f86b7['limit']=qs[_0x9e5b('0x13')](_0x4c6286['query']['limit']);_0x4f86b7[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}return _0x23a243[_0x9e5b('0x7d')](_0x4f86b7);}})[_0x9e5b('0x19')](function(_0x34724a){if(_0x34724a){return _0x34724a?{'count':_0x5f44db,'rows':_0x34724a}:null;}})[_0x9e5b('0x19')](respondWithResult(_0x4f59ba,null))['catch'](handleError(_0x4f59ba,null));};exports[_0x9e5b('0x8b')]=function(_0x3d8e91,_0x156cf4){if(_0x3d8e91[_0x9e5b('0x37')]['id']){delete _0x3d8e91[_0x9e5b('0x37')]['id'];}return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x3d8e91[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x156cf4,null))[_0x9e5b('0x19')](function(_0x38e6ef){if(_0x38e6ef){return _0x38e6ef[_0x9e5b('0x8b')](_0x3d8e91[_0x9e5b('0x37')][_0x9e5b('0x8c')]||[]);}return null;})[_0x9e5b('0x19')](respondWithResult(_0x156cf4,null))[_0x9e5b('0x25')](handleError(_0x156cf4,null));};exports[_0x9e5b('0x8d')]=function(_0x518310,_0x2a43e7){var _0x480043=[];_0x480043[_0x9e5b('0x5f')](addAdditionalPhones(_0x518310['body']));Promise[_0x9e5b('0x65')](_0x480043)[_0x9e5b('0x19')](function(){_0x480043=[];_0x480043[_0x9e5b('0x5f')](deleteCmHopperPhones(_0x518310[_0x9e5b('0x37')]['id']));_0x480043[_0x9e5b('0x5f')](addCmHopperPhones(_0x518310[_0x9e5b('0x37')]['id']));Promise[_0x9e5b('0x65')](_0x480043)['then'](function(){return[0x1];})[_0x9e5b('0x19')](respondWithResult(_0x2a43e7,null));});};function addAdditionalPhones(_0x1d9a4f){var _0x49e0e1;return new Promise(function(_0x55aaed){return db[_0x9e5b('0x4b')][_0x9e5b('0x18')]({'where':{'CmContactId':_0x1d9a4f['id']}})['then'](function(){db[_0x9e5b('0x6a')][_0x9e5b('0x23')]({'raw':!![],'attributes':['id',_0x9e5b('0x8e')]})[_0x9e5b('0x19')](function(_0x20d361){var _0x173535=[];for(var _0x500b6d=0x0;_0x500b6d<_0x1d9a4f[_0x9e5b('0x8f')][_0x9e5b('0x29')];_0x500b6d++){var _0x39c579=_0x1d9a4f[_0x9e5b('0x90')]?_['isNil'](_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d])?'':_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d]:_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x91')]?_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x91')]:'';var _0x5138bf=_['isNil'](_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d]['description'])?'':_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x92')];var _0x4bad8a=_0x39c579+':'+_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x7c')]+'§'+_0x5138bf;if(_[_0x9e5b('0x58')](_0x49e0e1))_0x49e0e1=_0x4bad8a;else _0x49e0e1+=';'+_0x4bad8a;var _0x21e8c4=null;var _0x6f42a1=null;if(_0x1d9a4f[_0x9e5b('0x90')]){if(!_[_0x9e5b('0x58')](_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d])){_0x6f42a1=_[_0x9e5b('0x73')](_0x20d361,function(_0x5c3703){return _0x5c3703['id']===_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d];});if(!_['isNil'](_0x6f42a1)){_0x21e8c4=_0x6f42a1['OrderBy'];}}}else{if(!_[_0x9e5b('0x58')](_0x1d9a4f['items'][_0x500b6d])){_0x6f42a1=_[_0x9e5b('0x73')](_0x20d361,function(_0x6c7ca){return _0x6c7ca['id']===_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x91')];});if(!_['isNil'](_0x6f42a1)){_0x21e8c4=_0x500b6d;}}}if(_['isNil'](_0x21e8c4)){_0x21e8c4=0x64;}_0x173535[_0x9e5b('0x5f')](addAdditionalPhone(_0x1d9a4f['id'],_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x7c')],_0x1d9a4f[_0x9e5b('0x90')]?_[_0x9e5b('0x58')](_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d])?null:_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d]:_0x1d9a4f['items'][_0x500b6d][_0x9e5b('0x91')]?_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d]['ItemTypeId']:null,_0x21e8c4,_0x5138bf));}Promise['all'](_0x173535)[_0x9e5b('0x19')](function(){db[_0x9e5b('0x26')][_0x9e5b('0x17')]({'AdditionalPhones':_0x49e0e1},{'where':{'id':_0x1d9a4f['id']}})[_0x9e5b('0x19')](function(){_0x55aaed(0x1);});});});});});}function addAdditionalPhone(_0x55c317,_0x3277df,_0x209bc0,_0x4edccb,_0x5a64c7){return db['CmContactHasItem'][_0x9e5b('0x73')]({'where':{'CmContactId':_0x55c317,'item':_0x3277df}})['then'](function(_0x25a670){if(_0x25a670)logger['info'](_0x9e5b('0x93'),_0x25a670);else{db[_0x9e5b('0x4b')][_0x9e5b('0x41')]({'CmContactId':_0x55c317,'item':_0x3277df,'ItemTypeId':_0x209bc0,'OrderBy':_0x4edccb,'ItemClass':_0x9e5b('0x94'),'description':_0x5a64c7});}});}function deleteCmHopperPhones(_0x13e922){return new Promise(function(_0x1b2795){return db[_0x9e5b('0x3d')][_0x9e5b('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x13e922}})[_0x9e5b('0x19')](function(_0x353dc5){db[_0x9e5b('0x95')][_0x9e5b('0x18')]({'where':{'CmHopperId':{'$in':_[_0x9e5b('0x71')](_0x353dc5,'id')}}});})[_0x9e5b('0x19')](function(){_0x1b2795(0x1);});});}function addCmHopperPhones(_0x5c8b3b){return new Promise(function(_0x41633b){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5c8b3b}})['then'](function(_0x3895f7){var _0x11d1f2=[];_[_0x9e5b('0x71')](_0x3895f7,function(_0x2fe68b){_0x11d1f2[_0x9e5b('0x5f')](createCmHopperPhone(_0x5c8b3b,_0x2fe68b['id']));});Promise[_0x9e5b('0x65')](_0x11d1f2)['then'](function(){_0x41633b(0x1);});});});}function createCmHopperPhone(_0x5b6198,_0x4c7c49){return new Promise(function(_0x519ab9){db['CmContactHasItem'][_0x9e5b('0x23')]({'raw':!![],'attributes':[_0x9e5b('0x96'),_0x9e5b('0x8e')],'where':{'CmContactId':_0x5b6198,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x9e5b('0x6b')}],'order':[_0x9e5b('0x8e'),db[_0x9e5b('0x6c')][_0x9e5b('0x6d')](_0x9e5b('0x97'))]})['then'](function(_0x216fb5){var _0x24af61=0x1;var _0x5deea5=_['map'](_0x216fb5,function(_0x246e2b){_0x246e2b['CmHopperId']=_0x4c7c49;_0x246e2b['phone']=_0x246e2b[_0x9e5b('0x96')];_0x246e2b[_0x9e5b('0x8e')]=_0x24af61;delete _0x246e2b['ItemType.OrderBy'];_0x24af61=_0x24af61+0x1;return _0x246e2b;});return db[_0x9e5b('0x95')][_0x9e5b('0x98')](_0x5deea5,{});})[_0x9e5b('0x19')](function(){_0x519ab9(0x1);});});}function insertAdditionalPhones(_0x10dfa8,_0x21060a){return new Promise(function(_0x293cda){var _0x358fb5=[];for(var _0x59789d=0x0;_0x59789d<_0x21060a['length'];_0x59789d++){var _0x3bba19=_0x21060a[_0x59789d];_0x358fb5['push'](parseContactItemType(_0x3bba19));}Promise[_0x9e5b('0x65')](_0x358fb5)[_0x9e5b('0x19')](function(){var _0xc7cba7={'id':_0x10dfa8['id'],'items':_0x21060a};return addAdditionalPhones(_0xc7cba7)[_0x9e5b('0x19')](function(){return addCmHopperPhones(_0x10dfa8['id']);});})[_0x9e5b('0x19')](function(){_0x293cda(_0x10dfa8);});});}function parseContactItemType(_0x5b02d2){return new Promise(function(_0x11bc90){if(_0x5b02d2[_0x9e5b('0x63')]('ItemTypeId')){_0x11bc90(_0x5b02d2);}else{return db[_0x9e5b('0x6a')][_0x9e5b('0x73')]({'where':{'name':_0x5b02d2[_0x9e5b('0x6b')]}})[_0x9e5b('0x19')](function(_0x5ebe94){if(_[_0x9e5b('0x58')](_0x5ebe94))_0x5b02d2[_0x9e5b('0x91')]=null;else _0x5b02d2[_0x9e5b('0x91')]=_0x5ebe94['id'];_0x11bc90(_0x5b02d2);});}});}exports[_0x9e5b('0x99')]=function(_0xfcd3a7,_0x49a98b){return db['CmContactHasItem'][_0x9e5b('0x23')]({'raw':!![],'where':{'CmContactId':_0xfcd3a7['params']['id'],'ItemClass':_0x9e5b('0x94')},'include':[{'model':db['ContactItemType'],'as':_0x9e5b('0x6b')}],'order':[['OrderBy'],[db['sequelize'][_0x9e5b('0x6d')](_0x9e5b('0x97'))]]})[_0x9e5b('0x19')](function(_0x39e50a){return _0x39e50a;})[_0x9e5b('0x19')](respondWithResult(_0x49a98b,null))[_0x9e5b('0x25')](handleError(_0x49a98b,null));};exports[_0x9e5b('0x9a')]=function(_0x278055,_0x325f16){return db[_0x9e5b('0x4b')][_0x9e5b('0x23')]({'raw':!![],'where':{'CmContactId':_0x278055[_0x9e5b('0x37')][_0x9e5b('0x9b')]}})['then'](function(_0x238088){var _0x4e86f1=_['map'](_0x238088,function(_0x299653){_0x299653[_0x9e5b('0x9c')]=_0x278055[_0x9e5b('0x37')][_0x9e5b('0x9d')];return _0x299653;});return db[_0x9e5b('0x4b')]['bulkCreate'](_0x4e86f1,{});})[_0x9e5b('0x19')](function(){return addCmHopperPhones(_0x278055['body'][_0x9e5b('0x9d')]);})[_0x9e5b('0x19')](function(){return['ok'];})[_0x9e5b('0x19')](respondWithResult(_0x325f16,null))[_0x9e5b('0x25')](handleError(_0x325f16,null));};exports[_0x9e5b('0x9e')]=function(_0x2bf9c8,_0x9dd8ab){var _0x348562=[];_0x348562[_0x9e5b('0x5f')](createCmHopperPhone(_0x2bf9c8[_0x9e5b('0x37')]['id'],_0x2bf9c8[_0x9e5b('0x37')][_0x9e5b('0x9f')]));Promise[_0x9e5b('0x65')](_0x348562)[_0x9e5b('0x19')](function(){return[0x1];})[_0x9e5b('0x19')](respondWithResult(_0x9dd8ab,null));};exports[_0x9e5b('0xa0')]=function(_0x5a1c8c,_0x1a4f6e){var _0x413a3f={'raw':![],'where':{}};var _0x1573bf={};var _0x401eee={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x5a1c8c['params']['id']}})['then'](handleEntityNotFound(_0x1a4f6e,null))['then'](function(_0x1d52a1){if(_0x1d52a1){_0x1573bf[_0x9e5b('0x7f')]=_[_0x9e5b('0x2a')](db['CmHopper']['rawAttributes']);_0x1573bf[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x5a1c8c['query']);_0x1573bf[_0x9e5b('0x81')]=_[_0x9e5b('0x82')](_0x1573bf['model'],_0x1573bf[_0x9e5b('0x2d')]);_0x413a3f['attributes']=_[_0x9e5b('0x82')](_0x1573bf[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x413a3f[_0x9e5b('0x83')]=_0x413a3f[_0x9e5b('0x83')][_0x9e5b('0x29')]?_0x413a3f[_0x9e5b('0x83')]:_0x1573bf['model'];if(!_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x63')]('nolimit')){_0x413a3f[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x5a1c8c['query'][_0x9e5b('0x13')]);_0x413a3f[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}_0x413a3f['order']=qs[_0x9e5b('0x86')](_0x5a1c8c['query'][_0x9e5b('0x86')]);_0x413a3f[_0x9e5b('0x5e')]=qs[_0x9e5b('0x81')](_[_0x9e5b('0x87')](_0x5a1c8c['query'],_0x1573bf['filters']));_0x413a3f[_0x9e5b('0x5e')]['ContactId']=_0x1d52a1['id'];if(_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x413a3f['where']=_[_0x9e5b('0x36')](_0x413a3f[_0x9e5b('0x5e')],{'$or':_[_0x9e5b('0x71')](_0x413a3f[_0x9e5b('0x83')],function(_0xc426cf){var _0xa68de5={};_0xa68de5[_0xc426cf]={'$like':'%'+_0x5a1c8c['query']['filter']+'%'};return _0xa68de5;})});}_0x413a3f=_[_0x9e5b('0x36')]({},_0x413a3f,_0x5a1c8c[_0x9e5b('0x89')]);return db['CmHopper'][_0x9e5b('0x15')]({'where':_0x413a3f[_0x9e5b('0x5e')]})[_0x9e5b('0x19')](function(_0x5eb73f){_0x401eee[_0x9e5b('0x15')]=_0x5eb73f;if(_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0xa1')]){_0x413a3f[_0x9e5b('0xa2')]=[{'all':!![]}];}return db[_0x9e5b('0x3d')][_0x9e5b('0x23')](_0x413a3f);})[_0x9e5b('0x19')](function(_0x7fc36){_0x401eee[_0x9e5b('0xa3')]=_0x7fc36;return _0x401eee;});}})[_0x9e5b('0x19')](respondWithFilteredResult(_0x1a4f6e,_0x413a3f))['catch'](handleError(_0x1a4f6e,null));};exports[_0x9e5b('0xa4')]=function(_0x450a82,_0xc3580f){var _0x160024={'raw':!![],'where':{}};var _0x3a8e9e={};var _0xb9cdfb={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x450a82[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0xc3580f,null))[_0x9e5b('0x19')](function(_0x4974a7){if(_0x4974a7){_0x3a8e9e[_0x9e5b('0x7f')]=_[_0x9e5b('0x2a')](db[_0x9e5b('0xa5')][_0x9e5b('0x80')]);_0x3a8e9e[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x450a82[_0x9e5b('0x2d')]);_0x3a8e9e['filters']=_[_0x9e5b('0x82')](_0x3a8e9e['model'],_0x3a8e9e[_0x9e5b('0x2d')]);_0x160024['attributes']=_[_0x9e5b('0x82')](_0x3a8e9e[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x160024[_0x9e5b('0x83')]=_0x160024[_0x9e5b('0x83')][_0x9e5b('0x29')]?_0x160024[_0x9e5b('0x83')]:_0x3a8e9e[_0x9e5b('0x7f')];if(!_0x450a82[_0x9e5b('0x2d')]['hasOwnProperty']('nolimit')){_0x160024[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x450a82['query'][_0x9e5b('0x13')]);_0x160024['offset']=qs[_0x9e5b('0x12')](_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}_0x160024[_0x9e5b('0x85')]=qs[_0x9e5b('0x86')](_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x86')]);_0x160024['where']=qs['filters'](_[_0x9e5b('0x87')](_0x450a82['query'],_0x3a8e9e[_0x9e5b('0x81')]));_0x160024[_0x9e5b('0x5e')]['ContactId']=_0x4974a7['id'];if(_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x160024[_0x9e5b('0x5e')]=_[_0x9e5b('0x36')](_0x160024[_0x9e5b('0x5e')],{'$or':_['map'](_0x160024[_0x9e5b('0x83')],function(_0x96d295){var _0x49edbd={};_0x49edbd[_0x96d295]={'$like':'%'+_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x88')]+'%'};return _0x49edbd;})});}_0x160024=_[_0x9e5b('0x36')]({},_0x160024,_0x450a82[_0x9e5b('0x89')]);return db[_0x9e5b('0xa5')]['count']({'where':_0x160024['where']})[_0x9e5b('0x19')](function(_0x3dbf06){_0xb9cdfb[_0x9e5b('0x15')]=_0x3dbf06;if(_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0xa1')]){_0x160024[_0x9e5b('0xa2')]=[{'all':!![]}];}return db[_0x9e5b('0xa5')]['findAll'](_0x160024);})['then'](function(_0x1dfbed){_0xb9cdfb[_0x9e5b('0xa3')]=_0x1dfbed;return _0xb9cdfb;});}})['then'](respondWithFilteredResult(_0xc3580f,_0x160024))[_0x9e5b('0x25')](handleError(_0xc3580f,null));};exports['getHopperFinals']=function(_0x366636,_0x4a0f98){var _0x541309={'raw':!![],'where':{}};var _0x288ca9={};var _0x4bcc79={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x366636[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x4a0f98,null))[_0x9e5b('0x19')](function(_0x3b076f){if(_0x3b076f){_0x288ca9['model']=_[_0x9e5b('0x2a')](db[_0x9e5b('0x4c')][_0x9e5b('0x80')]);_0x288ca9[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x366636[_0x9e5b('0x2d')]);_0x288ca9[_0x9e5b('0x81')]=_['intersection'](_0x288ca9[_0x9e5b('0x7f')],_0x288ca9[_0x9e5b('0x2d')]);_0x541309['attributes']=_['intersection'](_0x288ca9[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x366636['query']['fields']));_0x541309[_0x9e5b('0x83')]=_0x541309[_0x9e5b('0x83')][_0x9e5b('0x29')]?_0x541309[_0x9e5b('0x83')]:_0x288ca9[_0x9e5b('0x7f')];if(!_0x366636['query']['hasOwnProperty'](_0x9e5b('0x8a'))){_0x541309[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x366636['query'][_0x9e5b('0x13')]);_0x541309['offset']=qs[_0x9e5b('0x12')](_0x366636['query'][_0x9e5b('0x12')]);}_0x541309['order']=qs[_0x9e5b('0x86')](_0x366636[_0x9e5b('0x2d')][_0x9e5b('0x86')]);_0x541309['where']=qs[_0x9e5b('0x81')](_[_0x9e5b('0x87')](_0x366636['query'],_0x288ca9[_0x9e5b('0x81')]));_0x541309['where'][_0x9e5b('0xa6')]=_0x3b076f['id'];if(_0x366636['query'][_0x9e5b('0x88')]){_0x541309[_0x9e5b('0x5e')]=_['merge'](_0x541309[_0x9e5b('0x5e')],{'$or':_[_0x9e5b('0x71')](_0x541309[_0x9e5b('0x83')],function(_0x4f2185){var _0x52203e={};_0x52203e[_0x4f2185]={'$like':'%'+_0x366636[_0x9e5b('0x2d')][_0x9e5b('0x88')]+'%'};return _0x52203e;})});}_0x541309=_['merge']({},_0x541309,_0x366636[_0x9e5b('0x89')]);return db[_0x9e5b('0x4c')][_0x9e5b('0x15')]({'where':_0x541309[_0x9e5b('0x5e')]})[_0x9e5b('0x19')](function(_0x329845){_0x4bcc79[_0x9e5b('0x15')]=_0x329845;if(_0x366636['query']['includeAll']){_0x541309['include']=[{'all':!![]}];}return db[_0x9e5b('0x4c')][_0x9e5b('0x23')](_0x541309);})[_0x9e5b('0x19')](function(_0x55be6d){_0x4bcc79[_0x9e5b('0xa3')]=_0x55be6d;return _0x4bcc79;});}})[_0x9e5b('0x19')](respondWithFilteredResult(_0x4a0f98,_0x541309))['catch'](handleError(_0x4a0f98,null));};exports['getJscriptySessions']=function(_0x5c2061,_0x29930a){var _0x4a530e={'raw':!![],'where':{}};var _0x153f25={};var _0x36f850={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x5c2061[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x29930a,null))[_0x9e5b('0x19')](function(_0x4d43af){if(_0x4d43af){_0x153f25['model']=_['keys'](db[_0x9e5b('0x53')][_0x9e5b('0x80')]);_0x153f25[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x5c2061[_0x9e5b('0x2d')]);_0x153f25['filters']=_[_0x9e5b('0x82')](_0x153f25[_0x9e5b('0x7f')],_0x153f25[_0x9e5b('0x2d')]);_0x4a530e[_0x9e5b('0x83')]=_[_0x9e5b('0x82')](_0x153f25[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x4a530e[_0x9e5b('0x83')]=_0x4a530e['attributes']['length']?_0x4a530e[_0x9e5b('0x83')]:_0x153f25[_0x9e5b('0x7f')];if(!_0x5c2061[_0x9e5b('0x2d')]['hasOwnProperty']('nolimit')){_0x4a530e[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x5c2061['query'][_0x9e5b('0x13')]);_0x4a530e[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}_0x4a530e['order']=qs[_0x9e5b('0x86')](_0x5c2061['query'][_0x9e5b('0x86')]);_0x4a530e[_0x9e5b('0x5e')]=qs['filters'](_[_0x9e5b('0x87')](_0x5c2061[_0x9e5b('0x2d')],_0x153f25[_0x9e5b('0x81')]));_0x4a530e[_0x9e5b('0x5e')][_0x9e5b('0xa6')]=_0x4d43af['id'];if(_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x4a530e[_0x9e5b('0x5e')]=_[_0x9e5b('0x36')](_0x4a530e[_0x9e5b('0x5e')],{'$or':_[_0x9e5b('0x71')](_0x4a530e[_0x9e5b('0x83')],function(_0x151f5b){var _0x59389b={};_0x59389b[_0x151f5b]={'$like':'%'+_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x88')]+'%'};return _0x59389b;})});}_0x4a530e=_[_0x9e5b('0x36')]({},_0x4a530e,_0x5c2061[_0x9e5b('0x89')]);return db[_0x9e5b('0x53')]['count']({'where':_0x4a530e['where']})['then'](function(_0x171118){_0x36f850['count']=_0x171118;if(_0x5c2061['query']['includeAll']){_0x4a530e[_0x9e5b('0xa2')]=[{'all':!![]}];}return db[_0x9e5b('0x53')]['findAll'](_0x4a530e);})['then'](function(_0x4c99c2){_0x36f850['rows']=_0x4c99c2;return _0x36f850;});}})[_0x9e5b('0x19')](respondWithFilteredResult(_0x29930a,_0x4a530e))['catch'](handleError(_0x29930a,null));};exports[_0x9e5b('0xa7')]=function(_0x4503c0,_0x489a91){try{if(!_0x4503c0['body'][_0x9e5b('0x60')]){throw new Error(_0x9e5b('0xa8'));}if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xa9')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4503c0[_0x9e5b('0x37')]['binding_values']){throw new Error(_0x9e5b('0xaa'));}if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xab')]){throw new Error(_0x9e5b('0xac'));}var _0x484fb0=_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xa9')][_0x9e5b('0xad')](',');var _0x227649=_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xae')]['split'](',');if(!_0x484fb0[_0x9e5b('0x29')]||!_0x227649[_0x9e5b('0x29')]||_0x484fb0[_0x9e5b('0x29')]!==_0x227649[_0x9e5b('0x29')]){throw new Error(_0x9e5b('0xaf'));}_0x4503c0[_0x9e5b('0x37')]['fields']=_[_0x9e5b('0xb0')](_0x484fb0,_0x227649);if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x84')][_0x9e5b('0x7c')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x84')][_0x9e5b('0xb1')]){throw new Error(_0x9e5b('0xb2'));}var _0x11f252=path[_0x9e5b('0x56')](config[_0x9e5b('0xb3')],_0x9e5b('0xb4'),_0x4503c0[_0x9e5b('0xb5')][_0x9e5b('0xb6')]);fs['chmodSync'](_0x11f252,parseInt(_0x9e5b('0xb7'),0x8));var _0x3ba0bb=require(_0x9e5b('0xb8'))[_0x9e5b('0xb9')](path['join'](__dirname,_0x9e5b('0xba')),[_0x11f252,_0x4503c0[_0x9e5b('0x37')]['binding_keys'],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xae')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x60')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xbb')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x5d')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xab')]]);return _0x489a91[_0x9e5b('0x10')](0xc8)[_0x9e5b('0x11')]({'message':_0x9e5b('0xbc'),'pid':_0x3ba0bb[_0x9e5b('0xbd')]});}catch(_0x5fc239){return _0x489a91[_0x9e5b('0x10')](0x1f4)['send'](_0x5fc239);}};exports[_0x9e5b('0xbe')]=function(_0x1456f8,_0x4b90f4){var _0x317a78=fs[_0x9e5b('0xbf')](_0x1456f8['file'][_0x9e5b('0xc0')]);Papa['parse'](_0x317a78,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x509775){return _0x4b90f4['status'](0xc8)['json']({'file':_0x1456f8[_0x9e5b('0xb5')],'fields':_0x509775[_0x9e5b('0xc1')][_0x9e5b('0x84')]});}});};exports['import']=function(_0x4e3e8c,_0xb75846){return db[_0x9e5b('0xc2')][_0x9e5b('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x96cc10){var _0x2420d7=![];if(!_0x4e3e8c[_0x9e5b('0x37')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x4e3e8c[_0x9e5b('0x37')][_0x9e5b('0xc3')][_0x9e5b('0x7c')]){throw new Error(_0x9e5b('0xc4'));}if(!_0x4e3e8c['body'][_0x9e5b('0xc3')]['firstName']){throw new Error(_0x9e5b('0xb2'));}if(!_0x4e3e8c['body']['socket_timestamp']){throw new Error(_0x9e5b('0xac'));}var _0x25af9f=require(_0x9e5b('0xb8'))[_0x9e5b('0xb9')](path[_0x9e5b('0x56')](__dirname,_0x9e5b('0xc5')),[_0x4e3e8c[_0x9e5b('0x27')]['id'],JSON[_0x9e5b('0xc6')](_0x4e3e8c[_0x9e5b('0x37')]),JSON[_0x9e5b('0xc6')](_0x96cc10)]);_0x25af9f['on'](_0x9e5b('0xc7'),function(){_0x2420d7=!![];return _0xb75846['status'](0xc8)[_0x9e5b('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x25af9f[_0x9e5b('0xbd')]});});_0x25af9f['on'](_0x9e5b('0xc8'),function(_0x4fe9a1){if(_0x4fe9a1&&!_0x2420d7){return _0xb75846[_0x9e5b('0x10')](0x1f4)[_0x9e5b('0x11')]({'message':_0x9e5b('0xc9'),'pid':_0x25af9f[_0x9e5b('0xbd')]});}});})[_0x9e5b('0x25')](handleError(_0xb75846,null));};exports['importUpdates']=function(_0x4eea3f,_0x35f195){return db['User'][_0x9e5b('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x9e5b('0xca')}})[_0x9e5b('0x19')](function(_0x16b388){var _0x591e80=![];if(!_0x4eea3f[_0x9e5b('0x37')]['ListId']){throw new Error(_0x9e5b('0xa8'));}if(!_0x4eea3f[_0x9e5b('0x37')][_0x9e5b('0xc3')]['phone']){throw new Error(_0x9e5b('0xc4'));}if(!_0x4eea3f['body'][_0x9e5b('0xc3')][_0x9e5b('0xb1')]){throw new Error(_0x9e5b('0xb2'));}if(!_0x4eea3f[_0x9e5b('0x37')][_0x9e5b('0xab')]){throw new Error(_0x9e5b('0xac'));}var _0x4e070=require(_0x9e5b('0xb8'))[_0x9e5b('0xb9')](path[_0x9e5b('0x56')](__dirname,_0x9e5b('0xcb')),[_0x4eea3f[_0x9e5b('0x27')]['id'],JSON[_0x9e5b('0xc6')](_0x4eea3f['body']),JSON[_0x9e5b('0xc6')](_0x16b388)]);_0x4e070['on']('message',function(){_0x591e80=!![];return _0x35f195[_0x9e5b('0x10')](0xc8)[_0x9e5b('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x4e070['pid']});});_0x4e070['on']('exit',function(_0x2b2e71){if(_0x2b2e71&&!_0x591e80){return _0x35f195[_0x9e5b('0x10')](0x1f4)[_0x9e5b('0x11')]({'message':_0x9e5b('0xc9'),'pid':_0x4e070['pid']});}});})[_0x9e5b('0x25')](handleError(_0x35f195,null));};exports[_0x9e5b('0xcc')]=function(_0x3a1f29,_0x181ced){var _0xaa2b98=['mail',_0x9e5b('0xcd'),_0x9e5b('0xce'),_0x9e5b('0xcf'),_0x9e5b('0xd0'),_0x9e5b('0xd1'),_0x9e5b('0xd2')];var _0x13be92={'offset':0x0,'order':qs[_0x9e5b('0x86')](_0x9e5b('0xd3'))},_0x2c624d={'count':0x0,'rows':[]};Promise[_0x9e5b('0xd4')]()[_0x9e5b('0x19')](function(){if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd5')]){if(!_[_0x9e5b('0xd6')](_0xaa2b98,_0x3a1f29['query'][_0x9e5b('0xd5')][_0x9e5b('0xd7')]())){throw new Error(_0x9e5b('0xd8'));}_0xaa2b98=[_0x3a1f29['query'][_0x9e5b('0xd5')][_0x9e5b('0xd7')]()];}if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]){try{var _0x424ba9=JSON['parse'](_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]);if(!moment(_0x424ba9['from'])['isValid']()){throw new Error(_0x9e5b('0xda'));}if(!moment(_0x424ba9['to'])['isValid']()){throw new Error(_0x9e5b('0xdb'));}}catch(_0x52ae9f){throw new Error(_0x9e5b('0xdc'));}}if(!_0x3a1f29[_0x9e5b('0x2d')]['hasOwnProperty'](_0x9e5b('0x8a'))){_0x13be92[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0x13')]||0xa);_0x13be92[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}var _0x8f2125=_0xaa2b98[_0x9e5b('0x71')](function(_0x322193){if(_0x322193===_0x9e5b('0xd2')){var _0x4e58f1={'attributes':['id',_0x9e5b('0xdd'),_0x9e5b('0x33'),_0x9e5b('0xde'),_0x9e5b('0xdf'),_0x9e5b('0xe0'),_0x9e5b('0xe1'),_0x9e5b('0xe2'),'duration',_0x9e5b('0xe3'),_0x9e5b('0xe4'),'userDisposition',_0x9e5b('0xe5'),_0x9e5b('0xe6'),'UserId'],'where':{'ContactId':_0x3a1f29['params']['id']},'include':[{'model':db[_0x9e5b('0xc2')],'as':'User','attributes':['id','name',_0x9e5b('0xe7'),'alias']}],'order':[[_0x9e5b('0xe4'),'DESC']]};if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]){_0x4e58f1[_0x9e5b('0x5e')][_0x9e5b('0xe4')]={'$gte':_0x424ba9[_0x9e5b('0x38')],'$lte':_0x424ba9['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x4e58f1)[_0x9e5b('0x19')](function(_0x38cec1){_0x2c624d[_0x9e5b('0x15')]+=_0x38cec1[_0x9e5b('0x15')];return _[_0x9e5b('0x71')](_0x38cec1[_0x9e5b('0xa3')],function(_0x1fe088){var _0x53d84f=_0x1fe088[_0x9e5b('0x39')]({'plain':!![]});_0x53d84f[_0x9e5b('0xd5')]=_0x322193;if(_0x53d84f['User']){_0x53d84f['User']={'id':_0x53d84f['User']['id'],'name':_0x53d84f[_0x9e5b('0xc2')][_0x9e5b('0x1e')],'fullname':_0x53d84f['User'][_0x9e5b('0xe7')],'alias':_0x53d84f[_0x9e5b('0xc2')]['alias']};}return _0x53d84f;});});}else{var _0x33d38a=_['startCase'](_0x322193)+(_0x322193===_0x9e5b('0xcd')?_0x9e5b('0xe8'):'Account');var _0x2ab6a8={'attributes':['id',_0x9e5b('0xe9'),_0x9e5b('0xea'),_0x9e5b('0xe4'),'note',_0x9e5b('0xeb'),_0x9e5b('0xec'),_0x9e5b('0xed'),'UserId',_0x33d38a+'Id'],'where':{'ContactId':_0x3a1f29[_0x9e5b('0x27')]['id']},'include':[{'model':db[_0x33d38a],'as':'Account','attributes':['id',_0x9e5b('0x1e'),_0x9e5b('0xee')]},{'model':db[_0x9e5b('0xc2')],'as':'Owner','attributes':['id',_0x9e5b('0x1e'),'fullname']},{'model':db['Tag'],'as':_0x9e5b('0xef'),'attributes':['id',_0x9e5b('0x1e'),_0x9e5b('0x68')],'through':{'attributes':[]}}],'order':[[_0x9e5b('0xe4'),_0x9e5b('0xf0')]]};if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]){_0x2ab6a8[_0x9e5b('0x5e')][_0x9e5b('0xe4')]={'$gte':_0x424ba9[_0x9e5b('0x38')],'$lte':_0x424ba9['to']};}switch(_0x322193){case _0x9e5b('0xcd'):_0x2ab6a8[_0x9e5b('0x83')][_0x9e5b('0x5f')](_0x9e5b('0xf1'),_0x9e5b('0xf2'),_0x9e5b('0xf3'),_0x9e5b('0xf4'),_0x9e5b('0xf5'),_0x9e5b('0xf6'),_0x9e5b('0xf7'),_0x9e5b('0xf8'),_0x9e5b('0xf9'));break;case _0x9e5b('0xfa'):_0x2ab6a8[_0x9e5b('0x83')][_0x9e5b('0x5f')](_0x9e5b('0xfb'),'substatus');break;case _0x9e5b('0xcf'):_0x2ab6a8['attributes'][_0x9e5b('0x5f')](_0x9e5b('0xfc'),'threadId');break;}return db[_[_0x9e5b('0xfd')](_0x322193)+_0x9e5b('0xfe')][_0x9e5b('0xff')](_0x2ab6a8)[_0x9e5b('0x19')](function(_0x52d735){_0x2c624d['count']+=_0x52d735[_0x9e5b('0x15')];return _[_0x9e5b('0x71')](_0x52d735[_0x9e5b('0xa3')],function(_0x4f926f){var _0x12473a=_0x4f926f[_0x9e5b('0x39')]({'plain':!![]});_0x12473a[_0x9e5b('0xd5')]=_0x322193;if(_0x12473a[_0x9e5b('0x100')]){_0x12473a[_0x9e5b('0x100')]={'id':_0x12473a[_0x9e5b('0x100')]['id'],'name':_0x12473a[_0x9e5b('0x100')][_0x9e5b('0x1e')],'fullname':_0x12473a['Owner']['fullname']};}return _0x12473a;});});}});return Promise['all'](_0x8f2125);})[_0x9e5b('0x19')](function(_0x3f0ba5){return _(_0x3f0ba5)[_0x9e5b('0x101')]()[_0x9e5b('0x102')](_0x9e5b('0xe4'))['reverse']()[_0x9e5b('0x103')]();})[_0x9e5b('0x19')](function(_0x1a5a62){_0x2c624d['rows']=_0x13be92['limit']?_0x1a5a62[_0x9e5b('0x104')](_0x13be92[_0x9e5b('0x12')],_0x13be92[_0x9e5b('0x12')]+_0x13be92[_0x9e5b('0x13')]):_0x1a5a62;return _0x2c624d;})[_0x9e5b('0x19')](respondWithFilteredResult(_0x181ced,_0x13be92))['catch'](handleError(_0x181ced,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index c84443f..1a24a66 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 _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 +var _0x6e25=['hasOwnProperty','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x14ee58,_0x44c760){var _0x49c343=function(_0x2be457){while(--_0x2be457){_0x14ee58['push'](_0x14ee58['shift']());}};_0x49c343(++_0x44c760);}(_0x6e25,0x185));var _0x56e2=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0x6e25[_0x58ceb9];return _0x3d0ff5;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x56e2('0x0'))['db'][_0x56e2('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x56e2('0x2')](0x0);var events={'afterCreate':_0x56e2('0x3'),'afterUpdate':_0x56e2('0x4'),'afterDestroy':_0x56e2('0x5')};function emitEvent(_0x938d71){return function(_0x40995d,_0x463497,_0x5b4c06){CmContactEvents['emit'](_0x938d71+':'+_0x40995d['id'],_0x40995d);CmContactEvents[_0x56e2('0x6')](_0x938d71,_0x40995d);_0x5b4c06(null);};}for(var e in events){if(events[_0x56e2('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x56e2('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 7f7cffb..716425c 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 _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 +var _0x7c92=['[cmContact][afterCreate]','message','models','isEmpty','length','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','then','timezones','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','dialCheckDuplicateType','BlackLists','CmHopperBlack','define','cm_contacts','firstName','lastName','email','FULLTEXT','utf8mb4_unicode_ci','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch'];(function(_0x1b808e,_0x446e18){var _0x5a6726=function(_0x3eabfa){while(--_0x3eabfa){_0x1b808e['push'](_0x1b808e['shift']());}};_0x5a6726(++_0x446e18);}(_0x7c92,0xd0));var _0x27c9=function(_0xa0bc94,_0x2be459){_0xa0bc94=_0xa0bc94-0x0;var _0x13b2cd=_0x7c92[_0xa0bc94];return _0x13b2cd;};'use strict';var _=require(_0x27c9('0x0'));var util=require(_0x27c9('0x1'));var logger=require(_0x27c9('0x2'))(_0x27c9('0x3'));var moment=require(_0x27c9('0x4'));var shared=require('../../config/environment/shared');var attributes=require(_0x27c9('0x5'));function getTimezoneCallbackAt(_0x23ab5f,_0x33dce7,_0x22147e,_0x2cf9cb){var _0x54bb87=_0x2cf9cb?_0x27c9('0x6'):_0x27c9('0x7');var _0x3488de=_0x22147e[_0x27c9('0x8')]?_0x22147e[_0x27c9('0x8')]:moment()[_0x27c9('0x9')](_0x27c9('0xa'));if(_[_0x27c9('0xb')](_0x22147e[_0x27c9('0xc')])){return Promise[_0x27c9('0xd')](_0x3488de);}return _0x23ab5f[_0x54bb87]['findOne']({'where':{'id':_0x33dce7}})[_0x27c9('0xe')](function(_0x377d66){if(_[_0x27c9('0xb')](_0x377d66)||_['isNil'](_0x377d66[_0x27c9('0xc')])){return Promise[_0x27c9('0xd')](_0x3488de);}var _0x248094=shared[_0x27c9('0xf')];var _0x5e684b=_0x248094[_0x377d66[_0x27c9('0xc')]];var _0x9b1657=_0x248094[_0x22147e[_0x27c9('0xc')]];if(_[_0x27c9('0xb')](_0x5e684b)&&_[_0x27c9('0xb')](_0x9b1657)){return Promise[_0x27c9('0xd')](_0x3488de);}var _0x360b1e=_0x5e684b[_0x27c9('0x10')]-_0x9b1657[_0x27c9('0x10')];var _0x215ba6=_0x22147e['scheduledat']?_0x22147e[_0x27c9('0x8')]:moment();_0x3488de=moment(_0x215ba6)[_0x27c9('0x11')](_0x360b1e,_0x27c9('0x12'))[_0x27c9('0x9')](_0x27c9('0xa'));return Promise['resolve'](_0x3488de);});}function getNewHopperPayload(_0x2d7e94){return{'phone':_0x2d7e94[_0x27c9('0x13')],'ContactId':_0x2d7e94['id'],'ListId':_0x2d7e94[_0x27c9('0x14')],'scheduledat':_0x2d7e94[_0x27c9('0x8')]?_0x2d7e94[_0x27c9('0x8')]:moment()[_0x27c9('0x9')](_0x27c9('0xa')),'priority':_0x2d7e94[_0x27c9('0x15')]?_0x2d7e94[_0x27c9('0x15')]:0x2,'callback':_0x2d7e94[_0x27c9('0x16')]?!![]:![],'callbackuniqueid':_0x2d7e94[_0x27c9('0x16')]?_0x2d7e94['callbackUniqueid']:undefined,'callbackat':_0x2d7e94[_0x27c9('0x16')]?moment()[_0x27c9('0x9')](_0x27c9('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0x236ad9,_0x20a393,_0x5b7be9,_0x3f3fcc){var _0x40057a={'phone':_0x5b7be9['phone']};var _0x19981c={'calleridnum':_0x5b7be9[_0x27c9('0x13')]};if(_0x3f3fcc){Object[_0x27c9('0x17')](_0x40057a,{'CampaignId':_0x20a393['id']});Object[_0x27c9('0x17')](_0x19981c,{'CampaignId':_0x20a393['id']});}else{Object[_0x27c9('0x17')](_0x40057a,{'VoiceQueueId':_0x20a393['id']});Object['assign'](_0x19981c,{'VoiceQueueId':_0x20a393['id']});}return _0x236ad9[_0x27c9('0x18')][_0x27c9('0x19')]({'where':_0x40057a})['then'](function(_0x51f6da){if(_0x51f6da){throw new Error(_0x27c9('0x1a')+_0x5b7be9[_0x27c9('0x13')]+_0x27c9('0x1b')+_0x20a393['id']);}return _0x236ad9[_0x27c9('0x1c')]['findOne']({'where':_0x19981c});})['then'](function(_0x1c15ec){if(_0x1c15ec){throw new Error(_0x27c9('0x1d')+_0x5b7be9[_0x27c9('0x13')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x20a393['id']);}var _0x418a8a=getNewHopperPayload(_0x5b7be9);if(_0x3f3fcc){_0x418a8a[_0x27c9('0x1e')]=_0x20a393['id'];}else{_0x418a8a[_0x27c9('0x1f')]=_0x20a393['id'];}return _0x236ad9[_0x27c9('0x18')][_0x27c9('0x20')](_0x418a8a);});}function handleOnlyIfOpenCheckDuplicate(_0x3dcb4f,_0x5e0ffb,_0x5af2b2,_0x5c6edb){var _0x538e63={'phone':_0x5af2b2['phone']};if(_0x5c6edb){Object[_0x27c9('0x17')](_0x538e63,{'CampaignId':_0x5e0ffb['id']});}else{Object[_0x27c9('0x17')](_0x538e63,{'VoiceQueueId':_0x5e0ffb['id']});}return _0x3dcb4f[_0x27c9('0x18')][_0x27c9('0x19')]({'where':_0x538e63})[_0x27c9('0xe')](function(_0x2425e4){if(_0x2425e4){throw new Error(_0x27c9('0x21')+_0x5af2b2[_0x27c9('0x13')]+_0x27c9('0x1b')+_0x5e0ffb['id']);}var _0x4d8398=getNewHopperPayload(_0x5af2b2);if(_0x5c6edb){_0x4d8398[_0x27c9('0x1e')]=_0x5e0ffb['id'];}else{_0x4d8398['VoiceQueueId']=_0x5e0ffb['id'];}return _0x3dcb4f['CmHopper']['create'](_0x4d8398);});}function handleNeverCheckDuplicate(_0x1fc7ac,_0x4528c9,_0x3eb7e6){var _0x3d98f7=getNewHopperPayload(_0x3eb7e6);_0x3d98f7[_0x27c9('0x1f')]=_0x4528c9['id'];return _0x1fc7ac['CmHopper'][_0x27c9('0x20')](_0x3d98f7);}function handleCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266){return getTimezoneCallbackAt(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266)[_0x27c9('0xe')](function(_0x34c2ab){_0x4e768b['scheduledat']=_0x34c2ab;switch(_0x3b43ab['dialCheckDuplicateType']){case _0x27c9('0x22'):return handleAlwaysCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266);case _0x27c9('0x23'):return handleOnlyIfOpenCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266);default:return handleNeverCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b);}});}function createHopperForVoiceQueues(_0x227c82,_0x43acd4){return _0x227c82[_0x27c9('0x7')][_0x27c9('0x24')]({'where':{'type':_0x27c9('0x25')},'attributes':['id','dialCheckDuplicateType',_0x27c9('0xc')],'include':[{'model':_0x227c82[_0x27c9('0x26')],'as':_0x27c9('0x27'),'where':{'id':_0x43acd4[_0x27c9('0x14')]}}],'raw':!![]})[_0x27c9('0xe')](function(_0x54648b){var _0x1709e0=_0x54648b[_0x27c9('0x28')](function(_0x57e99c){return handleCheckDuplicate(_0x227c82,_0x57e99c,_0x43acd4,![]);});return Promise[_0x27c9('0x29')](_0x1709e0);});}function createHopperForCampaigns(_0x34503b,_0x241ff4){return _0x34503b[_0x27c9('0x6')][_0x27c9('0x24')]({'attributes':['id',_0x27c9('0x2a'),_0x27c9('0xc')],'include':[{'model':_0x34503b[_0x27c9('0x26')],'as':_0x27c9('0x27'),'where':{'id':_0x241ff4[_0x27c9('0x14')]}}],'raw':!![]})[_0x27c9('0xe')](function(_0x4d1796){var _0x365f02=_0x4d1796[_0x27c9('0x28')](function(_0x1b294c){return handleCheckDuplicate(_0x34503b,_0x1b294c,_0x241ff4,!![]);});return Promise[_0x27c9('0x29')](_0x365f02);});}function createHopperBlackForVoiceQueues(_0x247196,_0x142270){return _0x247196[_0x27c9('0x7')][_0x27c9('0x24')]({'where':{'type':_0x27c9('0x25')},'attributes':['id'],'include':[{'model':_0x247196[_0x27c9('0x26')],'as':_0x27c9('0x2b'),'where':{'id':_0x142270[_0x27c9('0x14')]}}],'raw':!![]})[_0x27c9('0xe')](function(_0x232629){var _0x446d27=_0x232629['map'](function(_0x5b9739){return _0x247196[_0x27c9('0x2c')]['create']({'phone':_0x142270['phone'],'ContactId':_0x142270['id'],'ListId':_0x142270[_0x27c9('0x14')],'VoiceQueueId':_0x5b9739['id']});});return Promise[_0x27c9('0x29')](_0x446d27);});}function createHopperBlackForCampaigns(_0x27416a,_0x360b5e){return _0x27416a[_0x27c9('0x6')][_0x27c9('0x24')]({'attributes':['id'],'include':[{'model':_0x27416a['CmList'],'as':_0x27c9('0x2b'),'where':{'id':_0x360b5e[_0x27c9('0x14')]}}],'raw':!![]})['then'](function(_0x317ddf){var _0x106489=_0x317ddf[_0x27c9('0x28')](function(_0x1442fe){return _0x27416a[_0x27c9('0x2c')][_0x27c9('0x20')]({'phone':_0x360b5e[_0x27c9('0x13')],'ContactId':_0x360b5e['id'],'ListId':_0x360b5e['ListId'],'CampaignId':_0x1442fe['id']});});return Promise['all'](_0x106489);});}module['exports']=function(_0x10e0b1){return _0x10e0b1[_0x27c9('0x2d')]('CmContact',attributes,{'tableName':_0x27c9('0x2e'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x27c9('0x13')]},{'name':'fti_cm_contacts','fields':[_0x27c9('0x2f'),_0x27c9('0x30'),_0x27c9('0x13'),'mobile','fax',_0x27c9('0x31')],'type':_0x27c9('0x32')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x27c9('0x33'),'hooks':{'afterCreate':function(_0x5b58b9,_0x3721bd,_0xaaaa2a){var _0xbe36df=_0x10e0b1['models'];var _0x3edc21=_0x5b58b9[_0x27c9('0x34')]({'plain':!![]});if(!_0x3edc21[_0x27c9('0x14')]){logger[_0x27c9('0x35')](_0x27c9('0x36')+_0x3edc21['id']);return _0xaaaa2a();}if(!_0x3edc21[_0x27c9('0x13')]){return _0xaaaa2a();}return createHopperForVoiceQueues(_0xbe36df,_0x3edc21)['then'](function(){return createHopperBlackForVoiceQueues(_0xbe36df,_0x3edc21);})[_0x27c9('0xe')](function(){return createHopperForCampaigns(_0xbe36df,_0x3edc21);})[_0x27c9('0xe')](function(){return createHopperBlackForCampaigns(_0xbe36df,_0x3edc21);})[_0x27c9('0xe')](function(){return _0xaaaa2a();})[_0x27c9('0x37')](function(_0x8ae876){logger[_0x27c9('0x35')](_0x27c9('0x38'),_0x8ae876[_0x27c9('0x39')]);_0xaaaa2a();});},'afterDestroy':function(_0x44ab8c,_0xe9ce5b,_0x47782f){var _0x76f47f=_0x10e0b1[_0x27c9('0x3a')];var _0x2ecf09=_0x44ab8c['get']({'plain':!![]});return _0x76f47f['CmHopper'][_0x27c9('0x24')]({'raw':!![],'where':{'ListId':_0x2ecf09[_0x27c9('0x14')],'ContactId':_0x2ecf09['id']}})['then'](function(_0x1f8f7b){if(!_[_0x27c9('0x3b')](_0x1f8f7b)){var _0x538bd0=[];for(var _0x5d490d=0x0;_0x5d490d<_0x1f8f7b[_0x27c9('0x3c')];_0x5d490d+=0x1){var _0x292cf7=_0x76f47f['CmHopper']['destroy']({'where':{'ListId':_0x1f8f7b[_0x5d490d]['ListId'],'ContactId':_0x1f8f7b[_0x5d490d][_0x27c9('0x3d')],'VoiceQueueId':_0x1f8f7b[_0x5d490d][_0x27c9('0x1f')],'CampaignId':_0x1f8f7b[_0x5d490d][_0x27c9('0x1e')]}});_0x538bd0[_0x27c9('0x3e')](_0x292cf7);}return Promise[_0x27c9('0x29')](_0x538bd0);}})[_0x27c9('0xe')](function(_0x11db9e){logger['info'](_0x27c9('0x3f'),util[_0x27c9('0x40')](_0x11db9e,{'showHidden':![],'depth':null}));_0x47782f();})[_0x27c9('0x37')](function(_0x16162c){logger[_0x27c9('0x35')](_0x27c9('0x41'),util[_0x27c9('0x40')](_0x16162c,{'showHidden':![],'depth':null}));_0x47782f(_0x16162c);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e705b6e..53e3c58 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x2f5002,_0x20e022){var _0x3d745b=function(_0x36422b){while(--_0x36422b){_0x2f5002['push'](_0x2f5002['shift']());}};_0x3d745b(++_0x20e022);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 e0cc46c..fa74a03 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 _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 +var _0x1fdc=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0x2ecf58,_0x4795ee){var _0x2f6f18=function(_0x5b60a1){while(--_0x5b60a1){_0x2ecf58['push'](_0x2ecf58['shift']());}};_0x2f6f18(++_0x4795ee);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x1fdc[_0x4450b1];return _0x399b0b;};'use strict';var Sequelize=require(_0xc1fd('0x0'));module[_0xc1fd('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xc1fd('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc1fd('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc1fd('0x2')],'defaultValue':_0xc1fd('0x4')},'OrderBy':{'type':Sequelize[_0xc1fd('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xc1fd('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 8d8a110..95a817b 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 _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 +var _0xff11=['name','send','map','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','CmContactHasItem','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','request-promise','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','get','CmContactHasItems','UserProfileResource','then','sendStatus','error','stack'];(function(_0x3a5fdd,_0x3c2047){var _0x4f0aeb=function(_0x4bf54d){while(--_0x4bf54d){_0x3a5fdd['push'](_0x3a5fdd['shift']());}};_0x4f0aeb(++_0x3c2047);}(_0xff11,0x10e));var _0x1ff1=function(_0x4f4b58,_0xc7bd71){_0x4f4b58=_0x4f4b58-0x0;var _0x26672b=_0xff11[_0x4f4b58];return _0x26672b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ff1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1ff1('0x1'));var moment=require('moment');var BPromise=require(_0x1ff1('0x2'));var Mustache=require(_0x1ff1('0x3'));var util=require('util');var path=require(_0x1ff1('0x4'));var sox=require(_0x1ff1('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ff1('0x6'));var _=require('lodash');var squel=require(_0x1ff1('0x7'));var crypto=require(_0x1ff1('0x8'));var jsforce=require(_0x1ff1('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ff1('0xa'));var Papa=require('papaparse');var Redis=require(_0x1ff1('0xb'));var authService=require(_0x1ff1('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ff1('0xd'));var logger=require(_0x1ff1('0xe'))(_0x1ff1('0xf'));var utils=require(_0x1ff1('0x10'));var config=require(_0x1ff1('0x11'));var licenseUtil=require(_0x1ff1('0x12'));var db=require(_0x1ff1('0x13'))['db'];function respondWithStatusCode(_0x2374cd,_0x2bffcb){_0x2bffcb=_0x2bffcb||0xcc;return function(_0x325f31){if(_0x325f31){return _0x2374cd['sendStatus'](_0x2bffcb);}return _0x2374cd[_0x1ff1('0x14')](_0x2bffcb)[_0x1ff1('0x15')]();};}function respondWithResult(_0x88151b,_0x351f6e){_0x351f6e=_0x351f6e||0xc8;return function(_0x21123d){if(_0x21123d){return _0x88151b[_0x1ff1('0x14')](_0x351f6e)[_0x1ff1('0x16')](_0x21123d);}};}function respondWithFilteredResult(_0x43d686,_0x1426de){return function(_0x568d40){if(_0x568d40){var _0x5754f5=typeof _0x1426de[_0x1ff1('0x17')]===_0x1ff1('0x18')&&typeof _0x1426de[_0x1ff1('0x19')]===_0x1ff1('0x18');var _0x3040a9=_0x568d40[_0x1ff1('0x1a')];var _0x5eed93=_0x5754f5?0x0:_0x1426de[_0x1ff1('0x17')];var _0x26d2c2=_0x5754f5?_0x568d40[_0x1ff1('0x1a')]:_0x1426de['offset']+_0x1426de[_0x1ff1('0x19')];var _0x1e33af;if(_0x26d2c2>=_0x3040a9){_0x26d2c2=_0x3040a9;_0x1e33af=0xc8;}else{_0x1e33af=0xce;}_0x43d686[_0x1ff1('0x14')](_0x1e33af);return _0x43d686[_0x1ff1('0x1b')](_0x1ff1('0x1c'),_0x5eed93+'-'+_0x26d2c2+'/'+_0x3040a9)[_0x1ff1('0x16')](_0x568d40);}return null;};}function patchUpdates(_0x4c55c9){return function(_0x4c9ea0){try{jsonpatch['apply'](_0x4c9ea0,_0x4c55c9,!![]);}catch(_0x26a773){return BPromise[_0x1ff1('0x1d')](_0x26a773);}return _0x4c9ea0['save']();};}function saveUpdates(_0x218c03,_0x3fd5bc){return function(_0x3753dc){if(_0x3753dc){return _0x3753dc['update'](_0x218c03)['then'](function(_0x2cbb89){return _0x2cbb89;});}return null;};}function removeEntity(_0x6a708,_0x211810){return function(_0x2c077f){if(_0x2c077f){return _0x2c077f[_0x1ff1('0x1e')]()['then'](function(){var _0x57f674=_0x2c077f[_0x1ff1('0x1f')]({'plain':!![]});var _0x320e27=_0x1ff1('0x20');return db[_0x1ff1('0x21')]['destroy']({'where':{'type':_0x320e27,'resourceId':_0x57f674['id']}})[_0x1ff1('0x22')](function(){return _0x2c077f;});})[_0x1ff1('0x22')](function(){_0x6a708[_0x1ff1('0x14')](0xcc)[_0x1ff1('0x15')]();});}};}function handleEntityNotFound(_0x48a20e,_0x5ba3f3){return function(_0x836363){if(!_0x836363){_0x48a20e[_0x1ff1('0x23')](0x194);}return _0x836363;};}function handleError(_0x59838e,_0x552e9a){_0x552e9a=_0x552e9a||0x1f4;return function(_0x58dddb){logger[_0x1ff1('0x24')](_0x58dddb[_0x1ff1('0x25')]);if(_0x58dddb['name']){delete _0x58dddb[_0x1ff1('0x26')];}_0x59838e[_0x1ff1('0x14')](_0x552e9a)[_0x1ff1('0x27')](_0x58dddb);};}exports['index']=function(_0x3b179e,_0x34efc2){var _0x51168e={},_0x3723cd={},_0x1928f9={'count':0x0,'rows':[]};var _0x3156b0=_[_0x1ff1('0x28')](db['CmContactHasItem']['rawAttributes'],function(_0x4ffd37){return{'name':_0x4ffd37['fieldName'],'type':_0x4ffd37[_0x1ff1('0x29')]['key']};});_0x3723cd['model']=_[_0x1ff1('0x28')](_0x3156b0,_0x1ff1('0x26'));_0x3723cd[_0x1ff1('0x2a')]=_['keys'](_0x3b179e[_0x1ff1('0x2a')]);_0x3723cd[_0x1ff1('0x2b')]=_[_0x1ff1('0x2c')](_0x3723cd[_0x1ff1('0x2d')],_0x3723cd[_0x1ff1('0x2a')]);_0x51168e[_0x1ff1('0x2e')]=_[_0x1ff1('0x2c')](_0x3723cd['model'],qs['fields'](_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x2f')]));_0x51168e[_0x1ff1('0x2e')]=_0x51168e[_0x1ff1('0x2e')][_0x1ff1('0x30')]?_0x51168e[_0x1ff1('0x2e')]:_0x3723cd['model'];if(!_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x31')](_0x1ff1('0x32'))){_0x51168e[_0x1ff1('0x19')]=qs[_0x1ff1('0x19')](_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x19')]);_0x51168e[_0x1ff1('0x17')]=qs['offset'](_0x3b179e[_0x1ff1('0x2a')]['offset']);}_0x51168e['order']=qs[_0x1ff1('0x33')](_0x3b179e['query'][_0x1ff1('0x33')]);_0x51168e[_0x1ff1('0x34')]=qs[_0x1ff1('0x2b')](_[_0x1ff1('0x35')](_0x3b179e[_0x1ff1('0x2a')],_0x3723cd[_0x1ff1('0x2b')]),_0x3156b0);if(_0x3b179e[_0x1ff1('0x2a')]['filter']){_0x51168e[_0x1ff1('0x34')]=_[_0x1ff1('0x36')](_0x51168e[_0x1ff1('0x34')],{'$or':_[_0x1ff1('0x28')](_0x3156b0,function(_0x3baa8b){if(_0x3baa8b['type']!==_0x1ff1('0x37')){var _0x37f587={};_0x37f587[_0x3baa8b['name']]={'$like':'%'+_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x38')]+'%'};return _0x37f587;}})});}_0x51168e=_[_0x1ff1('0x36')]({},_0x51168e,_0x3b179e[_0x1ff1('0x39')]);var _0x5216b6={'where':_0x51168e[_0x1ff1('0x34')]};return db[_0x1ff1('0x3a')][_0x1ff1('0x1a')](_0x5216b6)[_0x1ff1('0x22')](function(_0x5d9d1b){_0x1928f9[_0x1ff1('0x1a')]=_0x5d9d1b;if(_0x3b179e[_0x1ff1('0x2a')]['includeAll']){_0x51168e[_0x1ff1('0x3b')]=[{'all':!![]}];}return db[_0x1ff1('0x3a')][_0x1ff1('0x3c')](_0x51168e);})[_0x1ff1('0x22')](function(_0x3ec8c2){_0x1928f9[_0x1ff1('0x3d')]=_0x3ec8c2;return _0x1928f9;})[_0x1ff1('0x22')](respondWithFilteredResult(_0x34efc2,_0x51168e))[_0x1ff1('0x3e')](handleError(_0x34efc2,null));};exports[_0x1ff1('0x3f')]=function(_0xb1b9a8,_0x4af9a7){var _0x233f92={'raw':!![],'where':{'id':_0xb1b9a8[_0x1ff1('0x40')]['id']}},_0x19c358={};_0x19c358['model']=_[_0x1ff1('0x41')](db['CmContactHasItem']['rawAttributes']);_0x19c358['query']=_[_0x1ff1('0x41')](_0xb1b9a8[_0x1ff1('0x2a')]);_0x19c358[_0x1ff1('0x2b')]=_[_0x1ff1('0x2c')](_0x19c358['model'],_0x19c358[_0x1ff1('0x2a')]);_0x233f92[_0x1ff1('0x2e')]=_[_0x1ff1('0x2c')](_0x19c358[_0x1ff1('0x2d')],qs[_0x1ff1('0x2f')](_0xb1b9a8[_0x1ff1('0x2a')]['fields']));_0x233f92['attributes']=_0x233f92['attributes'][_0x1ff1('0x30')]?_0x233f92[_0x1ff1('0x2e')]:_0x19c358[_0x1ff1('0x2d')];if(_0xb1b9a8[_0x1ff1('0x2a')][_0x1ff1('0x42')]){_0x233f92[_0x1ff1('0x3b')]=[{'all':!![]}];}_0x233f92=_[_0x1ff1('0x36')]({},_0x233f92,_0xb1b9a8['options']);return db[_0x1ff1('0x3a')][_0x1ff1('0x43')](_0x233f92)[_0x1ff1('0x22')](handleEntityNotFound(_0x4af9a7,null))['then'](respondWithResult(_0x4af9a7,null))[_0x1ff1('0x3e')](handleError(_0x4af9a7,null));};exports[_0x1ff1('0x44')]=function(_0x570d34,_0x3eda8d){return db[_0x1ff1('0x3a')]['create'](_0x570d34[_0x1ff1('0x45')],{})['then'](function(_0x234b04){var _0x3394fc=_0x570d34[_0x1ff1('0x46')]['get']({'plain':!![]});if(!_0x3394fc)throw new Error(_0x1ff1('0x47'));if(_0x3394fc[_0x1ff1('0x48')]===_0x1ff1('0x46')){var _0x5775a6=_0x234b04['get']({'plain':!![]});var _0x3fc64c=_0x1ff1('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x3fc64c,'userProfileId':_0x3394fc[_0x1ff1('0x49')]},'raw':!![]})['then'](function(_0x5d0a14){if(_0x5d0a14&&_0x5d0a14[_0x1ff1('0x4a')]===0x0){return db[_0x1ff1('0x21')]['create']({'name':_0x5775a6[_0x1ff1('0x26')],'resourceId':_0x5775a6['id'],'type':_0x5d0a14['name'],'sectionId':_0x5d0a14['id']},{})['then'](function(){return _0x234b04;});}else{return _0x234b04;}})['catch'](function(_0x554cd8){logger[_0x1ff1('0x24')](_0x1ff1('0x4b'),_0x554cd8);throw _0x554cd8;});}return _0x234b04;})['then'](respondWithResult(_0x3eda8d,0xc9))[_0x1ff1('0x3e')](handleError(_0x3eda8d,null));};exports[_0x1ff1('0x4c')]=function(_0x3d3b9b,_0x5cf517){if(_0x3d3b9b[_0x1ff1('0x45')]['id']){delete _0x3d3b9b[_0x1ff1('0x45')]['id'];}return db[_0x1ff1('0x3a')][_0x1ff1('0x43')]({'where':{'id':_0x3d3b9b[_0x1ff1('0x40')]['id']}})[_0x1ff1('0x22')](handleEntityNotFound(_0x5cf517,null))['then'](saveUpdates(_0x3d3b9b[_0x1ff1('0x45')],null))[_0x1ff1('0x22')](respondWithResult(_0x5cf517,null))['catch'](handleError(_0x5cf517,null));};exports[_0x1ff1('0x1e')]=function(_0x5bd4a1,_0x535d84){return db[_0x1ff1('0x3a')]['find']({'where':{'id':_0x5bd4a1[_0x1ff1('0x40')]['id']}})[_0x1ff1('0x22')](handleEntityNotFound(_0x535d84,null))[_0x1ff1('0x22')](removeEntity(_0x535d84,null))[_0x1ff1('0x3e')](handleError(_0x535d84,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6b72f3d..f1a7395 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 _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 +var _0xc45d=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x6e5e90,_0x181771){var _0x2cff97=function(_0xa09816){while(--_0xa09816){_0x6e5e90['push'](_0x6e5e90['shift']());}};_0x2cff97(++_0x181771);}(_0xc45d,0x190));var _0xdc45=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0xc45d[_0x1f9f5f];return _0x51d649;};'use strict';var _=require(_0xdc45('0x0'));var util=require(_0xdc45('0x1'));var logger=require(_0xdc45('0x2'))(_0xdc45('0x3'));var moment=require(_0xdc45('0x4'));var BPromise=require(_0xdc45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc45('0x6'));var rimraf=require('rimraf');var config=require(_0xdc45('0x7'));var attributes=require(_0xdc45('0x8'));module[_0xdc45('0x9')]=function(_0x10bf43,_0x465920){return _0x10bf43[_0xdc45('0xa')](_0xdc45('0xb'),attributes,{'tableName':'cm_contact_has_items','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 2f32c96..ce38708 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 _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 +var _0xf994=['http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x2bfa1b,_0x1985d2){var _0x1217a7=function(_0x31de68){while(--_0x31de68){_0x2bfa1b['push'](_0x2bfa1b['shift']());}};_0x1217a7(++_0x1985d2);}(_0xf994,0x66));var _0x4f99=function(_0x2d1343,_0x84096){_0x2d1343=_0x2d1343-0x0;var _0x30d5d8=_0xf994[_0x2d1343];return _0x30d5d8;};'use strict';var _=require(_0x4f99('0x0'));var util=require('util');var moment=require(_0x4f99('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f99('0x2'));var fs=require('fs');var Redis=require(_0x4f99('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f99('0x4'));var logger=require(_0x4f99('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f99('0x6'));var client=jayson[_0x4f99('0x7')][_0x4f99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29e3e7,_0x3704e9,_0x2c6257){return new BPromise(function(_0x3d0769,_0x55685e){return client[_0x4f99('0x9')](_0x29e3e7,_0x2c6257)[_0x4f99('0xa')](function(_0x31fd37){logger[_0x4f99('0xb')](_0x4f99('0xc'),_0x3704e9,_0x4f99('0xd'));logger[_0x4f99('0xe')](_0x4f99('0xf'),_0x3704e9,_0x4f99('0xd'),JSON[_0x4f99('0x10')](_0x31fd37));if(_0x31fd37[_0x4f99('0x11')]){if(_0x31fd37['error'][_0x4f99('0x12')]===0x1f4){logger['error'](_0x4f99('0xc'),_0x3704e9,_0x31fd37[_0x4f99('0x11')][_0x4f99('0x13')]);return _0x55685e(_0x31fd37[_0x4f99('0x11')]['message']);}logger[_0x4f99('0x11')](_0x4f99('0xc'),_0x3704e9,_0x31fd37['error']['message']);return _0x3d0769(_0x31fd37[_0x4f99('0x11')][_0x4f99('0x13')]);}else{logger[_0x4f99('0xb')](_0x4f99('0xc'),_0x3704e9,_0x4f99('0xd'));_0x3d0769(_0x31fd37[_0x4f99('0x14')][_0x4f99('0x13')]);}})[_0x4f99('0x15')](function(_0x2f1106){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3704e9,_0x2f1106);_0x55685e(_0x2f1106);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 52405df..cd53a50 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 _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 +var _0x2234=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports'];(function(_0x38b73e,_0x5b93f4){var _0x4bbfbd=function(_0x1b1e86){while(--_0x1b1e86){_0x38b73e['push'](_0x38b73e['shift']());}};_0x4bbfbd(++_0x5b93f4);}(_0x2234,0x18c));var _0x4223=function(_0xc9b988,_0x429150){_0xc9b988=_0xc9b988-0x0;var _0x5f14fe=_0x2234[_0xc9b988];return _0x5f14fe;};'use strict';var multer=require('multer');var util=require(_0x4223('0x0'));var path=require(_0x4223('0x1'));var timeout=require(_0x4223('0x2'));var express=require('express');var router=express[_0x4223('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4223('0x4'));var interaction=require(_0x4223('0x5'));var config=require(_0x4223('0x6'));var controller=require(_0x4223('0x7'));router[_0x4223('0x8')]('/',auth[_0x4223('0x9')](),controller[_0x4223('0xa')]);router[_0x4223('0x8')](_0x4223('0xb'),auth[_0x4223('0x9')](),controller[_0x4223('0xc')]);router[_0x4223('0xd')]('/',auth[_0x4223('0x9')](),controller[_0x4223('0xe')]);router[_0x4223('0xf')](_0x4223('0xb'),auth[_0x4223('0x9')](),controller['update']);router[_0x4223('0x10')](_0x4223('0xb'),auth[_0x4223('0x9')](),controller['destroy']);module[_0x4223('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index bec8f69..433094b 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 _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 +var _0xfa25=['BOOLEAN','voice','sequelize','exports','getDataValue','alias','STRING','setDataValue','long','type','select','values','isArray'];(function(_0xf89934,_0x1e8c65){var _0x4292f4=function(_0x40e3a8){while(--_0x40e3a8){_0xf89934['push'](_0xf89934['shift']());}};_0x4292f4(++_0x1e8c65);}(_0xfa25,0x6a));var _0x5fa2=function(_0x39149,_0x548a65){_0x39149=_0x39149-0x0;var _0x5a0f05=_0xfa25[_0x39149];return _0x5a0f05;};'use strict';var Sequelize=require(_0x5fa2('0x0'));var _=require('lodash');module[_0x5fa2('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x127510){return this[_0x5fa2('0x2')](_0x5fa2('0x3'));}},'alias':{'type':Sequelize[_0x5fa2('0x4')],'allowNull':![],'set':function(_0x87c5c9){this[_0x5fa2('0x5')]('alias',_0x87c5c9?_0x87c5c9:this[_0x5fa2('0x2')]('name'));}},'type':{'type':Sequelize[_0x5fa2('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x5fa2('0x6')),'get':function(){if(this[_0x5fa2('0x2')](_0x5fa2('0x7'))===_0x5fa2('0x8')){return JSON['parse'](this[_0x5fa2('0x2')](_0x5fa2('0x9')));}else{return this[_0x5fa2('0x2')](_0x5fa2('0x9'));}},'set':function(_0x46ecf1){if(Array[_0x5fa2('0xa')](_0x46ecf1)){this[_0x5fa2('0x5')](_0x5fa2('0x9'),JSON['stringify'](_0x46ecf1));}else{this[_0x5fa2('0x5')](_0x5fa2('0x9'),_0x46ecf1);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5fa2('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x5fa2('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 785d2a2..f58326b 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 _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 +var _0x8237=['findAll','rows','catch','show','params','include','options','body','find','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge'];(function(_0x4fec9f,_0x33cc0e){var _0x481749=function(_0x5bd5ea){while(--_0x5bd5ea){_0x4fec9f['push'](_0x4fec9f['shift']());}};_0x481749(++_0x33cc0e);}(_0x8237,0x117));var _0x7823=function(_0x223e57,_0x2ac299){_0x223e57=_0x223e57-0x0;var _0x32bd53=_0x8237[_0x223e57];return _0x32bd53;};'use strict';var emlformat=require(_0x7823('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7823('0x1'));var rp=require(_0x7823('0x2'));var moment=require('moment');var BPromise=require(_0x7823('0x3'));var Mustache=require(_0x7823('0x4'));var util=require(_0x7823('0x5'));var path=require('path');var sox=require(_0x7823('0x6'));var csv=require('to-csv');var ejs=require(_0x7823('0x7'));var fs=require('fs');var fs_extra=require(_0x7823('0x8'));var _=require('lodash');var squel=require(_0x7823('0x9'));var crypto=require(_0x7823('0xa'));var jsforce=require(_0x7823('0xb'));var deskjs=require(_0x7823('0xc'));var toCsv=require(_0x7823('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7823('0xe'));var authService=require(_0x7823('0xf'));var qs=require(_0x7823('0x10'));var as=require(_0x7823('0x11'));var hardwareService=require(_0x7823('0x12'));var logger=require('../../config/logger')(_0x7823('0x13'));var utils=require('../../config/utils');var config=require(_0x7823('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177bf9,_0x5c732b){_0x5c732b=_0x5c732b||0xcc;return function(_0x41b052){if(_0x41b052){return _0x177bf9[_0x7823('0x15')](_0x5c732b);}return _0x177bf9[_0x7823('0x16')](_0x5c732b)['end']();};}function respondWithResult(_0x7b3d12,_0x2ca530){_0x2ca530=_0x2ca530||0xc8;return function(_0x25b4cb){if(_0x25b4cb){return _0x7b3d12[_0x7823('0x16')](_0x2ca530)[_0x7823('0x17')](_0x25b4cb);}};}function respondWithFilteredResult(_0x633e2a,_0x31005e){return function(_0x480b15){if(_0x480b15){var _0x1732e3=typeof _0x31005e[_0x7823('0x18')]===_0x7823('0x19')&&typeof _0x31005e['limit']===_0x7823('0x19');var _0x16792c=_0x480b15[_0x7823('0x1a')];var _0x5ae6c9=_0x1732e3?0x0:_0x31005e[_0x7823('0x18')];var _0x56caae=_0x1732e3?_0x480b15[_0x7823('0x1a')]:_0x31005e['offset']+_0x31005e[_0x7823('0x1b')];var _0xce9a92;if(_0x56caae>=_0x16792c){_0x56caae=_0x16792c;_0xce9a92=0xc8;}else{_0xce9a92=0xce;}_0x633e2a[_0x7823('0x16')](_0xce9a92);return _0x633e2a[_0x7823('0x1c')](_0x7823('0x1d'),_0x5ae6c9+'-'+_0x56caae+'/'+_0x16792c)[_0x7823('0x17')](_0x480b15);}return null;};}function patchUpdates(_0x37a9a2){return function(_0x476e70){try{jsonpatch[_0x7823('0x1e')](_0x476e70,_0x37a9a2,!![]);}catch(_0x472c05){return BPromise['reject'](_0x472c05);}return _0x476e70[_0x7823('0x1f')]();};}function saveUpdates(_0x4b82dd,_0x29bc41){return function(_0x5bd28e){if(_0x5bd28e){return _0x5bd28e[_0x7823('0x20')](_0x4b82dd)['then'](function(_0x1f4eca){return _0x1f4eca;});}return null;};}function removeEntity(_0x39a975,_0x1765f8){return function(_0x9b742d){if(_0x9b742d){return _0x9b742d[_0x7823('0x21')]()[_0x7823('0x22')](function(){_0x39a975[_0x7823('0x16')](0xcc)[_0x7823('0x23')]();});}};}function handleEntityNotFound(_0x5b3ec0,_0x330294){return function(_0x462cb5){if(!_0x462cb5){_0x5b3ec0[_0x7823('0x15')](0x194);}return _0x462cb5;};}function handleError(_0x11be3b,_0x2d6bea){_0x2d6bea=_0x2d6bea||0x1f4;return function(_0x32ffac){logger[_0x7823('0x24')](_0x32ffac[_0x7823('0x25')]);if(_0x32ffac['name']){delete _0x32ffac[_0x7823('0x26')];}_0x11be3b[_0x7823('0x16')](_0x2d6bea)[_0x7823('0x27')](_0x32ffac);};}exports[_0x7823('0x28')]=function(_0x361e23,_0x5298e0){var _0x2a4943={},_0xa63b16={},_0x355e89={'count':0x0,'rows':[]};var _0x70eed1=_[_0x7823('0x29')](db[_0x7823('0x2a')][_0x7823('0x2b')],function(_0x9d0620){return{'name':_0x9d0620[_0x7823('0x2c')],'type':_0x9d0620[_0x7823('0x2d')]['key']};});_0xa63b16[_0x7823('0x2e')]=_[_0x7823('0x2f')](_[_0x7823('0x29')](_0x70eed1,_0x7823('0x26')),[_0x7823('0x26')]);_0xa63b16[_0x7823('0x30')]=_[_0x7823('0x31')](_0x361e23[_0x7823('0x30')]);_0xa63b16[_0x7823('0x32')]=_[_0x7823('0x33')](_0xa63b16['model'],_0xa63b16['query']);_0x2a4943[_0x7823('0x34')]=_[_0x7823('0x33')](_0xa63b16['model'],qs[_0x7823('0x35')](_0x361e23[_0x7823('0x30')][_0x7823('0x35')]));_0x2a4943['attributes']=_0x2a4943[_0x7823('0x34')][_0x7823('0x36')]?_0x2a4943[_0x7823('0x34')]:_0xa63b16[_0x7823('0x2e')];if(!_0x361e23['query'][_0x7823('0x37')]('nolimit')){_0x2a4943[_0x7823('0x1b')]=qs[_0x7823('0x1b')](_0x361e23[_0x7823('0x30')][_0x7823('0x1b')]);_0x2a4943[_0x7823('0x18')]=qs[_0x7823('0x18')](_0x361e23[_0x7823('0x30')][_0x7823('0x18')]);}_0x2a4943['order']=qs[_0x7823('0x38')](_0x361e23[_0x7823('0x30')]['sort']);_0x2a4943[_0x7823('0x39')]=qs[_0x7823('0x32')](_[_0x7823('0x3a')](_0x361e23[_0x7823('0x30')],_0xa63b16[_0x7823('0x32')]),_0x70eed1);if(_0x361e23[_0x7823('0x30')]['filter']){_0x2a4943['where']=_['merge'](_0x2a4943[_0x7823('0x39')],{'$or':_['map'](_0x70eed1,function(_0x3fd43b){if(_0x3fd43b[_0x7823('0x2d')]!==_0x7823('0x3b')){var _0x5a6e1b={};_0x5a6e1b[_0x3fd43b[_0x7823('0x26')]]={'$like':'%'+_0x361e23[_0x7823('0x30')]['filter']+'%'};return _0x5a6e1b;}})});}_0x2a4943=_[_0x7823('0x3c')]({},_0x2a4943,_0x361e23['options']);var _0x1b27fe={'where':_0x2a4943['where']};return db[_0x7823('0x2a')][_0x7823('0x1a')](_0x1b27fe)[_0x7823('0x22')](function(_0x37f427){_0x355e89[_0x7823('0x1a')]=_0x37f427;if(_0x361e23[_0x7823('0x30')]['includeAll']){_0x2a4943['include']=[{'all':!![]}];}return db[_0x7823('0x2a')][_0x7823('0x3d')](_0x2a4943);})[_0x7823('0x22')](function(_0xf1ce07){_0x355e89[_0x7823('0x3e')]=_0xf1ce07;return _0x355e89;})[_0x7823('0x22')](respondWithFilteredResult(_0x5298e0,_0x2a4943))[_0x7823('0x3f')](handleError(_0x5298e0,null));};exports[_0x7823('0x40')]=function(_0x23cf50,_0x26e132){var _0x42fa85={'raw':!![],'where':{'id':_0x23cf50[_0x7823('0x41')]['id']}},_0x3956bf={};_0x3956bf[_0x7823('0x2e')]=_['keys'](db[_0x7823('0x2a')][_0x7823('0x2b')]);_0x3956bf['query']=_['keys'](_0x23cf50[_0x7823('0x30')]);_0x3956bf['filters']=_[_0x7823('0x33')](_0x3956bf[_0x7823('0x2e')],_0x3956bf[_0x7823('0x30')]);_0x42fa85[_0x7823('0x34')]=_[_0x7823('0x33')](_0x3956bf['model'],qs[_0x7823('0x35')](_0x23cf50[_0x7823('0x30')][_0x7823('0x35')]));_0x42fa85[_0x7823('0x34')]=_0x42fa85[_0x7823('0x34')]['length']?_0x42fa85[_0x7823('0x34')]:_0x3956bf[_0x7823('0x2e')];if(_0x23cf50[_0x7823('0x30')]['includeAll']){_0x42fa85[_0x7823('0x42')]=[{'all':!![]}];}_0x42fa85=_[_0x7823('0x3c')]({},_0x42fa85,_0x23cf50[_0x7823('0x43')]);return db[_0x7823('0x2a')]['find'](_0x42fa85)[_0x7823('0x22')](handleEntityNotFound(_0x26e132,null))[_0x7823('0x22')](respondWithResult(_0x26e132,null))[_0x7823('0x3f')](handleError(_0x26e132,null));};exports[_0x7823('0x20')]=function(_0x5a15f2,_0x4c2d8b){if(_0x5a15f2[_0x7823('0x44')]['id']){delete _0x5a15f2['body']['id'];}return db[_0x7823('0x2a')]['find']({'where':{'id':_0x5a15f2['params']['id']}})[_0x7823('0x22')](handleEntityNotFound(_0x4c2d8b,null))[_0x7823('0x22')](saveUpdates(_0x5a15f2[_0x7823('0x44')],null))[_0x7823('0x22')](respondWithResult(_0x4c2d8b,null))[_0x7823('0x3f')](handleError(_0x4c2d8b,null));};exports['destroy']=function(_0x4791fc,_0x25f854){return db['CmCustomField'][_0x7823('0x45')]({'where':{'id':_0x4791fc[_0x7823('0x41')]['id']}})[_0x7823('0x22')](handleEntityNotFound(_0x25f854,null))[_0x7823('0x22')](removeEntity(_0x25f854,null))[_0x7823('0x3f')](handleError(_0x25f854,null));};exports[_0x7823('0x46')]=function(_0x3bbd40,_0x166e85){var _0x3a2dc5;return db[_0x7823('0x47')]['transaction'](function(_0x1adfdf){return db[_0x7823('0x2a')][_0x7823('0x46')](_0x3bbd40['body'],{'transaction':_0x1adfdf})[_0x7823('0x22')](function(_0x1ba15d){_0x3a2dc5=_0x1ba15d;var _0x59cfd0={'type':db[_0x7823('0x48')][_0x7823('0x49')],'transaction':_0x1adfdf};switch(_0x3bbd40[_0x7823('0x44')]['type']){case _0x7823('0x4a'):_0x59cfd0[_0x7823('0x2d')]=db[_0x7823('0x48')][_0x7823('0x49')];break;case _0x7823('0x4b'):_0x59cfd0[_0x7823('0x2d')]=db['Sequelize'][_0x7823('0x4c')];break;case _0x7823('0x4d'):_0x59cfd0[_0x7823('0x2d')]=db[_0x7823('0x48')][_0x7823('0x4e')];_0x59cfd0[_0x7823('0x4f')]=![];break;default:}return db[_0x7823('0x47')][_0x7823('0x50')][_0x7823('0x51')](_0x7823('0x52'),util[_0x7823('0x53')](_0x7823('0x54'),_0x3a2dc5['id']),_0x59cfd0);})[_0x7823('0x22')](function(){return _0x3a2dc5;});})[_0x7823('0x22')](respondWithResult(_0x166e85,0xc9))[_0x7823('0x3f')](handleError(_0x166e85,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 0430a9a..338d332 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 _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 +var _0x57db=['./cmCustomField.attributes','define','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x2598da,_0x323754){var _0x196ba0=function(_0x254836){while(--_0x254836){_0x2598da['push'](_0x2598da['shift']());}};_0x196ba0(++_0x323754);}(_0x57db,0x152));var _0xb57d=function(_0x5a4d52,_0x5e5882){_0x5a4d52=_0x5a4d52-0x0;var _0x27063d=_0x57db[_0x5a4d52];return _0x27063d;};'use strict';var _=require(_0xb57d('0x0'));var util=require(_0xb57d('0x1'));var logger=require(_0xb57d('0x2'))(_0xb57d('0x3'));var moment=require(_0xb57d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb57d('0x5'));var attributes=require(_0xb57d('0x6'));module['exports']=function(_0x19162a,_0x4e5996){return _0x19162a[_0xb57d('0x7')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','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 465c89b..fb09725 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 _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 +var _0x8cdf=['jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31a871,_0x455b03){var _0x18d7aa=function(_0x14e8f2){while(--_0x14e8f2){_0x31a871['push'](_0x31a871['shift']());}};_0x18d7aa(++_0x455b03);}(_0x8cdf,0x147));var _0xf8cd=function(_0x1737e5,_0x146b76){_0x1737e5=_0x1737e5-0x0;var _0x5d88e4=_0x8cdf[_0x1737e5];return _0x5d88e4;};'use strict';var _=require(_0xf8cd('0x0'));var util=require(_0xf8cd('0x1'));var moment=require(_0xf8cd('0x2'));var BPromise=require(_0xf8cd('0x3'));var rs=require(_0xf8cd('0x4'));var fs=require('fs');var Redis=require(_0xf8cd('0x5'));var db=require(_0xf8cd('0x6'))['db'];var utils=require(_0xf8cd('0x7'));var logger=require(_0xf8cd('0x8'))(_0xf8cd('0x9'));var config=require(_0xf8cd('0xa'));var jayson=require(_0xf8cd('0xb'));var client=jayson[_0xf8cd('0xc')][_0xf8cd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x8d4f12,_0xb7e575,_0x3c58b5){return new BPromise(function(_0x1f26e7,_0x4776b2){return client[_0xf8cd('0xe')](_0x8d4f12,_0x3c58b5)[_0xf8cd('0xf')](function(_0x4058cd){logger['info'](_0xf8cd('0x10'),_0xb7e575,_0xf8cd('0x11'));logger[_0xf8cd('0x12')](_0xf8cd('0x13'),_0xb7e575,_0xf8cd('0x11'),JSON['stringify'](_0x4058cd));if(_0x4058cd['error']){if(_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x15')]===0x1f4){logger[_0xf8cd('0x14')]('CmCustomField,\x20%s,\x20%s',_0xb7e575,_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);return _0x4776b2(_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);}logger[_0xf8cd('0x14')](_0xf8cd('0x10'),_0xb7e575,_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);return _0x1f26e7(_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);}else{logger[_0xf8cd('0x17')](_0xf8cd('0x10'),_0xb7e575,_0xf8cd('0x11'));_0x1f26e7(_0x4058cd[_0xf8cd('0x18')][_0xf8cd('0x16')]);}})[_0xf8cd('0x19')](function(_0x22ec03){logger[_0xf8cd('0x14')](_0xf8cd('0x10'),_0xb7e575,_0x22ec03);_0x4776b2(_0x22ec03);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5f59157..98a09fa 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 _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 +var _0x7579=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','post','create','/:id','update','delete'];(function(_0x578db0,_0x5dca17){var _0x135d83=function(_0x17890d){while(--_0x17890d){_0x578db0['push'](_0x578db0['shift']());}};_0x135d83(++_0x5dca17);}(_0x7579,0x1e2));var _0x9757=function(_0x13b4c4,_0x1e4734){_0x13b4c4=_0x13b4c4-0x0;var _0x52cff0=_0x7579[_0x13b4c4];return _0x52cff0;};'use strict';var multer=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var path=require(_0x9757('0x2'));var timeout=require(_0x9757('0x3'));var express=require(_0x9757('0x4'));var router=express[_0x9757('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9757('0x6'));var interaction=require(_0x9757('0x7'));var config=require(_0x9757('0x8'));var controller=require(_0x9757('0x9'));router['get']('/',auth[_0x9757('0xa')](),controller[_0x9757('0xb')]);router[_0x9757('0xc')]('/:id',auth[_0x9757('0xa')](),controller['show']);router[_0x9757('0xd')]('/',auth[_0x9757('0xa')](),controller[_0x9757('0xe')]);router['put'](_0x9757('0xf'),auth[_0x9757('0xa')](),controller[_0x9757('0x10')]);router[_0x9757('0x11')](_0x9757('0xf'),auth[_0x9757('0xa')](),controller[_0x9757('0x12')]);module[_0x9757('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 75fbbd1..14a04b4 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 _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 +var _0xcb14=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','exports','STRING','BOOLEAN'];(function(_0x3d3458,_0x2bb392){var _0x902073=function(_0x188b92){while(--_0x188b92){_0x3d3458['push'](_0x3d3458['shift']());}};_0x902073(++_0x2bb392);}(_0xcb14,0x1e2));var _0x4cb1=function(_0x46753c,_0x1d8501){_0x46753c=_0x46753c-0x0;var _0x5edd01=_0xcb14[_0x46753c];return _0x5edd01;};'use strict';var moment=require(_0x4cb1('0x0'));var Sequelize=require('sequelize');module[_0x4cb1('0x1')]={'phone':{'type':Sequelize[_0x4cb1('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x4cb1('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4cb1('0x4')],'defaultValue':moment()[_0x4cb1('0x5')](_0x4cb1('0x6'))},'countbusyretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4cb1('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x4cb1('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4cb1('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4cb1('0x7')],'unique':_0x4cb1('0x8')},'ListId':{'type':Sequelize[_0x4cb1('0x7')],'unique':_0x4cb1('0x8')},'UserId':{'type':Sequelize[_0x4cb1('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4cb1('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4cb1('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4cb1('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b213089..21ed8a4 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 _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 +var _0xc03e=['options','includeAll','include','findAll','rows','catch','show','find','create','params','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','UPDATE','CmCompany','CmList','List','getPreviewRecall','findOne','scheduledat','Company','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','../../config/logger','../../config/environment','status','json','undefined','limit','offset','count','Content-Range','update','then','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL'];(function(_0x5e33f6,_0x36c590){var _0x1eefe7=function(_0xa14c10){while(--_0xa14c10){_0x5e33f6['push'](_0x5e33f6['shift']());}};_0x1eefe7(++_0x36c590);}(_0xc03e,0x15a));var _0xec03=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0xc03e[_0x328b40];return _0x556a56;};'use strict';var moment=require(_0xec03('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xec03('0x1'))('api');var shared=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0xfed10f,_0x269001){_0x269001=_0x269001||0xc8;return function(_0x3e3a78){if(_0x3e3a78){return _0xfed10f[_0xec03('0x3')](_0x269001)[_0xec03('0x4')](_0x3e3a78);}};}function respondWithFilteredResult(_0x1ce78a,_0x31db21){return function(_0xcaaf03){if(_0xcaaf03){var _0x278f90=typeof _0x31db21['offset']===_0xec03('0x5')&&typeof _0x31db21[_0xec03('0x6')]===_0xec03('0x5');var _0x3959b4=_0xcaaf03['count'];var _0x375e4a=_0x278f90?0x0:_0x31db21[_0xec03('0x7')];var _0x2d8711=_0x278f90?_0xcaaf03[_0xec03('0x8')]:_0x31db21[_0xec03('0x7')]+_0x31db21[_0xec03('0x6')];var _0x2c81b3;if(_0x2d8711>=_0x3959b4){_0x2d8711=_0x3959b4;_0x2c81b3=0xc8;}else{_0x2c81b3=0xce;}_0x1ce78a[_0xec03('0x3')](_0x2c81b3);return _0x1ce78a['set'](_0xec03('0x9'),_0x375e4a+'-'+_0x2d8711+'/'+_0x3959b4)[_0xec03('0x4')](_0xcaaf03);}return null;};}function saveUpdates(_0x398720,_0x2f65a1){return function(_0x9908ef){if(_0x9908ef){return _0x9908ef[_0xec03('0xa')](_0x398720)[_0xec03('0xb')](function(_0x9a818f){return _0x9a818f;});}return null;};}function handleEntityNotFound(_0x4ba43a,_0x555447){return function(_0x5ca0e2){if(!_0x5ca0e2){_0x4ba43a[_0xec03('0xc')](0x194);}return _0x5ca0e2;};}function handleError(_0x2d177e,_0x3501ab){_0x3501ab=_0x3501ab||0x1f4;return function(_0x515680){logger[_0xec03('0xd')](_0x515680[_0xec03('0xe')]);if(_0x515680[_0xec03('0xf')]){delete _0x515680[_0xec03('0xf')];}_0x2d177e['status'](_0x3501ab)[_0xec03('0x10')](_0x515680);};}exports['index']=function(_0x46a669,_0x5e8ae2){var _0x25292d={},_0x5b3e04={},_0x57dc2d={'count':0x0,'rows':[]};var _0x26f431=_[_0xec03('0x11')](db[_0xec03('0x12')][_0xec03('0x13')],function(_0x4b9df8){return{'name':_0x4b9df8[_0xec03('0x14')],'type':_0x4b9df8['type'][_0xec03('0x15')]};});_0x5b3e04[_0xec03('0x16')]=_[_0xec03('0x11')](_0x26f431,_0xec03('0xf'));_0x5b3e04[_0xec03('0x17')]=_[_0xec03('0x18')](_0x46a669[_0xec03('0x17')]);_0x5b3e04[_0xec03('0x19')]=_['intersection'](_0x5b3e04[_0xec03('0x16')],_0x5b3e04[_0xec03('0x17')]);_0x5b3e04[_0xec03('0x19')]=_[_0xec03('0x1a')](_0x5b3e04[_0xec03('0x19')],[_0xec03('0x1b'),'$or',_0xec03('0x1c'),_0xec03('0x1d'),'$lt',_0xec03('0x1e'),_0xec03('0x1f'),_0xec03('0x20'),_0xec03('0x21'),_0xec03('0x22'),'$notBetween',_0xec03('0x23'),_0xec03('0x24'),_0xec03('0x25'),_0xec03('0x26'),_0xec03('0x27'),'$notILike',_0xec03('0x25'),_0xec03('0x28'),'$contains','$contained',_0xec03('0x29')]);_0x25292d[_0xec03('0x2a')]=_[_0xec03('0x2b')](_0x5b3e04[_0xec03('0x16')],qs[_0xec03('0x2c')](_0x46a669[_0xec03('0x17')][_0xec03('0x2c')]));_0x25292d[_0xec03('0x2a')]=_0x25292d['attributes'][_0xec03('0x2d')]?_0x25292d[_0xec03('0x2a')]:_0x5b3e04[_0xec03('0x16')];if(!_0x46a669[_0xec03('0x17')][_0xec03('0x2e')](_0xec03('0x2f'))){_0x25292d[_0xec03('0x6')]=qs[_0xec03('0x6')](_0x46a669[_0xec03('0x17')]['limit']);_0x25292d['offset']=qs['offset'](_0x46a669[_0xec03('0x17')][_0xec03('0x7')]);}_0x25292d[_0xec03('0x30')]=qs[_0xec03('0x31')](_0x46a669['query']['sort']);_0x25292d['where']=qs['filters'](_[_0xec03('0x32')](_0x46a669[_0xec03('0x17')],_0x5b3e04[_0xec03('0x19')]),_0x26f431);if(_0x46a669[_0xec03('0x17')][_0xec03('0x33')]){_0x25292d[_0xec03('0x34')]=_[_0xec03('0x35')](_0x25292d[_0xec03('0x34')],{'$or':_[_0xec03('0x11')](_0x26f431,function(_0x1a5c10){if(_0x1a5c10[_0xec03('0x36')]!==_0xec03('0x37')){var _0x5b9267={};_0x5b9267[_0x1a5c10[_0xec03('0xf')]]={'$like':'%'+_0x46a669[_0xec03('0x17')][_0xec03('0x33')]+'%'};return _0x5b9267;}})});}_0x25292d=_['merge']({},_0x25292d,_0x46a669[_0xec03('0x38')]);var _0x159208={'where':_0x25292d[_0xec03('0x34')]};return db[_0xec03('0x12')][_0xec03('0x8')](_0x159208)[_0xec03('0xb')](function(_0x124324){_0x57dc2d[_0xec03('0x8')]=_0x124324;if(_0x46a669[_0xec03('0x17')][_0xec03('0x39')]){_0x25292d[_0xec03('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0xec03('0x3b')](_0x25292d);})[_0xec03('0xb')](function(_0x37819a){_0x57dc2d[_0xec03('0x3c')]=_0x37819a;return _0x57dc2d;})[_0xec03('0xb')](respondWithFilteredResult(_0x5e8ae2,_0x25292d))[_0xec03('0x3d')](handleError(_0x5e8ae2,null));};exports[_0xec03('0x3e')]=function(_0xa95d46,_0x4f95c9){var _0x454e91={'raw':!![],'where':{'id':_0xa95d46['params']['id']}},_0x4eef2b={};_0x4eef2b[_0xec03('0x16')]=_['keys'](db['CmHopper'][_0xec03('0x13')]);_0x4eef2b[_0xec03('0x17')]=_['keys'](_0xa95d46[_0xec03('0x17')]);_0x4eef2b['filters']=_['intersection'](_0x4eef2b['model'],_0x4eef2b[_0xec03('0x17')]);_0x454e91[_0xec03('0x2a')]=_[_0xec03('0x2b')](_0x4eef2b[_0xec03('0x16')],qs['fields'](_0xa95d46[_0xec03('0x17')][_0xec03('0x2c')]));_0x454e91[_0xec03('0x2a')]=_0x454e91[_0xec03('0x2a')][_0xec03('0x2d')]?_0x454e91[_0xec03('0x2a')]:_0x4eef2b[_0xec03('0x16')];if(_0xa95d46[_0xec03('0x17')][_0xec03('0x39')]){_0x454e91['include']=[{'all':!![]}];}_0x454e91=_[_0xec03('0x35')]({},_0x454e91,_0xa95d46[_0xec03('0x38')]);return db[_0xec03('0x12')][_0xec03('0x3f')](_0x454e91)['then'](handleEntityNotFound(_0x4f95c9,null))[_0xec03('0xb')](respondWithResult(_0x4f95c9,null))[_0xec03('0x3d')](handleError(_0x4f95c9,null));};exports[_0xec03('0x40')]=function(_0xfdadb1,_0x25d241){return db[_0xec03('0x12')]['create'](_0xfdadb1['body'],{})[_0xec03('0xb')](respondWithResult(_0x25d241,0xc9))[_0xec03('0x3d')](handleError(_0x25d241,null));};exports[_0xec03('0xa')]=function(_0x19e390,_0x3ae1bd){if(_0x19e390['body']['id']){delete _0x19e390['body']['id'];}return db[_0xec03('0x12')]['find']({'where':{'id':_0x19e390[_0xec03('0x41')]['id']}})[_0xec03('0xb')](handleEntityNotFound(_0x3ae1bd,null))[_0xec03('0xb')](saveUpdates(_0x19e390[_0xec03('0x42')],null))['then'](respondWithResult(_0x3ae1bd,null))[_0xec03('0x3d')](handleError(_0x3ae1bd,null));};exports[_0xec03('0x43')]=function(_0x3c7e18,_0x30e9ae){return db['CmHopper'][_0xec03('0x43')]()['then'](respondWithResult(_0x30e9ae,null))[_0xec03('0x3d')](handleError(_0x30e9ae,null));};exports[_0xec03('0x44')]=function(_0xdb9a99,_0x1c6b87){var _0x2eba66;var _0x15fe1d=_0xdb9a99[_0xec03('0x41')]['id'];return db['CmHopper'][_0xec03('0x3f')]({'where':{'id':_0xdb9a99[_0xec03('0x41')]['id']}})[_0xec03('0xb')](handleEntityNotFound(_0x1c6b87,null))[_0xec03('0xb')](function(_0x53a51e){if(_0x53a51e){return _0x53a51e[_0xec03('0x44')]()['then'](function(_0xe0e874){return _0xe0e874;});}})[_0xec03('0xb')](function(_0x2c281d){_0x2eba66=_0x2c281d;if(_0x2c281d){if(_0x2c281d[_0xec03('0x45')]||_0x2c281d['CampaignId']){return db[_0x2c281d[_0xec03('0x45')]?_0xec03('0x46'):_0xec03('0x47')][_0xec03('0x3f')]({'where':{'id':_0x2c281d[_0xec03('0x45')]?_0x2c281d['VoiceQueueId']:_0x2c281d[_0xec03('0x48')]},'attributes':['id',_0xec03('0xf')],'raw':!![]});}}})[_0xec03('0xb')](function(_0x4c434a){var _0x52c176={};if(_0x4c434a){_[_0xec03('0x35')](_0x52c176,_[_0xec03('0x49')](_0x2eba66[_0xec03('0x4a')],[_0xec03('0x4b'),'updatedAt','id']));_0x52c176[_0xec03('0x4c')]=0x15;_0x52c176[_0xec03('0x4d')]=_0xec03('0x4e');_0x52c176[_0xec03('0x4f')]=_0x4c434a['name'];_0x52c176[_0xec03('0x50')]=_0xdb9a99[_0xec03('0x51')][_0xec03('0xf')];_0x52c176[_0xec03('0x52')]=_0xdb9a99[_0xec03('0x51')]['id'];_0x52c176[_0xec03('0x4e')]=!![];_0x52c176[_0xec03('0x53')]=moment()[_0xec03('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x52c176[_0xec03('0x55')]=_0x2eba66[_0xec03('0x56')];_0x52c176[_0xec03('0x57')]=_0x2eba66[_0xec03('0x45')]?'queue':_0xec03('0x58');return db[_0xec03('0x59')][_0xec03('0x3f')]({'where':{'id':_0x52c176[_0xec03('0x5a')]},'attributes':['firstName',_0xec03('0x5b')]})[_0xec03('0xb')](function(_0x13fae4){if(!_[_0xec03('0x5c')](_0x1c6b87)&&!_[_0xec03('0x5c')](_0x13fae4[_0xec03('0x5d')])){_0x52c176[_0xec03('0x5e')]=_0x13fae4[_0xec03('0x5d')];if(!_['isNil'](_0x13fae4[_0xec03('0x5b')])){_0x52c176['calleridname']+='\x20'+_0x13fae4[_0xec03('0x5b')];}}})['finally'](function(){return db[_0xec03('0x5f')][_0xec03('0x40')](_0x52c176);});}})[_0xec03('0xb')](function(_0x3e2498){return db[_0xec03('0x60')][_0xec03('0x44')]({'where':{'CmHopperId':_0x15fe1d}});})[_0xec03('0xb')](function(){return _0x1c6b87[_0xec03('0x3')](0xcc)['end']();})[_0xec03('0x3d')](handleError(_0x1c6b87,null));};exports[_0xec03('0x61')]=function(_0x4f1daf,_0x430e4b){var _0x39095c=[];return db['CmContact']['describe']()[_0xec03('0xb')](function(_0x370f97){_0x39095c=_[_0xec03('0x18')](_0x370f97);return _0x4f1daf[_0xec03('0x51')][_0xec03('0x62')]({'where':{'type':_0xec03('0x63'),'dialActive':!![],'dialMethod':_0xec03('0x64')},'attributes':['id',_0xec03('0x65'),_0xec03('0x66')],'raw':!![]});})[_0xec03('0xb')](function(_0x462ac8){if(_0x462ac8&&_0x462ac8[_0xec03('0x2d')]){return db[_0xec03('0x67')][_0xec03('0x68')](function(_0x24a4c0){var _0x555065={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xec03('0x54')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xec03('0x11')](_0x462ac8,'id')},'$or':[{'UserId':null},{'UserId':_0x4f1daf[_0xec03('0x51')]['id']}]};var _0x179416={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x462ac8)[_0xec03('0x33')]([_0xec03('0x66'),0x0])[_0xec03('0x11')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4f1daf[_0xec03('0x51')]['id']}]};var _0x400652={'$or':[_0x555065,_0x179416]};var _0x2dc181=[];if(_0x4f1daf[_0xec03('0x42')][_0xec03('0x69')]&&_0x4f1daf[_0xec03('0x42')][_0xec03('0x69')]===_0xec03('0x6a')){if(!_['isEmpty'](_0x4f1daf[_0xec03('0x42')][_0xec03('0x6b')])){_0x400652['id']={'$in':_0x4f1daf['body'][_0xec03('0x6b')]};}_0x2dc181=[[_0xec03('0x6c'),_0xec03('0x6d')],[_0xec03('0x6e'),_0x462ac8[0x0][_0xec03('0x65')]==='ASC'?_0xec03('0x6f'):_0xec03('0x6d')],db[_0xec03('0x67')][_0xec03('0x70')](_0xec03('0x71')),['id',_0xec03('0x6f')]];}else{if(!_[_0xec03('0x72')](_0x4f1daf['body'][_0xec03('0x6b')])){_0x400652['id']={'$notIn':_0x4f1daf[_0xec03('0x42')][_0xec03('0x6b')]};}_0x2dc181=[['priority',_0xec03('0x6f')],['scheduledAt',_0x462ac8[0x0]['dialOrderByScheduledAt']],db[_0xec03('0x67')][_0xec03('0x70')](_0xec03('0x73')),['id',_0xec03('0x6d')]];}return db[_0xec03('0x12')]['findOne']({'attributes':['id','scheduledat','phone',_0xec03('0x74')],'where':_0x400652,'order':_0x2dc181,'transaction':_0x24a4c0,'lock':_0x24a4c0[_0xec03('0x75')][_0xec03('0x76')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x39095c,'include':[{'model':db[_0xec03('0x77')],'as':'Company','attributes':['id',_0xec03('0xf')]}]},{'model':db[_0xec03('0x78')],'as':_0xec03('0x79'),'attributes':['id','name']},{'model':db[_0xec03('0x46')],'as':'Queue','attributes':['id',_0xec03('0xf'),'dialActive']}]})['then'](function(_0x5a83b5){if(_0x5a83b5){return _0x5a83b5[_0xec03('0xa')]({'UserId':_0x4f1daf[_0xec03('0x51')]['id']},{'transaction':_0x24a4c0});}});});}})[_0xec03('0xb')](handleEntityNotFound(_0x430e4b,null))[_0xec03('0xb')](respondWithResult(_0x430e4b,null))[_0xec03('0x3d')](handleError(_0x430e4b,null));};exports[_0xec03('0x7a')]=function(_0x9f642f,_0x58b8a2,_0x1b346d){var _0xaad563=[];var _0x4bf355=_0x9f642f[_0xec03('0x41')]['id'];var _0x5286bc=_0x9f642f[_0xec03('0x51')]['id'];return db[_0xec03('0x59')][_0xec03('0x43')]()['then'](function(_0x17b507){_0xaad563=_[_0xec03('0x18')](_0x17b507);return db['sequelize']['transaction'](function(_0x111493){const _0x225855={'id':_0x4bf355};return db[_0xec03('0x12')][_0xec03('0x7b')]({'attributes':['id',_0xec03('0x7c'),_0xec03('0x74')],'where':_0x225855,'transaction':_0x111493,'lock':_0x111493[_0xec03('0x75')][_0xec03('0x76')],'include':[{'model':db[_0xec03('0x59')],'as':'Contact','attributes':_0xaad563,'include':[{'model':db[_0xec03('0x77')],'as':_0xec03('0x7d'),'attributes':['id',_0xec03('0xf')]}]},{'model':db[_0xec03('0x78')],'as':_0xec03('0x79'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xec03('0xf'),'dialActive']}]})[_0xec03('0xb')](function(_0x1048c2){if(_0x1048c2){return _0x1048c2[_0xec03('0xa')]({'UserId':_0x5286bc},{'transaction':_0x111493});}});});})[_0xec03('0xb')](handleEntityNotFound(_0x58b8a2,null))['then'](respondWithResult(_0x58b8a2,null))[_0xec03('0x3d')](handleError(_0x58b8a2,null));};exports[_0xec03('0x7e')]=function(_0x539004,_0x2d3172){return _0x539004['user'][_0xec03('0x62')]({'where':{'type':_0xec03('0x63'),'dialActive':!![],'dialMethod':_0xec03('0x64')},'attributes':['id'],'raw':!![]})['then'](function(_0x4cab14){if(_0x4cab14&&_0x4cab14[_0xec03('0x2d')]){return db[_0xec03('0x12')][_0xec03('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xec03('0x54')](_0xec03('0x7f'))},'VoiceQueueId':{'$in':_[_0xec03('0x11')](_0x4cab14,'id')},'$or':[{'UserId':null},{'UserId':_0x539004['user']['id']}]}});}return 0x0;})[_0xec03('0xb')](function(_0x152b93){if(!_[_0xec03('0x5c')](_0x152b93)&&_[_0xec03('0x80')](_0x152b93)){return _0x2d3172[_0xec03('0x3')](0xc8)[_0xec03('0x4')]({'contacts':_0x152b93});}else{logger[_0xec03('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xec03('0x7e'),0x194,_0xec03('0x81'));_0x2d3172['sendStatus'](0x194);}})['catch'](handleError(_0x2d3172,null));};exports[_0xec03('0x82')]=function(_0x525b31,_0x2c6b0a){var _0x205d44=shared[_0xec03('0x83')];var _0x2684b6=[];_[_0xec03('0x11')](_0x205d44,function(_0x2ffdd5){_0x2684b6['push']({'id':_0x2ffdd5['name'],'name':_0x2ffdd5[_0xec03('0xf')],'utcOffset':_0x2ffdd5[_0xec03('0x84')]});});return _0x2c6b0a[_0xec03('0x3')](0xc8)[_0xec03('0x4')]({'tz':_0x2684b6});};exports[_0xec03('0x85')]=function(_0x165c1f,_0xdf204a){var _0x245cb1=shared[_0xec03('0x83')];var _0x2ff3f6={};if(!_[_0xec03('0x5c')](_0x245cb1[_0x165c1f[_0xec03('0x42')]['id']]))_0x2ff3f6=_0x245cb1[_0x165c1f[_0xec03('0x42')]['id']];return _0xdf204a[_0xec03('0x3')](0xc8)[_0xec03('0x4')](_0x2ff3f6);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 14be372..9c6b624 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 _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 +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x57b7f5,_0x6e56a){var _0x59e151=function(_0x4c9c54){while(--_0x4c9c54){_0x57b7f5['push'](_0x57b7f5['shift']());}};_0x59e151(++_0x6e56a);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c6c495b..489da65 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 _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 +var _0x31b9=['GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','List','CmHopperHandlePreviewRecallNotifications','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','error','message','ShowCmHopper','catch','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','describe'];(function(_0x141295,_0xb221c9){var _0x18753b=function(_0x68ad6e){while(--_0x68ad6e){_0x141295['push'](_0x141295['shift']());}};_0x18753b(++_0xb221c9);}(_0x31b9,0xb4));var _0x931b=function(_0x46d58d,_0x157397){_0x46d58d=_0x46d58d-0x0;var _0x3e1f10=_0x31b9[_0x46d58d];return _0x3e1f10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x931b('0x0'));var BPromise=require(_0x931b('0x1'));var db=require(_0x931b('0x2'))['db'];var logger=require(_0x931b('0x3'))(_0x931b('0x4'));exports[_0x931b('0x5')]=function(_0x4e9c87){var _0x402c2f=this;return new Promise(function(_0x29953a,_0x5e1c5d){return db[_0x931b('0x6')][_0x931b('0x7')]({'raw':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87['options'][_0x931b('0xa')]||null:null,'attributes':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')]['attributes']||null:null,'limit':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87['options'][_0x931b('0xb')]||null:null,'include':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')][_0x931b('0xc')]?_[_0x931b('0xd')](_0x4e9c87[_0x931b('0x8')][_0x931b('0xc')],function(_0x2318e5){return{'model':db[_0x2318e5[_0x931b('0xe')]],'as':_0x2318e5['as'],'attributes':_0x2318e5[_0x931b('0xf')],'include':_0x2318e5[_0x931b('0xc')]?_[_0x931b('0xd')](_0x2318e5[_0x931b('0xc')],function(_0x4b7f06){return{'model':db[_0x4b7f06['model']],'as':_0x4b7f06['as'],'attributes':_0x4b7f06['attributes'],'include':_0x4b7f06[_0x931b('0xc')]?_['map'](_0x4b7f06[_0x931b('0xc')],function(_0x45b0c7){return{'model':db[_0x45b0c7['model']],'as':_0x45b0c7['as'],'attributes':_0x45b0c7[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x19c35b){logger[_0x931b('0x11')](_0x931b('0x5'),_0x4e9c87);logger[_0x931b('0x12')]('GetCmHopper',_0x4e9c87,JSON[_0x931b('0x13')](_0x19c35b));_0x29953a(_0x19c35b);})['catch'](function(_0x4bdead){logger[_0x931b('0x14')]('GetCmHopper',_0x4bdead[_0x931b('0x15')],_0x4e9c87);_0x5e1c5d(_0x402c2f[_0x931b('0x14')](0x1f4,_0x4bdead[_0x931b('0x15')]));});});};exports[_0x931b('0x16')]=function(_0x448c20){var _0x4b0858=this;return new Promise(function(_0x5a4042,_0x58e33d){return db[_0x931b('0x6')]['find']({'raw':_0x448c20['options']?_0x448c20[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x448c20[_0x931b('0x8')]?_0x448c20[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x448c20[_0x931b('0x8')]?_0x448c20['options']['attributes']||null:null,'include':_0x448c20['options']?_0x448c20['options'][_0x931b('0xc')]?_[_0x931b('0xd')](_0x448c20[_0x931b('0x8')][_0x931b('0xc')],function(_0x35638e){return{'model':db[_0x35638e[_0x931b('0xe')]],'as':_0x35638e['as'],'attributes':_0x35638e[_0x931b('0xf')],'include':_0x35638e[_0x931b('0xc')]?_[_0x931b('0xd')](_0x35638e[_0x931b('0xc')],function(_0xb16da6){return{'model':db[_0xb16da6['model']],'as':_0xb16da6['as'],'attributes':_0xb16da6['attributes'],'include':_0xb16da6[_0x931b('0xc')]?_['map'](_0xb16da6[_0x931b('0xc')],function(_0x1b9d09){return{'model':db[_0x1b9d09[_0x931b('0xe')]],'as':_0x1b9d09['as'],'attributes':_0x1b9d09[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x5f44df){logger[_0x931b('0x11')](_0x931b('0x16'),_0x448c20);logger[_0x931b('0x12')]('ShowCmHopper',_0x448c20,JSON['stringify'](_0x5f44df));_0x5a4042(_0x5f44df);})[_0x931b('0x17')](function(_0x2ee978){logger['error'](_0x931b('0x16'),_0x2ee978[_0x931b('0x15')],_0x448c20);_0x58e33d(_0x4b0858[_0x931b('0x14')](0x1f4,_0x2ee978[_0x931b('0x15')]));});});};exports[_0x931b('0x18')]=function(_0x2176e8){var _0x4e1da9=this;return new Promise(function(_0x197219,_0xaafbf){return db[_0x931b('0x6')][_0x931b('0x19')](_0x2176e8[_0x931b('0x1a')],{'raw':_0x2176e8[_0x931b('0x8')]?_0x2176e8[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x370648){logger['info'](_0x931b('0x18'),_0x2176e8);logger[_0x931b('0x12')](_0x931b('0x18'),_0x2176e8,JSON[_0x931b('0x13')](_0x370648));_0x197219(_0x370648);})[_0x931b('0x17')](function(_0x1c1fbe){logger[_0x931b('0x14')](_0x931b('0x18'),_0x1c1fbe[_0x931b('0x15')],_0x2176e8);_0xaafbf(_0x4e1da9[_0x931b('0x14')](0x1f4,_0x1c1fbe[_0x931b('0x15')]));});});};exports['UpdateCmHopper']=function(_0x401e5c){var _0x35bff5=this;return new Promise(function(_0x33630f,_0x2bf3c3){return db['CmHopper'][_0x931b('0x1b')](_0x401e5c[_0x931b('0x1a')],{'raw':_0x401e5c[_0x931b('0x8')]?_0x401e5c[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x401e5c[_0x931b('0x8')]?_0x401e5c[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x401e5c['options']?_0x401e5c['options'][_0x931b('0xf')]||null:null,'limit':_0x401e5c['options']?_0x401e5c[_0x931b('0x8')]['limit']||null:null})[_0x931b('0x10')](function(_0x52bfbc){logger[_0x931b('0x11')](_0x931b('0x1c'),_0x401e5c);logger[_0x931b('0x11')](_0x931b('0x1d'),JSON[_0x931b('0x13')](_0x401e5c['options'][_0x931b('0xa')]),_0x401e5c['body'][_0x931b('0x1e')]);logger[_0x931b('0x12')](_0x931b('0x1c'),_0x401e5c,JSON[_0x931b('0x13')](_0x52bfbc));_0x33630f(_0x52bfbc);})['catch'](function(_0x2f8398){logger['error'](_0x931b('0x1c'),_0x2f8398[_0x931b('0x15')],_0x401e5c);_0x2bf3c3(_0x35bff5[_0x931b('0x14')](0x1f4,_0x2f8398['message']));});});};exports[_0x931b('0x1f')]=function(_0x1f9d21){var _0x261391=this;return new Promise(function(_0xf321b9,_0x558021){return db[_0x931b('0x6')][_0x931b('0x20')]({'where':_0x1f9d21['options']?_0x1f9d21[_0x931b('0x8')][_0x931b('0xa')]||null:null})[_0x931b('0x10')](function(_0x3713dc){logger[_0x931b('0x11')](_0x931b('0x1f'),_0x1f9d21);logger[_0x931b('0x12')](_0x931b('0x1f'),_0x1f9d21,JSON[_0x931b('0x13')](_0x3713dc));_0xf321b9(_0x3713dc);})[_0x931b('0x17')](function(_0x5a89e0){logger['error']('DestroyCmHopper',_0x5a89e0[_0x931b('0x15')],_0x1f9d21);_0x558021(_0x261391[_0x931b('0x14')](0x1f4,_0x5a89e0[_0x931b('0x15')]));});});};exports[_0x931b('0x21')]=function(_0xb37ea4){var _0x37e1a9=this;return new Promise(function(_0x2abd78,_0x299225){return db['CmContact']['describe']()[_0x931b('0x10')](function(_0x49c36e){return db['sequelize']['transaction'](function(_0x18182){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')]['where']||null:null,'attributes':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0xf')]||null:null,'limit':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0xb')]||null:null,'order':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0x22')]||null:null,'transaction':_0x18182,'lock':_0x18182[_0x931b('0x23')][_0x931b('0x24')],'include':[{'model':db['CmContact'],'as':_0x931b('0x25'),'attributes':_[_0x931b('0x26')](_0x49c36e)},{'model':db['User'],'as':_0x931b('0x27'),'attributes':['id','name',_0x931b('0x28')]}]})[_0x931b('0x10')](function(_0x4442c1){var _0x29beae=[];var _0x2f437a=[];for(var _0x333306=0x0;_0x333306<_0x4442c1['length'];_0x333306+=0x1){var _0xf82002=_0x4442c1[_0x333306][_0x931b('0x29')];if(_0xf82002===null){_0x29beae[_0x931b('0x2a')](_0x4442c1[_0x333306][_0x931b('0x1b')](_0xb37ea4[_0x931b('0x1a')],{'transaction':_0x18182}));}else if(!_0x2f437a[_0x931b('0x2b')](_0xf82002)){_0x2f437a[_0x931b('0x2a')](_0xf82002);_0x29beae['push'](_0x4442c1[_0x333306][_0x931b('0x1b')](_0xb37ea4['body'],{'transaction':_0x18182}));}}return BPromise[_0x931b('0x2c')](_0x29beae);});})[_0x931b('0x10')](function(_0x49a467){logger[_0x931b('0x11')](_0x931b('0x21'),_0xb37ea4);if(_0x49a467[_0x931b('0x2d')]>0x0){logger[_0x931b('0x11')](_0x931b('0x2e'),_0x49a467[0x0][_0x931b('0x2f')]['id'],_0x49a467[0x0]['dataValues'][_0x931b('0x30')],_0x49a467[0x0]['dataValues'][_0x931b('0x1e')]);}logger[_0x931b('0x12')]('GetContactDialer',_0xb37ea4,JSON['stringify'](_0x49a467));_0x2abd78(_0x49a467);})[_0x931b('0x17')](function(_0x25cf76){logger[_0x931b('0x14')](_0x931b('0x21'),_0x25cf76[_0x931b('0x15')],_0xb37ea4);_0x299225(_0x37e1a9['error'](0x1f4,_0x25cf76[_0x931b('0x15')]));});});});};exports[_0x931b('0x31')]=function(_0x2cabcd){var _0x3334b5=this;return new Promise(function(_0x5a7b59,_0x2f3038){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x19f85a){return db[_0x931b('0x34')][_0x931b('0x19')](_0x2cabcd[_0x931b('0x1a')],{'raw':_0x2cabcd[_0x931b('0x8')]?_0x2cabcd[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'transaction':_0x19f85a})[_0x931b('0x10')](function(){logger[_0x931b('0x11')](_0x931b('0x35'),JSON[_0x931b('0x13')](_0x2cabcd['options'][_0x931b('0xa')]),_0x2cabcd[_0x931b('0x8')]['where']['active']);return db[_0x931b('0x6')][_0x931b('0x20')]({'where':_0x2cabcd['options']?_0x2cabcd[_0x931b('0x8')][_0x931b('0xa')]||null:null,'transaction':_0x19f85a});});})['then'](function(_0x5bfd7d){logger['info'](_0x931b('0x31'),_0x2cabcd);logger[_0x931b('0x12')]('MoveContactManagedDialer',_0x2cabcd,JSON[_0x931b('0x13')](_0x5bfd7d));_0x5a7b59(_0x5bfd7d);})[_0x931b('0x17')](function(_0x1f5d5b){logger['error'](_0x931b('0x31'),_0x1f5d5b[_0x931b('0x15')],_0x2cabcd);_0x2f3038(_0x3334b5[_0x931b('0x14')](0x1f4,_0x1f5d5b['message']));});});};exports[_0x931b('0x36')]=function(_0x62cb69){var _0x2eca9d=this;return new Promise(function(_0x2f2c05,_0x1706a0){return db['CmHopper'][_0x931b('0x7')]({'raw':_0x62cb69[_0x931b('0x8')]?_0x62cb69['options']['raw']===undefined?!![]:![]:!![],'where':_0x62cb69[_0x931b('0x8')]?_0x62cb69[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0x931b('0x37'),db[_0x931b('0x32')]['fn']('IF',db[_0x931b('0x32')][_0x931b('0x38')](_0x931b('0x39')+util['format'](_0x931b('0x3a'),moment()[_0x931b('0x3b')](_0x931b('0x3c')))+_0x931b('0x3d')))),_0x931b('0x3e')]]})['then'](function(_0x4b428c){logger[_0x931b('0x11')](_0x931b('0x36'),_0x62cb69);logger['debug'](_0x931b('0x36'),_0x62cb69,JSON['stringify'](_0x4b428c));_0x2f2c05(_0x4b428c);})[_0x931b('0x17')](function(_0x180158){logger[_0x931b('0x14')]('CountReScheduled',_0x180158[_0x931b('0x15')],_0x62cb69);_0x1706a0(_0x2eca9d[_0x931b('0x14')](0x1f4,_0x180158[_0x931b('0x15')]));});});};exports[_0x931b('0x3f')]=function(_0x1240ed){var _0x3c7e1d=this;return new Promise(function(_0x1cc6ba,_0x5b1ccd){return db[_0x931b('0x40')][_0x931b('0x41')]()[_0x931b('0x10')](function(){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x461205){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')][_0x931b('0xf')]||null:null,'limit':0x1,'order':_0x1240ed['options']?_0x1240ed[_0x931b('0x8')][_0x931b('0x22')]||null:null,'group':db[_0x931b('0x6')][_0x931b('0x29')],'transaction':_0x461205,'lock':_0x461205[_0x931b('0x23')][_0x931b('0x24')],'include':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')]['include']?_[_0x931b('0xd')](_0x1240ed[_0x931b('0x8')]['include'],function(_0x4b8b34){return{'model':db[_0x4b8b34[_0x931b('0xe')]],'as':_0x4b8b34['as'],'attributes':_0x4b8b34['attributes'],'include':_0x4b8b34[_0x931b('0xc')]?_[_0x931b('0xd')](_0x4b8b34['include'],function(_0x4afdd6){return{'model':db[_0x4afdd6[_0x931b('0xe')]],'as':_0x4afdd6['as'],'attributes':_0x4afdd6['attributes'],'include':_0x4afdd6['include']?_[_0x931b('0xd')](_0x4afdd6[_0x931b('0xc')],function(_0x358bc0){return{'model':db[_0x358bc0[_0x931b('0xe')]],'as':_0x358bc0['as'],'attributes':_0x358bc0[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x287708){var _0x156ee9=[];for(var _0xdf54b0=0x0;_0xdf54b0<_0x287708[_0x931b('0x2d')];_0xdf54b0+=0x1){_0x156ee9[_0x931b('0x2a')](_0x287708[_0xdf54b0][_0x931b('0x1b')](_0x1240ed[_0x931b('0x1a')],{'transaction':_0x461205}));}return BPromise[_0x931b('0x2c')](_0x156ee9);});})[_0x931b('0x10')](function(_0x4942ec){logger[_0x931b('0x11')](_0x931b('0x3f'),_0x1240ed);logger[_0x931b('0x12')]('GetContactRecallMe',_0x1240ed,JSON[_0x931b('0x13')](_0x4942ec));_0x1cc6ba(_0x4942ec);})[_0x931b('0x17')](function(_0x2eceea){logger['error'](_0x931b('0x3f'),_0x2eceea[_0x931b('0x15')],_0x1240ed);_0x5b1ccd(_0x3c7e1d[_0x931b('0x14')](0x1f4,_0x2eceea['message']));});});});};exports[_0x931b('0x42')]=function(_0x126d2f){var _0x3f70f1=this;return new Promise(function(_0x166499,_0xe75079){db[_0x931b('0x40')][_0x931b('0x41')]()[_0x931b('0x10')](function(_0x1f7a05){return db['CmHopper']['findAll']({'raw':_0x126d2f['options']?_0x126d2f['options'][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x126d2f[_0x931b('0x8')]?_0x126d2f[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x126d2f['options']?_0x126d2f[_0x931b('0x8')]['attributes']||null:null,'limit':_0x126d2f[_0x931b('0x8')]?_0x126d2f[_0x931b('0x8')]['limit']||null:null,'include':_0x126d2f['options']?_0x126d2f['options'][_0x931b('0xc')]?_['map'](_0x126d2f[_0x931b('0x8')][_0x931b('0xc')],function(_0x1c972e){return{'model':db[_0x1c972e[_0x931b('0xe')]],'as':_0x1c972e['as'],'attributes':_0x1c972e['as']===_0x931b('0x25')?_['keys'](_0x1f7a05):_0x1c972e[_0x931b('0xf')],'include':_0x1c972e[_0x931b('0xc')]?_['map'](_0x1c972e['include'],function(_0x39928e){return{'model':db[_0x39928e['model']],'as':_0x39928e['as'],'attributes':_0x39928e[_0x931b('0xf')],'include':_0x39928e[_0x931b('0xc')]?_['map'](_0x39928e[_0x931b('0xc')],function(_0x1c7554){return{'model':db[_0x1c7554[_0x931b('0xe')]],'as':_0x1c7554['as'],'attributes':_0x1c7554['attributes']};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x59772d){logger[_0x931b('0x11')](_0x931b('0x5'),_0x126d2f);logger[_0x931b('0x12')](_0x931b('0x5'),_0x126d2f,JSON['stringify'](_0x59772d));_0x166499(_0x59772d);})[_0x931b('0x17')](function(_0xe447d0){logger[_0x931b('0x14')](_0x931b('0x5'),_0xe447d0[_0x931b('0x15')],_0x126d2f);_0xe75079(_0x3f70f1[_0x931b('0x14')](0x1f4,_0xe447d0[_0x931b('0x15')]));});});});};exports['GetContactByPhone']=function(_0x242546){var _0x628278=this;return new Promise(function(_0x1c37aa,_0x142e6d){return db[_0x931b('0x40')][_0x931b('0x43')]({'raw':!![],'where':{'phone':_0x242546[_0x931b('0x8')]['where'][_0x931b('0x44')]},'attributes':['id',_0x931b('0x45')],'order':[['id',_0x931b('0x46')]]})[_0x931b('0x10')](function(_0x5243ed){logger['info'](_0x931b('0x47'),_0x242546);logger['debug']('getContactByPhone',_0x242546,JSON[_0x931b('0x13')](_0x5243ed));_0x1c37aa(_0x5243ed);})[_0x931b('0x17')](function(_0x4bdcd8){logger[_0x931b('0x14')](_0x931b('0x47'),_0x4bdcd8[_0x931b('0x15')],_0x242546);_0x142e6d(_0x628278['error'](0x1f4,_0x4bdcd8[_0x931b('0x15')]));});});};exports['ResetActiveCalls']=function(_0x1aaf3f){var _0x306961=this;return new Promise(function(_0x547b75,_0x642d57){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0xc87405){var _0x20dee5=_0x1aaf3f[_0x931b('0x8')]&&_0x1aaf3f[_0x931b('0x8')][_0x931b('0xa')]?_0x1aaf3f[_0x931b('0x8')][_0x931b('0xa')]:{};return db['CmHopper'][_0x931b('0x1b')](_0x1aaf3f[_0x931b('0x1a')],{'where':_0x20dee5,'transaction':_0xc87405})[_0x931b('0x10')](function(_0x4e0315){logger[_0x931b('0x11')]('ResetActiveCalls',_0x1aaf3f);logger[_0x931b('0x12')](_0x931b('0x48'),_0x1aaf3f,JSON[_0x931b('0x13')](_0x4e0315));_0x547b75(_0x4e0315);})['catch'](function(_0x3988a3){logger[_0x931b('0x14')](_0x931b('0x48'),_0x3988a3[_0x931b('0x15')],_0x1aaf3f);_0x642d57(_0x306961[_0x931b('0x14')](0x1f4,_0x3988a3[_0x931b('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x3c593f){var _0x56fc33=this;var _0x1ed045=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x49')];var _0x36b375=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x4a')];var _0x57b3c4=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x4b')];return new Promise(function(_0x21d06,_0xbc1a15){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':{'voiceQueueId':{'$in':_0x1ed045},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x931b('0x32')][_0x931b('0x38')](_0x931b('0x4c')+_0x36b375+_0x931b('0x4d')),'$gt':db[_0x931b('0x32')]['literal'](_0x931b('0x4e'))}},'UserId':{'$in':_0x57b3c4}},'include':[{'model':db['CmContact'],'as':_0x931b('0x25')},{'model':db[_0x931b('0x4f')],'as':_0x931b('0x27'),'attributes':['id','name',_0x931b('0x28')]},{'model':db['CmList'],'as':_0x931b('0x50')}]})['then'](function(_0x4f3093){if(_0x4f3093[_0x931b('0x2d')]>0x0){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x454577){return db[_0x931b('0x6')]['update']({'recallmeNotifiedDate':db[_0x931b('0x32')][_0x931b('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0x931b('0xd')](_0x4f3093,'id')}},'transaction':_0x454577})[_0x931b('0x10')](function(){_0x21d06(_0x4f3093);})[_0x931b('0x17')](function(_0x3c4302){logger[_0x931b('0x14')](_0x931b('0x51'),_0x3c4302['message'],_0x3c593f);_0xbc1a15(_0x56fc33[_0x931b('0x14')](0x1f4,_0x3c4302[_0x931b('0x15')]));});})['catch'](function(_0x86535b){logger['error'](_0x931b('0x51'),_0x86535b[_0x931b('0x15')],_0x3c593f);_0xbc1a15(_0x56fc33['error'](0x1f4,_0x86535b[_0x931b('0x15')]));});}else{_0x21d06(_0x4f3093);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 1ecb9ba..241db68 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 _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 +var _0xa848=['delete','destroy','exports','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','create','post','getPreview','/timezone','/:id','update'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa848,0xdf));var _0x8a84=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa848[_0x3ab51d];return _0x29a04e;};'use strict';var express=require('express');var router=express[_0x8a84('0x0')]();var auth=require(_0x8a84('0x1'));var controller=require('./cmHopper.controller');router[_0x8a84('0x2')]('/',auth[_0x8a84('0x3')](),controller[_0x8a84('0x4')]);router[_0x8a84('0x2')](_0x8a84('0x5'),auth['isAuthenticated'](),controller[_0x8a84('0x6')]);router[_0x8a84('0x2')](_0x8a84('0x7'),auth[_0x8a84('0x3')](),controller['getOpenContacts']);router[_0x8a84('0x2')](_0x8a84('0x8'),auth[_0x8a84('0x3')](),controller[_0x8a84('0x9')]);router['get']('/:id',auth[_0x8a84('0x3')](),controller[_0x8a84('0xa')]);router[_0x8a84('0x2')](_0x8a84('0xb'),auth[_0x8a84('0x3')](),controller[_0x8a84('0xc')]);router['post']('/',auth[_0x8a84('0x3')](),controller[_0x8a84('0xd')]);router[_0x8a84('0xe')]('/preview',auth[_0x8a84('0x3')](),controller[_0x8a84('0xf')]);router['post'](_0x8a84('0x10'),auth[_0x8a84('0x3')](),controller['getTimezone']);router['put'](_0x8a84('0x11'),auth[_0x8a84('0x3')](),controller[_0x8a84('0x12')]);router[_0x8a84('0x13')](_0x8a84('0x11'),auth[_0x8a84('0x3')](),controller[_0x8a84('0x14')]);module[_0x8a84('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 4eac600..92eb9f8 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 _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 +var _0x49cd=['STRING','DATE','moment','exports','INTEGER'];(function(_0x270af2,_0x1ee972){var _0x5948f0=function(_0x69dd0e){while(--_0x69dd0e){_0x270af2['push'](_0x270af2['shift']());}};_0x5948f0(++_0x1ee972);}(_0x49cd,0x1ec));var _0xd49c=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x49cd[_0x5ebc04];return _0x17845c;};'use strict';var moment=require(_0xd49c('0x0'));var Sequelize=require('sequelize');module[_0xd49c('0x1')]={'CmHopperId':{'type':Sequelize[_0xd49c('0x2')]},'phone':{'type':Sequelize[_0xd49c('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xd49c('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd49c('0x2')],'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 619f8a1..6df0cc8 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 _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 +var _0x5d54=['include','findAll','params','keys','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','status','end','sendStatus','error','stack','name','index','CmHopperAdditionalPhone','rawAttributes','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d54,0x14e));var _0x45d5=function(_0xcd3753,_0x5f170f){_0xcd3753=_0xcd3753-0x0;var _0x4831f1=_0x5d54[_0xcd3753];return _0x4831f1;};'use strict';var emlformat=require(_0x45d5('0x0'));var rimraf=require(_0x45d5('0x1'));var zipdir=require(_0x45d5('0x2'));var jsonpatch=require(_0x45d5('0x3'));var rp=require(_0x45d5('0x4'));var moment=require(_0x45d5('0x5'));var BPromise=require(_0x45d5('0x6'));var Mustache=require(_0x45d5('0x7'));var util=require(_0x45d5('0x8'));var path=require(_0x45d5('0x9'));var sox=require(_0x45d5('0xa'));var csv=require(_0x45d5('0xb'));var ejs=require(_0x45d5('0xc'));var fs=require('fs');var fs_extra=require(_0x45d5('0xd'));var _=require(_0x45d5('0xe'));var squel=require('squel');var crypto=require(_0x45d5('0xf'));var jsforce=require(_0x45d5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x45d5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x45d5('0x11'));var qs=require(_0x45d5('0x12'));var as=require(_0x45d5('0x13'));var hardwareService=require(_0x45d5('0x14'));var logger=require('../../config/logger')(_0x45d5('0x15'));var utils=require(_0x45d5('0x16'));var config=require(_0x45d5('0x17'));var licenseUtil=require(_0x45d5('0x18'));var db=require(_0x45d5('0x19'))['db'];function respondWithStatusCode(_0x3f6e23,_0x339e27){_0x339e27=_0x339e27||0xcc;return function(_0x27cc4c){if(_0x27cc4c){return _0x3f6e23['sendStatus'](_0x339e27);}return _0x3f6e23['status'](_0x339e27)['end']();};}function respondWithResult(_0xf736a8,_0x329849){_0x329849=_0x329849||0xc8;return function(_0x9bd7c9){if(_0x9bd7c9){return _0xf736a8['status'](_0x329849)[_0x45d5('0x1a')](_0x9bd7c9);}};}function respondWithFilteredResult(_0x123e50,_0x4a0c40){return function(_0x3f15f4){if(_0x3f15f4){var _0x5378dc=typeof _0x4a0c40[_0x45d5('0x1b')]===_0x45d5('0x1c')&&typeof _0x4a0c40[_0x45d5('0x1d')]===_0x45d5('0x1c');var _0x52a60b=_0x3f15f4[_0x45d5('0x1e')];var _0x5db259=_0x5378dc?0x0:_0x4a0c40[_0x45d5('0x1b')];var _0x1204ff=_0x5378dc?_0x3f15f4[_0x45d5('0x1e')]:_0x4a0c40[_0x45d5('0x1b')]+_0x4a0c40[_0x45d5('0x1d')];var _0x5123ee;if(_0x1204ff>=_0x52a60b){_0x1204ff=_0x52a60b;_0x5123ee=0xc8;}else{_0x5123ee=0xce;}_0x123e50['status'](_0x5123ee);return _0x123e50[_0x45d5('0x1f')](_0x45d5('0x20'),_0x5db259+'-'+_0x1204ff+'/'+_0x52a60b)['json'](_0x3f15f4);}return null;};}function patchUpdates(_0x4b06ee){return function(_0x294b47){try{jsonpatch[_0x45d5('0x21')](_0x294b47,_0x4b06ee,!![]);}catch(_0xb5924d){return BPromise[_0x45d5('0x22')](_0xb5924d);}return _0x294b47[_0x45d5('0x23')]();};}function saveUpdates(_0x1c1e6d,_0xc51856){return function(_0x18e353){if(_0x18e353){return _0x18e353['update'](_0x1c1e6d)['then'](function(_0x1ac511){return _0x1ac511;});}return null;};}function removeEntity(_0x427818,_0x4721f0){return function(_0x365d72){if(_0x365d72){return _0x365d72[_0x45d5('0x24')]()[_0x45d5('0x25')](function(){var _0x58f278=_0x365d72[_0x45d5('0x26')]({'plain':!![]});var _0x2da742='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x45d5('0x24')]({'where':{'type':_0x2da742,'resourceId':_0x58f278['id']}})[_0x45d5('0x25')](function(){return _0x365d72;});})[_0x45d5('0x25')](function(){_0x427818[_0x45d5('0x27')](0xcc)[_0x45d5('0x28')]();});}};}function handleEntityNotFound(_0x2edf4e,_0x3b6aa6){return function(_0x4a5b13){if(!_0x4a5b13){_0x2edf4e[_0x45d5('0x29')](0x194);}return _0x4a5b13;};}function handleError(_0x76082a,_0x488369){_0x488369=_0x488369||0x1f4;return function(_0x321a7d){logger[_0x45d5('0x2a')](_0x321a7d[_0x45d5('0x2b')]);if(_0x321a7d['name']){delete _0x321a7d[_0x45d5('0x2c')];}_0x76082a[_0x45d5('0x27')](_0x488369)['send'](_0x321a7d);};}exports[_0x45d5('0x2d')]=function(_0x593f72,_0x329d60){var _0x4bc61e={},_0x421f83={},_0x342fd7={'count':0x0,'rows':[]};var _0x49f958=_['map'](db[_0x45d5('0x2e')][_0x45d5('0x2f')],function(_0x37a2ca){return{'name':_0x37a2ca['fieldName'],'type':_0x37a2ca[_0x45d5('0x30')][_0x45d5('0x31')]};});_0x421f83[_0x45d5('0x32')]=_[_0x45d5('0x33')](_0x49f958,_0x45d5('0x2c'));_0x421f83['query']=_['keys'](_0x593f72['query']);_0x421f83[_0x45d5('0x34')]=_[_0x45d5('0x35')](_0x421f83['model'],_0x421f83[_0x45d5('0x36')]);_0x4bc61e[_0x45d5('0x37')]=_[_0x45d5('0x35')](_0x421f83[_0x45d5('0x32')],qs[_0x45d5('0x38')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x38')]));_0x4bc61e[_0x45d5('0x37')]=_0x4bc61e[_0x45d5('0x37')][_0x45d5('0x39')]?_0x4bc61e[_0x45d5('0x37')]:_0x421f83[_0x45d5('0x32')];if(!_0x593f72[_0x45d5('0x36')][_0x45d5('0x3a')](_0x45d5('0x3b'))){_0x4bc61e[_0x45d5('0x1d')]=qs[_0x45d5('0x1d')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x1d')]);_0x4bc61e[_0x45d5('0x1b')]=qs[_0x45d5('0x1b')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x1b')]);}_0x4bc61e['order']=qs[_0x45d5('0x3c')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x3c')]);_0x4bc61e[_0x45d5('0x3d')]=qs[_0x45d5('0x34')](_[_0x45d5('0x3e')](_0x593f72[_0x45d5('0x36')],_0x421f83[_0x45d5('0x34')]),_0x49f958);if(_0x593f72[_0x45d5('0x36')][_0x45d5('0x3f')]){_0x4bc61e[_0x45d5('0x3d')]=_['merge'](_0x4bc61e[_0x45d5('0x3d')],{'$or':_['map'](_0x49f958,function(_0x27547d){if(_0x27547d[_0x45d5('0x30')]!=='VIRTUAL'){var _0x1375ec={};_0x1375ec[_0x27547d['name']]={'$like':'%'+_0x593f72['query'][_0x45d5('0x3f')]+'%'};return _0x1375ec;}})});}_0x4bc61e=_[_0x45d5('0x40')]({},_0x4bc61e,_0x593f72['options']);var _0x1dbe6f={'where':_0x4bc61e['where']};return db['CmHopperAdditionalPhone'][_0x45d5('0x1e')](_0x1dbe6f)[_0x45d5('0x25')](function(_0x521272){_0x342fd7[_0x45d5('0x1e')]=_0x521272;if(_0x593f72[_0x45d5('0x36')][_0x45d5('0x41')]){_0x4bc61e[_0x45d5('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x45d5('0x43')](_0x4bc61e);})[_0x45d5('0x25')](function(_0xedac3){_0x342fd7['rows']=_0xedac3;return _0x342fd7;})['then'](respondWithFilteredResult(_0x329d60,_0x4bc61e))['catch'](handleError(_0x329d60,null));};exports['show']=function(_0x1ef453,_0x573725){var _0x5d2787={'raw':!![],'where':{'id':_0x1ef453[_0x45d5('0x44')]['id']}},_0x16c5f1={};_0x16c5f1[_0x45d5('0x32')]=_[_0x45d5('0x45')](db[_0x45d5('0x2e')][_0x45d5('0x2f')]);_0x16c5f1[_0x45d5('0x36')]=_[_0x45d5('0x45')](_0x1ef453[_0x45d5('0x36')]);_0x16c5f1[_0x45d5('0x34')]=_['intersection'](_0x16c5f1[_0x45d5('0x32')],_0x16c5f1[_0x45d5('0x36')]);_0x5d2787['attributes']=_[_0x45d5('0x35')](_0x16c5f1['model'],qs[_0x45d5('0x38')](_0x1ef453[_0x45d5('0x36')]['fields']));_0x5d2787[_0x45d5('0x37')]=_0x5d2787[_0x45d5('0x37')][_0x45d5('0x39')]?_0x5d2787['attributes']:_0x16c5f1[_0x45d5('0x32')];if(_0x1ef453['query'][_0x45d5('0x41')]){_0x5d2787['include']=[{'all':!![]}];}_0x5d2787=_[_0x45d5('0x40')]({},_0x5d2787,_0x1ef453['options']);return db['CmHopperAdditionalPhone']['find'](_0x5d2787)[_0x45d5('0x25')](handleEntityNotFound(_0x573725,null))[_0x45d5('0x25')](respondWithResult(_0x573725,null))[_0x45d5('0x46')](handleError(_0x573725,null));};exports['create']=function(_0x5896ae,_0x348fd6){return db[_0x45d5('0x2e')][_0x45d5('0x47')](_0x5896ae['body'],{})['then'](function(_0x63fb66){var _0x4979fa=_0x5896ae['user'][_0x45d5('0x26')]({'plain':!![]});if(!_0x4979fa)throw new Error(_0x45d5('0x48'));if(_0x4979fa[_0x45d5('0x49')]===_0x45d5('0x4a')){var _0x542b3b=_0x63fb66[_0x45d5('0x26')]({'plain':!![]});var _0x563401='CmHopperAdditionalPhones';return db[_0x45d5('0x4b')]['find']({'where':{'name':_0x563401,'userProfileId':_0x4979fa[_0x45d5('0x4c')]},'raw':!![]})[_0x45d5('0x25')](function(_0x262006){if(_0x262006&&_0x262006['autoAssociation']===0x0){return db['UserProfileResource'][_0x45d5('0x47')]({'name':_0x542b3b[_0x45d5('0x2c')],'resourceId':_0x542b3b['id'],'type':_0x262006[_0x45d5('0x2c')],'sectionId':_0x262006['id']},{})[_0x45d5('0x25')](function(){return _0x63fb66;});}else{return _0x63fb66;}})[_0x45d5('0x46')](function(_0x5413ab){logger[_0x45d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5413ab);throw _0x5413ab;});}return _0x63fb66;})[_0x45d5('0x25')](respondWithResult(_0x348fd6,0xc9))[_0x45d5('0x46')](handleError(_0x348fd6,null));};exports[_0x45d5('0x4d')]=function(_0x539f00,_0x4fc288){if(_0x539f00['body']['id']){delete _0x539f00[_0x45d5('0x4e')]['id'];}return db[_0x45d5('0x2e')][_0x45d5('0x4f')]({'where':{'id':_0x539f00[_0x45d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fc288,null))[_0x45d5('0x25')](saveUpdates(_0x539f00['body'],null))[_0x45d5('0x25')](respondWithResult(_0x4fc288,null))[_0x45d5('0x46')](handleError(_0x4fc288,null));};exports[_0x45d5('0x24')]=function(_0x282390,_0x9efbe8){return db[_0x45d5('0x2e')][_0x45d5('0x4f')]({'where':{'id':_0x282390[_0x45d5('0x44')]['id']}})[_0x45d5('0x25')](handleEntityNotFound(_0x9efbe8,null))['then'](removeEntity(_0x9efbe8,null))[_0x45d5('0x46')](handleError(_0x9efbe8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 8b16d04..302ee09 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 _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 +var _0xca9d=['moment','../../config/environment','./cmHopperAdditionalPhone.attributes','define','lodash','util','../../config/logger','api'];(function(_0x14261d,_0x4a2ecc){var _0x37202c=function(_0x6f5de2){while(--_0x6f5de2){_0x14261d['push'](_0x14261d['shift']());}};_0x37202c(++_0x4a2ecc);}(_0xca9d,0x15c));var _0xdca9=function(_0x45d520,_0x271cca){_0x45d520=_0x45d520-0x0;var _0xb6f110=_0xca9d[_0x45d520];return _0xb6f110;};'use strict';var _=require(_0xdca9('0x0'));var util=require(_0xdca9('0x1'));var logger=require(_0xdca9('0x2'))(_0xdca9('0x3'));var moment=require(_0xdca9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdca9('0x5'));var attributes=require(_0xdca9('0x6'));module['exports']=function(_0x1fc077,_0x58ce22){return _0x1fc077[_0xdca9('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','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 737b89d..c3545af 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 _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 +var _0x0301=['entity','ASC','countcongestionretry','countnoanswerretry','countmachineretry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','phone','isNil','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x510bd8,_0x46c1e6){var _0xcd6e09=function(_0x4adabe){while(--_0x4adabe){_0x510bd8['push'](_0x510bd8['shift']());}};_0xcd6e09(++_0x46c1e6);}(_0x0301,0x157));var _0x1030=function(_0x372400,_0xdaeb10){_0x372400=_0x372400-0x0;var _0x4cd28c=_0x0301[_0x372400];return _0x4cd28c;};'use strict';var _=require('lodash');var util=require(_0x1030('0x0'));var moment=require(_0x1030('0x1'));var BPromise=require(_0x1030('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1030('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1030('0x4'))(_0x1030('0x5'));var config=require(_0x1030('0x6'));var jayson=require(_0x1030('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3f19,_0x36be0d,_0x4826e0){return new BPromise(function(_0xd99d7d,_0x220022){return client[_0x1030('0x8')](_0x1d3f19,_0x4826e0)['then'](function(_0x200c00){logger[_0x1030('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x36be0d,_0x1030('0xa'));logger[_0x1030('0xb')](_0x1030('0xc'),_0x36be0d,_0x1030('0xa'),JSON[_0x1030('0xd')](_0x200c00));if(_0x200c00[_0x1030('0xe')]){if(_0x200c00['error']['code']===0x1f4){logger[_0x1030('0xe')](_0x1030('0xf'),_0x36be0d,_0x200c00['error'][_0x1030('0x10')]);return _0x220022(_0x200c00['error'][_0x1030('0x10')]);}logger[_0x1030('0xe')](_0x1030('0xf'),_0x36be0d,_0x200c00['error'][_0x1030('0x10')]);return _0xd99d7d(_0x200c00[_0x1030('0xe')][_0x1030('0x10')]);}else{logger[_0x1030('0x9')](_0x1030('0xf'),_0x36be0d,_0x1030('0xa'));_0xd99d7d(_0x200c00[_0x1030('0x11')]['message']);}})[_0x1030('0x12')](function(_0x320f7b){logger[_0x1030('0xe')](_0x1030('0xf'),_0x36be0d,_0x320f7b);_0x220022(_0x320f7b);});});}exports[_0x1030('0x13')]=function(_0x105b48){var _0x4374b3=this;return new Promise(function(_0xda922c,_0x573ddb){return db[_0x1030('0x14')][_0x1030('0x15')]({'raw':!![],'where':{'ContactId':_0x105b48[_0x1030('0x16')][_0x1030('0x17')],'ListId':_0x105b48[_0x1030('0x16')][_0x1030('0x18')],'VoiceQueueId':_0x105b48[_0x1030('0x16')][_0x1030('0x19')]===undefined?null:_0x105b48[_0x1030('0x16')][_0x1030('0x19')],'CampaignId':_0x105b48[_0x1030('0x16')][_0x1030('0x1a')]===undefined?null:_0x105b48[_0x1030('0x16')]['CampaignId']}})[_0x1030('0x1b')](function(_0x204b54){if(_0x204b54!=null){return db[_0x1030('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x204b54['id'],'OrderBy':{'$gt':_0x204b54[_0x1030('0x1d')]}},'order':[[_0x1030('0x1d'),'ASC']]})[_0x1030('0x1b')](function(_0x220992){var _0x5642ab=0x0;if(_0x220992){if(_0x220992[_0x1030('0x1e')]+_0x220992['countcongestionretry']+_0x220992['countnoanswerretry']+_0x220992[_0x1030('0x1f')]+_0x220992[_0x1030('0x20')]+_0x220992[_0x1030('0x21')]+_0x220992['countmachineretry']+_0x220992[_0x1030('0x22')]<_0x105b48[_0x1030('0x23')]['dialGlobalMaxRetry'])_0x5642ab=0x1;_0xda922c({'additional':_0x5642ab});}else{return db[_0x1030('0x1c')][_0x1030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x204b54['id']},'order':[[_0x1030('0x1d'),_0x1030('0x24')]]})[_0x1030('0x1b')](function(_0x550f1c){var _0x52cd11=0x0;if(_0x550f1c){if(_0x550f1c[_0x1030('0x1e')]+_0x550f1c[_0x1030('0x25')]+_0x550f1c[_0x1030('0x26')]+_0x550f1c[_0x1030('0x1f')]+_0x550f1c[_0x1030('0x20')]+_0x550f1c[_0x1030('0x21')]+_0x550f1c[_0x1030('0x27')]+_0x550f1c[_0x1030('0x22')]<_0x105b48[_0x1030('0x23')]['dialGlobalMaxRetry'])_0x52cd11=0x1;_0xda922c({'additional':_0x52cd11});}else{_0xda922c({'additional':0x0});}})[_0x1030('0x12')](function(_0xa439c8){logger[_0x1030('0xe')](_0x1030('0x13'),_0xa439c8[_0x1030('0x10')]);_0x573ddb(_0x4374b3[_0x1030('0xe')](0x1f4,_0xa439c8[_0x1030('0x10')]));});}})[_0x1030('0x12')](function(_0x4e6856){logger['error']('VerifyAdditionalPhones',_0x4e6856['message']);_0x573ddb(_0x4374b3['error'](0x1f4,_0x4e6856[_0x1030('0x10')]));});}else _0xda922c({'additional':0x0});});});};exports[_0x1030('0x28')]=function(_0x503405){var _0x47fb8d=this;return new Promise(function(_0x257223,_0x28e49a){return db[_0x1030('0x14')][_0x1030('0x15')]({'raw':!![],'where':{'ContactId':_0x503405[_0x1030('0x16')]['ContactId'],'ListId':_0x503405[_0x1030('0x16')][_0x1030('0x18')],'VoiceQueueId':_0x503405[_0x1030('0x16')][_0x1030('0x19')]===undefined?null:_0x503405['body'][_0x1030('0x19')],'CampaignId':_0x503405[_0x1030('0x16')][_0x1030('0x1a')]===undefined?null:_0x503405[_0x1030('0x16')][_0x1030('0x1a')]}})[_0x1030('0x1b')](function(_0x2c596b){if(_0x2c596b!=null){return db['CmHopperAdditionalPhone'][_0x1030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2c596b['id'],'OrderBy':{'$gte':_0x2c596b[_0x1030('0x1d')]}},'order':[[_0x1030('0x1d'),_0x1030('0x24')]]})[_0x1030('0x1b')](function(_0x527813){if(_0x527813)return activateAdditionalPhone(_0x2c596b,_0x503405['body'],_0x527813,_0x503405[_0x1030('0x29')],_0x503405[_0x1030('0x2a')])['then'](function(_0x47c10c){_0x257223(_0x47c10c);});else{return db['CmHopperAdditionalPhone'][_0x1030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2c596b['id']},'order':[[_0x1030('0x1d'),_0x1030('0x24')]]})[_0x1030('0x1b')](function(_0x5520ff){if(_0x5520ff)return activateAdditionalPhone(_0x2c596b,_0x503405['body'],_0x5520ff,_0x503405[_0x1030('0x29')],_0x503405[_0x1030('0x2a')])[_0x1030('0x1b')](function(_0x113d92){_0x257223(_0x113d92);});else{_0x257223({'id':_0x2c596b['id'],'phone':''});}})[_0x1030('0x12')](function(_0x57084e){logger[_0x1030('0xe')]('VerifyAdditionalPhones',_0x57084e[_0x1030('0x10')]);_0x28e49a(_0x47fb8d[_0x1030('0xe')](0x1f4,_0x57084e[_0x1030('0x10')]));});}})[_0x1030('0x12')](function(_0x1be0ef){logger[_0x1030('0xe')](_0x1030('0x13'),_0x1be0ef['message']);_0x28e49a(_0x47fb8d['error'](0x1f4,_0x1be0ef[_0x1030('0x10')]));});}else _0x257223(0x1);});});};function activateAdditionalPhone(_0x4c3480,_0x2ec3ae,_0x2db967,_0x48ff89,_0x1e5372){return new Promise(function(_0x241c97,_0x2c077f){var _0x2c5285;if(_['isNil'](_0x2db967[_0x1030('0x2b')])){_0x2db967[_0x1030('0x2b')]=moment();}if(moment()>moment(_0x2db967[_0x1030('0x2b')])){_0x2c5285=moment()['add'](_0x1e5372||0x3,_0x1030('0x2c'));}else{if(_0x2db967['OrderBy']==0x0){_0x2c5285=moment(_0x2db967[_0x1030('0x2b')]);}else{_0x2c5285=moment()['add'](_0x1e5372||0x3,_0x1030('0x2c'));}}if(_['isNil'](_0x2c5285)){_0x2c5285=moment()[_0x1030('0x2d')](_0x1e5372||0x3,_0x1030('0x2c'));}var _0x180651={'phone':_0x4c3480[_0x1030('0x2e')],'active':0x0,'OrderBy':_[_0x1030('0x2f')](_0x4c3480['OrderBy'])?0x0:_0x4c3480[_0x1030('0x1d')],'scheduledat':moment()[_0x1030('0x2d')](_0x48ff89||0x1,_0x1030('0x2c')),'countbusyretry':_0x2ec3ae['countbusyretry'],'countcongestionretry':_0x2ec3ae[_0x1030('0x25')],'countnoanswerretry':_0x2ec3ae['countnoanswerretry'],'countnosuchnumberretry':_0x2ec3ae['countnosuchnumberretry'],'countdropretry':_0x2ec3ae[_0x1030('0x20')],'countabandonedretry':_0x2ec3ae[_0x1030('0x21')],'countmachineretry':_0x2ec3ae['countmachineretry'],'countagentrejectretry':_0x2ec3ae[_0x1030('0x22')],'createdAt':_0x2ec3ae[_0x1030('0x30')],'updatedAt':_0x2ec3ae[_0x1030('0x31')]};var _0x190fe2={'CmHopperId':_0x4c3480['id'],'phone':_0x2db967['phone'],'active':0x0,'OrderBy':_[_0x1030('0x2f')](_0x2db967[_0x1030('0x1d')])?0x0:_0x2db967[_0x1030('0x1d')],'scheduledat':_0x2c5285,'countbusyretry':_0x2db967[_0x1030('0x1e')],'countcongestionretry':_0x2db967['countcongestionretry'],'countnoanswerretry':_0x2db967[_0x1030('0x26')],'countnosuchnumberretry':_0x2db967['countnosuchnumberretry'],'countdropretry':_0x2db967[_0x1030('0x20')],'countabandonedretry':_0x2db967[_0x1030('0x21')],'countmachineretry':_0x2db967[_0x1030('0x27')],'countagentrejectretry':_0x2db967['countagentrejectretry'],'createdAt':_0x2db967[_0x1030('0x30')],'updatedAt':_0x2db967['updatedAt']};return db[_0x1030('0x32')]['transaction'](function(_0x57803a){return db[_0x1030('0x1c')][_0x1030('0x33')](_0x180651,{'where':{'id':_0x2db967['id']}},{'transaction':_0x57803a})[_0x1030('0x1b')](function(){return db[_0x1030('0x14')]['update'](_0x190fe2,{'where':{'id':_0x4c3480['id']}},{'transaction':_0x57803a});});})[_0x1030('0x1b')](function(_0x39951a){_0x241c97({'id':_0x4c3480['id'],'phone':_0x2db967[_0x1030('0x2e')]});})[_0x1030('0x12')](function(_0x29c808){logger[_0x1030('0xe')](_0x1030('0x34'),_0x29c808[_0x1030('0x10')]);_0x2c077f({'error':_0x29c808[_0x1030('0x10')]});});});}exports[_0x1030('0x35')]=function(_0x1a551d){var _0x19f825=this;return new Promise(function(_0x152a17,_0x4e946c){return db[_0x1030('0x14')][_0x1030('0x33')](_0x1a551d[_0x1030('0x16')]['field'],{'where':{'id':_0x1a551d[_0x1030('0x16')]['id']}})[_0x1030('0x1b')](function(_0x151b4){_0x152a17(_0x151b4);})[_0x1030('0x12')](function(_0x2d41db){logger[_0x1030('0xe')](_0x1030('0x35'),_0x2d41db['message']);_0x4e946c(_0x19f825[_0x1030('0xe')](0x1f4,_0x2d41db[_0x1030('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4243117..9998e6a 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 _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 +var _0xb264=['get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x13385c,_0x5ec81c){var _0x15b1ab=function(_0xc71c8){while(--_0xc71c8){_0x13385c['push'](_0x13385c['shift']());}};_0x15b1ab(++_0x5ec81c);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4b26('0x0'));var util=require(_0x4b26('0x1'));var path=require('path');var timeout=require(_0x4b26('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4b26('0x3'));var auth=require(_0x4b26('0x4'));var interaction=require(_0x4b26('0x5'));var config=require(_0x4b26('0x6'));var controller=require(_0x4b26('0x7'));router[_0x4b26('0x8')]('/',auth[_0x4b26('0x9')](),controller['index']);router[_0x4b26('0x8')](_0x4b26('0xa'),auth['isAuthenticated'](),controller[_0x4b26('0xb')]);router[_0x4b26('0xc')]('/',auth[_0x4b26('0x9')](),controller['create']);router[_0x4b26('0xd')](_0x4b26('0xa'),auth[_0x4b26('0x9')](),controller[_0x4b26('0xe')]);router[_0x4b26('0xf')]('/:id',auth[_0x4b26('0x9')](),controller['destroy']);module[_0x4b26('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 824ab8f..1a36914 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 _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 +var _0x21cd=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x210e7e,_0x230a6b){var _0x21d8bd=function(_0xba9d44){while(--_0xba9d44){_0x210e7e['push'](_0x210e7e['shift']());}};_0x21d8bd(++_0x230a6b);}(_0x21cd,0x6a));var _0xd21c=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x21cd[_0x2adbeb];return _0x5e18a6;};'use strict';var moment=require(_0xd21c('0x0'));var Sequelize=require(_0xd21c('0x1'));module[_0xd21c('0x2')]={'phone':{'type':Sequelize[_0xd21c('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd21c('0x4')],'unique':_0xd21c('0x5')},'ListId':{'type':Sequelize[_0xd21c('0x4')],'unique':_0xd21c('0x5')},'VoiceQueueId':{'type':Sequelize[_0xd21c('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1cf8c13..3f23f70 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 _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 +var _0xbcf8=['path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','body','params','destroy','describe','eml-format','zip-dir','request-promise','moment','mustache','util'];(function(_0x59aebd,_0x4495f3){var _0x38a859=function(_0x2c61e8){while(--_0x2c61e8){_0x59aebd['push'](_0x59aebd['shift']());}};_0x38a859(++_0x4495f3);}(_0xbcf8,0x15d));var _0x8bcf=function(_0x418104,_0x1830e4){_0x418104=_0x418104-0x0;var _0x56545b=_0xbcf8[_0x418104];return _0x56545b;};'use strict';var emlformat=require(_0x8bcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8bcf('0x2'));var moment=require(_0x8bcf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8bcf('0x4'));var util=require(_0x8bcf('0x5'));var path=require(_0x8bcf('0x6'));var sox=require(_0x8bcf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bcf('0x8'));var squel=require(_0x8bcf('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8bcf('0xa'));var toCsv=require(_0x8bcf('0xb'));var querystring=require(_0x8bcf('0xc'));var Papa=require(_0x8bcf('0xd'));var Redis=require(_0x8bcf('0xe'));var authService=require(_0x8bcf('0xf'));var qs=require(_0x8bcf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bcf('0x11'))(_0x8bcf('0x12'));var utils=require(_0x8bcf('0x13'));var config=require(_0x8bcf('0x14'));var licenseUtil=require(_0x8bcf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177168,_0x2acbaf){_0x2acbaf=_0x2acbaf||0xcc;return function(_0x33c1df){if(_0x33c1df){return _0x177168[_0x8bcf('0x16')](_0x2acbaf);}return _0x177168['status'](_0x2acbaf)['end']();};}function respondWithResult(_0x145529,_0x230de2){_0x230de2=_0x230de2||0xc8;return function(_0x1afa38){if(_0x1afa38){return _0x145529[_0x8bcf('0x17')](_0x230de2)[_0x8bcf('0x18')](_0x1afa38);}};}function respondWithFilteredResult(_0x593b2b,_0x8b557){return function(_0x2fe3d0){if(_0x2fe3d0){var _0x8e9712=typeof _0x8b557[_0x8bcf('0x19')]===_0x8bcf('0x1a')&&typeof _0x8b557[_0x8bcf('0x1b')]==='undefined';var _0x3d0261=_0x2fe3d0['count'];var _0x1ce45b=_0x8e9712?0x0:_0x8b557['offset'];var _0x1c5c1f=_0x8e9712?_0x2fe3d0[_0x8bcf('0x1c')]:_0x8b557[_0x8bcf('0x19')]+_0x8b557[_0x8bcf('0x1b')];var _0x5c50b0;if(_0x1c5c1f>=_0x3d0261){_0x1c5c1f=_0x3d0261;_0x5c50b0=0xc8;}else{_0x5c50b0=0xce;}_0x593b2b[_0x8bcf('0x17')](_0x5c50b0);return _0x593b2b['set'](_0x8bcf('0x1d'),_0x1ce45b+'-'+_0x1c5c1f+'/'+_0x3d0261)['json'](_0x2fe3d0);}return null;};}function patchUpdates(_0x4c90e){return function(_0x2ec010){try{jsonpatch[_0x8bcf('0x1e')](_0x2ec010,_0x4c90e,!![]);}catch(_0x31b882){return BPromise[_0x8bcf('0x1f')](_0x31b882);}return _0x2ec010['save']();};}function saveUpdates(_0x25439b,_0x21220b){return function(_0x17a7d6){if(_0x17a7d6){return _0x17a7d6[_0x8bcf('0x20')](_0x25439b)['then'](function(_0x5253a9){return _0x5253a9;});}return null;};}function removeEntity(_0x37d21d,_0x182f5e){return function(_0x4bfffe){if(_0x4bfffe){return _0x4bfffe['destroy']()[_0x8bcf('0x21')](function(){_0x37d21d[_0x8bcf('0x17')](0xcc)[_0x8bcf('0x22')]();});}};}function handleEntityNotFound(_0x4db62b,_0x4dd439){return function(_0x3fd676){if(!_0x3fd676){_0x4db62b[_0x8bcf('0x16')](0x194);}return _0x3fd676;};}function handleError(_0x3ea5fb,_0x3abbe6){_0x3abbe6=_0x3abbe6||0x1f4;return function(_0x5b1302){logger[_0x8bcf('0x23')](_0x5b1302[_0x8bcf('0x24')]);if(_0x5b1302['name']){delete _0x5b1302[_0x8bcf('0x25')];}_0x3ea5fb[_0x8bcf('0x17')](_0x3abbe6)[_0x8bcf('0x26')](_0x5b1302);};}exports['index']=function(_0x24d607,_0xb54c20){var _0x5cfaed={},_0x3bf001={},_0x1382a6={'count':0x0,'rows':[]};var _0x1d7d22=_[_0x8bcf('0x27')](db[_0x8bcf('0x28')][_0x8bcf('0x29')],function(_0x138cce){return{'name':_0x138cce[_0x8bcf('0x2a')],'type':_0x138cce['type']['key']};});_0x3bf001[_0x8bcf('0x2b')]=_[_0x8bcf('0x27')](_0x1d7d22,_0x8bcf('0x25'));_0x3bf001[_0x8bcf('0x2c')]=_[_0x8bcf('0x2d')](_0x24d607[_0x8bcf('0x2c')]);_0x3bf001[_0x8bcf('0x2e')]=_['intersection'](_0x3bf001[_0x8bcf('0x2b')],_0x3bf001[_0x8bcf('0x2c')]);_0x5cfaed['attributes']=_[_0x8bcf('0x2f')](_0x3bf001[_0x8bcf('0x2b')],qs[_0x8bcf('0x30')](_0x24d607['query']['fields']));_0x5cfaed[_0x8bcf('0x31')]=_0x5cfaed[_0x8bcf('0x31')][_0x8bcf('0x32')]?_0x5cfaed['attributes']:_0x3bf001[_0x8bcf('0x2b')];if(!_0x24d607['query'][_0x8bcf('0x33')](_0x8bcf('0x34'))){_0x5cfaed[_0x8bcf('0x1b')]=qs[_0x8bcf('0x1b')](_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x1b')]);_0x5cfaed[_0x8bcf('0x19')]=qs[_0x8bcf('0x19')](_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x19')]);}_0x5cfaed[_0x8bcf('0x35')]=qs[_0x8bcf('0x36')](_0x24d607[_0x8bcf('0x2c')]['sort']);_0x5cfaed[_0x8bcf('0x37')]=qs[_0x8bcf('0x2e')](_[_0x8bcf('0x38')](_0x24d607['query'],_0x3bf001[_0x8bcf('0x2e')]),_0x1d7d22);if(_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x39')]){_0x5cfaed[_0x8bcf('0x37')]=_[_0x8bcf('0x3a')](_0x5cfaed[_0x8bcf('0x37')],{'$or':_[_0x8bcf('0x27')](_0x1d7d22,function(_0x3435b1){if(_0x3435b1['type']!==_0x8bcf('0x3b')){var _0x49043d={};_0x49043d[_0x3435b1[_0x8bcf('0x25')]]={'$like':'%'+_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x39')]+'%'};return _0x49043d;}})});}_0x5cfaed=_['merge']({},_0x5cfaed,_0x24d607[_0x8bcf('0x3c')]);var _0x1c47e2={'where':_0x5cfaed[_0x8bcf('0x37')]};return db[_0x8bcf('0x28')][_0x8bcf('0x1c')](_0x1c47e2)[_0x8bcf('0x21')](function(_0x32c10f){_0x1382a6[_0x8bcf('0x1c')]=_0x32c10f;if(_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x3d')]){_0x5cfaed[_0x8bcf('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8bcf('0x3f')](_0x5cfaed);})['then'](function(_0x4c986b){_0x1382a6['rows']=_0x4c986b;return _0x1382a6;})['then'](respondWithFilteredResult(_0xb54c20,_0x5cfaed))[_0x8bcf('0x40')](handleError(_0xb54c20,null));};exports[_0x8bcf('0x41')]=function(_0x5c464e,_0x501cba){var _0x22b023={'raw':!![],'where':{'id':_0x5c464e['params']['id']}},_0x435789={};_0x435789[_0x8bcf('0x2b')]=_[_0x8bcf('0x2d')](db[_0x8bcf('0x28')][_0x8bcf('0x29')]);_0x435789[_0x8bcf('0x2c')]=_[_0x8bcf('0x2d')](_0x5c464e[_0x8bcf('0x2c')]);_0x435789['filters']=_['intersection'](_0x435789[_0x8bcf('0x2b')],_0x435789['query']);_0x22b023['attributes']=_[_0x8bcf('0x2f')](_0x435789[_0x8bcf('0x2b')],qs[_0x8bcf('0x30')](_0x5c464e['query'][_0x8bcf('0x30')]));_0x22b023[_0x8bcf('0x31')]=_0x22b023[_0x8bcf('0x31')][_0x8bcf('0x32')]?_0x22b023['attributes']:_0x435789['model'];if(_0x5c464e[_0x8bcf('0x2c')]['includeAll']){_0x22b023[_0x8bcf('0x3e')]=[{'all':!![]}];}_0x22b023=_['merge']({},_0x22b023,_0x5c464e['options']);return db['CmHopperBlack'][_0x8bcf('0x42')](_0x22b023)[_0x8bcf('0x21')](handleEntityNotFound(_0x501cba,null))[_0x8bcf('0x21')](respondWithResult(_0x501cba,null))['catch'](handleError(_0x501cba,null));};exports[_0x8bcf('0x20')]=function(_0x5acab7,_0x52406b){if(_0x5acab7[_0x8bcf('0x43')]['id']){delete _0x5acab7[_0x8bcf('0x43')]['id'];}return db[_0x8bcf('0x28')][_0x8bcf('0x42')]({'where':{'id':_0x5acab7[_0x8bcf('0x44')]['id']}})[_0x8bcf('0x21')](handleEntityNotFound(_0x52406b,null))[_0x8bcf('0x21')](saveUpdates(_0x5acab7['body'],null))[_0x8bcf('0x21')](respondWithResult(_0x52406b,null))[_0x8bcf('0x40')](handleError(_0x52406b,null));};exports[_0x8bcf('0x45')]=function(_0x25c4bc,_0x2f5947){return db[_0x8bcf('0x28')][_0x8bcf('0x42')]({'where':{'id':_0x25c4bc[_0x8bcf('0x44')]['id']}})[_0x8bcf('0x21')](handleEntityNotFound(_0x2f5947,null))['then'](removeEntity(_0x2f5947,null))['catch'](handleError(_0x2f5947,null));};exports[_0x8bcf('0x46')]=function(_0x483f1a,_0x2fb5c1){return db['CmHopperBlack'][_0x8bcf('0x46')]()['then'](respondWithResult(_0x2fb5c1,null))[_0x8bcf('0x40')](handleError(_0x2fb5c1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c9ffdb3..b162118 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 _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 +var _0x63aa=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','cm_hopper_black','lodash','util','api'];(function(_0x27fe7f,_0x1a3bcd){var _0x432d89=function(_0x34bc29){while(--_0x34bc29){_0x27fe7f['push'](_0x27fe7f['shift']());}};_0x432d89(++_0x1a3bcd);}(_0x63aa,0x1b5));var _0xa63a=function(_0xf06bfa,_0x264ac0){_0xf06bfa=_0xf06bfa-0x0;var _0x535005=_0x63aa[_0xf06bfa];return _0x535005;};'use strict';var _=require(_0xa63a('0x0'));var util=require(_0xa63a('0x1'));var logger=require('../../config/logger')(_0xa63a('0x2'));var moment=require('moment');var BPromise=require(_0xa63a('0x3'));var rp=require(_0xa63a('0x4'));var fs=require('fs');var path=require(_0xa63a('0x5'));var rimraf=require(_0xa63a('0x6'));var config=require(_0xa63a('0x7'));var attributes=require(_0xa63a('0x8'));module['exports']=function(_0x479939,_0x233b90){return _0x479939[_0xa63a('0x9')]('CmHopperBlack',attributes,{'tableName':_0xa63a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 3eaae66..266bf33 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 _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 +var _0xb726=['stringify','error','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','UpdateCmHopperBlack','body','CmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x2ce8e2,_0x43716f){var _0x369539=function(_0x4168e9){while(--_0x4168e9){_0x2ce8e2['push'](_0x2ce8e2['shift']());}};_0x369539(++_0x43716f);}(_0xb726,0x1cc));var _0x6b72=function(_0x3e1983,_0x293002){_0x3e1983=_0x3e1983-0x0;var _0x283e83=_0xb726[_0x3e1983];return _0x283e83;};'use strict';var _=require(_0x6b72('0x0'));var util=require(_0x6b72('0x1'));var moment=require(_0x6b72('0x2'));var BPromise=require(_0x6b72('0x3'));var rs=require(_0x6b72('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b72('0x5'))['db'];var utils=require(_0x6b72('0x6'));var logger=require(_0x6b72('0x7'))(_0x6b72('0x8'));var config=require(_0x6b72('0x9'));var jayson=require(_0x6b72('0xa'));var client=jayson[_0x6b72('0xb')][_0x6b72('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48526a,_0x53d135,_0x4b596b){return new BPromise(function(_0x865e4f,_0xe8c069){return client[_0x6b72('0xd')](_0x48526a,_0x4b596b)[_0x6b72('0xe')](function(_0x46fb1d){logger[_0x6b72('0xf')](_0x6b72('0x10'),_0x53d135,_0x6b72('0x11'));logger[_0x6b72('0x12')](_0x6b72('0x13'),_0x53d135,_0x6b72('0x11'),JSON[_0x6b72('0x14')](_0x46fb1d));if(_0x46fb1d[_0x6b72('0x15')]){if(_0x46fb1d[_0x6b72('0x15')]['code']===0x1f4){logger[_0x6b72('0x15')](_0x6b72('0x10'),_0x53d135,_0x46fb1d[_0x6b72('0x15')][_0x6b72('0x16')]);return _0xe8c069(_0x46fb1d[_0x6b72('0x15')][_0x6b72('0x16')]);}logger[_0x6b72('0x15')](_0x6b72('0x10'),_0x53d135,_0x46fb1d['error']['message']);return _0x865e4f(_0x46fb1d[_0x6b72('0x15')][_0x6b72('0x16')]);}else{logger[_0x6b72('0xf')](_0x6b72('0x10'),_0x53d135,_0x6b72('0x11'));_0x865e4f(_0x46fb1d[_0x6b72('0x17')][_0x6b72('0x16')]);}})[_0x6b72('0x18')](function(_0x526cab){logger[_0x6b72('0x15')](_0x6b72('0x10'),_0x53d135,_0x526cab);_0xe8c069(_0x526cab);});});}exports[_0x6b72('0x19')]=function(_0x2133bf){var _0xd78e6=this;return new Promise(function(_0x95c781,_0x3f44c5){return db['CmHopperBlack'][_0x6b72('0x1a')]({'raw':_0x2133bf['options']?_0x2133bf[_0x6b72('0x1b')][_0x6b72('0x1c')]===undefined?!![]:![]:!![],'where':_0x2133bf[_0x6b72('0x1b')]?_0x2133bf[_0x6b72('0x1b')][_0x6b72('0x1d')]||null:null,'attributes':_0x2133bf['options']?_0x2133bf['options']['attributes']||null:null,'limit':_0x2133bf[_0x6b72('0x1b')]?_0x2133bf['options'][_0x6b72('0x1e')]||null:null,'include':_0x2133bf['options']?_0x2133bf['options'][_0x6b72('0x1f')]?_[_0x6b72('0x20')](_0x2133bf[_0x6b72('0x1b')][_0x6b72('0x1f')],function(_0xa47055){return{'model':db[_0xa47055[_0x6b72('0x21')]],'as':_0xa47055['as'],'attributes':_0xa47055[_0x6b72('0x22')],'include':_0xa47055['include']?_[_0x6b72('0x20')](_0xa47055['include'],function(_0x19f968){return{'model':db[_0x19f968['model']],'as':_0x19f968['as'],'attributes':_0x19f968['attributes'],'include':_0x19f968['include']?_[_0x6b72('0x20')](_0x19f968[_0x6b72('0x1f')],function(_0x291711){return{'model':db[_0x291711['model']],'as':_0x291711['as'],'attributes':_0x291711[_0x6b72('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6b72('0xe')](function(_0x38017d){logger[_0x6b72('0xf')]('GetCmHopperBlack',_0x2133bf);logger['debug']('GetCmHopperBlack',_0x2133bf,JSON[_0x6b72('0x14')](_0x38017d));_0x95c781(_0x38017d);})[_0x6b72('0x18')](function(_0x8e7d4b){logger[_0x6b72('0x15')](_0x6b72('0x19'),_0x8e7d4b[_0x6b72('0x16')],_0x2133bf);_0x3f44c5(_0xd78e6['error'](0x1f4,_0x8e7d4b[_0x6b72('0x16')]));});});};exports[_0x6b72('0x23')]=function(_0x3451fa){var _0x33d04b=this;return new Promise(function(_0xd3b76,_0x1b5465){return db['CmHopperBlack']['update'](_0x3451fa[_0x6b72('0x24')],{'raw':_0x3451fa['options']?_0x3451fa[_0x6b72('0x1b')][_0x6b72('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3451fa[_0x6b72('0x1b')]?_0x3451fa[_0x6b72('0x1b')]['where']||null:null,'attributes':_0x3451fa[_0x6b72('0x1b')]?_0x3451fa[_0x6b72('0x1b')][_0x6b72('0x22')]||null:null,'limit':_0x3451fa[_0x6b72('0x1b')]?_0x3451fa[_0x6b72('0x1b')][_0x6b72('0x1e')]||null:null})[_0x6b72('0xe')](function(_0x5a5bc3){logger[_0x6b72('0xf')](_0x6b72('0x23'),_0x3451fa);logger[_0x6b72('0x12')]('UpdateCmHopperBlack',_0x3451fa,JSON[_0x6b72('0x14')](_0x5a5bc3));_0xd3b76(_0x5a5bc3);})[_0x6b72('0x18')](function(_0x445e7f){logger[_0x6b72('0x15')]('UpdateCmHopperBlack',_0x445e7f['message'],_0x3451fa);_0x1b5465(_0x33d04b['error'](0x1f4,_0x445e7f['message']));});});};exports['DestroyCmHopperBlack']=function(_0x564b3e){var _0x4f4482=this;return new Promise(function(_0x19009b,_0x4a8786){return db[_0x6b72('0x25')][_0x6b72('0x26')]({'where':_0x564b3e[_0x6b72('0x1b')]?_0x564b3e['options'][_0x6b72('0x1d')]||null:null})['then'](function(_0x20ddeb){logger[_0x6b72('0xf')](_0x6b72('0x27'),_0x564b3e);logger[_0x6b72('0x12')]('DestroyCmHopperBlack',_0x564b3e,JSON[_0x6b72('0x14')](_0x20ddeb));_0x19009b(_0x20ddeb);})['catch'](function(_0x4d673d){logger['error'](_0x6b72('0x27'),_0x4d673d[_0x6b72('0x16')],_0x564b3e);_0x4a8786(_0x4f4482[_0x6b72('0x15')](0x1f4,_0x4d673d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d271374..d2eeb52 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 _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 +var _0x687b=['isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x99c991,_0x439ce7){var _0x3e2061=function(_0x15bf1b){while(--_0x15bf1b){_0x99c991['push'](_0x99c991['shift']());}};_0x3e2061(++_0x439ce7);}(_0x687b,0x14a));var _0xb687=function(_0x2107a6,_0xe8360d){_0x2107a6=_0x2107a6-0x0;var _0x2f09ef=_0x687b[_0x2107a6];return _0x2f09ef;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller['destroy']);module[_0xb687('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e8a596c..0345b3b 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 _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 +var _0xa87b=['seconds','BOOLEAN','sequelize','moment','STRING','DATE','INTEGER','getDataValue','endtime','followuptime'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa87b,0x1e2));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xba87('0x0'));var moment=require(_0xba87('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xba87('0x2')]},'scheduledat':{'type':Sequelize[_0xba87('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xba87('0x2')]},'originatecalleridname':{'type':Sequelize[_0xba87('0x2')]},'calleridnum':{'type':Sequelize[_0xba87('0x2')]},'calleridname':{'type':Sequelize[_0xba87('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xba87('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xba87('0x3')]},'ringtime':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xba87('0x2')]},'campaign':{'type':Sequelize[_0xba87('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xba87('0x2')]},'disposition':{'type':Sequelize[_0xba87('0x2')]},'secondDisposition':{'type':Sequelize[_0xba87('0x2')]},'thirdDisposition':{'type':Sequelize[_0xba87('0x2')]},'dispositionat':{'type':Sequelize[_0xba87('0x3')],'set':function(_0x21d157){var _0x21e47c=this[_0xba87('0x5')](_0xba87('0x6'));if(_0x21e47c&&_0x21d157){this['setDataValue'](_0xba87('0x7'),moment(_0x21d157)['diff'](moment(_0x21e47c),_0xba87('0x8')));}}},'amd':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xba87('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xba87('0x3')]},'deleted':{'type':Sequelize[_0xba87('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xba87('0x3')]},'recallme':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xba87('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 3a694e1..d9a34ff 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 _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 +var _0x2a07=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x100f8a,_0x42db63){var _0x5671f2=function(_0x27ef4f){while(--_0x27ef4f){_0x100f8a['push'](_0x100f8a['shift']());}};_0x5671f2(++_0x42db63);}(_0x2a07,0x74));var _0x72a0=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0x2a07[_0x32665e];return _0x10be45;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['CmHopperFinal'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b4e9a50..40da8e8 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 _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 +var _0x535c=['../../config/logger','moment','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x2949cf,_0x548962){var _0x57d596=function(_0x4c6bea){while(--_0x4c6bea){_0x2949cf['push'](_0x2949cf['shift']());}};_0x57d596(++_0x548962);}(_0x535c,0x16a));var _0xc535=function(_0x3b95e2,_0x3d2dfb){_0x3b95e2=_0x3b95e2-0x0;var _0x1191c4=_0x535c[_0x3b95e2];return _0x1191c4;};'use strict';var _=require(_0xc535('0x0'));var util=require('util');var logger=require(_0xc535('0x1'))('api');var moment=require(_0xc535('0x2'));var BPromise=require('bluebird');var rp=require(_0xc535('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc535('0x4'));module[_0xc535('0x5')]=function(_0x317f06,_0x55d00b){return _0x317f06[_0xc535('0x6')](_0xc535('0x7'),attributes,{'tableName':_0xc535('0x8'),'paranoid':![],'indexes':[{'name':_0xc535('0x9'),'fields':[_0xc535('0x9')]},{'name':_0xc535('0xa'),'fields':[_0xc535('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index c9038bd..fd25c3f 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 _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 +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(_0x28eb1a,_0x54d12f){var _0x56f48d=function(_0x5053db){while(--_0x5053db){_0x28eb1a['push'](_0x28eb1a['shift']());}};_0x56f48d(++_0x54d12f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0xb10b[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index bf10332..46fb4b1 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 _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 +var _0x61c2=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x61c2,0x11f));var _0x261c=function(_0x3ce8a9,_0x4612d6){_0x3ce8a9=_0x3ce8a9-0x0;var _0x159582=_0x61c2[_0x3ce8a9];return _0x159582;};'use strict';var multer=require(_0x261c('0x0'));var util=require(_0x261c('0x1'));var path=require(_0x261c('0x2'));var timeout=require(_0x261c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x261c('0x4'));var auth=require(_0x261c('0x5'));var interaction=require(_0x261c('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x261c('0x7')]('/',auth['isAuthenticated'](),controller[_0x261c('0x8')]);router['get']('/describe',auth[_0x261c('0x9')](),controller[_0x261c('0xa')]);router[_0x261c('0x7')](_0x261c('0xb'),auth[_0x261c('0x9')](),controller[_0x261c('0xc')]);router[_0x261c('0x7')](_0x261c('0xd'),auth['isAuthenticated'](),controller[_0x261c('0xe')]);router[_0x261c('0x7')](_0x261c('0xf'),auth['isAuthenticated'](),controller[_0x261c('0x10')]);router[_0x261c('0x11')](_0x261c('0x12'),auth[_0x261c('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x261c('0x11')](_0x261c('0x13'),auth['isAuthenticated'](),controller[_0x261c('0x14')]);router[_0x261c('0x11')]('/checkContactHopper',auth[_0x261c('0x9')](),controller[_0x261c('0x15')]);router[_0x261c('0x16')](_0x261c('0xb'),auth['isAuthenticated'](),controller[_0x261c('0x17')]);module[_0x261c('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f4038b2..2d8856c 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 _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 +var _0xd325=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xd325,0x1f3));var _0x5d32=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xd325[_0x421e36];return _0x20b3e3;};'use strict';var Sequelize=require(_0x5d32('0x0'));module[_0x5d32('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5d32('0x2')]},'scheduledat':{'type':Sequelize[_0x5d32('0x3')]},'countbusyretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d32('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5d32('0x2')]},'calleridname':{'type':Sequelize[_0x5d32('0x2')]},'starttime':{'type':Sequelize[_0x5d32('0x3')]},'responsetime':{'type':Sequelize[_0x5d32('0x3')]},'answertime':{'type':Sequelize[_0x5d32('0x3')]},'droptime':{'type':Sequelize[_0x5d32('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d32('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d32('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d32('0x3')]},'edited':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5d32('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f35f621..14e19b6 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 _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 +var _0xf210=['attributes','intersection','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','then','include','catch','show','params','includeAll','options','find','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','json','offset','undefined','count','set','apply','reject','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','filters','query'];(function(_0x1eb127,_0x46958c){var _0x3c30c7=function(_0x4244cb){while(--_0x4244cb){_0x1eb127['push'](_0x1eb127['shift']());}};_0x3c30c7(++_0x46958c);}(_0xf210,0xd6));var _0x0f21=function(_0x4547e6,_0x29fcc7){_0x4547e6=_0x4547e6-0x0;var _0x42b412=_0xf210[_0x4547e6];return _0x42b412;};'use strict';var emlformat=require(_0x0f21('0x0'));var rimraf=require(_0x0f21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f21('0x2'));var moment=require(_0x0f21('0x3'));var BPromise=require(_0x0f21('0x4'));var Mustache=require(_0x0f21('0x5'));var util=require(_0x0f21('0x6'));var path=require(_0x0f21('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f21('0x8'));var _=require('lodash');var squel=require(_0x0f21('0x9'));var crypto=require(_0x0f21('0xa'));var jsforce=require(_0x0f21('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0f21('0xc'));var querystring=require(_0x0f21('0xd'));var Papa=require('papaparse');var Redis=require(_0x0f21('0xe'));var authService=require(_0x0f21('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0f21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0f21('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabe9bd,_0x3f4eb1){_0x3f4eb1=_0x3f4eb1||0xcc;return function(_0x4c51cd){if(_0x4c51cd){return _0xabe9bd[_0x0f21('0x12')](_0x3f4eb1);}return _0xabe9bd[_0x0f21('0x13')](_0x3f4eb1)['end']();};}function respondWithResult(_0x5bc661,_0x51eef3){_0x51eef3=_0x51eef3||0xc8;return function(_0x5da397){if(_0x5da397){return _0x5bc661[_0x0f21('0x13')](_0x51eef3)[_0x0f21('0x14')](_0x5da397);}};}function respondWithFilteredResult(_0x1c8b64,_0x5afcd9){return function(_0x346660){if(_0x346660){var _0x591a1f=typeof _0x5afcd9[_0x0f21('0x15')]===_0x0f21('0x16')&&typeof _0x5afcd9['limit']==='undefined';var _0x2bb6de=_0x346660[_0x0f21('0x17')];var _0x3b1562=_0x591a1f?0x0:_0x5afcd9[_0x0f21('0x15')];var _0x181531=_0x591a1f?_0x346660[_0x0f21('0x17')]:_0x5afcd9[_0x0f21('0x15')]+_0x5afcd9['limit'];var _0x321f97;if(_0x181531>=_0x2bb6de){_0x181531=_0x2bb6de;_0x321f97=0xc8;}else{_0x321f97=0xce;}_0x1c8b64['status'](_0x321f97);return _0x1c8b64[_0x0f21('0x18')]('Content-Range',_0x3b1562+'-'+_0x181531+'/'+_0x2bb6de)[_0x0f21('0x14')](_0x346660);}return null;};}function patchUpdates(_0x5bcf7b){return function(_0x5d455b){try{jsonpatch[_0x0f21('0x19')](_0x5d455b,_0x5bcf7b,!![]);}catch(_0x2aafe7){return BPromise[_0x0f21('0x1a')](_0x2aafe7);}return _0x5d455b['save']();};}function saveUpdates(_0x454123,_0x54db2d){return function(_0x714edc){if(_0x714edc){return _0x714edc['update'](_0x454123)['then'](function(_0x47cde0){return _0x47cde0;});}return null;};}function removeEntity(_0x5bbe7d,_0x1f8081){return function(_0x65a158){if(_0x65a158){return _0x65a158['destroy']()['then'](function(){_0x5bbe7d['status'](0xcc)[_0x0f21('0x1b')]();});}};}function handleEntityNotFound(_0x5e00bf,_0x50edf4){return function(_0x3933e8){if(!_0x3933e8){_0x5e00bf[_0x0f21('0x12')](0x194);}return _0x3933e8;};}function handleError(_0x4fad42,_0x6b9a0f){_0x6b9a0f=_0x6b9a0f||0x1f4;return function(_0x557dcd){logger[_0x0f21('0x1c')](_0x557dcd[_0x0f21('0x1d')]);if(_0x557dcd[_0x0f21('0x1e')]){delete _0x557dcd[_0x0f21('0x1e')];}_0x4fad42['status'](_0x6b9a0f)['send'](_0x557dcd);};}exports[_0x0f21('0x1f')]=function(_0x176965,_0x1ffdc9){var _0x2bffcf={},_0x5536e6={},_0x273607={'count':0x0,'rows':[]};var _0x614c7d=_[_0x0f21('0x20')](db[_0x0f21('0x21')][_0x0f21('0x22')],function(_0x15eed2){return{'name':_0x15eed2[_0x0f21('0x23')],'type':_0x15eed2[_0x0f21('0x24')][_0x0f21('0x25')]};});_0x5536e6[_0x0f21('0x26')]=_[_0x0f21('0x20')](_0x614c7d,'name');_0x5536e6['query']=_[_0x0f21('0x27')](_0x176965['query']);_0x5536e6[_0x0f21('0x28')]=_['intersection'](_0x5536e6[_0x0f21('0x26')],_0x5536e6[_0x0f21('0x29')]);_0x2bffcf[_0x0f21('0x2a')]=_[_0x0f21('0x2b')](_0x5536e6[_0x0f21('0x26')],qs[_0x0f21('0x2c')](_0x176965[_0x0f21('0x29')][_0x0f21('0x2c')]));_0x2bffcf[_0x0f21('0x2a')]=_0x2bffcf[_0x0f21('0x2a')][_0x0f21('0x2d')]?_0x2bffcf[_0x0f21('0x2a')]:_0x5536e6[_0x0f21('0x26')];if(!_0x176965[_0x0f21('0x29')]['hasOwnProperty'](_0x0f21('0x2e'))){_0x2bffcf['limit']=qs['limit'](_0x176965[_0x0f21('0x29')]['limit']);_0x2bffcf[_0x0f21('0x15')]=qs[_0x0f21('0x15')](_0x176965[_0x0f21('0x29')]['offset']);}_0x2bffcf['order']=qs[_0x0f21('0x2f')](_0x176965[_0x0f21('0x29')][_0x0f21('0x2f')]);_0x2bffcf['where']=qs[_0x0f21('0x28')](_['pick'](_0x176965[_0x0f21('0x29')],_0x5536e6['filters']),_0x614c7d);if(_0x176965['query'][_0x0f21('0x30')]){_0x2bffcf[_0x0f21('0x31')]=_[_0x0f21('0x32')](_0x2bffcf[_0x0f21('0x31')],{'$or':_[_0x0f21('0x20')](_0x614c7d,function(_0x227e55){if(_0x227e55['type']!==_0x0f21('0x33')){var _0x47a074={};_0x47a074[_0x227e55['name']]={'$like':'%'+_0x176965[_0x0f21('0x29')][_0x0f21('0x30')]+'%'};return _0x47a074;}})});}_0x2bffcf=_['merge']({},_0x2bffcf,_0x176965['options']);var _0x727e84={'where':_0x2bffcf['where']};return db[_0x0f21('0x21')]['count'](_0x727e84)[_0x0f21('0x34')](function(_0x38f16e){_0x273607[_0x0f21('0x17')]=_0x38f16e;if(_0x176965[_0x0f21('0x29')]['includeAll']){_0x2bffcf[_0x0f21('0x35')]=[{'all':!![]}];}return db[_0x0f21('0x21')]['findAll'](_0x2bffcf);})[_0x0f21('0x34')](function(_0x5beeb7){_0x273607['rows']=_0x5beeb7;return _0x273607;})[_0x0f21('0x34')](respondWithFilteredResult(_0x1ffdc9,_0x2bffcf))[_0x0f21('0x36')](handleError(_0x1ffdc9,null));};exports[_0x0f21('0x37')]=function(_0x15d676,_0x507490){var _0x7f2361={'raw':!![],'where':{'id':_0x15d676[_0x0f21('0x38')]['id']}},_0x598521={};_0x598521[_0x0f21('0x26')]=_[_0x0f21('0x27')](db[_0x0f21('0x21')]['rawAttributes']);_0x598521[_0x0f21('0x29')]=_[_0x0f21('0x27')](_0x15d676[_0x0f21('0x29')]);_0x598521[_0x0f21('0x28')]=_[_0x0f21('0x2b')](_0x598521['model'],_0x598521[_0x0f21('0x29')]);_0x7f2361[_0x0f21('0x2a')]=_[_0x0f21('0x2b')](_0x598521['model'],qs[_0x0f21('0x2c')](_0x15d676[_0x0f21('0x29')]['fields']));_0x7f2361[_0x0f21('0x2a')]=_0x7f2361[_0x0f21('0x2a')]['length']?_0x7f2361[_0x0f21('0x2a')]:_0x598521['model'];if(_0x15d676[_0x0f21('0x29')][_0x0f21('0x39')]){_0x7f2361['include']=[{'all':!![]}];}_0x7f2361=_[_0x0f21('0x32')]({},_0x7f2361,_0x15d676[_0x0f21('0x3a')]);return db[_0x0f21('0x21')][_0x0f21('0x3b')](_0x7f2361)[_0x0f21('0x34')](handleEntityNotFound(_0x507490,null))['then'](respondWithResult(_0x507490,null))[_0x0f21('0x36')](handleError(_0x507490,null));};exports[_0x0f21('0x3c')]=function(_0x3c5223,_0x471156){return db['CmHopperHistory'][_0x0f21('0x3c')](_0x3c5223[_0x0f21('0x3d')],{})[_0x0f21('0x34')](respondWithResult(_0x471156,0xc9))[_0x0f21('0x36')](handleError(_0x471156,null));};exports[_0x0f21('0x3e')]=function(_0x482712,_0x33496d){return db[_0x0f21('0x21')][_0x0f21('0x3e')]()[_0x0f21('0x34')](respondWithResult(_0x33496d,null))[_0x0f21('0x36')](handleError(_0x33496d,null));};exports['update']=function(_0xec825d,_0x21fdcc){if(_0xec825d['body']['uniqueid']){delete _0xec825d[_0x0f21('0x3d')][_0x0f21('0x3f')];}return db[_0x0f21('0x21')]['find']({'where':{'uniqueid':_0xec825d[_0x0f21('0x38')]['id']}})[_0x0f21('0x34')](handleEntityNotFound(_0x21fdcc,null))['then'](saveUpdates(_0xec825d[_0x0f21('0x3d')],null))[_0x0f21('0x34')](respondWithResult(_0x21fdcc,null))[_0x0f21('0x36')](handleError(_0x21fdcc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d059b61..6679f2d 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 _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 +var _0x3fce=['../../config/logger','api','moment','bluebird','request-promise','path','CmHopperHistory','endtime','uniqueid','util'];(function(_0x3a41be,_0x51ff6a){var _0x5d4b86=function(_0x3687d7){while(--_0x3687d7){_0x3a41be['push'](_0x3a41be['shift']());}};_0x5d4b86(++_0x51ff6a);}(_0x3fce,0x121));var _0xe3fc=function(_0x53ba51,_0x2f2321){_0x53ba51=_0x53ba51-0x0;var _0x2e776e=_0x3fce[_0x53ba51];return _0x2e776e;};'use strict';var _=require('lodash');var util=require(_0xe3fc('0x0'));var logger=require(_0xe3fc('0x1'))(_0xe3fc('0x2'));var moment=require(_0xe3fc('0x3'));var BPromise=require(_0xe3fc('0x4'));var rp=require(_0xe3fc('0x5'));var fs=require('fs');var path=require(_0xe3fc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x36eff8,_0x2dc84d){return _0x36eff8['define'](_0xe3fc('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xe3fc('0x8'),'fields':['endtime']},{'name':_0xe3fc('0x9'),'fields':[_0xe3fc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index fede405..61dbf25 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 _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 +var _0x43fd=['jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x35c2ab,_0xc7661b){var _0x528f69=function(_0x26c6f5){while(--_0x26c6f5){_0x35c2ab['push'](_0x35c2ab['shift']());}};_0x528f69(++_0xc7661b);}(_0x43fd,0x150));var _0xd43f=function(_0x5c7b0b,_0x3dda71){_0x5c7b0b=_0x5c7b0b-0x0;var _0x4d68d9=_0x43fd[_0x5c7b0b];return _0x4d68d9;};'use strict';var _=require(_0xd43f('0x0'));var util=require(_0xd43f('0x1'));var moment=require('moment');var BPromise=require(_0xd43f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd43f('0x3'));var db=require(_0xd43f('0x4'))['db'];var utils=require(_0xd43f('0x5'));var logger=require(_0xd43f('0x6'))(_0xd43f('0x7'));var config=require(_0xd43f('0x8'));var jayson=require(_0xd43f('0x9'));var client=jayson[_0xd43f('0xa')][_0xd43f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2296e1,_0x907208,_0x2516ee){return new BPromise(function(_0x39a819,_0x44b1bf){return client['request'](_0x2296e1,_0x2516ee)[_0xd43f('0xc')](function(_0x43b9db){logger[_0xd43f('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x907208,_0xd43f('0xe'));logger[_0xd43f('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x907208,_0xd43f('0xe'),JSON[_0xd43f('0x10')](_0x43b9db));if(_0x43b9db[_0xd43f('0x11')]){if(_0x43b9db[_0xd43f('0x11')]['code']===0x1f4){logger['error'](_0xd43f('0x12'),_0x907208,_0x43b9db[_0xd43f('0x11')]['message']);return _0x44b1bf(_0x43b9db[_0xd43f('0x11')]['message']);}logger['error'](_0xd43f('0x12'),_0x907208,_0x43b9db[_0xd43f('0x11')]['message']);return _0x39a819(_0x43b9db[_0xd43f('0x11')][_0xd43f('0x13')]);}else{logger['info'](_0xd43f('0x12'),_0x907208,_0xd43f('0xe'));_0x39a819(_0x43b9db[_0xd43f('0x14')][_0xd43f('0x13')]);}})[_0xd43f('0x15')](function(_0x5d2f85){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x907208,_0x5d2f85);_0x44b1bf(_0x5d2f85);});});}exports[_0xd43f('0x16')]=function(_0x22d86f){var _0xda0dcc=this;return new Promise(function(_0x2e2396,_0x57931d){return db[_0xd43f('0x17')][_0xd43f('0x18')](_0x22d86f[_0xd43f('0x19')],{'raw':_0x22d86f[_0xd43f('0x1a')]?_0x22d86f[_0xd43f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd43f('0xc')](function(_0x5bae9e){logger[_0xd43f('0xd')]('CreateCmHopperHistory',_0x22d86f);logger[_0xd43f('0xf')](_0xd43f('0x16'),_0x22d86f,JSON['stringify'](_0x5bae9e));_0x2e2396(_0x5bae9e);})[_0xd43f('0x15')](function(_0x1c79b8){logger[_0xd43f('0x11')]('CreateCmHopperHistory',_0x1c79b8[_0xd43f('0x13')],_0x22d86f);_0x57931d(_0xda0dcc['error'](0x1f4,_0x1c79b8[_0xd43f('0x13')]));});});};exports[_0xd43f('0x1b')]=function(_0x1bf18d){var _0xa7858f=this;return new Promise(function(_0x38928a,_0x364d67){return db['CmHopperHistory'][_0xd43f('0x1c')]({'raw':_0x1bf18d[_0xd43f('0x1a')]?_0x1bf18d[_0xd43f('0x1a')][_0xd43f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bf18d[_0xd43f('0x1a')]?_0x1bf18d[_0xd43f('0x1a')][_0xd43f('0x1e')]||null:null,'attributes':[[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['col']('id')),_0xd43f('0x21')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x23')))),_0xd43f('0x24')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x25')))),_0xd43f('0x26')],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xd43f('0x1f')]['fn']('AVG',db[_0xd43f('0x1f')]['fn']('IF',db['sequelize'][_0xd43f('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xd43f('0x28')],[db[_0xd43f('0x1f')]['fn']('AVG',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x29')))),_0xd43f('0x2a')]]})[_0xd43f('0xc')](function(_0x4b15a9){logger[_0xd43f('0xd')](_0xd43f('0x1b'),_0x1bf18d);logger['debug'](_0xd43f('0x1b'),_0x1bf18d,JSON[_0xd43f('0x10')](_0x4b15a9));_0x38928a(_0x4b15a9);})[_0xd43f('0x15')](function(_0x345f14){logger[_0xd43f('0x11')]('AvgHandleTime',_0x345f14[_0xd43f('0x13')],_0x1bf18d);_0x364d67(_0xa7858f['error'](0x1f4,_0x345f14[_0xd43f('0x13')]));});});};exports[_0xd43f('0x2b')]=function(_0xe8093f){var _0x1fa248=this;return new Promise(function(_0x2d8359,_0x400fa5){return db['CmHopperHistory'][_0xd43f('0x1c')]({'raw':_0xe8093f[_0xd43f('0x1a')]?_0xe8093f['options'][_0xd43f('0x1d')]===undefined?!![]:![]:!![],'where':_0xe8093f[_0xd43f('0x1a')]?_0xe8093f[_0xd43f('0x1a')]['where']||null:null,'attributes':[[_0xd43f('0x2c'),'name'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x2d')))),_0xd43f('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xd43f('0x22')](_0xd43f('0x2f')))),_0xd43f('0x30')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x31')))),_0xd43f('0x32')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x33')))),_0xd43f('0x34')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x35')))),'outboundDropCallsDayTimeout'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xd43f('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x37')))),_0xd43f('0x38')],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0xd43f('0x39')],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x3a')))),_0xd43f('0x3b')],[db['sequelize']['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x3c')))),_0xd43f('0x3d')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0xd43f('0x3e')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x3f')))),'outboundRejectCallsDay'],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db['sequelize'][_0xd43f('0x22')](_0xd43f('0x40')))),'outboundReCallsDay']],'group':[_0xd43f('0x2c')]})['then'](function(_0x453e45){logger[_0xd43f('0xd')](_0xd43f('0x2b'),_0xe8093f);logger['debug'](_0xd43f('0x2b'),_0xe8093f,JSON[_0xd43f('0x10')](_0x453e45));_0x2d8359(_0x453e45);})[_0xd43f('0x15')](function(_0x2860da){logger[_0xd43f('0x11')](_0xd43f('0x2b'),_0x2860da[_0xd43f('0x13')],_0xe8093f);_0x400fa5(_0x1fa248[_0xd43f('0x11')](0x1f4,_0x2860da[_0xd43f('0x13')]));});});};exports[_0xd43f('0x41')]=function(_0x573389){var _0x56b09c=this;return new Promise(function(_0xc6480d,_0x588426){return db[_0xd43f('0x17')][_0xd43f('0x1c')]({'raw':_0x573389['options']?_0x573389[_0xd43f('0x1a')][_0xd43f('0x1d')]===undefined?!![]:![]:!![],'where':_0x573389[_0xd43f('0x1a')]?_0x573389[_0xd43f('0x1a')][_0xd43f('0x1e')]||null:null,'attributes':[[_0xd43f('0x2c'),_0xd43f('0x42')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['col']('id')),_0xd43f('0x43')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db['sequelize'][_0xd43f('0x22')](_0xd43f('0x23')))),_0xd43f('0x44')]],'group':['campaign']})['then'](function(_0x3c87af){logger[_0xd43f('0xd')]('GetCampaignHopperHistory',_0x573389);logger[_0xd43f('0xf')](_0xd43f('0x41'),_0x573389,JSON['stringify'](_0x3c87af));_0xc6480d(_0x3c87af);})['catch'](function(_0x4964ba){logger[_0xd43f('0x11')](_0xd43f('0x41'),_0x4964ba[_0xd43f('0x13')],_0x573389);_0x588426(_0x56b09c['error'](0x1f4,_0x4964ba[_0xd43f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 54b7f02..7110c9b 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 _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 +var _0x4598=['/:id','show','post','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xa14cf8,_0x1f2630){var _0x593535=function(_0x3832ad){while(--_0x3832ad){_0xa14cf8['push'](_0xa14cf8['shift']());}};_0x593535(++_0x1f2630);}(_0x4598,0x79));var _0x8459=function(_0x3f8631,_0x15fa06){_0x3f8631=_0x3f8631-0x0;var _0x4df996=_0x4598[_0x3f8631];return _0x4df996;};'use strict';var multer=require(_0x8459('0x0'));var util=require('util');var path=require(_0x8459('0x1'));var timeout=require('connect-timeout');var express=require(_0x8459('0x2'));var router=express[_0x8459('0x3')]();var fs_extra=require(_0x8459('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8459('0x5'));var config=require('../../config/environment');var controller=require(_0x8459('0x6'));router[_0x8459('0x7')]('/',auth[_0x8459('0x8')](),controller[_0x8459('0x9')]);router[_0x8459('0x7')](_0x8459('0xa'),auth[_0x8459('0x8')](),controller[_0x8459('0xb')]);router[_0x8459('0x7')](_0x8459('0xc'),auth[_0x8459('0x8')](),controller[_0x8459('0xd')]);router[_0x8459('0xe')]('/',auth[_0x8459('0x8')](),controller[_0x8459('0xf')]);router[_0x8459('0x10')](_0x8459('0xc'),auth['isAuthenticated'](),controller[_0x8459('0x11')]);module[_0x8459('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a28e711..3260b4a 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 _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 +var _0x2cc1=['name','sequelize','exports','STRING'];(function(_0x8dfaf0,_0x3cff4f){var _0x3b69a8=function(_0x17ccff){while(--_0x17ccff){_0x8dfaf0['push'](_0x8dfaf0['shift']());}};_0x3b69a8(++_0x3cff4f);}(_0x2cc1,0x1bd));var _0x12cc=function(_0xb6c6f1,_0x12fa19){_0xb6c6f1=_0xb6c6f1-0x0;var _0xb8552f=_0x2cc1[_0xb6c6f1];return _0xb8552f;};'use strict';var Sequelize=require(_0x12cc('0x0'));module[_0x12cc('0x1')]={'name':{'type':Sequelize[_0x12cc('0x2')],'unique':_0x12cc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x12cc('0x2')]},'dialPrefix':{'type':Sequelize[_0x12cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 4ed50f6..d0c6d35 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 _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 +var _0x40c6=['text','Sequelize','switch','sequelize','addColumn','cm_contacts','cf_%s','getGlobalCustomFields','addAgents','ids','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','addContacts','CmContact','tags','isArray','push','each','omit','success','message','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','nolimit','getContacts','OrderBy','select','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','CmCustomField','addCustomFields','TEXT'];(function(_0x5dc087,_0x9d6e6e){var _0x24e72a=function(_0x5e1f66){while(--_0x5e1f66){_0x5dc087['push'](_0x5dc087['shift']());}};_0x24e72a(++_0x9d6e6e);}(_0x40c6,0x1f2));var _0x640c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x40c6[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x640c('0x0'));var zipdir=require(_0x640c('0x1'));var jsonpatch=require(_0x640c('0x2'));var rp=require(_0x640c('0x3'));var moment=require(_0x640c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x640c('0x5'));var path=require(_0x640c('0x6'));var sox=require(_0x640c('0x7'));var csv=require(_0x640c('0x8'));var ejs=require(_0x640c('0x9'));var fs=require('fs');var fs_extra=require(_0x640c('0xa'));var _=require('lodash');var squel=require(_0x640c('0xb'));var crypto=require('crypto');var jsforce=require(_0x640c('0xc'));var deskjs=require(_0x640c('0xd'));var toCsv=require(_0x640c('0x8'));var querystring=require(_0x640c('0xe'));var Papa=require('papaparse');var Redis=require(_0x640c('0xf'));var authService=require(_0x640c('0x10'));var qs=require(_0x640c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x640c('0x12'));var logger=require('../../config/logger')(_0x640c('0x13'));var utils=require(_0x640c('0x14'));var config=require(_0x640c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x640c('0x16'))['db'];var csv_results;config[_0x640c('0x17')]=_[_0x640c('0x18')](config[_0x640c('0x17')],{'host':_0x640c('0x19'),'port':0x18eb});var socket=require(_0x640c('0x1a'))(new Redis(config[_0x640c('0x17')]));require(_0x640c('0x1b'))[_0x640c('0x1c')](socket);function respondWithStatusCode(_0x275036,_0x5368b6){_0x5368b6=_0x5368b6||0xcc;return function(_0x16befa){if(_0x16befa){return _0x275036[_0x640c('0x1d')](_0x5368b6);}return _0x275036[_0x640c('0x1e')](_0x5368b6)['end']();};}function respondWithResult(_0x31b18a,_0x5a1545){_0x5a1545=_0x5a1545||0xc8;return function(_0x4cf0b9){if(_0x4cf0b9){return _0x31b18a[_0x640c('0x1e')](_0x5a1545)[_0x640c('0x1f')](_0x4cf0b9);}};}function respondWithFilteredResult(_0x33830b,_0x150898){return function(_0xef9eb0){if(_0xef9eb0){var _0x113136=typeof _0x150898['offset']==='undefined'&&typeof _0x150898[_0x640c('0x20')]==='undefined';var _0x5adc8c=_0xef9eb0[_0x640c('0x21')];var _0x59d979=_0x113136?0x0:_0x150898['offset'];var _0x9df4cc=_0x113136?_0xef9eb0[_0x640c('0x21')]:_0x150898[_0x640c('0x22')]+_0x150898['limit'];var _0x367c3c;if(_0x9df4cc>=_0x5adc8c){_0x9df4cc=_0x5adc8c;_0x367c3c=0xc8;}else{_0x367c3c=0xce;}_0x33830b[_0x640c('0x1e')](_0x367c3c);return _0x33830b[_0x640c('0x23')](_0x640c('0x24'),_0x59d979+'-'+_0x9df4cc+'/'+_0x5adc8c)[_0x640c('0x1f')](_0xef9eb0);}return null;};}function patchUpdates(_0x3cbf31){return function(_0x5ee714){try{jsonpatch[_0x640c('0x25')](_0x5ee714,_0x3cbf31,!![]);}catch(_0x10ec19){return BPromise['reject'](_0x10ec19);}return _0x5ee714[_0x640c('0x26')]();};}function saveUpdates(_0x48d7b4,_0x13e6c0){return function(_0x52458b){if(_0x52458b){return _0x52458b[_0x640c('0x27')](_0x48d7b4)[_0x640c('0x28')](function(_0x4debcd){return _0x4debcd;});}return null;};}function removeEntity(_0x14bae5,_0x514ab5){return function(_0x3319be){if(_0x3319be){return _0x3319be[_0x640c('0x29')]()[_0x640c('0x28')](function(){var _0x596458=_0x3319be[_0x640c('0x2a')]({'plain':!![]});var _0x4b5946='Lists';return db[_0x640c('0x2b')][_0x640c('0x29')]({'where':{'type':_0x4b5946,'resourceId':_0x596458['id']}})[_0x640c('0x28')](function(){return _0x3319be;});})['then'](function(){_0x14bae5[_0x640c('0x1e')](0xcc)[_0x640c('0x2c')]();});}};}function handleEntityNotFound(_0x165108,_0x8087){return function(_0x36350f){if(!_0x36350f){_0x165108['sendStatus'](0x194);}return _0x36350f;};}function handleError(_0x5de98f,_0x2c166b){_0x2c166b=_0x2c166b||0x1f4;return function(_0x35a93f){logger[_0x640c('0x2d')](_0x35a93f[_0x640c('0x2e')]);if(_0x35a93f[_0x640c('0x2f')]){delete _0x35a93f[_0x640c('0x2f')];}_0x5de98f[_0x640c('0x1e')](_0x2c166b)[_0x640c('0x30')](_0x35a93f);};}exports[_0x640c('0x31')]=function(_0x329b33,_0x23b968){var _0x4105c2={},_0x1aeeb0={},_0x310d8c={'count':0x0,'rows':[]};var _0x5c1d40=_[_0x640c('0x32')](db[_0x640c('0x33')][_0x640c('0x34')],function(_0x1c6872){return{'name':_0x1c6872[_0x640c('0x35')],'type':_0x1c6872[_0x640c('0x36')][_0x640c('0x37')]};});_0x1aeeb0[_0x640c('0x38')]=_[_0x640c('0x32')](_0x5c1d40,_0x640c('0x2f'));_0x1aeeb0[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x329b33[_0x640c('0x39')]);_0x1aeeb0[_0x640c('0x3b')]=_[_0x640c('0x3c')](_0x1aeeb0['model'],_0x1aeeb0['query']);_0x4105c2[_0x640c('0x3d')]=_['intersection'](_0x1aeeb0['model'],qs[_0x640c('0x3e')](_0x329b33['query'][_0x640c('0x3e')]));_0x4105c2[_0x640c('0x3d')]=_0x4105c2[_0x640c('0x3d')]['length']?_0x4105c2[_0x640c('0x3d')]:_0x1aeeb0['model'];if(!_0x329b33[_0x640c('0x39')][_0x640c('0x3f')]('nolimit')){_0x4105c2['limit']=qs[_0x640c('0x20')](_0x329b33[_0x640c('0x39')][_0x640c('0x20')]);_0x4105c2['offset']=qs[_0x640c('0x22')](_0x329b33[_0x640c('0x39')][_0x640c('0x22')]);}_0x4105c2[_0x640c('0x40')]=qs['sort'](_0x329b33[_0x640c('0x39')][_0x640c('0x41')]);_0x4105c2[_0x640c('0x42')]=qs[_0x640c('0x3b')](_['pick'](_0x329b33[_0x640c('0x39')],_0x1aeeb0[_0x640c('0x3b')]),_0x5c1d40);if(_0x329b33[_0x640c('0x39')][_0x640c('0x43')]){_0x4105c2[_0x640c('0x42')]=_[_0x640c('0x44')](_0x4105c2[_0x640c('0x42')],{'$or':_[_0x640c('0x32')](_0x5c1d40,function(_0x561ab2){if(_0x561ab2['type']!==_0x640c('0x45')){var _0x44e3db={};_0x44e3db[_0x561ab2[_0x640c('0x2f')]]={'$like':'%'+_0x329b33[_0x640c('0x39')]['filter']+'%'};return _0x44e3db;}})});}_0x4105c2=_[_0x640c('0x44')]({},_0x4105c2,_0x329b33[_0x640c('0x46')]);var _0xd52642={'where':_0x4105c2[_0x640c('0x42')]};return db['CmList'][_0x640c('0x21')](_0xd52642)[_0x640c('0x28')](function(_0x5dc90e){_0x310d8c[_0x640c('0x21')]=_0x5dc90e;if(_0x329b33[_0x640c('0x39')][_0x640c('0x47')]){_0x4105c2[_0x640c('0x48')]=[{'all':!![]}];}return db[_0x640c('0x33')][_0x640c('0x49')](_0x4105c2);})[_0x640c('0x28')](function(_0x1be9f7){_0x310d8c['rows']=_0x1be9f7;return _0x310d8c;})['then'](respondWithFilteredResult(_0x23b968,_0x4105c2))[_0x640c('0x4a')](handleError(_0x23b968,null));};exports[_0x640c('0x4b')]=function(_0xc7cd52,_0x173eaf){var _0x41b2e7={'raw':![],'where':{'id':_0xc7cd52[_0x640c('0x4c')]['id']}},_0xb50366={};_0xb50366['model']=_[_0x640c('0x3a')](db[_0x640c('0x33')]['rawAttributes']);_0xb50366['query']=_['keys'](_0xc7cd52[_0x640c('0x39')]);_0xb50366['filters']=_[_0x640c('0x3c')](_0xb50366[_0x640c('0x38')],_0xb50366[_0x640c('0x39')]);_0x41b2e7[_0x640c('0x3d')]=_[_0x640c('0x3c')](_0xb50366['model'],qs[_0x640c('0x3e')](_0xc7cd52[_0x640c('0x39')][_0x640c('0x3e')]));_0x41b2e7[_0x640c('0x3d')]=_0x41b2e7[_0x640c('0x3d')][_0x640c('0x4d')]?_0x41b2e7['attributes']:_0xb50366[_0x640c('0x38')];if(_0xc7cd52[_0x640c('0x39')][_0x640c('0x47')]){_0x41b2e7[_0x640c('0x48')]=[{'all':!![]}];}_0x41b2e7=_[_0x640c('0x44')]({},_0x41b2e7,_0xc7cd52[_0x640c('0x46')]);return db[_0x640c('0x33')]['find'](_0x41b2e7)[_0x640c('0x28')](handleEntityNotFound(_0x173eaf,null))['then'](respondWithResult(_0x173eaf,null))[_0x640c('0x4a')](handleError(_0x173eaf,null));};exports[_0x640c('0x4e')]=function(_0x53bccc,_0x4d62c9){return db[_0x640c('0x33')][_0x640c('0x4e')](_0x53bccc[_0x640c('0x4f')],{})['then'](function(_0x270209){var _0x4732b2=_0x53bccc[_0x640c('0x50')][_0x640c('0x2a')]({'plain':!![]});if(!_0x4732b2)throw new Error(_0x640c('0x51'));if(_0x4732b2[_0x640c('0x52')]===_0x640c('0x50')){var _0x3e88e6=_0x270209[_0x640c('0x2a')]({'plain':!![]});var _0x31e946=_0x640c('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x31e946,'userProfileId':_0x4732b2[_0x640c('0x54')]},'raw':!![]})['then'](function(_0x141558){if(_0x141558&&_0x141558[_0x640c('0x55')]===0x0){return db['UserProfileResource'][_0x640c('0x4e')]({'name':_0x3e88e6[_0x640c('0x2f')],'resourceId':_0x3e88e6['id'],'type':_0x141558[_0x640c('0x2f')],'sectionId':_0x141558['id']},{})[_0x640c('0x28')](function(){return _0x270209;});}else{return _0x270209;}})[_0x640c('0x4a')](function(_0x468b9a){logger[_0x640c('0x2d')](_0x640c('0x56'),_0x468b9a);throw _0x468b9a;});}return _0x270209;})['then'](respondWithResult(_0x4d62c9,0xc9))[_0x640c('0x4a')](handleError(_0x4d62c9,null));};exports[_0x640c('0x27')]=function(_0x25e468,_0x22b276){if(_0x25e468['body']['id']){delete _0x25e468['body']['id'];}return db['CmList'][_0x640c('0x57')]({'where':{'id':_0x25e468[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x22b276,null))[_0x640c('0x28')](saveUpdates(_0x25e468['body'],null))[_0x640c('0x28')](respondWithResult(_0x22b276,null))[_0x640c('0x4a')](handleError(_0x22b276,null));};exports[_0x640c('0x29')]=function(_0x9a9122,_0x303f6c){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x9a9122['params']['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x303f6c,null))[_0x640c('0x28')](removeEntity(_0x303f6c,null))['catch'](handleError(_0x303f6c,null));};exports[_0x640c('0x58')]=function(_0x3873c5,_0x2b2318){return db[_0x640c('0x33')][_0x640c('0x58')]()[_0x640c('0x28')](respondWithResult(_0x2b2318,null))['catch'](handleError(_0x2b2318,null));};exports[_0x640c('0x59')]=function(_0x24fdf8,_0x2de7ac,_0x51b4f4){if(_0x24fdf8['body']['id']){delete _0x24fdf8[_0x640c('0x4f')]['id'];}return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x24fdf8['params']['id']}})['then'](handleEntityNotFound(_0x2de7ac,null))[_0x640c('0x28')](function(_0x134c2f){if(_0x134c2f){_0x24fdf8[_0x640c('0x4f')][_0x640c('0x5a')]=_0x134c2f['id'];return db[_0x640c('0x5b')]['create'](_0x24fdf8['body']);}})['then'](respondWithResult(_0x2de7ac,null))[_0x640c('0x4a')](handleError(_0x2de7ac,null));};exports[_0x640c('0x5c')]=function(_0x5c2ad2,_0x234ac6,_0xa2435d){var _0x12dad0={'raw':![],'where':{}};var _0x15e4e3={};var _0x474315={'count':0x0,'rows':[]};return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x5c2ad2['params']['id']}})['then'](handleEntityNotFound(_0x234ac6,null))[_0x640c('0x28')](function(_0x1bfeed){if(_0x1bfeed){_0x15e4e3[_0x640c('0x38')]=_['keys'](db[_0x640c('0x5b')]['rawAttributes']);_0x15e4e3[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x5c2ad2[_0x640c('0x39')]);_0x15e4e3[_0x640c('0x3b')]=_[_0x640c('0x3c')](_0x15e4e3['model'],_0x15e4e3[_0x640c('0x39')]);_0x12dad0[_0x640c('0x3d')]=_[_0x640c('0x3c')](_0x15e4e3[_0x640c('0x38')],qs['fields'](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x3e')]));_0x12dad0['attributes']=_0x12dad0[_0x640c('0x3d')][_0x640c('0x4d')]?_0x12dad0[_0x640c('0x3d')]:_0x15e4e3[_0x640c('0x38')];if(!_0x5c2ad2[_0x640c('0x39')][_0x640c('0x3f')]('nolimit')){_0x12dad0[_0x640c('0x20')]=qs[_0x640c('0x20')](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x20')]);_0x12dad0[_0x640c('0x22')]=qs[_0x640c('0x22')](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x22')]);}_0x12dad0[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x41')]);_0x12dad0[_0x640c('0x42')]=qs['filters'](_[_0x640c('0x5e')](_0x5c2ad2[_0x640c('0x39')],_0x15e4e3[_0x640c('0x3b')]));_0x12dad0['where'][_0x640c('0x5a')]=_0x1bfeed['id'];if(_0x5c2ad2['query'][_0x640c('0x43')]){_0x12dad0['where']=_[_0x640c('0x44')](_0x12dad0['where'],{'$or':_[_0x640c('0x32')](_0x12dad0[_0x640c('0x3d')],function(_0x28cd58){var _0x5ef1b4={};_0x5ef1b4[_0x28cd58]={'$like':'%'+_0x5c2ad2['query'][_0x640c('0x43')]+'%'};return _0x5ef1b4;})});}_0x12dad0=_[_0x640c('0x44')]({},_0x12dad0,_0x5c2ad2[_0x640c('0x46')]);return db[_0x640c('0x5b')][_0x640c('0x21')]({'where':_0x12dad0[_0x640c('0x42')]})[_0x640c('0x28')](function(_0x422bc1){_0x474315['count']=_0x422bc1;if(_0x5c2ad2[_0x640c('0x39')][_0x640c('0x47')]){_0x12dad0['include']=[{'all':!![]}];}return db[_0x640c('0x5b')][_0x640c('0x49')](_0x12dad0);})['then'](function(_0x4eea51){_0x474315[_0x640c('0x5f')]=_0x4eea51;return _0x474315;});}})['then'](respondWithFilteredResult(_0x234ac6,_0x12dad0))['catch'](handleError(_0x234ac6,null));};exports[_0x640c('0x60')]=function(_0x17fc8b,_0x946196,_0x427f97){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x17fc8b[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x946196,null))[_0x640c('0x28')](function(_0x34e887){if(_0x34e887){return _0x34e887[_0x640c('0x60')](_0x17fc8b[_0x640c('0x39')]['ids']);}})[_0x640c('0x28')](respondWithStatusCode(_0x946196,null))['catch'](handleError(_0x946196,null));};exports[_0x640c('0x61')]=function(_0x5ec07f,_0x5711d5,_0x3563ae){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x5ec07f['params']['id']}})['then'](handleEntityNotFound(_0x5711d5,null))[_0x640c('0x28')](function(_0x231d96){if(_0x231d96){var _0x205a0c=[];var _0x326c2f={'success':[],'errors':[]};return db[_0x640c('0x62')]['describe']()[_0x640c('0x28')](function(_0x5a0aed){if(_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]&&_['isArray'](_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')])){if(_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')][_0x640c('0x4d')]){_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]=_0x5ec07f['body'][_0x640c('0x63')]['join'](';')+';';}else{_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]=null;}}else{_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]=null;}if(_0x5ec07f['body']&&_[_0x640c('0x64')](_0x5ec07f[_0x640c('0x4f')])){for(var _0x43fd1b=0x0;_0x43fd1b<_0x5ec07f[_0x640c('0x4f')][_0x640c('0x4d')];_0x43fd1b+=0x1){_0x5ec07f[_0x640c('0x4f')][_0x43fd1b]['ListId']=_0x5ec07f[_0x640c('0x4c')]['id'];_0x205a0c[_0x640c('0x65')](_0x5ec07f[_0x640c('0x4f')][_0x43fd1b]);}return BPromise[_0x640c('0x66')](_0x205a0c,function(_0x473916){return db['CmContact'][_0x640c('0x4e')](_[_0x640c('0x67')](_0x473916,['ids','id'])||{},{'fields':_[_0x640c('0x3a')](_0x5a0aed),'raw':!![]})[_0x640c('0x28')](function(_0x4bf37a){_0x326c2f[_0x640c('0x68')][_0x640c('0x65')](_0x4bf37a['dataValues']);})[_0x640c('0x4a')](function(_0x44622b){_0x326c2f['errors']['push']({'data':_0x473916,'error':_0x44622b[_0x640c('0x69')]});});})[_0x640c('0x28')](function(_0x41415f){return _0x326c2f;})[_0x640c('0x4a')](function(_0x8fe5c0){return _0x8fe5c0;});}else{_0x5711d5[_0x640c('0x1e')](0x190)[_0x640c('0x1f')]({'message':_0x640c('0x6a')});}});}})[_0x640c('0x28')](respondWithResult(_0x5711d5,null))[_0x640c('0x4a')](handleError(_0x5711d5,null));};exports['getContacts']=function(_0x32e332,_0x291c59,_0x3a9bbe){var _0x21c73f;return db[_0x640c('0x33')]['find']({'where':{'id':_0x32e332[_0x640c('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x640c('0x6b')}]})['then'](handleEntityNotFound(_0x291c59,null))[_0x640c('0x28')](function(_0x4a6212){if(_0x4a6212){_0x21c73f=_0x4a6212;return db[_0x640c('0x62')][_0x640c('0x34')];}})['then'](function(_0x51fb88){if(_0x51fb88){var _0x2a874f={};var _0x32dab3={};_0x32dab3[_0x640c('0x38')]=_[_0x640c('0x6c')](_[_0x640c('0x3a')](_0x51fb88),_['map'](_0x21c73f[_0x640c('0x6b')],function(_0x27cae9){return util[_0x640c('0x6d')](_0x640c('0x6e'),_0x27cae9['id']);}));_0x32dab3[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x32e332[_0x640c('0x39')]);_0x32dab3['filters']=_[_0x640c('0x3c')](_0x32dab3[_0x640c('0x38')],_0x32dab3[_0x640c('0x39')]);_0x2a874f[_0x640c('0x3d')]=_[_0x640c('0x3c')](_0x32dab3[_0x640c('0x38')],qs['fields'](_0x32e332['query'][_0x640c('0x3e')]));_0x2a874f[_0x640c('0x3d')]=_0x2a874f[_0x640c('0x3d')]['length']?_0x2a874f[_0x640c('0x3d')]:_0x32dab3[_0x640c('0x38')];if(!_0x32e332['query'][_0x640c('0x3f')](_0x640c('0x6f'))){_0x2a874f[_0x640c('0x20')]=qs['limit'](_0x32e332['query']['limit']);_0x2a874f[_0x640c('0x22')]=qs[_0x640c('0x22')](_0x32e332[_0x640c('0x39')][_0x640c('0x22')]);}_0x2a874f[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x32e332['query']['sort']);_0x2a874f[_0x640c('0x42')]=qs[_0x640c('0x3b')](_[_0x640c('0x5e')](_0x32e332[_0x640c('0x39')],_0x32dab3[_0x640c('0x3b')]));_0x2a874f['raw']=!![];if(_0x32e332[_0x640c('0x39')]['filter']){_0x2a874f[_0x640c('0x42')]=_[_0x640c('0x44')](_0x2a874f[_0x640c('0x42')],{'$or':_['map'](_0x2a874f[_0x640c('0x3d')],function(_0x481d4d){var _0x2eef73={};_0x2eef73[_0x481d4d]={'$like':'%'+_0x32e332[_0x640c('0x39')][_0x640c('0x43')]+'%'};return _0x2eef73;})});}_0x2a874f=_[_0x640c('0x44')]({},_0x2a874f,_0x32e332[_0x640c('0x46')]);return _0x21c73f[_0x640c('0x70')](_0x2a874f);}})[_0x640c('0x28')](respondWithResult(_0x291c59,null))[_0x640c('0x4a')](handleError(_0x291c59,null));};exports['getContactsCsv']=function(_0x266f2a,_0x22a3f7,_0x484f89){var _0x148a92;var _0x1da114;var _0x4ba7a9;var _0x910e35=_0x266f2a['params']['id'];csv_results=[];return db['ContactItemType'][_0x640c('0x49')]({'attributes':['id',_0x640c('0x2f')],'raw':!![],'order':[_0x640c('0x71')]})[_0x640c('0x28')](function(_0x222eb7){_0x148a92=_0x222eb7;var _0xb24c3f=_[_0x640c('0x3a')](db[_0x640c('0x62')][_0x640c('0x34')]);return db['CmCustomField'][_0x640c('0x49')]({'raw':!![],'attributes':['id','alias']})[_0x640c('0x28')](function(_0x375348){_0x1da114=_0x375348;var _0x553349=squel[_0x640c('0x72')]()[_0x640c('0x3e')](_0xb24c3f)['from']('cm_contacts','c')[_0x640c('0x42')]('c.ListId\x20=\x20?',_0x910e35)[_0x640c('0x42')](_0x640c('0x73'))[_0x640c('0x74')]();for(var _0x39f8b7=0x0;_0x39f8b7<_0x1da114[_0x640c('0x4d')];_0x39f8b7++){_0x553349[_0x640c('0x75')](_0x640c('0x76')+_0x1da114[_0x39f8b7]['id'],_0x640c('0x77')+_0x1da114[_0x39f8b7][_0x640c('0x78')]);}for(var _0x39f8b7=0x0;_0x39f8b7<_0x148a92[_0x640c('0x4d')];_0x39f8b7++){_0x553349[_0x640c('0x75')](squel[_0x640c('0x72')]()['field']('item')[_0x640c('0x79')](_0x640c('0x7a'))[_0x640c('0x42')](_0x640c('0x7b'),_0x148a92[_0x39f8b7]['id'])[_0x640c('0x42')](_0x640c('0x7c')),_0x640c('0x7d')+_0x148a92[_0x39f8b7][_0x640c('0x2f')]);_0x553349[_0x640c('0x75')](squel['select']()[_0x640c('0x75')](_0x640c('0x7e'))[_0x640c('0x79')]('cm_contact_has_items')[_0x640c('0x42')]('ItemTypeId\x20=\x20?',_0x148a92[_0x39f8b7]['id'])[_0x640c('0x42')](_0x640c('0x7c')),'description_additionalPhone_'+_0x148a92[_0x39f8b7]['name']);}var _0x4b4a88=[];_0x4b4a88[_0x640c('0x65')](_0x553349['toString']());BPromise[_0x640c('0x66')](_0x4b4a88,handleQuery)['then'](function(_0x1bec37){handleQuery(_0x553349['toString']());var _0x36365a=csv_results[0x0];if(!_[_0x640c('0x7f')](_0x36365a)){var _0x12d3c6=toCsv(_0x36365a);var _0x4e67c3=Date[_0x640c('0x80')]();fs[_0x640c('0x81')](util['format']('/tmp/list_%d_%s.csv',_0x910e35,_0x4e67c3),_0x12d3c6);_0x22a3f7[_0x640c('0x82')](_0x640c('0x83'),_0x640c('0x84')+util[_0x640c('0x6d')](_0x640c('0x85'),_0x910e35,_0x4e67c3));_0x22a3f7['setHeader'](_0x640c('0x86'),_0x640c('0x87'));return _0x22a3f7[_0x640c('0x88')](util['format'](_0x640c('0x89'),_0x910e35,_0x4e67c3));}else{return _0x22a3f7['sendStatus'](0xcc);}});});});};exports[_0x640c('0x8a')]=function(_0x141368,_0x17bbf5,_0x5b455d){var _0x4ac4ff;delete _0x141368[_0x640c('0x4f')]['id'];return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x141368[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x17bbf5,null))[_0x640c('0x28')](function(_0x5794c1){if(_0x5794c1){return db['sequelize']['transaction'](function(_0x59ef5b){return db[_0x640c('0x8b')][_0x640c('0x4e')](_0x141368[_0x640c('0x4f')],{'transaction':_0x59ef5b})['then'](function(_0x8bab2d){_0x4ac4ff=_0x8bab2d;return _0x5794c1[_0x640c('0x8c')](_0x8bab2d,{'transaction':_0x59ef5b});})[_0x640c('0x28')](function(){var _0x4b1c13={'type':db['Sequelize'][_0x640c('0x8d')],'transaction':_0x59ef5b};switch(_0x141368[_0x640c('0x4f')]['type']){case _0x640c('0x8e'):_0x4b1c13[_0x640c('0x36')]=db[_0x640c('0x8f')][_0x640c('0x8d')];break;case'number':_0x4b1c13[_0x640c('0x36')]=db[_0x640c('0x8f')]['INTEGER'];break;case _0x640c('0x90'):_0x4b1c13[_0x640c('0x36')]=db[_0x640c('0x8f')]['BOOLEAN'];_0x4b1c13['defaultValue']=![];break;default:}return db[_0x640c('0x91')]['queryInterface'][_0x640c('0x92')](_0x640c('0x93'),util['format'](_0x640c('0x94'),_0x4ac4ff['id']),_0x4b1c13);})[_0x640c('0x28')](function(){return _0x4ac4ff;});});}})[_0x640c('0x28')](respondWithResult(_0x17bbf5,null))[_0x640c('0x4a')](handleError(_0x17bbf5,null));};exports['getCustomFields']=function(_0x557713,_0x2e0d4c,_0x4e4871){var _0x3780ad={};var _0x35ebb5={};var _0x449296;var _0x38c96a;return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x557713[_0x640c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e0d4c,null))[_0x640c('0x28')](function(_0x450c45){if(_0x450c45){_0x449296=_0x450c45;_0x35ebb5[_0x640c('0x38')]=_[_0x640c('0x3a')](db[_0x640c('0x8b')][_0x640c('0x34')]);_0x35ebb5['query']=_['keys'](_0x557713['query']);_0x35ebb5[_0x640c('0x3b')]=_['intersection'](_0x35ebb5['model'],_0x35ebb5[_0x640c('0x39')]);_0x3780ad[_0x640c('0x3d')]=_['intersection'](_0x35ebb5[_0x640c('0x38')],qs[_0x640c('0x3e')](_0x557713[_0x640c('0x39')]['fields']));_0x3780ad[_0x640c('0x3d')]=_0x3780ad['attributes'][_0x640c('0x4d')]?_0x3780ad[_0x640c('0x3d')]:_0x35ebb5[_0x640c('0x38')];_0x3780ad[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x557713[_0x640c('0x39')][_0x640c('0x41')]);_0x3780ad['where']=qs[_0x640c('0x3b')](_[_0x640c('0x5e')](_0x557713[_0x640c('0x39')],_0x35ebb5['filters']));_0x3780ad[_0x640c('0x42')]=_[_0x640c('0x44')](_0x3780ad[_0x640c('0x42')],{'$or':[{'ListId':_0x450c45['id']},{'ListId':null}]});if(_0x557713[_0x640c('0x39')][_0x640c('0x43')]){_0x3780ad[_0x640c('0x42')]=_[_0x640c('0x44')](_0x3780ad[_0x640c('0x42')],{'$or':_[_0x640c('0x32')](_0x3780ad['attributes'],function(_0x448efd){var _0x1565f2={};_0x1565f2[_0x448efd]={'$like':'%'+_0x557713[_0x640c('0x39')]['filter']+'%'};return _0x1565f2;})});}_0x3780ad=_[_0x640c('0x44')]({},_0x3780ad,_0x557713[_0x640c('0x46')]);return db[_0x640c('0x8b')]['findAndCountAll'](_0x3780ad);}})[_0x640c('0x28')](respondWithResult(_0x2e0d4c,null))['catch'](handleError(_0x2e0d4c,null));};exports[_0x640c('0x95')]=function(_0x5f5249,_0x1632a6){return db[_0x640c('0x8b')]['findAndCountAll']({'where':{'ListId':null}})[_0x640c('0x28')](handleEntityNotFound(_0x1632a6,null))[_0x640c('0x28')](function(_0x2de780){return _0x2de780;})['then'](respondWithResult(_0x1632a6,null))[_0x640c('0x4a')](handleError(_0x1632a6,null));};exports[_0x640c('0x96')]=function(_0x141639,_0x4bf2d0,_0x2ee3e4){return db[_0x640c('0x33')]['find']({'where':{'id':_0x141639[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x4bf2d0,null))[_0x640c('0x28')](function(_0x2ab0ac){if(_0x2ab0ac){return _0x2ab0ac[_0x640c('0x96')](_0x141639['body']['ids'],_['omit'](_0x141639['body'],[_0x640c('0x97'),'id'])||{})[_0x640c('0x98')](function(_0x4bacf4){for(var _0x109484=0x0;_0x109484<_0x141639[_0x640c('0x4f')][_0x640c('0x97')][_0x640c('0x4d')];_0x109484+=0x1){socket[_0x640c('0x99')](_0x640c('0x9a'),{'UserId':Number(_0x141639[_0x640c('0x4f')][_0x640c('0x97')][_0x109484]),'CmListId':Number(_0x141639[_0x640c('0x4c')]['id'])});}return _0x4bacf4;});}})['then'](respondWithResult(_0x4bf2d0,null))[_0x640c('0x4a')](handleError(_0x4bf2d0,null));};exports['removeAgents']=function(_0xdc53fb,_0x56a777,_0x53fbac){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0xdc53fb[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x56a777,null))[_0x640c('0x28')](function(_0x12285a){if(_0x12285a){return _0x12285a[_0x640c('0x9b')](_0xdc53fb[_0x640c('0x39')]['ids'])[_0x640c('0x28')](function(){if(_[_0x640c('0x64')](_0xdc53fb[_0x640c('0x39')]['ids'])){for(var _0x2e08ee=0x0;_0x2e08ee<_0xdc53fb['query'][_0x640c('0x97')][_0x640c('0x4d')];_0x2e08ee+=0x1){socket[_0x640c('0x99')]('userCmList:remove',{'UserId':Number(_0xdc53fb['query'][_0x640c('0x97')][_0x2e08ee]),'CmListId':Number(_0xdc53fb[_0x640c('0x4c')]['id'])});}}else{socket[_0x640c('0x99')](_0x640c('0x9c'),{'UserId':Number(_0xdc53fb[_0x640c('0x39')]['ids']),'CmListId':Number(_0xdc53fb['params']['id'])});}});}})[_0x640c('0x28')](respondWithStatusCode(_0x56a777,null))[_0x640c('0x4a')](handleError(_0x56a777,null));};exports[_0x640c('0x9d')]=function(_0x5da384,_0x1b9ff2,_0x1ea3d3){var _0xd761c1={};var _0x28775f={};var _0x56f514;var _0x23ec61;return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x5da384[_0x640c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b9ff2,null))['then'](function(_0x194de8){if(_0x194de8){_0x56f514=_0x194de8;_0x28775f[_0x640c('0x38')]=_[_0x640c('0x3a')](db[_0x640c('0x9e')][_0x640c('0x34')]);_0x28775f[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x5da384[_0x640c('0x39')]);_0x28775f[_0x640c('0x3b')]=_[_0x640c('0x3c')](_0x28775f['model'],_0x28775f[_0x640c('0x39')]);_0xd761c1[_0x640c('0x3d')]=_['intersection'](_0x28775f[_0x640c('0x38')],qs[_0x640c('0x3e')](_0x5da384['query'][_0x640c('0x3e')]));_0xd761c1[_0x640c('0x3d')]=_0xd761c1[_0x640c('0x3d')]['length']?_0xd761c1[_0x640c('0x3d')]:_0x28775f[_0x640c('0x38')];_0xd761c1[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x5da384[_0x640c('0x39')][_0x640c('0x41')]);_0xd761c1[_0x640c('0x42')]=qs['filters'](_[_0x640c('0x5e')](_0x5da384[_0x640c('0x39')],_0x28775f[_0x640c('0x3b')]));if(_0x5da384[_0x640c('0x39')][_0x640c('0x43')]){_0xd761c1['where']=_[_0x640c('0x44')](_0xd761c1[_0x640c('0x42')],{'$or':_['map'](_0xd761c1[_0x640c('0x3d')],function(_0x21bfa8){var _0x4c1b8a={};_0x4c1b8a[_0x21bfa8]={'$like':'%'+_0x5da384['query']['filter']+'%'};return _0x4c1b8a;})});}_0xd761c1=_[_0x640c('0x44')]({},_0xd761c1,_0x5da384[_0x640c('0x46')]);return _0x56f514['getAgents'](_0xd761c1);}})[_0x640c('0x28')](function(_0x554607){if(_0x554607){_0x23ec61=_0x554607[_0x640c('0x4d')];if(!_0x5da384[_0x640c('0x39')]['hasOwnProperty'](_0x640c('0x6f'))){_0xd761c1['limit']=qs['limit'](_0x5da384['query']['limit']);_0xd761c1[_0x640c('0x22')]=qs[_0x640c('0x22')](_0x5da384['query'][_0x640c('0x22')]);}return _0x56f514[_0x640c('0x9d')](_0xd761c1);}})['then'](function(_0xfccbdd){if(_0xfccbdd){return _0xfccbdd?{'count':_0x23ec61,'rows':_0xfccbdd}:null;}})[_0x640c('0x28')](respondWithResult(_0x1b9ff2,null))[_0x640c('0x4a')](handleError(_0x1b9ff2,null));};function handleQuery(_0x9d683c){logger[_0x640c('0x9f')](_0x9d683c);return db[_0x640c('0x91')][_0x640c('0x39')](_0x9d683c)[_0x640c('0x98')](function(_0x3fe76b){csv_results[_0x640c('0x65')](_0x3fe76b);})[_0x640c('0x4a')](function(_0x52450a){logger[_0x640c('0x2d')](_0x52450a['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e3788f1..68bb52f 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 _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 +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2fc2e4,_0xf15e31){var _0x21d7b3=function(_0xa09ad0){while(--_0xa09ad0){_0x2fc2e4['push'](_0x2fc2e4['shift']());}};_0x21d7b3(++_0xf15e31);}(_0x814b,0x1a2));var _0xb814=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0x814b[_0x270dba];return _0x36b83b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 2b5572d..b6173a5 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 _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 +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xe14d,0x1ee));var _0xde14=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xe14d[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('CmList',attributes,{'tableName':_0xde14('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 c2a7eb5..2e22a0c 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 _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 +var _0xd82f=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2c1d3a,_0x43cdf5){var _0x1f93c4=function(_0x19ae7e){while(--_0x19ae7e){_0x2c1d3a['push'](_0x2c1d3a['shift']());}};_0x1f93c4(++_0x43cdf5);}(_0xd82f,0x121));var _0xfd82=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd82f[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xfd82('0x0'));var util=require(_0xfd82('0x1'));var moment=require(_0xfd82('0x2'));var BPromise=require(_0xfd82('0x3'));var rs=require(_0xfd82('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd82('0x5'))['db'];var utils=require(_0xfd82('0x6'));var logger=require(_0xfd82('0x7'))(_0xfd82('0x8'));var config=require(_0xfd82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfd82('0xa')][_0xfd82('0xb')]({'port':0x232a});config[_0xfd82('0xc')]=_[_0xfd82('0xd')](config[_0xfd82('0xc')],{'host':_0xfd82('0xe'),'port':0x18eb});var socket=require(_0xfd82('0xf'))(new Redis(config[_0xfd82('0xc')]));require(_0xfd82('0x10'))[_0xfd82('0x11')](socket);function respondWithRpcPromise(_0x6e8740,_0x31295f,_0x497d9b){return new BPromise(function(_0x5c9a16,_0x2179e8){return client['request'](_0x6e8740,_0x497d9b)[_0xfd82('0x12')](function(_0x18731b){logger[_0xfd82('0x13')](_0xfd82('0x14'),_0x31295f,_0xfd82('0x15'));logger[_0xfd82('0x16')](_0xfd82('0x17'),_0x31295f,_0xfd82('0x15'),JSON[_0xfd82('0x18')](_0x18731b));if(_0x18731b[_0xfd82('0x19')]){if(_0x18731b['error'][_0xfd82('0x1a')]===0x1f4){logger[_0xfd82('0x19')]('CmList,\x20%s,\x20%s',_0x31295f,_0x18731b[_0xfd82('0x19')][_0xfd82('0x1b')]);return _0x2179e8(_0x18731b['error'][_0xfd82('0x1b')]);}logger[_0xfd82('0x19')](_0xfd82('0x14'),_0x31295f,_0x18731b['error'][_0xfd82('0x1b')]);return _0x5c9a16(_0x18731b[_0xfd82('0x19')][_0xfd82('0x1b')]);}else{logger[_0xfd82('0x13')](_0xfd82('0x14'),_0x31295f,_0xfd82('0x15'));_0x5c9a16(_0x18731b[_0xfd82('0x1c')]['message']);}})['catch'](function(_0x5a8fdb){logger[_0xfd82('0x19')](_0xfd82('0x14'),_0x31295f,_0x5a8fdb);_0x2179e8(_0x5a8fdb);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 76e62eb..d42a671 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 _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 +var _0xc84b=['length','cmList:','./cmList.events','save','remove','update','emit','removeListener','register'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc84b,0x173));var _0xbc84=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xc84b[_0x2aea9e];return _0x430b92;};'use strict';var CmListEvents=require(_0xbc84('0x0'));var events=[_0xbc84('0x1'),_0xbc84('0x2'),_0xbc84('0x3')];function createListener(_0xf6af18,_0x52d33c){return function(_0x4ef69f){_0x52d33c[_0xbc84('0x4')](_0xf6af18,_0x4ef69f);};}function removeListener(_0x4ef3a8,_0x12c5d2){return function(){CmListEvents[_0xbc84('0x5')](_0x4ef3a8,_0x12c5d2);};}exports[_0xbc84('0x6')]=function(_0xe010fb){for(var _0x2f22d7=0x0,_0x2c10d1=events[_0xbc84('0x7')];_0x2f22d7<_0x2c10d1;_0x2f22d7++){var _0x385cab=events[_0x2f22d7];var _0x5f4e35=createListener(_0xbc84('0x8')+_0x385cab,_0xe010fb);CmListEvents['on'](_0x385cab,_0x5f4e35);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7ea9b9c..6152ffc 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 _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 +var _0x2875=['/:id/fields','getCustomFields','post','addDisposition','/:id/contacts','addAgents','delete','removeDispositions','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','getContactsCsv'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2875,0x14b));var _0x5287=function(_0x389a61,_0x20216c){_0x389a61=_0x389a61-0x0;var _0x1acde9=_0x2875[_0x389a61];return _0x1acde9;};'use strict';var multer=require(_0x5287('0x0'));var util=require(_0x5287('0x1'));var path=require(_0x5287('0x2'));var timeout=require(_0x5287('0x3'));var express=require(_0x5287('0x4'));var router=express[_0x5287('0x5')]();var fs_extra=require(_0x5287('0x6'));var auth=require(_0x5287('0x7'));var interaction=require(_0x5287('0x8'));var config=require(_0x5287('0x9'));var controller=require('./cmList.controller');router[_0x5287('0xa')]('/',auth[_0x5287('0xb')](),controller[_0x5287('0xc')]);router[_0x5287('0xa')](_0x5287('0xd'),auth[_0x5287('0xb')](),controller[_0x5287('0xe')]);router['get'](_0x5287('0xf'),auth[_0x5287('0xb')](),controller[_0x5287('0x10')]);router[_0x5287('0xa')](_0x5287('0x11'),auth[_0x5287('0xb')](),controller['show']);router[_0x5287('0xa')](_0x5287('0x12'),auth[_0x5287('0xb')](),controller[_0x5287('0x13')]);router[_0x5287('0xa')]('/:id/contacts',auth[_0x5287('0xb')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x5287('0x14')]);router['get'](_0x5287('0x15'),auth[_0x5287('0xb')](),controller[_0x5287('0x16')]);router[_0x5287('0xa')]('/:id/users',auth[_0x5287('0xb')](),controller['getAgents']);router[_0x5287('0x17')]('/',auth[_0x5287('0xb')](),controller['create']);router[_0x5287('0x17')]('/:id/dispositions',auth[_0x5287('0xb')](),controller[_0x5287('0x18')]);router[_0x5287('0x17')](_0x5287('0x19'),auth[_0x5287('0xb')](),controller['addContacts']);router[_0x5287('0x17')](_0x5287('0x15'),auth[_0x5287('0xb')](),controller['addCustomField']);router['post']('/:id/users',auth[_0x5287('0xb')](),controller[_0x5287('0x1a')]);router['put'](_0x5287('0x11'),auth[_0x5287('0xb')](),controller['update']);router['delete'](_0x5287('0x11'),auth[_0x5287('0xb')](),controller['destroy']);router[_0x5287('0x1b')](_0x5287('0x12'),auth[_0x5287('0xb')](),controller[_0x5287('0x1c')]);router[_0x5287('0x1b')](_0x5287('0x1d'),auth[_0x5287('0xb')](),controller[_0x5287('0x1e')]);module[_0x5287('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a0ff33d..8e9921d 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 _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 +var _0x5ebb=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5ebb,0x1c7));var _0xb5eb=function(_0x3db5a3,_0x55994c){_0x3db5a3=_0x3db5a3-0x0;var _0x1afffe=_0x5ebb[_0x3db5a3];return _0x1afffe;};'use strict';var Sequelize=require(_0xb5eb('0x0'));module[_0xb5eb('0x1')]={'name':{'type':Sequelize[_0xb5eb('0x2')],'get':function(_0x2d610c){return this[_0xb5eb('0x3')](_0xb5eb('0x4'));}},'field':{'type':Sequelize[_0xb5eb('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xb5eb('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 000563e..793f458 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(_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 +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1f67f4,_0x1731db){var _0x2ac8d0=function(_0x898b1d){while(--_0x898b1d){_0x1f67f4['push'](_0x1f67f4['shift']());}};_0x2ac8d0(++_0x1731db);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8666c87..0a492fa 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 _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 +var _0x2651=['define','Condition','tools_conditions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2651,0x16f));var _0x1265=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x2651[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x1265('0x0'));var util=require(_0x1265('0x1'));var logger=require(_0x1265('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1265('0x3'));var rp=require(_0x1265('0x4'));var fs=require('fs');var path=require(_0x1265('0x5'));var rimraf=require(_0x1265('0x6'));var config=require(_0x1265('0x7'));var attributes=require(_0x1265('0x8'));module[_0x1265('0x9')]=function(_0x3fad58,_0x124c8d){return _0x3fad58[_0x1265('0xa')](_0x1265('0xb'),attributes,{'tableName':_0x1265('0xc'),'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 fce525e..1d1960f 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 _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 +var _0x16d6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x1db562,_0x290e26){var _0xa58473=function(_0x2e0afd){while(--_0x2e0afd){_0x1db562['push'](_0x1db562['shift']());}};_0xa58473(++_0x290e26);}(_0x16d6,0xae));var _0x616d=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x16d6[_0xaa6a4];return _0xdc31a4;};'use strict';var _=require(_0x616d('0x0'));var util=require(_0x616d('0x1'));var moment=require(_0x616d('0x2'));var BPromise=require(_0x616d('0x3'));var rs=require(_0x616d('0x4'));var fs=require('fs');var Redis=require(_0x616d('0x5'));var db=require(_0x616d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x616d('0x7'))(_0x616d('0x8'));var config=require('../../config/environment');var jayson=require(_0x616d('0x9'));var client=jayson['client'][_0x616d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eca6a,_0x18e341,_0x16304b){return new BPromise(function(_0x2e169b,_0x342e52){return client['request'](_0x3eca6a,_0x16304b)[_0x616d('0xb')](function(_0x3315c0){logger[_0x616d('0xc')](_0x616d('0xd'),_0x18e341,_0x616d('0xe'));logger[_0x616d('0xf')](_0x616d('0x10'),_0x18e341,_0x616d('0xe'),JSON[_0x616d('0x11')](_0x3315c0));if(_0x3315c0[_0x616d('0x12')]){if(_0x3315c0['error'][_0x616d('0x13')]===0x1f4){logger['error'](_0x616d('0xd'),_0x18e341,_0x3315c0['error'][_0x616d('0x14')]);return _0x342e52(_0x3315c0[_0x616d('0x12')]['message']);}logger[_0x616d('0x12')]('Condition,\x20%s,\x20%s',_0x18e341,_0x3315c0[_0x616d('0x12')][_0x616d('0x14')]);return _0x2e169b(_0x3315c0[_0x616d('0x12')][_0x616d('0x14')]);}else{logger[_0x616d('0xc')](_0x616d('0xd'),_0x18e341,_0x616d('0xe'));_0x2e169b(_0x3315c0[_0x616d('0x15')]['message']);}})['catch'](function(_0x2f76a3){logger[_0x616d('0x12')]('Condition,\x20%s,\x20%s',_0x18e341,_0x2f76a3);_0x342e52(_0x2f76a3);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9eadd73..2377dca 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 _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 +var _0xf567=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','destroy','exports'];(function(_0x54f11e,_0x2b3226){var _0x15e017=function(_0x49c028){while(--_0x49c028){_0x54f11e['push'](_0x54f11e['shift']());}};_0x15e017(++_0x2b3226);}(_0xf567,0x118));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var path=require(_0x7f56('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f56('0x3'));var router=express[_0x7f56('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f56('0x5'));var interaction=require(_0x7f56('0x6'));var config=require(_0x7f56('0x7'));var controller=require(_0x7f56('0x8'));router['put'](_0x7f56('0x9'),auth[_0x7f56('0xa')](),controller[_0x7f56('0xb')]);router['delete'](_0x7f56('0x9'),auth[_0x7f56('0xa')](),controller[_0x7f56('0xc')]);module[_0x7f56('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index a58a460..1acb40d 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 _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 +var _0xaeaa=['STRING','name','INTEGER','exports'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xaeaa,0xf3));var _0xaaea=function(_0x23f69e,_0x753e91){_0x23f69e=_0x23f69e-0x0;var _0x1b2a46=_0xaeaa[_0x23f69e];return _0x1b2a46;};'use strict';var Sequelize=require('sequelize');module[_0xaaea('0x0')]={'name':{'type':Sequelize[_0xaaea('0x1')],'allowNull':![],'unique':_0xaaea('0x2')},'OrderBy':{'type':Sequelize[_0xaaea('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaaea('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0abb2f8..b124b66 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 _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 +var _0x7708=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x7708,0x188));var _0x8770=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0x7708[_0x1ee9a1];return _0x21270f;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 8b8e9d7..1d8c007 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 _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 +var _0x36cb=['path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x36cb,0x17b));var _0xb36c=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x36cb[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xb36c('0x0'));var util=require('util');var logger=require(_0xb36c('0x1'))(_0xb36c('0x2'));var moment=require(_0xb36c('0x3'));var BPromise=require(_0xb36c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb36c('0x5'));var rimraf=require(_0xb36c('0x6'));var config=require('../../config/environment');var attributes=require(_0xb36c('0x7'));module[_0xb36c('0x8')]=function(_0x1abf5d,_0x109e83){return _0x1abf5d[_0xb36c('0x9')](_0xb36c('0xa'),attributes,{'tableName':_0xb36c('0xb'),'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 8649361..6d008d7 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 _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 +var _0x8443=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','ContactItemType,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8443,0x101));var _0x3844=function(_0xcc47fd,_0x3f5165){_0xcc47fd=_0xcc47fd-0x0;var _0x5e952d=_0x8443[_0xcc47fd];return _0x5e952d;};'use strict';var _=require(_0x3844('0x0'));var util=require(_0x3844('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3844('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3844('0x3'))['db'];var utils=require(_0x3844('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3844('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3844('0x6')][_0x3844('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x365778,_0x18c10b,_0x1910e8){return new BPromise(function(_0xcfecf9,_0x567467){return client[_0x3844('0x8')](_0x365778,_0x1910e8)[_0x3844('0x9')](function(_0x21a8c4){logger['info']('ContactItemType,\x20%s,\x20%s',_0x18c10b,'request\x20sent');logger[_0x3844('0xa')](_0x3844('0xb'),_0x18c10b,'request\x20sent',JSON[_0x3844('0xc')](_0x21a8c4));if(_0x21a8c4[_0x3844('0xd')]){if(_0x21a8c4[_0x3844('0xd')]['code']===0x1f4){logger[_0x3844('0xd')]('ContactItemType,\x20%s,\x20%s',_0x18c10b,_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);return _0x567467(_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);}logger[_0x3844('0xd')](_0x3844('0xf'),_0x18c10b,_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);return _0xcfecf9(_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);}else{logger[_0x3844('0x10')](_0x3844('0xf'),_0x18c10b,_0x3844('0x11'));_0xcfecf9(_0x21a8c4[_0x3844('0x12')]['message']);}})[_0x3844('0x13')](function(_0x599395){logger[_0x3844('0xd')]('ContactItemType,\x20%s,\x20%s',_0x18c10b,_0x599395);_0x567467(_0x599395);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 1ecf601..8b00d84 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 _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 +var _0x75ff=['create','put','update','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post'];(function(_0x9388c8,_0x2cdf84){var _0x6f1d3a=function(_0x6a3073){while(--_0x6a3073){_0x9388c8['push'](_0x9388c8['shift']());}};_0x6f1d3a(++_0x2cdf84);}(_0x75ff,0x1e1));var _0xf75f=function(_0x3efcd5,_0x9bbba3){_0x3efcd5=_0x3efcd5-0x0;var _0x54e50a=_0x75ff[_0x3efcd5];return _0x54e50a;};'use strict';var multer=require(_0xf75f('0x0'));var util=require('util');var path=require(_0xf75f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf75f('0x2'));var router=express['Router']();var fs_extra=require(_0xf75f('0x3'));var auth=require(_0xf75f('0x4'));var interaction=require(_0xf75f('0x5'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router['get']('/',auth[_0xf75f('0x6')](),controller[_0xf75f('0x7')]);router[_0xf75f('0x8')](_0xf75f('0x9'),auth[_0xf75f('0x6')](),controller[_0xf75f('0xa')]);router[_0xf75f('0xb')]('/',auth[_0xf75f('0x6')](),controller[_0xf75f('0xc')]);router[_0xf75f('0xd')](_0xf75f('0x9'),auth['isAuthenticated'](),controller[_0xf75f('0xe')]);router['delete']('/:id',auth[_0xf75f('0x6')](),controller[_0xf75f('0xf')]);module[_0xf75f('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 692d896..da72b80 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 _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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x2b062d,_0x39488e){var _0x51ddfd=function(_0x412ab6){while(--_0x412ab6){_0x2b062d['push'](_0x2b062d['shift']());}};_0x51ddfd(++_0x39488e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xb10b[_0x4b4f24];return _0x1c13d4;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a39d0aa..7857fce 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 _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 +var _0xc487=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','error','name','index','map','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','Dashboard','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','UserProfileResource','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report','reportType','attrRefresh','stringify','addItem','DashboardId','getItems','findOne','order','options','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end'];(function(_0x230b8d,_0xc7bd){var _0x499932=function(_0x3aec13){while(--_0x3aec13){_0x230b8d['push'](_0x230b8d['shift']());}};_0x499932(++_0xc7bd);}(_0xc487,0xe2));var _0x7c48=function(_0x2c9673,_0x296ba0){_0x2c9673=_0x2c9673-0x0;var _0x49c8b0=_0xc487[_0x2c9673];return _0x49c8b0;};'use strict';var emlformat=require(_0x7c48('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c48('0x1'));var rp=require(_0x7c48('0x2'));var moment=require(_0x7c48('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7c48('0x4'));var util=require(_0x7c48('0x5'));var path=require(_0x7c48('0x6'));var sox=require('sox');var csv=require(_0x7c48('0x7'));var ejs=require(_0x7c48('0x8'));var fs=require('fs');var fs_extra=require(_0x7c48('0x9'));var _=require('lodash');var squel=require(_0x7c48('0xa'));var crypto=require(_0x7c48('0xb'));var jsforce=require(_0x7c48('0xc'));var deskjs=require(_0x7c48('0xd'));var toCsv=require(_0x7c48('0x7'));var querystring=require(_0x7c48('0xe'));var Papa=require(_0x7c48('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c48('0x10'));var as=require(_0x7c48('0x11'));var hardwareService=require(_0x7c48('0x12'));var logger=require('../../config/logger')(_0x7c48('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7c48('0x14'));var db=require(_0x7c48('0x15'))['db'];config[_0x7c48('0x16')]=_[_0x7c48('0x17')](config[_0x7c48('0x16')],{'host':_0x7c48('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c48('0x16')]));require(_0x7c48('0x19'))[_0x7c48('0x1a')](socket);function respondWithStatusCode(_0x3d212d,_0xadcccc){_0xadcccc=_0xadcccc||0xcc;return function(_0x4a3d04){if(_0x4a3d04){return _0x3d212d[_0x7c48('0x1b')](_0xadcccc);}return _0x3d212d[_0x7c48('0x1c')](_0xadcccc)[_0x7c48('0x1d')]();};}function respondWithResult(_0x555d24,_0x44d293){_0x44d293=_0x44d293||0xc8;return function(_0x174cb0){if(_0x174cb0){return _0x555d24[_0x7c48('0x1c')](_0x44d293)[_0x7c48('0x1e')](_0x174cb0);}};}function respondWithFilteredResult(_0x4dac0e,_0xa259b8){return function(_0x2aeea7){if(_0x2aeea7){var _0x109a5e=typeof _0xa259b8[_0x7c48('0x1f')]===_0x7c48('0x20')&&typeof _0xa259b8[_0x7c48('0x21')]===_0x7c48('0x20');var _0x365674=_0x2aeea7['count'];var _0x1b9165=_0x109a5e?0x0:_0xa259b8[_0x7c48('0x1f')];var _0x3a2a10=_0x109a5e?_0x2aeea7[_0x7c48('0x22')]:_0xa259b8[_0x7c48('0x1f')]+_0xa259b8[_0x7c48('0x21')];var _0xaa0d98;if(_0x3a2a10>=_0x365674){_0x3a2a10=_0x365674;_0xaa0d98=0xc8;}else{_0xaa0d98=0xce;}_0x4dac0e[_0x7c48('0x1c')](_0xaa0d98);return _0x4dac0e[_0x7c48('0x23')](_0x7c48('0x24'),_0x1b9165+'-'+_0x3a2a10+'/'+_0x365674)[_0x7c48('0x1e')](_0x2aeea7);}return null;};}function patchUpdates(_0x291e0f){return function(_0x14aad0){try{jsonpatch['apply'](_0x14aad0,_0x291e0f,!![]);}catch(_0x4e2e7e){return BPromise[_0x7c48('0x25')](_0x4e2e7e);}return _0x14aad0[_0x7c48('0x26')]();};}function saveUpdates(_0x498467,_0x4f68cb){return function(_0x4b87ae){if(_0x4b87ae){return _0x4b87ae[_0x7c48('0x27')](_0x498467)['then'](function(_0x1bd8d5){return _0x1bd8d5;});}return null;};}function removeEntity(_0x3fe201,_0x3a3490){return function(_0x352195){if(_0x352195){return _0x352195[_0x7c48('0x28')]()[_0x7c48('0x29')](function(){var _0x375f73=_0x352195[_0x7c48('0x2a')]({'plain':!![]});var _0x8dbe20='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x8dbe20,'resourceId':_0x375f73['id']}})['then'](function(){return _0x352195;});})[_0x7c48('0x29')](function(){_0x3fe201['status'](0xcc)[_0x7c48('0x1d')]();});}};}function handleEntityNotFound(_0x42696d,_0x47b368){return function(_0x1f02db){if(!_0x1f02db){_0x42696d['sendStatus'](0x194);}return _0x1f02db;};}function handleError(_0x400cbb,_0x2df3a4){_0x2df3a4=_0x2df3a4||0x1f4;return function(_0x5d4f92){logger[_0x7c48('0x2b')](_0x5d4f92['stack']);if(_0x5d4f92['name']){delete _0x5d4f92[_0x7c48('0x2c')];}_0x400cbb['status'](_0x2df3a4)['send'](_0x5d4f92);};}exports[_0x7c48('0x2d')]=function(_0x3aed6d,_0x5ecb96){var _0x5a76ed={},_0x27b729={},_0x5a559a={'count':0x0,'rows':[]};var _0x193695=_[_0x7c48('0x2e')](db['Dashboard']['rawAttributes'],function(_0x423190){return{'name':_0x423190[_0x7c48('0x2f')],'type':_0x423190[_0x7c48('0x30')][_0x7c48('0x31')]};});_0x27b729[_0x7c48('0x32')]=_['map'](_0x193695,_0x7c48('0x2c'));_0x27b729[_0x7c48('0x33')]=_['keys'](_0x3aed6d[_0x7c48('0x33')]);_0x27b729[_0x7c48('0x34')]=_['intersection'](_0x27b729[_0x7c48('0x32')],_0x27b729['query']);_0x5a76ed[_0x7c48('0x35')]=_['intersection'](_0x27b729['model'],qs[_0x7c48('0x36')](_0x3aed6d[_0x7c48('0x33')]['fields']));_0x5a76ed['attributes']=_0x5a76ed[_0x7c48('0x35')][_0x7c48('0x37')]?_0x5a76ed[_0x7c48('0x35')]:_0x27b729[_0x7c48('0x32')];if(!_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x38')](_0x7c48('0x39'))){_0x5a76ed[_0x7c48('0x21')]=qs[_0x7c48('0x21')](_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x21')]);_0x5a76ed['offset']=qs['offset'](_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x1f')]);}_0x5a76ed['order']=qs[_0x7c48('0x3a')](_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x3a')]);_0x5a76ed['where']=qs['filters'](_[_0x7c48('0x3b')](_0x3aed6d[_0x7c48('0x33')],_0x27b729['filters']),_0x193695);if(_0x3aed6d['query'][_0x7c48('0x3c')]){_0x5a76ed[_0x7c48('0x3d')]=_[_0x7c48('0x3e')](_0x5a76ed['where'],{'$or':_[_0x7c48('0x2e')](_0x193695,function(_0xee0241){if(_0xee0241[_0x7c48('0x30')]!==_0x7c48('0x3f')){var _0x1fc744={};_0x1fc744[_0xee0241[_0x7c48('0x2c')]]={'$like':'%'+_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x3c')]+'%'};return _0x1fc744;}})});}_0x5a76ed=_[_0x7c48('0x3e')]({},_0x5a76ed,_0x3aed6d['options']);var _0x5da741={'where':_0x5a76ed[_0x7c48('0x3d')]};return db[_0x7c48('0x40')][_0x7c48('0x22')](_0x5da741)[_0x7c48('0x29')](function(_0x175909){_0x5a559a[_0x7c48('0x22')]=_0x175909;if(_0x3aed6d['query']['includeAll']){_0x5a76ed[_0x7c48('0x41')]=[{'all':!![]}];}return db[_0x7c48('0x40')][_0x7c48('0x42')](_0x5a76ed);})[_0x7c48('0x29')](function(_0x59e197){_0x5a559a[_0x7c48('0x43')]=_0x59e197;return _0x5a559a;})[_0x7c48('0x29')](respondWithFilteredResult(_0x5ecb96,_0x5a76ed))[_0x7c48('0x44')](handleError(_0x5ecb96,null));};exports[_0x7c48('0x45')]=function(_0x6ba6bc,_0x1a4d26){var _0x5d09e0={'raw':![],'where':{'id':_0x6ba6bc[_0x7c48('0x46')]['id']}},_0xf61b9f={};_0xf61b9f[_0x7c48('0x32')]=_[_0x7c48('0x47')](db['Dashboard'][_0x7c48('0x48')]);_0xf61b9f[_0x7c48('0x33')]=_[_0x7c48('0x47')](_0x6ba6bc[_0x7c48('0x33')]);_0xf61b9f[_0x7c48('0x34')]=_[_0x7c48('0x49')](_0xf61b9f[_0x7c48('0x32')],_0xf61b9f[_0x7c48('0x33')]);_0x5d09e0[_0x7c48('0x35')]=_[_0x7c48('0x49')](_0xf61b9f['model'],qs['fields'](_0x6ba6bc[_0x7c48('0x33')][_0x7c48('0x36')]));_0x5d09e0[_0x7c48('0x35')]=_0x5d09e0[_0x7c48('0x35')][_0x7c48('0x37')]?_0x5d09e0[_0x7c48('0x35')]:_0xf61b9f[_0x7c48('0x32')];if(_0x6ba6bc[_0x7c48('0x33')][_0x7c48('0x4a')]){_0x5d09e0['include']=[{'all':!![]}];}_0x5d09e0=_[_0x7c48('0x3e')]({},_0x5d09e0,_0x6ba6bc['options']);return db[_0x7c48('0x40')]['find'](_0x5d09e0)[_0x7c48('0x29')](handleEntityNotFound(_0x1a4d26,null))[_0x7c48('0x29')](respondWithResult(_0x1a4d26,null))[_0x7c48('0x44')](handleError(_0x1a4d26,null));};exports[_0x7c48('0x4b')]=function(_0x367e62,_0x36ce04){return db[_0x7c48('0x40')][_0x7c48('0x4b')](_0x367e62[_0x7c48('0x4c')],{})[_0x7c48('0x29')](function(_0x19b21e){var _0x3299fa=_0x367e62[_0x7c48('0x4d')]['get']({'plain':!![]});if(!_0x3299fa)throw new Error(_0x7c48('0x4e'));if(_0x3299fa[_0x7c48('0x4f')]===_0x7c48('0x4d')){var _0x17b91a=_0x19b21e['get']({'plain':!![]});var _0x505336=_0x7c48('0x50');return db[_0x7c48('0x51')][_0x7c48('0x52')]({'where':{'name':_0x505336,'userProfileId':_0x3299fa[_0x7c48('0x53')]},'raw':!![]})[_0x7c48('0x29')](function(_0xeb19b4){if(_0xeb19b4&&_0xeb19b4['autoAssociation']===0x0){return db[_0x7c48('0x54')][_0x7c48('0x4b')]({'name':_0x17b91a[_0x7c48('0x2c')],'resourceId':_0x17b91a['id'],'type':_0xeb19b4[_0x7c48('0x2c')],'sectionId':_0xeb19b4['id']},{})[_0x7c48('0x29')](function(){return _0x19b21e;});}else{return _0x19b21e;}})[_0x7c48('0x44')](function(_0x3bed84){logger[_0x7c48('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bed84);throw _0x3bed84;});}return _0x19b21e;})[_0x7c48('0x29')](respondWithResult(_0x36ce04,0xc9))[_0x7c48('0x44')](handleError(_0x36ce04,null));};exports[_0x7c48('0x55')]=function(_0x151cee,_0x4f0570){var _0x3e6368={'where':{'id':_0x151cee[_0x7c48('0x46')]['id']}},_0x244feb={};_0x244feb[_0x7c48('0x32')]=_['keys'](db[_0x7c48('0x40')][_0x7c48('0x48')]);_0x3e6368[_0x7c48('0x35')]=_[_0x7c48('0x49')](_0x244feb[_0x7c48('0x32')],qs[_0x7c48('0x36')](_0x151cee[_0x7c48('0x33')][_0x7c48('0x36')]));_0x3e6368[_0x7c48('0x35')]=_0x3e6368[_0x7c48('0x35')]['length']?_0x3e6368[_0x7c48('0x35')]:_0x244feb[_0x7c48('0x32')];if(_0x151cee[_0x7c48('0x33')][_0x7c48('0x4a')]){_0x3e6368['include']=[{'all':!![]}];}_0x3e6368=_[_0x7c48('0x3e')]({},_0x3e6368,_0x151cee['options']);return db[_0x7c48('0x40')]['find'](_0x3e6368)[_0x7c48('0x29')](handleEntityNotFound(_0x4f0570,null))['then'](function(_0x4178c3){if(_0x4178c3){var _0x312c3f=_0x4178c3['get']({'plain':!![]});_0x312c3f=qs[_0x7c48('0x56')](_0x312c3f,['id',_0x7c48('0x57'),_0x7c48('0x58')]);_0x151cee['body']=_['omit'](_0x151cee['body'],['id',_0x7c48('0x57'),'updatedAt']);return db[_0x7c48('0x40')][_0x7c48('0x4b')](_['merge'](_0x312c3f,_0x151cee[_0x7c48('0x4c')]),{'include':_0x151cee[_0x7c48('0x33')][_0x7c48('0x4a')]?[{'all':!![]}]:undefined})[_0x7c48('0x29')](function(_0x14eaac){var _0x577123=_0x151cee[_0x7c48('0x4d')][_0x7c48('0x2a')]({'plain':!![]});if(!_0x577123)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x577123[_0x7c48('0x4f')]===_0x7c48('0x4d')){var _0x147352=_0x14eaac['get']({'plain':!![]});var _0x4ba0d6=_0x7c48('0x50');return db[_0x7c48('0x51')][_0x7c48('0x52')]({'where':{'name':_0x4ba0d6,'userProfileId':_0x577123['userProfileId']},'raw':!![]})[_0x7c48('0x29')](function(_0xaba8a2){if(_0xaba8a2&&_0xaba8a2['autoAssociation']===0x0){return db[_0x7c48('0x54')][_0x7c48('0x4b')]({'name':_0x147352[_0x7c48('0x2c')],'resourceId':_0x147352['id'],'type':_0xaba8a2[_0x7c48('0x2c')],'sectionId':_0xaba8a2['id']},{})[_0x7c48('0x29')](function(){return _0x14eaac;});}else{return _0x14eaac;}})[_0x7c48('0x44')](function(_0xa47ef3){logger[_0x7c48('0x2b')](_0x7c48('0x59'),_0xa47ef3);throw _0xa47ef3;});}return _0x14eaac;});}})[_0x7c48('0x29')](respondWithResult(_0x4f0570,0xc9))[_0x7c48('0x44')](handleError(_0x4f0570,null));};exports[_0x7c48('0x27')]=function(_0x2e6255,_0x366498){if(_0x2e6255[_0x7c48('0x4c')]['id']){delete _0x2e6255[_0x7c48('0x4c')]['id'];}return db[_0x7c48('0x40')][_0x7c48('0x52')]({'where':{'id':_0x2e6255[_0x7c48('0x46')]['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0x366498,null))[_0x7c48('0x29')](saveUpdates(_0x2e6255[_0x7c48('0x4c')],null))[_0x7c48('0x29')](respondWithResult(_0x366498,null))[_0x7c48('0x44')](handleError(_0x366498,null));};exports[_0x7c48('0x28')]=function(_0x56bb90,_0xbc51f8){return db[_0x7c48('0x40')][_0x7c48('0x52')]({'where':{'id':_0x56bb90[_0x7c48('0x46')]['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0xbc51f8,null))[_0x7c48('0x29')](removeEntity(_0xbc51f8,null))[_0x7c48('0x44')](handleError(_0xbc51f8,null));};function widgetAttributes(_0x29899c){try{switch(_0x29899c[_0x7c48('0x30')]){case _0x7c48('0x5a'):return[{'name':_0x7c48('0x5b'),'value':_0x29899c['attrUrl']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||'https://'}];case _0x7c48('0x5e'):return[{'name':_0x7c48('0x5f'),'value':_0x29899c['attrPath']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c['attrs'][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||''}];case _0x7c48('0x60'):return[{'name':_0x7c48('0x61'),'value':_0x29899c[_0x7c48('0x61')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||_0x7c48('0x62')},{'name':'attrTimezone','value':_0x29899c[_0x7c48('0x63')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1][_0x7c48('0x5d')]:undefined)||_0x7c48('0x64')},{'name':_0x7c48('0x65'),'value':_0x29899c['attrFontSize']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x2]?_0x29899c[_0x7c48('0x5c')][0x2][_0x7c48('0x5d')]:undefined)||0xc}];case _0x7c48('0x66'):return[{'name':_0x7c48('0x67'),'value':_0x29899c[_0x7c48('0x67')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||_0x7c48('0x68')},{'name':_0x7c48('0x69'),'value':_0x29899c[_0x7c48('0x69')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1][_0x7c48('0x5d')]:undefined)||[]},{'name':_0x7c48('0x65'),'value':_0x29899c[_0x7c48('0x65')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x2]?_0x29899c['attrs'][0x2][_0x7c48('0x5d')]:undefined)||0x14},{'name':_0x7c48('0x6a'),'value':_0x29899c[_0x7c48('0x6a')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x3]?_0x29899c['attrs'][0x3][_0x7c48('0x5d')]:undefined)||_0x7c48('0x6b')},{'name':'attrEmailAccounts','value':_0x29899c[_0x7c48('0x6c')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x4]?_0x29899c['attrs'][0x4][_0x7c48('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x29899c['attrFaxAccounts']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x5]?_0x29899c[_0x7c48('0x5c')][0x5]['value']:undefined)||''},{'name':_0x7c48('0x6d'),'value':_0x29899c[_0x7c48('0x6d')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x6]?_0x29899c['attrs'][0x6][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6e'),'value':_0x29899c[_0x7c48('0x6e')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c['attrs'][0x7]?_0x29899c[_0x7c48('0x5c')][0x7][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6f'),'value':_0x29899c['attrWhatsappAccounts']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x8]?_0x29899c[_0x7c48('0x5c')][0x8][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x70'),'value':_0x29899c[_0x7c48('0x70')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x9]?_0x29899c[_0x7c48('0x5c')][0x9][_0x7c48('0x5d')]:undefined)||''}];case'multibar-chart':case _0x7c48('0x71'):return[{'name':_0x7c48('0x72'),'value':_0x29899c[_0x7c48('0x72')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||_0x7c48('0x68')},{'name':_0x7c48('0x73'),'value':_0x29899c['attrSerie2']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1]['value']:undefined)||null},{'name':_0x7c48('0x74'),'value':_0x29899c[_0x7c48('0x74')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x2]?_0x29899c[_0x7c48('0x5c')][0x2][_0x7c48('0x5d')]:undefined)||null},{'name':_0x7c48('0x69'),'value':_0x29899c[_0x7c48('0x69')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x3]?_0x29899c[_0x7c48('0x5c')][0x3]['value']:undefined)||[]},{'name':_0x7c48('0x6a'),'value':_0x29899c[_0x7c48('0x6a')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x4]?_0x29899c[_0x7c48('0x5c')][0x4]['value']:undefined)||_0x7c48('0x6b')},{'name':_0x7c48('0x6c'),'value':_0x29899c['attrEmailAccounts']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x5]?_0x29899c[_0x7c48('0x5c')][0x5][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x75'),'value':_0x29899c[_0x7c48('0x75')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c['attrs'][0x6]?_0x29899c[_0x7c48('0x5c')][0x6][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6d'),'value':_0x29899c['attrSmsAccounts']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x7]?_0x29899c['attrs'][0x7][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6e'),'value':_0x29899c[_0x7c48('0x6e')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x8]?_0x29899c['attrs'][0x8]['value']:undefined)||''},{'name':_0x7c48('0x6f'),'value':_0x29899c[_0x7c48('0x6f')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x9]?_0x29899c[_0x7c48('0x5c')][0x9]['value']:undefined)||''},{'name':_0x7c48('0x70'),'value':_0x29899c[_0x7c48('0x70')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0xa]?_0x29899c[_0x7c48('0x5c')][0xa]['value']:undefined)||''}];case _0x7c48('0x76'):return[{'name':'attrReport','type':_0x29899c[_0x7c48('0x77')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0]['type']:undefined)||null,'value':_0x29899c['attrReport']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||null},{'name':_0x7c48('0x78'),'value':_0x29899c[_0x7c48('0x78')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1][_0x7c48('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0xf24063){logger[_0x7c48('0x2b')]('widgetAttributes:\x20%s',JSON[_0x7c48('0x79')](_0xf24063));return[];}}exports[_0x7c48('0x7a')]=function(_0x573e50,_0x994674,_0x574f96){if(_0x573e50['body']['id']){delete _0x573e50[_0x7c48('0x4c')]['id'];}return db[_0x7c48('0x40')]['find']({'where':{'id':_0x573e50['params']['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0x994674,null))['then'](function(_0x244cae){if(_0x244cae){_0x573e50[_0x7c48('0x4c')][_0x7c48('0x7b')]=_0x244cae['id'];_0x573e50[_0x7c48('0x4c')][_0x7c48('0x5c')]=widgetAttributes(_0x573e50['body']);return db['DashboardItem'][_0x7c48('0x4b')](_0x573e50[_0x7c48('0x4c')]);}})['then'](respondWithResult(_0x994674,null))['catch'](handleError(_0x994674,null));};exports[_0x7c48('0x7c')]=function(_0x58d218,_0x30cc1f,_0x3361ee){var _0x42a8b7={};var _0x4e0404={};var _0x4abe87;var _0x4b03ad;return db['Dashboard'][_0x7c48('0x7d')]({'where':{'id':_0x58d218[_0x7c48('0x46')]['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0x30cc1f,null))[_0x7c48('0x29')](function(_0x380f3a){if(_0x380f3a){_0x4abe87=_0x380f3a;_0x4e0404['model']=_[_0x7c48('0x47')](db['DashboardItem']['rawAttributes']);_0x4e0404[_0x7c48('0x33')]=_[_0x7c48('0x47')](_0x58d218[_0x7c48('0x33')]);_0x4e0404[_0x7c48('0x34')]=_['intersection'](_0x4e0404[_0x7c48('0x32')],_0x4e0404[_0x7c48('0x33')]);_0x42a8b7[_0x7c48('0x35')]=_[_0x7c48('0x49')](_0x4e0404[_0x7c48('0x32')],qs[_0x7c48('0x36')](_0x58d218['query'][_0x7c48('0x36')]));_0x42a8b7[_0x7c48('0x35')]=_0x42a8b7[_0x7c48('0x35')][_0x7c48('0x37')]?_0x42a8b7[_0x7c48('0x35')]:_0x4e0404[_0x7c48('0x32')];_0x42a8b7[_0x7c48('0x7e')]=qs['sort'](_0x58d218[_0x7c48('0x33')][_0x7c48('0x3a')]);_0x42a8b7[_0x7c48('0x3d')]=qs[_0x7c48('0x34')](_['pick'](_0x58d218[_0x7c48('0x33')],_0x4e0404[_0x7c48('0x34')]));if(_0x58d218[_0x7c48('0x33')][_0x7c48('0x3c')]){_0x42a8b7['where']=_[_0x7c48('0x3e')](_0x42a8b7['where'],{'$or':_['map'](_0x42a8b7[_0x7c48('0x35')],function(_0x20fdcf){var _0x2fb089={};_0x2fb089[_0x20fdcf]={'$like':'%'+_0x58d218[_0x7c48('0x33')][_0x7c48('0x3c')]+'%'};return _0x2fb089;})});}_0x42a8b7=_[_0x7c48('0x3e')]({},_0x42a8b7,_0x58d218[_0x7c48('0x7f')]);return _0x4abe87[_0x7c48('0x7c')](_0x42a8b7);}})[_0x7c48('0x29')](function(_0x56583d){if(_0x56583d){_0x4b03ad=_0x56583d[_0x7c48('0x37')];if(!_0x58d218[_0x7c48('0x33')][_0x7c48('0x38')](_0x7c48('0x39'))){_0x42a8b7[_0x7c48('0x21')]=qs[_0x7c48('0x21')](_0x58d218[_0x7c48('0x33')][_0x7c48('0x21')]);_0x42a8b7['offset']=qs['offset'](_0x58d218[_0x7c48('0x33')][_0x7c48('0x1f')]);}return _0x4abe87[_0x7c48('0x7c')](_0x42a8b7);}})[_0x7c48('0x29')](function(_0x3e0939){if(_0x3e0939){return _0x3e0939?{'count':_0x4b03ad,'rows':_0x3e0939}:null;}})['then'](respondWithResult(_0x30cc1f,null))[_0x7c48('0x44')](handleError(_0x30cc1f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e514e0b..9839ae3 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 _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 +var _0x8d7b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard'];(function(_0x3df93e,_0x5af13a){var _0x2d4f2a=function(_0x14c85c){while(--_0x14c85c){_0x3df93e['push'](_0x3df93e['shift']());}};_0x2d4f2a(++_0x5af13a);}(_0x8d7b,0x1e8));var _0xb8d7=function(_0x41f8ab,_0x4d1c3b){_0x41f8ab=_0x41f8ab-0x0;var _0x49602a=_0x8d7b[_0x41f8ab];return _0x49602a;};'use strict';var EventEmitter=require(_0xb8d7('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xb8d7('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb8d7('0x2')](0x0);var events={'afterCreate':_0xb8d7('0x3'),'afterUpdate':_0xb8d7('0x4'),'afterDestroy':_0xb8d7('0x5')};function emitEvent(_0x47cc97){return function(_0x41da30,_0x1191b8,_0x1cfa7b){DashboardEvents[_0xb8d7('0x6')](_0x47cc97+':'+_0x41da30['id'],_0x41da30);DashboardEvents[_0xb8d7('0x6')](_0x47cc97,_0x41da30);_0x1cfa7b(null);};}for(var e in events){if(events[_0xb8d7('0x7')](e)){var event=events[e];Dashboard[_0xb8d7('0x8')](e,emitEvent(event));}}module[_0xb8d7('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ddd4f81..8639acc 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 _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 +var _0xf26a=['exports','define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./dashboard.attributes'];(function(_0x29872b,_0xacb79){var _0x35d599=function(_0x5bcb13){while(--_0x5bcb13){_0x29872b['push'](_0x29872b['shift']());}};_0x35d599(++_0xacb79);}(_0xf26a,0xbe));var _0xaf26=function(_0x4fc5c1,_0x496c84){_0x4fc5c1=_0x4fc5c1-0x0;var _0x3a4f09=_0xf26a[_0x4fc5c1];return _0x3a4f09;};'use strict';var _=require(_0xaf26('0x0'));var util=require(_0xaf26('0x1'));var logger=require(_0xaf26('0x2'))(_0xaf26('0x3'));var moment=require(_0xaf26('0x4'));var BPromise=require(_0xaf26('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaf26('0x6'));var attributes=require(_0xaf26('0x7'));module[_0xaf26('0x8')]=function(_0x21fe83,_0x441e9b){return _0x21fe83[_0xaf26('0x9')](_0xaf26('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 2ab0bde..f2f59e0 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 _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 +var _0xb23c=['defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x9489b8,_0x5293b3){var _0x372964=function(_0x41616f){while(--_0x41616f){_0x9489b8['push'](_0x9489b8['shift']());}};_0x372964(++_0x5293b3);}(_0xb23c,0xd4));var _0xcb23=function(_0x3e4f2b,_0x3a66b2){_0x3e4f2b=_0x3e4f2b-0x0;var _0x21808f=_0xb23c[_0x3e4f2b];return _0x21808f;};'use strict';var _=require(_0xcb23('0x0'));var util=require(_0xcb23('0x1'));var moment=require('moment');var BPromise=require(_0xcb23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb23('0x3'))['db'];var utils=require(_0xcb23('0x4'));var logger=require(_0xcb23('0x5'))(_0xcb23('0x6'));var config=require(_0xcb23('0x7'));var jayson=require(_0xcb23('0x8'));var client=jayson[_0xcb23('0x9')][_0xcb23('0xa')]({'port':0x232a});config[_0xcb23('0xb')]=_[_0xcb23('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcb23('0xd'))(new Redis(config[_0xcb23('0xb')]));require(_0xcb23('0xe'))[_0xcb23('0xf')](socket);function respondWithRpcPromise(_0x3e192d,_0x3d4fdf,_0x24681c){return new BPromise(function(_0x380f04,_0x88affe){return client[_0xcb23('0x10')](_0x3e192d,_0x24681c)[_0xcb23('0x11')](function(_0x289a15){logger[_0xcb23('0x12')](_0xcb23('0x13'),_0x3d4fdf,_0xcb23('0x14'));logger['debug'](_0xcb23('0x15'),_0x3d4fdf,_0xcb23('0x14'),JSON[_0xcb23('0x16')](_0x289a15));if(_0x289a15['error']){if(_0x289a15[_0xcb23('0x17')][_0xcb23('0x18')]===0x1f4){logger[_0xcb23('0x17')](_0xcb23('0x13'),_0x3d4fdf,_0x289a15[_0xcb23('0x17')][_0xcb23('0x19')]);return _0x88affe(_0x289a15['error'][_0xcb23('0x19')]);}logger[_0xcb23('0x17')](_0xcb23('0x13'),_0x3d4fdf,_0x289a15['error'][_0xcb23('0x19')]);return _0x380f04(_0x289a15[_0xcb23('0x17')][_0xcb23('0x19')]);}else{logger[_0xcb23('0x12')](_0xcb23('0x13'),_0x3d4fdf,'request\x20sent');_0x380f04(_0x289a15[_0xcb23('0x1a')][_0xcb23('0x19')]);}})[_0xcb23('0x1b')](function(_0x19712e){logger[_0xcb23('0x17')](_0xcb23('0x13'),_0x3d4fdf,_0x19712e);_0x88affe(_0x19712e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index d63692f..eb38f20 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 _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 +var _0xd14e=['remove','update','emit','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x18e001,_0x174788){var _0x3fd04f=function(_0x15426d){while(--_0x15426d){_0x18e001['push'](_0x18e001['shift']());}};_0x3fd04f(++_0x174788);}(_0xd14e,0xc6));var _0xed14=function(_0x57ef17,_0x5dcab0){_0x57ef17=_0x57ef17-0x0;var _0x303547=_0xd14e[_0x57ef17];return _0x303547;};'use strict';var DashboardEvents=require(_0xed14('0x0'));var events=[_0xed14('0x1'),_0xed14('0x2'),_0xed14('0x3')];function createListener(_0x16808b,_0x5f4244){return function(_0x424f52){_0x5f4244[_0xed14('0x4')](_0x16808b,_0x424f52);};}function removeListener(_0x5872f9,_0x53e6ae){return function(){DashboardEvents[_0xed14('0x5')](_0x5872f9,_0x53e6ae);};}exports[_0xed14('0x6')]=function(_0x235766){for(var _0x5979ac=0x0,_0x7aaf53=events['length'];_0x5979ac<_0x7aaf53;_0x5979ac++){var _0x26ac11=events[_0x5979ac];var _0x397191=createListener(_0xed14('0x7')+_0x26ac11,_0x235766);DashboardEvents['on'](_0x26ac11,_0x397191);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index c98a15e..4957513 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 _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 +var _0x2963=['/:id/clone','clone','/:id','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','create'];(function(_0x550221,_0x14d658){var _0xc16276=function(_0x3e6c02){while(--_0x3e6c02){_0x550221['push'](_0x550221['shift']());}};_0xc16276(++_0x14d658);}(_0x2963,0xf5));var _0x3296=function(_0x6cf18,_0x27430f){_0x6cf18=_0x6cf18-0x0;var _0x5f2a77=_0x2963[_0x6cf18];return _0x5f2a77;};'use strict';var multer=require('multer');var util=require(_0x3296('0x0'));var path=require('path');var timeout=require(_0x3296('0x1'));var express=require(_0x3296('0x2'));var router=express[_0x3296('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3296('0x4'));var config=require(_0x3296('0x5'));var controller=require(_0x3296('0x6'));router[_0x3296('0x7')]('/',auth[_0x3296('0x8')](),controller[_0x3296('0x9')]);router['get']('/:id',auth[_0x3296('0x8')](),controller[_0x3296('0xa')]);router[_0x3296('0x7')](_0x3296('0xb'),auth[_0x3296('0x8')](),controller[_0x3296('0xc')]);router[_0x3296('0xd')]('/',auth[_0x3296('0x8')](),controller[_0x3296('0xe')]);router['post'](_0x3296('0xf'),auth['isAuthenticated'](),controller[_0x3296('0x10')]);router[_0x3296('0xd')](_0x3296('0xb'),auth[_0x3296('0x8')](),controller['addItem']);router['put'](_0x3296('0x11'),auth[_0x3296('0x8')](),controller[_0x3296('0x12')]);router['delete'](_0x3296('0x11'),auth[_0x3296('0x8')](),controller['destroy']);module[_0x3296('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8e9eb60..dd45411 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 _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 +var _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0xe91a23,_0x27f043){var _0x4d0207=function(_0x1fdb59){while(--_0x1fdb59){_0xe91a23['push'](_0xe91a23['shift']());}};_0x4d0207(++_0x27f043);}(_0x524e,0x15e));var _0xe524=function(_0x2954b3,_0x1024b7){_0x2954b3=_0x2954b3-0x0;var _0x1db341=_0x524e[_0x2954b3];return _0x1db341;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xe524('0x0'));module[_0xe524('0x1')]={'title':{'type':Sequelize[_0xe524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4')),'get':function(){try{return JSON[_0xe524('0x5')](this[_0xe524('0x6')](_0xe524('0x7')));}catch(_0x110cff){return[];}},'set':function(_0x4f75d6){try{this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')](_0x4f75d6));}catch(_0x533c14){this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe524('0xa')]},'col':{'type':Sequelize[_0xe524('0xa')]},'background':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe524('0x2')]},'titleFontSize':{'type':Sequelize[_0xe524('0xa')],'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 6449ca1..7c4df29 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 _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 +var _0x2ef3=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./dashboardItem.socket','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','update','destroy','then','end','error','name','send','params','model','keys','rawAttributes','query','intersection','attributes','length','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body'];(function(_0x30dc1c,_0x581ecb){var _0x37099e=function(_0x28ac6c){while(--_0x28ac6c){_0x30dc1c['push'](_0x30dc1c['shift']());}};_0x37099e(++_0x581ecb);}(_0x2ef3,0xba));var _0x32ef=function(_0x14d424,_0x2ad3e4){_0x14d424=_0x14d424-0x0;var _0x329bc9=_0x2ef3[_0x14d424];return _0x329bc9;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x18')]=_['defaults'](config[_0x32ef('0x18')],{'host':_0x32ef('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x32ef('0x1a'))['register'](socket);function respondWithStatusCode(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xcc;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x1b')](_0x40a6e6);}return _0x326fce['status'](_0x40a6e6)['end']();};}function respondWithResult(_0x531e30,_0x13db1a){_0x13db1a=_0x13db1a||0xc8;return function(_0x3950e6){if(_0x3950e6){return _0x531e30[_0x32ef('0x1c')](_0x13db1a)['json'](_0x3950e6);}};}function respondWithFilteredResult(_0x5d559b,_0x1eb468){return function(_0x1a9476){if(_0x1a9476){var _0x286bfb=typeof _0x1eb468['offset']===_0x32ef('0x1d')&&typeof _0x1eb468[_0x32ef('0x1e')]==='undefined';var _0x304505=_0x1a9476[_0x32ef('0x1f')];var _0x26aff3=_0x286bfb?0x0:_0x1eb468[_0x32ef('0x20')];var _0x445cda=_0x286bfb?_0x1a9476[_0x32ef('0x1f')]:_0x1eb468['offset']+_0x1eb468[_0x32ef('0x1e')];var _0x5cc3ef;if(_0x445cda>=_0x304505){_0x445cda=_0x304505;_0x5cc3ef=0xc8;}else{_0x5cc3ef=0xce;}_0x5d559b[_0x32ef('0x1c')](_0x5cc3ef);return _0x5d559b[_0x32ef('0x21')]('Content-Range',_0x26aff3+'-'+_0x445cda+'/'+_0x304505)[_0x32ef('0x22')](_0x1a9476);}return null;};}function patchUpdates(_0x97780){return function(_0x5e8898){try{jsonpatch['apply'](_0x5e8898,_0x97780,!![]);}catch(_0x57f5e5){return BPromise[_0x32ef('0x23')](_0x57f5e5);}return _0x5e8898[_0x32ef('0x24')]();};}function saveUpdates(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x25')](_0x225feb)['then'](function(_0x51a412){return _0x51a412;});}return null;};}function removeEntity(_0x278495,_0x14d4b3){return function(_0x371540){if(_0x371540){return _0x371540[_0x32ef('0x26')]()[_0x32ef('0x27')](function(){_0x278495[_0x32ef('0x1c')](0xcc)[_0x32ef('0x28')]();});}};}function handleEntityNotFound(_0x38aed5,_0x338f19){return function(_0x2f52d7){if(!_0x2f52d7){_0x38aed5[_0x32ef('0x1b')](0x194);}return _0x2f52d7;};}function handleError(_0xba4b3f,_0x5a88a5){_0x5a88a5=_0x5a88a5||0x1f4;return function(_0xd65fde){logger[_0x32ef('0x29')](_0xd65fde['stack']);if(_0xd65fde[_0x32ef('0x2a')]){delete _0xd65fde[_0x32ef('0x2a')];}_0xba4b3f[_0x32ef('0x1c')](_0x5a88a5)[_0x32ef('0x2b')](_0xd65fde);};}exports['show']=function(_0x10e38c,_0x22bf86){var _0x31dbc3={'raw':![],'where':{'id':_0x10e38c[_0x32ef('0x2c')]['id']}},_0x2ac686={};_0x2ac686[_0x32ef('0x2d')]=_[_0x32ef('0x2e')](db['DashboardItem'][_0x32ef('0x2f')]);_0x2ac686['query']=_[_0x32ef('0x2e')](_0x10e38c[_0x32ef('0x30')]);_0x2ac686['filters']=_[_0x32ef('0x31')](_0x2ac686[_0x32ef('0x2d')],_0x2ac686[_0x32ef('0x30')]);_0x31dbc3[_0x32ef('0x32')]=_[_0x32ef('0x31')](_0x2ac686['model'],qs['fields'](_0x10e38c[_0x32ef('0x30')]['fields']));_0x31dbc3[_0x32ef('0x32')]=_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x33')]?_0x31dbc3[_0x32ef('0x32')]:_0x2ac686[_0x32ef('0x2d')];if(_0x10e38c[_0x32ef('0x30')]['includeAll']){_0x31dbc3['include']=[{'all':!![]}];}_0x31dbc3=_['merge']({},_0x31dbc3,_0x10e38c[_0x32ef('0x34')]);return db[_0x32ef('0x35')][_0x32ef('0x36')](_0x31dbc3)['then'](handleEntityNotFound(_0x22bf86,null))['then'](respondWithResult(_0x22bf86,null))[_0x32ef('0x37')](handleError(_0x22bf86,null));};exports[_0x32ef('0x26')]=function(_0x410334,_0x480348){return db['DashboardItem'][_0x32ef('0x36')]({'where':{'id':_0x410334[_0x32ef('0x2c')]['id']}})[_0x32ef('0x27')](handleEntityNotFound(_0x480348,null))[_0x32ef('0x27')](removeEntity(_0x480348,null))[_0x32ef('0x37')](handleError(_0x480348,null));};function widgetAttributes(_0x211c79){try{switch(_0x211c79[_0x32ef('0x38')]){case _0x32ef('0x39'):return[{'name':_0x32ef('0x3a'),'value':_0x211c79['attrUrl']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0]['value']:undefined)||_0x32ef('0x3c')}];case _0x32ef('0x3d'):return[{'name':_0x32ef('0x3e'),'value':_0x211c79[_0x32ef('0x3e')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||''}];case _0x32ef('0x40'):return[{'name':_0x32ef('0x41'),'value':_0x211c79[_0x32ef('0x41')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x42')},{'name':_0x32ef('0x43'),'value':_0x211c79[_0x32ef('0x43')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79['attrs'][0x1]['value']:undefined)||_0x32ef('0x44')},{'name':_0x32ef('0x45'),'value':_0x211c79[_0x32ef('0x45')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x2]?_0x211c79[_0x32ef('0x3b')][0x2][_0x32ef('0x3f')]:undefined)||0xc}];case'counter':return[{'name':_0x32ef('0x46'),'value':_0x211c79['attrMetric']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x47')},{'name':_0x32ef('0x48'),'value':_0x211c79[_0x32ef('0x48')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1]['value']:undefined)||[]},{'name':_0x32ef('0x45'),'value':_0x211c79['attrFontSize']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x2]?_0x211c79[_0x32ef('0x3b')][0x2]['value']:undefined)||0x14},{'name':_0x32ef('0x49'),'value':_0x211c79[_0x32ef('0x49')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x3]?_0x211c79[_0x32ef('0x3b')][0x3][_0x32ef('0x3f')]:undefined)||_0x32ef('0x4a')},{'name':'attrEmailAccounts','value':_0x211c79['attrEmailAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x4]?_0x211c79[_0x32ef('0x3b')][0x4][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4b'),'value':_0x211c79[_0x32ef('0x4b')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x5]?_0x211c79[_0x32ef('0x3b')][0x5][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4c'),'value':_0x211c79[_0x32ef('0x4c')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x6]?_0x211c79[_0x32ef('0x3b')][0x6][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4d'),'value':_0x211c79[_0x32ef('0x4d')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x7]?_0x211c79[_0x32ef('0x3b')][0x7][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4e'),'value':_0x211c79[_0x32ef('0x4e')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x8]?_0x211c79[_0x32ef('0x3b')][0x8][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4f'),'value':_0x211c79[_0x32ef('0x4f')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x9]?_0x211c79['attrs'][0x9]['value']:undefined)||''}];case _0x32ef('0x50'):case _0x32ef('0x51'):return[{'name':_0x32ef('0x52'),'value':_0x211c79[_0x32ef('0x52')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x47')},{'name':_0x32ef('0x53'),'value':_0x211c79[_0x32ef('0x53')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1][_0x32ef('0x3f')]:undefined)||null},{'name':_0x32ef('0x54'),'value':_0x211c79[_0x32ef('0x54')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x2]?_0x211c79[_0x32ef('0x3b')][0x2][_0x32ef('0x3f')]:undefined)||null},{'name':_0x32ef('0x48'),'value':_0x211c79['attrVoiceQueues']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x3]?_0x211c79[_0x32ef('0x3b')][0x3][_0x32ef('0x3f')]:undefined)||[]},{'name':'attrChannel','value':_0x211c79[_0x32ef('0x49')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x4]?_0x211c79[_0x32ef('0x3b')][0x4][_0x32ef('0x3f')]:undefined)||_0x32ef('0x4a')},{'name':_0x32ef('0x55'),'value':_0x211c79[_0x32ef('0x55')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x5]?_0x211c79['attrs'][0x5][_0x32ef('0x3f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x211c79['attrFaxAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x6]?_0x211c79[_0x32ef('0x3b')][0x6][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4c'),'value':_0x211c79[_0x32ef('0x4c')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x7]?_0x211c79[_0x32ef('0x3b')][0x7][_0x32ef('0x3f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x211c79['attrOpenchannelAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x8]?_0x211c79['attrs'][0x8][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4e'),'value':_0x211c79[_0x32ef('0x4e')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x9]?_0x211c79[_0x32ef('0x3b')][0x9][_0x32ef('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x211c79['attrChatWebsites']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0xa]?_0x211c79[_0x32ef('0x3b')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x32ef('0x56'),'type':_0x211c79[_0x32ef('0x57')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x38')]:undefined)||null,'value':_0x211c79[_0x32ef('0x56')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x211c79[_0x32ef('0x58')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1][_0x32ef('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x40700e){logger['error'](_0x32ef('0x59'),JSON[_0x32ef('0x5a')](_0x40700e));return[];}}exports[_0x32ef('0x5b')]=function(_0x36ed97,_0x21e930){if(_0x36ed97[_0x32ef('0x5c')]){_0x36ed97[_0x32ef('0x5c')][_0x32ef('0x3b')]=widgetAttributes(_0x36ed97[_0x32ef('0x5c')]);}return db['DashboardItem'][_0x32ef('0x5b')](_0x36ed97[_0x32ef('0x5c')],{})[_0x32ef('0x27')](respondWithResult(_0x21e930,0xc9))[_0x32ef('0x37')](handleError(_0x21e930,null));};exports[_0x32ef('0x25')]=function(_0x5ad75c,_0x47c0ed){if(_0x5ad75c[_0x32ef('0x5c')]['id']){delete _0x5ad75c[_0x32ef('0x5c')]['id'];}_0x5ad75c[_0x32ef('0x5c')][_0x32ef('0x3b')]=widgetAttributes(_0x5ad75c[_0x32ef('0x5c')]);return db['DashboardItem'][_0x32ef('0x36')]({'where':{'id':_0x5ad75c['params']['id']}})[_0x32ef('0x27')](handleEntityNotFound(_0x47c0ed,null))[_0x32ef('0x27')](saveUpdates(_0x5ad75c['body'],null))['then'](respondWithResult(_0x47c0ed,null))[_0x32ef('0x37')](handleError(_0x47c0ed,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 57aa994..c9eefa6 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 _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 +var _0x554e=['hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x1092be,_0x2e846c){var _0x55a287=function(_0x29d4b4){while(--_0x29d4b4){_0x1092be['push'](_0x1092be['shift']());}};_0x55a287(++_0x2e846c);}(_0x554e,0xb6));var _0xe554=function(_0x590649,_0x28f93d){_0x590649=_0x590649-0x0;var _0x4e1806=_0x554e[_0x590649];return _0x4e1806;};'use strict';var EventEmitter=require(_0xe554('0x0'));var DashboardItem=require(_0xe554('0x1'))['db'][_0xe554('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe554('0x3')](0x0);var events={'afterCreate':_0xe554('0x4'),'afterUpdate':_0xe554('0x5'),'afterDestroy':_0xe554('0x6')};function emitEvent(_0xe1c760){return function(_0x1d2962,_0xf9d08c,_0x5075f4){DashboardItemEvents[_0xe554('0x7')](_0xe1c760+':'+_0x1d2962['id'],_0x1d2962);DashboardItemEvents[_0xe554('0x7')](_0xe1c760,_0x1d2962);_0x5075f4(null);};}for(var e in events){if(events[_0xe554('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xe554('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c4b9913..49cb52b 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 _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 +var _0xf21d=['path','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2628de,_0x1380a5){var _0x2c11de=function(_0x56e382){while(--_0x56e382){_0x2628de['push'](_0x2628de['shift']());}};_0x2c11de(++_0x1380a5);}(_0xf21d,0xe1));var _0xdf21=function(_0x36c650,_0x89f2ca){_0x36c650=_0x36c650-0x0;var _0x2e5aa4=_0xf21d[_0x36c650];return _0x2e5aa4;};'use strict';var _=require(_0xdf21('0x0'));var util=require('util');var logger=require(_0xdf21('0x1'))(_0xdf21('0x2'));var moment=require(_0xdf21('0x3'));var BPromise=require(_0xdf21('0x4'));var rp=require(_0xdf21('0x5'));var fs=require('fs');var path=require(_0xdf21('0x6'));var rimraf=require('rimraf');var config=require(_0xdf21('0x7'));var attributes=require(_0xdf21('0x8'));module['exports']=function(_0x53fa12,_0x520b85){return _0x53fa12[_0xdf21('0x9')](_0xdf21('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index a9ab37f..3365c88 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 _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 +var _0x90e5=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','redis','localhost','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x90e5,0x86));var _0x590e=function(_0xd53fe6,_0x418e66){_0xd53fe6=_0xd53fe6-0x0;var _0x2a581b=_0x90e5[_0xd53fe6];return _0x2a581b;};'use strict';var _=require(_0x590e('0x0'));var util=require(_0x590e('0x1'));var moment=require(_0x590e('0x2'));var BPromise=require(_0x590e('0x3'));var rs=require(_0x590e('0x4'));var fs=require('fs');var Redis=require(_0x590e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x590e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x590e('0x7')][_0x590e('0x8')]({'port':0x232a});config[_0x590e('0x9')]=_['defaults'](config[_0x590e('0x9')],{'host':_0x590e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x590e('0x9')]));require('./dashboardItem.socket')[_0x590e('0xb')](socket);function respondWithRpcPromise(_0x383f74,_0x481ff3,_0x3d4ad5){return new BPromise(function(_0x615619,_0x58abed){return client[_0x590e('0xc')](_0x383f74,_0x3d4ad5)[_0x590e('0xd')](function(_0x2bdc28){logger[_0x590e('0xe')](_0x590e('0xf'),_0x481ff3,'request\x20sent');logger[_0x590e('0x10')](_0x590e('0x11'),_0x481ff3,_0x590e('0x12'),JSON[_0x590e('0x13')](_0x2bdc28));if(_0x2bdc28['error']){if(_0x2bdc28[_0x590e('0x14')][_0x590e('0x15')]===0x1f4){logger[_0x590e('0x14')](_0x590e('0xf'),_0x481ff3,_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);return _0x58abed(_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x481ff3,_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);return _0x615619(_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);}else{logger[_0x590e('0xe')](_0x590e('0xf'),_0x481ff3,_0x590e('0x12'));_0x615619(_0x2bdc28[_0x590e('0x17')][_0x590e('0x16')]);}})[_0x590e('0x18')](function(_0x4bf3f9){logger[_0x590e('0x14')](_0x590e('0xf'),_0x481ff3,_0x4bf3f9);_0x58abed(_0x4bf3f9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ffee2e2..4ef6ca0 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 _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 +var _0x8a55=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x23f063,_0x40bc29){var _0xf633b3=function(_0x3cd66f){while(--_0x3cd66f){_0x23f063['push'](_0x23f063['shift']());}};_0xf633b3(++_0x40bc29);}(_0x8a55,0x1a8));var _0x58a5=function(_0x4c54a1,_0x752170){_0x4c54a1=_0x4c54a1-0x0;var _0x59115a=_0x8a55[_0x4c54a1];return _0x59115a;};'use strict';var DashboardItemEvents=require(_0x58a5('0x0'));var events=[_0x58a5('0x1'),'remove',_0x58a5('0x2')];function createListener(_0x48210e,_0x2bd1f4){return function(_0x23c498){_0x2bd1f4['emit'](_0x48210e,_0x23c498);};}function removeListener(_0x3361cf,_0x197d18){return function(){DashboardItemEvents[_0x58a5('0x3')](_0x3361cf,_0x197d18);};}exports[_0x58a5('0x4')]=function(_0x992ff2){for(var _0x2fc88f=0x0,_0x8a0a50=events[_0x58a5('0x5')];_0x2fc88f<_0x8a0a50;_0x2fc88f++){var _0x2b1238=events[_0x2fc88f];var _0x4e1c23=createListener(_0x58a5('0x6')+_0x2b1238,_0x992ff2);DashboardItemEvents['on'](_0x2b1238,_0x4e1c23);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index baa0dba..2cb846e 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 _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 +var _0x5f80=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util'];(function(_0x44a76f,_0x367226){var _0x3325df=function(_0x36239c){while(--_0x36239c){_0x44a76f['push'](_0x44a76f['shift']());}};_0x3325df(++_0x367226);}(_0x5f80,0x168));var _0x05f8=function(_0x59b2b5,_0x55c20a){_0x59b2b5=_0x59b2b5-0x0;var _0x658e36=_0x5f80[_0x59b2b5];return _0x658e36;};'use strict';var multer=require('multer');var util=require(_0x05f8('0x0'));var path=require(_0x05f8('0x1'));var timeout=require(_0x05f8('0x2'));var express=require(_0x05f8('0x3'));var router=express[_0x05f8('0x4')]();var fs_extra=require(_0x05f8('0x5'));var auth=require(_0x05f8('0x6'));var interaction=require(_0x05f8('0x7'));var config=require(_0x05f8('0x8'));var controller=require('./dashboardItem.controller');router[_0x05f8('0x9')](_0x05f8('0xa'),auth[_0x05f8('0xb')](),controller[_0x05f8('0xc')]);router[_0x05f8('0xd')]('/',auth[_0x05f8('0xb')](),controller[_0x05f8('0xe')]);router[_0x05f8('0xf')](_0x05f8('0xa'),auth[_0x05f8('0xb')](),controller[_0x05f8('0x10')]);router[_0x05f8('0x11')](_0x05f8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x05f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 8b015ea..6a8a608 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 _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 +var _0x041c=['third','sequelize','exports','STRING','ENUM','first'];(function(_0x254c9e,_0x20ae9b){var _0x112ff6=function(_0x34005b){while(--_0x34005b){_0x254c9e['push'](_0x254c9e['shift']());}};_0x112ff6(++_0x20ae9b);}(_0x041c,0x139));var _0xc041=function(_0x46d4a8,_0x292d53){_0x46d4a8=_0x46d4a8-0x0;var _0x1e323f=_0x041c[_0x46d4a8];return _0x1e323f;};'use strict';var Sequelize=require(_0xc041('0x0'));module[_0xc041('0x1')]={'name':{'type':Sequelize[_0xc041('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc041('0x3')](_0xc041('0x4'),'second',_0xc041('0x5')),'allowNull':![],'defaultValue':_0xc041('0x4')},'description':{'type':Sequelize[_0xc041('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f6c09fa..0928958 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 _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 +var _0x92f4=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','name','index','map','Disposition','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','catch','params','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x423f5b,_0x14717b){var _0x12ddc5=function(_0x5d0ed9){while(--_0x5d0ed9){_0x423f5b['push'](_0x423f5b['shift']());}};_0x12ddc5(++_0x14717b);}(_0x92f4,0x10f));var _0x492f=function(_0x1e744a,_0xa8fdb1){_0x1e744a=_0x1e744a-0x0;var _0x1ac4d0=_0x92f4[_0x1e744a];return _0x1ac4d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x492f('0x0'));var zipdir=require(_0x492f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x492f('0x2'));var moment=require(_0x492f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x492f('0x4'));var util=require('util');var path=require(_0x492f('0x5'));var sox=require(_0x492f('0x6'));var csv=require(_0x492f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x492f('0x8'));var squel=require(_0x492f('0x9'));var crypto=require(_0x492f('0xa'));var jsforce=require(_0x492f('0xb'));var deskjs=require(_0x492f('0xc'));var toCsv=require(_0x492f('0x7'));var querystring=require(_0x492f('0xd'));var Papa=require(_0x492f('0xe'));var Redis=require('ioredis');var authService=require(_0x492f('0xf'));var qs=require(_0x492f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x492f('0x11'))(_0x492f('0x12'));var utils=require('../../config/utils');var config=require(_0x492f('0x13'));var licenseUtil=require(_0x492f('0x14'));var db=require(_0x492f('0x15'))['db'];function respondWithStatusCode(_0x3ef643,_0x40390d){_0x40390d=_0x40390d||0xcc;return function(_0x17f9a5){if(_0x17f9a5){return _0x3ef643[_0x492f('0x16')](_0x40390d);}return _0x3ef643[_0x492f('0x17')](_0x40390d)['end']();};}function respondWithResult(_0x5beeac,_0x183521){_0x183521=_0x183521||0xc8;return function(_0x5464db){if(_0x5464db){return _0x5beeac[_0x492f('0x17')](_0x183521)['json'](_0x5464db);}};}function respondWithFilteredResult(_0x2e4981,_0x5c13b9){return function(_0x11edc7){if(_0x11edc7){var _0xa52f71=typeof _0x5c13b9[_0x492f('0x18')]===_0x492f('0x19')&&typeof _0x5c13b9[_0x492f('0x1a')]===_0x492f('0x19');var _0x2a067e=_0x11edc7[_0x492f('0x1b')];var _0x185457=_0xa52f71?0x0:_0x5c13b9[_0x492f('0x18')];var _0x19804d=_0xa52f71?_0x11edc7[_0x492f('0x1b')]:_0x5c13b9[_0x492f('0x18')]+_0x5c13b9[_0x492f('0x1a')];var _0x21b8fa;if(_0x19804d>=_0x2a067e){_0x19804d=_0x2a067e;_0x21b8fa=0xc8;}else{_0x21b8fa=0xce;}_0x2e4981[_0x492f('0x17')](_0x21b8fa);return _0x2e4981[_0x492f('0x1c')](_0x492f('0x1d'),_0x185457+'-'+_0x19804d+'/'+_0x2a067e)[_0x492f('0x1e')](_0x11edc7);}return null;};}function patchUpdates(_0x1cc6cf){return function(_0x1e78b4){try{jsonpatch[_0x492f('0x1f')](_0x1e78b4,_0x1cc6cf,!![]);}catch(_0x214367){return BPromise[_0x492f('0x20')](_0x214367);}return _0x1e78b4['save']();};}function saveUpdates(_0xdd5579,_0x3f505e){return function(_0x1a1b87){if(_0x1a1b87){return _0x1a1b87[_0x492f('0x21')](_0xdd5579)[_0x492f('0x22')](function(_0xfb5c6e){return _0xfb5c6e;});}return null;};}function removeEntity(_0x467a00,_0x3d7f80){return function(_0x19fbf3){if(_0x19fbf3){return _0x19fbf3[_0x492f('0x23')]()[_0x492f('0x22')](function(){var _0x181763=_0x19fbf3[_0x492f('0x24')]({'plain':!![]});var _0x42af7a='Dispositions';return db[_0x492f('0x25')]['destroy']({'where':{'type':_0x42af7a,'resourceId':_0x181763['id']}})[_0x492f('0x22')](function(){return _0x19fbf3;});})['then'](function(){_0x467a00[_0x492f('0x17')](0xcc)[_0x492f('0x26')]();});}};}function handleEntityNotFound(_0x2a4f07,_0x2dcef5){return function(_0x1539fa){if(!_0x1539fa){_0x2a4f07['sendStatus'](0x194);}return _0x1539fa;};}function handleError(_0xc51d6d,_0x3b0abb){_0x3b0abb=_0x3b0abb||0x1f4;return function(_0x269842){logger[_0x492f('0x27')](_0x269842['stack']);if(_0x269842[_0x492f('0x28')]){delete _0x269842[_0x492f('0x28')];}_0xc51d6d['status'](_0x3b0abb)['send'](_0x269842);};}exports[_0x492f('0x29')]=function(_0x53856c,_0x5bd1bc){var _0x2ec2be={},_0x66f0a0={},_0x58872a={'count':0x0,'rows':[]};var _0x199753=_[_0x492f('0x2a')](db[_0x492f('0x2b')][_0x492f('0x2c')],function(_0xba5bb2){return{'name':_0xba5bb2['fieldName'],'type':_0xba5bb2[_0x492f('0x2d')]['key']};});_0x66f0a0[_0x492f('0x2e')]=_[_0x492f('0x2a')](_0x199753,_0x492f('0x28'));_0x66f0a0[_0x492f('0x2f')]=_[_0x492f('0x30')](_0x53856c[_0x492f('0x2f')]);_0x66f0a0[_0x492f('0x31')]=_[_0x492f('0x32')](_0x66f0a0[_0x492f('0x2e')],_0x66f0a0[_0x492f('0x2f')]);_0x2ec2be[_0x492f('0x33')]=_[_0x492f('0x32')](_0x66f0a0['model'],qs[_0x492f('0x34')](_0x53856c['query'][_0x492f('0x34')]));_0x2ec2be[_0x492f('0x33')]=_0x2ec2be['attributes']['length']?_0x2ec2be[_0x492f('0x33')]:_0x66f0a0[_0x492f('0x2e')];if(!_0x53856c['query'][_0x492f('0x35')](_0x492f('0x36'))){_0x2ec2be[_0x492f('0x1a')]=qs['limit'](_0x53856c[_0x492f('0x2f')][_0x492f('0x1a')]);_0x2ec2be[_0x492f('0x18')]=qs['offset'](_0x53856c[_0x492f('0x2f')][_0x492f('0x18')]);}_0x2ec2be['order']=qs[_0x492f('0x37')](_0x53856c['query'][_0x492f('0x37')]);_0x2ec2be[_0x492f('0x38')]=qs['filters'](_[_0x492f('0x39')](_0x53856c[_0x492f('0x2f')],_0x66f0a0[_0x492f('0x31')]),_0x199753);if(_0x53856c[_0x492f('0x2f')][_0x492f('0x3a')]){_0x2ec2be[_0x492f('0x38')]=_[_0x492f('0x3b')](_0x2ec2be[_0x492f('0x38')],{'$or':_[_0x492f('0x2a')](_0x199753,function(_0x5989ab){if(_0x5989ab[_0x492f('0x2d')]!=='VIRTUAL'){var _0x3e0bab={};_0x3e0bab[_0x5989ab[_0x492f('0x28')]]={'$like':'%'+_0x53856c[_0x492f('0x2f')][_0x492f('0x3a')]+'%'};return _0x3e0bab;}})});}_0x2ec2be=_[_0x492f('0x3b')]({},_0x2ec2be,_0x53856c[_0x492f('0x3c')]);var _0x86dc9e={'where':_0x2ec2be['where']};return db[_0x492f('0x2b')]['count'](_0x86dc9e)[_0x492f('0x22')](function(_0x4632d3){_0x58872a['count']=_0x4632d3;if(_0x53856c[_0x492f('0x2f')]['includeAll']){_0x2ec2be['include']=[{'all':!![]}];}return db[_0x492f('0x2b')]['findAll'](_0x2ec2be);})[_0x492f('0x22')](function(_0x5d8418){_0x58872a['rows']=_0x5d8418;return _0x58872a;})['then'](respondWithFilteredResult(_0x5bd1bc,_0x2ec2be))['catch'](handleError(_0x5bd1bc,null));};exports['show']=function(_0x54e597,_0xdf8c7b){var _0xc030ea={'raw':!![],'where':{'id':_0x54e597['params']['id']}},_0x4acdd2={};_0x4acdd2[_0x492f('0x2e')]=_[_0x492f('0x30')](db[_0x492f('0x2b')][_0x492f('0x2c')]);_0x4acdd2[_0x492f('0x2f')]=_[_0x492f('0x30')](_0x54e597[_0x492f('0x2f')]);_0x4acdd2[_0x492f('0x31')]=_[_0x492f('0x32')](_0x4acdd2['model'],_0x4acdd2[_0x492f('0x2f')]);_0xc030ea[_0x492f('0x33')]=_[_0x492f('0x32')](_0x4acdd2['model'],qs[_0x492f('0x34')](_0x54e597['query']['fields']));_0xc030ea[_0x492f('0x33')]=_0xc030ea[_0x492f('0x33')]['length']?_0xc030ea[_0x492f('0x33')]:_0x4acdd2[_0x492f('0x2e')];if(_0x54e597[_0x492f('0x2f')][_0x492f('0x3d')]){_0xc030ea[_0x492f('0x3e')]=[{'all':!![]}];}_0xc030ea=_['merge']({},_0xc030ea,_0x54e597['options']);return db['Disposition'][_0x492f('0x3f')](_0xc030ea)['then'](handleEntityNotFound(_0xdf8c7b,null))[_0x492f('0x22')](respondWithResult(_0xdf8c7b,null))['catch'](handleError(_0xdf8c7b,null));};exports['create']=function(_0x5a90ad,_0x1bb9ed){return db[_0x492f('0x2b')][_0x492f('0x40')](_0x5a90ad[_0x492f('0x41')],{})[_0x492f('0x22')](function(_0x45ffaa){var _0x119a3c=_0x5a90ad[_0x492f('0x42')][_0x492f('0x24')]({'plain':!![]});if(!_0x119a3c)throw new Error(_0x492f('0x43'));if(_0x119a3c[_0x492f('0x44')]==='user'){var _0x571b28=_0x45ffaa[_0x492f('0x24')]({'plain':!![]});var _0x428d4e='Dispositions';return db['UserProfileSection'][_0x492f('0x3f')]({'where':{'name':_0x428d4e,'userProfileId':_0x119a3c[_0x492f('0x45')]},'raw':!![]})[_0x492f('0x22')](function(_0x3e073d){if(_0x3e073d&&_0x3e073d['autoAssociation']===0x0){return db[_0x492f('0x25')][_0x492f('0x40')]({'name':_0x571b28[_0x492f('0x28')],'resourceId':_0x571b28['id'],'type':_0x3e073d[_0x492f('0x28')],'sectionId':_0x3e073d['id']},{})[_0x492f('0x22')](function(){return _0x45ffaa;});}else{return _0x45ffaa;}})[_0x492f('0x46')](function(_0x373c9e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x373c9e);throw _0x373c9e;});}return _0x45ffaa;})[_0x492f('0x22')](respondWithResult(_0x1bb9ed,0xc9))['catch'](handleError(_0x1bb9ed,null));};exports[_0x492f('0x21')]=function(_0x23e863,_0xdd38b2){if(_0x23e863[_0x492f('0x41')]['id']){delete _0x23e863[_0x492f('0x41')]['id'];}return db[_0x492f('0x2b')][_0x492f('0x3f')]({'where':{'id':_0x23e863[_0x492f('0x47')]['id']}})['then'](handleEntityNotFound(_0xdd38b2,null))[_0x492f('0x22')](saveUpdates(_0x23e863[_0x492f('0x41')],null))[_0x492f('0x22')](respondWithResult(_0xdd38b2,null))[_0x492f('0x46')](handleError(_0xdd38b2,null));};exports[_0x492f('0x23')]=function(_0x1c39f0,_0x4613c9){return db[_0x492f('0x2b')][_0x492f('0x3f')]({'where':{'id':_0x1c39f0[_0x492f('0x47')]['id']}})[_0x492f('0x22')](handleEntityNotFound(_0x4613c9,null))[_0x492f('0x22')](removeEntity(_0x4613c9,null))[_0x492f('0x46')](handleError(_0x4613c9,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2270b24..4260d64 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 _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 +var _0x1a1a=['name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_dispositions'];(function(_0x405d40,_0xc57994){var _0x576905=function(_0x4f58da){while(--_0x4f58da){_0x405d40['push'](_0x405d40['shift']());}};_0x576905(++_0xc57994);}(_0x1a1a,0xbb));var _0xa1a1=function(_0x4ede94,_0x4d346a){_0x4ede94=_0x4ede94-0x0;var _0x8c2fbb=_0x1a1a[_0x4ede94];return _0x8c2fbb;};'use strict';var _=require(_0xa1a1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa1a1('0x1'));var moment=require(_0xa1a1('0x2'));var BPromise=require(_0xa1a1('0x3'));var rp=require(_0xa1a1('0x4'));var fs=require('fs');var path=require(_0xa1a1('0x5'));var rimraf=require(_0xa1a1('0x6'));var config=require(_0xa1a1('0x7'));var attributes=require('./disposition.attributes');module[_0xa1a1('0x8')]=function(_0x5de3c2,_0x13562b){return _0x5de3c2[_0xa1a1('0x9')]('Disposition',attributes,{'tableName':_0xa1a1('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa1a1('0xb'),'fields':[_0xa1a1('0xc'),_0xa1a1('0xd')]},{'unique':!![],'name':_0xa1a1('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xa1a1('0xf'),'fields':[_0xa1a1('0xc'),_0xa1a1('0x10')]},{'unique':!![],'name':_0xa1a1('0x11'),'fields':[_0xa1a1('0xc'),_0xa1a1('0x12')]},{'unique':!![],'name':'name_fax','fields':['name',_0xa1a1('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xa1a1('0xc'),_0xa1a1('0x14')]},{'unique':!![],'name':_0xa1a1('0x15'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index af67c16..0ec7770 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(_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 +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(_0x2429fd,_0x10b4f6){var _0xff9b12=function(_0x159912){while(--_0x159912){_0x2429fd['push'](_0x2429fd['shift']());}};_0xff9b12(++_0x10b4f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 3926509..7deab6d 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 _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 +var _0xb99c=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x343cc4,_0x5ba0f7){var _0x5dc8ce=function(_0x5dacc8){while(--_0x5dacc8){_0x343cc4['push'](_0x343cc4['shift']());}};_0x5dc8ce(++_0x5ba0f7);}(_0xb99c,0x153));var _0xcb99=function(_0x18cf5e,_0x579100){_0x18cf5e=_0x18cf5e-0x0;var _0x2d4a88=_0xb99c[_0x18cf5e];return _0x2d4a88;};'use strict';var multer=require(_0xcb99('0x0'));var util=require(_0xcb99('0x1'));var path=require(_0xcb99('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb99('0x3'));var router=express[_0xcb99('0x4')]();var fs_extra=require(_0xcb99('0x5'));var auth=require(_0xcb99('0x6'));var interaction=require(_0xcb99('0x7'));var config=require(_0xcb99('0x8'));var controller=require(_0xcb99('0x9'));router[_0xcb99('0xa')]('/',auth[_0xcb99('0xb')](),controller[_0xcb99('0xc')]);router[_0xcb99('0xa')](_0xcb99('0xd'),auth[_0xcb99('0xb')](),controller[_0xcb99('0xe')]);router[_0xcb99('0xf')]('/',auth[_0xcb99('0xb')](),controller['create']);router[_0xcb99('0x10')]('/:id',auth[_0xcb99('0xb')](),controller[_0xcb99('0x11')]);router[_0xcb99('0x12')](_0xcb99('0xd'),auth[_0xcb99('0xb')](),controller[_0xcb99('0x13')]);module[_0xcb99('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3747f6a..fc3bba1 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 _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 +var _0xaf1b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','12000','v17,v27,v29','INTEGER','SIP','KHOMP','TEXT'];(function(_0x2cf81a,_0x1f8e73){var _0x27daa4=function(_0x504aac){while(--_0x504aac){_0x2cf81a['push'](_0x2cf81a['shift']());}};_0x27daa4(++_0x1f8e73);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x331581,_0x1b378e){_0x331581=_0x331581-0x0;var _0x2505d2=_0xaf1b[_0x331581];return _0x2505d2;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbaf1('0x2')]},'ecm':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x4'),'no'),'defaultValue':_0xbaf1('0x4')},'headerinfo':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':_0xbaf1('0x5')},'localstationid':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x6')},'minrate':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x7'),_0xbaf1('0x8'),'7200',_0xbaf1('0x9'),'12000',_0xbaf1('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x7'),_0xbaf1('0x8'),'7200',_0xbaf1('0x9'),_0xbaf1('0xb'),'14400'),'defaultValue':_0xbaf1('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xbaf1('0xc')},'gateway':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbaf1('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0xe'),'IAX','DADHI',_0xbaf1('0xf')),'defaultValue':_0xbaf1('0xe')},'key':{'type':Sequelize[_0xbaf1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbaf1('0x10')],'defaultValue':function(){return _0xbaf1('0x11');}},'notificationSound':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbaf1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbaf1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbaf1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbaf1('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xbaf1('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33c23b){if(!_0x33c23b)this['setDataValue'](_0xbaf1('0x14'),null);this[_0xbaf1('0x15')](_0xbaf1('0x16'),_0x33c23b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e892eeb..e390261 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 _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 +var _0x0d46=['push','CDR(type)=inbound-fax','Set','ecm','localstationid','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','key','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','dataValues','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','end','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','system','description'];(function(_0x2b3278,_0xa6d2c5){var _0x2c66dc=function(_0x3da215){while(--_0x3da215){_0x2b3278['push'](_0x2b3278['shift']());}};_0x2c66dc(++_0xa6d2c5);}(_0x0d46,0xfb));var _0x60d4=function(_0x2c665a,_0x330ba9){_0x2c665a=_0x2c665a-0x0;var _0x5d9f89=_0x0d46[_0x2c665a];return _0x5d9f89;};'use strict';var emlformat=require(_0x60d4('0x0'));var rimraf=require(_0x60d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x60d4('0x2'));var moment=require(_0x60d4('0x3'));var BPromise=require(_0x60d4('0x4'));var Mustache=require(_0x60d4('0x5'));var util=require(_0x60d4('0x6'));var path=require(_0x60d4('0x7'));var sox=require(_0x60d4('0x8'));var csv=require(_0x60d4('0x9'));var ejs=require(_0x60d4('0xa'));var fs=require('fs');var fs_extra=require(_0x60d4('0xb'));var _=require('lodash');var squel=require(_0x60d4('0xc'));var crypto=require('crypto');var jsforce=require(_0x60d4('0xd'));var deskjs=require(_0x60d4('0xe'));var toCsv=require(_0x60d4('0x9'));var querystring=require(_0x60d4('0xf'));var Papa=require(_0x60d4('0x10'));var Redis=require(_0x60d4('0x11'));var authService=require(_0x60d4('0x12'));var qs=require(_0x60d4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60d4('0x14'));var logger=require(_0x60d4('0x15'))(_0x60d4('0x16'));var utils=require('../../config/utils');var config=require(_0x60d4('0x17'));var licenseUtil=require(_0x60d4('0x18'));var db=require(_0x60d4('0x19'))['db'];config['redis']=_[_0x60d4('0x1a')](config['redis'],{'host':_0x60d4('0x1b'),'port':0x18eb});var socket=require(_0x60d4('0x1c'))(new Redis(config['redis']));require(_0x60d4('0x1d'))[_0x60d4('0x1e')](socket);var jayson=require(_0x60d4('0x1f'));var client=jayson[_0x60d4('0x20')][_0x60d4('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x60d4('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x402ce5,_0x57126e,_0x20c6dd,_0x4d1105){return new BPromise(function(_0x494dcc,_0xaa1d8f){var _0x708b00=_0x4d1105||client;return _0x708b00[_0x60d4('0x22')](_0x402ce5,_0x20c6dd)[_0x60d4('0x23')](function(_0x5aed19){logger[_0x60d4('0x24')](_0x60d4('0x25'),_0x57126e,_0x60d4('0x26'));logger[_0x60d4('0x27')](_0x60d4('0x28'),_0x57126e,_0x60d4('0x26'),JSON[_0x60d4('0x29')](_0x5aed19));if(_0x5aed19[_0x60d4('0x2a')]){if(_0x5aed19[_0x60d4('0x2a')][_0x60d4('0x2b')]===0x1f4){logger[_0x60d4('0x2a')](_0x60d4('0x25'),_0x57126e,_0x5aed19[_0x60d4('0x2a')][_0x60d4('0x2c')]);return _0xaa1d8f(_0x5aed19[_0x60d4('0x2a')][_0x60d4('0x2c')]);}logger[_0x60d4('0x2a')](_0x60d4('0x25'),_0x57126e,_0x5aed19[_0x60d4('0x2a')]['message']);return _0x494dcc(_0x5aed19[_0x60d4('0x2a')]['message']);}else{logger['info'](_0x60d4('0x25'),_0x57126e,_0x60d4('0x26'));_0x494dcc(_0x5aed19['result'][_0x60d4('0x2c')]);}})[_0x60d4('0x2d')](function(_0x513206){logger[_0x60d4('0x2a')](_0x60d4('0x25'),_0x57126e,_0x513206);_0xaa1d8f(_0x513206);});});}function respondWithStatusCode(_0x2ebfd1,_0x5ad612){_0x5ad612=_0x5ad612||0xcc;return function(_0x1fe091){if(_0x1fe091){return _0x2ebfd1[_0x60d4('0x2e')](_0x5ad612);}return _0x2ebfd1[_0x60d4('0x2f')](_0x5ad612)['end']();};}function respondWithResult(_0x534111,_0x33a4e8){_0x33a4e8=_0x33a4e8||0xc8;return function(_0x4399fd){if(_0x4399fd){return _0x534111[_0x60d4('0x2f')](_0x33a4e8)[_0x60d4('0x30')](_0x4399fd);}};}function respondWithFilteredResult(_0x3a1589,_0x49aa88){return function(_0x58628f){if(_0x58628f){var _0x34cfef=typeof _0x49aa88['offset']===_0x60d4('0x31')&&typeof _0x49aa88[_0x60d4('0x32')]===_0x60d4('0x31');var _0x83be69=_0x58628f['count'];var _0x4c03dc=_0x34cfef?0x0:_0x49aa88[_0x60d4('0x33')];var _0x520975=_0x34cfef?_0x58628f['count']:_0x49aa88[_0x60d4('0x33')]+_0x49aa88[_0x60d4('0x32')];var _0x23aa48;if(_0x520975>=_0x83be69){_0x520975=_0x83be69;_0x23aa48=0xc8;}else{_0x23aa48=0xce;}_0x3a1589[_0x60d4('0x2f')](_0x23aa48);return _0x3a1589[_0x60d4('0x34')](_0x60d4('0x35'),_0x4c03dc+'-'+_0x520975+'/'+_0x83be69)[_0x60d4('0x30')](_0x58628f);}return null;};}function patchUpdates(_0x411dbd){return function(_0x1632b1){try{jsonpatch[_0x60d4('0x36')](_0x1632b1,_0x411dbd,!![]);}catch(_0x9acd24){return BPromise[_0x60d4('0x37')](_0x9acd24);}return _0x1632b1['save']();};}function saveUpdates(_0x591417,_0xf01d3a){return function(_0x467350){if(_0x467350){return _0x467350[_0x60d4('0x38')](_0x591417)[_0x60d4('0x23')](function(_0x22328d){return _0x22328d;});}return null;};}function removeEntity(_0x29e05e,_0x2b5499){return function(_0x16acad){if(_0x16acad){return _0x16acad[_0x60d4('0x39')]()[_0x60d4('0x23')](function(){var _0x30d772=_0x16acad[_0x60d4('0x3a')]({'plain':!![]});var _0x9ee9e7=_0x60d4('0x3b');return db[_0x60d4('0x3c')][_0x60d4('0x39')]({'where':{'type':_0x9ee9e7,'resourceId':_0x30d772['id']}})[_0x60d4('0x23')](function(){return _0x16acad;});})['then'](function(){_0x29e05e['status'](0xcc)[_0x60d4('0x3d')]();});}};}function handleEntityNotFound(_0x40c8fa,_0x2f50ca){return function(_0x4fea54){if(!_0x4fea54){_0x40c8fa['sendStatus'](0x194);}return _0x4fea54;};}function handleError(_0x11a17f,_0x306c56){_0x306c56=_0x306c56||0x1f4;return function(_0x2f768c){logger[_0x60d4('0x2a')](_0x2f768c['stack']);if(_0x2f768c['name']){delete _0x2f768c['name'];}_0x11a17f[_0x60d4('0x2f')](_0x306c56)[_0x60d4('0x3e')](_0x2f768c);};}exports[_0x60d4('0x3f')]=function(_0x58b487,_0x1cb3e7){var _0x5a6eeb={'include':[{'model':db['Pause'],'as':_0x60d4('0x40')}]},_0x1d4125={},_0x3cbf23={'count':0x0,'rows':[]};var _0xbe368a=_[_0x60d4('0x41')](db[_0x60d4('0x42')][_0x60d4('0x43')],function(_0x44441b){return{'name':_0x44441b[_0x60d4('0x44')],'type':_0x44441b[_0x60d4('0x45')]['key']};});_0x1d4125[_0x60d4('0x46')]=_[_0x60d4('0x41')](_0xbe368a,_0x60d4('0x47'));_0x1d4125[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x58b487['query']);_0x1d4125[_0x60d4('0x4a')]=_[_0x60d4('0x4b')](_0x1d4125[_0x60d4('0x46')],_0x1d4125[_0x60d4('0x48')]);_0x5a6eeb['attributes']=_[_0x60d4('0x4b')](_0x1d4125[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x58b487['query'][_0x60d4('0x4c')]));_0x5a6eeb['attributes']=_0x5a6eeb[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x5a6eeb[_0x60d4('0x4d')]:_0x1d4125[_0x60d4('0x46')];if(!_0x58b487['query'][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x5a6eeb[_0x60d4('0x32')]=qs[_0x60d4('0x32')](_0x58b487['query']['limit']);_0x5a6eeb[_0x60d4('0x33')]=qs[_0x60d4('0x33')](_0x58b487[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x5a6eeb[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x58b487['query']['sort']);_0x5a6eeb[_0x60d4('0x53')]=qs['filters'](_[_0x60d4('0x54')](_0x58b487[_0x60d4('0x48')],_0x1d4125[_0x60d4('0x4a')]),_0xbe368a);if(_0x58b487[_0x60d4('0x48')][_0x60d4('0x55')]){_0x5a6eeb[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x5a6eeb[_0x60d4('0x53')],{'$or':_['map'](_0xbe368a,function(_0x2ee3e9){if(_0x2ee3e9[_0x60d4('0x45')]!==_0x60d4('0x57')){var _0x5d43c2={};_0x5d43c2[_0x2ee3e9[_0x60d4('0x47')]]={'$like':'%'+_0x58b487['query'][_0x60d4('0x55')]+'%'};return _0x5d43c2;}})});}_0x5a6eeb=_[_0x60d4('0x56')]({},_0x5a6eeb,_0x58b487[_0x60d4('0x58')]);var _0x282a83={'where':_0x5a6eeb[_0x60d4('0x53')]};return db['FaxAccount'][_0x60d4('0x59')](_0x282a83)[_0x60d4('0x23')](function(_0x691795){_0x3cbf23['count']=_0x691795;if(_0x58b487[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x5a6eeb[_0x60d4('0x5b')]=[{'all':!![]}];}return db[_0x60d4('0x42')][_0x60d4('0x5c')](_0x5a6eeb);})[_0x60d4('0x23')](function(_0x42667b){_0x3cbf23[_0x60d4('0x5d')]=_0x42667b;return _0x3cbf23;})[_0x60d4('0x23')](respondWithFilteredResult(_0x1cb3e7,_0x5a6eeb))[_0x60d4('0x2d')](handleError(_0x1cb3e7,null));};exports[_0x60d4('0x5e')]=function(_0x53f0eb,_0x480e4c){var _0x21dd3b={'raw':![],'where':{'id':_0x53f0eb[_0x60d4('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x60d4('0x40')}]},_0x211ddb={};_0x211ddb[_0x60d4('0x46')]=_['keys'](db[_0x60d4('0x42')][_0x60d4('0x43')]);_0x211ddb[_0x60d4('0x48')]=_['keys'](_0x53f0eb[_0x60d4('0x48')]);_0x211ddb['filters']=_['intersection'](_0x211ddb[_0x60d4('0x46')],_0x211ddb['query']);_0x21dd3b['attributes']=_[_0x60d4('0x4b')](_0x211ddb['model'],qs['fields'](_0x53f0eb[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x21dd3b[_0x60d4('0x4d')]=_0x21dd3b['attributes'][_0x60d4('0x4e')]?_0x21dd3b['attributes']:_0x211ddb[_0x60d4('0x46')];if(_0x53f0eb[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x21dd3b[_0x60d4('0x5b')]=[{'all':!![]}];}_0x21dd3b=_[_0x60d4('0x56')]({},_0x21dd3b,_0x53f0eb[_0x60d4('0x58')]);return db['FaxAccount'][_0x60d4('0x60')](_0x21dd3b)[_0x60d4('0x23')](handleEntityNotFound(_0x480e4c,null))['then'](respondWithResult(_0x480e4c,null))[_0x60d4('0x2d')](handleError(_0x480e4c,null));};exports[_0x60d4('0x61')]=function(_0x4dc2d9,_0x173496){return db['FaxAccount'][_0x60d4('0x61')](_0x4dc2d9[_0x60d4('0x62')],{})['then'](function(_0x21c78c){var _0x262ad1=_0x4dc2d9[_0x60d4('0x63')][_0x60d4('0x3a')]({'plain':!![]});if(!_0x262ad1)throw new Error(_0x60d4('0x64'));if(_0x262ad1[_0x60d4('0x65')]==='user'){var _0x17ea01=_0x21c78c[_0x60d4('0x3a')]({'plain':!![]});var _0x3cb1f8='FaxAccounts';return db[_0x60d4('0x66')][_0x60d4('0x60')]({'where':{'name':_0x3cb1f8,'userProfileId':_0x262ad1['userProfileId']},'raw':!![]})[_0x60d4('0x23')](function(_0x154c8a){if(_0x154c8a&&_0x154c8a[_0x60d4('0x67')]===0x0){return db[_0x60d4('0x3c')][_0x60d4('0x61')]({'name':_0x17ea01[_0x60d4('0x47')],'resourceId':_0x17ea01['id'],'type':_0x154c8a[_0x60d4('0x47')],'sectionId':_0x154c8a['id']},{})[_0x60d4('0x23')](function(){return _0x21c78c;});}else{return _0x21c78c;}})[_0x60d4('0x2d')](function(_0x466032){logger['error'](_0x60d4('0x68'),_0x466032);throw _0x466032;});}return _0x21c78c;})[_0x60d4('0x23')](respondWithResult(_0x173496,0xc9))[_0x60d4('0x2d')](handleError(_0x173496,null));};exports[_0x60d4('0x38')]=function(_0x19b643,_0x5657e2){if(_0x19b643[_0x60d4('0x62')]['id']){delete _0x19b643[_0x60d4('0x62')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x19b643['params']['id']},'include':[{'model':db[_0x60d4('0x69')],'as':_0x60d4('0x40')}]})[_0x60d4('0x23')](handleEntityNotFound(_0x5657e2,null))['then'](saveUpdates(_0x19b643[_0x60d4('0x62')],null))[_0x60d4('0x23')](respondWithResult(_0x5657e2,null))[_0x60d4('0x2d')](handleError(_0x5657e2,null));};exports['destroy']=function(_0xab6262,_0x20d4c4){return db['FaxAccount'][_0x60d4('0x60')]({'where':{'id':_0xab6262[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x20d4c4,null))[_0x60d4('0x23')](removeEntity(_0x20d4c4,null))['catch'](handleError(_0x20d4c4,null));};exports[_0x60d4('0x6a')]=function(_0x9c0a1f,_0x316989){return db[_0x60d4('0x42')][_0x60d4('0x6a')]()['then'](respondWithResult(_0x316989,null))['catch'](handleError(_0x316989,null));};exports[_0x60d4('0x6b')]=function(_0x3902b0,_0x3b556f,_0x86ccc7){if(_0x3902b0[_0x60d4('0x62')]['id']){delete _0x3902b0[_0x60d4('0x62')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3902b0['params']['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x3b556f,null))[_0x60d4('0x23')](function(_0x322cc4){if(_0x322cc4){_0x3902b0[_0x60d4('0x62')][_0x60d4('0x6c')]=_0x322cc4['id'];return db[_0x60d4('0x6d')][_0x60d4('0x61')](_0x3902b0[_0x60d4('0x62')]);}})[_0x60d4('0x23')](respondWithResult(_0x3b556f,null))[_0x60d4('0x2d')](handleError(_0x3b556f,null));};exports[_0x60d4('0x6e')]=function(_0x8bfa14,_0x2271c7,_0x1f6d60){var _0x1c4c74={'raw':![],'where':{}};var _0x20bf3f={};var _0x48dd52={'count':0x0,'rows':[]};return db[_0x60d4('0x42')]['findOne']({'where':{'id':_0x8bfa14[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x2271c7,null))[_0x60d4('0x23')](function(_0x43e547){if(_0x43e547){_0x20bf3f[_0x60d4('0x46')]=_[_0x60d4('0x49')](db[_0x60d4('0x6d')][_0x60d4('0x43')]);_0x20bf3f['query']=_[_0x60d4('0x49')](_0x8bfa14[_0x60d4('0x48')]);_0x20bf3f['filters']=_['intersection'](_0x20bf3f[_0x60d4('0x46')],_0x20bf3f[_0x60d4('0x48')]);_0x1c4c74[_0x60d4('0x4d')]=_['intersection'](_0x20bf3f[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x8bfa14[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x1c4c74['attributes']=_0x1c4c74[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x1c4c74['attributes']:_0x20bf3f[_0x60d4('0x46')];if(!_0x8bfa14[_0x60d4('0x48')]['hasOwnProperty'](_0x60d4('0x50'))){_0x1c4c74[_0x60d4('0x32')]=qs[_0x60d4('0x32')](_0x8bfa14[_0x60d4('0x48')]['limit']);_0x1c4c74[_0x60d4('0x33')]=qs[_0x60d4('0x33')](_0x8bfa14[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x1c4c74[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x8bfa14['query']['sort']);_0x1c4c74['where']=qs[_0x60d4('0x4a')](_['pick'](_0x8bfa14['query'],_0x20bf3f[_0x60d4('0x4a')]));_0x1c4c74[_0x60d4('0x53')][_0x60d4('0x6c')]=_0x43e547['id'];if(_0x8bfa14[_0x60d4('0x48')]['filter']){_0x1c4c74[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x1c4c74[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x1c4c74[_0x60d4('0x4d')],function(_0x36b6c6){var _0x147623={};_0x147623[_0x36b6c6]={'$like':'%'+_0x8bfa14[_0x60d4('0x48')]['filter']+'%'};return _0x147623;})});}_0x1c4c74=_[_0x60d4('0x56')]({},_0x1c4c74,_0x8bfa14[_0x60d4('0x58')]);return db[_0x60d4('0x6d')][_0x60d4('0x59')]({'where':_0x1c4c74[_0x60d4('0x53')]})[_0x60d4('0x23')](function(_0x266ec3){_0x48dd52[_0x60d4('0x59')]=_0x266ec3;if(_0x8bfa14[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x1c4c74[_0x60d4('0x5b')]=[{'all':!![]}];}return db[_0x60d4('0x6d')][_0x60d4('0x5c')](_0x1c4c74);})[_0x60d4('0x23')](function(_0x3e8867){_0x48dd52[_0x60d4('0x5d')]=_0x3e8867;return _0x48dd52;});}})[_0x60d4('0x23')](respondWithFilteredResult(_0x2271c7,_0x1c4c74))[_0x60d4('0x2d')](handleError(_0x2271c7,null));};exports[_0x60d4('0x6f')]=function(_0x3813a9,_0x2dcda1,_0x286f97){return db[_0x60d4('0x42')][_0x60d4('0x60')]({'where':{'id':_0x3813a9[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x2dcda1,null))[_0x60d4('0x23')](function(_0x4db2a6){if(_0x4db2a6){return _0x4db2a6[_0x60d4('0x6f')](_0x3813a9[_0x60d4('0x48')][_0x60d4('0x70')]);}})[_0x60d4('0x23')](respondWithStatusCode(_0x2dcda1,null))[_0x60d4('0x2d')](handleError(_0x2dcda1,null));};exports[_0x60d4('0x71')]=function(_0x48a188,_0x1e4a30,_0x3c2c9c){if(_0x48a188[_0x60d4('0x62')]['id']){delete _0x48a188[_0x60d4('0x62')]['id'];}return db[_0x60d4('0x42')]['find']({'where':{'id':_0x48a188['params']['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x1e4a30,null))[_0x60d4('0x23')](function(_0x36000b){if(_0x36000b){_0x48a188[_0x60d4('0x62')][_0x60d4('0x6c')]=_0x36000b['id'];return db['CannedAnswer'][_0x60d4('0x61')](_0x48a188[_0x60d4('0x62')]);}})[_0x60d4('0x23')](respondWithResult(_0x1e4a30,null))['catch'](handleError(_0x1e4a30,null));};exports['getAnswers']=function(_0x1af723,_0x101c23,_0x4bfce7){var _0x41c9d5={'raw':![],'where':{}};var _0x1c94ed={};var _0x4041cf={'count':0x0,'rows':[]};return db[_0x60d4('0x42')]['findOne']({'where':{'id':_0x1af723[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x101c23,null))[_0x60d4('0x23')](function(_0x5688c0){if(_0x5688c0){_0x1c94ed[_0x60d4('0x46')]=_[_0x60d4('0x49')](db[_0x60d4('0x72')]['rawAttributes']);_0x1c94ed[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x1af723[_0x60d4('0x48')]);_0x1c94ed[_0x60d4('0x4a')]=_[_0x60d4('0x4b')](_0x1c94ed[_0x60d4('0x46')],_0x1c94ed[_0x60d4('0x48')]);_0x41c9d5[_0x60d4('0x4d')]=_[_0x60d4('0x4b')](_0x1c94ed[_0x60d4('0x46')],qs['fields'](_0x1af723['query'][_0x60d4('0x4c')]));_0x41c9d5[_0x60d4('0x4d')]=_0x41c9d5['attributes'][_0x60d4('0x4e')]?_0x41c9d5[_0x60d4('0x4d')]:_0x1c94ed['model'];if(!_0x1af723[_0x60d4('0x48')][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x41c9d5['limit']=qs['limit'](_0x1af723[_0x60d4('0x48')][_0x60d4('0x32')]);_0x41c9d5['offset']=qs['offset'](_0x1af723[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x41c9d5['order']=qs[_0x60d4('0x52')](_0x1af723[_0x60d4('0x48')][_0x60d4('0x52')]);_0x41c9d5[_0x60d4('0x53')]=qs[_0x60d4('0x4a')](_[_0x60d4('0x54')](_0x1af723[_0x60d4('0x48')],_0x1c94ed['filters']));_0x41c9d5[_0x60d4('0x53')]['FaxAccountId']=_0x5688c0['id'];if(_0x1af723[_0x60d4('0x48')][_0x60d4('0x55')]){_0x41c9d5['where']=_[_0x60d4('0x56')](_0x41c9d5[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x41c9d5[_0x60d4('0x4d')],function(_0x174d8e){var _0x83bd06={};_0x83bd06[_0x174d8e]={'$like':'%'+_0x1af723[_0x60d4('0x48')][_0x60d4('0x55')]+'%'};return _0x83bd06;})});}_0x41c9d5=_[_0x60d4('0x56')]({},_0x41c9d5,_0x1af723[_0x60d4('0x58')]);return db['CannedAnswer'][_0x60d4('0x59')]({'where':_0x41c9d5['where']})['then'](function(_0x5b04c5){_0x4041cf[_0x60d4('0x59')]=_0x5b04c5;if(_0x1af723[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x41c9d5[_0x60d4('0x5b')]=[{'all':!![]}];}return db[_0x60d4('0x72')][_0x60d4('0x5c')](_0x41c9d5);})[_0x60d4('0x23')](function(_0x31260c){_0x4041cf[_0x60d4('0x5d')]=_0x31260c;return _0x4041cf;});}})['then'](respondWithFilteredResult(_0x101c23,_0x41c9d5))['catch'](handleError(_0x101c23,null));};exports[_0x60d4('0x73')]=function(_0x349788,_0x54f06e,_0x5c7902){return db[_0x60d4('0x42')]['find']({'where':{'id':_0x349788[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x54f06e,null))['then'](function(_0x922eb4){if(_0x922eb4){return _0x922eb4['removeAnswers'](_0x349788[_0x60d4('0x48')][_0x60d4('0x70')]);}})[_0x60d4('0x23')](respondWithStatusCode(_0x54f06e,null))[_0x60d4('0x2d')](handleError(_0x54f06e,null));};exports[_0x60d4('0x74')]=function(_0x33e2dd,_0x2783ed,_0x11dc18){return db[_0x60d4('0x75')][_0x60d4('0x60')]({'where':{'id':_0x33e2dd['params']['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x2783ed,null))[_0x60d4('0x23')](function(_0x3c947a){if(_0x3c947a){return _0x3c947a[_0x60d4('0x74')](_0x33e2dd[_0x60d4('0x62')][_0x60d4('0x70')],_[_0x60d4('0x76')](_0x33e2dd[_0x60d4('0x62')],[_0x60d4('0x70'),'id'])||{});}})[_0x60d4('0x23')](respondWithResult(_0x2783ed,null))['catch'](handleError(_0x2783ed,null));};exports[_0x60d4('0x77')]=function(_0x309659,_0x31fc82,_0x2a8b13){var _0x166365={'raw':![],'where':{}};var _0x519d78={};var _0x3c8923={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x309659[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x31fc82,null))[_0x60d4('0x23')](function(_0x14cbe3){if(_0x14cbe3){_0x519d78[_0x60d4('0x46')]=_[_0x60d4('0x49')](db['FaxInteraction']['rawAttributes']);_0x519d78[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x309659[_0x60d4('0x48')]);_0x519d78['filters']=_['intersection'](_0x519d78['model'],_0x519d78[_0x60d4('0x48')]);_0x166365[_0x60d4('0x4d')]=_['intersection'](_0x519d78[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x309659[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x166365['attributes']=_0x166365[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x166365['attributes']:_0x519d78[_0x60d4('0x46')];if(!_0x309659['query']['hasOwnProperty'](_0x60d4('0x50'))){_0x166365[_0x60d4('0x32')]=qs[_0x60d4('0x32')](_0x309659[_0x60d4('0x48')]['limit']);_0x166365[_0x60d4('0x33')]=qs['offset'](_0x309659[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x166365[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x309659[_0x60d4('0x48')]['sort']);_0x166365[_0x60d4('0x53')]=qs[_0x60d4('0x4a')](_[_0x60d4('0x54')](_0x309659[_0x60d4('0x48')],_0x519d78['filters']));_0x166365[_0x60d4('0x53')]['FaxAccountId']=_0x14cbe3['id'];if(_0x309659['query']['filter']){_0x166365[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x166365[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x166365[_0x60d4('0x4d')],function(_0x3762fc){var _0x2560a3={};_0x2560a3[_0x3762fc]={'$like':'%'+_0x309659['query'][_0x60d4('0x55')]+'%'};return _0x2560a3;})});}_0x166365=_[_0x60d4('0x56')]({},_0x166365,_0x309659[_0x60d4('0x58')]);return db[_0x60d4('0x75')][_0x60d4('0x59')]({'where':_0x166365[_0x60d4('0x53')]})[_0x60d4('0x23')](function(_0x3bdf84){_0x3c8923[_0x60d4('0x59')]=_0x3bdf84;if(_0x309659[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x166365['include']=[{'model':db[_0x60d4('0x78')],'as':_0x60d4('0x79'),'required':![]},{'model':db[_0x60d4('0x7a')],'as':'Owner','attributes':[_0x60d4('0x47'),'fullname',_0x60d4('0x7b')],'required':![]},{'model':db[_0x60d4('0x7c')],'as':_0x60d4('0x7d'),'attributes':['id',_0x60d4('0x47'),_0x60d4('0x7e')],'where':_0x309659[_0x60d4('0x48')][_0x60d4('0x7f')]?{'id':_0x309659[_0x60d4('0x48')][_0x60d4('0x7f')]}:undefined,'required':_0x309659['query'][_0x60d4('0x7f')]?!![]:![]}];}return db[_0x60d4('0x75')][_0x60d4('0x5c')](_0x166365);})['then'](function(_0x25245a){_0x3c8923[_0x60d4('0x5d')]=_0x25245a;return _0x3c8923;});}})[_0x60d4('0x23')](respondWithFilteredResult(_0x31fc82,_0x166365))[_0x60d4('0x2d')](handleError(_0x31fc82,null));};exports[_0x60d4('0x80')]=function(_0x1de918,_0x62df4){var _0x122fdc=_0x1de918[_0x60d4('0x5f')]['id'];var _0x558e6d=_0x1de918['body'];var _0x4a6ac4=0xc8;var _0x25ddf4=null;return db[_0x60d4('0x81')]['transaction']({'isolationLevel':db[_0x60d4('0x81')][_0x60d4('0x82')][_0x60d4('0x83')]['READ_COMMITTED']},function(_0x5bab58){return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0x122fdc},'transaction':_0x5bab58})[_0x60d4('0x23')](function(_0x3159a7){if(_0x3159a7){return db[_0x60d4('0x85')][_0x60d4('0x39')]({'where':{'FaxAccountId':_0x122fdc},'transaction':_0x5bab58})[_0x60d4('0x23')](function(){var _0x2b7a1e=_[_0x60d4('0x41')](_0x558e6d,function(_0x30d355){_0x30d355[_0x60d4('0x6c')]=_0x122fdc;return _0x30d355;});return db['FaxApplication'][_0x60d4('0x86')](_0x2b7a1e,{'transaction':_0x5bab58});});}else{_0x4a6ac4=0x194;_0x25ddf4=[];}});})[_0x60d4('0x23')](function(){if(_0x4a6ac4!==0x194){return db[_0x60d4('0x85')][_0x60d4('0x87')]({'where':{'FaxAccountId':_0x122fdc},'order':_0x60d4('0x88')})['then'](function(_0x1f2508){_0x25ddf4=_0x1f2508;});}})[_0x60d4('0x2d')](function(_0x4b2d23){_0x4a6ac4=0x1f4;logger['error'](_0x4b2d23['stack']);if(_0x4b2d23['name']){delete _0x4b2d23[_0x60d4('0x47')];}_0x25ddf4=_0x4b2d23;})['finally'](function(){if(_0x25ddf4===null){_0x62df4[_0x60d4('0x2e')](_0x4a6ac4);}else{if(_0x4a6ac4===0x1f4){_0x62df4[_0x60d4('0x2f')](_0x4a6ac4)[_0x60d4('0x3e')](_0x25ddf4);}else{_0x62df4[_0x60d4('0x2f')](_0x4a6ac4)[_0x60d4('0x30')](_0x25ddf4);}}});};exports[_0x60d4('0x89')]=function(_0x14eda4,_0x50a8cc,_0x2802e8){var _0x3cee3c={};var _0xd6069c={};var _0x4d6874;var _0x4dc7a4;return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0x14eda4[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x50a8cc,null))[_0x60d4('0x23')](function(_0x26b6f5){if(_0x26b6f5){_0x4d6874=_0x26b6f5;_0xd6069c['model']=_[_0x60d4('0x49')](db['FaxApplication']['rawAttributes']);_0xd6069c[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x14eda4[_0x60d4('0x48')]);_0xd6069c['filters']=_['intersection'](_0xd6069c[_0x60d4('0x46')],_0xd6069c['query']);_0x3cee3c[_0x60d4('0x4d')]=_[_0x60d4('0x4b')](_0xd6069c[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x14eda4['query'][_0x60d4('0x4c')]));_0x3cee3c[_0x60d4('0x4d')]=_0x3cee3c[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x3cee3c[_0x60d4('0x4d')]:_0xd6069c[_0x60d4('0x46')];_0x3cee3c[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x14eda4[_0x60d4('0x48')][_0x60d4('0x52')]);_0x3cee3c[_0x60d4('0x53')]=qs[_0x60d4('0x4a')](_['pick'](_0x14eda4[_0x60d4('0x48')],_0xd6069c[_0x60d4('0x4a')]));if(_0x14eda4[_0x60d4('0x48')]['filter']){_0x3cee3c[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x3cee3c[_0x60d4('0x53')],{'$or':_['map'](_0x3cee3c[_0x60d4('0x4d')],function(_0x2a7abd){var _0x1d9a14={};_0x1d9a14[_0x2a7abd]={'$like':'%'+_0x14eda4[_0x60d4('0x48')][_0x60d4('0x55')]+'%'};return _0x1d9a14;})});}_0x3cee3c=_[_0x60d4('0x56')]({},_0x3cee3c,_0x14eda4[_0x60d4('0x58')]);return _0x4d6874[_0x60d4('0x89')](_0x3cee3c);}})[_0x60d4('0x23')](function(_0x94f09){if(_0x94f09){_0x4dc7a4=_0x94f09[_0x60d4('0x4e')];if(!_0x14eda4[_0x60d4('0x48')][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x3cee3c[_0x60d4('0x32')]=qs['limit'](_0x14eda4[_0x60d4('0x48')][_0x60d4('0x32')]);_0x3cee3c[_0x60d4('0x33')]=qs['offset'](_0x14eda4[_0x60d4('0x48')][_0x60d4('0x33')]);}return _0x4d6874[_0x60d4('0x89')](_0x3cee3c);}})[_0x60d4('0x23')](function(_0x5d1835){if(_0x5d1835){return _0x5d1835?{'count':_0x4dc7a4,'rows':_0x5d1835}:null;}})[_0x60d4('0x23')](respondWithResult(_0x50a8cc,null))['catch'](handleError(_0x50a8cc,null));};function Extension(_0x404613,_0x2d17cd,_0x13f814,_0x38a2f5){this[_0x60d4('0x8a')]=_0x60d4('0x8b');this[_0x60d4('0x8c')]=_0x404613['localstationid'];this['app']=_0x38a2f5;this[_0x60d4('0x45')]=_0x60d4('0x8d');this[_0x60d4('0x8e')]='Fax\x20Extension';this[_0x60d4('0x6c')]=_0x404613['id'];this[_0x60d4('0x88')]=_0x2d17cd;this['appdata']=_0x13f814;}function createExtensionsReciveFax(_0x488ae0){var _0xe7dba2=0x1;var _0x19e23e=[];_0x19e23e['push'](new Extension(_0x488ae0,_0xe7dba2,'','Answer'));_0xe7dba2+=0x1;_0x19e23e[_0x60d4('0x8f')](new Extension(_0x488ae0,_0xe7dba2,_0x60d4('0x90'),_0x60d4('0x91')));_0xe7dba2+=0x1;for(var _0x36856e in _0x488ae0){if(_0x488ae0[_0x60d4('0x4f')](_0x36856e)&&(_0x36856e===_0x60d4('0x92')||_0x36856e===_0x60d4('0x93')||_0x36856e==='gateway'||_0x36856e==='faxdetect'||_0x36856e===_0x60d4('0x94')||_0x36856e===_0x60d4('0x95')||_0x36856e===_0x60d4('0x96')||_0x36856e==='modem'||_0x36856e===_0x60d4('0x97'))){_0x19e23e['push'](new Extension(_0x488ae0,_0xe7dba2,_0x60d4('0x98')+_0x36856e+')='+_0x488ae0[_0x36856e],_0x60d4('0x91')));_0xe7dba2+=0x1;}}_0x19e23e[_0x60d4('0x8f')](new Extension(_0x488ae0,_0xe7dba2,'6',_0x60d4('0x99')));_0xe7dba2+=0x1;_0x19e23e['push'](new Extension(_0x488ae0,_0xe7dba2,'/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',_0x60d4('0x9a')));_0xe7dba2=0x0;return _0x19e23e;}exports[_0x60d4('0x9b')]=function(_0x54d03a,_0x139ada,_0x41a2d7){var _0x2b513e;return db[_0x60d4('0x81')][_0x60d4('0x9c')](function(_0x302a61){return db[_0x60d4('0x42')][_0x60d4('0x61')](_0x54d03a['body'],{'transaction':_0x302a61})[_0x60d4('0x23')](function(_0x38467e){_0x2b513e=_0x38467e[_0x60d4('0x3a')]({'plain':!![]});return db[_0x60d4('0x9d')][_0x60d4('0x86')](createExtensionsReciveFax(_0x2b513e),{'transaction':_0x302a61});});})[_0x60d4('0x23')](function(){return _0x2b513e;})[_0x60d4('0x23')](respondWithResult(_0x139ada,null))['catch'](handleError(_0x139ada,null));};exports[_0x60d4('0x9e')]=function(_0x594c8b,_0x110700,_0x4848d8){var _0x1af6e8;return db['sequelize'][_0x60d4('0x9c')](function(_0x1e74b0){return db[_0x60d4('0x42')][_0x60d4('0x38')](_0x594c8b[_0x60d4('0x62')],{'where':{'id':_0x594c8b[_0x60d4('0x62')]['id']},'transaction':_0x1e74b0})[_0x60d4('0x23')](function(_0x4b139a){return db[_0x60d4('0x9d')]['destroy']({'where':{'FaxAccountId':_0x594c8b[_0x60d4('0x62')]['id']},'transaction':_0x1e74b0})[_0x60d4('0x23')](function(_0x3cd66b){return db[_0x60d4('0x9d')][_0x60d4('0x86')](createExtensionsReciveFax(_[_0x60d4('0x76')](_0x594c8b[_0x60d4('0x62')],['tech',_0x60d4('0x9f'),_0x60d4('0xa0'),_0x60d4('0xa1'),'TrunkId',_0x60d4('0xa2')])),{'transaction':_0x1e74b0});});});})['then'](function(){return db[_0x60d4('0x42')][_0x60d4('0xa3')](_0x594c8b['body']['id']);})[_0x60d4('0x23')](respondWithResult(_0x110700,null))['catch'](handleError(_0x110700,null));};exports[_0x60d4('0xa4')]=function(_0xf10794,_0x1a45b9,_0x465778){var _0x57861f={'raw':!![],'where':{}};var _0x2aadcc={};var _0x40dd97={'count':0x0,'rows':[]};return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0xf10794[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1a45b9,null))['then'](function(_0x1c7763){if(_0x1c7763){_0x2aadcc[_0x60d4('0x46')]=_[_0x60d4('0x49')](db['FaxMessage']['rawAttributes']);_0x2aadcc[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0xf10794[_0x60d4('0x48')]);_0x2aadcc[_0x60d4('0x4a')]=_[_0x60d4('0x4b')](_0x2aadcc[_0x60d4('0x46')],_0x2aadcc[_0x60d4('0x48')]);_0x57861f[_0x60d4('0x4d')]=_['intersection'](_0x2aadcc['model'],qs[_0x60d4('0x4c')](_0xf10794['query'][_0x60d4('0x4c')]));_0x57861f[_0x60d4('0x4d')]=_0x57861f[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x57861f[_0x60d4('0x4d')]:_0x2aadcc['model'];if(!_0xf10794[_0x60d4('0x48')][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x57861f['limit']=qs[_0x60d4('0x32')](_0xf10794[_0x60d4('0x48')][_0x60d4('0x32')]);_0x57861f[_0x60d4('0x33')]=qs[_0x60d4('0x33')](_0xf10794['query'][_0x60d4('0x33')]);}_0x57861f[_0x60d4('0x51')]=qs['sort'](_0xf10794[_0x60d4('0x48')]['sort']);_0x57861f[_0x60d4('0x53')]=qs['filters'](_[_0x60d4('0x54')](_0xf10794['query'],_0x2aadcc[_0x60d4('0x4a')]));_0x57861f['where'][_0x60d4('0x6c')]=_0x1c7763['id'];if(_0xf10794[_0x60d4('0x48')][_0x60d4('0x55')]){_0x57861f[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x57861f[_0x60d4('0x53')],{'$or':_['map'](_0x57861f['attributes'],function(_0x11b58c){var _0x1ba1f4={};_0x1ba1f4[_0x11b58c]={'$like':'%'+_0xf10794[_0x60d4('0x48')][_0x60d4('0x55')]+'%'};return _0x1ba1f4;})});}if(_0xf10794[_0x60d4('0x48')][_0x60d4('0xa5')]){var _0x24b9ef=_0xf10794[_0x60d4('0x48')][_0x60d4('0xa5')][_0x60d4('0xa6')](',');var _0x2ab635={};_0x2ab635[_0x24b9ef[0x0]]={'$gte':moment(_0x24b9ef[0x1])[_0x60d4('0xa7')](_0x60d4('0xa8'))};_0x57861f['where']=_[_0x60d4('0x56')](_0x57861f['where'],_0x2ab635);}_0x57861f=_['merge']({},_0x57861f,_0xf10794[_0x60d4('0x58')]);return db[_0x60d4('0xa9')][_0x60d4('0x59')]({'where':_0x57861f[_0x60d4('0x53')]})['then'](function(_0xa7ec22){_0x40dd97[_0x60d4('0x59')]=_0xa7ec22;if(_0xf10794[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x57861f[_0x60d4('0x5b')]=[{'all':!![]}];}return db['FaxMessage'][_0x60d4('0x5c')](_0x57861f);})[_0x60d4('0x23')](function(_0x13b65c){_0x40dd97[_0x60d4('0x5d')]=_0x13b65c;return _0x40dd97;});}})[_0x60d4('0x23')](respondWithFilteredResult(_0x1a45b9,_0x57861f))['catch'](handleError(_0x1a45b9,null));};exports[_0x60d4('0x3e')]=function(_0x3fad71,_0x698caa,_0x531202){var _0x177e7c,_0x34857a={},_0x2d9ebc;if(_0x3fad71[_0x60d4('0x62')]['to']){_0x2d9ebc=_0x3fad71[_0x60d4('0x62')]['to'][0x0];}return db['FaxAccount'][_0x60d4('0x60')]({'where':{'id':_0x3fad71['params']['id']},'include':[{'model':db[_0x60d4('0xaa')],'as':_0x60d4('0xab'),'include':[{'model':db[_0x60d4('0x78')],'as':_0x60d4('0xac'),'where':{'fax':_0x2d9ebc},'limit':0x1,'order':[[_0x60d4('0xa1'),_0x60d4('0xad')]]}]}]})[_0x60d4('0x23')](handleEntityNotFound(_0x698caa,null))[_0x60d4('0x23')](function(_0x38469a){_0x177e7c=_0x38469a;if(_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')]&&_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x60d4('0x4e')]){for(var _0x50055f=0x0;_0x50055f<_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x60d4('0x4e')];_0x50055f+=0x1){_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x50055f]={'filename':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x50055f][_0x60d4('0x47')],'id':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x50055f]['id'],'path':path[_0x60d4('0xaf')](config[_0x60d4('0xb0')],_0x60d4('0xb1'),_0x3fad71['body']['attachments'][_0x50055f]['basename'])};}}return respondWithRpcPromise(_0x60d4('0xb2'),_0x60d4('0xb2'),{'FaxAccountId':_['isNil'](_0x3fad71[_0x60d4('0x5f')]['id'])?undefined:_0x3fad71[_0x60d4('0x5f')]['id'],'path':_['isNil'](_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0x7')])?undefined:_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0x7')],'fax':_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')]['to'][0x0])?undefined:_0x3fad71['body']['to'][0x0]},client9002);})[_0x60d4('0x23')](function(){if(_0x177e7c){if(_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')][_0x60d4('0xb4')])){_0x3fad71[_0x60d4('0x62')][_0x60d4('0xb4')]=util['format']('\x22%s\x22\x20<%s>',_0x177e7c[_0x60d4('0x47')],_0x177e7c[_0x60d4('0xb5')]);}if(_0x177e7c[_0x60d4('0xab')]){if(_0x177e7c[_0x60d4('0xab')]['Contacts']['length']){return _0x177e7c[_0x60d4('0xab')]['Contacts'][0x0];}else{return db['CmContact'][_0x60d4('0x61')](_[_0x60d4('0x1a')](_0x3fad71['body'],{'firstName':_0x3fad71[_0x60d4('0x62')]['to'][0x0],'phone':_0x3fad71['body']['to'][0x0],'fax':_0x3fad71[_0x60d4('0x62')]['to'][0x0],'ListId':_0x177e7c[_0x60d4('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x60d4('0xb6'));}})['then'](function(_0x498620){if(_0x498620){return db[_0x60d4('0x75')][_0x60d4('0x60')]({'where':{'ContactId':_0x498620['id'],'closed':![],'FaxAccountId':_0x177e7c['id']}})['then'](function(_0x352424){if(_0x352424){return[_0x352424,![]];}return db['FaxInteraction']['create']({'UserId':_0x3fad71[_0x60d4('0x63')]['id'],'ContactId':_0x498620['id'],'FaxAccountId':_0x177e7c['id'],'fax':_0x3fad71[_0x60d4('0x62')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x60d4('0x56')](_0x3fad71['body'],{'read':![],'body':_0x3fad71['body'][_0x60d4('0xae')][0x0][_0x60d4('0xb7')],'FaxAccountId':_0x177e7c['id'],'UserId':_0x3fad71[_0x60d4('0x63')]['id'],'ContactId':_0x498620['id'],'AttachmentId':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x60d4('0xa9')],'as':_0x60d4('0xb8')}]})['then'](function(_0x3bd029){return[_0x3bd029,!![]];});});}else{throw new Error(_0x60d4('0xb9'));}})['spread'](function(_0x2d05e0,_0xdbe44c){if(_0xdbe44c){return _0x2d05e0;}return db['FaxMessage'][_0x60d4('0x61')]({'direction':_0x60d4('0xba'),'read':![],'body':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0xb7')],'FaxAccountId':_0x177e7c['id'],'FaxInteractionId':_0x2d05e0['id'],'UserId':_0x3fad71[_0x60d4('0x63')]['id'],'ContactId':_0x2d05e0['ContactId'],'AttachmentId':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0]['id']})[_0x60d4('0x23')](function(_0xa31763){_0x2d05e0['dataValues']['Messages']=[];_0x2d05e0[_0x60d4('0xbb')][_0x60d4('0xb8')][_0x60d4('0x8f')](_0xa31763[_0x60d4('0xbb')]);return _0x2d05e0;});})['then'](function(_0x6fbfe4){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x3fad71[_0x60d4('0x5f')]['id'])?undefined:_0x3fad71[_0x60d4('0x5f')]['id'],'path':_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0x7')])?undefined:_0x3fad71['body']['attachments'][0x0][_0x60d4('0x7')],'fax':_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')]['to'][0x0])?undefined:_0x3fad71[_0x60d4('0x62')]['to'][0x0],'AttachmentId':_0x3fad71[_0x60d4('0x62')]['attachments'][0x0]['id']},client9002)[_0x60d4('0x23')](function(_0x2f05cf){logger[_0x60d4('0x24')](_0x60d4('0xbc'),_0x2f05cf);})[_0x60d4('0x2d')](function(_0x19ef1a){logger[_0x60d4('0x24')](_0x60d4('0xbc'),_0x19ef1a);});return _0x6fbfe4;})['then'](respondWithResult(_0x698caa,null))[_0x60d4('0x2d')](handleError(_0x698caa,null));};exports[_0x60d4('0xbd')]=function(_0x3787b3,_0x3514d6,_0x334087){return db[_0x60d4('0x42')][_0x60d4('0x60')]({'where':{'id':_0x3787b3[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x3514d6,null))[_0x60d4('0x23')](function(_0x54b327){if(_0x54b327){return _0x54b327[_0x60d4('0xbd')](_0x3787b3[_0x60d4('0x62')]['ids'],_['omit'](_0x3787b3[_0x60d4('0x62')],[_0x60d4('0x70'),'id'])||{})[_0x60d4('0xbe')](function(_0x10724d){for(var _0x550549=0x0;_0x550549<_0x3787b3[_0x60d4('0x62')]['ids'][_0x60d4('0x4e')];_0x550549+=0x1){socket[_0x60d4('0xbf')](_0x60d4('0xc0'),{'UserId':Number(_0x3787b3[_0x60d4('0x62')][_0x60d4('0x70')][_0x550549]),'FaxAccountId':Number(_0x3787b3[_0x60d4('0x5f')]['id'])});}return _0x10724d;});}})[_0x60d4('0x23')](respondWithResult(_0x3514d6,null))[_0x60d4('0x2d')](handleError(_0x3514d6,null));};exports[_0x60d4('0xc1')]=function(_0x5eaa6e,_0x57d8a9,_0x5a9eb5){return db[_0x60d4('0x42')][_0x60d4('0x60')]({'where':{'id':_0x5eaa6e[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x57d8a9,null))['then'](function(_0x47fcbd){if(_0x47fcbd){return _0x47fcbd[_0x60d4('0xc1')](_0x5eaa6e['query'][_0x60d4('0x70')])[_0x60d4('0x23')](function(){if(_[_0x60d4('0xc2')](_0x5eaa6e[_0x60d4('0x48')][_0x60d4('0x70')])){for(var _0xcd715e=0x0;_0xcd715e<_0x5eaa6e[_0x60d4('0x48')][_0x60d4('0x70')]['length'];_0xcd715e+=0x1){socket['emit'](_0x60d4('0xc3'),{'UserId':Number(_0x5eaa6e['query'][_0x60d4('0x70')][_0xcd715e]),'FaxAccountId':Number(_0x5eaa6e[_0x60d4('0x5f')]['id'])});}}else{socket[_0x60d4('0xbf')](_0x60d4('0xc3'),{'UserId':Number(_0x5eaa6e['query'][_0x60d4('0x70')]),'FaxAccountId':Number(_0x5eaa6e[_0x60d4('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x57d8a9,null))[_0x60d4('0x2d')](handleError(_0x57d8a9,null));};exports[_0x60d4('0xc4')]=function(_0x1a9341,_0x45de3b,_0x2b4d15){var _0x1d4c3a={};var _0x11872c={};var _0x5660f5;var _0x5f463b;return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0x1a9341[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x45de3b,null))[_0x60d4('0x23')](function(_0x4306c7){if(_0x4306c7){_0x5660f5=_0x4306c7;_0x11872c[_0x60d4('0x46')]=_[_0x60d4('0x49')](db[_0x60d4('0x7a')][_0x60d4('0x43')]);_0x11872c[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x1a9341['query']);_0x11872c[_0x60d4('0x4a')]=_['intersection'](_0x11872c[_0x60d4('0x46')],_0x11872c[_0x60d4('0x48')]);_0x1d4c3a['attributes']=_[_0x60d4('0x4b')](_0x11872c[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x1a9341[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x1d4c3a[_0x60d4('0x4d')]=_0x1d4c3a[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x1d4c3a[_0x60d4('0x4d')]:_0x11872c[_0x60d4('0x46')];_0x1d4c3a[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x1a9341['query'][_0x60d4('0x52')]);_0x1d4c3a['where']=qs[_0x60d4('0x4a')](_[_0x60d4('0x54')](_0x1a9341[_0x60d4('0x48')],_0x11872c[_0x60d4('0x4a')]));if(_0x1a9341[_0x60d4('0x48')][_0x60d4('0x55')]){_0x1d4c3a[_0x60d4('0x53')]=_['merge'](_0x1d4c3a[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x1d4c3a[_0x60d4('0x4d')],function(_0x42b8c3){var _0x41bc00={};_0x41bc00[_0x42b8c3]={'$like':'%'+_0x1a9341[_0x60d4('0x48')]['filter']+'%'};return _0x41bc00;})});}_0x1d4c3a=_['merge']({},_0x1d4c3a,_0x1a9341['options']);return _0x5660f5[_0x60d4('0xc4')](_0x1d4c3a);}})[_0x60d4('0x23')](function(_0x55556){if(_0x55556){_0x5f463b=_0x55556['length'];if(!_0x1a9341['query'][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x1d4c3a['limit']=qs[_0x60d4('0x32')](_0x1a9341[_0x60d4('0x48')]['limit']);_0x1d4c3a['offset']=qs[_0x60d4('0x33')](_0x1a9341[_0x60d4('0x48')]['offset']);}return _0x5660f5[_0x60d4('0xc4')](_0x1d4c3a);}})[_0x60d4('0x23')](function(_0xdaceaa){if(_0xdaceaa){return _0xdaceaa?{'count':_0x5f463b,'rows':_0xdaceaa}:null;}})[_0x60d4('0x23')](respondWithResult(_0x45de3b,null))['catch'](handleError(_0x45de3b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3404cf5..7a43054 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 _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 +var _0x1472=['FaxAccount','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x2dbe1e,_0x20a042){var _0x35a6eb=function(_0x4ed7b6){while(--_0x4ed7b6){_0x2dbe1e['push'](_0x2dbe1e['shift']());}};_0x35a6eb(++_0x20a042);}(_0x1472,0x166));var _0x2147=function(_0x250ce7,_0x502ad3){_0x250ce7=_0x250ce7-0x0;var _0x416428=_0x1472[_0x250ce7];return _0x416428;};'use strict';var EventEmitter=require(_0x2147('0x0'));var FaxAccount=require(_0x2147('0x1'))['db'][_0x2147('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2147('0x3')](0x0);var events={'afterCreate':_0x2147('0x4'),'afterUpdate':_0x2147('0x5'),'afterDestroy':_0x2147('0x6')};function emitEvent(_0x803a6b){return function(_0x4de048,_0x516ff5,_0x1f5727){FaxAccountEvents[_0x2147('0x7')](_0x803a6b+':'+_0x4de048['id'],_0x4de048);FaxAccountEvents[_0x2147('0x7')](_0x803a6b,_0x4de048);_0x1f5727(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2147('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 020e073..96059fa 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 _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 +var _0xc5de=['../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xc5de,0xd6));var _0xec5d=function(_0x336cb2,_0x436438){_0x336cb2=_0x336cb2-0x0;var _0x1eaadb=_0xc5de[_0x336cb2];return _0x1eaadb;};'use strict';var _=require(_0xec5d('0x0'));var util=require('util');var logger=require(_0xec5d('0x1'))(_0xec5d('0x2'));var moment=require(_0xec5d('0x3'));var BPromise=require(_0xec5d('0x4'));var rp=require(_0xec5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec5d('0x6'));var attributes=require(_0xec5d('0x7'));module[_0xec5d('0x8')]=function(_0x1a39f1,_0x5e9127){return _0x1a39f1[_0xec5d('0x9')]('FaxAccount',attributes,{'tableName':_0xec5d('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 efe8f45..dc7e67e 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 _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 +var _0xae57=['body','fax','CmContact','describe','Sequelize','ValidationError','keys','createdAt','updatedAt','difference','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','asc','defaults','ListId','contact','FaxInteraction','create','spread','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','find','name','waitForTheAssignedAgent','queueId','FaxQueue','unshift','queue','Start','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','register','request','then','info','request\x20sent','debug','stringify','error','message','FaxAccount,\x20%s,\x20%s','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xae57,0xe3));var _0x7ae5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xae57[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x7ae5('0x0'));var moment=require('moment');var BPromise=require(_0x7ae5('0x1'));var rs=require(_0x7ae5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ae5('0x3'))['db'];var utils=require(_0x7ae5('0x4'));var logger=require(_0x7ae5('0x5'))('rpc');var config=require(_0x7ae5('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7ae5('0x7')]({'port':0x232c});config['redis']=_['defaults'](config[_0x7ae5('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ae5('0x8')]));require('./faxAccount.socket')[_0x7ae5('0x9')](socket);function respondWithRpcPromise(_0x59d811,_0x2dad1b,_0x4f81eb){return new BPromise(function(_0x5a4bd2,_0x273e67){return client[_0x7ae5('0xa')](_0x59d811,_0x4f81eb)[_0x7ae5('0xb')](function(_0x27eadd){logger[_0x7ae5('0xc')]('FaxAccount,\x20%s,\x20%s',_0x2dad1b,_0x7ae5('0xd'));logger[_0x7ae5('0xe')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2dad1b,_0x7ae5('0xd'),JSON[_0x7ae5('0xf')](_0x27eadd));if(_0x27eadd[_0x7ae5('0x10')]){if(_0x27eadd[_0x7ae5('0x10')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2dad1b,_0x27eadd['error']['message']);return _0x273e67(_0x27eadd[_0x7ae5('0x10')]['message']);}logger[_0x7ae5('0x10')]('FaxAccount,\x20%s,\x20%s',_0x2dad1b,_0x27eadd[_0x7ae5('0x10')][_0x7ae5('0x11')]);return _0x5a4bd2(_0x27eadd[_0x7ae5('0x10')]['message']);}else{logger[_0x7ae5('0xc')](_0x7ae5('0x12'),_0x2dad1b,_0x7ae5('0xd'));_0x5a4bd2(_0x27eadd['result']['message']);}})['catch'](function(_0x13c50a){logger[_0x7ae5('0x10')](_0x7ae5('0x12'),_0x2dad1b,_0x13c50a);_0x273e67(_0x13c50a);});});}exports[_0x7ae5('0x13')]=function(_0x337842){var _0x59786e=this;return new Promise(function(_0x397da5,_0xddaf14){return db[_0x7ae5('0x14')][_0x7ae5('0x15')]({'raw':_0x337842[_0x7ae5('0x16')]?_0x337842['options'][_0x7ae5('0x17')]===undefined?!![]:![]:!![],'where':_0x337842['options']?_0x337842[_0x7ae5('0x16')][_0x7ae5('0x18')]||null:null,'attributes':_0x337842[_0x7ae5('0x16')]?_0x337842[_0x7ae5('0x16')][_0x7ae5('0x19')]||null:null,'limit':_0x337842[_0x7ae5('0x16')]?_0x337842['options'][_0x7ae5('0x1a')]||null:null,'include':_0x337842[_0x7ae5('0x16')]?_0x337842[_0x7ae5('0x16')][_0x7ae5('0x1b')]?_[_0x7ae5('0x1c')](_0x337842[_0x7ae5('0x16')][_0x7ae5('0x1b')],function(_0x12920c){return{'model':db[_0x12920c[_0x7ae5('0x1d')]],'as':_0x12920c['as'],'attributes':_0x12920c['attributes'],'include':_0x12920c[_0x7ae5('0x1b')]?_[_0x7ae5('0x1c')](_0x12920c[_0x7ae5('0x1b')],function(_0x1a77c9){return{'model':db[_0x1a77c9[_0x7ae5('0x1d')]],'as':_0x1a77c9['as'],'attributes':_0x1a77c9[_0x7ae5('0x19')],'include':_0x1a77c9[_0x7ae5('0x1b')]?_[_0x7ae5('0x1c')](_0x1a77c9[_0x7ae5('0x1b')],function(_0x1ea2fe){return{'model':db[_0x1ea2fe[_0x7ae5('0x1d')]],'as':_0x1ea2fe['as'],'attributes':_0x1ea2fe[_0x7ae5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7ae5('0xb')](function(_0x4ee259){logger[_0x7ae5('0xc')](_0x7ae5('0x13'),_0x337842);logger[_0x7ae5('0xe')](_0x7ae5('0x13'),_0x337842,JSON[_0x7ae5('0xf')](_0x4ee259));_0x397da5(_0x4ee259);})['catch'](function(_0x1b565c){logger[_0x7ae5('0x10')]('GetFaxAccount',_0x1b565c['message'],_0x337842);_0xddaf14(_0x59786e[_0x7ae5('0x10')](0x1f4,_0x1b565c['message']));});});};exports[_0x7ae5('0x1e')]=function(_0x574aaa,_0x36fb68,_0x25b0a0){var _0x29314d=this;return new Promise(function(_0x4ffeab,_0x49b0d9){var _0x5de21c={'body':_0x574aaa[_0x7ae5('0x1f')],'channel':_0x7ae5('0x20')};var _0x3e7217=[];var _0x437db2=[];var _0x4675bc={};return db[_0x7ae5('0x21')][_0x7ae5('0x22')]()['then'](function(_0x7f41f){if(!_0x7f41f){throw new db[(_0x7ae5('0x23'))][(_0x7ae5('0x24'))]('no\x20available\x20attributes');}_0x3e7217=_['difference'](_[_0x7ae5('0x25')](_0x7f41f),[_0x7ae5('0x26'),_0x7ae5('0x27')]);_0x437db2=_[_0x7ae5('0x28')](_[_0x7ae5('0x25')](_0x7f41f),[_0x7ae5('0x26'),_0x7ae5('0x27'),_0x7ae5('0x29'),'ListId']);if(_0x574aaa[_0x7ae5('0x1f')]['id']){delete _0x574aaa[_0x7ae5('0x1f')]['id'];}if(_[_0x7ae5('0x2a')](_0x574aaa['body'][_0x7ae5('0x2b')])){throw new db['Sequelize'][(_0x7ae5('0x24'))]('from\x20is\x20mandatory');}if(_[_0x7ae5('0x2a')](_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x1f')])||_0x574aaa[_0x7ae5('0x1f')]['body']===''){throw new db[(_0x7ae5('0x23'))][(_0x7ae5('0x24'))](_0x7ae5('0x2c'));}if(_[_0x7ae5('0x2a')](_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x2d')])){throw new db['Sequelize'][(_0x7ae5('0x24'))](_0x7ae5('0x2e')+_0x437db2);}if(!_['includes'](_0x437db2,_0x574aaa[_0x7ae5('0x1f')]['mapKey'])){throw new db[(_0x7ae5('0x23'))]['ValidationError'](_0x7ae5('0x2f')+_0x437db2);}_0x4675bc[_0x574aaa[_0x7ae5('0x1f')]['mapKey']]=_0x574aaa['body']['from'];})[_0x7ae5('0xb')](function(){return db[_0x7ae5('0x14')]['find']({'where':{'id':_0x574aaa[_0x7ae5('0x30')]['id']},'include':[{'model':db['CmList'],'as':_0x7ae5('0x31'),'include':[{'model':db[_0x7ae5('0x21')],'as':_0x7ae5('0x32'),'where':_0x4675bc,'limit':0x1,'order':[[_0x7ae5('0x27'),_0x7ae5('0x33')]]}]},{'model':db[_0x7ae5('0x34')],'as':'Applications'}]});})[_0x7ae5('0xb')](function(_0x277006){if(_0x277006&&_0x277006[_0x7ae5('0x31')]){var _0x8cf322=_0x277006[_0x7ae5('0x35')]({'plain':!![]});_0x5de21c[_0x7ae5('0x30')]=_0x8cf322;_0x5de21c[_0x7ae5('0x36')]=_0x8cf322[_0x7ae5('0x37')];_0x5de21c[_0x7ae5('0x38')]=_0x8cf322[_0x7ae5('0x31')];_0x5de21c[_0x7ae5('0x36')]=_[_0x7ae5('0x39')](_0x5de21c[_0x7ae5('0x36')],[_0x7ae5('0x3a')],[_0x7ae5('0x3b')]);if(_0x5de21c[_0x7ae5('0x30')][_0x7ae5('0x37')]){delete _0x5de21c[_0x7ae5('0x30')]['Applications'];}if(_0x5de21c['account'][_0x7ae5('0x31')]&&_0x5de21c['account'][_0x7ae5('0x31')]['Contacts']['length']){return _0x5de21c['account'][_0x7ae5('0x31')][_0x7ae5('0x32')][0x0];}var _0x3eeeb7=_[_0x7ae5('0x3c')](_0x574aaa[_0x7ae5('0x1f')],{'firstName':_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x2b')],'ListId':_0x8cf322[_0x7ae5('0x3d')]});_0x3eeeb7[_0x574aaa[_0x7ae5('0x1f')]['mapKey']]=_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x2b')];return db[_0x7ae5('0x21')]['create'](_0x3eeeb7,{'fields':_0x3e7217,'raw':!![]});}})[_0x7ae5('0xb')](function(_0x11a255){_0x5de21c[_0x7ae5('0x3e')]=_0x11a255;if(_0x11a255){var _0x12e1d2={'ContactId':_0x11a255['id'],'FaxAccountId':_0x574aaa[_0x7ae5('0x30')]['id'],'fax':_0x11a255['fax']};return db[_0x7ae5('0x3f')]['find']({'where':{'ContactId':_0x11a255['id'],'closed':![],'FaxAccountId':_0x574aaa[_0x7ae5('0x30')]['id']}})[_0x7ae5('0xb')](function(_0x4ec23d){if(_0x4ec23d){return[_0x4ec23d,![]];}return db[_0x7ae5('0x3f')][_0x7ae5('0x40')](_0x12e1d2)['then'](function(_0x29b452){return[_0x29b452,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7ae5('0x41')](function(_0x35c723,_0x54dfe0){var _0x4ed314=_0x35c723[_0x7ae5('0x35')]({'plain':!![]});if(_0x54dfe0){if(_0x5de21c[_0x7ae5('0x30')][_0x7ae5('0x42')]){_0x5de21c['applications']['push']({'id':0x0,'priority':_0x5de21c[_0x7ae5('0x36')][_0x7ae5('0x43')]+0x1,'app':_0x7ae5('0x44'),'appdata':_0x7ae5('0x45'),'interval':_0x7ae5('0x46')});}_0x4ed314[_0x7ae5('0x47')]=!![];}else{_0x4ed314['created']=![];}_0x5de21c[_0x7ae5('0x48')]=_0x4ed314;return db[_0x7ae5('0x49')][_0x7ae5('0x40')]({'body':_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x1f')],'FaxAccountId':_0x574aaa[_0x7ae5('0x30')]['id'],'FaxInteractionId':_0x35c723['id'],'direction':'in','ContactId':_0x35c723[_0x7ae5('0x4a')],'AttachmentId':_0x574aaa['body'][_0x7ae5('0x4b')]});})[_0x7ae5('0xb')](function(_0xc81d3b){_0x5de21c['message']=_0xc81d3b;if(!_0x5de21c['interaction'][_0x7ae5('0x4c')])return;return db['User'][_0x7ae5('0x4d')]({'attributes':['id','name'],'where':{'id':_0x5de21c[_0x7ae5('0x48')][_0x7ae5('0x4c')]}});})[_0x7ae5('0xb')](function(_0x52bca1){if(_0x52bca1){_0x5de21c[_0x7ae5('0x36')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x52bca1[_0x7ae5('0x4e')]+','+(_0x5de21c[_0x7ae5('0x30')][_0x7ae5('0x4f')]||0xa),'interval':_0x7ae5('0x46')});}if(!_0x5de21c[_0x7ae5('0x48')][_0x7ae5('0x50')])return;return db[_0x7ae5('0x51')][_0x7ae5('0x4d')]({'attributes':['id','name'],'where':{'id':_0x5de21c[_0x7ae5('0x48')]['queueId']}});})[_0x7ae5('0xb')](function(_0x387b69){if(_0x387b69){_0x5de21c['applications'][_0x7ae5('0x52')]({'id':0x0,'priority':0x1,'app':_0x7ae5('0x53'),'appdata':_0x387b69[_0x7ae5('0x4e')]+','+(_0x5de21c[_0x7ae5('0x30')]['waitForTheAssignedQueue']||0x12c),'interval':_0x7ae5('0x46')});}return respondWithRpcPromise(_0x7ae5('0x54'),'startRouting',_0x5de21c);})['then'](function(_0x1a7280){_0x4ffeab(_0x1a7280);})[_0x7ae5('0x55')](function(_0x1d0a63){_0x49b0d9(_0x29314d[_0x7ae5('0x10')](0x1f4,_0x1d0a63[_0x7ae5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d20b70c..e14296d 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 _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 +var _0xacfd=['register','length','./faxAccount.events','save','update','emit','removeListener'];(function(_0x4022ca,_0x2486c8){var _0x5cb8a9=function(_0x3bfde6){while(--_0x3bfde6){_0x4022ca['push'](_0x4022ca['shift']());}};_0x5cb8a9(++_0x2486c8);}(_0xacfd,0x64));var _0xdacf=function(_0x132c3d,_0x1d1906){_0x132c3d=_0x132c3d-0x0;var _0x2c98f7=_0xacfd[_0x132c3d];return _0x2c98f7;};'use strict';var FaxAccountEvents=require(_0xdacf('0x0'));var events=[_0xdacf('0x1'),'remove',_0xdacf('0x2')];function createListener(_0xe5f983,_0x4531cf){return function(_0x20217b){_0x4531cf[_0xdacf('0x3')](_0xe5f983,_0x20217b);};}function removeListener(_0x22c4fd,_0xbb5090){return function(){FaxAccountEvents[_0xdacf('0x4')](_0x22c4fd,_0xbb5090);};}exports[_0xdacf('0x5')]=function(_0x5a669b){for(var _0x173591=0x0,_0x171caa=events[_0xdacf('0x6')];_0x173591<_0x171caa;_0x173591++){var _0x133d3a=events[_0x173591];var _0x40f2a7=createListener('faxAccount:'+_0x133d3a,_0x5a669b);FaxAccountEvents['on'](_0x133d3a,_0x40f2a7);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index ac97b7a..7766c8d 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 _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 +var _0x06d2=['getDispositions','/:id/canned_answers','getAnswers','getApplications','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/dispositions'];(function(_0x370e93,_0x134964){var _0x3e09de=function(_0x2f4bb8){while(--_0x2f4bb8){_0x370e93['push'](_0x370e93['shift']());}};_0x3e09de(++_0x134964);}(_0x06d2,0x194));var _0x206d=function(_0x2d1400,_0x38b458){_0x2d1400=_0x2d1400-0x0;var _0x429d74=_0x06d2[_0x2d1400];return _0x429d74;};'use strict';var multer=require(_0x206d('0x0'));var util=require(_0x206d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x206d('0x2'));var router=express[_0x206d('0x3')]();var fs_extra=require(_0x206d('0x4'));var auth=require(_0x206d('0x5'));var interaction=require(_0x206d('0x6'));var config=require(_0x206d('0x7'));var controller=require('./faxAccount.controller');router[_0x206d('0x8')]('/',auth[_0x206d('0x9')](),controller[_0x206d('0xa')]);router[_0x206d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x206d('0xb')]);router[_0x206d('0x8')](_0x206d('0xc'),auth[_0x206d('0x9')](),controller['show']);router[_0x206d('0x8')](_0x206d('0xd'),auth['isAuthenticated'](),controller[_0x206d('0xe')]);router['get'](_0x206d('0xf'),auth[_0x206d('0x9')](),controller[_0x206d('0x10')]);router['get']('/:id/interactions',auth[_0x206d('0x9')](),controller['getInteractions']);router[_0x206d('0x8')]('/:id/applications',auth[_0x206d('0x9')](),controller[_0x206d('0x11')]);router[_0x206d('0x8')]('/:id/messages',auth[_0x206d('0x9')](),controller[_0x206d('0x12')]);router['get'](_0x206d('0x13'),auth[_0x206d('0x9')](),controller[_0x206d('0x14')]);router[_0x206d('0x15')]('/',auth[_0x206d('0x9')](),controller[_0x206d('0x16')]);router[_0x206d('0x15')](_0x206d('0xd'),auth[_0x206d('0x9')](),controller[_0x206d('0x17')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x206d('0x18')]);router[_0x206d('0x15')]('/:id/interactions',auth[_0x206d('0x9')](),controller[_0x206d('0x19')]);router[_0x206d('0x15')]('/:id/applications',auth[_0x206d('0x9')](),controller[_0x206d('0x1a')]);router[_0x206d('0x15')](_0x206d('0x1b'),auth[_0x206d('0x9')](),controller[_0x206d('0x1c')]);router['post']('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x206d('0x1d')]);router[_0x206d('0x15')]('/:id/send',auth[_0x206d('0x9')](),controller[_0x206d('0x1e')]);router[_0x206d('0x15')](_0x206d('0x13'),auth[_0x206d('0x9')](),controller[_0x206d('0x1f')]);router['put']('/:id',auth[_0x206d('0x9')](),controller[_0x206d('0x20')]);router[_0x206d('0x21')]('/:id',auth[_0x206d('0x9')](),controller[_0x206d('0x22')]);router[_0x206d('0x21')](_0x206d('0xd'),auth['isAuthenticated'](),controller[_0x206d('0x23')]);router['delete']('/:id/canned_answers',auth[_0x206d('0x9')](),controller[_0x206d('0x24')]);router[_0x206d('0x21')](_0x206d('0x13'),auth[_0x206d('0x9')](),controller[_0x206d('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d7fc6c6..166e45a 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 _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 +var _0x79ea=['TEXT','sequelize','STRING'];(function(_0x5a5038,_0x5044c0){var _0x42cc9e=function(_0x4de4b2){while(--_0x4de4b2){_0x5a5038['push'](_0x5a5038['shift']());}};_0x42cc9e(++_0x5044c0);}(_0x79ea,0x8b));var _0xa79e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x79ea[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xa79e('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa79e('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa79e('0x2')]()},'description':{'type':Sequelize[_0xa79e('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index afae749..ac59858 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 _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 +var _0xa2e7=['keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','type','filter','merge','FaxApplication','includeAll','include','findAll','rows','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query'];(function(_0x23e39d,_0xc9afc4){var _0x41c9a6=function(_0x4c784a){while(--_0x4c784a){_0x23e39d['push'](_0x23e39d['shift']());}};_0x41c9a6(++_0xc9afc4);}(_0xa2e7,0xac));var _0x7a2e=function(_0x21a6b6,_0x56a097){_0x21a6b6=_0x21a6b6-0x0;var _0x2fe250=_0xa2e7[_0x21a6b6];return _0x2fe250;};'use strict';var emlformat=require(_0x7a2e('0x0'));var rimraf=require(_0x7a2e('0x1'));var zipdir=require(_0x7a2e('0x2'));var jsonpatch=require(_0x7a2e('0x3'));var rp=require(_0x7a2e('0x4'));var moment=require(_0x7a2e('0x5'));var BPromise=require(_0x7a2e('0x6'));var Mustache=require(_0x7a2e('0x7'));var util=require('util');var path=require(_0x7a2e('0x8'));var sox=require(_0x7a2e('0x9'));var csv=require(_0x7a2e('0xa'));var ejs=require(_0x7a2e('0xb'));var fs=require('fs');var fs_extra=require(_0x7a2e('0xc'));var _=require(_0x7a2e('0xd'));var squel=require('squel');var crypto=require(_0x7a2e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a2e('0xa'));var querystring=require(_0x7a2e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a2e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a2e('0x11'))(_0x7a2e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7a2e('0x13'))['db'];function respondWithStatusCode(_0x3bcae0,_0x19fe7a){_0x19fe7a=_0x19fe7a||0xcc;return function(_0x5943fa){if(_0x5943fa){return _0x3bcae0['sendStatus'](_0x19fe7a);}return _0x3bcae0[_0x7a2e('0x14')](_0x19fe7a)[_0x7a2e('0x15')]();};}function respondWithResult(_0x211614,_0x26cc21){_0x26cc21=_0x26cc21||0xc8;return function(_0x560bee){if(_0x560bee){return _0x211614[_0x7a2e('0x14')](_0x26cc21)[_0x7a2e('0x16')](_0x560bee);}};}function respondWithFilteredResult(_0x16b5f2,_0x78bcc6){return function(_0x5a6f53){if(_0x5a6f53){var _0x196480=typeof _0x78bcc6[_0x7a2e('0x17')]===_0x7a2e('0x18')&&typeof _0x78bcc6['limit']===_0x7a2e('0x18');var _0x44a3f9=_0x5a6f53[_0x7a2e('0x19')];var _0x44e400=_0x196480?0x0:_0x78bcc6[_0x7a2e('0x17')];var _0x284caf=_0x196480?_0x5a6f53[_0x7a2e('0x19')]:_0x78bcc6[_0x7a2e('0x17')]+_0x78bcc6['limit'];var _0x116321;if(_0x284caf>=_0x44a3f9){_0x284caf=_0x44a3f9;_0x116321=0xc8;}else{_0x116321=0xce;}_0x16b5f2[_0x7a2e('0x14')](_0x116321);return _0x16b5f2[_0x7a2e('0x1a')](_0x7a2e('0x1b'),_0x44e400+'-'+_0x284caf+'/'+_0x44a3f9)['json'](_0x5a6f53);}return null;};}function patchUpdates(_0x59eb92){return function(_0x25fd2c){try{jsonpatch[_0x7a2e('0x1c')](_0x25fd2c,_0x59eb92,!![]);}catch(_0x552af8){return BPromise[_0x7a2e('0x1d')](_0x552af8);}return _0x25fd2c['save']();};}function saveUpdates(_0x13c982,_0x1e28b7){return function(_0x4ef048){if(_0x4ef048){return _0x4ef048[_0x7a2e('0x1e')](_0x13c982)[_0x7a2e('0x1f')](function(_0x59157e){return _0x59157e;});}return null;};}function removeEntity(_0x2be93c,_0x297db1){return function(_0x514e1d){if(_0x514e1d){return _0x514e1d[_0x7a2e('0x20')]()['then'](function(){_0x2be93c[_0x7a2e('0x14')](0xcc)[_0x7a2e('0x15')]();});}};}function handleEntityNotFound(_0x5ca979,_0x7df8d8){return function(_0x50e633){if(!_0x50e633){_0x5ca979[_0x7a2e('0x21')](0x194);}return _0x50e633;};}function handleError(_0x457836,_0x1730df){_0x1730df=_0x1730df||0x1f4;return function(_0x4d5f00){logger[_0x7a2e('0x22')](_0x4d5f00[_0x7a2e('0x23')]);if(_0x4d5f00[_0x7a2e('0x24')]){delete _0x4d5f00[_0x7a2e('0x24')];}_0x457836['status'](_0x1730df)[_0x7a2e('0x25')](_0x4d5f00);};}exports[_0x7a2e('0x26')]=function(_0x2dd147,_0x2252dd){var _0x43d885={},_0x52579c={},_0x3b2b95={'count':0x0,'rows':[]};var _0x97c2a9=_[_0x7a2e('0x27')](db['FaxApplication'][_0x7a2e('0x28')],function(_0x44fac6){return{'name':_0x44fac6[_0x7a2e('0x29')],'type':_0x44fac6['type'][_0x7a2e('0x2a')]};});_0x52579c['model']=_['map'](_0x97c2a9,_0x7a2e('0x24'));_0x52579c[_0x7a2e('0x2b')]=_[_0x7a2e('0x2c')](_0x2dd147[_0x7a2e('0x2b')]);_0x52579c['filters']=_[_0x7a2e('0x2d')](_0x52579c[_0x7a2e('0x2e')],_0x52579c['query']);_0x43d885[_0x7a2e('0x2f')]=_[_0x7a2e('0x2d')](_0x52579c[_0x7a2e('0x2e')],qs['fields'](_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x30')]));_0x43d885['attributes']=_0x43d885[_0x7a2e('0x2f')][_0x7a2e('0x31')]?_0x43d885['attributes']:_0x52579c[_0x7a2e('0x2e')];if(!_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x32')](_0x7a2e('0x33'))){_0x43d885[_0x7a2e('0x34')]=qs[_0x7a2e('0x34')](_0x2dd147[_0x7a2e('0x2b')]['limit']);_0x43d885[_0x7a2e('0x17')]=qs[_0x7a2e('0x17')](_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x17')]);}_0x43d885[_0x7a2e('0x35')]=qs[_0x7a2e('0x36')](_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x36')]);_0x43d885['where']=qs[_0x7a2e('0x37')](_[_0x7a2e('0x38')](_0x2dd147[_0x7a2e('0x2b')],_0x52579c[_0x7a2e('0x37')]),_0x97c2a9);if(_0x2dd147[_0x7a2e('0x2b')]['filter']){_0x43d885[_0x7a2e('0x39')]=_['merge'](_0x43d885[_0x7a2e('0x39')],{'$or':_[_0x7a2e('0x27')](_0x97c2a9,function(_0x3b56dc){if(_0x3b56dc[_0x7a2e('0x3a')]!=='VIRTUAL'){var _0x55b017={};_0x55b017[_0x3b56dc['name']]={'$like':'%'+_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x3b')]+'%'};return _0x55b017;}})});}_0x43d885=_[_0x7a2e('0x3c')]({},_0x43d885,_0x2dd147['options']);var _0x58f079={'where':_0x43d885[_0x7a2e('0x39')]};return db[_0x7a2e('0x3d')][_0x7a2e('0x19')](_0x58f079)[_0x7a2e('0x1f')](function(_0x5db844){_0x3b2b95['count']=_0x5db844;if(_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x3e')]){_0x43d885[_0x7a2e('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x7a2e('0x40')](_0x43d885);})['then'](function(_0x2aeb6e){_0x3b2b95[_0x7a2e('0x41')]=_0x2aeb6e;return _0x3b2b95;})['then'](respondWithFilteredResult(_0x2252dd,_0x43d885))[_0x7a2e('0x42')](handleError(_0x2252dd,null));};exports['show']=function(_0x54bc12,_0x29a9ba){var _0x3749d8={'raw':!![],'where':{'id':_0x54bc12['params']['id']}},_0x51d8fd={};_0x51d8fd['model']=_['keys'](db[_0x7a2e('0x3d')]['rawAttributes']);_0x51d8fd[_0x7a2e('0x2b')]=_[_0x7a2e('0x2c')](_0x54bc12[_0x7a2e('0x2b')]);_0x51d8fd['filters']=_[_0x7a2e('0x2d')](_0x51d8fd[_0x7a2e('0x2e')],_0x51d8fd[_0x7a2e('0x2b')]);_0x3749d8['attributes']=_[_0x7a2e('0x2d')](_0x51d8fd[_0x7a2e('0x2e')],qs[_0x7a2e('0x30')](_0x54bc12[_0x7a2e('0x2b')][_0x7a2e('0x30')]));_0x3749d8[_0x7a2e('0x2f')]=_0x3749d8['attributes'][_0x7a2e('0x31')]?_0x3749d8[_0x7a2e('0x2f')]:_0x51d8fd[_0x7a2e('0x2e')];if(_0x54bc12[_0x7a2e('0x2b')][_0x7a2e('0x3e')]){_0x3749d8[_0x7a2e('0x3f')]=[{'all':!![]}];}_0x3749d8=_[_0x7a2e('0x3c')]({},_0x3749d8,_0x54bc12[_0x7a2e('0x43')]);return db[_0x7a2e('0x3d')][_0x7a2e('0x44')](_0x3749d8)[_0x7a2e('0x1f')](handleEntityNotFound(_0x29a9ba,null))['then'](respondWithResult(_0x29a9ba,null))[_0x7a2e('0x42')](handleError(_0x29a9ba,null));};exports[_0x7a2e('0x45')]=function(_0x2c6a20,_0x53a889){return db[_0x7a2e('0x3d')][_0x7a2e('0x45')](_0x2c6a20[_0x7a2e('0x46')],{})[_0x7a2e('0x1f')](respondWithResult(_0x53a889,0xc9))[_0x7a2e('0x42')](handleError(_0x53a889,null));};exports['update']=function(_0x2d3f81,_0x1badaa){if(_0x2d3f81['body']['id']){delete _0x2d3f81[_0x7a2e('0x46')]['id'];}return db[_0x7a2e('0x3d')][_0x7a2e('0x44')]({'where':{'id':_0x2d3f81['params']['id']}})[_0x7a2e('0x1f')](handleEntityNotFound(_0x1badaa,null))[_0x7a2e('0x1f')](saveUpdates(_0x2d3f81[_0x7a2e('0x46')],null))[_0x7a2e('0x1f')](respondWithResult(_0x1badaa,null))[_0x7a2e('0x42')](handleError(_0x1badaa,null));};exports[_0x7a2e('0x20')]=function(_0x1edcfb,_0x135c62){return db['FaxApplication']['find']({'where':{'id':_0x1edcfb[_0x7a2e('0x47')]['id']}})[_0x7a2e('0x1f')](handleEntityNotFound(_0x135c62,null))[_0x7a2e('0x1f')](removeEntity(_0x135c62,null))['catch'](handleError(_0x135c62,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 99fe059..02a6315 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 _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 +var _0x669e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4','../../config/logger'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x669e,0x1bb));var _0xe669=function(_0x10e98b,_0x407343){_0x10e98b=_0x10e98b-0x0;var _0x5cc787=_0x669e[_0x10e98b];return _0x5cc787;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe669('0x0'))(_0xe669('0x1'));var moment=require(_0xe669('0x2'));var BPromise=require(_0xe669('0x3'));var rp=require(_0xe669('0x4'));var fs=require('fs');var path=require(_0xe669('0x5'));var rimraf=require(_0xe669('0x6'));var config=require(_0xe669('0x7'));var attributes=require('./faxApplication.attributes');module[_0xe669('0x8')]=function(_0x83442b,_0x3ed3e2){return _0x83442b[_0xe669('0x9')]('FaxApplication',attributes,{'tableName':_0xe669('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe669('0xb'),'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 206c6b6..ee21d96 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 _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 +var _0xdc02=['http','request','then','info','FaxApplication,\x20%s,\x20%s','stringify','error','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','debug','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xdc02,0x1d3));var _0x2dc0=function(_0xb8d37c,_0x10a6a4){_0xb8d37c=_0xb8d37c-0x0;var _0x400f4b=_0xdc02[_0xb8d37c];return _0x400f4b;};'use strict';var _=require(_0x2dc0('0x0'));var util=require(_0x2dc0('0x1'));var moment=require(_0x2dc0('0x2'));var BPromise=require(_0x2dc0('0x3'));var rs=require(_0x2dc0('0x4'));var fs=require('fs');var Redis=require(_0x2dc0('0x5'));var db=require(_0x2dc0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2dc0('0x7'));var jayson=require(_0x2dc0('0x8'));var client=jayson['client'][_0x2dc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcab9b7,_0x36838a,_0x53060d){return new BPromise(function(_0x4fb2f3,_0x4b6bba){return client[_0x2dc0('0xa')](_0xcab9b7,_0x53060d)[_0x2dc0('0xb')](function(_0x28625b){logger[_0x2dc0('0xc')](_0x2dc0('0xd'),_0x36838a,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x36838a,'request\x20sent',JSON[_0x2dc0('0xe')](_0x28625b));if(_0x28625b[_0x2dc0('0xf')]){if(_0x28625b[_0x2dc0('0xf')]['code']===0x1f4){logger[_0x2dc0('0xf')](_0x2dc0('0xd'),_0x36838a,_0x28625b[_0x2dc0('0xf')]['message']);return _0x4b6bba(_0x28625b[_0x2dc0('0xf')]['message']);}logger[_0x2dc0('0xf')](_0x2dc0('0xd'),_0x36838a,_0x28625b[_0x2dc0('0xf')]['message']);return _0x4fb2f3(_0x28625b['error']['message']);}else{logger[_0x2dc0('0xc')]('FaxApplication,\x20%s,\x20%s',_0x36838a,_0x2dc0('0x10'));_0x4fb2f3(_0x28625b[_0x2dc0('0x11')]['message']);}})[_0x2dc0('0x12')](function(_0x487136){logger['error']('FaxApplication,\x20%s,\x20%s',_0x36838a,_0x487136);_0x4b6bba(_0x487136);});});}exports[_0x2dc0('0x13')]=function(_0x20ed2c){var _0x2af446=this;return new Promise(function(_0x25c40d,_0x2b20ec){return db[_0x2dc0('0x14')][_0x2dc0('0x15')](_0x20ed2c[_0x2dc0('0x16')],{'raw':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c[_0x2dc0('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c[_0x2dc0('0x17')][_0x2dc0('0x18')]||null:null,'attributes':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c[_0x2dc0('0x17')][_0x2dc0('0x19')]||null:null,'limit':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c['options']['limit']||null:null})[_0x2dc0('0xb')](function(_0x40b8f2){logger[_0x2dc0('0xc')](_0x2dc0('0x13'),_0x20ed2c);logger[_0x2dc0('0x1a')](_0x2dc0('0x13'),_0x20ed2c,JSON['stringify'](_0x40b8f2));_0x25c40d(_0x40b8f2);})[_0x2dc0('0x12')](function(_0x3945c9){logger[_0x2dc0('0xf')](_0x2dc0('0x13'),_0x3945c9[_0x2dc0('0x1b')],_0x20ed2c);_0x2b20ec(_0x2af446['error'](0x1f4,_0x3945c9[_0x2dc0('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 75c5a08..188cd6a 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 _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 +var _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x31e1a5,_0x24a0d5){var _0x1d74f3=function(_0x3f5424){while(--_0x3f5424){_0x31e1a5['push'](_0x31e1a5['shift']());}};_0x1d74f3(++_0x24a0d5);}(_0x9354,0x96));var _0x4935=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x9354[_0x8b0f43];return _0x3f4425;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1546a4d..b01ed30 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 _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 +var _0x958a=['ENUM','INTEGER','sequelize','exports','DATE','STRING','out'];(function(_0x2730ad,_0x4d247d){var _0x1d4363=function(_0x17c180){while(--_0x17c180){_0x2730ad['push'](_0x2730ad['shift']());}};_0x1d4363(++_0x4d247d);}(_0x958a,0x128));var _0xa958=function(_0x4ccd84,_0x147a41){_0x4ccd84=_0x4ccd84-0x0;var _0x1d7fc7=_0x958a[_0x4ccd84];return _0x1d7fc7;};'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 429b737..266c002 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 _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 +var _0x8e05=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','root','server','files','tmp','attachments','transcript-%d-%s.zip','join','push','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','createWriteStream','resolve','log','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','offset','count','set','json','update','then','destroy','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','fax','query','user','show','model','keys','attributes','intersection','includeAll','merge','options','find','catch','create','body','params','describe','addMessage','FaxMessage','ids','omit','findOne','filters','fields'];(function(_0xbb122b,_0x4c42d6){var _0xd61670=function(_0x11b1aa){while(--_0x11b1aa){_0xbb122b['push'](_0xbb122b['shift']());}};_0xd61670(++_0x4c42d6);}(_0x8e05,0xf7));var _0x58e0=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x8e05[_0x43d11d];return _0x38cd08;};'use strict';var rimraf=require(_0x58e0('0x0'));var zipdir=require(_0x58e0('0x1'));var moment=require('moment');var BPromise=require(_0x58e0('0x2'));var util=require(_0x58e0('0x3'));var path=require(_0x58e0('0x4'));var fs=require('fs');var _=require(_0x58e0('0x5'));var Redis=require(_0x58e0('0x6'));var interaction=require(_0x58e0('0x7'));var qs=require(_0x58e0('0x8'));var logger=require(_0x58e0('0x9'))(_0x58e0('0xa'));var config=require(_0x58e0('0xb'));var db=require(_0x58e0('0xc'))['db'];config[_0x58e0('0xd')]=_[_0x58e0('0xe')](config[_0x58e0('0xd')],{'host':_0x58e0('0xf'),'port':0x18eb});var socket=require(_0x58e0('0x10'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x58e0('0x11')](socket);function respondWithStatusCode(_0x3efa63,_0x40a053){_0x40a053=_0x40a053||0xcc;return function(_0x48eae1){if(_0x48eae1){return _0x3efa63[_0x58e0('0x12')](_0x40a053);}return _0x3efa63[_0x58e0('0x13')](_0x40a053)[_0x58e0('0x14')]();};}function respondWithResult(_0x56efb8,_0x2159e6){_0x2159e6=_0x2159e6||0xc8;return function(_0x499158){if(_0x499158){return _0x56efb8['status'](_0x2159e6)['json'](_0x499158);}};}function respondWithFilteredResult(_0x45c1e7,_0x3ca600){return function(_0x5e2dbe){if(_0x5e2dbe){var _0x55a278=typeof _0x3ca600['offset']==='undefined'&&typeof _0x3ca600['limit']===_0x58e0('0x15');var _0xf04039=_0x5e2dbe['count'];var _0x611b2=_0x55a278?0x0:_0x3ca600[_0x58e0('0x16')];var _0x534a5e=_0x55a278?_0x5e2dbe[_0x58e0('0x17')]:_0x3ca600['offset']+_0x3ca600['limit'];var _0x1c2b39;if(_0x534a5e>=_0xf04039){_0x534a5e=_0xf04039;_0x1c2b39=0xc8;}else{_0x1c2b39=0xce;}_0x45c1e7[_0x58e0('0x13')](_0x1c2b39);return _0x45c1e7[_0x58e0('0x18')]('Content-Range',_0x611b2+'-'+_0x534a5e+'/'+_0xf04039)[_0x58e0('0x19')](_0x5e2dbe);}return null;};}function saveUpdates(_0x123ebe){return function(_0x353a31){if(_0x353a31){return _0x353a31[_0x58e0('0x1a')](_0x123ebe)[_0x58e0('0x1b')](function(_0x234a92){return _0x234a92;});}return null;};}function removeEntity(_0x35d330){return function(_0x328075){if(_0x328075){return _0x328075[_0x58e0('0x1c')]()['then'](function(){_0x35d330['status'](0xcc)[_0x58e0('0x14')]();});}};}function handleEntityNotFound(_0x4345ce){return function(_0x212511){if(!_0x212511){_0x4345ce[_0x58e0('0x12')](0x194);}return _0x212511;};}function handleError(_0x1658a1,_0x3b318e){_0x3b318e=_0x3b318e||0x1f4;return function(_0x5e431c){logger[_0x58e0('0x1d')](_0x5e431c['stack']);if(_0x5e431c[_0x58e0('0x1e')]){delete _0x5e431c['name'];}_0x1658a1[_0x58e0('0x13')](_0x3b318e)[_0x58e0('0x1f')](_0x5e431c);};}exports[_0x58e0('0x20')]=function(_0x50afd9,_0x169d24){var _0x18b48b={};var _0x4a7775=_[_0x58e0('0x21')](db[_0x58e0('0x22')][_0x58e0('0x23')],function(_0x6682f4){return{'name':_0x6682f4[_0x58e0('0x24')],'type':_0x6682f4['type'][_0x58e0('0x25')]};});_0x18b48b=qs['getOptions'](_0x4a7775,_0x50afd9);return interaction['findAll'](_0x58e0('0x26'),_0x50afd9[_0x58e0('0x27')],_0x50afd9[_0x58e0('0x28')],_0x18b48b,_0x4a7775)['then'](respondWithFilteredResult(_0x169d24,_0x18b48b))['catch'](handleError(_0x169d24,null));};exports[_0x58e0('0x29')]=function(_0x2da8be,_0x4743b8){var _0x155882={'raw':![],'where':{'id':_0x2da8be['params']['id']}},_0x292a7b={};_0x292a7b[_0x58e0('0x2a')]=_[_0x58e0('0x2b')](db[_0x58e0('0x22')][_0x58e0('0x23')]);_0x292a7b[_0x58e0('0x27')]=_[_0x58e0('0x2b')](_0x2da8be[_0x58e0('0x27')]);_0x292a7b['filters']=_['intersection'](_0x292a7b[_0x58e0('0x2a')],_0x292a7b[_0x58e0('0x27')]);_0x155882[_0x58e0('0x2c')]=_[_0x58e0('0x2d')](_0x292a7b[_0x58e0('0x2a')],qs['fields'](_0x2da8be[_0x58e0('0x27')]['fields']));_0x155882[_0x58e0('0x2c')]=_0x155882[_0x58e0('0x2c')]['length']?_0x155882[_0x58e0('0x2c')]:_0x292a7b[_0x58e0('0x2a')];if(_0x2da8be[_0x58e0('0x27')][_0x58e0('0x2e')]){_0x155882['include']=[{'all':!![]}];}_0x155882=_[_0x58e0('0x2f')]({},_0x155882,_0x2da8be[_0x58e0('0x30')]);return db[_0x58e0('0x22')][_0x58e0('0x31')](_0x155882)[_0x58e0('0x1b')](handleEntityNotFound(_0x4743b8,null))[_0x58e0('0x1b')](respondWithResult(_0x4743b8,null))[_0x58e0('0x32')](handleError(_0x4743b8,null));};exports['create']=function(_0x2e87a7,_0x2a86d4){return db[_0x58e0('0x22')][_0x58e0('0x33')](_0x2e87a7['body'],{})[_0x58e0('0x1b')](respondWithResult(_0x2a86d4,0xc9))[_0x58e0('0x32')](handleError(_0x2a86d4,null));};exports[_0x58e0('0x1a')]=function(_0x1a3143,_0x1a30ca){if(_0x1a3143[_0x58e0('0x34')]['id']){delete _0x1a3143[_0x58e0('0x34')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x1a3143[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x1a30ca,null))['then'](saveUpdates(_0x1a3143[_0x58e0('0x34')],null))['then'](respondWithResult(_0x1a30ca,null))[_0x58e0('0x32')](handleError(_0x1a30ca,null));};exports[_0x58e0('0x1c')]=function(_0x160dd9,_0x546e80){return db[_0x58e0('0x22')][_0x58e0('0x31')]({'where':{'id':_0x160dd9[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x546e80,null))[_0x58e0('0x1b')](removeEntity(_0x546e80,null))[_0x58e0('0x32')](handleError(_0x546e80,null));};exports[_0x58e0('0x36')]=function(_0x58927b,_0x2a96ea){return db[_0x58e0('0x22')][_0x58e0('0x36')]()[_0x58e0('0x1b')](respondWithResult(_0x2a96ea,null))[_0x58e0('0x32')](handleError(_0x2a96ea,null));};exports[_0x58e0('0x37')]=function(_0x37bed1,_0x362895){return db[_0x58e0('0x38')][_0x58e0('0x31')]({'where':{'id':_0x37bed1[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x362895,null))['then'](function(_0x139178){if(_0x139178){return _0x139178[_0x58e0('0x37')](_0x37bed1[_0x58e0('0x34')][_0x58e0('0x39')],_[_0x58e0('0x3a')](_0x37bed1['body'],[_0x58e0('0x39'),'id'])||{});}})[_0x58e0('0x1b')](respondWithResult(_0x362895,null))['catch'](handleError(_0x362895,null));};exports['getMessages']=function(_0x47a1a4,_0x272cec){var _0x113fd6={'raw':![],'where':{}};var _0x48836b={};var _0x359fc4={'count':0x0,'rows':[]};return db[_0x58e0('0x22')][_0x58e0('0x3b')]({'where':{'id':_0x47a1a4[_0x58e0('0x35')]['id']}})['then'](handleEntityNotFound(_0x272cec,null))[_0x58e0('0x1b')](function(_0x586b24){if(_0x586b24){_0x48836b['model']=_['keys'](db[_0x58e0('0x38')][_0x58e0('0x23')]);_0x48836b[_0x58e0('0x27')]=_[_0x58e0('0x2b')](_0x47a1a4[_0x58e0('0x27')]);_0x48836b[_0x58e0('0x3c')]=_[_0x58e0('0x2d')](_0x48836b[_0x58e0('0x2a')],_0x48836b[_0x58e0('0x27')]);_0x113fd6[_0x58e0('0x2c')]=_[_0x58e0('0x2d')](_0x48836b['model'],qs[_0x58e0('0x3d')](_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x3d')]));_0x113fd6['attributes']=_0x113fd6[_0x58e0('0x2c')][_0x58e0('0x3e')]?_0x113fd6[_0x58e0('0x2c')]:_0x48836b[_0x58e0('0x2a')];if(!_0x47a1a4['query'][_0x58e0('0x3f')](_0x58e0('0x40'))){_0x113fd6[_0x58e0('0x41')]=qs['limit'](_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x41')]);_0x113fd6[_0x58e0('0x16')]=qs[_0x58e0('0x16')](_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x16')]);}_0x113fd6[_0x58e0('0x42')]=qs[_0x58e0('0x43')](_0x47a1a4['query'][_0x58e0('0x43')]);_0x113fd6[_0x58e0('0x44')]=qs['filters'](_[_0x58e0('0x45')](_0x47a1a4[_0x58e0('0x27')],_0x48836b[_0x58e0('0x3c')]));_0x113fd6['where'][_0x58e0('0x46')]=_0x586b24['id'];if(_0x47a1a4[_0x58e0('0x27')]['filter']){_0x113fd6[_0x58e0('0x44')]=_[_0x58e0('0x2f')](_0x113fd6[_0x58e0('0x44')],{'$or':_['map'](_0x113fd6[_0x58e0('0x2c')],function(_0x33dc6c){var _0x3cdce5={};_0x3cdce5[_0x33dc6c]={'$like':'%'+_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x47')]+'%'};return _0x3cdce5;})});}if(_0x47a1a4['query'][_0x58e0('0x48')]){var _0x20e3b7=_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x48')]['split'](',');var _0x7f754b={};_0x7f754b[_0x20e3b7[0x0]]={'$gte':moment(_0x20e3b7[0x1])[_0x58e0('0x49')](_0x58e0('0x4a'))};_0x113fd6['where']=_[_0x58e0('0x2f')](_0x113fd6[_0x58e0('0x44')],_0x7f754b);}_0x113fd6=_[_0x58e0('0x2f')]({},_0x113fd6,_0x47a1a4['options']);return db[_0x58e0('0x38')][_0x58e0('0x17')]({'where':_0x113fd6[_0x58e0('0x44')]})['then'](function(_0x26d816){_0x359fc4[_0x58e0('0x17')]=_0x26d816;if(_0x47a1a4['query']['includeAll']){_0x113fd6['include']=[{'all':!![]}];}return db[_0x58e0('0x38')][_0x58e0('0x4b')](_0x113fd6);})[_0x58e0('0x1b')](function(_0x1bd246){_0x359fc4[_0x58e0('0x4c')]=_0x1bd246;return _0x359fc4;});}})['then'](respondWithFilteredResult(_0x272cec,_0x113fd6))[_0x58e0('0x32')](handleError(_0x272cec,null));};exports[_0x58e0('0x4d')]=function(_0x43481e,_0x2dd136){return db[_0x58e0('0x22')][_0x58e0('0x31')]({'where':{'id':_0x43481e['params']['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x2dd136,null))[_0x58e0('0x1b')](function(_0x2064fd){if(_0x2064fd){return _0x2064fd[_0x58e0('0x4e')](_0x43481e['body'][_0x58e0('0x39')],_[_0x58e0('0x3a')](_0x43481e[_0x58e0('0x34')],[_0x58e0('0x39'),'id'])||{})[_0x58e0('0x4f')](function(){return db[_0x58e0('0x50')][_0x58e0('0x4b')]({'attributes':['id',_0x58e0('0x1e'),_0x58e0('0x51')],'where':{'id':_0x43481e[_0x58e0('0x34')][_0x58e0('0x39')]}});})[_0x58e0('0x1b')](function(_0x2a0602){socket[_0x58e0('0x52')]('faxInteractionTags:save',{'id':Number(_0x43481e['params']['id']),'tags':_0x2a0602||[]});return{'id':Number(_0x43481e[_0x58e0('0x35')]['id']),'tags':_0x2a0602||[]};});}})[_0x58e0('0x1b')](respondWithResult(_0x2dd136,null))['catch'](handleError(_0x2dd136,null));};exports[_0x58e0('0x53')]=function(_0x36ede2,_0x552992){return db['FaxInteraction'][_0x58e0('0x31')]({'where':{'id':_0x36ede2[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x552992,null))[_0x58e0('0x1b')](function(_0x5142c9){if(_0x5142c9){return _0x5142c9[_0x58e0('0x53')](_0x36ede2[_0x58e0('0x27')][_0x58e0('0x39')]);}})[_0x58e0('0x1b')](respondWithStatusCode(_0x552992,null))['catch'](handleError(_0x552992,null));};exports[_0x58e0('0x54')]=function(_0x819408,_0x39a9e9){var _0x3475fd=moment()['unix']()['toString']();var _0x1995b2=path['join'](config[_0x58e0('0x55')],_0x58e0('0x56'),_0x58e0('0x57'),_0x58e0('0x58'));var _0x1ef4b9=path['join'](config[_0x58e0('0x55')],_0x58e0('0x56'),_0x58e0('0x57'),_0x58e0('0x59'));var _0x419cf3=path['join'](_0x1995b2,_0x3475fd);var _0x7897d9=util[_0x58e0('0x49')](_0x58e0('0x5a'),_0x819408[_0x58e0('0x35')]['id'],_0x3475fd);var _0x42f8c3=path[_0x58e0('0x5b')](_0x1995b2,_0x7897d9);var _0x5301b7=[];_0x5301b7[_0x58e0('0x5c')]({'model':db[_0x58e0('0x5d')],'as':_0x58e0('0x5d'),'raw':!![]});var _0x23d9d1=[{'model':db[_0x58e0('0x38')],'as':_0x58e0('0x5e'),'attributes':['id',_0x58e0('0x34'),_0x58e0('0x5f')],'include':_0x5301b7}];return db['FaxInteraction']['find']({'where':{'id':_0x819408['params']['id']},'include':_0x23d9d1})[_0x58e0('0x1b')](handleEntityNotFound(_0x39a9e9,null))[_0x58e0('0x1b')](function(_0x32135a){if(_0x32135a&&_0x32135a[_0x58e0('0x5e')]){var _0x2af288=_0x32135a[_0x58e0('0x60')]({'plain':!![]});fs[_0x58e0('0x61')](_0x419cf3);for(var _0x195d24=0x0;_0x195d24<_0x2af288[_0x58e0('0x5e')][_0x58e0('0x3e')];_0x195d24++){var _0x789bd=_0x2af288[_0x58e0('0x5e')][_0x195d24][_0x58e0('0x5d')];if(_0x789bd){var _0x34e414=path[_0x58e0('0x5b')](_0x1ef4b9,_0x789bd[_0x58e0('0x62')]);if(fs['existsSync'](_0x34e414)){fs[_0x58e0('0x63')](_0x34e414)['pipe'](fs[_0x58e0('0x64')](path[_0x58e0('0x5b')](_0x419cf3,_0x789bd['basename'])));}}}return BPromise[_0x58e0('0x65')]()['then'](function(){return new BPromise(function(_0x532b85,_0x1d71ef){zipdir(_0x419cf3,{'saveTo':_0x42f8c3},function(_0x156201,_0x2558df){if(_0x156201)return _0x1d71ef(_0x156201);return _0x532b85(_0x2558df);});})[_0x58e0('0x1b')](function(){return new BPromise(function(_0x233aef,_0x55242b){rimraf(_0x419cf3,function(_0x15b48a){if(_0x15b48a)_0x55242b(_0x15b48a);return _0x233aef();});});})['then'](function(){return _0x39a9e9[_0x58e0('0x54')](_0x42f8c3,_0x7897d9,function(_0x463911){if(_0x463911){console[_0x58e0('0x66')]('err',_0x463911);}else{fs['unlinkSync'](_0x42f8c3);}});});});}else{return _0x39a9e9['sendStatus'](0xc8);}})['catch'](handleError(_0x39a9e9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e7453ca..3046994 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 _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 +var _0xa9da=['../../mysqldb','FaxInteraction','setMaxListeners','update','getUsers','then','setDataValue','map','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0xa9da,0x1cd));var _0xaa9d=function(_0x101d19,_0xc0e538){_0x101d19=_0x101d19-0x0;var _0x24c472=_0xa9da[_0x101d19];return _0x24c472;};'use strict';var EventEmitter=require(_0xaa9d('0x0'));var FaxInteraction=require(_0xaa9d('0x1'))['db'][_0xaa9d('0x2')];var FaxMessage=require(_0xaa9d('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xaa9d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa9d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3757cd){return function(_0x398955,_0x29cca2,_0x5d658d){_0x398955[_0xaa9d('0x5')]({'attributes':['id'],'raw':!![]})[_0xaa9d('0x6')](function(_0x488618){_0x398955[_0xaa9d('0x7')]('Users',_0x488618[_0xaa9d('0x8')](function(_0x5102d6){return{'id':_0x5102d6['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x398955['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa9d('0x6')](function(_0x58455c){_0x398955[_0xaa9d('0x7')]('unreadMessages',_0x58455c[_0xaa9d('0x9')]);FaxInteractionEvents[_0xaa9d('0xa')](_0x3757cd+':'+_0x398955['id'],_0x398955);FaxInteractionEvents[_0xaa9d('0xa')](_0x3757cd,_0x398955);_0x5d658d(null);})[_0xaa9d('0xb')](_0x5d658d(null));};}for(var e in events){if(events[_0xaa9d('0xc')](e)){var event=events[e];FaxInteraction[_0xaa9d('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 16a7cef..7aeaadf 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 _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 +var _0xc125=['define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x1f8eb8,_0x569d29){var _0x415ba5=function(_0x875e22){while(--_0x875e22){_0x1f8eb8['push'](_0x1f8eb8['shift']());}};_0x415ba5(++_0x569d29);}(_0xc125,0x139));var _0x5c12=function(_0x2e876e,_0x4f6a89){_0x2e876e=_0x2e876e-0x0;var _0x48b463=_0xc125[_0x2e876e];return _0x48b463;};'use strict';var _=require(_0x5c12('0x0'));var util=require('util');var logger=require(_0x5c12('0x1'))(_0x5c12('0x2'));var moment=require(_0x5c12('0x3'));var BPromise=require(_0x5c12('0x4'));var rp=require(_0x5c12('0x5'));var fs=require('fs');var path=require(_0x5c12('0x6'));var rimraf=require(_0x5c12('0x7'));var config=require(_0x5c12('0x8'));var attributes=require(_0x5c12('0x9'));module[_0x5c12('0xa')]=function(_0x284967,_0x32be5b){return _0x284967[_0x5c12('0xb')](_0x5c12('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xaeeab,_0x23b414,_0x5b20a7){if(_0xaeeab[_0x5c12('0xd')](_0x5c12('0xe'))){_0xaeeab[_0x5c12('0xf')]=moment()[_0x5c12('0x10')](_0x5c12('0x11'));}_0x5b20a7(null,_0xaeeab);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2dd2e01..d98058d 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 _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 +var _0x7b7d=['http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','info','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7b7d,0x10e));var _0xd7b7=function(_0x3a0674,_0x1c81fe){_0x3a0674=_0x3a0674-0x0;var _0x3437d7=_0x7b7d[_0x3a0674];return _0x3437d7;};'use strict';var _=require(_0xd7b7('0x0'));var util=require(_0xd7b7('0x1'));var moment=require(_0xd7b7('0x2'));var BPromise=require(_0xd7b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7b7('0x4'));var db=require(_0xd7b7('0x5'))['db'];var utils=require(_0xd7b7('0x6'));var logger=require('../../config/logger')(_0xd7b7('0x7'));var config=require('../../config/environment');var jayson=require(_0xd7b7('0x8'));var client=jayson[_0xd7b7('0x9')][_0xd7b7('0xa')]({'port':0x232a});config['redis']=_[_0xd7b7('0xb')](config[_0xd7b7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7b7('0xd'))(new Redis(config[_0xd7b7('0xc')]));require(_0xd7b7('0xe'))[_0xd7b7('0xf')](socket);function respondWithRpcPromise(_0x3582f6,_0x5f1566,_0x27ec44){return new BPromise(function(_0x4da846,_0x5c234c){return client['request'](_0x3582f6,_0x27ec44)[_0xd7b7('0x10')](function(_0x54ea0a){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5f1566,_0xd7b7('0x11'));logger[_0xd7b7('0x12')](_0xd7b7('0x13'),_0x5f1566,_0xd7b7('0x11'),JSON['stringify'](_0x54ea0a));if(_0x54ea0a[_0xd7b7('0x14')]){if(_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x15')]===0x1f4){logger[_0xd7b7('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x5f1566,_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x16')]);return _0x5c234c(_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x16')]);}logger[_0xd7b7('0x14')](_0xd7b7('0x17'),_0x5f1566,_0x54ea0a['error'][_0xd7b7('0x16')]);return _0x4da846(_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x16')]);}else{logger[_0xd7b7('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x5f1566,'request\x20sent');_0x4da846(_0x54ea0a['result'][_0xd7b7('0x16')]);}})[_0xd7b7('0x19')](function(_0x3b52a9){logger[_0xd7b7('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x5f1566,_0x3b52a9);_0x5c234c(_0x3b52a9);});});}exports[_0xd7b7('0x1a')]=function(_0x37b78a){var _0x2edb13=this;return new Promise(function(_0x54781d,_0x35efee){return db['FaxInteraction'][_0xd7b7('0x1b')](_0x37b78a[_0xd7b7('0x1c')],{'raw':_0x37b78a[_0xd7b7('0x1d')]?_0x37b78a[_0xd7b7('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37b78a['options']?_0x37b78a[_0xd7b7('0x1d')][_0xd7b7('0x1e')]||null:null,'attributes':_0x37b78a[_0xd7b7('0x1d')]?_0x37b78a[_0xd7b7('0x1d')][_0xd7b7('0x1f')]||null:null,'limit':_0x37b78a['options']?_0x37b78a[_0xd7b7('0x1d')][_0xd7b7('0x20')]||null:null})[_0xd7b7('0x10')](function(_0x59025a){logger[_0xd7b7('0x18')](_0xd7b7('0x1a'),_0x37b78a);logger['debug']('UpdateFaxInteraction',_0x37b78a,JSON['stringify'](_0x59025a));_0x54781d(_0x59025a);})['catch'](function(_0x36995e){logger['error'](_0xd7b7('0x1a'),_0x36995e[_0xd7b7('0x16')],_0x37b78a);_0x35efee(_0x2edb13['error'](0x1f4,_0x36995e[_0xd7b7('0x16')]));});});};exports[_0xd7b7('0x21')]=function(_0x26d792){return new Promise(function(_0x3ca453,_0x53bd96){return db[_0xd7b7('0x22')][_0xd7b7('0x23')]({'where':_0x26d792['options']?_0x26d792[_0xd7b7('0x1d')][_0xd7b7('0x1e')]||null:null})[_0xd7b7('0x10')](function(_0x30e08c){if(_0x30e08c){return _0x30e08c[_0xd7b7('0x24')](_0x26d792['body'][_0xd7b7('0x25')],_['omit'](_0x26d792[_0xd7b7('0x1c')],['ids','id'])||{});}})[_0xd7b7('0x26')](function(_0x2ecdb0){logger[_0xd7b7('0x18')](_0xd7b7('0x27'),_0x26d792);logger[_0xd7b7('0x12')](_0xd7b7('0x27'),_0x26d792,JSON['stringify'](_0x2ecdb0));_0x3ca453(_0x2ecdb0);})[_0xd7b7('0x19')](function(_0x3bd4d3){logger[_0xd7b7('0x14')]('AddTags',_0x3bd4d3[_0xd7b7('0x16')],_0x26d792);_0x53bd96(_this[_0xd7b7('0x14')](0x1f4,_0x3bd4d3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f2b880b..360b175 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 _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 +var _0xe7d6=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x2aeba4,_0x47184c){var _0x3db727=function(_0x4b5056){while(--_0x4b5056){_0x2aeba4['push'](_0x2aeba4['shift']());}};_0x3db727(++_0x47184c);}(_0xe7d6,0x135));var _0x6e7d=function(_0xeab168,_0x30d561){_0xeab168=_0xeab168-0x0;var _0xbbf818=_0xe7d6[_0xeab168];return _0xbbf818;};'use strict';var FaxInteractionEvents=require(_0x6e7d('0x0'));var events=[_0x6e7d('0x1'),_0x6e7d('0x2'),_0x6e7d('0x3')];function createListener(_0x460cd0,_0x3c7aa7){return function(_0x2ce05c){_0x3c7aa7[_0x6e7d('0x4')](_0x460cd0,_0x2ce05c);};}function removeListener(_0x37493e,_0x2f9b6f){return function(){FaxInteractionEvents[_0x6e7d('0x5')](_0x37493e,_0x2f9b6f);};}exports[_0x6e7d('0x6')]=function(_0x53cdfa){for(var _0x5159be=0x0,_0x3b49a0=events[_0x6e7d('0x7')];_0x5159be<_0x3b49a0;_0x5159be++){var _0xcb273=events[_0x5159be];var _0xd49299=createListener(_0x6e7d('0x8')+_0xcb273,_0x53cdfa);FaxInteractionEvents['on'](_0xcb273,_0xd49299);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 34676bd..f85e091 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 _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 +var _0x552e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','faxinteraction:destroy','delete','/:id/tags','removeTags','exports','multer','util','path'];(function(_0x3aa091,_0x34c349){var _0x43f9d8=function(_0x304cea){while(--_0x304cea){_0x3aa091['push'](_0x3aa091['shift']());}};_0x43f9d8(++_0x34c349);}(_0x552e,0x138));var _0xe552=function(_0x24c852,_0x4ffff0){_0x24c852=_0x24c852-0x0;var _0x144286=_0x552e[_0x24c852];return _0x144286;};'use strict';var multer=require(_0xe552('0x0'));var util=require(_0xe552('0x1'));var path=require(_0xe552('0x2'));var timeout=require(_0xe552('0x3'));var express=require(_0xe552('0x4'));var router=express[_0xe552('0x5')]();var fs_extra=require(_0xe552('0x6'));var auth=require(_0xe552('0x7'));var interaction=require(_0xe552('0x8'));var config=require(_0xe552('0x9'));var controller=require('./faxInteraction.controller');router[_0xe552('0xa')]('/',auth[_0xe552('0xb')](),controller[_0xe552('0xc')]);router[_0xe552('0xa')](_0xe552('0xd'),auth['isAuthenticated'](),controller[_0xe552('0xe')]);router['get'](_0xe552('0xf'),auth[_0xe552('0xb')](),controller[_0xe552('0x10')]);router[_0xe552('0xa')](_0xe552('0x11'),auth[_0xe552('0xb')](),controller[_0xe552('0x12')]);router[_0xe552('0xa')](_0xe552('0x13'),auth[_0xe552('0xb')](),controller[_0xe552('0x14')]);router[_0xe552('0x15')]('/',auth[_0xe552('0xb')](),controller[_0xe552('0x16')]);router[_0xe552('0x15')](_0xe552('0x11'),auth[_0xe552('0xb')](),controller[_0xe552('0x17')]);router['post']('/:id/tags',auth[_0xe552('0xb')](),interaction[_0xe552('0x18')](_0xe552('0x19'),_0xe552('0x1a')),controller[_0xe552('0x1b')]);router[_0xe552('0x1c')](_0xe552('0xf'),auth['isAuthenticated'](),interaction[_0xe552('0x18')](_0xe552('0x19'),'faxinteraction:update'),controller[_0xe552('0x1d')]);router['delete'](_0xe552('0xf'),auth[_0xe552('0xb')](),interaction[_0xe552('0x18')](_0xe552('0x19'),_0xe552('0x1e')),controller['destroy']);router[_0xe552('0x1f')](_0xe552('0x20'),auth[_0xe552('0xb')](),controller[_0xe552('0x21')]);module[_0xe552('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 57b3e48..3b3d1bf 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 _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 +var _0x4d9e=['TEXT','sequelize','medium','ENUM','out'];(function(_0x37cba1,_0x14e01a){var _0xe06895=function(_0x5ae028){while(--_0x5ae028){_0x37cba1['push'](_0x37cba1['shift']());}};_0xe06895(++_0x14e01a);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2fe90d,_0x4595aa){_0x2fe90d=_0x2fe90d-0x0;var _0x2ce879=_0x4d9e[_0x2fe90d];return _0x2ce879;};'use strict';var Sequelize=require(_0xe4d9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xe4d9('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe4d9('0x2')]('in','out'),'defaultValue':_0xe4d9('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe4d9('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 890b5c3..91e9c2a 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 _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 +var _0xf418=['acceptMessage','fax','reject','body','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','format','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','fax-interactions','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','status','json','undefined','limit','count','offset','set','end','sendStatus','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','show','params','keys','fields','includeAll','update','find','describe','accept','sms'];(function(_0x2fa715,_0x249c05){var _0x91bbbe=function(_0x299934){while(--_0x299934){_0x2fa715['push'](_0x2fa715['shift']());}};_0x91bbbe(++_0x249c05);}(_0xf418,0x18e));var _0x8f41=function(_0x2745aa,_0x1e248e){_0x2745aa=_0x2745aa-0x0;var _0x3ed770=_0xf418[_0x2745aa];return _0x3ed770;};'use strict';var util=require('util');var path=require(_0x8f41('0x0'));var _=require('lodash');var Redis=require(_0x8f41('0x1'));var interactionService=require(_0x8f41('0x2'));var qs=require(_0x8f41('0x3'));var logger=require(_0x8f41('0x4'))(_0x8f41('0x5'));var config=require(_0x8f41('0x6'));var db=require('../../mysqldb')['db'];config[_0x8f41('0x7')]=_[_0x8f41('0x8')](config['redis'],{'host':_0x8f41('0x9'),'port':0x18eb});var socket=require(_0x8f41('0xa'))(new Redis(config[_0x8f41('0x7')]));require(_0x8f41('0xb'))[_0x8f41('0xc')](socket);var jayson=require(_0x8f41('0xd'));var client=jayson['client'][_0x8f41('0xe')]({'port':0x232c});var client9002=jayson[_0x8f41('0xf')][_0x8f41('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x8f41('0x10'));function respondWithRpcPromise(_0x27db92,_0x10093f,_0x458eb6,_0x2f66e4){return new Promise(function(_0x5dccc7,_0x38666c){var _0x101e00=_0x2f66e4||client;return _0x101e00[_0x8f41('0x11')](_0x27db92,_0x458eb6)[_0x8f41('0x12')](function(_0x3a4633){logger[_0x8f41('0x13')](_0x8f41('0x14'),_0x10093f,_0x8f41('0x15'));logger[_0x8f41('0x16')](_0x8f41('0x17'),_0x10093f,_0x8f41('0x15'),JSON[_0x8f41('0x18')](_0x3a4633));if(_0x3a4633['error']){if(_0x3a4633['error'][_0x8f41('0x19')]===0x1f4){logger[_0x8f41('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x10093f,_0x3a4633[_0x8f41('0x1a')][_0x8f41('0x1b')]);return _0x38666c(_0x3a4633['error']['message']);}logger['error'](_0x8f41('0x14'),_0x10093f,_0x3a4633['error'][_0x8f41('0x1b')]);return _0x5dccc7(_0x3a4633['error'][_0x8f41('0x1b')]);}else{logger[_0x8f41('0x13')](_0x8f41('0x14'),_0x10093f,_0x8f41('0x15'));_0x5dccc7(_0x3a4633['result']['message']);}})[_0x8f41('0x1c')](function(_0x3011e3){logger['error'](_0x8f41('0x14'),_0x10093f,_0x3011e3);_0x38666c(_0x3011e3);});});}function respondWithResult(_0x3b0a49,_0x57bba2){_0x57bba2=_0x57bba2||0xc8;return function(_0x27808f){if(_0x27808f){return _0x3b0a49[_0x8f41('0x1d')](_0x57bba2)[_0x8f41('0x1e')](_0x27808f);}};}function respondWithFilteredResult(_0x8e1c11,_0x24b89b){return function(_0x442c94){if(_0x442c94){var _0xe25900=typeof _0x24b89b['offset']===_0x8f41('0x1f')&&typeof _0x24b89b[_0x8f41('0x20')]===_0x8f41('0x1f');var _0x40807a=_0x442c94[_0x8f41('0x21')];var _0x271b96=_0xe25900?0x0:_0x24b89b[_0x8f41('0x22')];var _0x4cfc00=_0xe25900?_0x442c94[_0x8f41('0x21')]:_0x24b89b[_0x8f41('0x22')]+_0x24b89b[_0x8f41('0x20')];var _0x1aacc4;if(_0x4cfc00>=_0x40807a){_0x4cfc00=_0x40807a;_0x1aacc4=0xc8;}else{_0x1aacc4=0xce;}_0x8e1c11[_0x8f41('0x1d')](_0x1aacc4);return _0x8e1c11[_0x8f41('0x23')]('Content-Range',_0x271b96+'-'+_0x4cfc00+'/'+_0x40807a)[_0x8f41('0x1e')](_0x442c94);}return null;};}function saveUpdates(_0x4c82d6){return function(_0x9a6f1a){if(_0x9a6f1a){return _0x9a6f1a['update'](_0x4c82d6)[_0x8f41('0x12')](function(_0x1afa08){return _0x1afa08;});}return null;};}function removeEntity(_0x2f0713){return function(_0x5617c4){if(_0x5617c4){return _0x5617c4['destroy']()['then'](function(){_0x2f0713[_0x8f41('0x1d')](0xcc)[_0x8f41('0x24')]();});}};}function handleEntityNotFound(_0x1503c2){return function(_0x3ee268){if(!_0x3ee268){_0x1503c2[_0x8f41('0x25')](0x194);}return _0x3ee268;};}function handleError(_0x2dc08c,_0x2bddb6){_0x2bddb6=_0x2bddb6||0x1f4;return function(_0x32c72c){logger['error'](_0x32c72c['stack']);if(_0x32c72c[_0x8f41('0x26')]){delete _0x32c72c['name'];}_0x2dc08c[_0x8f41('0x1d')](_0x2bddb6)[_0x8f41('0x27')](_0x32c72c);};}exports[_0x8f41('0x28')]=function(_0x220491,_0x114714){var _0x1cd4c7={},_0x3ced9a={},_0x2be5a8={'count':0x0,'rows':[]};var _0x11c5d7=_[_0x8f41('0x29')](db[_0x8f41('0x2a')][_0x8f41('0x2b')],function(_0xc8df50){return{'name':_0xc8df50[_0x8f41('0x2c')],'type':_0xc8df50['type'][_0x8f41('0x2d')]};});_0x3ced9a[_0x8f41('0x2e')]=_[_0x8f41('0x29')](_0x11c5d7,'name');_0x3ced9a[_0x8f41('0x2f')]=_['keys'](_0x220491[_0x8f41('0x2f')]);_0x3ced9a[_0x8f41('0x30')]=_[_0x8f41('0x31')](_0x3ced9a[_0x8f41('0x2e')],_0x3ced9a[_0x8f41('0x2f')]);_0x1cd4c7['attributes']=_[_0x8f41('0x31')](_0x3ced9a['model'],qs['fields'](_0x220491[_0x8f41('0x2f')]['fields']));_0x1cd4c7[_0x8f41('0x32')]=_0x1cd4c7[_0x8f41('0x32')][_0x8f41('0x33')]?_0x1cd4c7[_0x8f41('0x32')]:_0x3ced9a[_0x8f41('0x2e')];if(!_0x220491[_0x8f41('0x2f')][_0x8f41('0x34')](_0x8f41('0x35'))){_0x1cd4c7[_0x8f41('0x20')]=qs['limit'](_0x220491['query'][_0x8f41('0x20')]);_0x1cd4c7[_0x8f41('0x22')]=qs[_0x8f41('0x22')](_0x220491[_0x8f41('0x2f')][_0x8f41('0x22')]);}_0x1cd4c7[_0x8f41('0x36')]=qs[_0x8f41('0x37')](_0x220491[_0x8f41('0x2f')][_0x8f41('0x37')]);_0x1cd4c7[_0x8f41('0x38')]=qs[_0x8f41('0x30')](_[_0x8f41('0x39')](_0x220491[_0x8f41('0x2f')],_0x3ced9a['filters']),_0x11c5d7);if(_0x220491['query'][_0x8f41('0x3a')]){_0x1cd4c7[_0x8f41('0x38')]=_[_0x8f41('0x3b')](_0x1cd4c7[_0x8f41('0x38')],{'$or':_[_0x8f41('0x29')](_0x11c5d7,function(_0x199c3b){if(_0x199c3b[_0x8f41('0x3c')]!=='VIRTUAL'){var _0x27dd40={};_0x27dd40[_0x199c3b[_0x8f41('0x26')]]={'$like':'%'+_0x220491[_0x8f41('0x2f')]['filter']+'%'};return _0x27dd40;}})});}_0x1cd4c7=_['merge']({},_0x1cd4c7,_0x220491[_0x8f41('0x3d')]);var _0x488367={'where':_0x1cd4c7[_0x8f41('0x38')]};return db[_0x8f41('0x2a')][_0x8f41('0x21')](_0x488367)['then'](function(_0x2471e4){_0x2be5a8[_0x8f41('0x21')]=_0x2471e4;if(_0x220491[_0x8f41('0x2f')]['includeAll']){_0x1cd4c7[_0x8f41('0x3e')]=[{'all':!![]}];}return db[_0x8f41('0x2a')][_0x8f41('0x3f')](_0x1cd4c7);})[_0x8f41('0x12')](function(_0x1efc09){_0x2be5a8['rows']=_0x1efc09;return _0x2be5a8;})[_0x8f41('0x12')](respondWithFilteredResult(_0x114714,_0x1cd4c7))[_0x8f41('0x1c')](handleError(_0x114714,null));};exports[_0x8f41('0x40')]=function(_0x14c416,_0x5575db){var _0x28ea43={'raw':!![],'where':{'id':_0x14c416[_0x8f41('0x41')]['id']}},_0x2f9fbc={};_0x2f9fbc[_0x8f41('0x2e')]=_['keys'](db[_0x8f41('0x2a')][_0x8f41('0x2b')]);_0x2f9fbc[_0x8f41('0x2f')]=_[_0x8f41('0x42')](_0x14c416[_0x8f41('0x2f')]);_0x2f9fbc[_0x8f41('0x30')]=_[_0x8f41('0x31')](_0x2f9fbc[_0x8f41('0x2e')],_0x2f9fbc[_0x8f41('0x2f')]);_0x28ea43[_0x8f41('0x32')]=_[_0x8f41('0x31')](_0x2f9fbc[_0x8f41('0x2e')],qs[_0x8f41('0x43')](_0x14c416[_0x8f41('0x2f')][_0x8f41('0x43')]));_0x28ea43[_0x8f41('0x32')]=_0x28ea43[_0x8f41('0x32')][_0x8f41('0x33')]?_0x28ea43[_0x8f41('0x32')]:_0x2f9fbc[_0x8f41('0x2e')];if(_0x14c416[_0x8f41('0x2f')][_0x8f41('0x44')]){_0x28ea43[_0x8f41('0x3e')]=[{'all':!![]}];}_0x28ea43=_[_0x8f41('0x3b')]({},_0x28ea43,_0x14c416[_0x8f41('0x3d')]);return db[_0x8f41('0x2a')]['find'](_0x28ea43)['then'](handleEntityNotFound(_0x5575db,null))[_0x8f41('0x12')](respondWithResult(_0x5575db,null))[_0x8f41('0x1c')](handleError(_0x5575db,null));};exports[_0x8f41('0x45')]=function(_0x4e7e04,_0x20014c){if(_0x4e7e04['body']['id']){delete _0x4e7e04['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x4e7e04[_0x8f41('0x41')]['id']}})[_0x8f41('0x12')](handleEntityNotFound(_0x20014c,null))[_0x8f41('0x12')](saveUpdates(_0x4e7e04['body'],null))[_0x8f41('0x12')](respondWithResult(_0x20014c,null))[_0x8f41('0x1c')](handleError(_0x20014c,null));};exports['destroy']=function(_0x36985a,_0x47fe34){return db['FaxMessage'][_0x8f41('0x46')]({'where':{'id':_0x36985a['params']['id']}})[_0x8f41('0x12')](handleEntityNotFound(_0x47fe34,null))[_0x8f41('0x12')](removeEntity(_0x47fe34,null))[_0x8f41('0x1c')](handleError(_0x47fe34,null));};exports[_0x8f41('0x47')]=function(_0x5b71c6,_0x433e31){return db[_0x8f41('0x2a')][_0x8f41('0x47')]()[_0x8f41('0x12')](respondWithResult(_0x433e31,null))[_0x8f41('0x1c')](handleError(_0x433e31,null));};exports[_0x8f41('0x48')]=function(_0x2432e6,_0x258e56){var _0x96e370=_0x8f41('0x49');return interactionService[_0x8f41('0x4a')](_0x2432e6,_0x96e370)['then'](respondWithResult(_0x258e56,null))['catch'](handleError(_0x258e56,null));};exports['accept']=function(_0x219cec,_0x16614b){var _0x346068=_0x8f41('0x4b');return interactionService[_0x8f41('0x4a')](_0x219cec,_0x346068)[_0x8f41('0x12')](respondWithResult(_0x16614b,null))[_0x8f41('0x1c')](handleError(_0x16614b,null));};exports[_0x8f41('0x4c')]=function(_0x154037,_0x3f106b){var _0xd9b903={'agent':{},'channel':_0x8f41('0x4b')};if(_0x154037[_0x8f41('0x4d')]['id']){delete _0x154037['body']['id'];}_0x154037['body'][_0x8f41('0x4e')]=_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')]||_0x154037[_0x8f41('0x4f')]['id'];_0xd9b903[_0x8f41('0x50')]['id']=_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')];return db[_0x8f41('0x2a')][_0x8f41('0x46')]({'where':{'id':_0x154037[_0x8f41('0x41')]['id'],'UserId':null}})[_0x8f41('0x12')](handleEntityNotFound(_0x3f106b,null))[_0x8f41('0x12')](function(_0x1572c0){if(_0x1572c0){_0xd9b903[_0x8f41('0x1b')]=_0x1572c0['get']({'plain':!![]});return db[_0x8f41('0x51')]['find']({'where':{'id':_0x1572c0[_0x8f41('0x52')]}});}return null;})['then'](handleEntityNotFound(_0x3f106b,null))[_0x8f41('0x12')](function(_0x342bb2){if(_0x342bb2){_0xd9b903[_0x8f41('0x53')]=_0x342bb2[_0x8f41('0x54')]({'plain':!![]});interaction_log[_0x8f41('0x13')](_0x8f41('0x55'),_0x154037[_0x8f41('0x4f')]['id'],_0x154037[_0x8f41('0x4f')][_0x8f41('0x26')],_0x154037[_0x8f41('0x4f')][_0x8f41('0x56')],_0xd9b903[_0x8f41('0x53')]['id'],_0x154037[_0x8f41('0x4d')]?JSON[_0x8f41('0x18')](_0x154037[_0x8f41('0x4d')]):_0x8f41('0x57'));return respondWithRpcPromise('RejectMessage',_0x8f41('0x58'),_0xd9b903);}return null;})['then'](function(_0x278a5b){var _0x49d0ee=_0x8f41('0x59')+_0x278a5b[_0x8f41('0x1b')][_0x8f41('0x5a')];return db[_0x8f41('0x5b')]['query'](_0x49d0ee,{'type':db['Sequelize']['QueryTypes'][_0x8f41('0x5c')],'raw':!![]})['then'](function(_0x4c5de4){return _0x4c5de4;});})[_0x8f41('0x12')](function(_0x4fba45){if(_0x4fba45){_0xd9b903['message'][_0x8f41('0x5d')]=_0x4fba45[0x0];if(!_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')])return;return db['User'][_0x8f41('0x46')]({'where':{'id':_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')],'role':'agent'},'attributes':['id',_0x8f41('0x26'),'fullname',_0x8f41('0x5e'),_0x8f41('0x5f')],'raw':!![]});}return null;})[_0x8f41('0x12')](function(_0x2dfd24){if(!_0x2dfd24)return null;_0xd9b903[_0x8f41('0x1b')][_0x8f41('0x50')]=_0x2dfd24;return _0xd9b903;})[_0x8f41('0x12')](function(_0xca04a6){if(_0xca04a6){_0xca04a6[_0x8f41('0x1b')][_0x8f41('0x60')]=util['format'](_0x8f41('0x61'),_0x154037[_0x8f41('0x4f')]['name']);_0xca04a6['message'][_0x8f41('0x62')]=_0xd9b903[_0x8f41('0x62')];_0xca04a6['message'][_0x8f41('0x63')]=_0xd9b903[_0x8f41('0x62')];_0xca04a6[_0x8f41('0x1b')]['event']=_0x8f41('0x4c');respondWithRpcPromise(_0x8f41('0x64'),'EventManager',{'event':_0x8f41('0x65'),'message':_0xca04a6[_0x8f41('0x1b')]},client9002);return _0xd9b903;}return null;})[_0x8f41('0x12')](respondWithResult(_0x3f106b,null))['catch'](handleError(_0x3f106b,null));};exports['create']=function(_0xff008b,_0x1b9578){var _0x1428a9;return db[_0x8f41('0x2a')][_0x8f41('0x66')](_0xff008b['body'],{})[_0x8f41('0x12')](function(_0x502d58){_0x1428a9=_0x502d58;return db[_0x8f41('0x67')][_0x8f41('0x68')]({'where':{'id':_0x1428a9['ContactId']}});})['then'](function(_0x4d42ba){if(_[_0x8f41('0x69')](_0x4d42ba)){return;}else{_0x1428a9[_0x8f41('0x4b')]=_0x4d42ba[_0x8f41('0x4b')];return db[_0x8f41('0x6a')]['findOne']({'where':{'id':_0x1428a9['AttachmentId']}});}})[_0x8f41('0x12')](function(_0x5ad31b){return respondWithRpcPromise(_0x8f41('0x6b'),_0x8f41('0x6b'),{'FaxAccountId':_[_0x8f41('0x69')](_0xff008b[_0x8f41('0x4d')])?undefined:_0xff008b['body']['FaxAccountId'],'path':_[_0x8f41('0x69')](_0x5ad31b)?undefined:util[_0x8f41('0x6c')](_0x8f41('0x6d'),_0x5ad31b[_0x8f41('0x6e')]),'fax':_[_0x8f41('0x69')](_0x1428a9['fax'])?undefined:_0x1428a9[_0x8f41('0x4b')],'AttachmentId':_0x1428a9[_0x8f41('0x6f')]},client9002);})['then'](respondWithResult(_0x1b9578,0xc9))[_0x8f41('0x1c')](handleError(_0x1b9578,null));};exports[_0x8f41('0x70')]=function(_0x18405d,_0x3a7fb3){var _0x29561d=path[_0x8f41('0x71')](config[_0x8f41('0x72')],_0x8f41('0x73'),_0x8f41('0x74'),_0x8f41('0x75'));return db[_0x8f41('0x2a')][_0x8f41('0x46')]({'where':{'id':_0x18405d[_0x8f41('0x41')]['id']},'include':[{'model':db[_0x8f41('0x6a')],'as':'Attachment'}]})[_0x8f41('0x12')](handleEntityNotFound(_0x3a7fb3,null))[_0x8f41('0x12')](function(_0x4033cd){if(_0x4033cd){return _0x3a7fb3[_0x8f41('0x70')](path[_0x8f41('0x71')](_0x29561d,_0x4033cd[_0x8f41('0x6a')][_0x8f41('0x6e')]));}})['catch'](handleError(_0x3a7fb3,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 36361c2..00c6cd4 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 _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 +var _0x3641=['../../mysqldb','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x16b172,_0x245b65){var _0x1cfab5=function(_0x4ccda5){while(--_0x4ccda5){_0x16b172['push'](_0x16b172['shift']());}};_0x1cfab5(++_0x245b65);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x1364('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1364('0x1'),'afterUpdate':_0x1364('0x2'),'afterDestroy':'remove'};function emitEvent(_0x435684){return function(_0x4a9034,_0x3d14e0,_0x4e41b7){FaxMessageEvents[_0x1364('0x3')](_0x435684+':'+_0x4a9034['id'],_0x4a9034);FaxMessageEvents['emit'](_0x435684,_0x4a9034);_0x4e41b7(null);};}for(var e in events){if(events[_0x1364('0x4')](e)){var event=events[e];FaxMessage[_0x1364('0x5')](e,emitEvent(event));}}module[_0x1364('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ba215c6..e500ccb 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 _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 +var _0xaf55=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x754f7f,_0x5a0753){var _0x20d21b=function(_0x36594e){while(--_0x36594e){_0x754f7f['push'](_0x754f7f['shift']());}};_0x20d21b(++_0x5a0753);}(_0xaf55,0x13e));var _0x5af5=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xaf55[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5af5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5af5('0x1'));var moment=require(_0x5af5('0x2'));var BPromise=require(_0x5af5('0x3'));var rp=require(_0x5af5('0x4'));var fs=require('fs');var path=require(_0x5af5('0x5'));var rimraf=require(_0x5af5('0x6'));var config=require(_0x5af5('0x7'));var attributes=require('./faxMessage.attributes');module[_0x5af5('0x8')]=function(_0x30e62d,_0x427226){return _0x30e62d[_0x5af5('0x9')](_0x5af5('0xa'),attributes,{'tableName':_0x5af5('0xb'),'paranoid':![],'indexes':[{'name':_0x5af5('0xc'),'fields':[_0x5af5('0xd')],'type':_0x5af5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b6744,_0x9fc7a7,_0x23c1f2){var _0x4c2337=_0x30e62d[_0x5af5('0xf')];var _0x33a8a5=_0x4b6744[_0x5af5('0x10')]({'plain':!![]});if(_0x33a8a5['direction'][_0x5af5('0x11')]()==='in'||_0x33a8a5[_0x5af5('0x12')][_0x5af5('0x11')]()===_0x5af5('0x13')&&!_0x33a8a5[_0x5af5('0x14')]&&!_[_0x5af5('0x15')](_0x33a8a5[_0x5af5('0x16')])){_0x4c2337['FaxInteraction'][_0x5af5('0x17')]({'where':{'id':_0x33a8a5[_0x5af5('0x18')]}})[_0x5af5('0x19')](function(_0x351461){if(_0x351461){_0x351461[_0x5af5('0x1a')]({'lastMsgAt':_0x33a8a5[_0x5af5('0x1b')],'lastMsgDirection':_0x33a8a5[_0x5af5('0x12')][_0x5af5('0x11')]()});}})[_0x5af5('0x1c')](function(_0x2ec76e){console[_0x5af5('0x1d')](_0x2ec76e);});}_0x23c1f2();}},'charset':_0x5af5('0x1e'),'collate':_0x5af5('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 0324064..cc9fddd 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 _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 +var _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a53c2,_0x2e768b){var _0x189ef4=function(_0x405d7e){while(--_0x405d7e){_0x5a53c2['push'](_0x5a53c2['shift']());}};_0x189ef4(++_0x2e768b);}(_0xe14d,0x1ee));var _0xde14=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe14d[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ba30801..6e634a3 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 _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 +var _0x9676=['remove','update','emit','removeListener','register','length','faxMessage:','save'];(function(_0x29e595,_0x4b9838){var _0xc4e3f1=function(_0x9a3b2d){while(--_0x9a3b2d){_0x29e595['push'](_0x29e595['shift']());}};_0xc4e3f1(++_0x4b9838);}(_0x9676,0x7f));var _0x6967=function(_0x54e698,_0x4c6d5c){_0x54e698=_0x54e698-0x0;var _0x1eb4a6=_0x9676[_0x54e698];return _0x1eb4a6;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x6967('0x0'),_0x6967('0x1'),_0x6967('0x2')];function createListener(_0x57e7b4,_0x1df47c){return function(_0x1191f4){_0x1df47c[_0x6967('0x3')](_0x57e7b4,_0x1191f4);};}function removeListener(_0x42a193,_0x24513d){return function(){FaxMessageEvents[_0x6967('0x4')](_0x42a193,_0x24513d);};}exports[_0x6967('0x5')]=function(_0x572bbd){for(var _0x4e6fb5=0x0,_0x1b3476=events[_0x6967('0x6')];_0x4e6fb5<_0x1b3476;_0x4e6fb5++){var _0x43d0f3=events[_0x4e6fb5];var _0x47ba16=createListener(_0x6967('0x7')+_0x43d0f3,_0x572bbd);FaxMessageEvents['on'](_0x43d0f3,_0x47ba16);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index da83d03..1972f1c 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 _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 +var _0xb7e7=['get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')]('/',auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x11')](_0x7b7e('0x12'),_0x7b7e('0x13')),controller[_0x7b7e('0x14')]);router[_0x7b7e('0x15')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x15')]('/:id/accept',auth[_0x7b7e('0xc')](),controller['accept']);router['put'](_0x7b7e('0x17'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1e53bbd..599ce5b 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 _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 +var _0xe495=['roundrobin','INTEGER','sequelize','STRING','name','ENUM','beepall'];(function(_0x512d6a,_0x5c514b){var _0x38513d=function(_0x9841cf){while(--_0x9841cf){_0x512d6a['push'](_0x512d6a['shift']());}};_0x38513d(++_0x5c514b);}(_0xe495,0x12f));var _0x5e49=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe495[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0x5e49('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e49('0x1')],'unique':_0x5e49('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e49('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e49('0x3')]('rrmemory',_0x5e49('0x4'),_0x5e49('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5e49('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 47a056a..c98718f 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 _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 +var _0xc6c0=['hasOwnProperty','nolimit','sort','pick','where','FaxQueueId','filter','options','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','interface','flatMap','sequelize','each','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','order','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','map','FaxQueue','rawAttributes','fieldName','key','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne'];(function(_0x1579e4,_0x49f202){var _0x1f6683=function(_0xd68516){while(--_0xd68516){_0x1579e4['push'](_0x1579e4['shift']());}};_0x1f6683(++_0x49f202);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xc6c0[_0x51fe5f];return _0x4abce9;};'use strict';var BPromise=require(_0x0c6c('0x0'));var util=require('util');var _=require(_0x0c6c('0x1'));var squel=require(_0x0c6c('0x2'));var Redis=require(_0x0c6c('0x3'));var qs=require(_0x0c6c('0x4'));var logger=require(_0x0c6c('0x5'))(_0x0c6c('0x6'));var config=require(_0x0c6c('0x7'));var db=require(_0x0c6c('0x8'))['db'];config[_0x0c6c('0x9')]=_[_0x0c6c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0c6c('0xb'))(new Redis(config[_0x0c6c('0x9')]));require(_0x0c6c('0xc'))[_0x0c6c('0xd')](socket);function respondWithStatusCode(_0x15c862,_0x30ae87){_0x30ae87=_0x30ae87||0xcc;return function(_0x289309){if(_0x289309){return _0x15c862[_0x0c6c('0xe')](_0x30ae87);}return _0x15c862[_0x0c6c('0xf')](_0x30ae87)[_0x0c6c('0x10')]();};}function respondWithResult(_0x4286b0,_0x3769c2){_0x3769c2=_0x3769c2||0xc8;return function(_0x238229){if(_0x238229){return _0x4286b0[_0x0c6c('0xf')](_0x3769c2)[_0x0c6c('0x11')](_0x238229);}};}function respondWithFilteredResult(_0x5c9d9a,_0x1556e8){return function(_0x5f4cd7){if(_0x5f4cd7){var _0x1dfc49=typeof _0x1556e8[_0x0c6c('0x12')]==='undefined'&&typeof _0x1556e8[_0x0c6c('0x13')]===_0x0c6c('0x14');var _0x44c500=_0x5f4cd7[_0x0c6c('0x15')];var _0x33d675=_0x1dfc49?0x0:_0x1556e8['offset'];var _0xcbf4a9=_0x1dfc49?_0x5f4cd7[_0x0c6c('0x15')]:_0x1556e8[_0x0c6c('0x12')]+_0x1556e8[_0x0c6c('0x13')];var _0x5051c2;if(_0xcbf4a9>=_0x44c500){_0xcbf4a9=_0x44c500;_0x5051c2=0xc8;}else{_0x5051c2=0xce;}_0x5c9d9a[_0x0c6c('0xf')](_0x5051c2);return _0x5c9d9a[_0x0c6c('0x16')]('Content-Range',_0x33d675+'-'+_0xcbf4a9+'/'+_0x44c500)[_0x0c6c('0x11')](_0x5f4cd7);}return null;};}function saveUpdates(_0x527ade){return function(_0x5300a7){if(_0x5300a7){return _0x5300a7['update'](_0x527ade)[_0x0c6c('0x17')](function(_0x530333){return _0x530333;});}return null;};}function removeEntity(_0x9463e8){return function(_0x50be43){if(_0x50be43){return _0x50be43[_0x0c6c('0x18')]()[_0x0c6c('0x17')](function(){var _0x9ebbd8=_0x50be43[_0x0c6c('0x19')]({'plain':!![]});var _0x4ff711=_0x0c6c('0x1a');return db[_0x0c6c('0x1b')][_0x0c6c('0x18')]({'where':{'type':_0x4ff711,'resourceId':_0x9ebbd8['id']}})[_0x0c6c('0x17')](function(){return _0x50be43;});})[_0x0c6c('0x17')](function(){_0x9463e8[_0x0c6c('0xf')](0xcc)[_0x0c6c('0x10')]();});}};}function handleEntityNotFound(_0x8e8179){return function(_0x1be835){if(!_0x1be835){_0x8e8179['sendStatus'](0x194);}return _0x1be835;};}function handleError(_0x323854,_0xc33069){_0xc33069=_0xc33069||0x1f4;return function(_0x6d291f){logger['error'](_0x6d291f[_0x0c6c('0x1c')]);if(_0x6d291f['name']){delete _0x6d291f[_0x0c6c('0x1d')];}_0x323854[_0x0c6c('0xf')](_0xc33069)[_0x0c6c('0x1e')](_0x6d291f);};}exports['index']=function(_0x3fb7a0,_0x63784f){var _0x200a47={};var _0x99b725={'count':0x0,'rows':[]};var _0xb46694=_[_0x0c6c('0x1f')](db[_0x0c6c('0x20')][_0x0c6c('0x21')],function(_0x194637){return{'name':_0x194637[_0x0c6c('0x22')],'type':_0x194637['type'][_0x0c6c('0x23')]};});_0x200a47=qs['getOptions'](_0xb46694,_0x3fb7a0);var _0x29ec5d={'where':_0x200a47['where']};return db[_0x0c6c('0x20')][_0x0c6c('0x15')](_0x29ec5d)[_0x0c6c('0x17')](function(_0xba7b3){_0x99b725[_0x0c6c('0x15')]=_0xba7b3;_0x200a47[_0x0c6c('0x24')]=qs[_0x0c6c('0x24')](_0x3fb7a0[_0x0c6c('0x25')]);return db['FaxQueue'][_0x0c6c('0x26')](_0x200a47);})[_0x0c6c('0x17')](function(_0x5ec5bc){_0x99b725[_0x0c6c('0x27')]=_0x5ec5bc;return _0x99b725;})['then'](respondWithFilteredResult(_0x63784f,_0x200a47))[_0x0c6c('0x28')](handleError(_0x63784f,null));};exports[_0x0c6c('0x29')]=function(_0x1240d5,_0xb2a3a2){var _0x368725={'raw':!![],'where':{'id':_0x1240d5[_0x0c6c('0x2a')]['id']}},_0x133670={};_0x133670[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db['FaxQueue']['rawAttributes']);_0x133670[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x1240d5[_0x0c6c('0x25')]);_0x133670[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x133670[_0x0c6c('0x2b')],_0x133670['query']);_0x368725[_0x0c6c('0x2f')]=_['intersection'](_0x133670[_0x0c6c('0x2b')],qs['fields'](_0x1240d5[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x368725['attributes']=_0x368725['attributes'][_0x0c6c('0x31')]?_0x368725[_0x0c6c('0x2f')]:_0x133670[_0x0c6c('0x2b')];if(_0x1240d5[_0x0c6c('0x25')]['includeAll']){_0x368725[_0x0c6c('0x24')]=[{'all':!![]}];}_0x368725=_[_0x0c6c('0x32')]({},_0x368725,_0x1240d5['options']);return db[_0x0c6c('0x20')][_0x0c6c('0x33')](_0x368725)[_0x0c6c('0x17')](handleEntityNotFound(_0xb2a3a2,null))['then'](respondWithResult(_0xb2a3a2,null))[_0x0c6c('0x28')](handleError(_0xb2a3a2,null));};exports[_0x0c6c('0x34')]=function(_0xbf1a35,_0x93e98a){return db[_0x0c6c('0x20')][_0x0c6c('0x34')](_0xbf1a35[_0x0c6c('0x35')],{})[_0x0c6c('0x17')](function(_0x3b5cc1){var _0x371c0b=_0xbf1a35[_0x0c6c('0x36')][_0x0c6c('0x19')]({'plain':!![]});if(!_0x371c0b)throw new Error(_0x0c6c('0x37'));if(_0x371c0b[_0x0c6c('0x38')]===_0x0c6c('0x36')){var _0x1c70d8=_0x3b5cc1[_0x0c6c('0x19')]({'plain':!![]});var _0x3bf947=_0x0c6c('0x1a');return db[_0x0c6c('0x39')][_0x0c6c('0x33')]({'where':{'name':_0x3bf947,'userProfileId':_0x371c0b[_0x0c6c('0x3a')]},'raw':!![]})[_0x0c6c('0x17')](function(_0x39b640){if(_0x39b640&&_0x39b640[_0x0c6c('0x3b')]===0x0){return db[_0x0c6c('0x1b')]['create']({'name':_0x1c70d8[_0x0c6c('0x1d')],'resourceId':_0x1c70d8['id'],'type':_0x39b640[_0x0c6c('0x1d')],'sectionId':_0x39b640['id']},{})['then'](function(){return _0x3b5cc1;});}else{return _0x3b5cc1;}})[_0x0c6c('0x28')](function(_0x12278f){logger[_0x0c6c('0x3c')](_0x0c6c('0x3d'),_0x12278f);throw _0x12278f;});}return _0x3b5cc1;})[_0x0c6c('0x17')](respondWithResult(_0x93e98a,0xc9))[_0x0c6c('0x28')](handleError(_0x93e98a,null));};exports[_0x0c6c('0x3e')]=function(_0x485c32,_0x5cda22){if(_0x485c32[_0x0c6c('0x35')]['id']){delete _0x485c32[_0x0c6c('0x35')]['id'];}return db[_0x0c6c('0x20')][_0x0c6c('0x33')]({'where':{'id':_0x485c32[_0x0c6c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5cda22,null))[_0x0c6c('0x17')](saveUpdates(_0x485c32[_0x0c6c('0x35')],null))[_0x0c6c('0x17')](respondWithResult(_0x5cda22,null))[_0x0c6c('0x28')](handleError(_0x5cda22,null));};exports[_0x0c6c('0x18')]=function(_0x363b31,_0x1b8e62){return db['FaxQueue'][_0x0c6c('0x33')]({'where':{'id':_0x363b31[_0x0c6c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1b8e62,null))[_0x0c6c('0x17')](removeEntity(_0x1b8e62,null))['catch'](handleError(_0x1b8e62,null));};exports[_0x0c6c('0x3f')]=function(_0x2fcbca,_0x5aa32e){return db[_0x0c6c('0x20')][_0x0c6c('0x3f')]()[_0x0c6c('0x17')](respondWithResult(_0x5aa32e,null))['catch'](handleError(_0x5aa32e,null));};exports[_0x0c6c('0x40')]=function(_0x11c599,_0x22ddb0){var _0x1d7373={'raw':!![],'where':{}},_0x4ccf3a={},_0x5a7ceb;return db[_0x0c6c('0x20')][_0x0c6c('0x41')]({'where':{'id':_0x11c599[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x22ddb0,null))[_0x0c6c('0x17')](function(_0x29328c){if(_0x29328c){_0x5a7ceb=_0x29328c[_0x0c6c('0x19')]({'plain':!![]});_0x4ccf3a[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db['UserFaxQueue'][_0x0c6c('0x21')]);_0x4ccf3a[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x11c599[_0x0c6c('0x25')]);_0x4ccf3a[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x4ccf3a[_0x0c6c('0x2b')],_0x4ccf3a[_0x0c6c('0x25')]);_0x1d7373[_0x0c6c('0x2f')]=_[_0x0c6c('0x2e')](_0x4ccf3a[_0x0c6c('0x2b')],qs[_0x0c6c('0x30')](_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x1d7373['attributes']=_0x1d7373[_0x0c6c('0x2f')][_0x0c6c('0x31')]?_0x1d7373[_0x0c6c('0x2f')]:_0x4ccf3a['model'];if(!_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x42')](_0x0c6c('0x43'))){_0x1d7373[_0x0c6c('0x13')]=qs['limit'](_0x11c599[_0x0c6c('0x25')]['limit']);_0x1d7373[_0x0c6c('0x12')]=qs[_0x0c6c('0x12')](_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x12')]);}_0x1d7373['order']=qs[_0x0c6c('0x44')](_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x44')]);_0x1d7373['where']=qs[_0x0c6c('0x2d')](_[_0x0c6c('0x45')](_0x11c599[_0x0c6c('0x25')],_0x4ccf3a['filters']));_0x1d7373[_0x0c6c('0x46')][_0x0c6c('0x47')]=_0x29328c['id'];if(_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x48')]){_0x1d7373[_0x0c6c('0x46')]=_[_0x0c6c('0x32')](_0x1d7373[_0x0c6c('0x46')],{'$or':_[_0x0c6c('0x1f')](_0x1d7373['attributes'],function(_0x15ffbc){var _0x15a031={};_0x15a031[_0x15ffbc]={'$like':'%'+_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x48')]+'%'};return _0x15a031;})});}_0x1d7373=_['merge']({},_0x1d7373,_0x11c599[_0x0c6c('0x49')]);return db[_0x0c6c('0x4a')][_0x0c6c('0x26')](_0x1d7373);}})[_0x0c6c('0x17')](function(_0x4fc0c6){if(_0x4fc0c6){return db[_0x0c6c('0x4b')][_0x0c6c('0x4c')]({'where':{'id':_['map'](_0x4fc0c6,_0x0c6c('0x4d')),'role':_0x0c6c('0x4e')},'attributes':['id',_0x0c6c('0x1d'),_0x0c6c('0x4f'),_0x0c6c('0x50'),_0x0c6c('0x51')]});}})['then'](function(_0x305462){if(_0x305462){return{'count':_0x305462[_0x0c6c('0x15')],'rows':_[_0x0c6c('0x1f')](_0x305462[_0x0c6c('0x27')],function(_0x2b10d0){return{'membername':_0x2b10d0[_0x0c6c('0x1d')],'UserId':_0x2b10d0['id'],'queue_name':_0x5a7ceb[_0x0c6c('0x1d')],'FaxQueueId':_0x5a7ceb['id'],'interface':util[_0x0c6c('0x52')](_0x0c6c('0x53'),_0x0c6c('0x54'),_0x2b10d0[_0x0c6c('0x1d')]),'penalty':0x0,'paused':_0x2b10d0[_0x0c6c('0x4f')],'createdAt':_0x2b10d0[_0x0c6c('0x51')],'updatedAt':_0x2b10d0[_0x0c6c('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0c6c('0x17')](respondWithFilteredResult(_0x22ddb0,_0x1d7373))['catch'](handleError(_0x22ddb0,null));};exports[_0x0c6c('0x55')]=function(_0x5ea10b,_0x420d8e){var _0x45e962={};var _0x4dfea9={};var _0x3ceed1;var _0x496670;return db[_0x0c6c('0x20')][_0x0c6c('0x41')]({'where':{'id':_0x5ea10b[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x420d8e,null))[_0x0c6c('0x17')](function(_0x409ce0){if(_0x409ce0){_0x3ceed1=_0x409ce0;_0x4dfea9[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db[_0x0c6c('0x56')]['rawAttributes']);_0x4dfea9[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x5ea10b['query']);_0x4dfea9[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x4dfea9[_0x0c6c('0x2b')],_0x4dfea9[_0x0c6c('0x25')]);_0x45e962[_0x0c6c('0x2f')]=_['intersection'](_0x4dfea9[_0x0c6c('0x2b')],qs['fields'](_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x45e962[_0x0c6c('0x2f')]=_0x45e962[_0x0c6c('0x2f')]['length']?_0x45e962[_0x0c6c('0x2f')]:_0x4dfea9[_0x0c6c('0x2b')];_0x45e962['order']=qs[_0x0c6c('0x44')](_0x5ea10b[_0x0c6c('0x25')]['sort']);_0x45e962[_0x0c6c('0x46')]=qs[_0x0c6c('0x2d')](_[_0x0c6c('0x45')](_0x5ea10b['query'],_0x4dfea9['filters']));if(_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x48')]){_0x45e962[_0x0c6c('0x46')]=_['merge'](_0x45e962['where'],{'$or':_[_0x0c6c('0x1f')](_0x45e962['attributes'],function(_0x1d2d2f){var _0x3a0934={};_0x3a0934[_0x1d2d2f]={'$like':'%'+_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x48')]+'%'};return _0x3a0934;})});}_0x45e962=_[_0x0c6c('0x32')]({},_0x45e962,_0x5ea10b['options']);return _0x3ceed1['getTeams'](_0x45e962);}})[_0x0c6c('0x17')](function(_0x104b50){if(_0x104b50){_0x496670=_0x104b50[_0x0c6c('0x31')];if(!_0x5ea10b['query'][_0x0c6c('0x42')](_0x0c6c('0x43'))){_0x45e962[_0x0c6c('0x13')]=qs[_0x0c6c('0x13')](_0x5ea10b[_0x0c6c('0x25')]['limit']);_0x45e962[_0x0c6c('0x12')]=qs[_0x0c6c('0x12')](_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x12')]);}return _0x3ceed1[_0x0c6c('0x55')](_0x45e962);}})[_0x0c6c('0x17')](function(_0x573870){if(_0x573870){return _0x573870?{'count':_0x496670,'rows':_0x573870}:null;}})['then'](respondWithResult(_0x420d8e,null))[_0x0c6c('0x28')](handleError(_0x420d8e,null));};exports[_0x0c6c('0x57')]=function(_0x14a61f,_0x272f0e){var _0x3eae02=_0x14a61f[_0x0c6c('0x35')]['ids'];return db[_0x0c6c('0x56')][_0x0c6c('0x26')]({'where':{'id':_0x3eae02},'attributes':['id'],'include':[{'model':db[_0x0c6c('0x4b')],'as':_0x0c6c('0x58'),'attributes':['id',_0x0c6c('0x1d'),'online','voicePause',_0x0c6c('0x59')],'raw':!![]}]})[_0x0c6c('0x17')](function(_0x3e13e5){if(_0x3e13e5){var _0x4b454c=_[_0x0c6c('0x5a')](_0x3e13e5,function(_0x936de4){var _0x22916a=_0x936de4[_0x0c6c('0x19')]({'plain':!![]});return _0x22916a[_0x0c6c('0x58')];});return db[_0x0c6c('0x20')][_0x0c6c('0x33')]({'where':{'id':_0x14a61f[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](function(_0x552c19){return db[_0x0c6c('0x5b')]['transaction'](function(_0x559ad0){return _0x552c19['addTeams'](_0x3eae02,{'transaction':_0x559ad0})[_0x0c6c('0x17')](function(){return BPromise[_0x0c6c('0x5c')](_0x4b454c,function(_0x354ca7){return db['UserFaxQueue'][_0x0c6c('0x5d')]({'where':{'UserId':_0x354ca7['id'],'FaxQueueId':_0x14a61f[_0x0c6c('0x2a')]['id']},'transaction':_0x559ad0});});})['then'](function(){_0x4b454c['forEach'](function(_0x3eb3e3){socket[_0x0c6c('0x5e')](_0x0c6c('0x5f'),{'UserId':_0x3eb3e3['id'],'FaxQueueId':_0x552c19['id']});});});});});}})['then'](respondWithStatusCode(_0x272f0e,null))[_0x0c6c('0x28')](handleError(_0x272f0e,null));};exports[_0x0c6c('0x60')]=function(_0x7481f0,_0x43e2c3){return db['Team']['findAll']({'where':{'id':_0x7481f0[_0x0c6c('0x25')][_0x0c6c('0x61')]},'attributes':['id'],'include':[{'model':db[_0x0c6c('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x43e2c3,null))[_0x0c6c('0x17')](function(_0x4c915d){var _0x42d681=_[_0x0c6c('0x1f')](_0x4c915d,'id');var _0x360f3c=[];var _0x43c18d=[];var _0x3178ac=squel[_0x0c6c('0x62')]();_0x3178ac[_0x0c6c('0x63')](_0x0c6c('0x64'))[_0x0c6c('0x65')]('team_has_fax_queues','tq')[_0x0c6c('0x66')](_0x0c6c('0x67'),'ut',_0x0c6c('0x68'))[_0x0c6c('0x46')](_0x0c6c('0x69'),_0x7481f0[_0x0c6c('0x2a')]['id']);for(var _0xb57dd2=0x0;_0xb57dd2<_0x4c915d[_0x0c6c('0x31')];_0xb57dd2+=0x1){let _0xba15f=_0x4c915d[_0xb57dd2];for(var _0x371550=0x0;_0x371550<_0xba15f[_0x0c6c('0x58')][_0x0c6c('0x31')];_0x371550+=0x1){let _0x3d10cf=_0xba15f[_0x0c6c('0x58')][_0x371550];var _0x1c6a4c=_0x3178ac[_0x0c6c('0x6a')]();_0x1c6a4c['where'](_0x0c6c('0x6b'),_0x3d10cf['id']);_0x43c18d[_0x0c6c('0x6c')](db['sequelize'][_0x0c6c('0x25')](_0x1c6a4c[_0x0c6c('0x6d')](),{'type':db[_0x0c6c('0x5b')][_0x0c6c('0x6e')][_0x0c6c('0x6f')]})[_0x0c6c('0x17')](function(_0x4dc47e){if(_0x4dc47e['length']===0x1){return _0x3d10cf['id'];}else{var _0x3492d5=_[_0x0c6c('0x70')](_[_0x0c6c('0x1f')](_0x4dc47e,_0x0c6c('0x71')),function(_0x5eea03){return _[_0x0c6c('0x72')](_0x42d681,_0x5eea03);});if(_0x3492d5){return _0x3d10cf['id'];}}}));}}return BPromise[_0x0c6c('0x73')](_0x43c18d)[_0x0c6c('0x17')](function(_0xd2cab6){_0x360f3c=_(_0x360f3c)['union'](_0xd2cab6)[_0x0c6c('0x74')]()[_0x0c6c('0x75')]();return db[_0x0c6c('0x20')]['find']({'where':{'id':_0x7481f0['params']['id']}})[_0x0c6c('0x17')](function(_0x31a33b){return db[_0x0c6c('0x5b')][_0x0c6c('0x76')](function(_0x1305e2){return _0x31a33b[_0x0c6c('0x60')](_0x7481f0[_0x0c6c('0x25')]['ids'],{'transaction':_0x1305e2})[_0x0c6c('0x17')](function(){if(!_['isEmpty'](_0x360f3c)){return _0x31a33b[_0x0c6c('0x77')](_0x360f3c,{'transaction':_0x1305e2});}})[_0x0c6c('0x17')](function(){_0x360f3c[_0x0c6c('0x78')](function(_0x45e0ef){socket[_0x0c6c('0x5e')](_0x0c6c('0x79'),{'UserId':_0x45e0ef,'FaxQueueId':_0x31a33b['id']});});});});});});})[_0x0c6c('0x17')](respondWithStatusCode(_0x43e2c3,null))['catch'](handleError(_0x43e2c3,null));};exports['addAgents']=function(_0x408737,_0x1eb534){return db['FaxQueue'][_0x0c6c('0x33')]({'where':{'id':_0x408737[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x1eb534,null))[_0x0c6c('0x17')](function(_0x48391b){if(_0x48391b){return _0x48391b[_0x0c6c('0x7a')](_0x408737['body'][_0x0c6c('0x61')],_[_0x0c6c('0x7b')](_0x408737[_0x0c6c('0x35')],[_0x0c6c('0x61'),'id'])||{})[_0x0c6c('0x7c')](function(_0x67e9d9){for(var _0x28b3e8=0x0;_0x28b3e8<_0x408737[_0x0c6c('0x35')][_0x0c6c('0x61')][_0x0c6c('0x31')];_0x28b3e8+=0x1){socket[_0x0c6c('0x5e')](_0x0c6c('0x5f'),{'UserId':Number(_0x408737[_0x0c6c('0x35')][_0x0c6c('0x61')][_0x28b3e8]),'FaxQueueId':Number(_0x408737[_0x0c6c('0x2a')]['id'])});}return _0x67e9d9;});}})[_0x0c6c('0x17')](respondWithResult(_0x1eb534,null))[_0x0c6c('0x28')](handleError(_0x1eb534,null));};exports[_0x0c6c('0x77')]=function(_0x5928a4,_0x4e4472){return db[_0x0c6c('0x20')]['find']({'where':{'id':_0x5928a4[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x4e4472,null))[_0x0c6c('0x17')](function(_0x474704){if(_0x474704){return _0x474704['removeAgents'](_0x5928a4[_0x0c6c('0x25')][_0x0c6c('0x61')])[_0x0c6c('0x17')](function(){if(_[_0x0c6c('0x7d')](_0x5928a4['query'][_0x0c6c('0x61')])){for(var _0x4b6cbb=0x0;_0x4b6cbb<_0x5928a4[_0x0c6c('0x25')]['ids'][_0x0c6c('0x31')];_0x4b6cbb+=0x1){socket[_0x0c6c('0x5e')](_0x0c6c('0x79'),{'UserId':Number(_0x5928a4[_0x0c6c('0x25')][_0x0c6c('0x61')][_0x4b6cbb]),'FaxQueueId':Number(_0x5928a4[_0x0c6c('0x2a')]['id'])});}}else{socket[_0x0c6c('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x5928a4[_0x0c6c('0x25')][_0x0c6c('0x61')]),'FaxQueueId':Number(_0x5928a4[_0x0c6c('0x2a')]['id'])});}});}})[_0x0c6c('0x17')](respondWithStatusCode(_0x4e4472,null))[_0x0c6c('0x28')](handleError(_0x4e4472,null));};exports['getAgents']=function(_0x692cc4,_0x1e325f){var _0x595c75={};var _0x133418={};var _0x4756f0;var _0x2a4fce;return db[_0x0c6c('0x20')][_0x0c6c('0x41')]({'where':{'id':_0x692cc4[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x1e325f,null))[_0x0c6c('0x17')](function(_0x3d4956){if(_0x3d4956){_0x4756f0=_0x3d4956;_0x133418[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db['User'][_0x0c6c('0x21')]);_0x133418[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x692cc4['query']);_0x133418[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x133418[_0x0c6c('0x2b')],_0x133418['query']);_0x595c75['attributes']=_['intersection'](_0x133418[_0x0c6c('0x2b')],qs[_0x0c6c('0x30')](_0x692cc4[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x595c75['attributes']=_0x595c75[_0x0c6c('0x2f')]['length']?_0x595c75[_0x0c6c('0x2f')]:_0x133418['model'];_0x595c75[_0x0c6c('0x7e')]=qs[_0x0c6c('0x44')](_0x692cc4['query'][_0x0c6c('0x44')]);_0x595c75[_0x0c6c('0x46')]=qs[_0x0c6c('0x2d')](_[_0x0c6c('0x45')](_0x692cc4[_0x0c6c('0x25')],_0x133418['filters']));if(_0x692cc4['query']['filter']){_0x595c75['where']=_[_0x0c6c('0x32')](_0x595c75[_0x0c6c('0x46')],{'$or':_[_0x0c6c('0x1f')](_0x595c75['attributes'],function(_0x2778a9){var _0x2e47b2={};_0x2e47b2[_0x2778a9]={'$like':'%'+_0x692cc4[_0x0c6c('0x25')]['filter']+'%'};return _0x2e47b2;})});}_0x595c75=_[_0x0c6c('0x32')]({},_0x595c75,_0x692cc4['options']);return _0x4756f0[_0x0c6c('0x7f')](_0x595c75);}})[_0x0c6c('0x17')](function(_0x492e2c){if(_0x492e2c){_0x2a4fce=_0x492e2c['length'];if(!_0x692cc4[_0x0c6c('0x25')][_0x0c6c('0x42')](_0x0c6c('0x43'))){_0x595c75[_0x0c6c('0x13')]=qs['limit'](_0x692cc4[_0x0c6c('0x25')][_0x0c6c('0x13')]);_0x595c75[_0x0c6c('0x12')]=qs[_0x0c6c('0x12')](_0x692cc4[_0x0c6c('0x25')]['offset']);}return _0x4756f0[_0x0c6c('0x7f')](_0x595c75);}})['then'](function(_0x59f1de){if(_0x59f1de){return _0x59f1de?{'count':_0x2a4fce,'rows':_0x59f1de}:null;}})['then'](respondWithResult(_0x1e325f,null))['catch'](handleError(_0x1e325f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 1c16a05..9d61559 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 _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 +var _0x591f=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x591f,0x167));var _0xf591=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x591f[_0x49d19d];return _0x4ebef1;};'use strict';var EventEmitter=require(_0xf591('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf591('0x1')](0x0);var events={'afterCreate':_0xf591('0x2'),'afterUpdate':'update','afterDestroy':_0xf591('0x3')};function emitEvent(_0x1da401){return function(_0x2ec790,_0xe5d14a,_0x43e7af){FaxQueueEvents[_0xf591('0x4')](_0x1da401+':'+_0x2ec790['id'],_0x2ec790);FaxQueueEvents[_0xf591('0x4')](_0x1da401,_0x2ec790);_0x43e7af(null);};}for(var e in events){if(events[_0xf591('0x5')](e)){var event=events[e];FaxQueue[_0xf591('0x6')](e,emitEvent(event));}}module[_0xf591('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0830863..b821106 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 _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 +var _0xa2f4=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x4b02d0,_0x5b1795){var _0x2ec3cc=function(_0xad8930){while(--_0xad8930){_0x4b02d0['push'](_0x4b02d0['shift']());}};_0x2ec3cc(++_0x5b1795);}(_0xa2f4,0x15d));var _0x4a2f=function(_0xb49cb8,_0x39474b){_0xb49cb8=_0xb49cb8-0x0;var _0x879ead=_0xa2f4[_0xb49cb8];return _0x879ead;};'use strict';var _=require(_0x4a2f('0x0'));var util=require(_0x4a2f('0x1'));var logger=require(_0x4a2f('0x2'))(_0x4a2f('0x3'));var moment=require(_0x4a2f('0x4'));var BPromise=require(_0x4a2f('0x5'));var rp=require(_0x4a2f('0x6'));var fs=require('fs');var path=require(_0x4a2f('0x7'));var rimraf=require(_0x4a2f('0x8'));var config=require(_0x4a2f('0x9'));var attributes=require(_0x4a2f('0xa'));module[_0x4a2f('0xb')]=function(_0x580082,_0x2f7d09){return _0x580082[_0x4a2f('0xc')](_0x4a2f('0xd'),attributes,{'tableName':_0x4a2f('0xe'),'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 5920c70..25a8897 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 _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 +var _0xd6d8=['catch','FaxQueue','findAll','options','raw','attributes','limit','map','include','model','then','GetFaxQueue','stringify','ShowFaxQueue','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','request','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxQueue,\x20%s,\x20%s','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6d8,0x1f0));var _0x8d6d=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0xd6d8[_0x1ee5be];return _0x177140;};'use strict';var _=require(_0x8d6d('0x0'));var util=require('util');var moment=require(_0x8d6d('0x1'));var BPromise=require(_0x8d6d('0x2'));var rs=require(_0x8d6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d6d('0x4'))['db'];var utils=require(_0x8d6d('0x5'));var logger=require(_0x8d6d('0x6'))('rpc');var config=require(_0x8d6d('0x7'));var jayson=require(_0x8d6d('0x8'));var client=jayson['client'][_0x8d6d('0x9')]({'port':0x232a});config[_0x8d6d('0xa')]=_['defaults'](config[_0x8d6d('0xa')],{'host':_0x8d6d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1607af,_0x39d67b,_0x1d9ce7){return new BPromise(function(_0x35a0cd,_0x19f174){return client[_0x8d6d('0xc')](_0x1607af,_0x1d9ce7)['then'](function(_0x224bf0){logger[_0x8d6d('0xd')]('FaxQueue,\x20%s,\x20%s',_0x39d67b,'request\x20sent');logger[_0x8d6d('0xe')](_0x8d6d('0xf'),_0x39d67b,_0x8d6d('0x10'),JSON['stringify'](_0x224bf0));if(_0x224bf0['error']){if(_0x224bf0[_0x8d6d('0x11')][_0x8d6d('0x12')]===0x1f4){logger[_0x8d6d('0x11')](_0x8d6d('0x13'),_0x39d67b,_0x224bf0['error'][_0x8d6d('0x14')]);return _0x19f174(_0x224bf0[_0x8d6d('0x11')]['message']);}logger[_0x8d6d('0x11')](_0x8d6d('0x13'),_0x39d67b,_0x224bf0[_0x8d6d('0x11')][_0x8d6d('0x14')]);return _0x35a0cd(_0x224bf0[_0x8d6d('0x11')][_0x8d6d('0x14')]);}else{logger[_0x8d6d('0xd')](_0x8d6d('0x13'),_0x39d67b,'request\x20sent');_0x35a0cd(_0x224bf0[_0x8d6d('0x15')][_0x8d6d('0x14')]);}})[_0x8d6d('0x16')](function(_0x240d89){logger[_0x8d6d('0x11')](_0x8d6d('0x13'),_0x39d67b,_0x240d89);_0x19f174(_0x240d89);});});}exports['GetFaxQueue']=function(_0x26cecd){var _0x595114=this;return new Promise(function(_0x541ebc,_0x282a62){return db[_0x8d6d('0x17')][_0x8d6d('0x18')]({'raw':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')][_0x8d6d('0x1a')]===undefined?!![]:![]:!![],'where':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')]['where']||null:null,'attributes':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd['options'][_0x8d6d('0x1b')]||null:null,'limit':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')][_0x8d6d('0x1c')]||null:null,'include':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')]['include']?_[_0x8d6d('0x1d')](_0x26cecd[_0x8d6d('0x19')][_0x8d6d('0x1e')],function(_0x3e6fbe){return{'model':db[_0x3e6fbe[_0x8d6d('0x1f')]],'as':_0x3e6fbe['as'],'attributes':_0x3e6fbe[_0x8d6d('0x1b')],'include':_0x3e6fbe['include']?_[_0x8d6d('0x1d')](_0x3e6fbe[_0x8d6d('0x1e')],function(_0x24a447){return{'model':db[_0x24a447[_0x8d6d('0x1f')]],'as':_0x24a447['as'],'attributes':_0x24a447[_0x8d6d('0x1b')],'include':_0x24a447['include']?_['map'](_0x24a447[_0x8d6d('0x1e')],function(_0x162492){return{'model':db[_0x162492[_0x8d6d('0x1f')]],'as':_0x162492['as'],'attributes':_0x162492[_0x8d6d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d6d('0x20')](function(_0x35e8dc){logger[_0x8d6d('0xd')](_0x8d6d('0x21'),_0x26cecd);logger[_0x8d6d('0xe')](_0x8d6d('0x21'),_0x26cecd,JSON[_0x8d6d('0x22')](_0x35e8dc));_0x541ebc(_0x35e8dc);})['catch'](function(_0x4cc94f){logger['error'](_0x8d6d('0x21'),_0x4cc94f[_0x8d6d('0x14')],_0x26cecd);_0x282a62(_0x595114[_0x8d6d('0x11')](0x1f4,_0x4cc94f['message']));});});};exports[_0x8d6d('0x23')]=function(_0x2e3248){var _0x46b248=this;return new Promise(function(_0xecff29,_0x3dfe8f){return db[_0x8d6d('0x17')]['find']({'raw':_0x2e3248['options']?_0x2e3248['options'][_0x8d6d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e3248[_0x8d6d('0x19')]?_0x2e3248['options'][_0x8d6d('0x24')]||null:null,'attributes':_0x2e3248['options']?_0x2e3248[_0x8d6d('0x19')][_0x8d6d('0x1b')]||null:null,'include':_0x2e3248[_0x8d6d('0x19')]?_0x2e3248[_0x8d6d('0x19')][_0x8d6d('0x1e')]?_[_0x8d6d('0x1d')](_0x2e3248[_0x8d6d('0x19')][_0x8d6d('0x1e')],function(_0x126240){return{'model':db[_0x126240[_0x8d6d('0x1f')]],'as':_0x126240['as'],'attributes':_0x126240[_0x8d6d('0x1b')],'include':_0x126240['include']?_[_0x8d6d('0x1d')](_0x126240[_0x8d6d('0x1e')],function(_0x120cca){return{'model':db[_0x120cca[_0x8d6d('0x1f')]],'as':_0x120cca['as'],'attributes':_0x120cca[_0x8d6d('0x1b')],'include':_0x120cca['include']?_[_0x8d6d('0x1d')](_0x120cca[_0x8d6d('0x1e')],function(_0x2924c5){return{'model':db[_0x2924c5[_0x8d6d('0x1f')]],'as':_0x2924c5['as'],'attributes':_0x2924c5[_0x8d6d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d6d('0x20')](function(_0x3ebc36){logger[_0x8d6d('0xd')](_0x8d6d('0x23'),_0x2e3248);logger[_0x8d6d('0xe')](_0x8d6d('0x23'),_0x2e3248,JSON['stringify'](_0x3ebc36));_0xecff29(_0x3ebc36);})['catch'](function(_0x4f5502){logger['error'](_0x8d6d('0x23'),_0x4f5502[_0x8d6d('0x14')],_0x2e3248);_0x3dfe8f(_0x46b248[_0x8d6d('0x11')](0x1f4,_0x4f5502[_0x8d6d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 22e645e..697225c 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 _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 +var _0xa1f6=['save','remove','update','register','length','./faxQueue.events'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xa1f6[_0x305c31];return _0x17f39f;};'use strict';var FaxQueueEvents=require(_0x6a1f('0x0'));var events=[_0x6a1f('0x1'),_0x6a1f('0x2'),_0x6a1f('0x3')];function createListener(_0x198e14,_0x123ad4){return function(_0x5cf561){_0x123ad4['emit'](_0x198e14,_0x5cf561);};}function removeListener(_0x521944,_0x5d4ad7){return function(){FaxQueueEvents['removeListener'](_0x521944,_0x5d4ad7);};}exports[_0x6a1f('0x4')]=function(_0x426ae1){for(var _0xa1c928=0x0,_0x3a772b=events[_0x6a1f('0x5')];_0xa1c928<_0x3a772b;_0xa1c928++){var _0x3ecd63=events[_0xa1c928];var _0x36c00b=createListener('faxQueue:'+_0x3ecd63,_0x426ae1);FaxQueueEvents['on'](_0x3ecd63,_0x36c00b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6e98ff2..81356bb 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 _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 +var _0x5d17=['addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x5d17,0x114));var _0x75d1=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0x5d17[_0x38cb7c];return _0x2a5f5e;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x75d1('0xe')]);router[_0x75d1('0x8')]('/:id/teams',auth[_0x75d1('0xb')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x8')](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);router['post']('/',auth[_0x75d1('0xb')](),controller[_0x75d1('0x12')]);router[_0x75d1('0x13')](_0x75d1('0x14'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x15')]);router['put'](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x16')]);router[_0x75d1('0x17')](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x18')]);router[_0x75d1('0x17')](_0x75d1('0x14'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x19')]);router['delete']('/:id/users',auth[_0x75d1('0xb')](),controller[_0x75d1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7500f60..5a0029a 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 _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 +var _0xc677=['sequelize','exports','STRING','DATE','moment'];(function(_0x14a4f7,_0x3782c2){var _0x350768=function(_0x33b25f){while(--_0x33b25f){_0x14a4f7['push'](_0x14a4f7['shift']());}};_0x350768(++_0x3782c2);}(_0xc677,0x18a));var _0x7c67=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc677[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x7c67('0x0'));var Sequelize=require(_0x7c67('0x1'));module[_0x7c67('0x2')]={'uniqueid':{'type':Sequelize[_0x7c67('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7c67('0x3')]},'joinAt':{'type':Sequelize[_0x7c67('0x4')]},'leaveAt':{'type':Sequelize[_0x7c67('0x4')]},'acceptAt':{'type':Sequelize[_0x7c67('0x4')]},'exitAt':{'type':Sequelize[_0x7c67('0x4')]},'reason':{'type':Sequelize[_0x7c67('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 51b7449..e28c152 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 _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 +var _0xb43b=['moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','name','status','send','index','map','FaxQueueReport','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','then','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2f8e01,_0x278674){var _0x5333e9=function(_0x1abd14){while(--_0x1abd14){_0x2f8e01['push'](_0x2f8e01['shift']());}};_0x5333e9(++_0x278674);}(_0xb43b,0x1b2));var _0xbb43=function(_0x373ec1,_0x59037b){_0x373ec1=_0x373ec1-0x0;var _0xec42f5=_0xb43b[_0x373ec1];return _0xec42f5;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={},_0x539730={},_0x2ad6da={'count':0x0,'rows':[]};var _0x56fe33=_[_0xbb43('0x2a')](db[_0xbb43('0x2b')][_0xbb43('0x2c')],function(_0x1880cd){return{'name':_0x1880cd['fieldName'],'type':_0x1880cd[_0xbb43('0x2d')]['key']};});_0x539730['model']=_['map'](_0x56fe33,_0xbb43('0x26'));_0x539730['query']=_[_0xbb43('0x2e')](_0x40b04b[_0xbb43('0x2f')]);_0x539730[_0xbb43('0x30')]=_['intersection'](_0x539730[_0xbb43('0x31')],_0x539730[_0xbb43('0x2f')]);_0x473828[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x539730[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x473828['attributes']=_0x473828[_0xbb43('0x32')][_0xbb43('0x35')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x31')];if(!_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x36')](_0xbb43('0x37'))){_0x473828[_0xbb43('0x1d')]=qs[_0xbb43('0x1d')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1d')]);_0x473828[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1c')]);}_0x473828[_0xbb43('0x38')]=qs['sort'](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x39')]);_0x473828['where']=qs[_0xbb43('0x30')](_[_0xbb43('0x3a')](_0x40b04b[_0xbb43('0x2f')],_0x539730['filters']),_0x56fe33);if(_0x40b04b['query']['filter']){_0x473828[_0xbb43('0x3b')]=_[_0xbb43('0x3c')](_0x473828['where'],{'$or':_['map'](_0x56fe33,function(_0x2aa381){if(_0x2aa381[_0xbb43('0x2d')]!==_0xbb43('0x3d')){var _0x37afbb={};_0x37afbb[_0x2aa381[_0xbb43('0x26')]]={'$like':'%'+_0x40b04b['query'][_0xbb43('0x3e')]+'%'};return _0x37afbb;}})});}_0x473828=_[_0xbb43('0x3c')]({},_0x473828,_0x40b04b[_0xbb43('0x3f')]);var _0x3340aa={'where':_0x473828[_0xbb43('0x3b')]};return db['FaxQueueReport'][_0xbb43('0x1b')](_0x3340aa)['then'](function(_0x1c076f){_0x2ad6da[_0xbb43('0x1b')]=_0x1c076f;if(_0x40b04b['query'][_0xbb43('0x40')]){_0x473828['include']=[{'all':!![]}];}return db[_0xbb43('0x2b')][_0xbb43('0x41')](_0x473828);})[_0xbb43('0x42')](function(_0xb84ece){_0x2ad6da['rows']=_0xb84ece;return _0x2ad6da;})[_0xbb43('0x42')](respondWithFilteredResult(_0x21d386,_0x473828))[_0xbb43('0x43')](handleError(_0x21d386,null));};exports['show']=function(_0x3443f8,_0x5198a2){var _0x42b965={'raw':!![],'where':{'id':_0x3443f8[_0xbb43('0x44')]['id']}},_0x14285d={};_0x14285d[_0xbb43('0x31')]=_[_0xbb43('0x2e')](db[_0xbb43('0x2b')]['rawAttributes']);_0x14285d[_0xbb43('0x2f')]=_['keys'](_0x3443f8[_0xbb43('0x2f')]);_0x14285d[_0xbb43('0x30')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],_0x14285d['query']);_0x42b965[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x3443f8[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x42b965[_0xbb43('0x32')]=_0x42b965[_0xbb43('0x32')]['length']?_0x42b965[_0xbb43('0x32')]:_0x14285d[_0xbb43('0x31')];if(_0x3443f8['query'][_0xbb43('0x40')]){_0x42b965['include']=[{'all':!![]}];}_0x42b965=_['merge']({},_0x42b965,_0x3443f8['options']);return db['FaxQueueReport'][_0xbb43('0x45')](_0x42b965)['then'](handleEntityNotFound(_0x5198a2,null))[_0xbb43('0x42')](respondWithResult(_0x5198a2,null))['catch'](handleError(_0x5198a2,null));};exports[_0xbb43('0x46')]=function(_0x39b6ae,_0x1f3fb4){return db['FaxQueueReport'][_0xbb43('0x46')](_0x39b6ae['body'],{})[_0xbb43('0x42')](respondWithResult(_0x1f3fb4,0xc9))[_0xbb43('0x43')](handleError(_0x1f3fb4,null));};exports[_0xbb43('0x23')]=function(_0x29840e,_0x417ad9){if(_0x29840e[_0xbb43('0x47')]['id']){delete _0x29840e[_0xbb43('0x47')]['id'];}return db['FaxQueueReport'][_0xbb43('0x45')]({'where':{'id':_0x29840e[_0xbb43('0x44')]['id']}})[_0xbb43('0x42')](handleEntityNotFound(_0x417ad9,null))[_0xbb43('0x42')](saveUpdates(_0x29840e['body'],null))[_0xbb43('0x42')](respondWithResult(_0x417ad9,null))[_0xbb43('0x43')](handleError(_0x417ad9,null));};exports[_0xbb43('0x24')]=function(_0xb1883e,_0x4b7712){return db[_0xbb43('0x2b')][_0xbb43('0x45')]({'where':{'id':_0xb1883e[_0xbb43('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b7712,null))[_0xbb43('0x42')](removeEntity(_0x4b7712,null))[_0xbb43('0x43')](handleError(_0x4b7712,null));};exports[_0xbb43('0x48')]=function(_0x1dc40a,_0x3402f2){return db['FaxQueueReport']['describe']()[_0xbb43('0x42')](respondWithResult(_0x3402f2,null))['catch'](handleError(_0x3402f2,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a5c2817..c11dac3 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 _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 +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0xaccfa5,_0x4eec88){var _0x16580c=function(_0x1ab9c8){while(--_0x1ab9c8){_0xaccfa5['push'](_0xaccfa5['shift']());}};_0x16580c(++_0x4eec88);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 3bf759f..85ce950 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 _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 +var _0x4918=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x48b02c,_0x20e1ef){var _0x5d8dae=function(_0x46c476){while(--_0x46c476){_0x48b02c['push'](_0x48b02c['shift']());}};_0x5d8dae(++_0x20e1ef);}(_0x4918,0x1ab));var _0x8491=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x4918[_0x4b0290];return _0x4bd9f4;};'use strict';var _=require(_0x8491('0x0'));var util=require(_0x8491('0x1'));var moment=require(_0x8491('0x2'));var BPromise=require(_0x8491('0x3'));var rs=require(_0x8491('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8491('0x5'))['db'];var utils=require(_0x8491('0x6'));var logger=require(_0x8491('0x7'))(_0x8491('0x8'));var config=require(_0x8491('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8491('0xa')][_0x8491('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e98b0,_0x4941f9,_0x22213f){return new BPromise(function(_0x1d58f3,_0x286e72){return client[_0x8491('0xc')](_0x1e98b0,_0x22213f)[_0x8491('0xd')](function(_0x254e40){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4941f9,_0x8491('0xe'));logger[_0x8491('0xf')](_0x8491('0x10'),_0x4941f9,'request\x20sent',JSON[_0x8491('0x11')](_0x254e40));if(_0x254e40[_0x8491('0x12')]){if(_0x254e40['error'][_0x8491('0x13')]===0x1f4){logger[_0x8491('0x12')](_0x8491('0x14'),_0x4941f9,_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);return _0x286e72(_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);}logger['error'](_0x8491('0x14'),_0x4941f9,_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);return _0x1d58f3(_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);}else{logger[_0x8491('0x16')]('FaxQueueReport,\x20%s,\x20%s',_0x4941f9,_0x8491('0xe'));_0x1d58f3(_0x254e40['result'][_0x8491('0x15')]);}})[_0x8491('0x17')](function(_0x44b987){logger[_0x8491('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x4941f9,_0x44b987);_0x286e72(_0x44b987);});});}exports[_0x8491('0x18')]=function(_0x2d531a){var _0x1a3ffe=this;return new Promise(function(_0x1e0343,_0x13064e){return db[_0x8491('0x19')][_0x8491('0x1a')](_0x2d531a['body'],{'raw':_0x2d531a[_0x8491('0x1b')]?_0x2d531a[_0x8491('0x1b')][_0x8491('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5bfcd2){logger[_0x8491('0x16')](_0x8491('0x18'),_0x2d531a);logger[_0x8491('0xf')](_0x8491('0x18'),_0x2d531a,JSON[_0x8491('0x11')](_0x5bfcd2));_0x1e0343(_0x5bfcd2);})['catch'](function(_0x289fe3){logger[_0x8491('0x12')]('CreateFaxQueueReport',_0x289fe3['message'],_0x2d531a);_0x13064e(_0x1a3ffe['error'](0x1f4,_0x289fe3['message']));});});};exports[_0x8491('0x1d')]=function(_0x49fcf7){var _0x3e4412=this;return new Promise(function(_0x4e1f33,_0x1fd465){return db[_0x8491('0x19')][_0x8491('0x1e')](_0x49fcf7[_0x8491('0x1f')],{'raw':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')]['where']||null:null,'attributes':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')][_0x8491('0x20')]||null:null,'limit':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')][_0x8491('0x21')]||null:null})['then'](function(_0x3611a7){logger['info']('UpdateFaxQueueReport',_0x49fcf7);logger[_0x8491('0xf')](_0x8491('0x1d'),_0x49fcf7,JSON[_0x8491('0x11')](_0x3611a7));_0x4e1f33(_0x3611a7);})[_0x8491('0x17')](function(_0x459f7e){logger[_0x8491('0x12')](_0x8491('0x1d'),_0x459f7e['message'],_0x49fcf7);_0x1fd465(_0x3e4412['error'](0x1f4,_0x459f7e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4d4b793..8079c16 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 _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 +var _0xd667=['get','/describe','describe','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','index'];(function(_0x556f5e,_0x3ade74){var _0x5b6ce2=function(_0x59c35f){while(--_0x59c35f){_0x556f5e['push'](_0x556f5e['shift']());}};_0x5b6ce2(++_0x3ade74);}(_0xd667,0xc8));var _0x7d66=function(_0x3385e7,_0x3d67a9){_0x3385e7=_0x3385e7-0x0;var _0x3d4490=_0xd667[_0x3385e7];return _0x3d4490;};'use strict';var multer=require(_0x7d66('0x0'));var util=require(_0x7d66('0x1'));var path=require('path');var timeout=require(_0x7d66('0x2'));var express=require(_0x7d66('0x3'));var router=express[_0x7d66('0x4')]();var fs_extra=require(_0x7d66('0x5'));var auth=require(_0x7d66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7d66('0x7'));var controller=require(_0x7d66('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d66('0x9')]);router[_0x7d66('0xa')](_0x7d66('0xb'),auth['isAuthenticated'](),controller[_0x7d66('0xc')]);router[_0x7d66('0xa')](_0x7d66('0xd'),auth[_0x7d66('0xe')](),controller['show']);router[_0x7d66('0xf')]('/',auth[_0x7d66('0xe')](),controller['create']);router[_0x7d66('0x10')](_0x7d66('0xd'),auth['isAuthenticated'](),controller[_0x7d66('0x11')]);router[_0x7d66('0x12')]('/:id',auth[_0x7d66('0xe')](),controller[_0x7d66('0x13')]);module[_0x7d66('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 21129cf..ebe762c 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 _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 +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x289937,_0x540a1a){var _0x51a4fc=function(_0x2003bd){while(--_0x2003bd){_0x289937['push'](_0x289937['shift']());}};_0x51a4fc(++_0x540a1a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b578f45..6e03c40 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 _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 +var _0x3ca9=['params','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','update','destroy','then','end','name','index','map','FaxTransferReport','fieldName','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','keys','find','create','body'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x3ca9,0x10a));var _0x93ca=function(_0x2c328f,_0x360eb9){_0x2c328f=_0x2c328f-0x0;var _0x4db412=_0x3ca9[_0x2c328f];return _0x4db412;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93ca('0x0'));var jsonpatch=require(_0x93ca('0x1'));var rp=require('request-promise');var moment=require(_0x93ca('0x2'));var BPromise=require(_0x93ca('0x3'));var Mustache=require(_0x93ca('0x4'));var util=require(_0x93ca('0x5'));var path=require('path');var sox=require(_0x93ca('0x6'));var csv=require(_0x93ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93ca('0x8'));var _=require(_0x93ca('0x9'));var squel=require('squel');var crypto=require(_0x93ca('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x93ca('0xb'));var toCsv=require(_0x93ca('0x7'));var querystring=require(_0x93ca('0xc'));var Papa=require(_0x93ca('0xd'));var Redis=require('ioredis');var authService=require(_0x93ca('0xe'));var qs=require(_0x93ca('0xf'));var as=require(_0x93ca('0x10'));var hardwareService=require(_0x93ca('0x11'));var logger=require(_0x93ca('0x12'))('api');var utils=require(_0x93ca('0x13'));var config=require(_0x93ca('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x93ca('0x15'))['db'];function respondWithStatusCode(_0x4aba6c,_0xbba138){_0xbba138=_0xbba138||0xcc;return function(_0x4304b9){if(_0x4304b9){return _0x4aba6c[_0x93ca('0x16')](_0xbba138);}return _0x4aba6c[_0x93ca('0x17')](_0xbba138)['end']();};}function respondWithResult(_0x279216,_0x5cb66b){_0x5cb66b=_0x5cb66b||0xc8;return function(_0x2c5a00){if(_0x2c5a00){return _0x279216[_0x93ca('0x17')](_0x5cb66b)[_0x93ca('0x18')](_0x2c5a00);}};}function respondWithFilteredResult(_0x165aa9,_0x299efc){return function(_0x4ae9d4){if(_0x4ae9d4){var _0x3f5919=typeof _0x299efc[_0x93ca('0x19')]===_0x93ca('0x1a')&&typeof _0x299efc['limit']===_0x93ca('0x1a');var _0x3e4974=_0x4ae9d4[_0x93ca('0x1b')];var _0x4f7148=_0x3f5919?0x0:_0x299efc['offset'];var _0x3bc7fb=_0x3f5919?_0x4ae9d4[_0x93ca('0x1b')]:_0x299efc['offset']+_0x299efc[_0x93ca('0x1c')];var _0x5b539d;if(_0x3bc7fb>=_0x3e4974){_0x3bc7fb=_0x3e4974;_0x5b539d=0xc8;}else{_0x5b539d=0xce;}_0x165aa9[_0x93ca('0x17')](_0x5b539d);return _0x165aa9['set'](_0x93ca('0x1d'),_0x4f7148+'-'+_0x3bc7fb+'/'+_0x3e4974)[_0x93ca('0x18')](_0x4ae9d4);}return null;};}function patchUpdates(_0xc1fcf3){return function(_0x17a6b4){try{jsonpatch['apply'](_0x17a6b4,_0xc1fcf3,!![]);}catch(_0x419614){return BPromise[_0x93ca('0x1e')](_0x419614);}return _0x17a6b4['save']();};}function saveUpdates(_0x239ff2,_0x5b3bbb){return function(_0x34a607){if(_0x34a607){return _0x34a607[_0x93ca('0x1f')](_0x239ff2)['then'](function(_0x37a6c7){return _0x37a6c7;});}return null;};}function removeEntity(_0x59cd21,_0x3bfb3c){return function(_0x3db574){if(_0x3db574){return _0x3db574[_0x93ca('0x20')]()[_0x93ca('0x21')](function(){_0x59cd21[_0x93ca('0x17')](0xcc)[_0x93ca('0x22')]();});}};}function handleEntityNotFound(_0x173d43,_0x4d981f){return function(_0x1726da){if(!_0x1726da){_0x173d43[_0x93ca('0x16')](0x194);}return _0x1726da;};}function handleError(_0x136c68,_0x59a6e5){_0x59a6e5=_0x59a6e5||0x1f4;return function(_0x5b42f0){logger['error'](_0x5b42f0['stack']);if(_0x5b42f0[_0x93ca('0x23')]){delete _0x5b42f0['name'];}_0x136c68[_0x93ca('0x17')](_0x59a6e5)['send'](_0x5b42f0);};}exports[_0x93ca('0x24')]=function(_0x2bb786,_0x35146e){var _0x92692e={},_0x9cc1bf={},_0x474bc0={'count':0x0,'rows':[]};var _0x50047c=_[_0x93ca('0x25')](db[_0x93ca('0x26')]['rawAttributes'],function(_0x2f45b6){return{'name':_0x2f45b6[_0x93ca('0x27')],'type':_0x2f45b6[_0x93ca('0x28')][_0x93ca('0x29')]};});_0x9cc1bf[_0x93ca('0x2a')]=_[_0x93ca('0x25')](_0x50047c,_0x93ca('0x23'));_0x9cc1bf['query']=_['keys'](_0x2bb786['query']);_0x9cc1bf[_0x93ca('0x2b')]=_['intersection'](_0x9cc1bf[_0x93ca('0x2a')],_0x9cc1bf[_0x93ca('0x2c')]);_0x92692e[_0x93ca('0x2d')]=_[_0x93ca('0x2e')](_0x9cc1bf[_0x93ca('0x2a')],qs['fields'](_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x2f')]));_0x92692e['attributes']=_0x92692e[_0x93ca('0x2d')][_0x93ca('0x30')]?_0x92692e['attributes']:_0x9cc1bf[_0x93ca('0x2a')];if(!_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x31')]('nolimit')){_0x92692e[_0x93ca('0x1c')]=qs[_0x93ca('0x1c')](_0x2bb786['query']['limit']);_0x92692e[_0x93ca('0x19')]=qs[_0x93ca('0x19')](_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x19')]);}_0x92692e[_0x93ca('0x32')]=qs[_0x93ca('0x33')](_0x2bb786['query'][_0x93ca('0x33')]);_0x92692e[_0x93ca('0x34')]=qs['filters'](_['pick'](_0x2bb786[_0x93ca('0x2c')],_0x9cc1bf[_0x93ca('0x2b')]),_0x50047c);if(_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x35')]){_0x92692e[_0x93ca('0x34')]=_[_0x93ca('0x36')](_0x92692e[_0x93ca('0x34')],{'$or':_[_0x93ca('0x25')](_0x50047c,function(_0x3d46b7){if(_0x3d46b7[_0x93ca('0x28')]!=='VIRTUAL'){var _0x31dc3e={};_0x31dc3e[_0x3d46b7['name']]={'$like':'%'+_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x35')]+'%'};return _0x31dc3e;}})});}_0x92692e=_['merge']({},_0x92692e,_0x2bb786['options']);var _0x3e7104={'where':_0x92692e[_0x93ca('0x34')]};return db[_0x93ca('0x26')][_0x93ca('0x1b')](_0x3e7104)[_0x93ca('0x21')](function(_0x4e087f){_0x474bc0[_0x93ca('0x1b')]=_0x4e087f;if(_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x37')]){_0x92692e[_0x93ca('0x38')]=[{'all':!![]}];}return db[_0x93ca('0x26')][_0x93ca('0x39')](_0x92692e);})[_0x93ca('0x21')](function(_0x1573e7){_0x474bc0[_0x93ca('0x3a')]=_0x1573e7;return _0x474bc0;})[_0x93ca('0x21')](respondWithFilteredResult(_0x35146e,_0x92692e))[_0x93ca('0x3b')](handleError(_0x35146e,null));};exports['show']=function(_0x449aa0,_0x4ebcc2){var _0x4fdc72={'raw':!![],'where':{'id':_0x449aa0['params']['id']}},_0xecba92={};_0xecba92['model']=_[_0x93ca('0x3c')](db['FaxTransferReport']['rawAttributes']);_0xecba92['query']=_['keys'](_0x449aa0[_0x93ca('0x2c')]);_0xecba92[_0x93ca('0x2b')]=_[_0x93ca('0x2e')](_0xecba92[_0x93ca('0x2a')],_0xecba92[_0x93ca('0x2c')]);_0x4fdc72[_0x93ca('0x2d')]=_['intersection'](_0xecba92[_0x93ca('0x2a')],qs[_0x93ca('0x2f')](_0x449aa0[_0x93ca('0x2c')]['fields']));_0x4fdc72[_0x93ca('0x2d')]=_0x4fdc72[_0x93ca('0x2d')][_0x93ca('0x30')]?_0x4fdc72[_0x93ca('0x2d')]:_0xecba92['model'];if(_0x449aa0['query'][_0x93ca('0x37')]){_0x4fdc72[_0x93ca('0x38')]=[{'all':!![]}];}_0x4fdc72=_[_0x93ca('0x36')]({},_0x4fdc72,_0x449aa0['options']);return db[_0x93ca('0x26')][_0x93ca('0x3d')](_0x4fdc72)[_0x93ca('0x21')](handleEntityNotFound(_0x4ebcc2,null))[_0x93ca('0x21')](respondWithResult(_0x4ebcc2,null))[_0x93ca('0x3b')](handleError(_0x4ebcc2,null));};exports[_0x93ca('0x3e')]=function(_0x176ab0,_0x138cd1){return db['FaxTransferReport'][_0x93ca('0x3e')](_0x176ab0[_0x93ca('0x3f')],{})['then'](respondWithResult(_0x138cd1,0xc9))['catch'](handleError(_0x138cd1,null));};exports[_0x93ca('0x1f')]=function(_0x7ec27b,_0x54c3be){if(_0x7ec27b[_0x93ca('0x3f')]['id']){delete _0x7ec27b[_0x93ca('0x3f')]['id'];}return db[_0x93ca('0x26')]['find']({'where':{'id':_0x7ec27b[_0x93ca('0x40')]['id']}})[_0x93ca('0x21')](handleEntityNotFound(_0x54c3be,null))['then'](saveUpdates(_0x7ec27b[_0x93ca('0x3f')],null))[_0x93ca('0x21')](respondWithResult(_0x54c3be,null))[_0x93ca('0x3b')](handleError(_0x54c3be,null));};exports['destroy']=function(_0x23331f,_0x1f9ec5){return db[_0x93ca('0x26')][_0x93ca('0x3d')]({'where':{'id':_0x23331f['params']['id']}})[_0x93ca('0x21')](handleEntityNotFound(_0x1f9ec5,null))[_0x93ca('0x21')](removeEntity(_0x1f9ec5,null))[_0x93ca('0x3b')](handleError(_0x1f9ec5,null));};exports[_0x93ca('0x41')]=function(_0x4f153c,_0x512ec0){return db[_0x93ca('0x26')][_0x93ca('0x41')]()[_0x93ca('0x21')](respondWithResult(_0x512ec0,null))['catch'](handleError(_0x512ec0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index cc5ff81..711ecc6 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 _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 +var _0xfd46=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','report_fax_transfer','uniqueid'];(function(_0x278603,_0xc8cc1b){var _0x3a375f=function(_0x40b59c){while(--_0x40b59c){_0x278603['push'](_0x278603['shift']());}};_0x3a375f(++_0xc8cc1b);}(_0xfd46,0x176));var _0x6fd4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xfd46[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x6fd4('0x0'));var util=require('util');var logger=require(_0x6fd4('0x1'))(_0x6fd4('0x2'));var moment=require(_0x6fd4('0x3'));var BPromise=require(_0x6fd4('0x4'));var rp=require(_0x6fd4('0x5'));var fs=require('fs');var path=require(_0x6fd4('0x6'));var rimraf=require(_0x6fd4('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x127aaa,_0x21c88d){return _0x127aaa[_0x6fd4('0x8')]('FaxTransferReport',attributes,{'tableName':_0x6fd4('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6fd4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ea1924b..b3b916e 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 _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 +var _0x4116=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','FaxTransferReport,\x20%s,\x20%s','message'];(function(_0x1911a1,_0x107c16){var _0x33926f=function(_0x3d2ff5){while(--_0x3d2ff5){_0x1911a1['push'](_0x1911a1['shift']());}};_0x33926f(++_0x107c16);}(_0x4116,0x95));var _0x6411=function(_0x4a5f95,_0x1553d3){_0x4a5f95=_0x4a5f95-0x0;var _0x4dcfa5=_0x4116[_0x4a5f95];return _0x4dcfa5;};'use strict';var _=require(_0x6411('0x0'));var util=require(_0x6411('0x1'));var moment=require('moment');var BPromise=require(_0x6411('0x2'));var rs=require(_0x6411('0x3'));var fs=require('fs');var Redis=require(_0x6411('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6411('0x5'));var logger=require(_0x6411('0x6'))(_0x6411('0x7'));var config=require(_0x6411('0x8'));var jayson=require(_0x6411('0x9'));var client=jayson['client'][_0x6411('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f43bc,_0x56c88e,_0x315211){return new BPromise(function(_0x3143ce,_0x59c456){return client['request'](_0x4f43bc,_0x315211)[_0x6411('0xb')](function(_0x2c69ba){logger[_0x6411('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x56c88e,_0x6411('0xd'));logger[_0x6411('0xe')](_0x6411('0xf'),_0x56c88e,'request\x20sent',JSON['stringify'](_0x2c69ba));if(_0x2c69ba[_0x6411('0x10')]){if(_0x2c69ba[_0x6411('0x10')]['code']===0x1f4){logger[_0x6411('0x10')](_0x6411('0x11'),_0x56c88e,_0x2c69ba['error'][_0x6411('0x12')]);return _0x59c456(_0x2c69ba[_0x6411('0x10')][_0x6411('0x12')]);}logger[_0x6411('0x10')](_0x6411('0x11'),_0x56c88e,_0x2c69ba['error']['message']);return _0x3143ce(_0x2c69ba['error'][_0x6411('0x12')]);}else{logger[_0x6411('0xc')](_0x6411('0x11'),_0x56c88e,_0x6411('0xd'));_0x3143ce(_0x2c69ba[_0x6411('0x13')][_0x6411('0x12')]);}})[_0x6411('0x14')](function(_0x26399f){logger[_0x6411('0x10')](_0x6411('0x11'),_0x56c88e,_0x26399f);_0x59c456(_0x26399f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 5a3713d..f79765c 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 _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 +var _0x64ec=['../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x532972,_0x23f2da){var _0x308435=function(_0x4d0ebc){while(--_0x4d0ebc){_0x532972['push'](_0x532972['shift']());}};_0x308435(++_0x23f2da);}(_0x64ec,0x72));var _0xc64e=function(_0xb4cb9,_0x3095f4){_0xb4cb9=_0xb4cb9-0x0;var _0x5afb94=_0x64ec[_0xb4cb9];return _0x5afb94;};'use strict';var multer=require(_0xc64e('0x0'));var util=require(_0xc64e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc64e('0x2'));var router=express[_0xc64e('0x3')]();var fs_extra=require(_0xc64e('0x4'));var auth=require(_0xc64e('0x5'));var interaction=require(_0xc64e('0x6'));var config=require('../../config/environment');var controller=require(_0xc64e('0x7'));router[_0xc64e('0x8')]('/',auth[_0xc64e('0x9')](),controller[_0xc64e('0xa')]);router[_0xc64e('0x8')](_0xc64e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xc64e('0x8')](_0xc64e('0xc'),auth[_0xc64e('0x9')](),controller[_0xc64e('0xd')]);router[_0xc64e('0xe')]('/',auth[_0xc64e('0x9')](),controller[_0xc64e('0xf')]);router[_0xc64e('0x10')](_0xc64e('0xc'),auth[_0xc64e('0x9')](),controller[_0xc64e('0x11')]);router[_0xc64e('0x12')]('/:id',auth[_0xc64e('0x9')](),controller['destroy']);module[_0xc64e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 20eb346..8a864d3 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 _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 +var _0x1f9b=['./intDeskAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa4f456,_0x22afbd){var _0x3797d7=function(_0x1a8bb1){while(--_0x1a8bb1){_0xa4f456['push'](_0xa4f456['shift']());}};_0x3797d7(++_0x22afbd);}(_0x1f9b,0xd4));var _0xb1f9=function(_0x3e6497,_0x26c5ab){_0x3e6497=_0x3e6497-0x0;var _0x2ae688=_0x1f9b[_0x3e6497];return _0x2ae688;};'use strict';var multer=require(_0xb1f9('0x0'));var util=require(_0xb1f9('0x1'));var path=require(_0xb1f9('0x2'));var timeout=require(_0xb1f9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb1f9('0x4'));var auth=require(_0xb1f9('0x5'));var interaction=require(_0xb1f9('0x6'));var config=require(_0xb1f9('0x7'));var controller=require(_0xb1f9('0x8'));router['get']('/',auth[_0xb1f9('0x9')](),controller[_0xb1f9('0xa')]);router['get']('/:id',auth[_0xb1f9('0x9')](),controller['show']);router[_0xb1f9('0xb')](_0xb1f9('0xc'),auth['isAuthenticated'](),controller[_0xb1f9('0xd')]);router[_0xb1f9('0xb')](_0xb1f9('0xe'),auth[_0xb1f9('0x9')](),controller[_0xb1f9('0xf')]);router[_0xb1f9('0x10')]('/',auth[_0xb1f9('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0xb1f9('0x9')](),controller[_0xb1f9('0x11')]);router['put'](_0xb1f9('0x12'),auth[_0xb1f9('0x9')](),controller[_0xb1f9('0x13')]);router[_0xb1f9('0x14')]('/:id',auth[_0xb1f9('0x9')](),controller['destroy']);module[_0xb1f9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 47ba66b..6b51750 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 _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 +var _0x7f9f=['basic','integrationTab','newTab','exports','STRING','ENUM'];(function(_0x3f2223,_0x1ca79a){var _0x1bcc92=function(_0x78134){while(--_0x78134){_0x3f2223['push'](_0x3f2223['shift']());}};_0x1bcc92(++_0x1ca79a);}(_0x7f9f,0x1d1));var _0xf7f9=function(_0x12270c,_0x55ed05){_0x12270c=_0x12270c-0x0;var _0xf37079=_0x7f9f[_0x12270c];return _0xf37079;};'use strict';var Sequelize=require('sequelize');module[_0xf7f9('0x0')]={'name':{'type':Sequelize[_0xf7f9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf7f9('0x1')]},'remoteUri':{'type':Sequelize[_0xf7f9('0x1')]},'authType':{'type':Sequelize[_0xf7f9('0x2')](_0xf7f9('0x3')),'defaultValue':_0xf7f9('0x3')},'password':{'type':Sequelize[_0xf7f9('0x1')]},'consumerKey':{'type':Sequelize[_0xf7f9('0x1')]},'consumerSecret':{'type':Sequelize[_0xf7f9('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xf7f9('0x1')]},'serverUrl':{'type':Sequelize[_0xf7f9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf7f9('0x2')](_0xf7f9('0x4'),_0xf7f9('0x5')),'defaultValue':_0xf7f9('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4d788f3..a6ae9d1 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 _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 +var _0xc02f=['sort','where','filters','filter','type','VIRTUAL','merge','options','count','include','DeskAccount','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','DeskConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','base64','concat','_embedded','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xc02f,0x120));var _0xfc02=function(_0x54614e,_0x23ee3d){_0x54614e=_0x54614e-0x0;var _0x13ba26=_0xc02f[_0x54614e];return _0x13ba26;};'use strict';var emlformat=require(_0xfc02('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc02('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc02('0x2'));var Mustache=require(_0xfc02('0x3'));var util=require(_0xfc02('0x4'));var path=require(_0xfc02('0x5'));var sox=require(_0xfc02('0x6'));var csv=require(_0xfc02('0x7'));var ejs=require(_0xfc02('0x8'));var fs=require('fs');var fs_extra=require(_0xfc02('0x9'));var _=require('lodash');var squel=require(_0xfc02('0xa'));var crypto=require(_0xfc02('0xb'));var jsforce=require(_0xfc02('0xc'));var deskjs=require(_0xfc02('0xd'));var toCsv=require(_0xfc02('0x7'));var querystring=require(_0xfc02('0xe'));var Papa=require(_0xfc02('0xf'));var Redis=require(_0xfc02('0x10'));var authService=require(_0xfc02('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfc02('0x12'));var config=require(_0xfc02('0x13'));var licenseUtil=require(_0xfc02('0x14'));var db=require(_0xfc02('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x175eb7,_0xbca460){_0xbca460=_0xbca460||0xcc;return function(_0x20cd0e){if(_0x20cd0e){return _0x175eb7[_0xfc02('0x16')](_0xbca460);}return _0x175eb7['status'](_0xbca460)[_0xfc02('0x17')]();};}function respondWithResult(_0x401efe,_0x5b9653){_0x5b9653=_0x5b9653||0xc8;return function(_0x57f28d){if(_0x57f28d){return _0x401efe[_0xfc02('0x18')](_0x5b9653)[_0xfc02('0x19')](_0x57f28d);}};}function respondWithFilteredResult(_0x5be8ac,_0x3d095c){return function(_0x239aba){if(_0x239aba){var _0x2d24b2=typeof _0x3d095c[_0xfc02('0x1a')]===_0xfc02('0x1b')&&typeof _0x3d095c[_0xfc02('0x1c')]==='undefined';var _0x2da775=_0x239aba['count'];var _0xcc1d90=_0x2d24b2?0x0:_0x3d095c[_0xfc02('0x1a')];var _0x51c9fe=_0x2d24b2?_0x239aba['count']:_0x3d095c['offset']+_0x3d095c[_0xfc02('0x1c')];var _0x5ba172;if(_0x51c9fe>=_0x2da775){_0x51c9fe=_0x2da775;_0x5ba172=0xc8;}else{_0x5ba172=0xce;}_0x5be8ac[_0xfc02('0x18')](_0x5ba172);return _0x5be8ac['set'](_0xfc02('0x1d'),_0xcc1d90+'-'+_0x51c9fe+'/'+_0x2da775)[_0xfc02('0x19')](_0x239aba);}return null;};}function patchUpdates(_0x2bcb27){return function(_0x27a390){try{jsonpatch[_0xfc02('0x1e')](_0x27a390,_0x2bcb27,!![]);}catch(_0xeebdba){return BPromise[_0xfc02('0x1f')](_0xeebdba);}return _0x27a390[_0xfc02('0x20')]();};}function saveUpdates(_0x5c8b6a,_0x19a762){return function(_0x1ff477){if(_0x1ff477){return _0x1ff477[_0xfc02('0x21')](_0x5c8b6a)[_0xfc02('0x22')](function(_0x22f55e){return _0x22f55e;});}return null;};}function removeEntity(_0x3e14ba,_0x586a6d){return function(_0x54d0dd){if(_0x54d0dd){return _0x54d0dd[_0xfc02('0x23')]()[_0xfc02('0x22')](function(){_0x3e14ba[_0xfc02('0x18')](0xcc)[_0xfc02('0x17')]();});}};}function handleEntityNotFound(_0x5599c7,_0x566679){return function(_0x1ba8cb){if(!_0x1ba8cb){_0x5599c7[_0xfc02('0x16')](0x194);}return _0x1ba8cb;};}function handleError(_0x20851e,_0x5f5a95){_0x5f5a95=_0x5f5a95||0x1f4;return function(_0x368d6c){logger[_0xfc02('0x24')](_0x368d6c[_0xfc02('0x25')]);if(_0x368d6c[_0xfc02('0x26')]){delete _0x368d6c[_0xfc02('0x26')];}_0x20851e[_0xfc02('0x18')](_0x5f5a95)[_0xfc02('0x27')](_0x368d6c);};}exports['index']=function(_0x5f2dda,_0x587440){var _0x10ada2={},_0x4d627a={},_0x4ff374={'count':0x0,'rows':[]};var _0x2f9fc1=_[_0xfc02('0x28')](db['DeskAccount'][_0xfc02('0x29')],function(_0x9f1719){return{'name':_0x9f1719[_0xfc02('0x2a')],'type':_0x9f1719['type'][_0xfc02('0x2b')]};});_0x4d627a[_0xfc02('0x2c')]=_['map'](_0x2f9fc1,_0xfc02('0x26'));_0x4d627a[_0xfc02('0x2d')]=_[_0xfc02('0x2e')](_0x5f2dda[_0xfc02('0x2d')]);_0x4d627a['filters']=_[_0xfc02('0x2f')](_0x4d627a[_0xfc02('0x2c')],_0x4d627a[_0xfc02('0x2d')]);_0x10ada2['attributes']=_[_0xfc02('0x2f')](_0x4d627a[_0xfc02('0x2c')],qs['fields'](_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x30')]));_0x10ada2[_0xfc02('0x31')]=_0x10ada2[_0xfc02('0x31')][_0xfc02('0x32')]?_0x10ada2['attributes']:_0x4d627a[_0xfc02('0x2c')];if(!_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x33')](_0xfc02('0x34'))){_0x10ada2[_0xfc02('0x1c')]=qs[_0xfc02('0x1c')](_0x5f2dda['query']['limit']);_0x10ada2[_0xfc02('0x1a')]=qs[_0xfc02('0x1a')](_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x1a')]);}_0x10ada2[_0xfc02('0x35')]=qs[_0xfc02('0x36')](_0x5f2dda['query']['sort']);_0x10ada2[_0xfc02('0x37')]=qs[_0xfc02('0x38')](_['pick'](_0x5f2dda[_0xfc02('0x2d')],_0x4d627a['filters']),_0x2f9fc1);if(_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x39')]){_0x10ada2[_0xfc02('0x37')]=_['merge'](_0x10ada2[_0xfc02('0x37')],{'$or':_[_0xfc02('0x28')](_0x2f9fc1,function(_0x208bf9){if(_0x208bf9[_0xfc02('0x3a')]!==_0xfc02('0x3b')){var _0x524bfd={};_0x524bfd[_0x208bf9[_0xfc02('0x26')]]={'$like':'%'+_0x5f2dda['query'][_0xfc02('0x39')]+'%'};return _0x524bfd;}})});}_0x10ada2=_[_0xfc02('0x3c')]({},_0x10ada2,_0x5f2dda[_0xfc02('0x3d')]);var _0x4d63ac={'where':_0x10ada2[_0xfc02('0x37')]};return db['DeskAccount'][_0xfc02('0x3e')](_0x4d63ac)[_0xfc02('0x22')](function(_0x2a754c){_0x4ff374[_0xfc02('0x3e')]=_0x2a754c;if(_0x5f2dda['query']['includeAll']){_0x10ada2[_0xfc02('0x3f')]=[{'all':!![]}];}return db[_0xfc02('0x40')][_0xfc02('0x41')](_0x10ada2);})[_0xfc02('0x22')](function(_0x4d64c9){_0x4ff374[_0xfc02('0x42')]=_0x4d64c9;return _0x4ff374;})[_0xfc02('0x22')](respondWithFilteredResult(_0x587440,_0x10ada2))[_0xfc02('0x43')](handleError(_0x587440,null));};exports['show']=function(_0x4a90bf,_0x30f943){var _0x61ff3c={'raw':![],'where':{'id':_0x4a90bf[_0xfc02('0x44')]['id']}},_0x392e99={};_0x392e99[_0xfc02('0x2c')]=_[_0xfc02('0x2e')](db[_0xfc02('0x40')][_0xfc02('0x29')]);_0x392e99[_0xfc02('0x2d')]=_[_0xfc02('0x2e')](_0x4a90bf[_0xfc02('0x2d')]);_0x392e99[_0xfc02('0x38')]=_[_0xfc02('0x2f')](_0x392e99['model'],_0x392e99[_0xfc02('0x2d')]);_0x61ff3c[_0xfc02('0x31')]=_['intersection'](_0x392e99[_0xfc02('0x2c')],qs[_0xfc02('0x30')](_0x4a90bf[_0xfc02('0x2d')][_0xfc02('0x30')]));_0x61ff3c['attributes']=_0x61ff3c[_0xfc02('0x31')]['length']?_0x61ff3c['attributes']:_0x392e99['model'];if(_0x4a90bf[_0xfc02('0x2d')][_0xfc02('0x45')]){_0x61ff3c[_0xfc02('0x3f')]=[{'all':!![]}];}_0x61ff3c=_[_0xfc02('0x3c')]({},_0x61ff3c,_0x4a90bf['options']);return db['DeskAccount'][_0xfc02('0x46')](_0x61ff3c)[_0xfc02('0x22')](handleEntityNotFound(_0x30f943,null))[_0xfc02('0x22')](respondWithResult(_0x30f943,null))['catch'](handleError(_0x30f943,null));};exports[_0xfc02('0x47')]=function(_0x26df97,_0x126113){return db['DeskAccount'][_0xfc02('0x47')](_0x26df97[_0xfc02('0x48')],{})[_0xfc02('0x22')](respondWithResult(_0x126113,0xc9))[_0xfc02('0x43')](handleError(_0x126113,null));};exports[_0xfc02('0x21')]=function(_0x2a17d6,_0x506fdc){if(_0x2a17d6[_0xfc02('0x48')]['id']){delete _0x2a17d6[_0xfc02('0x48')]['id'];}return db[_0xfc02('0x40')]['find']({'where':{'id':_0x2a17d6[_0xfc02('0x44')]['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x506fdc,null))['then'](saveUpdates(_0x2a17d6[_0xfc02('0x48')],null))[_0xfc02('0x22')](respondWithResult(_0x506fdc,null))[_0xfc02('0x43')](handleError(_0x506fdc,null));};exports['destroy']=function(_0x3c15c4,_0x4783bf){return db['DeskAccount'][_0xfc02('0x46')]({'where':{'id':_0x3c15c4['params']['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x4783bf,null))[_0xfc02('0x22')](removeEntity(_0x4783bf,null))[_0xfc02('0x43')](handleError(_0x4783bf,null));};exports[_0xfc02('0x49')]=function(_0x15aafd,_0x3432ab,_0x57ce35){var _0x4b3258={};var _0x394a10={};var _0x4722d4;var _0x16d3d3;return db[_0xfc02('0x40')]['findOne']({'where':{'id':_0x15aafd[_0xfc02('0x44')]['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x3432ab,null))[_0xfc02('0x22')](function(_0x2f4ee6){if(_0x2f4ee6){_0x4722d4=_0x2f4ee6;_0x394a10[_0xfc02('0x2c')]=_[_0xfc02('0x2e')](db[_0xfc02('0x4a')][_0xfc02('0x29')]);_0x394a10[_0xfc02('0x2d')]=_['keys'](_0x15aafd[_0xfc02('0x2d')]);_0x394a10[_0xfc02('0x38')]=_[_0xfc02('0x2f')](_0x394a10['model'],_0x394a10[_0xfc02('0x2d')]);_0x4b3258['attributes']=_[_0xfc02('0x2f')](_0x394a10[_0xfc02('0x2c')],qs[_0xfc02('0x30')](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x30')]));_0x4b3258[_0xfc02('0x31')]=_0x4b3258['attributes']['length']?_0x4b3258[_0xfc02('0x31')]:_0x394a10['model'];_0x4b3258[_0xfc02('0x35')]=qs[_0xfc02('0x36')](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x36')]);_0x4b3258[_0xfc02('0x37')]=qs[_0xfc02('0x38')](_[_0xfc02('0x4b')](_0x15aafd[_0xfc02('0x2d')],_0x394a10[_0xfc02('0x38')]));if(_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x39')]){_0x4b3258['where']=_[_0xfc02('0x3c')](_0x4b3258[_0xfc02('0x37')],{'$or':_[_0xfc02('0x28')](_0x4b3258['attributes'],function(_0x626816){var _0x597f95={};_0x597f95[_0x626816]={'$like':'%'+_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x39')]+'%'};return _0x597f95;})});}_0x4b3258=_[_0xfc02('0x3c')]({},_0x4b3258,_0x15aafd[_0xfc02('0x3d')]);return _0x4722d4[_0xfc02('0x49')](_0x4b3258);}})[_0xfc02('0x22')](function(_0x227a2b){if(_0x227a2b){_0x16d3d3=_0x227a2b[_0xfc02('0x32')];if(!_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x33')](_0xfc02('0x34'))){_0x4b3258[_0xfc02('0x1c')]=qs[_0xfc02('0x1c')](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x1c')]);_0x4b3258[_0xfc02('0x1a')]=qs['offset'](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x1a')]);}return _0x4722d4[_0xfc02('0x49')](_0x4b3258);}})['then'](function(_0xb1c69f){if(_0xb1c69f){return _0xb1c69f?{'count':_0x16d3d3,'rows':_0xb1c69f}:null;}})[_0xfc02('0x22')](respondWithResult(_0x3432ab,null))['catch'](handleError(_0x3432ab,null));};exports[_0xfc02('0x4c')]=function(_0x475e4e,_0x588fc,_0x2d9f94){if(_0x475e4e[_0xfc02('0x48')]['id']){delete _0x475e4e[_0xfc02('0x48')]['id'];}return db[_0xfc02('0x40')][_0xfc02('0x4d')]({'where':{'id':_0x475e4e['params']['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x588fc,null))[_0xfc02('0x22')](function(_0x20404a){if(_0x20404a){_0x475e4e[_0xfc02('0x48')][_0xfc02('0x4e')]=_0x20404a['id'];_0x475e4e[_0xfc02('0x48')][_0xfc02('0x4f')]=integrations[_0xfc02('0x50')](_0x475e4e[_0xfc02('0x48')][_0xfc02('0x51')],_0x475e4e[_0xfc02('0x48')]['type']);_0x475e4e[_0xfc02('0x48')][_0xfc02('0x52')]=integrations['getDescriptions'](_0x475e4e[_0xfc02('0x48')][_0xfc02('0x51')],_0x475e4e[_0xfc02('0x48')]['type']);return db[_0xfc02('0x4a')]['create'](_0x475e4e['body'],{'include':[{'model':db[_0xfc02('0x53')],'as':_0xfc02('0x4f')},{'model':db[_0xfc02('0x53')],'as':'Descriptions'}]});}return null;})[_0xfc02('0x22')](respondWithResult(_0x588fc,null))[_0xfc02('0x43')](handleError(_0x588fc,null));};exports[_0xfc02('0x54')]=function(_0x46cca7,_0x11fb1c,_0x23cd06){var _0x1f1c77=[{'name':_0xfc02('0x55'),'label':_0xfc02('0x55'),'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 _0x1aa64d='';return db[_0xfc02('0x40')][_0xfc02('0x4d')]({'where':{'id':_0x46cca7[_0xfc02('0x44')]['id']},'attributes':['id',_0xfc02('0x56'),_0xfc02('0x57'),_0xfc02('0x58'),_0xfc02('0x59'),_0xfc02('0x5a'),_0xfc02('0x5b'),_0xfc02('0x5c'),_0xfc02('0x5d')]})['then'](handleEntityNotFound(_0x11fb1c,null))[_0xfc02('0x22')](function(_0x1107a4){if(_0x1107a4){_0x1aa64d=_0x1107a4['remoteUri'];var _0x32577f=_0x1aa64d[_0xfc02('0x5e')](-0x1);if(_0x32577f==='/'){_0x1aa64d=_0x1aa64d[_0xfc02('0x5f')](0x0,_0x1aa64d[_0xfc02('0x60')](_0x32577f));}var _0x48206d={'method':_0xfc02('0x61'),'uri':util[_0xfc02('0x62')](_0xfc02('0x63'),_0x1aa64d),'headers':{'Content-Type':_0xfc02('0x64'),'Accept':'application/json'},'json':!![]};if(_0x1107a4[_0xfc02('0x57')]==='basic'){_0x48206d[_0xfc02('0x65')][_0xfc02('0x66')]=util[_0xfc02('0x62')](_0xfc02('0x67'),new Buffer(util[_0xfc02('0x62')]('%s:%s',_0x1107a4[_0xfc02('0x58')],_0x1107a4[_0xfc02('0x59')]))['toString'](_0xfc02('0x68')));}return rp(_0x48206d)['then'](function(_0x4753c7){return _0x1f1c77[_0xfc02('0x69')](_[_0xfc02('0x28')](_0x4753c7[_0xfc02('0x6a')][_0xfc02('0x6b')],function(_0x19c4b5){return{'id':_0x19c4b5[_0xfc02('0x26')],'name':_0x19c4b5[_0xfc02('0x26')],'type':_0x19c4b5['type'],'active':_0x19c4b5[_0xfc02('0x6c')],'label':_0x19c4b5[_0xfc02('0x6d')],'custom':!![]};}));});}})[_0xfc02('0x22')](function(_0x357c4c){return{'count':_0x357c4c[_0xfc02('0x32')],'rows':_0x357c4c};})[_0xfc02('0x22')](respondWithResult(_0x11fb1c,null))[_0xfc02('0x43')](function(_0x304375){var _0x2fb137=_0x46cca7[_0xfc02('0x2d')][_0xfc02('0x6e')]?0x1f4:_0x304375[_0xfc02('0x6f')]||0x1f4;logger[_0xfc02('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xfc02('0x54'),_0x2fb137,JSON[_0xfc02('0x70')](_0x304375));delete _0x304375[_0xfc02('0x26')];if(_0x2fb137===0x191){_0x2fb137=0x190;}_0x11fb1c[_0xfc02('0x18')](_0x2fb137)[_0xfc02('0x27')](_0x46cca7[_0xfc02('0x2d')][_0xfc02('0x6e')]?{'message':_0xfc02('0x71'),'statusCode':_0x304375[_0xfc02('0x6f')]}:_0x304375);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d8f3e46..f816134 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 _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 +var _0x5c5e=['request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','api','bluebird'];(function(_0x2943fe,_0x3c7335){var _0x43db96=function(_0x3d436a){while(--_0x3d436a){_0x2943fe['push'](_0x2943fe['shift']());}};_0x43db96(++_0x3c7335);}(_0x5c5e,0xc8));var _0xe5c5=function(_0xf8abbb,_0x3a0919){_0xf8abbb=_0xf8abbb-0x0;var _0x4e45d0=_0x5c5e[_0xf8abbb];return _0x4e45d0;};'use strict';var _=require(_0xe5c5('0x0'));var util=require(_0xe5c5('0x1'));var logger=require('../../config/logger')(_0xe5c5('0x2'));var moment=require('moment');var BPromise=require(_0xe5c5('0x3'));var rp=require(_0xe5c5('0x4'));var fs=require('fs');var path=require(_0xe5c5('0x5'));var rimraf=require(_0xe5c5('0x6'));var config=require('../../config/environment');var attributes=require(_0xe5c5('0x7'));var integrations=require(_0xe5c5('0x8'));module['exports']=function(_0x5c81d2,_0x37e570){return _0x5c81d2[_0xe5c5('0x9')](_0xe5c5('0xa'),attributes,{'tableName':_0xe5c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 279cb23..cf1c3fc 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 _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 +var _0xaf70=['code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','include','map','then','debug','ShowDeskAccount','find','model','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x45c0f7,_0x3b1c07){var _0x56cb13=function(_0x3434f6){while(--_0x3434f6){_0x45c0f7['push'](_0x45c0f7['shift']());}};_0x56cb13(++_0x3b1c07);}(_0xaf70,0xd8));var _0x0af7=function(_0x47d01f,_0xd1aa50){_0x47d01f=_0x47d01f-0x0;var _0x4701c7=_0xaf70[_0x47d01f];return _0x4701c7;};'use strict';var _=require(_0x0af7('0x0'));var util=require(_0x0af7('0x1'));var moment=require(_0x0af7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0af7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af7('0x4'));var logger=require(_0x0af7('0x5'))(_0x0af7('0x6'));var config=require(_0x0af7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0af7('0x8')][_0x0af7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178e78,_0x356fcd,_0x3eb193){return new BPromise(function(_0x216af0,_0x729bf8){return client['request'](_0x178e78,_0x3eb193)['then'](function(_0x501568){logger[_0x0af7('0xa')](_0x0af7('0xb'),_0x356fcd,_0x0af7('0xc'));logger['debug'](_0x0af7('0xd'),_0x356fcd,_0x0af7('0xc'),JSON['stringify'](_0x501568));if(_0x501568[_0x0af7('0xe')]){if(_0x501568[_0x0af7('0xe')][_0x0af7('0xf')]===0x1f4){logger[_0x0af7('0xe')]('DeskAccount,\x20%s,\x20%s',_0x356fcd,_0x501568[_0x0af7('0xe')][_0x0af7('0x10')]);return _0x729bf8(_0x501568[_0x0af7('0xe')][_0x0af7('0x10')]);}logger[_0x0af7('0xe')]('DeskAccount,\x20%s,\x20%s',_0x356fcd,_0x501568['error'][_0x0af7('0x10')]);return _0x216af0(_0x501568[_0x0af7('0xe')][_0x0af7('0x10')]);}else{logger['info'](_0x0af7('0xb'),_0x356fcd,_0x0af7('0xc'));_0x216af0(_0x501568[_0x0af7('0x11')][_0x0af7('0x10')]);}})[_0x0af7('0x12')](function(_0x33956b){logger[_0x0af7('0xe')](_0x0af7('0xb'),_0x356fcd,_0x33956b);_0x729bf8(_0x33956b);});});}exports[_0x0af7('0x13')]=function(_0x18ee6b){var _0x4a3aa1=this;return new Promise(function(_0x17a653,_0x3948e4){return db[_0x0af7('0x14')][_0x0af7('0x15')]({'raw':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')][_0x0af7('0x17')]||null:null,'attributes':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')][_0x0af7('0x18')]||null:null,'limit':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')]['limit']||null:null,'include':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')][_0x0af7('0x19')]?_[_0x0af7('0x1a')](_0x18ee6b['options'][_0x0af7('0x19')],function(_0x9cc3d6){return{'model':db[_0x9cc3d6['model']],'as':_0x9cc3d6['as'],'attributes':_0x9cc3d6[_0x0af7('0x18')],'include':_0x9cc3d6[_0x0af7('0x19')]?_[_0x0af7('0x1a')](_0x9cc3d6[_0x0af7('0x19')],function(_0x1f5f6b){return{'model':db[_0x1f5f6b['model']],'as':_0x1f5f6b['as'],'attributes':_0x1f5f6b['attributes'],'include':_0x1f5f6b[_0x0af7('0x19')]?_[_0x0af7('0x1a')](_0x1f5f6b[_0x0af7('0x19')],function(_0x48e792){return{'model':db[_0x48e792['model']],'as':_0x48e792['as'],'attributes':_0x48e792[_0x0af7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0af7('0x1b')](function(_0x435591){logger[_0x0af7('0xa')](_0x0af7('0x13'),_0x18ee6b);logger[_0x0af7('0x1c')](_0x0af7('0x13'),_0x18ee6b,JSON['stringify'](_0x435591));_0x17a653(_0x435591);})[_0x0af7('0x12')](function(_0x570431){logger[_0x0af7('0xe')](_0x0af7('0x13'),_0x570431[_0x0af7('0x10')],_0x18ee6b);_0x3948e4(_0x4a3aa1['error'](0x1f4,_0x570431['message']));});});};exports[_0x0af7('0x1d')]=function(_0x4ba6c8){var _0x434912=this;return new Promise(function(_0x13ddc6,_0x9476ba){return db['DeskAccount'][_0x0af7('0x1e')]({'raw':_0x4ba6c8[_0x0af7('0x16')]?_0x4ba6c8['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ba6c8[_0x0af7('0x16')]?_0x4ba6c8[_0x0af7('0x16')][_0x0af7('0x17')]||null:null,'attributes':_0x4ba6c8[_0x0af7('0x16')]?_0x4ba6c8['options'][_0x0af7('0x18')]||null:null,'include':_0x4ba6c8['options']?_0x4ba6c8[_0x0af7('0x16')]['include']?_[_0x0af7('0x1a')](_0x4ba6c8[_0x0af7('0x16')]['include'],function(_0x5e45e1){return{'model':db[_0x5e45e1[_0x0af7('0x1f')]],'as':_0x5e45e1['as'],'attributes':_0x5e45e1[_0x0af7('0x18')],'include':_0x5e45e1[_0x0af7('0x19')]?_['map'](_0x5e45e1[_0x0af7('0x19')],function(_0x5da7e8){return{'model':db[_0x5da7e8[_0x0af7('0x1f')]],'as':_0x5da7e8['as'],'attributes':_0x5da7e8['attributes'],'include':_0x5da7e8[_0x0af7('0x19')]?_['map'](_0x5da7e8[_0x0af7('0x19')],function(_0x123b8b){return{'model':db[_0x123b8b['model']],'as':_0x123b8b['as'],'attributes':_0x123b8b[_0x0af7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0af7('0x1b')](function(_0x51ff8d){logger[_0x0af7('0xa')](_0x0af7('0x1d'),_0x4ba6c8);logger['debug']('ShowDeskAccount',_0x4ba6c8,JSON[_0x0af7('0x20')](_0x51ff8d));_0x13ddc6(_0x51ff8d);})[_0x0af7('0x12')](function(_0x4fca63){logger['error'](_0x0af7('0x1d'),_0x4fca63[_0x0af7('0x10')],_0x4ba6c8);_0x9476ba(_0x434912[_0x0af7('0xe')](0x1f4,_0x4fca63[_0x0af7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a6dfeb8..77d8c84 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(_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 +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x55ca,0x126));var _0xa55c=function(_0x190c49,_0x103457){_0x190c49=_0x190c49-0x0;var _0x475b9a=_0x55ca[_0x190c49];return _0x475b9a;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f8abc5b..4deecbd 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 _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 +var _0x4c53=['STRING','exports'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x4c53,0x181));var _0x34c5=function(_0x315b3e,_0x12d46b){_0x315b3e=_0x315b3e-0x0;var _0x1efd1d=_0x4c53[_0x315b3e];return _0x1efd1d;};'use strict';var Sequelize=require('sequelize');module[_0x34c5('0x0')]={'name':{'type':Sequelize[_0x34c5('0x1')]},'description':{'type':Sequelize[_0x34c5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 6f04c85..287d30b 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 _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 +var _0x6358=['intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','then','rows','catch','show','params','create','body','getFields','findOne','keys','DeskField','nolimit','getSubjects','getDescriptions','getTags','order','setTags','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x5ebc8f,_0x2eb237){var _0x573495=function(_0x41aa85){while(--_0x41aa85){_0x5ebc8f['push'](_0x5ebc8f['shift']());}};_0x573495(++_0x2eb237);}(_0x6358,0x73));var _0x8635=function(_0x430a85,_0x4ce7ef){_0x430a85=_0x430a85-0x0;var _0x5e026b=_0x6358[_0x430a85];return _0x5e026b;};'use strict';var emlformat=require(_0x8635('0x0'));var rimraf=require(_0x8635('0x1'));var zipdir=require(_0x8635('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8635('0x3'));var moment=require('moment');var BPromise=require(_0x8635('0x4'));var Mustache=require(_0x8635('0x5'));var util=require(_0x8635('0x6'));var path=require(_0x8635('0x7'));var sox=require(_0x8635('0x8'));var csv=require('to-csv');var ejs=require(_0x8635('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8635('0xa'));var squel=require(_0x8635('0xb'));var crypto=require(_0x8635('0xc'));var jsforce=require(_0x8635('0xd'));var deskjs=require(_0x8635('0xe'));var toCsv=require(_0x8635('0xf'));var querystring=require(_0x8635('0x10'));var Papa=require(_0x8635('0x11'));var Redis=require(_0x8635('0x12'));var authService=require(_0x8635('0x13'));var qs=require(_0x8635('0x14'));var as=require(_0x8635('0x15'));var hardwareService=require(_0x8635('0x16'));var logger=require(_0x8635('0x17'))('api');var utils=require(_0x8635('0x18'));var config=require(_0x8635('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8635('0x1a'))['db'];function respondWithStatusCode(_0x19146d,_0xdbca41){_0xdbca41=_0xdbca41||0xcc;return function(_0x108878){if(_0x108878){return _0x19146d['sendStatus'](_0xdbca41);}return _0x19146d['status'](_0xdbca41)[_0x8635('0x1b')]();};}function respondWithResult(_0x2d31f9,_0x249e97){_0x249e97=_0x249e97||0xc8;return function(_0x5cb1f6){if(_0x5cb1f6){return _0x2d31f9['status'](_0x249e97)[_0x8635('0x1c')](_0x5cb1f6);}};}function respondWithFilteredResult(_0x571691,_0x18605e){return function(_0x23886c){if(_0x23886c){var _0x3b7407=typeof _0x18605e['offset']===_0x8635('0x1d')&&typeof _0x18605e[_0x8635('0x1e')]===_0x8635('0x1d');var _0x533dc3=_0x23886c[_0x8635('0x1f')];var _0x233a17=_0x3b7407?0x0:_0x18605e[_0x8635('0x20')];var _0x477cd4=_0x3b7407?_0x23886c['count']:_0x18605e[_0x8635('0x20')]+_0x18605e['limit'];var _0x5c4af8;if(_0x477cd4>=_0x533dc3){_0x477cd4=_0x533dc3;_0x5c4af8=0xc8;}else{_0x5c4af8=0xce;}_0x571691[_0x8635('0x21')](_0x5c4af8);return _0x571691[_0x8635('0x22')](_0x8635('0x23'),_0x233a17+'-'+_0x477cd4+'/'+_0x533dc3)[_0x8635('0x1c')](_0x23886c);}return null;};}function patchUpdates(_0x425508){return function(_0x4349dd){try{jsonpatch['apply'](_0x4349dd,_0x425508,!![]);}catch(_0x1395c0){return BPromise[_0x8635('0x24')](_0x1395c0);}return _0x4349dd[_0x8635('0x25')]();};}function saveUpdates(_0x3c9a76,_0x20b503){return function(_0x75620c){if(_0x75620c){return _0x75620c[_0x8635('0x26')](_0x3c9a76)['then'](function(_0x14cde4){return _0x14cde4;});}return null;};}function removeEntity(_0x141c2a,_0x55c4e2){return function(_0xad1af){if(_0xad1af){return _0xad1af[_0x8635('0x27')]()['then'](function(){_0x141c2a[_0x8635('0x21')](0xcc)[_0x8635('0x1b')]();});}};}function handleEntityNotFound(_0x45bfd0,_0xc09039){return function(_0x5d5daa){if(!_0x5d5daa){_0x45bfd0[_0x8635('0x28')](0x194);}return _0x5d5daa;};}function handleError(_0x25d832,_0x23b124){_0x23b124=_0x23b124||0x1f4;return function(_0x1edaa5){logger['error'](_0x1edaa5['stack']);if(_0x1edaa5[_0x8635('0x29')]){delete _0x1edaa5[_0x8635('0x29')];}_0x25d832[_0x8635('0x21')](_0x23b124)[_0x8635('0x2a')](_0x1edaa5);};}exports[_0x8635('0x2b')]=function(_0x191913,_0x460684){var _0x1ce1fa={},_0x453fbf={},_0x42d824={'count':0x0,'rows':[]};var _0x5e940c=_[_0x8635('0x2c')](db[_0x8635('0x2d')][_0x8635('0x2e')],function(_0x35ed5a){return{'name':_0x35ed5a[_0x8635('0x2f')],'type':_0x35ed5a[_0x8635('0x30')][_0x8635('0x31')]};});_0x453fbf[_0x8635('0x32')]=_[_0x8635('0x2c')](_0x5e940c,_0x8635('0x29'));_0x453fbf['query']=_['keys'](_0x191913[_0x8635('0x33')]);_0x453fbf[_0x8635('0x34')]=_[_0x8635('0x35')](_0x453fbf['model'],_0x453fbf['query']);_0x1ce1fa[_0x8635('0x36')]=_['intersection'](_0x453fbf[_0x8635('0x32')],qs[_0x8635('0x37')](_0x191913[_0x8635('0x33')][_0x8635('0x37')]));_0x1ce1fa[_0x8635('0x36')]=_0x1ce1fa[_0x8635('0x36')][_0x8635('0x38')]?_0x1ce1fa[_0x8635('0x36')]:_0x453fbf[_0x8635('0x32')];if(!_0x191913[_0x8635('0x33')][_0x8635('0x39')]('nolimit')){_0x1ce1fa[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x191913['query'][_0x8635('0x1e')]);_0x1ce1fa[_0x8635('0x20')]=qs[_0x8635('0x20')](_0x191913['query'][_0x8635('0x20')]);}_0x1ce1fa['order']=qs[_0x8635('0x3a')](_0x191913[_0x8635('0x33')][_0x8635('0x3a')]);_0x1ce1fa[_0x8635('0x3b')]=qs[_0x8635('0x34')](_[_0x8635('0x3c')](_0x191913['query'],_0x453fbf[_0x8635('0x34')]),_0x5e940c);if(_0x191913[_0x8635('0x33')][_0x8635('0x3d')]){_0x1ce1fa[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x1ce1fa[_0x8635('0x3b')],{'$or':_[_0x8635('0x2c')](_0x5e940c,function(_0x5286f7){if(_0x5286f7[_0x8635('0x30')]!==_0x8635('0x3f')){var _0x2cbb28={};_0x2cbb28[_0x5286f7[_0x8635('0x29')]]={'$like':'%'+_0x191913['query'][_0x8635('0x3d')]+'%'};return _0x2cbb28;}})});}_0x1ce1fa=_[_0x8635('0x3e')]({},_0x1ce1fa,_0x191913[_0x8635('0x40')]);var _0x34abf8={'where':_0x1ce1fa[_0x8635('0x3b')]};return db['DeskConfiguration'][_0x8635('0x1f')](_0x34abf8)['then'](function(_0x1b34d6){_0x42d824[_0x8635('0x1f')]=_0x1b34d6;if(_0x191913[_0x8635('0x33')][_0x8635('0x41')]){_0x1ce1fa[_0x8635('0x42')]=[{'all':!![]}];}return db[_0x8635('0x2d')]['findAll'](_0x1ce1fa);})[_0x8635('0x43')](function(_0x259982){_0x42d824[_0x8635('0x44')]=_0x259982;return _0x42d824;})['then'](respondWithFilteredResult(_0x460684,_0x1ce1fa))[_0x8635('0x45')](handleError(_0x460684,null));};exports[_0x8635('0x46')]=function(_0x565783,_0x239ab3){var _0x137ac2={'raw':![],'where':{'id':_0x565783[_0x8635('0x47')]['id']}},_0x5f0314={};_0x5f0314[_0x8635('0x32')]=_['keys'](db[_0x8635('0x2d')]['rawAttributes']);_0x5f0314[_0x8635('0x33')]=_['keys'](_0x565783['query']);_0x5f0314[_0x8635('0x34')]=_[_0x8635('0x35')](_0x5f0314[_0x8635('0x32')],_0x5f0314[_0x8635('0x33')]);_0x137ac2[_0x8635('0x36')]=_[_0x8635('0x35')](_0x5f0314[_0x8635('0x32')],qs[_0x8635('0x37')](_0x565783['query'][_0x8635('0x37')]));_0x137ac2['attributes']=_0x137ac2[_0x8635('0x36')]['length']?_0x137ac2[_0x8635('0x36')]:_0x5f0314['model'];if(_0x565783[_0x8635('0x33')][_0x8635('0x41')]){_0x137ac2[_0x8635('0x42')]=[{'all':!![]}];}_0x137ac2=_[_0x8635('0x3e')]({},_0x137ac2,_0x565783[_0x8635('0x40')]);return db['DeskConfiguration']['find'](_0x137ac2)[_0x8635('0x43')](handleEntityNotFound(_0x239ab3,null))[_0x8635('0x43')](respondWithResult(_0x239ab3,null))[_0x8635('0x45')](handleError(_0x239ab3,null));};exports[_0x8635('0x48')]=function(_0x2570d5,_0x1cd270){return db[_0x8635('0x2d')][_0x8635('0x48')](_0x2570d5[_0x8635('0x49')],{})[_0x8635('0x43')](respondWithResult(_0x1cd270,0xc9))[_0x8635('0x45')](handleError(_0x1cd270,null));};exports[_0x8635('0x26')]=function(_0x186b02,_0x55ceef){if(_0x186b02[_0x8635('0x49')]['id']){delete _0x186b02[_0x8635('0x49')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x186b02[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x55ceef,null))[_0x8635('0x43')](saveUpdates(_0x186b02[_0x8635('0x49')],null))['then'](respondWithResult(_0x55ceef,null))[_0x8635('0x45')](handleError(_0x55ceef,null));};exports['destroy']=function(_0x658883,_0x1edbf7){return db[_0x8635('0x2d')]['find']({'where':{'id':_0x658883[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x1edbf7,null))['then'](removeEntity(_0x1edbf7,null))['catch'](handleError(_0x1edbf7,null));};exports[_0x8635('0x4a')]=function(_0x1d3393,_0x1a1e6d,_0x15419b){var _0x4c289a={};var _0x3be1f3={};var _0x582225;var _0x2ae94e;return db[_0x8635('0x2d')][_0x8635('0x4b')]({'where':{'id':_0x1d3393['params']['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x1a1e6d,null))['then'](function(_0x458650){if(_0x458650){_0x582225=_0x458650;_0x3be1f3[_0x8635('0x32')]=_[_0x8635('0x4c')](db[_0x8635('0x4d')]['rawAttributes']);_0x3be1f3[_0x8635('0x33')]=_[_0x8635('0x4c')](_0x1d3393[_0x8635('0x33')]);_0x3be1f3[_0x8635('0x34')]=_['intersection'](_0x3be1f3[_0x8635('0x32')],_0x3be1f3['query']);_0x4c289a[_0x8635('0x36')]=_[_0x8635('0x35')](_0x3be1f3['model'],qs[_0x8635('0x37')](_0x1d3393['query'][_0x8635('0x37')]));_0x4c289a[_0x8635('0x36')]=_0x4c289a[_0x8635('0x36')][_0x8635('0x38')]?_0x4c289a[_0x8635('0x36')]:_0x3be1f3[_0x8635('0x32')];_0x4c289a['order']=qs[_0x8635('0x3a')](_0x1d3393['query'][_0x8635('0x3a')]);_0x4c289a['where']=qs[_0x8635('0x34')](_[_0x8635('0x3c')](_0x1d3393[_0x8635('0x33')],_0x3be1f3[_0x8635('0x34')]));if(_0x1d3393[_0x8635('0x33')][_0x8635('0x3d')]){_0x4c289a[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x4c289a[_0x8635('0x3b')],{'$or':_[_0x8635('0x2c')](_0x4c289a[_0x8635('0x36')],function(_0xd3bc0d){var _0x23b2df={};_0x23b2df[_0xd3bc0d]={'$like':'%'+_0x1d3393[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x23b2df;})});}_0x4c289a=_[_0x8635('0x3e')]({},_0x4c289a,_0x1d3393[_0x8635('0x40')]);return _0x582225[_0x8635('0x4a')](_0x4c289a);}})['then'](function(_0x1316e9){if(_0x1316e9){_0x2ae94e=_0x1316e9['length'];if(!_0x1d3393['query'][_0x8635('0x39')](_0x8635('0x4e'))){_0x4c289a[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x1d3393['query']['limit']);_0x4c289a['offset']=qs[_0x8635('0x20')](_0x1d3393[_0x8635('0x33')][_0x8635('0x20')]);}return _0x582225[_0x8635('0x4a')](_0x4c289a);}})['then'](function(_0x1dbcab){if(_0x1dbcab){return _0x1dbcab?{'count':_0x2ae94e,'rows':_0x1dbcab}:null;}})['then'](respondWithResult(_0x1a1e6d,null))[_0x8635('0x45')](handleError(_0x1a1e6d,null));};exports[_0x8635('0x4f')]=function(_0x489b49,_0x522c04,_0x1a0aac){var _0x1bb547={};var _0xe045fc={};var _0x52bef2;var _0x8ce346;return db[_0x8635('0x2d')]['findOne']({'where':{'id':_0x489b49[_0x8635('0x47')]['id']}})['then'](handleEntityNotFound(_0x522c04,null))[_0x8635('0x43')](function(_0x28e35a){if(_0x28e35a){_0x52bef2=_0x28e35a;_0xe045fc[_0x8635('0x32')]=_[_0x8635('0x4c')](db[_0x8635('0x4d')][_0x8635('0x2e')]);_0xe045fc[_0x8635('0x33')]=_['keys'](_0x489b49[_0x8635('0x33')]);_0xe045fc[_0x8635('0x34')]=_[_0x8635('0x35')](_0xe045fc[_0x8635('0x32')],_0xe045fc[_0x8635('0x33')]);_0x1bb547[_0x8635('0x36')]=_['intersection'](_0xe045fc[_0x8635('0x32')],qs['fields'](_0x489b49[_0x8635('0x33')][_0x8635('0x37')]));_0x1bb547[_0x8635('0x36')]=_0x1bb547['attributes']['length']?_0x1bb547[_0x8635('0x36')]:_0xe045fc[_0x8635('0x32')];_0x1bb547['order']=qs[_0x8635('0x3a')](_0x489b49[_0x8635('0x33')][_0x8635('0x3a')]);_0x1bb547[_0x8635('0x3b')]=qs['filters'](_[_0x8635('0x3c')](_0x489b49[_0x8635('0x33')],_0xe045fc['filters']));if(_0x489b49['query']['filter']){_0x1bb547[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x1bb547['where'],{'$or':_[_0x8635('0x2c')](_0x1bb547['attributes'],function(_0x31193c){var _0x46a0f1={};_0x46a0f1[_0x31193c]={'$like':'%'+_0x489b49[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x46a0f1;})});}_0x1bb547=_[_0x8635('0x3e')]({},_0x1bb547,_0x489b49[_0x8635('0x40')]);return _0x52bef2[_0x8635('0x4f')](_0x1bb547);}})['then'](function(_0x42e960){if(_0x42e960){_0x8ce346=_0x42e960['length'];if(!_0x489b49[_0x8635('0x33')][_0x8635('0x39')]('nolimit')){_0x1bb547[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x489b49[_0x8635('0x33')][_0x8635('0x1e')]);_0x1bb547[_0x8635('0x20')]=qs[_0x8635('0x20')](_0x489b49[_0x8635('0x33')][_0x8635('0x20')]);}return _0x52bef2[_0x8635('0x4f')](_0x1bb547);}})['then'](function(_0x5c304d){if(_0x5c304d){return _0x5c304d?{'count':_0x8ce346,'rows':_0x5c304d}:null;}})['then'](respondWithResult(_0x522c04,null))[_0x8635('0x45')](handleError(_0x522c04,null));};exports[_0x8635('0x50')]=function(_0x31d62f,_0x4ffa27,_0x424c85){var _0x4f8ba9={};var _0x1f5a61={};var _0x5d1466;var _0x181327;return db[_0x8635('0x2d')][_0x8635('0x4b')]({'where':{'id':_0x31d62f[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x4ffa27,null))[_0x8635('0x43')](function(_0x25388c){if(_0x25388c){_0x5d1466=_0x25388c;_0x1f5a61[_0x8635('0x32')]=_['keys'](db[_0x8635('0x4d')][_0x8635('0x2e')]);_0x1f5a61['query']=_[_0x8635('0x4c')](_0x31d62f[_0x8635('0x33')]);_0x1f5a61['filters']=_[_0x8635('0x35')](_0x1f5a61[_0x8635('0x32')],_0x1f5a61[_0x8635('0x33')]);_0x4f8ba9[_0x8635('0x36')]=_[_0x8635('0x35')](_0x1f5a61[_0x8635('0x32')],qs[_0x8635('0x37')](_0x31d62f[_0x8635('0x33')][_0x8635('0x37')]));_0x4f8ba9[_0x8635('0x36')]=_0x4f8ba9[_0x8635('0x36')][_0x8635('0x38')]?_0x4f8ba9[_0x8635('0x36')]:_0x1f5a61['model'];_0x4f8ba9['order']=qs[_0x8635('0x3a')](_0x31d62f[_0x8635('0x33')]['sort']);_0x4f8ba9[_0x8635('0x3b')]=qs[_0x8635('0x34')](_[_0x8635('0x3c')](_0x31d62f[_0x8635('0x33')],_0x1f5a61[_0x8635('0x34')]));if(_0x31d62f[_0x8635('0x33')][_0x8635('0x3d')]){_0x4f8ba9[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x4f8ba9[_0x8635('0x3b')],{'$or':_['map'](_0x4f8ba9[_0x8635('0x36')],function(_0x41ce5a){var _0x5d0552={};_0x5d0552[_0x41ce5a]={'$like':'%'+_0x31d62f[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x5d0552;})});}_0x4f8ba9=_[_0x8635('0x3e')]({},_0x4f8ba9,_0x31d62f[_0x8635('0x40')]);return _0x5d1466[_0x8635('0x50')](_0x4f8ba9);}})[_0x8635('0x43')](function(_0x1f4bb9){if(_0x1f4bb9){_0x181327=_0x1f4bb9[_0x8635('0x38')];if(!_0x31d62f[_0x8635('0x33')][_0x8635('0x39')](_0x8635('0x4e'))){_0x4f8ba9[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x31d62f[_0x8635('0x33')][_0x8635('0x1e')]);_0x4f8ba9[_0x8635('0x20')]=qs['offset'](_0x31d62f[_0x8635('0x33')][_0x8635('0x20')]);}return _0x5d1466[_0x8635('0x50')](_0x4f8ba9);}})['then'](function(_0xb416af){if(_0xb416af){return _0xb416af?{'count':_0x181327,'rows':_0xb416af}:null;}})[_0x8635('0x43')](respondWithResult(_0x4ffa27,null))['catch'](handleError(_0x4ffa27,null));};exports[_0x8635('0x51')]=function(_0x99b5d4,_0x176f61,_0x5cd66c){var _0x31c09a={};var _0xddc5b8={};var _0x341f2c;var _0x52866e;return db['DeskConfiguration'][_0x8635('0x4b')]({'where':{'id':_0x99b5d4[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x176f61,null))[_0x8635('0x43')](function(_0x31c674){if(_0x31c674){_0x341f2c=_0x31c674;_0xddc5b8[_0x8635('0x32')]=_[_0x8635('0x4c')](db['Tag'][_0x8635('0x2e')]);_0xddc5b8[_0x8635('0x33')]=_[_0x8635('0x4c')](_0x99b5d4[_0x8635('0x33')]);_0xddc5b8['filters']=_[_0x8635('0x35')](_0xddc5b8[_0x8635('0x32')],_0xddc5b8[_0x8635('0x33')]);_0x31c09a[_0x8635('0x36')]=_[_0x8635('0x35')](_0xddc5b8[_0x8635('0x32')],qs[_0x8635('0x37')](_0x99b5d4[_0x8635('0x33')][_0x8635('0x37')]));_0x31c09a[_0x8635('0x36')]=_0x31c09a[_0x8635('0x36')][_0x8635('0x38')]?_0x31c09a[_0x8635('0x36')]:_0xddc5b8[_0x8635('0x32')];_0x31c09a[_0x8635('0x52')]=qs[_0x8635('0x3a')](_0x99b5d4[_0x8635('0x33')][_0x8635('0x3a')]);_0x31c09a[_0x8635('0x3b')]=qs['filters'](_['pick'](_0x99b5d4[_0x8635('0x33')],_0xddc5b8[_0x8635('0x34')]));if(_0x99b5d4[_0x8635('0x33')][_0x8635('0x3d')]){_0x31c09a[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x31c09a[_0x8635('0x3b')],{'$or':_[_0x8635('0x2c')](_0x31c09a[_0x8635('0x36')],function(_0x5cc700){var _0x66f862={};_0x66f862[_0x5cc700]={'$like':'%'+_0x99b5d4[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x66f862;})});}_0x31c09a=_['merge']({},_0x31c09a,_0x99b5d4['options']);return _0x341f2c['getTags'](_0x31c09a);}})[_0x8635('0x43')](function(_0x5e1aa9){if(_0x5e1aa9){_0x52866e=_0x5e1aa9['length'];if(!_0x99b5d4[_0x8635('0x33')][_0x8635('0x39')](_0x8635('0x4e'))){_0x31c09a[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x99b5d4[_0x8635('0x33')]['limit']);_0x31c09a['offset']=qs[_0x8635('0x20')](_0x99b5d4['query'][_0x8635('0x20')]);}return _0x341f2c[_0x8635('0x51')](_0x31c09a);}})['then'](function(_0xf6a11f){if(_0xf6a11f){return _0xf6a11f?{'count':_0x52866e,'rows':_0xf6a11f}:null;}})[_0x8635('0x43')](respondWithResult(_0x176f61,null))[_0x8635('0x45')](handleError(_0x176f61,null));};exports[_0x8635('0x53')]=function(_0x36e6d6,_0x5634f0,_0x10c459){if(_0x36e6d6['body']['id']){delete _0x36e6d6['body']['id'];}return db[_0x8635('0x2d')][_0x8635('0x4b')]({'where':{'id':_0x36e6d6[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x5634f0,null))[_0x8635('0x43')](function(_0x1f31c0){if(_0x1f31c0){return _0x1f31c0['setTags'](_0x36e6d6[_0x8635('0x49')]['ids']||[]);}return null;})['then'](respondWithResult(_0x5634f0,null))[_0x8635('0x45')](handleError(_0x5634f0,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ce2114e..3749375 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 _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 +var _0x6ece=['exports','DeskConfiguration','int_desk_configurations','lodash','moment','bluebird','./intDeskConfiguration.attributes'];(function(_0x1835f9,_0x21578d){var _0x41b028=function(_0x458ba8){while(--_0x458ba8){_0x1835f9['push'](_0x1835f9['shift']());}};_0x41b028(++_0x21578d);}(_0x6ece,0x8f));var _0xe6ec=function(_0x45291a,_0x2e9d88){_0x45291a=_0x45291a-0x0;var _0x333f33=_0x6ece[_0x45291a];return _0x333f33;};'use strict';var _=require(_0xe6ec('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe6ec('0x1'));var BPromise=require(_0xe6ec('0x2'));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(_0xe6ec('0x3'));module[_0xe6ec('0x4')]=function(_0x1af473,_0x29e205){return _0x1af473['define'](_0xe6ec('0x5'),attributes,{'tableName':_0xe6ec('0x6'),'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 78182db..002b2d2 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 _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 +var _0xc025=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','code','error','message','request\x20sent','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc025,0x169));var _0x5c02=function(_0x3c1e89,_0x260d60){_0x3c1e89=_0x3c1e89-0x0;var _0x39211e=_0xc025[_0x3c1e89];return _0x39211e;};'use strict';var _=require(_0x5c02('0x0'));var util=require('util');var moment=require(_0x5c02('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c02('0x2'));var fs=require('fs');var Redis=require(_0x5c02('0x3'));var db=require(_0x5c02('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c02('0x5'));var config=require(_0x5c02('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5c02('0x7')][_0x5c02('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36934d,_0x1adc51,_0x1d5c2d){return new BPromise(function(_0x3adf86,_0x5a1363){return client[_0x5c02('0x9')](_0x36934d,_0x1d5c2d)[_0x5c02('0xa')](function(_0x594af5){logger[_0x5c02('0xb')](_0x5c02('0xc'),_0x1adc51,'request\x20sent');logger[_0x5c02('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1adc51,'request\x20sent',JSON['stringify'](_0x594af5));if(_0x594af5['error']){if(_0x594af5['error'][_0x5c02('0xe')]===0x1f4){logger[_0x5c02('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x1adc51,_0x594af5['error'][_0x5c02('0x10')]);return _0x5a1363(_0x594af5[_0x5c02('0xf')][_0x5c02('0x10')]);}logger[_0x5c02('0xf')](_0x5c02('0xc'),_0x1adc51,_0x594af5[_0x5c02('0xf')]['message']);return _0x3adf86(_0x594af5[_0x5c02('0xf')][_0x5c02('0x10')]);}else{logger[_0x5c02('0xb')](_0x5c02('0xc'),_0x1adc51,_0x5c02('0x11'));_0x3adf86(_0x594af5[_0x5c02('0x12')][_0x5c02('0x10')]);}})[_0x5c02('0x13')](function(_0xfd3cf4){logger['error'](_0x5c02('0xc'),_0x1adc51,_0xfd3cf4);_0x5a1363(_0xfd3cf4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index eaa8557..68faeca 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 _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 +var _0x299a=['post','create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x4491d9,_0x5856ec){var _0x3e9dba=function(_0x2a6302){while(--_0x2a6302){_0x4491d9['push'](_0x4491d9['shift']());}};_0x3e9dba(++_0x5856ec);}(_0x299a,0x182));var _0xa299=function(_0x487b7b,_0x1844af){_0x487b7b=_0x487b7b-0x0;var _0x452a2d=_0x299a[_0x487b7b];return _0x452a2d;};'use strict';var multer=require('multer');var util=require(_0xa299('0x0'));var path=require(_0xa299('0x1'));var timeout=require(_0xa299('0x2'));var express=require(_0xa299('0x3'));var router=express['Router']();var fs_extra=require(_0xa299('0x4'));var auth=require(_0xa299('0x5'));var interaction=require(_0xa299('0x6'));var config=require(_0xa299('0x7'));var controller=require(_0xa299('0x8'));router[_0xa299('0x9')]('/',auth[_0xa299('0xa')](),controller[_0xa299('0xb')]);router[_0xa299('0x9')](_0xa299('0xc'),auth[_0xa299('0xa')](),controller['show']);router[_0xa299('0xd')]('/',auth[_0xa299('0xa')](),controller[_0xa299('0xe')]);router[_0xa299('0xf')](_0xa299('0xc'),auth[_0xa299('0xa')](),controller[_0xa299('0x10')]);router['delete'](_0xa299('0xc'),auth[_0xa299('0xa')](),controller[_0xa299('0x11')]);module[_0xa299('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 92e5b89..f8ded51 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 _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 +var _0x9a45=['STRING','ENUM','variable','customVariable','sequelize','exports','string'];(function(_0x52398e,_0x2ad8c2){var _0x454d0f=function(_0x12e20c){while(--_0x12e20c){_0x52398e['push'](_0x52398e['shift']());}};_0x454d0f(++_0x2ad8c2);}(_0x9a45,0x11c));var _0x59a4=function(_0x79654c,_0x1fdcc2){_0x79654c=_0x79654c-0x0;var _0x4d5811=_0x9a45[_0x79654c];return _0x4d5811;};'use strict';var Sequelize=require(_0x59a4('0x0'));module[_0x59a4('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue','picklist'),'defaultValue':_0x59a4('0x2')},'content':{'type':Sequelize[_0x59a4('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x59a4('0x4')](_0x59a4('0x2'),_0x59a4('0x5'),_0x59a4('0x6'))},'keyContent':{'type':Sequelize[_0x59a4('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index eca8602..520a332 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 _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 +var _0xdedd=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','model'];(function(_0x3df60c,_0x573229){var _0x50202b=function(_0x17ba76){while(--_0x17ba76){_0x3df60c['push'](_0x3df60c['shift']());}};_0x50202b(++_0x573229);}(_0xdedd,0x197));var _0xdded=function(_0x338802,_0x1a3dd0){_0x338802=_0x338802-0x0;var _0x3cf257=_0xdedd[_0x338802];return _0x3cf257;};'use strict';var emlformat=require(_0xdded('0x0'));var rimraf=require(_0xdded('0x1'));var zipdir=require(_0xdded('0x2'));var jsonpatch=require(_0xdded('0x3'));var rp=require(_0xdded('0x4'));var moment=require('moment');var BPromise=require(_0xdded('0x5'));var Mustache=require(_0xdded('0x6'));var util=require(_0xdded('0x7'));var path=require(_0xdded('0x8'));var sox=require(_0xdded('0x9'));var csv=require(_0xdded('0xa'));var ejs=require(_0xdded('0xb'));var fs=require('fs');var fs_extra=require(_0xdded('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdded('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdded('0xe'));var Papa=require(_0xdded('0xf'));var Redis=require(_0xdded('0x10'));var authService=require(_0xdded('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdded('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdded('0x13'))(_0xdded('0x14'));var utils=require(_0xdded('0x15'));var config=require(_0xdded('0x16'));var licenseUtil=require(_0xdded('0x17'));var db=require(_0xdded('0x18'))['db'];function respondWithStatusCode(_0x233f97,_0x2c110e){_0x2c110e=_0x2c110e||0xcc;return function(_0x1e122c){if(_0x1e122c){return _0x233f97['sendStatus'](_0x2c110e);}return _0x233f97[_0xdded('0x19')](_0x2c110e)[_0xdded('0x1a')]();};}function respondWithResult(_0x4a48ca,_0x31cdbe){_0x31cdbe=_0x31cdbe||0xc8;return function(_0x5256e7){if(_0x5256e7){return _0x4a48ca[_0xdded('0x19')](_0x31cdbe)['json'](_0x5256e7);}};}function respondWithFilteredResult(_0x5e69e9,_0x140bc3){return function(_0x22ca73){if(_0x22ca73){var _0x481ae4=typeof _0x140bc3[_0xdded('0x1b')]===_0xdded('0x1c')&&typeof _0x140bc3[_0xdded('0x1d')]===_0xdded('0x1c');var _0x1454e4=_0x22ca73[_0xdded('0x1e')];var _0x323c30=_0x481ae4?0x0:_0x140bc3[_0xdded('0x1b')];var _0x4f249e=_0x481ae4?_0x22ca73[_0xdded('0x1e')]:_0x140bc3[_0xdded('0x1b')]+_0x140bc3[_0xdded('0x1d')];var _0x153686;if(_0x4f249e>=_0x1454e4){_0x4f249e=_0x1454e4;_0x153686=0xc8;}else{_0x153686=0xce;}_0x5e69e9[_0xdded('0x19')](_0x153686);return _0x5e69e9[_0xdded('0x1f')](_0xdded('0x20'),_0x323c30+'-'+_0x4f249e+'/'+_0x1454e4)[_0xdded('0x21')](_0x22ca73);}return null;};}function patchUpdates(_0x415b38){return function(_0x17be0a){try{jsonpatch[_0xdded('0x22')](_0x17be0a,_0x415b38,!![]);}catch(_0x35000a){return BPromise[_0xdded('0x23')](_0x35000a);}return _0x17be0a['save']();};}function saveUpdates(_0x417e8b,_0x4db31b){return function(_0x233776){if(_0x233776){return _0x233776[_0xdded('0x24')](_0x417e8b)['then'](function(_0xa0c790){return _0xa0c790;});}return null;};}function removeEntity(_0x5d68ed,_0x223048){return function(_0x1c1473){if(_0x1c1473){return _0x1c1473[_0xdded('0x25')]()[_0xdded('0x26')](function(){_0x5d68ed[_0xdded('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5025,_0xb6f82e){return function(_0x2b66b3){if(!_0x2b66b3){_0x1c5025[_0xdded('0x27')](0x194);}return _0x2b66b3;};}function handleError(_0x478235,_0x4bd5c9){_0x4bd5c9=_0x4bd5c9||0x1f4;return function(_0x5e2dfb){logger[_0xdded('0x28')](_0x5e2dfb[_0xdded('0x29')]);if(_0x5e2dfb[_0xdded('0x2a')]){delete _0x5e2dfb[_0xdded('0x2a')];}_0x478235[_0xdded('0x19')](_0x4bd5c9)['send'](_0x5e2dfb);};}exports[_0xdded('0x2b')]=function(_0x10c128,_0x154a55){var _0x11e13a={},_0x560dca={},_0x415158={'count':0x0,'rows':[]};var _0x5f3637=_[_0xdded('0x2c')](db[_0xdded('0x2d')][_0xdded('0x2e')],function(_0x36880e){return{'name':_0x36880e[_0xdded('0x2f')],'type':_0x36880e[_0xdded('0x30')][_0xdded('0x31')]};});_0x560dca['model']=_[_0xdded('0x2c')](_0x5f3637,_0xdded('0x2a'));_0x560dca['query']=_[_0xdded('0x32')](_0x10c128[_0xdded('0x33')]);_0x560dca['filters']=_['intersection'](_0x560dca['model'],_0x560dca['query']);_0x11e13a[_0xdded('0x34')]=_[_0xdded('0x35')](_0x560dca[_0xdded('0x36')],qs[_0xdded('0x37')](_0x10c128[_0xdded('0x33')][_0xdded('0x37')]));_0x11e13a[_0xdded('0x34')]=_0x11e13a['attributes'][_0xdded('0x38')]?_0x11e13a[_0xdded('0x34')]:_0x560dca[_0xdded('0x36')];if(!_0x10c128[_0xdded('0x33')][_0xdded('0x39')](_0xdded('0x3a'))){_0x11e13a['limit']=qs[_0xdded('0x1d')](_0x10c128[_0xdded('0x33')][_0xdded('0x1d')]);_0x11e13a['offset']=qs[_0xdded('0x1b')](_0x10c128[_0xdded('0x33')]['offset']);}_0x11e13a[_0xdded('0x3b')]=qs[_0xdded('0x3c')](_0x10c128[_0xdded('0x33')][_0xdded('0x3c')]);_0x11e13a[_0xdded('0x3d')]=qs[_0xdded('0x3e')](_[_0xdded('0x3f')](_0x10c128[_0xdded('0x33')],_0x560dca[_0xdded('0x3e')]),_0x5f3637);if(_0x10c128[_0xdded('0x33')][_0xdded('0x40')]){_0x11e13a[_0xdded('0x3d')]=_['merge'](_0x11e13a['where'],{'$or':_[_0xdded('0x2c')](_0x5f3637,function(_0xcf99aa){if(_0xcf99aa[_0xdded('0x30')]!==_0xdded('0x41')){var _0x1e849a={};_0x1e849a[_0xcf99aa[_0xdded('0x2a')]]={'$like':'%'+_0x10c128[_0xdded('0x33')][_0xdded('0x40')]+'%'};return _0x1e849a;}})});}_0x11e13a=_[_0xdded('0x42')]({},_0x11e13a,_0x10c128[_0xdded('0x43')]);var _0x398504={'where':_0x11e13a[_0xdded('0x3d')]};return db['DeskField'][_0xdded('0x1e')](_0x398504)['then'](function(_0x128e62){_0x415158['count']=_0x128e62;if(_0x10c128[_0xdded('0x33')][_0xdded('0x44')]){_0x11e13a['include']=[{'all':!![]}];}return db[_0xdded('0x2d')]['findAll'](_0x11e13a);})[_0xdded('0x26')](function(_0x43ed5e){_0x415158[_0xdded('0x45')]=_0x43ed5e;return _0x415158;})[_0xdded('0x26')](respondWithFilteredResult(_0x154a55,_0x11e13a))[_0xdded('0x46')](handleError(_0x154a55,null));};exports[_0xdded('0x47')]=function(_0x438c37,_0x43055e){var _0x47ca13={'raw':!![],'where':{'id':_0x438c37['params']['id']}},_0x2f3887={};_0x2f3887['model']=_[_0xdded('0x32')](db[_0xdded('0x2d')]['rawAttributes']);_0x2f3887[_0xdded('0x33')]=_[_0xdded('0x32')](_0x438c37[_0xdded('0x33')]);_0x2f3887[_0xdded('0x3e')]=_[_0xdded('0x35')](_0x2f3887[_0xdded('0x36')],_0x2f3887[_0xdded('0x33')]);_0x47ca13[_0xdded('0x34')]=_[_0xdded('0x35')](_0x2f3887[_0xdded('0x36')],qs[_0xdded('0x37')](_0x438c37['query'][_0xdded('0x37')]));_0x47ca13['attributes']=_0x47ca13[_0xdded('0x34')][_0xdded('0x38')]?_0x47ca13[_0xdded('0x34')]:_0x2f3887[_0xdded('0x36')];if(_0x438c37[_0xdded('0x33')][_0xdded('0x44')]){_0x47ca13[_0xdded('0x48')]=[{'all':!![]}];}_0x47ca13=_[_0xdded('0x42')]({},_0x47ca13,_0x438c37['options']);return db['DeskField'][_0xdded('0x49')](_0x47ca13)[_0xdded('0x26')](handleEntityNotFound(_0x43055e,null))[_0xdded('0x26')](respondWithResult(_0x43055e,null))[_0xdded('0x46')](handleError(_0x43055e,null));};exports['create']=function(_0x16d647,_0x5d4043){return db[_0xdded('0x2d')][_0xdded('0x4a')](_0x16d647[_0xdded('0x4b')],{})['then'](respondWithResult(_0x5d4043,0xc9))['catch'](handleError(_0x5d4043,null));};exports[_0xdded('0x24')]=function(_0x2b7e8c,_0x2beec5){if(_0x2b7e8c['body']['id']){delete _0x2b7e8c[_0xdded('0x4b')]['id'];}return db['DeskField'][_0xdded('0x49')]({'where':{'id':_0x2b7e8c[_0xdded('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2beec5,null))[_0xdded('0x26')](saveUpdates(_0x2b7e8c[_0xdded('0x4b')],null))[_0xdded('0x26')](respondWithResult(_0x2beec5,null))[_0xdded('0x46')](handleError(_0x2beec5,null));};exports['destroy']=function(_0x262d97,_0x35abc6){return db[_0xdded('0x2d')][_0xdded('0x49')]({'where':{'id':_0x262d97[_0xdded('0x4c')]['id']}})[_0xdded('0x26')](handleEntityNotFound(_0x35abc6,null))['then'](removeEntity(_0x35abc6,null))[_0xdded('0x46')](handleError(_0x35abc6,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 5052800..47c29a3 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 _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 +var _0xaf89=['desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_desk_fields'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaf89,0xd5));var _0x9af8=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xaf89[_0x202c61];return _0x540691;};'use strict';var _=require(_0x9af8('0x0'));var util=require('util');var logger=require(_0x9af8('0x1'))(_0x9af8('0x2'));var moment=require(_0x9af8('0x3'));var BPromise=require(_0x9af8('0x4'));var rp=require(_0x9af8('0x5'));var fs=require('fs');var path=require(_0x9af8('0x6'));var rimraf=require(_0x9af8('0x7'));var config=require(_0x9af8('0x8'));var attributes=require('./intDeskField.attributes');module[_0x9af8('0x9')]=function(_0xf5e8bc,_0x22edf0){return _0xf5e8bc[_0x9af8('0xa')]('DeskField',attributes,{'tableName':_0x9af8('0xb'),'paranoid':![],'indexes':[{'name':_0x9af8('0xc'),'fields':[_0x9af8('0xd'),_0x9af8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 3154902..ac94060 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 _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 +var _0x247c=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x247c,0xbf));var _0xc247=function(_0x39edf1,_0x3616a9){_0x39edf1=_0x39edf1-0x0;var _0x348891=_0x247c[_0x39edf1];return _0x348891;};'use strict';var _=require(_0xc247('0x0'));var util=require(_0xc247('0x1'));var moment=require(_0xc247('0x2'));var BPromise=require(_0xc247('0x3'));var rs=require(_0xc247('0x4'));var fs=require('fs');var Redis=require(_0xc247('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc247('0x6'));var logger=require(_0xc247('0x7'))(_0xc247('0x8'));var config=require(_0xc247('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc247('0xa')][_0xc247('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbfb70f,_0x2826dd,_0x1db307){return new BPromise(function(_0x58608a,_0x39d6c4){return client[_0xc247('0xc')](_0xbfb70f,_0x1db307)[_0xc247('0xd')](function(_0x339de3){logger[_0xc247('0xe')](_0xc247('0xf'),_0x2826dd,_0xc247('0x10'));logger[_0xc247('0x11')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2826dd,'request\x20sent',JSON[_0xc247('0x12')](_0x339de3));if(_0x339de3['error']){if(_0x339de3[_0xc247('0x13')][_0xc247('0x14')]===0x1f4){logger[_0xc247('0x13')](_0xc247('0xf'),_0x2826dd,_0x339de3[_0xc247('0x13')]['message']);return _0x39d6c4(_0x339de3[_0xc247('0x13')][_0xc247('0x15')]);}logger[_0xc247('0x13')](_0xc247('0xf'),_0x2826dd,_0x339de3[_0xc247('0x13')][_0xc247('0x15')]);return _0x58608a(_0x339de3[_0xc247('0x13')][_0xc247('0x15')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x2826dd,'request\x20sent');_0x58608a(_0x339de3[_0xc247('0x16')]['message']);}})['catch'](function(_0x49f1d7){logger['error'](_0xc247('0xf'),_0x2826dd,_0x49f1d7);_0x39d6c4(_0x49f1d7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9f5a8ec..4a817c3 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 _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 +var _0xb090=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xb090,0x13c));var _0x0b09=function(_0x304641,_0x55ebd8){_0x304641=_0x304641-0x0;var _0x221f56=_0xb090[_0x304641];return _0x221f56;};'use strict';var multer=require(_0x0b09('0x0'));var util=require(_0x0b09('0x1'));var path=require(_0x0b09('0x2'));var timeout=require(_0x0b09('0x3'));var express=require(_0x0b09('0x4'));var router=express[_0x0b09('0x5')]();var fs_extra=require(_0x0b09('0x6'));var auth=require(_0x0b09('0x7'));var interaction=require(_0x0b09('0x8'));var config=require(_0x0b09('0x9'));var controller=require(_0x0b09('0xa'));router[_0x0b09('0xb')]('/',auth[_0x0b09('0xc')](),controller['index']);router[_0x0b09('0xb')](_0x0b09('0xd'),auth[_0x0b09('0xc')](),controller['show']);router[_0x0b09('0xb')](_0x0b09('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x0b09('0xc')](),controller[_0x0b09('0xf')]);router[_0x0b09('0x10')]('/',auth[_0x0b09('0xc')](),controller[_0x0b09('0x11')]);router[_0x0b09('0x10')](_0x0b09('0xe'),auth[_0x0b09('0xc')](),controller[_0x0b09('0x12')]);router[_0x0b09('0x13')]('/:id',auth[_0x0b09('0xc')](),controller['update']);router[_0x0b09('0x14')](_0x0b09('0xd'),auth[_0x0b09('0xc')](),controller[_0x0b09('0x15')]);module[_0x0b09('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f0779dd..981f6b7 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 _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 +var _0x873a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1c1eb0,_0x5e6aaf){var _0x4e12d7=function(_0x591be9){while(--_0x591be9){_0x1c1eb0['push'](_0x1c1eb0['shift']());}};_0x4e12d7(++_0x5e6aaf);}(_0x873a,0x1c2));var _0xa873=function(_0x2a7873,_0xe7a2b8){_0x2a7873=_0x2a7873-0x0;var _0x436bf4=_0x873a[_0x2a7873];return _0x436bf4;};'use strict';var Sequelize=require(_0xa873('0x0'));module[_0xa873('0x1')]={'name':{'type':Sequelize[_0xa873('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa873('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa873('0x2')]},'clientSecret':{'type':Sequelize[_0xa873('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa873('0x2')]},'modernAuthentication':{'type':Sequelize[_0xa873('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 5426832..7f9b30a 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 _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 +var _0xc882=['modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','/oauth2/token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','remove','includes','LogicalName','forEach','@odata.type','all','isNil','BooleanAttributeMetadata','push','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','error','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','update','then','end','sendStatus','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname'];(function(_0x530db1,_0x2b9531){var _0x31c1f2=function(_0x1c77b3){while(--_0x1c77b3){_0x530db1['push'](_0x530db1['shift']());}};_0x31c1f2(++_0x2b9531);}(_0xc882,0xff));var _0x2c88=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc882[_0x17d9e3];return _0x14192d;};'use strict';var rp=require(_0x2c88('0x0'));var util=require(_0x2c88('0x1'));var _=require(_0x2c88('0x2'));var qs=require(_0x2c88('0x3'));var logger=require(_0x2c88('0x4'))(_0x2c88('0x5'));var db=require(_0x2c88('0x6'))['db'];var integrations=require(_0x2c88('0x7'));function respondWithResult(_0x23e92c,_0x359f11){_0x359f11=_0x359f11||0xc8;return function(_0x32d31e){if(_0x32d31e){return _0x23e92c[_0x2c88('0x8')](_0x359f11)[_0x2c88('0x9')](_0x32d31e);}};}function respondWithFilteredResult(_0x15eadc,_0x26bfea){return function(_0x4da29d){if(_0x4da29d){var _0x5e2f93=typeof _0x26bfea['offset']===_0x2c88('0xa')&&typeof _0x26bfea[_0x2c88('0xb')]==='undefined';var _0x1ee743=_0x4da29d[_0x2c88('0xc')];var _0x5df60c=_0x5e2f93?0x0:_0x26bfea[_0x2c88('0xd')];var _0x183b3b=_0x5e2f93?_0x4da29d[_0x2c88('0xc')]:_0x26bfea['offset']+_0x26bfea[_0x2c88('0xb')];var _0x259e9f;if(_0x183b3b>=_0x1ee743){_0x183b3b=_0x1ee743;_0x259e9f=0xc8;}else{_0x259e9f=0xce;}_0x15eadc['status'](_0x259e9f);return _0x15eadc[_0x2c88('0xe')](_0x2c88('0xf'),_0x5df60c+'-'+_0x183b3b+'/'+_0x1ee743)['json'](_0x4da29d);}return null;};}function saveUpdates(_0x52d5f4){return function(_0x16e9a9){if(_0x16e9a9){return _0x16e9a9[_0x2c88('0x10')](_0x52d5f4)[_0x2c88('0x11')](function(_0x5e099f){return _0x5e099f;});}return null;};}function removeEntity(_0x582300){return function(_0x3e3729){if(_0x3e3729){return _0x3e3729['destroy']()[_0x2c88('0x11')](function(){_0x582300[_0x2c88('0x8')](0xcc)[_0x2c88('0x12')]();});}};}function handleEntityNotFound(_0x45a679){return function(_0x3fb359){if(!_0x3fb359){_0x45a679[_0x2c88('0x13')](0x194);}return _0x3fb359;};}function handleError(_0x5039d8,_0x4e13dc){_0x4e13dc=_0x4e13dc||0x1f4;return function(_0x37b8fe){logger['error'](_0x37b8fe['stack']);if(_0x37b8fe[_0x2c88('0x14')]){delete _0x37b8fe[_0x2c88('0x14')];}_0x5039d8[_0x2c88('0x8')](_0x4e13dc)[_0x2c88('0x15')](_0x37b8fe);};}exports[_0x2c88('0x16')]=function(_0x26a9b5,_0x4a81e5){var _0x1125ef={},_0x1ca00f={},_0x23e02a={'count':0x0,'rows':[]};var _0x322d5c=_['map'](db[_0x2c88('0x17')][_0x2c88('0x18')],function(_0x201cb6){return{'name':_0x201cb6[_0x2c88('0x19')],'type':_0x201cb6['type'][_0x2c88('0x1a')]};});_0x1ca00f['model']=_[_0x2c88('0x1b')](_0x322d5c,'name');_0x1ca00f[_0x2c88('0x1c')]=_[_0x2c88('0x1d')](_0x26a9b5[_0x2c88('0x1c')]);_0x1ca00f[_0x2c88('0x1e')]=_[_0x2c88('0x1f')](_0x1ca00f['model'],_0x1ca00f['query']);_0x1125ef[_0x2c88('0x20')]=_[_0x2c88('0x1f')](_0x1ca00f['model'],qs['fields'](_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0x21')]));_0x1125ef[_0x2c88('0x20')]=_0x1125ef[_0x2c88('0x20')][_0x2c88('0x22')]?_0x1125ef[_0x2c88('0x20')]:_0x1ca00f[_0x2c88('0x23')];if(!_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0x24')]('nolimit')){_0x1125ef['limit']=qs['limit'](_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0xb')]);_0x1125ef[_0x2c88('0xd')]=qs['offset'](_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0xd')]);}_0x1125ef[_0x2c88('0x25')]=qs[_0x2c88('0x26')](_0x26a9b5[_0x2c88('0x1c')]['sort']);_0x1125ef['where']=qs['filters'](_[_0x2c88('0x27')](_0x26a9b5[_0x2c88('0x1c')],_0x1ca00f[_0x2c88('0x1e')]),_0x322d5c);if(_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0x28')]){_0x1125ef[_0x2c88('0x29')]=_[_0x2c88('0x2a')](_0x1125ef[_0x2c88('0x29')],{'$or':_[_0x2c88('0x1b')](_0x322d5c,function(_0x1bde07){if(_0x1bde07[_0x2c88('0x2b')]!=='VIRTUAL'){var _0x57f58e={};_0x57f58e[_0x1bde07['name']]={'$like':'%'+_0x26a9b5[_0x2c88('0x1c')]['filter']+'%'};return _0x57f58e;}})});}_0x1125ef=_['merge']({},_0x1125ef,_0x26a9b5[_0x2c88('0x2c')]);var _0x44867e={'where':_0x1125ef[_0x2c88('0x29')]};return db[_0x2c88('0x17')]['count'](_0x44867e)['then'](function(_0x633639){_0x23e02a['count']=_0x633639;if(_0x26a9b5['query'][_0x2c88('0x2d')]){_0x1125ef[_0x2c88('0x2e')]=[{'all':!![]}];}return db[_0x2c88('0x17')][_0x2c88('0x2f')](_0x1125ef);})[_0x2c88('0x11')](function(_0x5d5911){_0x23e02a[_0x2c88('0x30')]=_0x5d5911;return _0x23e02a;})['then'](respondWithFilteredResult(_0x4a81e5,_0x1125ef))['catch'](handleError(_0x4a81e5,null));};exports[_0x2c88('0x31')]=function(_0x3e0bf0,_0x27db55){var _0x46be58={'raw':![],'where':{'id':_0x3e0bf0[_0x2c88('0x32')]['id']}},_0x409171={};_0x409171[_0x2c88('0x23')]=_[_0x2c88('0x1d')](db[_0x2c88('0x17')]['rawAttributes']);_0x409171[_0x2c88('0x1c')]=_[_0x2c88('0x1d')](_0x3e0bf0[_0x2c88('0x1c')]);_0x409171[_0x2c88('0x1e')]=_[_0x2c88('0x1f')](_0x409171['model'],_0x409171['query']);_0x46be58[_0x2c88('0x20')]=_[_0x2c88('0x1f')](_0x409171[_0x2c88('0x23')],qs[_0x2c88('0x21')](_0x3e0bf0['query'][_0x2c88('0x21')]));_0x46be58[_0x2c88('0x20')]=_0x46be58[_0x2c88('0x20')][_0x2c88('0x22')]?_0x46be58[_0x2c88('0x20')]:_0x409171[_0x2c88('0x23')];if(_0x3e0bf0[_0x2c88('0x1c')][_0x2c88('0x2d')]){_0x46be58[_0x2c88('0x2e')]=[{'all':!![]}];}_0x46be58=_[_0x2c88('0x2a')]({},_0x46be58,_0x3e0bf0[_0x2c88('0x2c')]);return db[_0x2c88('0x17')][_0x2c88('0x33')](_0x46be58)['then'](handleEntityNotFound(_0x27db55,null))[_0x2c88('0x11')](respondWithResult(_0x27db55,null))[_0x2c88('0x34')](handleError(_0x27db55,null));};exports[_0x2c88('0x35')]=function(_0x4d8cc7,_0x10d1eb){return db[_0x2c88('0x17')][_0x2c88('0x35')](_0x4d8cc7[_0x2c88('0x36')],{})[_0x2c88('0x11')](respondWithResult(_0x10d1eb,0xc9))[_0x2c88('0x34')](handleError(_0x10d1eb,null));};exports[_0x2c88('0x10')]=function(_0x5af77f,_0x12dfc5){if(_0x5af77f[_0x2c88('0x36')]['id']){delete _0x5af77f['body']['id'];}return db['Dynamics365Account'][_0x2c88('0x33')]({'where':{'id':_0x5af77f[_0x2c88('0x32')]['id']}})['then'](handleEntityNotFound(_0x12dfc5,null))[_0x2c88('0x11')](saveUpdates(_0x5af77f[_0x2c88('0x36')],null))['then'](respondWithResult(_0x12dfc5,null))['catch'](handleError(_0x12dfc5,null));};exports[_0x2c88('0x37')]=function(_0x163ee0,_0x425460){return db['Dynamics365Account'][_0x2c88('0x33')]({'where':{'id':_0x163ee0['params']['id']}})[_0x2c88('0x11')](handleEntityNotFound(_0x425460,null))[_0x2c88('0x11')](removeEntity(_0x425460,null))[_0x2c88('0x34')](handleError(_0x425460,null));};exports[_0x2c88('0x38')]=function(_0x4d6c64,_0x259718){var _0x4618a9={};var _0xdc614b={};var _0x452f77;var _0x27bd1d;return db[_0x2c88('0x17')][_0x2c88('0x39')]({'where':{'id':_0x4d6c64[_0x2c88('0x32')]['id']}})[_0x2c88('0x11')](handleEntityNotFound(_0x259718,null))[_0x2c88('0x11')](function(_0x20dd2b){if(_0x20dd2b){_0x452f77=_0x20dd2b;_0xdc614b[_0x2c88('0x23')]=_[_0x2c88('0x1d')](db[_0x2c88('0x3a')][_0x2c88('0x18')]);_0xdc614b[_0x2c88('0x1c')]=_[_0x2c88('0x1d')](_0x4d6c64['query']);_0xdc614b[_0x2c88('0x1e')]=_[_0x2c88('0x1f')](_0xdc614b['model'],_0xdc614b[_0x2c88('0x1c')]);_0x4618a9[_0x2c88('0x20')]=_[_0x2c88('0x1f')](_0xdc614b[_0x2c88('0x23')],qs['fields'](_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x21')]));_0x4618a9[_0x2c88('0x20')]=_0x4618a9[_0x2c88('0x20')][_0x2c88('0x22')]?_0x4618a9[_0x2c88('0x20')]:_0xdc614b['model'];_0x4618a9['order']=qs[_0x2c88('0x26')](_0x4d6c64[_0x2c88('0x1c')]['sort']);_0x4618a9['where']=qs['filters'](_['pick'](_0x4d6c64['query'],_0xdc614b[_0x2c88('0x1e')]));if(_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x28')]){_0x4618a9['where']=_[_0x2c88('0x2a')](_0x4618a9['where'],{'$or':_[_0x2c88('0x1b')](_0x4618a9[_0x2c88('0x20')],function(_0x47abdb){var _0x5c1204={};_0x5c1204[_0x47abdb]={'$like':'%'+_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x28')]+'%'};return _0x5c1204;})});}_0x4618a9=_[_0x2c88('0x2a')]({},_0x4618a9,_0x4d6c64['options']);return _0x452f77['getConfigurations'](_0x4618a9);}})[_0x2c88('0x11')](function(_0x5516c9){if(_0x5516c9){_0x27bd1d=_0x5516c9[_0x2c88('0x22')];if(!_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x24')]('nolimit')){_0x4618a9[_0x2c88('0xb')]=qs[_0x2c88('0xb')](_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0xb')]);_0x4618a9[_0x2c88('0xd')]=qs[_0x2c88('0xd')](_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0xd')]);}return _0x452f77[_0x2c88('0x38')](_0x4618a9);}})['then'](function(_0x1361ce){if(_0x1361ce){return _0x1361ce?{'count':_0x27bd1d,'rows':_0x1361ce}:null;}})[_0x2c88('0x11')](respondWithResult(_0x259718,null))[_0x2c88('0x34')](handleError(_0x259718,null));};exports[_0x2c88('0x3b')]=function(_0xb132f2,_0x1fc3e9){if(_0xb132f2[_0x2c88('0x36')]['id']){delete _0xb132f2['body']['id'];}return db[_0x2c88('0x17')][_0x2c88('0x39')]({'where':{'id':_0xb132f2[_0x2c88('0x32')]['id']}})[_0x2c88('0x11')](handleEntityNotFound(_0x1fc3e9,null))[_0x2c88('0x11')](function(_0x555db9){if(_0x555db9){_0xb132f2[_0x2c88('0x36')][_0x2c88('0x3c')]=_0x555db9['id'];_0xb132f2[_0x2c88('0x36')][_0x2c88('0x3d')]=integrations[_0x2c88('0x3e')](_0xb132f2[_0x2c88('0x36')][_0x2c88('0x3f')],_0xb132f2[_0x2c88('0x36')][_0x2c88('0x2b')]);_0xb132f2[_0x2c88('0x36')][_0x2c88('0x40')]=integrations['getDescriptions'](_0xb132f2[_0x2c88('0x36')]['channel'],_0xb132f2['body'][_0x2c88('0x2b')]);return db[_0x2c88('0x3a')][_0x2c88('0x35')](_0xb132f2[_0x2c88('0x36')],{'include':[{'model':db[_0x2c88('0x41')],'as':_0x2c88('0x3d')},{'model':db['Dynamics365Field'],'as':_0x2c88('0x40')}]});}return null;})['then'](respondWithResult(_0x1fc3e9,null))['catch'](handleError(_0x1fc3e9,null));};function sanitizeRemoteUri(_0x1d396e){var _0xf36221=_0x1d396e[_0x2c88('0x42')](-0x1);if(_0xf36221==='/')return _0x1d396e[_0x2c88('0x43')](0x0,_0x1d396e[_0x2c88('0x44')](_0xf36221));return _0x1d396e;}function getWebApiUrl(_0x5e0e2f){return util[_0x2c88('0x45')]('%s/api/data/v9.0/',_0x5e0e2f);}exports[_0x2c88('0x46')]=function(_0x2638f3,_0x48d1d8){var _0x343311=_0x2638f3[_0x2c88('0x1c')][_0x2c88('0x47')];var _0x69d747=_0x343311==='incident'?_0x2c88('0x48'):_0x2c88('0x49');var _0x3ea3b1='';var _0x10c8d8='';var _0x375de0='';var _0x166e94='';var _0x5dce1a='';var _0x1df0b0='';var _0xbc1289='';var _0x24e091='';var _0x3e2641=[_0x2c88('0x4a'),'description',_0x2c88('0x4b'),_0x2c88('0x4c'),_0x2c88('0x4d'),_0x2c88('0x4e'),'phonenumber',_0x2c88('0x4f'),'directioncode',_0x2c88('0x50')];var _0x3ea7d4=[_0x2c88('0x51'),_0x2c88('0x52'),'actualserviceunits',_0x2c88('0x53'),_0x2c88('0x54'),'contactidyominame',_0x2c88('0x55'),_0x2c88('0x56'),'createdbyexternalpartyname',_0x2c88('0x57'),_0x2c88('0x58'),_0x2c88('0x59'),_0x2c88('0x5a'),_0x2c88('0x5b'),'createdonbehalfbyyominame','customeridname',_0x2c88('0x5c'),_0x2c88('0x5d'),'emailaddress',_0x2c88('0x5e'),_0x2c88('0x5f'),_0x2c88('0x60'),'escalatedon',_0x2c88('0x61'),'firstresponsebykpiidname',_0x2c88('0x62'),'importsequencenumber',_0x2c88('0x63'),_0x2c88('0x64'),_0x2c88('0x65'),_0x2c88('0x66'),_0x2c88('0x67'),_0x2c88('0x68'),_0x2c88('0x69'),_0x2c88('0x6a'),_0x2c88('0x6b'),_0x2c88('0x6c'),_0x2c88('0x6d'),_0x2c88('0x6e'),'msdyn_iotalertname',_0x2c88('0x6f'),_0x2c88('0x70'),'overriddencreatedon','owneridname',_0x2c88('0x71'),_0x2c88('0x72'),_0x2c88('0x73'),_0x2c88('0x74'),'primarycontactidyominame',_0x2c88('0x75'),_0x2c88('0x76'),'productserialnumber','resolveby',_0x2c88('0x77'),'responseby',_0x2c88('0x78'),_0x2c88('0x79'),_0x2c88('0x7a'),_0x2c88('0x7b'),_0x2c88('0x7c'),_0x2c88('0x7d'),_0x2c88('0x7e'),_0x2c88('0x7f'),'subjectidname','ticketnumber',_0x2c88('0x80'),_0x2c88('0x81'),_0x2c88('0x82'),_0x2c88('0x83'),_0x2c88('0x84')];var _0x129715=_0x3e2641[_0x2c88('0x85')](_0x3ea7d4);return db['Dynamics365Account'][_0x2c88('0x39')]({'where':{'id':_0x2638f3[_0x2c88('0x32')]['id']},'attributes':['id','username',_0x2c88('0x86'),_0x2c88('0x87'),_0x2c88('0x88'),_0x2c88('0x89'),_0x2c88('0x8a'),_0x2c88('0x8b')],'include':[{'model':db[_0x2c88('0x8c')],'as':_0x2c88('0x8c'),'attributes':['id',_0x2c88('0x8d'),_0x2c88('0x8e')]}]})[_0x2c88('0x11')](handleEntityNotFound(_0x48d1d8,null))[_0x2c88('0x11')](function(_0x4280f0){if(_0x4280f0){if(_0x4280f0[_0x2c88('0x8b')]){_0x4280f0['access_token']=_0x4280f0[_0x2c88('0x8c')][_0x2c88('0x8d')];_0x24e091=sanitizeRemoteUri(_0x4280f0[_0x2c88('0x8c')][_0x2c88('0x8e')]);_0xbc1289=getWebApiUrl(_0x24e091);return _0x4280f0;}_0x24e091=sanitizeRemoteUri(_0x4280f0['remoteUri']);_0xbc1289=getWebApiUrl(_0x24e091);var _0x31b1fd={'method':_0x2c88('0x8f'),'uri':'https://login.microsoftonline.com/'+_0x4280f0[_0x2c88('0x88')]+_0x2c88('0x90'),'form':{'client_id':_0x4280f0[_0x2c88('0x89')],'resource':_0x24e091,'username':_0x4280f0['username'],'password':_0x4280f0[_0x2c88('0x86')],'grant_type':_0x2c88('0x86'),'client_secret':_0x4280f0[_0x2c88('0x8a')]},'json':!![]};return rp(_0x31b1fd);}})[_0x2c88('0x11')](function(_0x74502f){_0x1df0b0=_0x74502f['access_token'];var _0x561dd9={'method':_0x2c88('0x91'),'uri':encodeURI(_0xbc1289+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x69d747+'\x27'),'headers':{'Authorization':_0x2c88('0x92')+_0x1df0b0,'If-None-Match':null,'OData-Version':_0x2c88('0x93')},'json':!![]};return rp(_0x561dd9);})['then'](function(_0x3ef4ee){var _0xfa4cba=_0x3ef4ee[_0x2c88('0x94')][0x0];var _0x3832ca=_0xfa4cba[_0x2c88('0x95')];var _0x415de5={'method':_0x2c88('0x91'),'uri':_0xbc1289+_0x2c88('0x96')+_0x3832ca+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x2c88('0x92')+_0x1df0b0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x415de5);})[_0x2c88('0x11')](function(_0x2b833b){_0x3ea3b1=_0x2b833b;_0x10c8d8=_0x3ea3b1['Attributes'];_0x10c8d8=_[_0x2c88('0x97')](_0x10c8d8,function(_0x1ac309){return!_0x129715[_0x2c88('0x98')](_0x1ac309[_0x2c88('0x99')]);});var _0x42e0cc=[];var _0x5e2de6=[];_0x10c8d8[_0x2c88('0x9a')](function(_0x1a1220){if(_0x1a1220[_0x2c88('0x9b')]){var _0x55d38d=_0x1a1220[_0x2c88('0x9b')][_0x2c88('0x43')](_0x1a1220['@odata.type'][_0x2c88('0x44')]('.')+0x1);if(_0x55d38d==='PicklistAttributeMetadata'){_0x42e0cc['push'](getSelectList(_0xbc1289,_0x343311,_0x5e2de6,_0x3ea3b1[_0x2c88('0x95')],_0x1a1220['MetadataId'],_0x1df0b0));}}});return Promise[_0x2c88('0x9c')](_0x42e0cc);})[_0x2c88('0x11')](function(_0x42e69e){_0x375de0=_0x42e69e[0x0];var _0x2116ce=[];var _0xeafebd=[];_0x10c8d8['forEach'](function(_0x401dd6){if(!_[_0x2c88('0x9d')](_0x401dd6['@odata.type'])){var _0x55c537=_0x401dd6[_0x2c88('0x9b')][_0x2c88('0x43')](_0x401dd6[_0x2c88('0x9b')][_0x2c88('0x44')]('.')+0x1);if(_0x55c537===_0x2c88('0x9e')){_0x2116ce[_0x2c88('0x9f')](getBooleanList(_0xbc1289,_0x343311,_0xeafebd,_0x3ea3b1['MetadataId'],_0x401dd6[_0x2c88('0x95')],_0x1df0b0));}}});return Promise[_0x2c88('0x9c')](_0x2116ce);})[_0x2c88('0x11')](function(_0x41f6ab){_0x166e94=_0x41f6ab[0x0];var _0x2e55e8=[];var _0x35b531=[];_0x10c8d8[_0x2c88('0x9a')](function(_0x1ccca3){if(_0x1ccca3['@odata.type']){var _0x1689c2=_0x1ccca3[_0x2c88('0x9b')][_0x2c88('0x43')](_0x1ccca3[_0x2c88('0x9b')][_0x2c88('0x44')]('.')+0x1);if(_0x1689c2==='StringAttributeMetadata'||_0x1689c2==='DoubleAttributeMetadata'||_0x1689c2===_0x2c88('0xa0')||_0x1689c2===_0x2c88('0xa1')||_0x1689c2===_0x2c88('0xa2')||_0x1689c2===_0x2c88('0xa3')||_0x1689c2===_0x2c88('0xa4')||_0x1689c2===_0x2c88('0xa5')||_0x1689c2===_0x2c88('0xa6')||_0x1689c2==='DecimalAttributeMetadata'){_0x2e55e8[_0x2c88('0x9f')](getInputList(_0xbc1289,_0x343311,_0x1689c2,_0x35b531,_0x3ea3b1[_0x2c88('0x95')],_0x1ccca3['MetadataId'],_0x1df0b0));}}});return Promise['all'](_0x2e55e8);})['then'](function(_0x15f01c){_0x5dce1a=_0x15f01c[0x0];var _0x25097a=_0x375de0['concat'](_0x166e94)[_0x2c88('0x85')](_0x5dce1a);var _0x507d6a={'count':_0x25097a['length'],'rows':_0x25097a};return _0x507d6a;})[_0x2c88('0x11')](respondWithResult(_0x48d1d8,null))[_0x2c88('0x34')](function(_0x6684e1){var _0x15dab7=_0x2638f3[_0x2c88('0x1c')]['test']?0x1f4:_0x6684e1[_0x2c88('0xa7')]||0x1f4;logger[_0x2c88('0xa8')](_0x6684e1['stack']);delete _0x6684e1[_0x2c88('0x14')];if(_0x15dab7===0x191){_0x15dab7=0x190;}_0x48d1d8[_0x2c88('0x8')](_0x15dab7)[_0x2c88('0x15')](_0x2638f3[_0x2c88('0x1c')]['test']?{'message':_0x2c88('0xa9'),'statusCode':_0x6684e1[_0x2c88('0xa7')]}:_0x6684e1);});};function getSelectList(_0x34fdc3,_0x2dc4a6,_0x4b4dba,_0x25a882,_0x4be5c5,_0x713797){var _0x236b17={'method':_0x2c88('0x91'),'uri':_0x34fdc3+_0x2c88('0x96')+_0x25a882+_0x2c88('0xaa')+_0x4be5c5+_0x2c88('0xab')+_0x2c88('0xac'),'headers':{'Authorization':_0x2c88('0x92')+_0x713797,'If-None-Match':null,'OData-Version':_0x2c88('0x93')},'json':!![]};return rp(_0x236b17)[_0x2c88('0x11')](function(_0x32bdcd){var _0x1fb40b=[];var _0x53beae=_0x32bdcd[_0x2c88('0xad')][_0x2c88('0xae')];_0x53beae[_0x2c88('0x9a')](function(_0x3e02ee){_0x1fb40b[_0x2c88('0x9f')]({'name':_0x3e02ee[_0x2c88('0xaf')][_0x2c88('0xb0')][_0x2c88('0xaf')],'value':String(_0x3e02ee[_0x2c88('0xb1')])});});var _0x3ac423={'id':_0x2dc4a6+'_'+_0x32bdcd[_0x2c88('0x99')],'name':_0x32bdcd[_0x2c88('0xb2')][_0x2c88('0xb0')][_0x2c88('0xaf')],'custom':![],'options':_0x1fb40b};_0x4b4dba[_0x2c88('0x9f')](_0x3ac423);return _0x4b4dba;});}function getBooleanList(_0x17305e,_0x4eea47,_0x59456d,_0x5bcd65,_0x3a9ca7,_0x338180){var _0x35ef52={'method':_0x2c88('0x91'),'uri':_0x17305e+_0x2c88('0x96')+_0x5bcd65+_0x2c88('0xaa')+_0x3a9ca7+_0x2c88('0xb3'),'headers':{'Authorization':_0x2c88('0x92')+_0x338180,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x35ef52)[_0x2c88('0x11')](function(_0x11122b){var _0x4389cf=[];_0x4389cf[_0x2c88('0x9f')]({'name':_0x11122b['OptionSet']['TrueOption'][_0x2c88('0xaf')]['UserLocalizedLabel'][_0x2c88('0xaf')],'value':'true'},{'name':_0x11122b[_0x2c88('0xad')]['FalseOption']['Label'][_0x2c88('0xb0')][_0x2c88('0xaf')],'value':_0x2c88('0xb4')});var _0x4649a6={'id':_0x4eea47+'_'+_0x11122b[_0x2c88('0x99')],'name':_0x11122b[_0x2c88('0xb2')][_0x2c88('0xb0')][_0x2c88('0xaf')],'custom':![],'options':_0x4389cf};_0x59456d[_0x2c88('0x9f')](_0x4649a6);return _0x59456d;});}function getInputList(_0x14169e,_0x54a87c,_0x14bc7b,_0x3dd5ea,_0x3a35b7,_0x5885ac,_0x45fc52){var _0x277397={'method':_0x2c88('0x91'),'uri':_0x14169e+'EntityDefinitions('+_0x3a35b7+')/Attributes('+_0x5885ac+')/Microsoft.Dynamics.CRM.'+_0x14bc7b+_0x2c88('0xb5'),'headers':{'Authorization':_0x2c88('0x92')+_0x45fc52,'If-None-Match':null,'OData-Version':_0x2c88('0x93')},'json':!![]};return rp(_0x277397)[_0x2c88('0x11')](function(_0x11dabb){var _0x58167b={'id':_0x54a87c+'_'+_0x11dabb['LogicalName'],'name':_0x11dabb['DisplayName'][_0x2c88('0xb0')]?_0x11dabb[_0x2c88('0xb2')][_0x2c88('0xb0')][_0x2c88('0xaf')]:_0x11dabb[_0x2c88('0x99')],'custom':![],'options':[]};_0x3dd5ea['push'](_0x58167b);return _0x3dd5ea;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5950bf2..874ee3a 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 _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 +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x3805eb,_0x380033){var _0x565582=function(_0x106a85){while(--_0x106a85){_0x3805eb['push'](_0x3805eb['shift']());}};_0x565582(++_0x380033);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb7e7[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 c44dcd8..2c1bb01 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 _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 +var _0xa346=['../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','GetDynamics365Account','find','ShowDynamics365Account','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x21ceee,_0x44fb20){var _0x33add3=function(_0x2c7dfb){while(--_0x2c7dfb){_0x21ceee['push'](_0x21ceee['shift']());}};_0x33add3(++_0x44fb20);}(_0xa346,0xe1));var _0x6a34=function(_0x9a98d9,_0x2dd2c7){_0x9a98d9=_0x9a98d9-0x0;var _0x5da06b=_0xa346[_0x9a98d9];return _0x5da06b;};'use strict';var _=require(_0x6a34('0x0'));var util=require(_0x6a34('0x1'));var moment=require(_0x6a34('0x2'));var BPromise=require(_0x6a34('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a34('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a34('0x5'))('rpc');var config=require(_0x6a34('0x6'));var jayson=require(_0x6a34('0x7'));var client=jayson['client'][_0x6a34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbbcfd0,_0x383151,_0x2a7adc){return new BPromise(function(_0x501093,_0x5903ed){return client['request'](_0xbbcfd0,_0x2a7adc)[_0x6a34('0x9')](function(_0x5a2b3c){logger[_0x6a34('0xa')](_0x6a34('0xb'),_0x383151,_0x6a34('0xc'));logger[_0x6a34('0xd')](_0x6a34('0xe'),_0x383151,_0x6a34('0xc'),JSON[_0x6a34('0xf')](_0x5a2b3c));if(_0x5a2b3c[_0x6a34('0x10')]){if(_0x5a2b3c[_0x6a34('0x10')][_0x6a34('0x11')]===0x1f4){logger[_0x6a34('0x10')](_0x6a34('0xb'),_0x383151,_0x5a2b3c[_0x6a34('0x10')][_0x6a34('0x12')]);return _0x5903ed(_0x5a2b3c[_0x6a34('0x10')][_0x6a34('0x12')]);}logger['error'](_0x6a34('0xb'),_0x383151,_0x5a2b3c['error']['message']);return _0x501093(_0x5a2b3c[_0x6a34('0x10')]['message']);}else{logger['info'](_0x6a34('0xb'),_0x383151,_0x6a34('0xc'));_0x501093(_0x5a2b3c['result'][_0x6a34('0x12')]);}})[_0x6a34('0x13')](function(_0x516ccb){logger[_0x6a34('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x383151,_0x516ccb);_0x5903ed(_0x516ccb);});});}exports['GetDynamics365Account']=function(_0x177ca3){var _0x3cc514=this;return new Promise(function(_0x3fc16b,_0x3336e6){return db[_0x6a34('0x14')][_0x6a34('0x15')]({'raw':_0x177ca3[_0x6a34('0x16')]?_0x177ca3[_0x6a34('0x16')][_0x6a34('0x17')]===undefined?!![]:![]:!![],'where':_0x177ca3['options']?_0x177ca3[_0x6a34('0x16')][_0x6a34('0x18')]||null:null,'attributes':_0x177ca3[_0x6a34('0x16')]?_0x177ca3['options'][_0x6a34('0x19')]||null:null,'limit':_0x177ca3[_0x6a34('0x16')]?_0x177ca3['options'][_0x6a34('0x1a')]||null:null,'include':_0x177ca3[_0x6a34('0x16')]?_0x177ca3['options'][_0x6a34('0x1b')]?_['map'](_0x177ca3[_0x6a34('0x16')][_0x6a34('0x1b')],function(_0x2305ee){return{'model':db[_0x2305ee[_0x6a34('0x1c')]],'as':_0x2305ee['as'],'attributes':_0x2305ee[_0x6a34('0x19')],'include':_0x2305ee[_0x6a34('0x1b')]?_['map'](_0x2305ee[_0x6a34('0x1b')],function(_0x47bc55){return{'model':db[_0x47bc55[_0x6a34('0x1c')]],'as':_0x47bc55['as'],'attributes':_0x47bc55[_0x6a34('0x19')],'include':_0x47bc55[_0x6a34('0x1b')]?_[_0x6a34('0x1d')](_0x47bc55[_0x6a34('0x1b')],function(_0x3ce7cf){return{'model':db[_0x3ce7cf[_0x6a34('0x1c')]],'as':_0x3ce7cf['as'],'attributes':_0x3ce7cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x6a34('0x9')](function(_0x27fa8d){logger['info'](_0x6a34('0x1e'),_0x177ca3);logger['debug'](_0x6a34('0x1e'),_0x177ca3,JSON[_0x6a34('0xf')](_0x27fa8d));_0x3fc16b(_0x27fa8d);})['catch'](function(_0x23ac0d){logger[_0x6a34('0x10')](_0x6a34('0x1e'),_0x23ac0d[_0x6a34('0x12')],_0x177ca3);_0x3336e6(_0x3cc514[_0x6a34('0x10')](0x1f4,_0x23ac0d[_0x6a34('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x57f499){var _0x5ad2aa=this;return new Promise(function(_0x46514c,_0x403497){return db[_0x6a34('0x14')][_0x6a34('0x1f')]({'raw':_0x57f499[_0x6a34('0x16')]?_0x57f499[_0x6a34('0x16')][_0x6a34('0x17')]===undefined?!![]:![]:!![],'where':_0x57f499['options']?_0x57f499[_0x6a34('0x16')][_0x6a34('0x18')]||null:null,'attributes':_0x57f499[_0x6a34('0x16')]?_0x57f499[_0x6a34('0x16')][_0x6a34('0x19')]||null:null,'include':_0x57f499[_0x6a34('0x16')]?_0x57f499[_0x6a34('0x16')][_0x6a34('0x1b')]?_[_0x6a34('0x1d')](_0x57f499['options'][_0x6a34('0x1b')],function(_0x2e277d){return{'model':db[_0x2e277d[_0x6a34('0x1c')]],'as':_0x2e277d['as'],'attributes':_0x2e277d[_0x6a34('0x19')],'include':_0x2e277d['include']?_['map'](_0x2e277d[_0x6a34('0x1b')],function(_0x3a5c78){return{'model':db[_0x3a5c78[_0x6a34('0x1c')]],'as':_0x3a5c78['as'],'attributes':_0x3a5c78[_0x6a34('0x19')],'include':_0x3a5c78['include']?_[_0x6a34('0x1d')](_0x3a5c78[_0x6a34('0x1b')],function(_0x4bf84e){return{'model':db[_0x4bf84e[_0x6a34('0x1c')]],'as':_0x4bf84e['as'],'attributes':_0x4bf84e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6a34('0x9')](function(_0x8c3778){logger[_0x6a34('0xa')](_0x6a34('0x20'),_0x57f499);logger[_0x6a34('0xd')](_0x6a34('0x20'),_0x57f499,JSON['stringify'](_0x8c3778));_0x46514c(_0x8c3778);})[_0x6a34('0x13')](function(_0x1501e5){logger[_0x6a34('0x10')](_0x6a34('0x20'),_0x1501e5[_0x6a34('0x12')],_0x57f499);_0x403497(_0x5ad2aa['error'](0x1f4,_0x1501e5[_0x6a34('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 541fdea..a13b7a7 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 _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 +var _0x7932=['/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5ae8c0,_0x50ccd0){var _0x48716e=function(_0x123cee){while(--_0x123cee){_0x5ae8c0['push'](_0x5ae8c0['shift']());}};_0x48716e(++_0x50ccd0);}(_0x7932,0xf0));var _0x2793=function(_0x41c826,_0x3fd04f){_0x41c826=_0x41c826-0x0;var _0x5adb33=_0x7932[_0x41c826];return _0x5adb33;};'use strict';var multer=require(_0x2793('0x0'));var util=require(_0x2793('0x1'));var path=require('path');var timeout=require(_0x2793('0x2'));var express=require(_0x2793('0x3'));var router=express[_0x2793('0x4')]();var fs_extra=require(_0x2793('0x5'));var auth=require(_0x2793('0x6'));var interaction=require(_0x2793('0x7'));var config=require(_0x2793('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x2793('0x9')]('/',auth[_0x2793('0xa')](),controller[_0x2793('0xb')]);router[_0x2793('0x9')](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['show']);router['get'](_0x2793('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x2793('0x9')](_0x2793('0xe'),auth['isAuthenticated'](),controller[_0x2793('0xf')]);router[_0x2793('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2793('0x10')]);router[_0x2793('0x11')]('/',auth[_0x2793('0xa')](),controller[_0x2793('0x12')]);router['put'](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['update']);router[_0x2793('0x13')](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['destroy']);module[_0x2793('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 354d66b..ea189af 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 _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 +var _0xbd85=['sequelize','exports','ENUM','incident','phonecall','contact','nothing','STRING'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xbd85,0x190));var _0x5bd8=function(_0x41d902,_0x29d0b){_0x41d902=_0x41d902-0x0;var _0x360fb1=_0xbd85[_0x41d902];return _0x360fb1;};'use strict';var Sequelize=require(_0x5bd8('0x0'));module[_0x5bd8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5bd8('0x2')](_0x5bd8('0x3'),_0x5bd8('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x5bd8('0x5'),_0x5bd8('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5bd8('0x7')],'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 f1a4100..e7cc15e 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 _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 +var _0x50ad=['send','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','body','destroy','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name'];(function(_0x4851ff,_0x1c9a8d){var _0x26773b=function(_0x26c33e){while(--_0x26c33e){_0x4851ff['push'](_0x4851ff['shift']());}};_0x26773b(++_0x1c9a8d);}(_0x50ad,0x16c));var _0xd50a=function(_0x1c1bf5,_0x4fc8e6){_0x1c1bf5=_0x1c1bf5-0x0;var _0xa3389=_0x50ad[_0x1c1bf5];return _0xa3389;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd50a('0x0'));var zipdir=require(_0xd50a('0x1'));var jsonpatch=require(_0xd50a('0x2'));var rp=require(_0xd50a('0x3'));var moment=require(_0xd50a('0x4'));var BPromise=require(_0xd50a('0x5'));var Mustache=require(_0xd50a('0x6'));var util=require(_0xd50a('0x7'));var path=require(_0xd50a('0x8'));var sox=require(_0xd50a('0x9'));var csv=require('to-csv');var ejs=require(_0xd50a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd50a('0xb'));var squel=require(_0xd50a('0xc'));var crypto=require(_0xd50a('0xd'));var jsforce=require(_0xd50a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd50a('0xf'));var Redis=require('ioredis');var authService=require(_0xd50a('0x10'));var qs=require(_0xd50a('0x11'));var as=require(_0xd50a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd50a('0x13'));var utils=require(_0xd50a('0x14'));var config=require(_0xd50a('0x15'));var licenseUtil=require(_0xd50a('0x16'));var db=require(_0xd50a('0x17'))['db'];function respondWithStatusCode(_0x2d2d1f,_0x4945ff){_0x4945ff=_0x4945ff||0xcc;return function(_0x2aa98c){if(_0x2aa98c){return _0x2d2d1f['sendStatus'](_0x4945ff);}return _0x2d2d1f[_0xd50a('0x18')](_0x4945ff)[_0xd50a('0x19')]();};}function respondWithResult(_0x552f10,_0x2c40a6){_0x2c40a6=_0x2c40a6||0xc8;return function(_0x3ef4da){if(_0x3ef4da){return _0x552f10['status'](_0x2c40a6)[_0xd50a('0x1a')](_0x3ef4da);}};}function respondWithFilteredResult(_0x20ad9e,_0x51721d){return function(_0x596dda){if(_0x596dda){var _0x4e2c91=typeof _0x51721d['offset']===_0xd50a('0x1b')&&typeof _0x51721d[_0xd50a('0x1c')]===_0xd50a('0x1b');var _0x2fcbaa=_0x596dda[_0xd50a('0x1d')];var _0xe4902=_0x4e2c91?0x0:_0x51721d['offset'];var _0x2427f0=_0x4e2c91?_0x596dda[_0xd50a('0x1d')]:_0x51721d[_0xd50a('0x1e')]+_0x51721d[_0xd50a('0x1c')];var _0x2742aa;if(_0x2427f0>=_0x2fcbaa){_0x2427f0=_0x2fcbaa;_0x2742aa=0xc8;}else{_0x2742aa=0xce;}_0x20ad9e[_0xd50a('0x18')](_0x2742aa);return _0x20ad9e[_0xd50a('0x1f')](_0xd50a('0x20'),_0xe4902+'-'+_0x2427f0+'/'+_0x2fcbaa)[_0xd50a('0x1a')](_0x596dda);}return null;};}function patchUpdates(_0x13a48c){return function(_0xb598a4){try{jsonpatch[_0xd50a('0x21')](_0xb598a4,_0x13a48c,!![]);}catch(_0x5d624f){return BPromise[_0xd50a('0x22')](_0x5d624f);}return _0xb598a4[_0xd50a('0x23')]();};}function saveUpdates(_0xf6ea3,_0x25e996){return function(_0x40a0ef){if(_0x40a0ef){return _0x40a0ef[_0xd50a('0x24')](_0xf6ea3)[_0xd50a('0x25')](function(_0x4f3583){return _0x4f3583;});}return null;};}function removeEntity(_0x5abb6b,_0x4ae822){return function(_0xfa0858){if(_0xfa0858){return _0xfa0858['destroy']()['then'](function(){_0x5abb6b[_0xd50a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x480dcf,_0x2ade61){return function(_0x50f5fa){if(!_0x50f5fa){_0x480dcf[_0xd50a('0x26')](0x194);}return _0x50f5fa;};}function handleError(_0xc03856,_0x46aafb){_0x46aafb=_0x46aafb||0x1f4;return function(_0x4907bc){logger[_0xd50a('0x27')](_0x4907bc['stack']);if(_0x4907bc[_0xd50a('0x28')]){delete _0x4907bc[_0xd50a('0x28')];}_0xc03856[_0xd50a('0x18')](_0x46aafb)[_0xd50a('0x29')](_0x4907bc);};}exports[_0xd50a('0x2a')]=function(_0x2e99c6,_0x350307){var _0x2bc68d={},_0x3bfe68={},_0x3548f7={'count':0x0,'rows':[]};var _0x58e089=_['map'](db[_0xd50a('0x2b')][_0xd50a('0x2c')],function(_0x3be117){return{'name':_0x3be117[_0xd50a('0x2d')],'type':_0x3be117['type'][_0xd50a('0x2e')]};});_0x3bfe68[_0xd50a('0x2f')]=_[_0xd50a('0x30')](_0x58e089,_0xd50a('0x28'));_0x3bfe68[_0xd50a('0x31')]=_[_0xd50a('0x32')](_0x2e99c6[_0xd50a('0x31')]);_0x3bfe68['filters']=_[_0xd50a('0x33')](_0x3bfe68['model'],_0x3bfe68[_0xd50a('0x31')]);_0x2bc68d[_0xd50a('0x34')]=_[_0xd50a('0x33')](_0x3bfe68[_0xd50a('0x2f')],qs[_0xd50a('0x35')](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x35')]));_0x2bc68d[_0xd50a('0x34')]=_0x2bc68d[_0xd50a('0x34')][_0xd50a('0x36')]?_0x2bc68d[_0xd50a('0x34')]:_0x3bfe68['model'];if(!_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x37')](_0xd50a('0x38'))){_0x2bc68d['limit']=qs[_0xd50a('0x1c')](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x1c')]);_0x2bc68d['offset']=qs['offset'](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x1e')]);}_0x2bc68d[_0xd50a('0x39')]=qs[_0xd50a('0x3a')](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x3a')]);_0x2bc68d['where']=qs[_0xd50a('0x3b')](_[_0xd50a('0x3c')](_0x2e99c6[_0xd50a('0x31')],_0x3bfe68[_0xd50a('0x3b')]),_0x58e089);if(_0x2e99c6[_0xd50a('0x31')]['filter']){_0x2bc68d[_0xd50a('0x3d')]=_[_0xd50a('0x3e')](_0x2bc68d[_0xd50a('0x3d')],{'$or':_[_0xd50a('0x30')](_0x58e089,function(_0x19afd8){if(_0x19afd8[_0xd50a('0x3f')]!==_0xd50a('0x40')){var _0x4933b0={};_0x4933b0[_0x19afd8['name']]={'$like':'%'+_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x41')]+'%'};return _0x4933b0;}})});}_0x2bc68d=_[_0xd50a('0x3e')]({},_0x2bc68d,_0x2e99c6[_0xd50a('0x42')]);var _0x3b97d7={'where':_0x2bc68d[_0xd50a('0x3d')]};return db['Dynamics365Configuration'][_0xd50a('0x1d')](_0x3b97d7)['then'](function(_0x3ff88b){_0x3548f7['count']=_0x3ff88b;if(_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x43')]){_0x2bc68d['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xd50a('0x44')](_0x2bc68d);})[_0xd50a('0x25')](function(_0x21a4ec){_0x3548f7[_0xd50a('0x45')]=_0x21a4ec;return _0x3548f7;})[_0xd50a('0x25')](respondWithFilteredResult(_0x350307,_0x2bc68d))[_0xd50a('0x46')](handleError(_0x350307,null));};exports['show']=function(_0xe6946c,_0x2d1fbe){var _0x50615a={'raw':![],'where':{'id':_0xe6946c[_0xd50a('0x47')]['id']}},_0xdf9556={};_0xdf9556['model']=_[_0xd50a('0x32')](db['Dynamics365Configuration'][_0xd50a('0x2c')]);_0xdf9556['query']=_[_0xd50a('0x32')](_0xe6946c[_0xd50a('0x31')]);_0xdf9556[_0xd50a('0x3b')]=_['intersection'](_0xdf9556['model'],_0xdf9556['query']);_0x50615a[_0xd50a('0x34')]=_['intersection'](_0xdf9556[_0xd50a('0x2f')],qs['fields'](_0xe6946c[_0xd50a('0x31')][_0xd50a('0x35')]));_0x50615a[_0xd50a('0x34')]=_0x50615a['attributes']['length']?_0x50615a[_0xd50a('0x34')]:_0xdf9556['model'];if(_0xe6946c['query']['includeAll']){_0x50615a[_0xd50a('0x48')]=[{'all':!![]}];}_0x50615a=_['merge']({},_0x50615a,_0xe6946c[_0xd50a('0x42')]);return db['Dynamics365Configuration'][_0xd50a('0x49')](_0x50615a)[_0xd50a('0x25')](handleEntityNotFound(_0x2d1fbe,null))[_0xd50a('0x25')](respondWithResult(_0x2d1fbe,null))[_0xd50a('0x46')](handleError(_0x2d1fbe,null));};exports['create']=function(_0x33197c,_0x2cbb37){return db['Dynamics365Configuration']['create'](_0x33197c[_0xd50a('0x4a')],{})[_0xd50a('0x25')](respondWithResult(_0x2cbb37,0xc9))['catch'](handleError(_0x2cbb37,null));};exports[_0xd50a('0x24')]=function(_0x128f3d,_0xdeb8e){if(_0x128f3d[_0xd50a('0x4a')]['id']){delete _0x128f3d[_0xd50a('0x4a')]['id'];}return db[_0xd50a('0x2b')][_0xd50a('0x49')]({'where':{'id':_0x128f3d[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0xdeb8e,null))[_0xd50a('0x25')](saveUpdates(_0x128f3d['body'],null))[_0xd50a('0x25')](respondWithResult(_0xdeb8e,null))[_0xd50a('0x46')](handleError(_0xdeb8e,null));};exports[_0xd50a('0x4b')]=function(_0x4fea4b,_0x441887){return db[_0xd50a('0x2b')][_0xd50a('0x49')]({'where':{'id':_0x4fea4b[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x441887,null))['then'](removeEntity(_0x441887,null))[_0xd50a('0x46')](handleError(_0x441887,null));};exports[_0xd50a('0x4c')]=function(_0x55f3ab,_0x232d97,_0x4abe28){var _0x1ff68e={};var _0x3fb2b8={};var _0x448215;var _0x14a7d4;return db[_0xd50a('0x2b')]['findOne']({'where':{'id':_0x55f3ab[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x232d97,null))[_0xd50a('0x25')](function(_0x4f9781){if(_0x4f9781){_0x448215=_0x4f9781;_0x3fb2b8[_0xd50a('0x2f')]=_['keys'](db[_0xd50a('0x4d')][_0xd50a('0x2c')]);_0x3fb2b8[_0xd50a('0x31')]=_[_0xd50a('0x32')](_0x55f3ab[_0xd50a('0x31')]);_0x3fb2b8['filters']=_[_0xd50a('0x33')](_0x3fb2b8[_0xd50a('0x2f')],_0x3fb2b8['query']);_0x1ff68e[_0xd50a('0x34')]=_[_0xd50a('0x33')](_0x3fb2b8['model'],qs[_0xd50a('0x35')](_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x35')]));_0x1ff68e[_0xd50a('0x34')]=_0x1ff68e[_0xd50a('0x34')]['length']?_0x1ff68e[_0xd50a('0x34')]:_0x3fb2b8[_0xd50a('0x2f')];_0x1ff68e[_0xd50a('0x39')]=qs['sort'](_0x55f3ab['query']['sort']);_0x1ff68e[_0xd50a('0x3d')]=qs['filters'](_[_0xd50a('0x3c')](_0x55f3ab['query'],_0x3fb2b8['filters']));if(_0x55f3ab[_0xd50a('0x31')]['filter']){_0x1ff68e[_0xd50a('0x3d')]=_[_0xd50a('0x3e')](_0x1ff68e[_0xd50a('0x3d')],{'$or':_[_0xd50a('0x30')](_0x1ff68e['attributes'],function(_0x5a27b7){var _0x204d60={};_0x204d60[_0x5a27b7]={'$like':'%'+_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x41')]+'%'};return _0x204d60;})});}_0x1ff68e=_['merge']({},_0x1ff68e,_0x55f3ab[_0xd50a('0x42')]);return _0x448215[_0xd50a('0x4c')](_0x1ff68e);}})[_0xd50a('0x25')](function(_0x401da2){if(_0x401da2){_0x14a7d4=_0x401da2[_0xd50a('0x36')];if(!_0x55f3ab['query'][_0xd50a('0x37')](_0xd50a('0x38'))){_0x1ff68e[_0xd50a('0x1c')]=qs[_0xd50a('0x1c')](_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x1c')]);_0x1ff68e['offset']=qs[_0xd50a('0x1e')](_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x1e')]);}return _0x448215['getFields'](_0x1ff68e);}})[_0xd50a('0x25')](function(_0x1759b3){if(_0x1759b3){return _0x1759b3?{'count':_0x14a7d4,'rows':_0x1759b3}:null;}})['then'](respondWithResult(_0x232d97,null))[_0xd50a('0x46')](handleError(_0x232d97,null));};exports[_0xd50a('0x4e')]=function(_0x4e6c83,_0x267cda,_0x1bd272){var _0x2df7a0={};var _0x2e8fdf={};var _0x22cbc9;var _0x53926d;return db['Dynamics365Configuration'][_0xd50a('0x4f')]({'where':{'id':_0x4e6c83['params']['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x267cda,null))['then'](function(_0x266ac2){if(_0x266ac2){_0x22cbc9=_0x266ac2;_0x2e8fdf[_0xd50a('0x2f')]=_[_0xd50a('0x32')](db['Dynamics365Field'][_0xd50a('0x2c')]);_0x2e8fdf['query']=_['keys'](_0x4e6c83[_0xd50a('0x31')]);_0x2e8fdf[_0xd50a('0x3b')]=_[_0xd50a('0x33')](_0x2e8fdf[_0xd50a('0x2f')],_0x2e8fdf[_0xd50a('0x31')]);_0x2df7a0[_0xd50a('0x34')]=_[_0xd50a('0x33')](_0x2e8fdf[_0xd50a('0x2f')],qs[_0xd50a('0x35')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x35')]));_0x2df7a0[_0xd50a('0x34')]=_0x2df7a0['attributes'][_0xd50a('0x36')]?_0x2df7a0[_0xd50a('0x34')]:_0x2e8fdf['model'];_0x2df7a0[_0xd50a('0x39')]=qs[_0xd50a('0x3a')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x3a')]);_0x2df7a0['where']=qs[_0xd50a('0x3b')](_['pick'](_0x4e6c83['query'],_0x2e8fdf[_0xd50a('0x3b')]));if(_0x4e6c83[_0xd50a('0x31')]['filter']){_0x2df7a0[_0xd50a('0x3d')]=_['merge'](_0x2df7a0['where'],{'$or':_[_0xd50a('0x30')](_0x2df7a0[_0xd50a('0x34')],function(_0x5d23d6){var _0x1293e3={};_0x1293e3[_0x5d23d6]={'$like':'%'+_0x4e6c83[_0xd50a('0x31')]['filter']+'%'};return _0x1293e3;})});}_0x2df7a0=_[_0xd50a('0x3e')]({},_0x2df7a0,_0x4e6c83[_0xd50a('0x42')]);return _0x22cbc9[_0xd50a('0x4e')](_0x2df7a0);}})[_0xd50a('0x25')](function(_0xb08b4){if(_0xb08b4){_0x53926d=_0xb08b4[_0xd50a('0x36')];if(!_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x37')]('nolimit')){_0x2df7a0[_0xd50a('0x1c')]=qs[_0xd50a('0x1c')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x1c')]);_0x2df7a0[_0xd50a('0x1e')]=qs[_0xd50a('0x1e')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x1e')]);}return _0x22cbc9[_0xd50a('0x4e')](_0x2df7a0);}})['then'](function(_0x31038a){if(_0x31038a){return _0x31038a?{'count':_0x53926d,'rows':_0x31038a}:null;}})[_0xd50a('0x25')](respondWithResult(_0x267cda,null))[_0xd50a('0x46')](handleError(_0x267cda,null));};exports[_0xd50a('0x50')]=function(_0x4dceeb,_0x2e011c,_0x16c880){var _0x428d42={};var _0x4e40e0={};var _0x5c3276;var _0x586408;return db[_0xd50a('0x2b')][_0xd50a('0x4f')]({'where':{'id':_0x4dceeb[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x2e011c,null))['then'](function(_0x24f1d3){if(_0x24f1d3){_0x5c3276=_0x24f1d3;_0x4e40e0[_0xd50a('0x2f')]=_[_0xd50a('0x32')](db[_0xd50a('0x4d')][_0xd50a('0x2c')]);_0x4e40e0['query']=_[_0xd50a('0x32')](_0x4dceeb[_0xd50a('0x31')]);_0x4e40e0[_0xd50a('0x3b')]=_[_0xd50a('0x33')](_0x4e40e0[_0xd50a('0x2f')],_0x4e40e0[_0xd50a('0x31')]);_0x428d42['attributes']=_['intersection'](_0x4e40e0[_0xd50a('0x2f')],qs[_0xd50a('0x35')](_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x35')]));_0x428d42['attributes']=_0x428d42['attributes'][_0xd50a('0x36')]?_0x428d42['attributes']:_0x4e40e0['model'];_0x428d42[_0xd50a('0x39')]=qs['sort'](_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x3a')]);_0x428d42['where']=qs[_0xd50a('0x3b')](_['pick'](_0x4dceeb[_0xd50a('0x31')],_0x4e40e0[_0xd50a('0x3b')]));if(_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x41')]){_0x428d42['where']=_[_0xd50a('0x3e')](_0x428d42[_0xd50a('0x3d')],{'$or':_[_0xd50a('0x30')](_0x428d42['attributes'],function(_0xa494c2){var _0x236683={};_0x236683[_0xa494c2]={'$like':'%'+_0x4dceeb['query']['filter']+'%'};return _0x236683;})});}_0x428d42=_[_0xd50a('0x3e')]({},_0x428d42,_0x4dceeb['options']);return _0x5c3276[_0xd50a('0x50')](_0x428d42);}})[_0xd50a('0x25')](function(_0x47606e){if(_0x47606e){_0x586408=_0x47606e[_0xd50a('0x36')];if(!_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x37')](_0xd50a('0x38'))){_0x428d42[_0xd50a('0x1c')]=qs[_0xd50a('0x1c')](_0x4dceeb['query'][_0xd50a('0x1c')]);_0x428d42['offset']=qs[_0xd50a('0x1e')](_0x4dceeb['query'][_0xd50a('0x1e')]);}return _0x5c3276[_0xd50a('0x50')](_0x428d42);}})[_0xd50a('0x25')](function(_0x4c3ed9){if(_0x4c3ed9){return _0x4c3ed9?{'count':_0x586408,'rows':_0x4c3ed9}:null;}})['then'](respondWithResult(_0x2e011c,null))['catch'](handleError(_0x2e011c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0cdaa8e..d056a0b 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 _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 +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e8063,_0x25dc8c){var _0x1aa9ec=function(_0x962a4c){while(--_0x962a4c){_0x5e8063['push'](_0x5e8063['shift']());}};_0x1aa9ec(++_0x25dc8c);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xb4e6[_0x237da8];return _0x558825;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 6ba041e..575f69e 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 _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 +var _0xb4a3=['message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b4716,_0x462a64){var _0x4cc549=function(_0x5aef7e){while(--_0x5aef7e){_0x2b4716['push'](_0x2b4716['shift']());}};_0x4cc549(++_0x462a64);}(_0xb4a3,0xa4));var _0x3b4a=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0xb4a3[_0x257017];return _0x38536d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3b4a('0x0'));var rs=require(_0x3b4a('0x1'));var fs=require('fs');var Redis=require(_0x3b4a('0x2'));var db=require(_0x3b4a('0x3'))['db'];var utils=require(_0x3b4a('0x4'));var logger=require(_0x3b4a('0x5'))(_0x3b4a('0x6'));var config=require(_0x3b4a('0x7'));var jayson=require(_0x3b4a('0x8'));var client=jayson[_0x3b4a('0x9')][_0x3b4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5b36,_0x20c694,_0x49623c){return new BPromise(function(_0xe64c26,_0x4191a8){return client['request'](_0x4c5b36,_0x49623c)[_0x3b4a('0xb')](function(_0x23db29){logger[_0x3b4a('0xc')](_0x3b4a('0xd'),_0x20c694,_0x3b4a('0xe'));logger[_0x3b4a('0xf')](_0x3b4a('0x10'),_0x20c694,'request\x20sent',JSON[_0x3b4a('0x11')](_0x23db29));if(_0x23db29[_0x3b4a('0x12')]){if(_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x13')]===0x1f4){logger[_0x3b4a('0x12')](_0x3b4a('0xd'),_0x20c694,_0x23db29['error']['message']);return _0x4191a8(_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x14')]);}logger[_0x3b4a('0x12')](_0x3b4a('0xd'),_0x20c694,_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x14')]);return _0xe64c26(_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x14')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x20c694,_0x3b4a('0xe'));_0xe64c26(_0x23db29[_0x3b4a('0x15')]['message']);}})[_0x3b4a('0x16')](function(_0xdb4094){logger[_0x3b4a('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x20c694,_0xdb4094);_0x4191a8(_0xdb4094);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4b75197..3a5a3eb 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 _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 +var _0xae75=['../../components/interaction/service','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xae75,0x94));var _0x5ae7=function(_0xa4fc15,_0x38c4ab){_0xa4fc15=_0xa4fc15-0x0;var _0x2730fc=_0xae75[_0xa4fc15];return _0x2730fc;};'use strict';var multer=require(_0x5ae7('0x0'));var util=require(_0x5ae7('0x1'));var path=require('path');var timeout=require(_0x5ae7('0x2'));var express=require(_0x5ae7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5ae7('0x4'));var interaction=require(_0x5ae7('0x5'));var config=require('../../config/environment');var controller=require(_0x5ae7('0x6'));router['get']('/',auth[_0x5ae7('0x7')](),controller[_0x5ae7('0x8')]);router[_0x5ae7('0x9')](_0x5ae7('0xa'),auth[_0x5ae7('0x7')](),controller[_0x5ae7('0xb')]);router[_0x5ae7('0xc')]('/',auth[_0x5ae7('0x7')](),controller['create']);router[_0x5ae7('0xd')](_0x5ae7('0xa'),auth[_0x5ae7('0x7')](),controller[_0x5ae7('0xe')]);router[_0x5ae7('0xf')](_0x5ae7('0xa'),auth[_0x5ae7('0x7')](),controller[_0x5ae7('0x10')]);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 8856b1d..3a0ed7e 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 _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 +var _0x343d=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x368371,_0x158eb4){var _0x4fba57=function(_0xa24f84){while(--_0xa24f84){_0x368371['push'](_0x368371['shift']());}};_0x4fba57(++_0x158eb4);}(_0x343d,0x135));var _0xd343=function(_0x21ef85,_0x2d9f4f){_0x21ef85=_0x21ef85-0x0;var _0x5b9a7d=_0x343d[_0x21ef85];return _0x5b9a7d;};'use strict';var Sequelize=require(_0xd343('0x0'));module[_0xd343('0x1')]={'type':{'type':Sequelize[_0xd343('0x2')]('string',_0xd343('0x3'),_0xd343('0x4'),'keyValue',_0xd343('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd343('0x6')]},'keyType':{'type':Sequelize[_0xd343('0x2')](_0xd343('0x7'),_0xd343('0x3'),_0xd343('0x4'))},'keyContent':{'type':Sequelize[_0xd343('0x6')]},'idField':{'type':Sequelize[_0xd343('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd343('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 44a3a0b..85b6dbf 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 _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 +var _0x4943=['send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','then','destroy','error','stack','name'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x4943,0x151));var _0x3494=function(_0x3d1b7d,_0x195c66){_0x3d1b7d=_0x3d1b7d-0x0;var _0x2d3879=_0x4943[_0x3d1b7d];return _0x2d3879;};'use strict';var emlformat=require(_0x3494('0x0'));var rimraf=require(_0x3494('0x1'));var zipdir=require(_0x3494('0x2'));var jsonpatch=require(_0x3494('0x3'));var rp=require(_0x3494('0x4'));var moment=require(_0x3494('0x5'));var BPromise=require(_0x3494('0x6'));var Mustache=require(_0x3494('0x7'));var util=require(_0x3494('0x8'));var path=require(_0x3494('0x9'));var sox=require('sox');var csv=require(_0x3494('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3494('0xb'));var _=require('lodash');var squel=require(_0x3494('0xc'));var crypto=require(_0x3494('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3494('0xe'));var toCsv=require(_0x3494('0xa'));var querystring=require(_0x3494('0xf'));var Papa=require('papaparse');var Redis=require(_0x3494('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3494('0x11'));var as=require(_0x3494('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3494('0x13'))('api');var utils=require(_0x3494('0x14'));var config=require(_0x3494('0x15'));var licenseUtil=require(_0x3494('0x16'));var db=require(_0x3494('0x17'))['db'];function respondWithStatusCode(_0xd41959,_0x8bae56){_0x8bae56=_0x8bae56||0xcc;return function(_0x4adf77){if(_0x4adf77){return _0xd41959[_0x3494('0x18')](_0x8bae56);}return _0xd41959[_0x3494('0x19')](_0x8bae56)[_0x3494('0x1a')]();};}function respondWithResult(_0x57309a,_0x4f7392){_0x4f7392=_0x4f7392||0xc8;return function(_0x5e7b14){if(_0x5e7b14){return _0x57309a[_0x3494('0x19')](_0x4f7392)[_0x3494('0x1b')](_0x5e7b14);}};}function respondWithFilteredResult(_0x1809e4,_0xbcb2be){return function(_0x43b284){if(_0x43b284){var _0x4e6efc=typeof _0xbcb2be[_0x3494('0x1c')]===_0x3494('0x1d')&&typeof _0xbcb2be[_0x3494('0x1e')]===_0x3494('0x1d');var _0x3926fb=_0x43b284['count'];var _0x387ea3=_0x4e6efc?0x0:_0xbcb2be[_0x3494('0x1c')];var _0x2a4e74=_0x4e6efc?_0x43b284[_0x3494('0x1f')]:_0xbcb2be[_0x3494('0x1c')]+_0xbcb2be[_0x3494('0x1e')];var _0x5c1494;if(_0x2a4e74>=_0x3926fb){_0x2a4e74=_0x3926fb;_0x5c1494=0xc8;}else{_0x5c1494=0xce;}_0x1809e4[_0x3494('0x19')](_0x5c1494);return _0x1809e4[_0x3494('0x20')](_0x3494('0x21'),_0x387ea3+'-'+_0x2a4e74+'/'+_0x3926fb)[_0x3494('0x1b')](_0x43b284);}return null;};}function patchUpdates(_0x443052){return function(_0xc6a8fc){try{jsonpatch[_0x3494('0x22')](_0xc6a8fc,_0x443052,!![]);}catch(_0x2e8e60){return BPromise[_0x3494('0x23')](_0x2e8e60);}return _0xc6a8fc[_0x3494('0x24')]();};}function saveUpdates(_0x2396ea,_0x4620d3){return function(_0x26e229){if(_0x26e229){return _0x26e229[_0x3494('0x25')](_0x2396ea)[_0x3494('0x26')](function(_0x401371){return _0x401371;});}return null;};}function removeEntity(_0x23514e,_0x1f89d8){return function(_0x4e2497){if(_0x4e2497){return _0x4e2497[_0x3494('0x27')]()[_0x3494('0x26')](function(){_0x23514e[_0x3494('0x19')](0xcc)[_0x3494('0x1a')]();});}};}function handleEntityNotFound(_0x3fea28,_0x4814cb){return function(_0x56a392){if(!_0x56a392){_0x3fea28[_0x3494('0x18')](0x194);}return _0x56a392;};}function handleError(_0x59bbf,_0x1b81a4){_0x1b81a4=_0x1b81a4||0x1f4;return function(_0x46c07e){logger[_0x3494('0x28')](_0x46c07e[_0x3494('0x29')]);if(_0x46c07e[_0x3494('0x2a')]){delete _0x46c07e[_0x3494('0x2a')];}_0x59bbf['status'](_0x1b81a4)[_0x3494('0x2b')](_0x46c07e);};}exports[_0x3494('0x2c')]=function(_0x16a97d,_0x45c589){var _0x3854f2={},_0x112429={},_0x1ef373={'count':0x0,'rows':[]};var _0x3b9b2d=_[_0x3494('0x2d')](db[_0x3494('0x2e')][_0x3494('0x2f')],function(_0x1c0b0e){return{'name':_0x1c0b0e[_0x3494('0x30')],'type':_0x1c0b0e[_0x3494('0x31')][_0x3494('0x32')]};});_0x112429[_0x3494('0x33')]=_['map'](_0x3b9b2d,_0x3494('0x2a'));_0x112429['query']=_[_0x3494('0x34')](_0x16a97d[_0x3494('0x35')]);_0x112429[_0x3494('0x36')]=_[_0x3494('0x37')](_0x112429['model'],_0x112429['query']);_0x3854f2[_0x3494('0x38')]=_[_0x3494('0x37')](_0x112429['model'],qs[_0x3494('0x39')](_0x16a97d[_0x3494('0x35')][_0x3494('0x39')]));_0x3854f2[_0x3494('0x38')]=_0x3854f2[_0x3494('0x38')]['length']?_0x3854f2[_0x3494('0x38')]:_0x112429[_0x3494('0x33')];if(!_0x16a97d[_0x3494('0x35')][_0x3494('0x3a')]('nolimit')){_0x3854f2[_0x3494('0x1e')]=qs['limit'](_0x16a97d[_0x3494('0x35')][_0x3494('0x1e')]);_0x3854f2[_0x3494('0x1c')]=qs['offset'](_0x16a97d[_0x3494('0x35')][_0x3494('0x1c')]);}_0x3854f2['order']=qs[_0x3494('0x3b')](_0x16a97d[_0x3494('0x35')]['sort']);_0x3854f2['where']=qs[_0x3494('0x36')](_[_0x3494('0x3c')](_0x16a97d['query'],_0x112429[_0x3494('0x36')]),_0x3b9b2d);if(_0x16a97d[_0x3494('0x35')][_0x3494('0x3d')]){_0x3854f2[_0x3494('0x3e')]=_['merge'](_0x3854f2[_0x3494('0x3e')],{'$or':_[_0x3494('0x2d')](_0x3b9b2d,function(_0x50fc82){if(_0x50fc82['type']!==_0x3494('0x3f')){var _0x586b09={};_0x586b09[_0x50fc82[_0x3494('0x2a')]]={'$like':'%'+_0x16a97d['query'][_0x3494('0x3d')]+'%'};return _0x586b09;}})});}_0x3854f2=_[_0x3494('0x40')]({},_0x3854f2,_0x16a97d[_0x3494('0x41')]);var _0x550580={'where':_0x3854f2['where']};return db[_0x3494('0x2e')]['count'](_0x550580)['then'](function(_0x1e7019){_0x1ef373[_0x3494('0x1f')]=_0x1e7019;if(_0x16a97d[_0x3494('0x35')][_0x3494('0x42')]){_0x3854f2[_0x3494('0x43')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x3854f2);})['then'](function(_0x2fa98c){_0x1ef373[_0x3494('0x44')]=_0x2fa98c;return _0x1ef373;})[_0x3494('0x26')](respondWithFilteredResult(_0x45c589,_0x3854f2))[_0x3494('0x45')](handleError(_0x45c589,null));};exports[_0x3494('0x46')]=function(_0x4c7e34,_0x1ebcd6){var _0x54fd9c={'raw':!![],'where':{'id':_0x4c7e34[_0x3494('0x47')]['id']}},_0x41e280={};_0x41e280[_0x3494('0x33')]=_[_0x3494('0x34')](db['Dynamics365Field'][_0x3494('0x2f')]);_0x41e280[_0x3494('0x35')]=_['keys'](_0x4c7e34[_0x3494('0x35')]);_0x41e280[_0x3494('0x36')]=_[_0x3494('0x37')](_0x41e280[_0x3494('0x33')],_0x41e280['query']);_0x54fd9c[_0x3494('0x38')]=_['intersection'](_0x41e280[_0x3494('0x33')],qs[_0x3494('0x39')](_0x4c7e34[_0x3494('0x35')][_0x3494('0x39')]));_0x54fd9c['attributes']=_0x54fd9c[_0x3494('0x38')][_0x3494('0x48')]?_0x54fd9c[_0x3494('0x38')]:_0x41e280[_0x3494('0x33')];if(_0x4c7e34['query'][_0x3494('0x42')]){_0x54fd9c['include']=[{'all':!![]}];}_0x54fd9c=_[_0x3494('0x40')]({},_0x54fd9c,_0x4c7e34['options']);return db['Dynamics365Field'][_0x3494('0x49')](_0x54fd9c)[_0x3494('0x26')](handleEntityNotFound(_0x1ebcd6,null))[_0x3494('0x26')](respondWithResult(_0x1ebcd6,null))['catch'](handleError(_0x1ebcd6,null));};exports[_0x3494('0x4a')]=function(_0x19aeac,_0x5c1675){return db['Dynamics365Field'][_0x3494('0x4a')](_0x19aeac[_0x3494('0x4b')],{})['then'](respondWithResult(_0x5c1675,0xc9))['catch'](handleError(_0x5c1675,null));};exports[_0x3494('0x25')]=function(_0x206ac7,_0x156920){if(_0x206ac7[_0x3494('0x4b')]['id']){delete _0x206ac7[_0x3494('0x4b')]['id'];}return db[_0x3494('0x2e')]['find']({'where':{'id':_0x206ac7[_0x3494('0x47')]['id']}})[_0x3494('0x26')](handleEntityNotFound(_0x156920,null))[_0x3494('0x26')](saveUpdates(_0x206ac7[_0x3494('0x4b')],null))[_0x3494('0x26')](respondWithResult(_0x156920,null))[_0x3494('0x45')](handleError(_0x156920,null));};exports[_0x3494('0x27')]=function(_0x130483,_0x51be90){return db[_0x3494('0x2e')][_0x3494('0x49')]({'where':{'id':_0x130483['params']['id']}})['then'](handleEntityNotFound(_0x51be90,null))['then'](removeEntity(_0x51be90,null))[_0x3494('0x45')](handleError(_0x51be90,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 62f1637..b3484dc 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 _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 +var _0x2c13=['bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','dynamics365_unique_index','FieldId','lodash','../../config/logger'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x2c13,0xd0));var _0x32c1=function(_0x15f4dd,_0x579de3){_0x15f4dd=_0x15f4dd-0x0;var _0x43eead=_0x2c13[_0x15f4dd];return _0x43eead;};'use strict';var _=require(_0x32c1('0x0'));var util=require('util');var logger=require(_0x32c1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x32c1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32c1('0x3'));var rimraf=require(_0x32c1('0x4'));var config=require(_0x32c1('0x5'));var attributes=require(_0x32c1('0x6'));module['exports']=function(_0x597928,_0x3e05ae){return _0x597928[_0x32c1('0x7')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x32c1('0x8'),'fields':['idField',_0x32c1('0x9')],'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 459a118..7cc790d 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 _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 +var _0x2637=['then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x415887,_0x43720d){var _0x450e7e=function(_0x4b4906){while(--_0x4b4906){_0x415887['push'](_0x415887['shift']());}};_0x450e7e(++_0x43720d);}(_0x2637,0x8e));var _0x7263=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x2637[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require(_0x7263('0x0'));var moment=require('moment');var BPromise=require(_0x7263('0x1'));var rs=require(_0x7263('0x2'));var fs=require('fs');var Redis=require(_0x7263('0x3'));var db=require(_0x7263('0x4'))['db'];var utils=require(_0x7263('0x5'));var logger=require(_0x7263('0x6'))(_0x7263('0x7'));var config=require(_0x7263('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7263('0x9')][_0x7263('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26bce4,_0x5d1ba4,_0x5794f9){return new BPromise(function(_0x2c17d8,_0x4a4228){return client[_0x7263('0xb')](_0x26bce4,_0x5794f9)[_0x7263('0xc')](function(_0x14c339){logger[_0x7263('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x7263('0xe'));logger['debug'](_0x7263('0xf'),_0x5d1ba4,'request\x20sent',JSON[_0x7263('0x10')](_0x14c339));if(_0x14c339[_0x7263('0x11')]){if(_0x14c339[_0x7263('0x11')][_0x7263('0x12')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x14c339[_0x7263('0x11')][_0x7263('0x13')]);return _0x4a4228(_0x14c339[_0x7263('0x11')][_0x7263('0x13')]);}logger[_0x7263('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x14c339['error'][_0x7263('0x13')]);return _0x2c17d8(_0x14c339[_0x7263('0x11')][_0x7263('0x13')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,'request\x20sent');_0x2c17d8(_0x14c339[_0x7263('0x14')]['message']);}})[_0x7263('0x15')](function(_0x1447a5){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x1447a5);_0x4a4228(_0x1447a5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1b83305..bba5c41 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 _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 +var _0x26e4=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields'];(function(_0x1d4dc5,_0x10c711){var _0x4dcdf1=function(_0x5bf936){while(--_0x5bf936){_0x1d4dc5['push'](_0x1d4dc5['shift']());}};_0x4dcdf1(++_0x10c711);}(_0x26e4,0x127));var _0x426e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x26e4[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x426e('0x0'));var util=require(_0x426e('0x1'));var path=require(_0x426e('0x2'));var timeout=require(_0x426e('0x3'));var express=require('express');var router=express[_0x426e('0x4')]();var fs_extra=require(_0x426e('0x5'));var auth=require(_0x426e('0x6'));var interaction=require(_0x426e('0x7'));var config=require(_0x426e('0x8'));var controller=require(_0x426e('0x9'));router['get']('/',auth[_0x426e('0xa')](),controller[_0x426e('0xb')]);router[_0x426e('0xc')](_0x426e('0xd'),auth[_0x426e('0xa')](),controller[_0x426e('0xe')]);router[_0x426e('0xc')](_0x426e('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x426e('0xc')](_0x426e('0x10'),auth['isAuthenticated'](),controller[_0x426e('0x11')]);router[_0x426e('0x12')]('/',auth[_0x426e('0xa')](),controller[_0x426e('0x13')]);router[_0x426e('0x12')](_0x426e('0xf'),auth['isAuthenticated'](),controller[_0x426e('0x14')]);router[_0x426e('0x15')](_0x426e('0xd'),auth[_0x426e('0xa')](),controller[_0x426e('0x16')]);router[_0x426e('0x17')](_0x426e('0xd'),auth['isAuthenticated'](),controller[_0x426e('0x18')]);module[_0x426e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 5652881..af98b20 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 _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 +var _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x45bc49,_0x25a067){var _0x31c05f=function(_0x40d106){while(--_0x40d106){_0x45bc49['push'](_0x45bc49['shift']());}};_0x31c05f(++_0x25a067);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x0b0e[_0x52684f];return _0x4a55f0;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6700e06..8cde103 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 _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 +var _0x7948=['group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','FreshdeskAccount','findAll','rows','catch','include','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0x7948,0x185));var _0x8794=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x7948[_0x52b7b9];return _0x5b5d30;};'use strict';var emlformat=require(_0x8794('0x0'));var rimraf=require(_0x8794('0x1'));var zipdir=require(_0x8794('0x2'));var jsonpatch=require(_0x8794('0x3'));var rp=require(_0x8794('0x4'));var moment=require(_0x8794('0x5'));var BPromise=require(_0x8794('0x6'));var Mustache=require(_0x8794('0x7'));var util=require(_0x8794('0x8'));var path=require(_0x8794('0x9'));var sox=require(_0x8794('0xa'));var csv=require(_0x8794('0xb'));var ejs=require(_0x8794('0xc'));var fs=require('fs');var fs_extra=require(_0x8794('0xd'));var _=require(_0x8794('0xe'));var squel=require(_0x8794('0xf'));var crypto=require(_0x8794('0x10'));var jsforce=require(_0x8794('0x11'));var deskjs=require(_0x8794('0x12'));var toCsv=require(_0x8794('0xb'));var querystring=require(_0x8794('0x13'));var Papa=require(_0x8794('0x14'));var Redis=require(_0x8794('0x15'));var authService=require(_0x8794('0x16'));var qs=require(_0x8794('0x17'));var as=require(_0x8794('0x18'));var hardwareService=require(_0x8794('0x19'));var logger=require(_0x8794('0x1a'))(_0x8794('0x1b'));var utils=require(_0x8794('0x1c'));var config=require(_0x8794('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0x8794('0x1e'))['db'];var integrations=require(_0x8794('0x1f'));function respondWithStatusCode(_0x1e9dac,_0x10a723){_0x10a723=_0x10a723||0xcc;return function(_0x1ce53e){if(_0x1ce53e){return _0x1e9dac[_0x8794('0x20')](_0x10a723);}return _0x1e9dac[_0x8794('0x21')](_0x10a723)[_0x8794('0x22')]();};}function respondWithResult(_0xb22e03,_0x2967e3){_0x2967e3=_0x2967e3||0xc8;return function(_0x2aea71){if(_0x2aea71){return _0xb22e03[_0x8794('0x21')](_0x2967e3)[_0x8794('0x23')](_0x2aea71);}};}function respondWithFilteredResult(_0x537e3d,_0x7500eb){return function(_0x4f8b21){if(_0x4f8b21){var _0x5623d7=typeof _0x7500eb[_0x8794('0x24')]===_0x8794('0x25')&&typeof _0x7500eb[_0x8794('0x26')]==='undefined';var _0x24ae6a=_0x4f8b21[_0x8794('0x27')];var _0x46be4d=_0x5623d7?0x0:_0x7500eb['offset'];var _0x23a396=_0x5623d7?_0x4f8b21[_0x8794('0x27')]:_0x7500eb[_0x8794('0x24')]+_0x7500eb['limit'];var _0x186ed4;if(_0x23a396>=_0x24ae6a){_0x23a396=_0x24ae6a;_0x186ed4=0xc8;}else{_0x186ed4=0xce;}_0x537e3d[_0x8794('0x21')](_0x186ed4);return _0x537e3d[_0x8794('0x28')]('Content-Range',_0x46be4d+'-'+_0x23a396+'/'+_0x24ae6a)[_0x8794('0x23')](_0x4f8b21);}return null;};}function patchUpdates(_0x4bd1ef){return function(_0x10829a){try{jsonpatch[_0x8794('0x29')](_0x10829a,_0x4bd1ef,!![]);}catch(_0x2b8cae){return BPromise[_0x8794('0x2a')](_0x2b8cae);}return _0x10829a[_0x8794('0x2b')]();};}function saveUpdates(_0xa180ac,_0x1b8c19){return function(_0xd6651c){if(_0xd6651c){return _0xd6651c[_0x8794('0x2c')](_0xa180ac)[_0x8794('0x2d')](function(_0x518eb6){return _0x518eb6;});}return null;};}function removeEntity(_0x3e3db9,_0x4de3af){return function(_0x16f7a0){if(_0x16f7a0){return _0x16f7a0[_0x8794('0x2e')]()['then'](function(){_0x3e3db9[_0x8794('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c30c,_0x5e3094){return function(_0x1f56f6){if(!_0x1f56f6){_0x38c30c['sendStatus'](0x194);}return _0x1f56f6;};}function handleError(_0x17cbd2,_0x165698){_0x165698=_0x165698||0x1f4;return function(_0xc1a17c){logger['error'](_0xc1a17c['stack']);if(_0xc1a17c[_0x8794('0x2f')]){delete _0xc1a17c[_0x8794('0x2f')];}_0x17cbd2[_0x8794('0x21')](_0x165698)['send'](_0xc1a17c);};}exports[_0x8794('0x30')]=function(_0x536fed,_0x4cb01c){var _0x2c357b={},_0x25f9f6={},_0x7ca073={'count':0x0,'rows':[]};var _0x45bbde=_[_0x8794('0x31')](db['FreshdeskAccount'][_0x8794('0x32')],function(_0x375ac1){return{'name':_0x375ac1[_0x8794('0x33')],'type':_0x375ac1[_0x8794('0x34')]['key']};});_0x25f9f6[_0x8794('0x35')]=_[_0x8794('0x31')](_0x45bbde,'name');_0x25f9f6['query']=_[_0x8794('0x36')](_0x536fed[_0x8794('0x37')]);_0x25f9f6[_0x8794('0x38')]=_[_0x8794('0x39')](_0x25f9f6['model'],_0x25f9f6['query']);_0x2c357b[_0x8794('0x3a')]=_[_0x8794('0x39')](_0x25f9f6[_0x8794('0x35')],qs[_0x8794('0x3b')](_0x536fed[_0x8794('0x37')][_0x8794('0x3b')]));_0x2c357b[_0x8794('0x3a')]=_0x2c357b[_0x8794('0x3a')][_0x8794('0x3c')]?_0x2c357b[_0x8794('0x3a')]:_0x25f9f6[_0x8794('0x35')];if(!_0x536fed['query'][_0x8794('0x3d')](_0x8794('0x3e'))){_0x2c357b[_0x8794('0x26')]=qs[_0x8794('0x26')](_0x536fed['query']['limit']);_0x2c357b[_0x8794('0x24')]=qs[_0x8794('0x24')](_0x536fed[_0x8794('0x37')][_0x8794('0x24')]);}_0x2c357b[_0x8794('0x3f')]=qs[_0x8794('0x40')](_0x536fed[_0x8794('0x37')][_0x8794('0x40')]);_0x2c357b['where']=qs[_0x8794('0x38')](_[_0x8794('0x41')](_0x536fed[_0x8794('0x37')],_0x25f9f6['filters']),_0x45bbde);if(_0x536fed[_0x8794('0x37')][_0x8794('0x42')]){_0x2c357b[_0x8794('0x43')]=_[_0x8794('0x44')](_0x2c357b['where'],{'$or':_[_0x8794('0x31')](_0x45bbde,function(_0x1121ca){if(_0x1121ca[_0x8794('0x34')]!==_0x8794('0x45')){var _0x20cfb9={};_0x20cfb9[_0x1121ca['name']]={'$like':'%'+_0x536fed[_0x8794('0x37')]['filter']+'%'};return _0x20cfb9;}})});}_0x2c357b=_['merge']({},_0x2c357b,_0x536fed[_0x8794('0x46')]);var _0x240bc6={'where':_0x2c357b[_0x8794('0x43')]};return db['FreshdeskAccount'][_0x8794('0x27')](_0x240bc6)[_0x8794('0x2d')](function(_0x3a3d63){_0x7ca073[_0x8794('0x27')]=_0x3a3d63;if(_0x536fed['query'][_0x8794('0x47')]){_0x2c357b['include']=[{'all':!![]}];}return db[_0x8794('0x48')][_0x8794('0x49')](_0x2c357b);})[_0x8794('0x2d')](function(_0x1f5c78){_0x7ca073[_0x8794('0x4a')]=_0x1f5c78;return _0x7ca073;})['then'](respondWithFilteredResult(_0x4cb01c,_0x2c357b))[_0x8794('0x4b')](handleError(_0x4cb01c,null));};exports['show']=function(_0x239bd3,_0x516655){var _0x2ef73d={'raw':![],'where':{'id':_0x239bd3['params']['id']}},_0x36b588={};_0x36b588[_0x8794('0x35')]=_[_0x8794('0x36')](db[_0x8794('0x48')][_0x8794('0x32')]);_0x36b588['query']=_['keys'](_0x239bd3[_0x8794('0x37')]);_0x36b588[_0x8794('0x38')]=_[_0x8794('0x39')](_0x36b588[_0x8794('0x35')],_0x36b588['query']);_0x2ef73d['attributes']=_[_0x8794('0x39')](_0x36b588[_0x8794('0x35')],qs[_0x8794('0x3b')](_0x239bd3[_0x8794('0x37')][_0x8794('0x3b')]));_0x2ef73d['attributes']=_0x2ef73d['attributes'][_0x8794('0x3c')]?_0x2ef73d['attributes']:_0x36b588[_0x8794('0x35')];if(_0x239bd3[_0x8794('0x37')]['includeAll']){_0x2ef73d[_0x8794('0x4c')]=[{'all':!![]}];}_0x2ef73d=_[_0x8794('0x44')]({},_0x2ef73d,_0x239bd3[_0x8794('0x46')]);return db[_0x8794('0x48')][_0x8794('0x4d')](_0x2ef73d)[_0x8794('0x2d')](handleEntityNotFound(_0x516655,null))['then'](respondWithResult(_0x516655,null))[_0x8794('0x4b')](handleError(_0x516655,null));};exports[_0x8794('0x4e')]=function(_0x36645b,_0x40d649){return db[_0x8794('0x48')]['create'](_0x36645b[_0x8794('0x4f')],{})[_0x8794('0x2d')](respondWithResult(_0x40d649,0xc9))[_0x8794('0x4b')](handleError(_0x40d649,null));};exports[_0x8794('0x2c')]=function(_0x14df40,_0x337aa9){if(_0x14df40[_0x8794('0x4f')]['id']){delete _0x14df40[_0x8794('0x4f')]['id'];}return db['FreshdeskAccount'][_0x8794('0x4d')]({'where':{'id':_0x14df40[_0x8794('0x50')]['id']}})[_0x8794('0x2d')](handleEntityNotFound(_0x337aa9,null))[_0x8794('0x2d')](saveUpdates(_0x14df40[_0x8794('0x4f')],null))[_0x8794('0x2d')](respondWithResult(_0x337aa9,null))[_0x8794('0x4b')](handleError(_0x337aa9,null));};exports[_0x8794('0x2e')]=function(_0x1be24d,_0x20db95){return db[_0x8794('0x48')][_0x8794('0x4d')]({'where':{'id':_0x1be24d['params']['id']}})['then'](handleEntityNotFound(_0x20db95,null))['then'](removeEntity(_0x20db95,null))[_0x8794('0x4b')](handleError(_0x20db95,null));};exports[_0x8794('0x51')]=function(_0x3bfb2d,_0x5627d0,_0x1bfb97){var _0x53ca6a={};var _0x342424={};var _0x4dbf82;var _0x449668;return db['FreshdeskAccount'][_0x8794('0x52')]({'where':{'id':_0x3bfb2d['params']['id']}})[_0x8794('0x2d')](handleEntityNotFound(_0x5627d0,null))[_0x8794('0x2d')](function(_0x1fe264){if(_0x1fe264){_0x4dbf82=_0x1fe264;_0x342424['model']=_['keys'](db[_0x8794('0x53')][_0x8794('0x32')]);_0x342424[_0x8794('0x37')]=_[_0x8794('0x36')](_0x3bfb2d[_0x8794('0x37')]);_0x342424[_0x8794('0x38')]=_['intersection'](_0x342424[_0x8794('0x35')],_0x342424[_0x8794('0x37')]);_0x53ca6a[_0x8794('0x3a')]=_[_0x8794('0x39')](_0x342424[_0x8794('0x35')],qs[_0x8794('0x3b')](_0x3bfb2d['query'][_0x8794('0x3b')]));_0x53ca6a[_0x8794('0x3a')]=_0x53ca6a[_0x8794('0x3a')][_0x8794('0x3c')]?_0x53ca6a['attributes']:_0x342424[_0x8794('0x35')];_0x53ca6a['order']=qs[_0x8794('0x40')](_0x3bfb2d[_0x8794('0x37')][_0x8794('0x40')]);_0x53ca6a[_0x8794('0x43')]=qs[_0x8794('0x38')](_[_0x8794('0x41')](_0x3bfb2d['query'],_0x342424[_0x8794('0x38')]));if(_0x3bfb2d[_0x8794('0x37')][_0x8794('0x42')]){_0x53ca6a[_0x8794('0x43')]=_['merge'](_0x53ca6a['where'],{'$or':_['map'](_0x53ca6a[_0x8794('0x3a')],function(_0x5676f0){var _0x2a29aa={};_0x2a29aa[_0x5676f0]={'$like':'%'+_0x3bfb2d[_0x8794('0x37')][_0x8794('0x42')]+'%'};return _0x2a29aa;})});}_0x53ca6a=_[_0x8794('0x44')]({},_0x53ca6a,_0x3bfb2d[_0x8794('0x46')]);return _0x4dbf82[_0x8794('0x51')](_0x53ca6a);}})[_0x8794('0x2d')](function(_0x4c9a59){if(_0x4c9a59){_0x449668=_0x4c9a59[_0x8794('0x3c')];if(!_0x3bfb2d[_0x8794('0x37')]['hasOwnProperty'](_0x8794('0x3e'))){_0x53ca6a[_0x8794('0x26')]=qs[_0x8794('0x26')](_0x3bfb2d[_0x8794('0x37')]['limit']);_0x53ca6a[_0x8794('0x24')]=qs[_0x8794('0x24')](_0x3bfb2d[_0x8794('0x37')][_0x8794('0x24')]);}return _0x4dbf82[_0x8794('0x51')](_0x53ca6a);}})[_0x8794('0x2d')](function(_0x420cf5){if(_0x420cf5){return _0x420cf5?{'count':_0x449668,'rows':_0x420cf5}:null;}})[_0x8794('0x2d')](respondWithResult(_0x5627d0,null))[_0x8794('0x4b')](handleError(_0x5627d0,null));};exports[_0x8794('0x54')]=function(_0x4554f3,_0x48eeff,_0x22f18c){if(_0x4554f3[_0x8794('0x4f')]['id']){delete _0x4554f3[_0x8794('0x4f')]['id'];}return db[_0x8794('0x48')][_0x8794('0x52')]({'where':{'id':_0x4554f3[_0x8794('0x50')]['id']}})['then'](handleEntityNotFound(_0x48eeff,null))['then'](function(_0x180b73){if(_0x180b73){_0x4554f3[_0x8794('0x4f')]['AccountId']=_0x180b73['id'];_0x4554f3[_0x8794('0x4f')][_0x8794('0x55')]=integrations[_0x8794('0x56')](_0x4554f3[_0x8794('0x4f')][_0x8794('0x57')],_0x4554f3['body'][_0x8794('0x34')]);_0x4554f3[_0x8794('0x4f')][_0x8794('0x58')]=integrations['getDescriptions'](_0x4554f3[_0x8794('0x4f')]['channel'],_0x4554f3[_0x8794('0x4f')][_0x8794('0x34')]);return db[_0x8794('0x53')][_0x8794('0x4e')](_0x4554f3[_0x8794('0x4f')],{'include':[{'model':db[_0x8794('0x59')],'as':_0x8794('0x55')},{'model':db[_0x8794('0x59')],'as':'Descriptions'}]});}return null;})[_0x8794('0x2d')](respondWithResult(_0x48eeff,null))['catch'](handleError(_0x48eeff,null));};exports[_0x8794('0x5a')]=function(_0x1ae06e,_0x528ebc,_0x1397f4){var _0x78df3b='';return db[_0x8794('0x48')][_0x8794('0x52')]({'where':{'id':_0x1ae06e[_0x8794('0x50')]['id']},'attributes':['id',_0x8794('0x5b'),_0x8794('0x5c')]})['then'](handleEntityNotFound(_0x528ebc,null))['then'](function(_0x4272d0){if(_0x4272d0){_0x78df3b=_0x4272d0['remoteUri'];var _0x5e640a=_0x78df3b[_0x8794('0x5d')](-0x1);if(_0x5e640a==='/'){_0x78df3b=_0x78df3b[_0x8794('0x5e')](0x0,_0x78df3b['lastIndexOf'](_0x5e640a));}return rp({'method':_0x8794('0x5f'),'uri':util[_0x8794('0x60')](_0x8794('0x61'),_0x78df3b,_0x8794('0x62')),'headers':{'Authorization':util['format'](_0x8794('0x63'),new Buffer(util[_0x8794('0x60')](_0x8794('0x64'),_0x4272d0[_0x8794('0x5c')]))[_0x8794('0x65')]('base64'))},'json':!![]});}})[_0x8794('0x2d')](function(_0x2186ea){if(_0x2186ea){var _0x2dd42e=[_0x8794('0x66'),_0x8794('0x67'),_0x8794('0x68'),_0x8794('0x69'),_0x8794('0x21'),_0x8794('0x6a'),_0x8794('0x6b'),_0x8794('0x6c'),_0x8794('0x6d'),_0x8794('0x6b'),_0x8794('0x6e')];_[_0x8794('0x6f')](_0x2186ea,function(_0x2b0825){return _0x2dd42e[_0x8794('0x70')](_0x2b0825[_0x8794('0x2f')])||!_0x2b0825[_0x8794('0x71')]&&_0x2b0825[_0x8794('0x34')]!==_0x8794('0x72')&&_0x2b0825[_0x8794('0x34')]!==_0x8794('0x73');});return{'count':_0x2186ea[_0x8794('0x3c')],'rows':_['map'](_0x2186ea,function(_0x4a349e){return{'id':_0x4a349e[_0x8794('0x2f')],'name':_0x4a349e[_0x8794('0x74')],'custom':!_0x4a349e[_0x8794('0x71')],'options':_0x4a349e['choices']?_['map'](_0x4a349e[_0x8794('0x75')],function(_0x273061){return{'name':_[_0x8794('0x76')](_0x273061),'value':_0x273061};}):[]};})};}})[_0x8794('0x2d')](respondWithResult(_0x528ebc,null))[_0x8794('0x4b')](function(_0x47b2e8){var _0x4abba7=_0x1ae06e[_0x8794('0x37')][_0x8794('0x77')]?0x1f4:_0x47b2e8[_0x8794('0x78')]||0x1f4;logger['error'](_0x8794('0x79'),_0x8794('0x5a'),_0x4abba7,JSON[_0x8794('0x7a')](_0x47b2e8));delete _0x47b2e8[_0x8794('0x2f')];if(_0x4abba7===0x191){_0x4abba7=0x190;}_0x528ebc[_0x8794('0x21')](_0x4abba7)['send'](_0x1ae06e[_0x8794('0x37')]['test']?{'message':_0x8794('0x7b'),'statusCode':_0x47b2e8[_0x8794('0x78')]}:_0x47b2e8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 420fddb..5d8f891 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 _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 +var _0xac57=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2a0134,_0x56a471){var _0x33a9f2=function(_0x1ff783){while(--_0x1ff783){_0x2a0134['push'](_0x2a0134['shift']());}};_0x33a9f2(++_0x56a471);}(_0xac57,0xbf));var _0x7ac5=function(_0x56e13e,_0x3754cd){_0x56e13e=_0x56e13e-0x0;var _0x148751=_0xac57[_0x56e13e];return _0x148751;};'use strict';var _=require(_0x7ac5('0x0'));var util=require('util');var logger=require(_0x7ac5('0x1'))(_0x7ac5('0x2'));var moment=require(_0x7ac5('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ac5('0x4'));var fs=require('fs');var path=require(_0x7ac5('0x5'));var rimraf=require(_0x7ac5('0x6'));var config=require(_0x7ac5('0x7'));var attributes=require(_0x7ac5('0x8'));var integrations=require(_0x7ac5('0x9'));module[_0x7ac5('0xa')]=function(_0x2f65fc,_0x1f2bb6){return _0x2f65fc[_0x7ac5('0xb')](_0x7ac5('0xc'),attributes,{'tableName':_0x7ac5('0xd'),'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 10f9462..19e6d50 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 _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 +var _0x80a5=['GetFreshdeskAccount','debug','catch','find','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','FreshdeskAccount','findAll','options','raw','where','include','map','model','attributes','then'];(function(_0x3151b9,_0x3c3057){var _0x354cce=function(_0x11e29d){while(--_0x11e29d){_0x3151b9['push'](_0x3151b9['shift']());}};_0x354cce(++_0x3c3057);}(_0x80a5,0xb4));var _0x580a=function(_0x4b6d28,_0x2c761b){_0x4b6d28=_0x4b6d28-0x0;var _0x46f15b=_0x80a5[_0x4b6d28];return _0x46f15b;};'use strict';var _=require(_0x580a('0x0'));var util=require(_0x580a('0x1'));var moment=require('moment');var BPromise=require(_0x580a('0x2'));var rs=require(_0x580a('0x3'));var fs=require('fs');var Redis=require(_0x580a('0x4'));var db=require(_0x580a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x580a('0x6'));var config=require(_0x580a('0x7'));var jayson=require(_0x580a('0x8'));var client=jayson[_0x580a('0x9')][_0x580a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fae02,_0x36a418,_0x260487){return new BPromise(function(_0x93ec2a,_0x3b8e38){return client[_0x580a('0xb')](_0x1fae02,_0x260487)['then'](function(_0x5f17cf){logger[_0x580a('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x36a418,_0x580a('0xd'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x36a418,_0x580a('0xd'),JSON[_0x580a('0xe')](_0x5f17cf));if(_0x5f17cf[_0x580a('0xf')]){if(_0x5f17cf[_0x580a('0xf')][_0x580a('0x10')]===0x1f4){logger[_0x580a('0xf')](_0x580a('0x11'),_0x36a418,_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);return _0x3b8e38(_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);}logger['error'](_0x580a('0x11'),_0x36a418,_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);return _0x93ec2a(_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);}else{logger[_0x580a('0xc')](_0x580a('0x11'),_0x36a418,_0x580a('0xd'));_0x93ec2a(_0x5f17cf[_0x580a('0x13')]['message']);}})['catch'](function(_0x50ad0c){logger[_0x580a('0xf')](_0x580a('0x11'),_0x36a418,_0x50ad0c);_0x3b8e38(_0x50ad0c);});});}exports['GetFreshdeskAccount']=function(_0x26c513){var _0x431086=this;return new Promise(function(_0x3ad6ca,_0x12af62){return db[_0x580a('0x14')][_0x580a('0x15')]({'raw':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')][_0x580a('0x17')]===undefined?!![]:![]:!![],'where':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')][_0x580a('0x18')]||null:null,'attributes':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')]['attributes']||null:null,'limit':_0x26c513[_0x580a('0x16')]?_0x26c513['options']['limit']||null:null,'include':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')][_0x580a('0x19')]?_[_0x580a('0x1a')](_0x26c513[_0x580a('0x16')][_0x580a('0x19')],function(_0x62e1cf){return{'model':db[_0x62e1cf[_0x580a('0x1b')]],'as':_0x62e1cf['as'],'attributes':_0x62e1cf[_0x580a('0x1c')],'include':_0x62e1cf[_0x580a('0x19')]?_[_0x580a('0x1a')](_0x62e1cf[_0x580a('0x19')],function(_0x50dfb4){return{'model':db[_0x50dfb4[_0x580a('0x1b')]],'as':_0x50dfb4['as'],'attributes':_0x50dfb4[_0x580a('0x1c')],'include':_0x50dfb4[_0x580a('0x19')]?_[_0x580a('0x1a')](_0x50dfb4[_0x580a('0x19')],function(_0x3aed9c){return{'model':db[_0x3aed9c[_0x580a('0x1b')]],'as':_0x3aed9c['as'],'attributes':_0x3aed9c[_0x580a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x580a('0x1d')](function(_0x10c2ce){logger[_0x580a('0xc')](_0x580a('0x1e'),_0x26c513);logger[_0x580a('0x1f')](_0x580a('0x1e'),_0x26c513,JSON['stringify'](_0x10c2ce));_0x3ad6ca(_0x10c2ce);})[_0x580a('0x20')](function(_0x835070){logger['error']('GetFreshdeskAccount',_0x835070['message'],_0x26c513);_0x12af62(_0x431086[_0x580a('0xf')](0x1f4,_0x835070[_0x580a('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x5a79dc){var _0x2ad243=this;return new Promise(function(_0x53444b,_0x320270){return db[_0x580a('0x14')][_0x580a('0x21')]({'raw':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')][_0x580a('0x17')]===undefined?!![]:![]:!![],'where':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')][_0x580a('0x18')]||null:null,'attributes':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')][_0x580a('0x1c')]||null:null,'include':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')]['include']?_[_0x580a('0x1a')](_0x5a79dc[_0x580a('0x16')][_0x580a('0x19')],function(_0x60d1c0){return{'model':db[_0x60d1c0['model']],'as':_0x60d1c0['as'],'attributes':_0x60d1c0[_0x580a('0x1c')],'include':_0x60d1c0['include']?_[_0x580a('0x1a')](_0x60d1c0[_0x580a('0x19')],function(_0x3c8a9d){return{'model':db[_0x3c8a9d['model']],'as':_0x3c8a9d['as'],'attributes':_0x3c8a9d[_0x580a('0x1c')],'include':_0x3c8a9d[_0x580a('0x19')]?_[_0x580a('0x1a')](_0x3c8a9d[_0x580a('0x19')],function(_0x56670f){return{'model':db[_0x56670f['model']],'as':_0x56670f['as'],'attributes':_0x56670f[_0x580a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x580a('0x1d')](function(_0x4e4cc1){logger['info'](_0x580a('0x22'),_0x5a79dc);logger[_0x580a('0x1f')](_0x580a('0x22'),_0x5a79dc,JSON[_0x580a('0xe')](_0x4e4cc1));_0x53444b(_0x4e4cc1);})[_0x580a('0x20')](function(_0x28a535){logger[_0x580a('0xf')]('ShowFreshdeskAccount',_0x28a535[_0x580a('0x12')],_0x5a79dc);_0x320270(_0x2ad243[_0x580a('0xf')](0x1f4,_0x28a535[_0x580a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 85ff008..3086f83 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 _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 +var _0x0fb8=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','delete','destroy','exports','multer','util'];(function(_0x4f8b2c,_0x237879){var _0x290f14=function(_0x2985b9){while(--_0x2985b9){_0x4f8b2c['push'](_0x4f8b2c['shift']());}};_0x290f14(++_0x237879);}(_0x0fb8,0xa6));var _0x80fb=function(_0x170a9f,_0x5ecb4a){_0x170a9f=_0x170a9f-0x0;var _0x9be5af=_0x0fb8[_0x170a9f];return _0x9be5af;};'use strict';var multer=require(_0x80fb('0x0'));var util=require(_0x80fb('0x1'));var path=require(_0x80fb('0x2'));var timeout=require(_0x80fb('0x3'));var express=require(_0x80fb('0x4'));var router=express[_0x80fb('0x5')]();var fs_extra=require(_0x80fb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x80fb('0x7'));var config=require(_0x80fb('0x8'));var controller=require(_0x80fb('0x9'));router[_0x80fb('0xa')]('/',auth[_0x80fb('0xb')](),controller[_0x80fb('0xc')]);router[_0x80fb('0xa')](_0x80fb('0xd'),auth[_0x80fb('0xb')](),controller[_0x80fb('0xe')]);router['get'](_0x80fb('0xf'),auth[_0x80fb('0xb')](),controller[_0x80fb('0x10')]);router[_0x80fb('0xa')](_0x80fb('0x11'),auth[_0x80fb('0xb')](),controller['getSubjects']);router[_0x80fb('0xa')](_0x80fb('0x12'),auth['isAuthenticated'](),controller[_0x80fb('0x13')]);router[_0x80fb('0xa')](_0x80fb('0x14'),auth[_0x80fb('0xb')](),controller['getTags']);router[_0x80fb('0x15')]('/',auth[_0x80fb('0xb')](),controller[_0x80fb('0x16')]);router[_0x80fb('0x15')](_0x80fb('0x14'),auth[_0x80fb('0xb')](),controller[_0x80fb('0x17')]);router[_0x80fb('0x18')](_0x80fb('0xd'),auth[_0x80fb('0xb')](),controller['update']);router[_0x80fb('0x19')](_0x80fb('0xd'),auth[_0x80fb('0xb')](),controller[_0x80fb('0x1a')]);module[_0x80fb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 43d01d8..4e89b67 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 _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 +var _0xd406=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd406,0x1a4));var _0x6d40=function(_0x10078d,_0x237968){_0x10078d=_0x10078d-0x0;var _0x39f417=_0xd406[_0x10078d];return _0x39f417;};'use strict';var Sequelize=require(_0x6d40('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d40('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5606d02..8a6feae 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 _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 +var _0x88da=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','end','name','map','FreshdeskConfiguration','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','find','body','params','findOne','FreshdeskField','rawAttributes','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','path','sox','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x1924c3,_0x2f4a9a){var _0x56217a=function(_0x45f94c){while(--_0x45f94c){_0x1924c3['push'](_0x1924c3['shift']());}};_0x56217a(++_0x2f4a9a);}(_0x88da,0x129));var _0xa88d=function(_0x29b872,_0xd60230){_0x29b872=_0x29b872-0x0;var _0x14ba28=_0x88da[_0x29b872];return _0x14ba28;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa88d('0x0'));var jsonpatch=require(_0xa88d('0x1'));var rp=require(_0xa88d('0x2'));var moment=require(_0xa88d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa88d('0x4'));var sox=require(_0xa88d('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa88d('0x6'));var _=require('lodash');var squel=require(_0xa88d('0x7'));var crypto=require(_0xa88d('0x8'));var jsforce=require(_0xa88d('0x9'));var deskjs=require(_0xa88d('0xa'));var toCsv=require(_0xa88d('0xb'));var querystring=require(_0xa88d('0xc'));var Papa=require(_0xa88d('0xd'));var Redis=require(_0xa88d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa88d('0xf'));var as=require(_0xa88d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa88d('0x11'))(_0xa88d('0x12'));var utils=require(_0xa88d('0x13'));var config=require(_0xa88d('0x14'));var licenseUtil=require(_0xa88d('0x15'));var db=require(_0xa88d('0x16'))['db'];function respondWithStatusCode(_0x30af56,_0x497f78){_0x497f78=_0x497f78||0xcc;return function(_0x4a27d6){if(_0x4a27d6){return _0x30af56[_0xa88d('0x17')](_0x497f78);}return _0x30af56[_0xa88d('0x18')](_0x497f78)['end']();};}function respondWithResult(_0x4aa09b,_0x3bd427){_0x3bd427=_0x3bd427||0xc8;return function(_0x21116c){if(_0x21116c){return _0x4aa09b[_0xa88d('0x18')](_0x3bd427)[_0xa88d('0x19')](_0x21116c);}};}function respondWithFilteredResult(_0x2e786f,_0x167e34){return function(_0xe2eff4){if(_0xe2eff4){var _0x2a832e=typeof _0x167e34[_0xa88d('0x1a')]==='undefined'&&typeof _0x167e34[_0xa88d('0x1b')]===_0xa88d('0x1c');var _0x321358=_0xe2eff4[_0xa88d('0x1d')];var _0x129106=_0x2a832e?0x0:_0x167e34[_0xa88d('0x1a')];var _0xe8516=_0x2a832e?_0xe2eff4[_0xa88d('0x1d')]:_0x167e34[_0xa88d('0x1a')]+_0x167e34[_0xa88d('0x1b')];var _0x1daf07;if(_0xe8516>=_0x321358){_0xe8516=_0x321358;_0x1daf07=0xc8;}else{_0x1daf07=0xce;}_0x2e786f['status'](_0x1daf07);return _0x2e786f[_0xa88d('0x1e')]('Content-Range',_0x129106+'-'+_0xe8516+'/'+_0x321358)[_0xa88d('0x19')](_0xe2eff4);}return null;};}function patchUpdates(_0x231760){return function(_0x56182d){try{jsonpatch['apply'](_0x56182d,_0x231760,!![]);}catch(_0xfc3562){return BPromise[_0xa88d('0x1f')](_0xfc3562);}return _0x56182d[_0xa88d('0x20')]();};}function saveUpdates(_0x6b178c,_0x3db26c){return function(_0x32fdfa){if(_0x32fdfa){return _0x32fdfa[_0xa88d('0x21')](_0x6b178c)[_0xa88d('0x22')](function(_0x5342a9){return _0x5342a9;});}return null;};}function removeEntity(_0x4b8563,_0x5a229c){return function(_0x317e4a){if(_0x317e4a){return _0x317e4a[_0xa88d('0x23')]()['then'](function(){_0x4b8563[_0xa88d('0x18')](0xcc)[_0xa88d('0x24')]();});}};}function handleEntityNotFound(_0x556e29,_0x2259ad){return function(_0x393507){if(!_0x393507){_0x556e29[_0xa88d('0x17')](0x194);}return _0x393507;};}function handleError(_0x36882d,_0x270d85){_0x270d85=_0x270d85||0x1f4;return function(_0x15d364){logger['error'](_0x15d364['stack']);if(_0x15d364[_0xa88d('0x25')]){delete _0x15d364[_0xa88d('0x25')];}_0x36882d[_0xa88d('0x18')](_0x270d85)['send'](_0x15d364);};}exports['index']=function(_0x496a8d,_0x3b3f09){var _0x5b3da9={},_0x39c4d7={},_0x1077d8={'count':0x0,'rows':[]};var _0x3fa498=_[_0xa88d('0x26')](db[_0xa88d('0x27')]['rawAttributes'],function(_0x1598b0){return{'name':_0x1598b0[_0xa88d('0x28')],'type':_0x1598b0['type']['key']};});_0x39c4d7[_0xa88d('0x29')]=_[_0xa88d('0x26')](_0x3fa498,_0xa88d('0x25'));_0x39c4d7[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0x496a8d['query']);_0x39c4d7[_0xa88d('0x2c')]=_['intersection'](_0x39c4d7[_0xa88d('0x29')],_0x39c4d7[_0xa88d('0x2a')]);_0x5b3da9[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x39c4d7['model'],qs[_0xa88d('0x2f')](_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x5b3da9[_0xa88d('0x2d')]=_0x5b3da9['attributes'][_0xa88d('0x30')]?_0x5b3da9[_0xa88d('0x2d')]:_0x39c4d7[_0xa88d('0x29')];if(!_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x31')](_0xa88d('0x32'))){_0x5b3da9[_0xa88d('0x1b')]=qs['limit'](_0x496a8d['query']['limit']);_0x5b3da9['offset']=qs['offset'](_0x496a8d['query'][_0xa88d('0x1a')]);}_0x5b3da9['order']=qs[_0xa88d('0x33')](_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x5b3da9[_0xa88d('0x34')]=qs['filters'](_[_0xa88d('0x35')](_0x496a8d[_0xa88d('0x2a')],_0x39c4d7[_0xa88d('0x2c')]),_0x3fa498);if(_0x496a8d['query']['filter']){_0x5b3da9[_0xa88d('0x34')]=_[_0xa88d('0x36')](_0x5b3da9[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x3fa498,function(_0x163dff){if(_0x163dff[_0xa88d('0x37')]!==_0xa88d('0x38')){var _0x527a20={};_0x527a20[_0x163dff[_0xa88d('0x25')]]={'$like':'%'+_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x39')]+'%'};return _0x527a20;}})});}_0x5b3da9=_[_0xa88d('0x36')]({},_0x5b3da9,_0x496a8d[_0xa88d('0x3a')]);var _0x216d3a={'where':_0x5b3da9[_0xa88d('0x34')]};return db['FreshdeskConfiguration'][_0xa88d('0x1d')](_0x216d3a)[_0xa88d('0x22')](function(_0x2fa7bc){_0x1077d8[_0xa88d('0x1d')]=_0x2fa7bc;if(_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x3b')]){_0x5b3da9[_0xa88d('0x3c')]=[{'all':!![]}];}return db[_0xa88d('0x27')][_0xa88d('0x3d')](_0x5b3da9);})[_0xa88d('0x22')](function(_0x1da355){_0x1077d8['rows']=_0x1da355;return _0x1077d8;})[_0xa88d('0x22')](respondWithFilteredResult(_0x3b3f09,_0x5b3da9))[_0xa88d('0x3e')](handleError(_0x3b3f09,null));};exports['show']=function(_0x479b0b,_0x354168){var _0x2c87ea={'raw':![],'where':{'id':_0x479b0b['params']['id']}},_0xccd6fb={};_0xccd6fb[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x27')]['rawAttributes']);_0xccd6fb['query']=_[_0xa88d('0x2b')](_0x479b0b[_0xa88d('0x2a')]);_0xccd6fb[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0xccd6fb[_0xa88d('0x29')],_0xccd6fb[_0xa88d('0x2a')]);_0x2c87ea[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0xccd6fb['model'],qs[_0xa88d('0x2f')](_0x479b0b[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x2c87ea[_0xa88d('0x2d')]=_0x2c87ea[_0xa88d('0x2d')][_0xa88d('0x30')]?_0x2c87ea[_0xa88d('0x2d')]:_0xccd6fb[_0xa88d('0x29')];if(_0x479b0b[_0xa88d('0x2a')][_0xa88d('0x3b')]){_0x2c87ea[_0xa88d('0x3c')]=[{'all':!![]}];}_0x2c87ea=_['merge']({},_0x2c87ea,_0x479b0b[_0xa88d('0x3a')]);return db[_0xa88d('0x27')][_0xa88d('0x3f')](_0x2c87ea)[_0xa88d('0x22')](handleEntityNotFound(_0x354168,null))[_0xa88d('0x22')](respondWithResult(_0x354168,null))[_0xa88d('0x3e')](handleError(_0x354168,null));};exports['create']=function(_0x1d73ac,_0x349c7d){return db['FreshdeskConfiguration']['create'](_0x1d73ac[_0xa88d('0x40')],{})[_0xa88d('0x22')](respondWithResult(_0x349c7d,0xc9))[_0xa88d('0x3e')](handleError(_0x349c7d,null));};exports['update']=function(_0x599b8f,_0x448bcb){if(_0x599b8f[_0xa88d('0x40')]['id']){delete _0x599b8f[_0xa88d('0x40')]['id'];}return db[_0xa88d('0x27')][_0xa88d('0x3f')]({'where':{'id':_0x599b8f[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x448bcb,null))[_0xa88d('0x22')](saveUpdates(_0x599b8f[_0xa88d('0x40')],null))[_0xa88d('0x22')](respondWithResult(_0x448bcb,null))[_0xa88d('0x3e')](handleError(_0x448bcb,null));};exports[_0xa88d('0x23')]=function(_0x2fc9db,_0x5e57d4){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2fc9db[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x5e57d4,null))[_0xa88d('0x22')](removeEntity(_0x5e57d4,null))[_0xa88d('0x3e')](handleError(_0x5e57d4,null));};exports['getFields']=function(_0xde7b93,_0x446194,_0x5818b2){var _0x28d099={};var _0x348dbc={};var _0x115368;var _0x313c26;return db[_0xa88d('0x27')][_0xa88d('0x42')]({'where':{'id':_0xde7b93[_0xa88d('0x41')]['id']}})['then'](handleEntityNotFound(_0x446194,null))['then'](function(_0x134150){if(_0x134150){_0x115368=_0x134150;_0x348dbc['model']=_[_0xa88d('0x2b')](db[_0xa88d('0x43')][_0xa88d('0x44')]);_0x348dbc[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0xde7b93[_0xa88d('0x2a')]);_0x348dbc[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0x348dbc['model'],_0x348dbc[_0xa88d('0x2a')]);_0x28d099[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x348dbc['model'],qs['fields'](_0xde7b93[_0xa88d('0x2a')]['fields']));_0x28d099[_0xa88d('0x2d')]=_0x28d099[_0xa88d('0x2d')][_0xa88d('0x30')]?_0x28d099[_0xa88d('0x2d')]:_0x348dbc[_0xa88d('0x29')];_0x28d099[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0xde7b93[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x28d099[_0xa88d('0x34')]=qs[_0xa88d('0x2c')](_[_0xa88d('0x35')](_0xde7b93[_0xa88d('0x2a')],_0x348dbc['filters']));if(_0xde7b93['query']['filter']){_0x28d099[_0xa88d('0x34')]=_[_0xa88d('0x36')](_0x28d099[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x28d099['attributes'],function(_0x4ae2c7){var _0x1b4797={};_0x1b4797[_0x4ae2c7]={'$like':'%'+_0xde7b93['query']['filter']+'%'};return _0x1b4797;})});}_0x28d099=_[_0xa88d('0x36')]({},_0x28d099,_0xde7b93[_0xa88d('0x3a')]);return _0x115368['getFields'](_0x28d099);}})[_0xa88d('0x22')](function(_0x575ad8){if(_0x575ad8){_0x313c26=_0x575ad8[_0xa88d('0x30')];if(!_0xde7b93[_0xa88d('0x2a')][_0xa88d('0x31')](_0xa88d('0x32'))){_0x28d099[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0xde7b93[_0xa88d('0x2a')]['limit']);_0x28d099[_0xa88d('0x1a')]=qs[_0xa88d('0x1a')](_0xde7b93[_0xa88d('0x2a')][_0xa88d('0x1a')]);}return _0x115368[_0xa88d('0x46')](_0x28d099);}})[_0xa88d('0x22')](function(_0x518ee3){if(_0x518ee3){return _0x518ee3?{'count':_0x313c26,'rows':_0x518ee3}:null;}})[_0xa88d('0x22')](respondWithResult(_0x446194,null))[_0xa88d('0x3e')](handleError(_0x446194,null));};exports['getSubjects']=function(_0x34a3aa,_0x2e0553,_0x2f4c2a){var _0x16585f={};var _0x7ef126={};var _0x4a3cc2;var _0x5d12a8;return db[_0xa88d('0x27')][_0xa88d('0x42')]({'where':{'id':_0x34a3aa['params']['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x2e0553,null))[_0xa88d('0x22')](function(_0x244aa4){if(_0x244aa4){_0x4a3cc2=_0x244aa4;_0x7ef126[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x43')][_0xa88d('0x44')]);_0x7ef126['query']=_[_0xa88d('0x2b')](_0x34a3aa[_0xa88d('0x2a')]);_0x7ef126[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0x7ef126['model'],_0x7ef126[_0xa88d('0x2a')]);_0x16585f[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x7ef126[_0xa88d('0x29')],qs[_0xa88d('0x2f')](_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x16585f[_0xa88d('0x2d')]=_0x16585f[_0xa88d('0x2d')]['length']?_0x16585f[_0xa88d('0x2d')]:_0x7ef126[_0xa88d('0x29')];_0x16585f[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x16585f[_0xa88d('0x34')]=qs[_0xa88d('0x2c')](_[_0xa88d('0x35')](_0x34a3aa['query'],_0x7ef126[_0xa88d('0x2c')]));if(_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x39')]){_0x16585f[_0xa88d('0x34')]=_[_0xa88d('0x36')](_0x16585f['where'],{'$or':_['map'](_0x16585f[_0xa88d('0x2d')],function(_0x3aea99){var _0x398fd3={};_0x398fd3[_0x3aea99]={'$like':'%'+_0x34a3aa['query'][_0xa88d('0x39')]+'%'};return _0x398fd3;})});}_0x16585f=_[_0xa88d('0x36')]({},_0x16585f,_0x34a3aa[_0xa88d('0x3a')]);return _0x4a3cc2[_0xa88d('0x47')](_0x16585f);}})[_0xa88d('0x22')](function(_0x7d6263){if(_0x7d6263){_0x5d12a8=_0x7d6263[_0xa88d('0x30')];if(!_0x34a3aa[_0xa88d('0x2a')]['hasOwnProperty'](_0xa88d('0x32'))){_0x16585f[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x1b')]);_0x16585f['offset']=qs[_0xa88d('0x1a')](_0x34a3aa[_0xa88d('0x2a')]['offset']);}return _0x4a3cc2[_0xa88d('0x47')](_0x16585f);}})[_0xa88d('0x22')](function(_0x5bb43a){if(_0x5bb43a){return _0x5bb43a?{'count':_0x5d12a8,'rows':_0x5bb43a}:null;}})['then'](respondWithResult(_0x2e0553,null))[_0xa88d('0x3e')](handleError(_0x2e0553,null));};exports[_0xa88d('0x48')]=function(_0x15abfe,_0x1bb27c,_0x130843){var _0x4adb9b={};var _0x327de6={};var _0x29834d;var _0x32a18d;return db['FreshdeskConfiguration'][_0xa88d('0x42')]({'where':{'id':_0x15abfe['params']['id']}})['then'](handleEntityNotFound(_0x1bb27c,null))[_0xa88d('0x22')](function(_0x3948bf){if(_0x3948bf){_0x29834d=_0x3948bf;_0x327de6[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x43')][_0xa88d('0x44')]);_0x327de6[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0x15abfe['query']);_0x327de6[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0x327de6[_0xa88d('0x29')],_0x327de6[_0xa88d('0x2a')]);_0x4adb9b[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x327de6[_0xa88d('0x29')],qs['fields'](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x4adb9b[_0xa88d('0x2d')]=_0x4adb9b[_0xa88d('0x2d')]['length']?_0x4adb9b[_0xa88d('0x2d')]:_0x327de6[_0xa88d('0x29')];_0x4adb9b[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x4adb9b[_0xa88d('0x34')]=qs[_0xa88d('0x2c')](_['pick'](_0x15abfe[_0xa88d('0x2a')],_0x327de6['filters']));if(_0x15abfe['query'][_0xa88d('0x39')]){_0x4adb9b['where']=_[_0xa88d('0x36')](_0x4adb9b[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x4adb9b['attributes'],function(_0x4a6520){var _0x36477d={};_0x36477d[_0x4a6520]={'$like':'%'+_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x39')]+'%'};return _0x36477d;})});}_0x4adb9b=_[_0xa88d('0x36')]({},_0x4adb9b,_0x15abfe[_0xa88d('0x3a')]);return _0x29834d[_0xa88d('0x48')](_0x4adb9b);}})[_0xa88d('0x22')](function(_0x5530fd){if(_0x5530fd){_0x32a18d=_0x5530fd[_0xa88d('0x30')];if(!_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x31')](_0xa88d('0x32'))){_0x4adb9b[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x1b')]);_0x4adb9b[_0xa88d('0x1a')]=qs['offset'](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x1a')]);}return _0x29834d[_0xa88d('0x48')](_0x4adb9b);}})[_0xa88d('0x22')](function(_0x36d18c){if(_0x36d18c){return _0x36d18c?{'count':_0x32a18d,'rows':_0x36d18c}:null;}})['then'](respondWithResult(_0x1bb27c,null))[_0xa88d('0x3e')](handleError(_0x1bb27c,null));};exports[_0xa88d('0x49')]=function(_0x23de05,_0x2c5d3f,_0x36c69e){var _0x1b165e={};var _0xa5cda={};var _0x443486;var _0x5f0a99;return db[_0xa88d('0x27')][_0xa88d('0x42')]({'where':{'id':_0x23de05[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x2c5d3f,null))[_0xa88d('0x22')](function(_0xe55123){if(_0xe55123){_0x443486=_0xe55123;_0xa5cda[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x4a')]['rawAttributes']);_0xa5cda[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0x23de05['query']);_0xa5cda[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0xa5cda['model'],_0xa5cda[_0xa88d('0x2a')]);_0x1b165e['attributes']=_[_0xa88d('0x2e')](_0xa5cda['model'],qs[_0xa88d('0x2f')](_0x23de05[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x1b165e['attributes']=_0x1b165e[_0xa88d('0x2d')][_0xa88d('0x30')]?_0x1b165e[_0xa88d('0x2d')]:_0xa5cda[_0xa88d('0x29')];_0x1b165e[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0x23de05[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x1b165e['where']=qs['filters'](_[_0xa88d('0x35')](_0x23de05['query'],_0xa5cda[_0xa88d('0x2c')]));if(_0x23de05[_0xa88d('0x2a')][_0xa88d('0x39')]){_0x1b165e['where']=_[_0xa88d('0x36')](_0x1b165e[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x1b165e['attributes'],function(_0x4f40f1){var _0x563b2e={};_0x563b2e[_0x4f40f1]={'$like':'%'+_0x23de05[_0xa88d('0x2a')]['filter']+'%'};return _0x563b2e;})});}_0x1b165e=_[_0xa88d('0x36')]({},_0x1b165e,_0x23de05['options']);return _0x443486[_0xa88d('0x49')](_0x1b165e);}})[_0xa88d('0x22')](function(_0x17805b){if(_0x17805b){_0x5f0a99=_0x17805b['length'];if(!_0x23de05['query'][_0xa88d('0x31')](_0xa88d('0x32'))){_0x1b165e[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0x23de05['query'][_0xa88d('0x1b')]);_0x1b165e[_0xa88d('0x1a')]=qs[_0xa88d('0x1a')](_0x23de05[_0xa88d('0x2a')][_0xa88d('0x1a')]);}return _0x443486[_0xa88d('0x49')](_0x1b165e);}})[_0xa88d('0x22')](function(_0x346170){if(_0x346170){return _0x346170?{'count':_0x5f0a99,'rows':_0x346170}:null;}})[_0xa88d('0x22')](respondWithResult(_0x2c5d3f,null))[_0xa88d('0x3e')](handleError(_0x2c5d3f,null));};exports[_0xa88d('0x4b')]=function(_0x2ef34f,_0xc7caf0,_0x5480dc){if(_0x2ef34f[_0xa88d('0x40')]['id']){delete _0x2ef34f['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2ef34f[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0xc7caf0,null))[_0xa88d('0x22')](function(_0x179b09){if(_0x179b09){return _0x179b09['setTags'](_0x2ef34f[_0xa88d('0x40')][_0xa88d('0x4c')]||[]);}return null;})[_0xa88d('0x22')](respondWithResult(_0xc7caf0,null))[_0xa88d('0x3e')](handleError(_0xc7caf0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 69616ba..435cb32 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 _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 +var _0x8719=['./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8719,0x10c));var _0x9871=function(_0x58ed9a,_0x9e00e2){_0x58ed9a=_0x58ed9a-0x0;var _0x1a0ff2=_0x8719[_0x58ed9a];return _0x1a0ff2;};'use strict';var _=require(_0x9871('0x0'));var util=require('util');var logger=require(_0x9871('0x1'))(_0x9871('0x2'));var moment=require('moment');var BPromise=require(_0x9871('0x3'));var rp=require(_0x9871('0x4'));var fs=require('fs');var path=require(_0x9871('0x5'));var rimraf=require(_0x9871('0x6'));var config=require(_0x9871('0x7'));var attributes=require(_0x9871('0x8'));module[_0x9871('0x9')]=function(_0x5627b6,_0x3f2b87){return _0x5627b6[_0x9871('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x9871('0xb'),'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 ceb6fb6..2d064aa 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 _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 +var _0x48a0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48a0,0xdf));var _0x048a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x48a0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x048a('0x0'));var util=require(_0x048a('0x1'));var moment=require(_0x048a('0x2'));var BPromise=require(_0x048a('0x3'));var rs=require(_0x048a('0x4'));var fs=require('fs');var Redis=require(_0x048a('0x5'));var db=require(_0x048a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x048a('0x7'))(_0x048a('0x8'));var config=require(_0x048a('0x9'));var jayson=require(_0x048a('0xa'));var client=jayson[_0x048a('0xb')][_0x048a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x330126,_0x4fd54c,_0x49f8f8){return new BPromise(function(_0xc64f4d,_0x4fb3cd){return client['request'](_0x330126,_0x49f8f8)['then'](function(_0x4fb12b){logger[_0x048a('0xd')](_0x048a('0xe'),_0x4fd54c,_0x048a('0xf'));logger[_0x048a('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4fd54c,_0x048a('0xf'),JSON[_0x048a('0x11')](_0x4fb12b));if(_0x4fb12b[_0x048a('0x12')]){if(_0x4fb12b[_0x048a('0x12')][_0x048a('0x13')]===0x1f4){logger[_0x048a('0x12')](_0x048a('0xe'),_0x4fd54c,_0x4fb12b[_0x048a('0x12')][_0x048a('0x14')]);return _0x4fb3cd(_0x4fb12b[_0x048a('0x12')][_0x048a('0x14')]);}logger[_0x048a('0x12')](_0x048a('0xe'),_0x4fd54c,_0x4fb12b[_0x048a('0x12')][_0x048a('0x14')]);return _0xc64f4d(_0x4fb12b[_0x048a('0x12')]['message']);}else{logger[_0x048a('0xd')](_0x048a('0xe'),_0x4fd54c,_0x048a('0xf'));_0xc64f4d(_0x4fb12b[_0x048a('0x15')][_0x048a('0x14')]);}})[_0x048a('0x16')](function(_0x33b11a){logger[_0x048a('0x12')](_0x048a('0xe'),_0x4fd54c,_0x33b11a);_0x4fb3cd(_0x33b11a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2c56cd3..49630ec 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 _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 +var _0x7519=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','post','create','put','isAuthenticated','delete','destroy','exports','multer'];(function(_0xa95950,_0x107291){var _0x5ba827=function(_0x57ad98){while(--_0x57ad98){_0xa95950['push'](_0xa95950['shift']());}};_0x5ba827(++_0x107291);}(_0x7519,0xbd));var _0x9751=function(_0x5030f4,_0x558ca8){_0x5030f4=_0x5030f4-0x0;var _0x4cc195=_0x7519[_0x5030f4];return _0x4cc195;};'use strict';var multer=require(_0x9751('0x0'));var util=require(_0x9751('0x1'));var path=require('path');var timeout=require(_0x9751('0x2'));var express=require(_0x9751('0x3'));var router=express[_0x9751('0x4')]();var fs_extra=require(_0x9751('0x5'));var auth=require(_0x9751('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9751('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9751('0x8')]('/',auth['isAuthenticated'](),controller[_0x9751('0x9')]);router[_0x9751('0x8')](_0x9751('0xa'),auth['isAuthenticated'](),controller[_0x9751('0xb')]);router[_0x9751('0xc')]('/',auth['isAuthenticated'](),controller[_0x9751('0xd')]);router[_0x9751('0xe')](_0x9751('0xa'),auth[_0x9751('0xf')](),controller['update']);router[_0x9751('0x10')](_0x9751('0xa'),auth['isAuthenticated'](),controller[_0x9751('0x11')]);module[_0x9751('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 12959b8..706d3e5 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 _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 +var _0xebf5=['exports','ENUM','variable','picklist','string','STRING','customVariable','sequelize'];(function(_0x16a200,_0x414bbd){var _0x106a31=function(_0x3380ad){while(--_0x3380ad){_0x16a200['push'](_0x16a200['shift']());}};_0x106a31(++_0x414bbd);}(_0xebf5,0x177));var _0x5ebf=function(_0x2c823e,_0x1067c9){_0x2c823e=_0x2c823e-0x0;var _0x21b297=_0xebf5[_0x2c823e];return _0x21b297;};'use strict';var Sequelize=require(_0x5ebf('0x0'));module[_0x5ebf('0x1')]={'type':{'type':Sequelize[_0x5ebf('0x2')]('string',_0x5ebf('0x3'),'customVariable','keyValue',_0x5ebf('0x4')),'defaultValue':_0x5ebf('0x5')},'content':{'type':Sequelize[_0x5ebf('0x6')]},'key':{'type':Sequelize[_0x5ebf('0x6')]},'keyType':{'type':Sequelize[_0x5ebf('0x2')](_0x5ebf('0x5'),'variable',_0x5ebf('0x7'))},'keyContent':{'type':Sequelize[_0x5ebf('0x6')]},'idField':{'type':Sequelize[_0x5ebf('0x6')]},'nameField':{'type':Sequelize[_0x5ebf('0x6')]},'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 129fda8..f6e2629 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 _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 +var _0xcffe=['apply','reject','save','then','error','name','send','FreshdeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range'];(function(_0x587ccb,_0x325edd){var _0x361336=function(_0x236204){while(--_0x236204){_0x587ccb['push'](_0x587ccb['shift']());}};_0x361336(++_0x325edd);}(_0xcffe,0x1a1));var _0xecff=function(_0x558414,_0x58ea6e){_0x558414=_0x558414-0x0;var _0x343829=_0xcffe[_0x558414];return _0x343829;};'use strict';var emlformat=require(_0xecff('0x0'));var rimraf=require(_0xecff('0x1'));var zipdir=require(_0xecff('0x2'));var jsonpatch=require(_0xecff('0x3'));var rp=require(_0xecff('0x4'));var moment=require(_0xecff('0x5'));var BPromise=require(_0xecff('0x6'));var Mustache=require(_0xecff('0x7'));var util=require(_0xecff('0x8'));var path=require(_0xecff('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xecff('0xa'));var fs=require('fs');var fs_extra=require(_0xecff('0xb'));var _=require(_0xecff('0xc'));var squel=require(_0xecff('0xd'));var crypto=require(_0xecff('0xe'));var jsforce=require(_0xecff('0xf'));var deskjs=require(_0xecff('0x10'));var toCsv=require('to-csv');var querystring=require(_0xecff('0x11'));var Papa=require(_0xecff('0x12'));var Redis=require(_0xecff('0x13'));var authService=require(_0xecff('0x14'));var qs=require(_0xecff('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecff('0x16'));var logger=require(_0xecff('0x17'))(_0xecff('0x18'));var utils=require(_0xecff('0x19'));var config=require(_0xecff('0x1a'));var licenseUtil=require(_0xecff('0x1b'));var db=require(_0xecff('0x1c'))['db'];function respondWithStatusCode(_0x32627c,_0x3e907d){_0x3e907d=_0x3e907d||0xcc;return function(_0x151a79){if(_0x151a79){return _0x32627c[_0xecff('0x1d')](_0x3e907d);}return _0x32627c[_0xecff('0x1e')](_0x3e907d)[_0xecff('0x1f')]();};}function respondWithResult(_0xb8745f,_0x5495f9){_0x5495f9=_0x5495f9||0xc8;return function(_0x4b1893){if(_0x4b1893){return _0xb8745f[_0xecff('0x1e')](_0x5495f9)[_0xecff('0x20')](_0x4b1893);}};}function respondWithFilteredResult(_0x558ecd,_0x35ce1f){return function(_0x362ed0){if(_0x362ed0){var _0x3a7623=typeof _0x35ce1f['offset']==='undefined'&&typeof _0x35ce1f[_0xecff('0x21')]===_0xecff('0x22');var _0x53ff8e=_0x362ed0[_0xecff('0x23')];var _0x3adc81=_0x3a7623?0x0:_0x35ce1f[_0xecff('0x24')];var _0x2393db=_0x3a7623?_0x362ed0[_0xecff('0x23')]:_0x35ce1f[_0xecff('0x24')]+_0x35ce1f['limit'];var _0x229728;if(_0x2393db>=_0x53ff8e){_0x2393db=_0x53ff8e;_0x229728=0xc8;}else{_0x229728=0xce;}_0x558ecd[_0xecff('0x1e')](_0x229728);return _0x558ecd[_0xecff('0x25')](_0xecff('0x26'),_0x3adc81+'-'+_0x2393db+'/'+_0x53ff8e)['json'](_0x362ed0);}return null;};}function patchUpdates(_0x4bb94e){return function(_0x2e2bdd){try{jsonpatch[_0xecff('0x27')](_0x2e2bdd,_0x4bb94e,!![]);}catch(_0x333eb7){return BPromise[_0xecff('0x28')](_0x333eb7);}return _0x2e2bdd[_0xecff('0x29')]();};}function saveUpdates(_0x494754,_0x14378d){return function(_0x520d6d){if(_0x520d6d){return _0x520d6d['update'](_0x494754)[_0xecff('0x2a')](function(_0x4fdc8e){return _0x4fdc8e;});}return null;};}function removeEntity(_0x2447da,_0x49c0cd){return function(_0x389281){if(_0x389281){return _0x389281['destroy']()[_0xecff('0x2a')](function(){_0x2447da[_0xecff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f173d,_0x18f4d4){return function(_0x393312){if(!_0x393312){_0x9f173d[_0xecff('0x1d')](0x194);}return _0x393312;};}function handleError(_0x19202e,_0x493465){_0x493465=_0x493465||0x1f4;return function(_0x4f987b){logger[_0xecff('0x2b')](_0x4f987b['stack']);if(_0x4f987b[_0xecff('0x2c')]){delete _0x4f987b[_0xecff('0x2c')];}_0x19202e[_0xecff('0x1e')](_0x493465)[_0xecff('0x2d')](_0x4f987b);};}exports['index']=function(_0x4e7afa,_0x55502f){var _0x202ee0={},_0xabe5da={},_0x230d04={'count':0x0,'rows':[]};var _0x1e3175=_['map'](db[_0xecff('0x2e')][_0xecff('0x2f')],function(_0x1926a5){return{'name':_0x1926a5['fieldName'],'type':_0x1926a5[_0xecff('0x30')][_0xecff('0x31')]};});_0xabe5da[_0xecff('0x32')]=_[_0xecff('0x33')](_0x1e3175,'name');_0xabe5da[_0xecff('0x34')]=_[_0xecff('0x35')](_0x4e7afa['query']);_0xabe5da[_0xecff('0x36')]=_[_0xecff('0x37')](_0xabe5da[_0xecff('0x32')],_0xabe5da[_0xecff('0x34')]);_0x202ee0['attributes']=_[_0xecff('0x37')](_0xabe5da[_0xecff('0x32')],qs[_0xecff('0x38')](_0x4e7afa['query'][_0xecff('0x38')]));_0x202ee0[_0xecff('0x39')]=_0x202ee0[_0xecff('0x39')][_0xecff('0x3a')]?_0x202ee0[_0xecff('0x39')]:_0xabe5da[_0xecff('0x32')];if(!_0x4e7afa['query']['hasOwnProperty']('nolimit')){_0x202ee0[_0xecff('0x21')]=qs['limit'](_0x4e7afa[_0xecff('0x34')][_0xecff('0x21')]);_0x202ee0['offset']=qs[_0xecff('0x24')](_0x4e7afa[_0xecff('0x34')][_0xecff('0x24')]);}_0x202ee0['order']=qs[_0xecff('0x3b')](_0x4e7afa[_0xecff('0x34')][_0xecff('0x3b')]);_0x202ee0['where']=qs[_0xecff('0x36')](_[_0xecff('0x3c')](_0x4e7afa[_0xecff('0x34')],_0xabe5da[_0xecff('0x36')]),_0x1e3175);if(_0x4e7afa[_0xecff('0x34')][_0xecff('0x3d')]){_0x202ee0[_0xecff('0x3e')]=_[_0xecff('0x3f')](_0x202ee0[_0xecff('0x3e')],{'$or':_[_0xecff('0x33')](_0x1e3175,function(_0xb9a367){if(_0xb9a367['type']!==_0xecff('0x40')){var _0x23c8f1={};_0x23c8f1[_0xb9a367[_0xecff('0x2c')]]={'$like':'%'+_0x4e7afa[_0xecff('0x34')][_0xecff('0x3d')]+'%'};return _0x23c8f1;}})});}_0x202ee0=_[_0xecff('0x3f')]({},_0x202ee0,_0x4e7afa[_0xecff('0x41')]);var _0x2ed2ab={'where':_0x202ee0['where']};return db[_0xecff('0x2e')]['count'](_0x2ed2ab)[_0xecff('0x2a')](function(_0x344108){_0x230d04[_0xecff('0x23')]=_0x344108;if(_0x4e7afa[_0xecff('0x34')][_0xecff('0x42')]){_0x202ee0[_0xecff('0x43')]=[{'all':!![]}];}return db[_0xecff('0x2e')]['findAll'](_0x202ee0);})[_0xecff('0x2a')](function(_0x3dc857){_0x230d04['rows']=_0x3dc857;return _0x230d04;})['then'](respondWithFilteredResult(_0x55502f,_0x202ee0))[_0xecff('0x44')](handleError(_0x55502f,null));};exports[_0xecff('0x45')]=function(_0x27f0dd,_0x1f095e){var _0x47084b={'raw':!![],'where':{'id':_0x27f0dd['params']['id']}},_0xb9117c={};_0xb9117c[_0xecff('0x32')]=_[_0xecff('0x35')](db['FreshdeskField'][_0xecff('0x2f')]);_0xb9117c[_0xecff('0x34')]=_[_0xecff('0x35')](_0x27f0dd[_0xecff('0x34')]);_0xb9117c[_0xecff('0x36')]=_[_0xecff('0x37')](_0xb9117c['model'],_0xb9117c[_0xecff('0x34')]);_0x47084b[_0xecff('0x39')]=_[_0xecff('0x37')](_0xb9117c['model'],qs[_0xecff('0x38')](_0x27f0dd[_0xecff('0x34')][_0xecff('0x38')]));_0x47084b[_0xecff('0x39')]=_0x47084b['attributes'][_0xecff('0x3a')]?_0x47084b[_0xecff('0x39')]:_0xb9117c['model'];if(_0x27f0dd[_0xecff('0x34')][_0xecff('0x42')]){_0x47084b['include']=[{'all':!![]}];}_0x47084b=_[_0xecff('0x3f')]({},_0x47084b,_0x27f0dd['options']);return db[_0xecff('0x2e')][_0xecff('0x46')](_0x47084b)[_0xecff('0x2a')](handleEntityNotFound(_0x1f095e,null))[_0xecff('0x2a')](respondWithResult(_0x1f095e,null))[_0xecff('0x44')](handleError(_0x1f095e,null));};exports[_0xecff('0x47')]=function(_0x563f68,_0x596eb8){return db[_0xecff('0x2e')][_0xecff('0x47')](_0x563f68[_0xecff('0x48')],{})[_0xecff('0x2a')](respondWithResult(_0x596eb8,0xc9))[_0xecff('0x44')](handleError(_0x596eb8,null));};exports[_0xecff('0x49')]=function(_0x36c50f,_0x3ac749){if(_0x36c50f['body']['id']){delete _0x36c50f[_0xecff('0x48')]['id'];}return db[_0xecff('0x2e')]['find']({'where':{'id':_0x36c50f[_0xecff('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ac749,null))[_0xecff('0x2a')](saveUpdates(_0x36c50f[_0xecff('0x48')],null))['then'](respondWithResult(_0x3ac749,null))[_0xecff('0x44')](handleError(_0x3ac749,null));};exports[_0xecff('0x4b')]=function(_0x3e79f9,_0x188d08){return db[_0xecff('0x2e')]['find']({'where':{'id':_0x3e79f9['params']['id']}})[_0xecff('0x2a')](handleEntityNotFound(_0x188d08,null))[_0xecff('0x2a')](removeEntity(_0x188d08,null))[_0xecff('0x44')](handleError(_0x188d08,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 531f9d7..ee00760 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 _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 +var _0xee81=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash'];(function(_0x354c52,_0x29eb19){var _0x519bfe=function(_0x18bba0){while(--_0x18bba0){_0x354c52['push'](_0x354c52['shift']());}};_0x519bfe(++_0x29eb19);}(_0xee81,0x15e));var _0x1ee8=function(_0x65a1ee,_0x422702){_0x65a1ee=_0x65a1ee-0x0;var _0x252fcb=_0xee81[_0x65a1ee];return _0x252fcb;};'use strict';var _=require(_0x1ee8('0x0'));var util=require(_0x1ee8('0x1'));var logger=require(_0x1ee8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1ee8('0x3'));var rp=require(_0x1ee8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ee8('0x5'));var config=require(_0x1ee8('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x1ee8('0x7')]=function(_0xd6987,_0x1f303b){return _0xd6987[_0x1ee8('0x8')](_0x1ee8('0x9'),attributes,{'tableName':_0x1ee8('0xa'),'paranoid':![],'indexes':[{'name':_0x1ee8('0xb'),'fields':[_0x1ee8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index b119357..ad2e0ea 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 _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 +var _0xc3c7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0xc3c7,0x1b4));var _0x7c3c=function(_0x225bbd,_0x378910){_0x225bbd=_0x225bbd-0x0;var _0x44fd36=_0xc3c7[_0x225bbd];return _0x44fd36;};'use strict';var _=require(_0x7c3c('0x0'));var util=require('util');var moment=require(_0x7c3c('0x1'));var BPromise=require(_0x7c3c('0x2'));var rs=require(_0x7c3c('0x3'));var fs=require('fs');var Redis=require(_0x7c3c('0x4'));var db=require(_0x7c3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c3c('0x6'))(_0x7c3c('0x7'));var config=require(_0x7c3c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7c3c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d37b4,_0x5d4ac4,_0x228095){return new BPromise(function(_0x298530,_0x1cf605){return client[_0x7c3c('0xa')](_0x3d37b4,_0x228095)[_0x7c3c('0xb')](function(_0x5c6bf7){logger[_0x7c3c('0xc')](_0x7c3c('0xd'),_0x5d4ac4,_0x7c3c('0xe'));logger[_0x7c3c('0xf')](_0x7c3c('0x10'),_0x5d4ac4,_0x7c3c('0xe'),JSON[_0x7c3c('0x11')](_0x5c6bf7));if(_0x5c6bf7[_0x7c3c('0x12')]){if(_0x5c6bf7['error'][_0x7c3c('0x13')]===0x1f4){logger['error'](_0x7c3c('0xd'),_0x5d4ac4,_0x5c6bf7[_0x7c3c('0x12')][_0x7c3c('0x14')]);return _0x1cf605(_0x5c6bf7[_0x7c3c('0x12')][_0x7c3c('0x14')]);}logger[_0x7c3c('0x12')](_0x7c3c('0xd'),_0x5d4ac4,_0x5c6bf7[_0x7c3c('0x12')]['message']);return _0x298530(_0x5c6bf7['error'][_0x7c3c('0x14')]);}else{logger[_0x7c3c('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x5d4ac4,_0x7c3c('0xe'));_0x298530(_0x5c6bf7[_0x7c3c('0x15')][_0x7c3c('0x14')]);}})[_0x7c3c('0x16')](function(_0x2ad2dd){logger[_0x7c3c('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5d4ac4,_0x2ad2dd);_0x1cf605(_0x2ad2dd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 7e5973c..769d333 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 _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 +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(_0x29424e,_0x3d389c){var _0xf84acc=function(_0x2eac8c){while(--_0x2eac8c){_0x29424e['push'](_0x29424e['shift']());}};_0xf84acc(++_0x3d389c);}(_0x2e54,0x1dd));var _0x42e5=function(_0x3db0b6,_0x2d2c11){_0x3db0b6=_0x3db0b6-0x0;var _0x135c9a=_0x2e54[_0x3db0b6];return _0x135c9a;};'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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 477ba3f..d387b2a 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 _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 +var _0x28f2=['exports','STRING','remoteUri','sequelize'];(function(_0x49c4d1,_0x247d67){var _0xb7c65=function(_0xefd5c6){while(--_0xefd5c6){_0x49c4d1['push'](_0x49c4d1['shift']());}};_0xb7c65(++_0x247d67);}(_0x28f2,0x193));var _0x228f=function(_0x356b3d,_0x2a0716){_0x356b3d=_0x356b3d-0x0;var _0x542434=_0x28f2[_0x356b3d];return _0x542434;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')]},'description':{'type':Sequelize[_0x228f('0x2')]},'username':{'type':Sequelize[_0x228f('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x228f('0x2')]},'remoteUri':{'type':Sequelize[_0x228f('0x2')],'unique':_0x228f('0x3')},'serverUrl':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 11628ca..ca45e08 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 _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 +var _0xb17f=['Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','findOne','username','apiKey','remoteUri','slice','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','FreshsalesAccount','rawAttributes','type','key','model','query','attributes','fields','length','nolimit','sort','where','filters','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','create','body','find','getConfigurations','order','AccountId','Subjects'];(function(_0x53e09a,_0x220240){var _0x38183e=function(_0xba7f3a){while(--_0xba7f3a){_0x53e09a['push'](_0x53e09a['shift']());}};_0x38183e(++_0x220240);}(_0xb17f,0x19e));var _0xfb17=function(_0x4287a0,_0x2528fb){_0x4287a0=_0x4287a0-0x0;var _0x1663fe=_0xb17f[_0x4287a0];return _0x1663fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb17('0x0'));var zipdir=require(_0xfb17('0x1'));var jsonpatch=require(_0xfb17('0x2'));var rp=require('request-promise');var moment=require(_0xfb17('0x3'));var BPromise=require(_0xfb17('0x4'));var Mustache=require('mustache');var util=require(_0xfb17('0x5'));var path=require(_0xfb17('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfb17('0x7'));var fs=require('fs');var fs_extra=require(_0xfb17('0x8'));var _=require(_0xfb17('0x9'));var squel=require(_0xfb17('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb17('0xb'));var deskjs=require(_0xfb17('0xc'));var toCsv=require(_0xfb17('0xd'));var querystring=require(_0xfb17('0xe'));var Papa=require(_0xfb17('0xf'));var Redis=require(_0xfb17('0x10'));var authService=require(_0xfb17('0x11'));var qs=require(_0xfb17('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb17('0x13'))(_0xfb17('0x14'));var utils=require('../../config/utils');var config=require(_0xfb17('0x15'));var licenseUtil=require(_0xfb17('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfb17('0x17'));function respondWithStatusCode(_0x5d8a92,_0x2a81c1){_0x2a81c1=_0x2a81c1||0xcc;return function(_0x4f5146){if(_0x4f5146){return _0x5d8a92[_0xfb17('0x18')](_0x2a81c1);}return _0x5d8a92['status'](_0x2a81c1)['end']();};}function respondWithResult(_0x16a055,_0x3025e0){_0x3025e0=_0x3025e0||0xc8;return function(_0x5acfe5){if(_0x5acfe5){return _0x16a055['status'](_0x3025e0)[_0xfb17('0x19')](_0x5acfe5);}};}function respondWithFilteredResult(_0x2572d7,_0x5f55a2){return function(_0x1f9d29){if(_0x1f9d29){var _0x4ff78c=typeof _0x5f55a2[_0xfb17('0x1a')]===_0xfb17('0x1b')&&typeof _0x5f55a2[_0xfb17('0x1c')]===_0xfb17('0x1b');var _0x23946c=_0x1f9d29[_0xfb17('0x1d')];var _0x1d86c9=_0x4ff78c?0x0:_0x5f55a2[_0xfb17('0x1a')];var _0x3a5dc8=_0x4ff78c?_0x1f9d29[_0xfb17('0x1d')]:_0x5f55a2[_0xfb17('0x1a')]+_0x5f55a2[_0xfb17('0x1c')];var _0x104a68;if(_0x3a5dc8>=_0x23946c){_0x3a5dc8=_0x23946c;_0x104a68=0xc8;}else{_0x104a68=0xce;}_0x2572d7[_0xfb17('0x1e')](_0x104a68);return _0x2572d7[_0xfb17('0x1f')](_0xfb17('0x20'),_0x1d86c9+'-'+_0x3a5dc8+'/'+_0x23946c)[_0xfb17('0x19')](_0x1f9d29);}return null;};}function patchUpdates(_0x363b36){return function(_0x51b585){try{jsonpatch['apply'](_0x51b585,_0x363b36,!![]);}catch(_0xeb05e4){return BPromise[_0xfb17('0x21')](_0xeb05e4);}return _0x51b585[_0xfb17('0x22')]();};}function saveUpdates(_0x2089cb,_0x280860){return function(_0x48a7b6){if(_0x48a7b6){return _0x48a7b6[_0xfb17('0x23')](_0x2089cb)[_0xfb17('0x24')](function(_0x218509){return _0x218509;});}return null;};}function removeEntity(_0x2cf91a,_0x1bf639){return function(_0x99d34d){if(_0x99d34d){return _0x99d34d[_0xfb17('0x25')]()[_0xfb17('0x24')](function(){_0x2cf91a[_0xfb17('0x1e')](0xcc)[_0xfb17('0x26')]();});}};}function handleEntityNotFound(_0x130ea1,_0x422da5){return function(_0x21603d){if(!_0x21603d){_0x130ea1[_0xfb17('0x18')](0x194);}return _0x21603d;};}function handleError(_0x334698,_0x35827c){_0x35827c=_0x35827c||0x1f4;return function(_0x5da263){logger[_0xfb17('0x27')](_0x5da263[_0xfb17('0x28')]);if(_0x5da263[_0xfb17('0x29')]){delete _0x5da263[_0xfb17('0x29')];}_0x334698[_0xfb17('0x1e')](_0x35827c)[_0xfb17('0x2a')](_0x5da263);};}exports['index']=function(_0x13b308,_0xbaa670){var _0x164917={},_0x28141d={},_0x2daa9d={'count':0x0,'rows':[]};var _0x4ae81f=_[_0xfb17('0x2b')](db[_0xfb17('0x2c')][_0xfb17('0x2d')],function(_0x32f9e1){return{'name':_0x32f9e1['fieldName'],'type':_0x32f9e1[_0xfb17('0x2e')][_0xfb17('0x2f')]};});_0x28141d[_0xfb17('0x30')]=_[_0xfb17('0x2b')](_0x4ae81f,_0xfb17('0x29'));_0x28141d['query']=_['keys'](_0x13b308[_0xfb17('0x31')]);_0x28141d['filters']=_['intersection'](_0x28141d[_0xfb17('0x30')],_0x28141d['query']);_0x164917[_0xfb17('0x32')]=_['intersection'](_0x28141d[_0xfb17('0x30')],qs[_0xfb17('0x33')](_0x13b308['query']['fields']));_0x164917[_0xfb17('0x32')]=_0x164917[_0xfb17('0x32')][_0xfb17('0x34')]?_0x164917['attributes']:_0x28141d['model'];if(!_0x13b308['query']['hasOwnProperty'](_0xfb17('0x35'))){_0x164917[_0xfb17('0x1c')]=qs[_0xfb17('0x1c')](_0x13b308[_0xfb17('0x31')][_0xfb17('0x1c')]);_0x164917[_0xfb17('0x1a')]=qs[_0xfb17('0x1a')](_0x13b308[_0xfb17('0x31')][_0xfb17('0x1a')]);}_0x164917['order']=qs[_0xfb17('0x36')](_0x13b308[_0xfb17('0x31')][_0xfb17('0x36')]);_0x164917[_0xfb17('0x37')]=qs[_0xfb17('0x38')](_['pick'](_0x13b308['query'],_0x28141d[_0xfb17('0x38')]),_0x4ae81f);if(_0x13b308[_0xfb17('0x31')]['filter']){_0x164917[_0xfb17('0x37')]=_['merge'](_0x164917[_0xfb17('0x37')],{'$or':_[_0xfb17('0x2b')](_0x4ae81f,function(_0x1b90cb){if(_0x1b90cb['type']!==_0xfb17('0x39')){var _0xa76eb3={};_0xa76eb3[_0x1b90cb['name']]={'$like':'%'+_0x13b308[_0xfb17('0x31')][_0xfb17('0x3a')]+'%'};return _0xa76eb3;}})});}_0x164917=_['merge']({},_0x164917,_0x13b308['options']);var _0x33d051={'where':_0x164917[_0xfb17('0x37')]};return db[_0xfb17('0x2c')][_0xfb17('0x1d')](_0x33d051)[_0xfb17('0x24')](function(_0x219b59){_0x2daa9d[_0xfb17('0x1d')]=_0x219b59;if(_0x13b308[_0xfb17('0x31')][_0xfb17('0x3b')]){_0x164917['include']=[{'all':!![]}];}return db[_0xfb17('0x2c')][_0xfb17('0x3c')](_0x164917);})[_0xfb17('0x24')](function(_0x54ab6e){_0x2daa9d[_0xfb17('0x3d')]=_0x54ab6e;return _0x2daa9d;})[_0xfb17('0x24')](respondWithFilteredResult(_0xbaa670,_0x164917))[_0xfb17('0x3e')](handleError(_0xbaa670,null));};exports[_0xfb17('0x3f')]=function(_0x51b76f,_0x248b8b){var _0x56e2b7={'raw':![],'where':{'id':_0x51b76f[_0xfb17('0x40')]['id']}},_0x575c46={};_0x575c46[_0xfb17('0x30')]=_[_0xfb17('0x41')](db[_0xfb17('0x2c')][_0xfb17('0x2d')]);_0x575c46[_0xfb17('0x31')]=_[_0xfb17('0x41')](_0x51b76f[_0xfb17('0x31')]);_0x575c46[_0xfb17('0x38')]=_[_0xfb17('0x42')](_0x575c46['model'],_0x575c46[_0xfb17('0x31')]);_0x56e2b7[_0xfb17('0x32')]=_[_0xfb17('0x42')](_0x575c46[_0xfb17('0x30')],qs[_0xfb17('0x33')](_0x51b76f[_0xfb17('0x31')][_0xfb17('0x33')]));_0x56e2b7[_0xfb17('0x32')]=_0x56e2b7[_0xfb17('0x32')]['length']?_0x56e2b7[_0xfb17('0x32')]:_0x575c46['model'];if(_0x51b76f[_0xfb17('0x31')][_0xfb17('0x3b')]){_0x56e2b7[_0xfb17('0x43')]=[{'all':!![]}];}_0x56e2b7=_['merge']({},_0x56e2b7,_0x51b76f[_0xfb17('0x44')]);return db[_0xfb17('0x2c')]['find'](_0x56e2b7)[_0xfb17('0x24')](handleEntityNotFound(_0x248b8b,null))[_0xfb17('0x24')](respondWithResult(_0x248b8b,null))['catch'](handleError(_0x248b8b,null));};exports['create']=function(_0x2f39c2,_0x49f0a6){return db[_0xfb17('0x2c')][_0xfb17('0x45')](_0x2f39c2[_0xfb17('0x46')],{})['then'](respondWithResult(_0x49f0a6,0xc9))[_0xfb17('0x3e')](handleError(_0x49f0a6,null));};exports[_0xfb17('0x23')]=function(_0x2bd111,_0x5d3154){if(_0x2bd111['body']['id']){delete _0x2bd111[_0xfb17('0x46')]['id'];}return db[_0xfb17('0x2c')]['find']({'where':{'id':_0x2bd111[_0xfb17('0x40')]['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x5d3154,null))[_0xfb17('0x24')](saveUpdates(_0x2bd111['body'],null))['then'](respondWithResult(_0x5d3154,null))[_0xfb17('0x3e')](handleError(_0x5d3154,null));};exports['destroy']=function(_0x5102b0,_0x1badfe){return db[_0xfb17('0x2c')][_0xfb17('0x47')]({'where':{'id':_0x5102b0[_0xfb17('0x40')]['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x1badfe,null))[_0xfb17('0x24')](removeEntity(_0x1badfe,null))[_0xfb17('0x3e')](handleError(_0x1badfe,null));};exports[_0xfb17('0x48')]=function(_0x19fe28,_0x25d7cb,_0x1e41c1){var _0x5a5fe2={};var _0x1474aa={};var _0x508bbe;var _0x44b323;return db[_0xfb17('0x2c')]['findOne']({'where':{'id':_0x19fe28['params']['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x25d7cb,null))['then'](function(_0x18e87f){if(_0x18e87f){_0x508bbe=_0x18e87f;_0x1474aa[_0xfb17('0x30')]=_[_0xfb17('0x41')](db['FreshsalesConfiguration'][_0xfb17('0x2d')]);_0x1474aa[_0xfb17('0x31')]=_[_0xfb17('0x41')](_0x19fe28['query']);_0x1474aa[_0xfb17('0x38')]=_['intersection'](_0x1474aa[_0xfb17('0x30')],_0x1474aa[_0xfb17('0x31')]);_0x5a5fe2['attributes']=_[_0xfb17('0x42')](_0x1474aa[_0xfb17('0x30')],qs['fields'](_0x19fe28[_0xfb17('0x31')][_0xfb17('0x33')]));_0x5a5fe2[_0xfb17('0x32')]=_0x5a5fe2['attributes'][_0xfb17('0x34')]?_0x5a5fe2[_0xfb17('0x32')]:_0x1474aa[_0xfb17('0x30')];_0x5a5fe2[_0xfb17('0x49')]=qs[_0xfb17('0x36')](_0x19fe28[_0xfb17('0x31')][_0xfb17('0x36')]);_0x5a5fe2['where']=qs['filters'](_['pick'](_0x19fe28['query'],_0x1474aa['filters']));if(_0x19fe28[_0xfb17('0x31')][_0xfb17('0x3a')]){_0x5a5fe2[_0xfb17('0x37')]=_['merge'](_0x5a5fe2[_0xfb17('0x37')],{'$or':_[_0xfb17('0x2b')](_0x5a5fe2[_0xfb17('0x32')],function(_0x502917){var _0xe1f37e={};_0xe1f37e[_0x502917]={'$like':'%'+_0x19fe28['query'][_0xfb17('0x3a')]+'%'};return _0xe1f37e;})});}_0x5a5fe2=_['merge']({},_0x5a5fe2,_0x19fe28[_0xfb17('0x44')]);return _0x508bbe[_0xfb17('0x48')](_0x5a5fe2);}})['then'](function(_0x497b6e){if(_0x497b6e){_0x44b323=_0x497b6e[_0xfb17('0x34')];if(!_0x19fe28[_0xfb17('0x31')]['hasOwnProperty'](_0xfb17('0x35'))){_0x5a5fe2['limit']=qs[_0xfb17('0x1c')](_0x19fe28[_0xfb17('0x31')]['limit']);_0x5a5fe2['offset']=qs['offset'](_0x19fe28[_0xfb17('0x31')][_0xfb17('0x1a')]);}return _0x508bbe[_0xfb17('0x48')](_0x5a5fe2);}})['then'](function(_0x45ebdd){if(_0x45ebdd){return _0x45ebdd?{'count':_0x44b323,'rows':_0x45ebdd}:null;}})[_0xfb17('0x24')](respondWithResult(_0x25d7cb,null))[_0xfb17('0x3e')](handleError(_0x25d7cb,null));};exports['addConfiguration']=function(_0x248db2,_0x5cba9a,_0x4da882){if(_0x248db2[_0xfb17('0x46')]['id']){delete _0x248db2[_0xfb17('0x46')]['id'];}return db[_0xfb17('0x2c')]['findOne']({'where':{'id':_0x248db2[_0xfb17('0x40')]['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x5cba9a,null))['then'](function(_0x2ac2c9){if(_0x2ac2c9){_0x248db2[_0xfb17('0x46')][_0xfb17('0x4a')]=_0x2ac2c9['id'];_0x248db2[_0xfb17('0x46')][_0xfb17('0x4b')]=integrations['getSubjects'](_0x248db2[_0xfb17('0x46')]['channel'],_0x248db2[_0xfb17('0x46')]['type']);_0x248db2[_0xfb17('0x46')][_0xfb17('0x4c')]=integrations[_0xfb17('0x4d')](_0x248db2['body'][_0xfb17('0x4e')],_0x248db2[_0xfb17('0x46')][_0xfb17('0x2e')]);return db[_0xfb17('0x4f')][_0xfb17('0x45')](_0x248db2[_0xfb17('0x46')],{'include':[{'model':db[_0xfb17('0x50')],'as':_0xfb17('0x4b')},{'model':db[_0xfb17('0x50')],'as':_0xfb17('0x4c')}]});}return null;})[_0xfb17('0x24')](respondWithResult(_0x5cba9a,null))['catch'](handleError(_0x5cba9a,null));};exports[_0xfb17('0x51')]=function(_0x368f0f,_0x46b2fe,_0x58c8be){var _0x4fd045='';var _0x218ec0='';return db[_0xfb17('0x2c')][_0xfb17('0x52')]({'where':{'id':_0x368f0f[_0xfb17('0x40')]['id']},'attributes':['id',_0xfb17('0x53'),'remoteUri',_0xfb17('0x54')]})[_0xfb17('0x24')](handleEntityNotFound(_0x46b2fe,null))[_0xfb17('0x24')](function(_0x7ada6b){if(_0x7ada6b){_0x218ec0=_0x7ada6b['username'];_0x4fd045=_0x7ada6b['remoteUri'];var _0x405bc4=_0x7ada6b[_0xfb17('0x55')][_0xfb17('0x56')](-0x1);if(_0x405bc4==='/'){_0x4fd045=_0x4fd045['substring'](0x0,_0x4fd045[_0xfb17('0x57')](_0x405bc4));}return rp({'method':_0xfb17('0x58'),'uri':util['format']('%s%s',_0x4fd045,_0xfb17('0x59')),'headers':{'Authorization':_0xfb17('0x5a')+_0x7ada6b[_0xfb17('0x54')]},'json':!![]});}})['then'](function(_0x2a5ad6){if(_0x2a5ad6){var _0x12eb49=_0x2a5ad6[_0xfb17('0x5b')];var _0x49200c=![];var _0x15418c=null;for(_0x15418c=0x0;_0x15418c<_0x12eb49[_0xfb17('0x34')];_0x15418c++){if(_0x12eb49[_0x15418c][_0xfb17('0x5c')]===_0x218ec0){_0x49200c=!![];}}if(_0x49200c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfb17('0x5d')});}}})['then'](respondWithResult(_0x46b2fe,null))[_0xfb17('0x3e')](function(_0x10b446){var _0x2b0e8c=_0x368f0f['query'][_0xfb17('0x5e')]?0x1f4:_0x10b446[_0xfb17('0x5f')]||0x1f4;logger[_0xfb17('0x27')](_0xfb17('0x60'),'getFields',_0x2b0e8c,JSON[_0xfb17('0x61')](_0x10b446));delete _0x10b446[_0xfb17('0x29')];if(_0x2b0e8c===0x191){_0x2b0e8c=0x190;}_0x46b2fe[_0xfb17('0x1e')](_0x2b0e8c)[_0xfb17('0x2a')](_0x368f0f[_0xfb17('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x10b446[_0xfb17('0x5f')]}:_0x10b446);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 5520d0e..4dbf1e5 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 _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 +var _0x4bd3=['define','int_freshsales_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4bd3,0x174));var _0x34bd=function(_0x15b957,_0x51bce6){_0x15b957=_0x15b957-0x0;var _0x3fb192=_0x4bd3[_0x15b957];return _0x3fb192;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x34bd('0x6'));module[_0x34bd('0x7')]=function(_0x5c2a7a,_0x3e8744){return _0x5c2a7a[_0x34bd('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x34bd('0x9'),'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 36fcb03..5637aef 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 _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 +var _0x5496=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshsalesAccount','find','ShowFreshsalesAccount','lodash'];(function(_0x25c082,_0x9411be){var _0x413283=function(_0xe59e84){while(--_0xe59e84){_0x25c082['push'](_0x25c082['shift']());}};_0x413283(++_0x9411be);}(_0x5496,0x175));var _0x6549=function(_0x477ce7,_0x5da1a4){_0x477ce7=_0x477ce7-0x0;var _0x23d8cb=_0x5496[_0x477ce7];return _0x23d8cb;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});}exports[_0x6549('0x15')]=function(_0x53b12b){var _0x5d61a0=this;return new Promise(function(_0x26a212,_0x48f037){return db['FreshsalesAccount'][_0x6549('0x16')]({'raw':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x53b12b[_0x6549('0x17')]?_0x53b12b['options'][_0x6549('0x19')]||null:null,'attributes':_0x53b12b['options']?_0x53b12b[_0x6549('0x17')][_0x6549('0x1a')]||null:null,'limit':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1b')]||null:null,'include':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')],function(_0x1fbfa4){return{'model':db[_0x1fbfa4[_0x6549('0x1e')]],'as':_0x1fbfa4['as'],'attributes':_0x1fbfa4['attributes'],'include':_0x1fbfa4[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x1fbfa4['include'],function(_0x126967){return{'model':db[_0x126967[_0x6549('0x1e')]],'as':_0x126967['as'],'attributes':_0x126967[_0x6549('0x1a')],'include':_0x126967['include']?_[_0x6549('0x1d')](_0x126967[_0x6549('0x1c')],function(_0x14de1f){return{'model':db[_0x14de1f[_0x6549('0x1e')]],'as':_0x14de1f['as'],'attributes':_0x14de1f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x2f58f7){logger[_0x6549('0xb')]('GetFreshsalesAccount',_0x53b12b);logger[_0x6549('0xe')](_0x6549('0x15'),_0x53b12b,JSON[_0x6549('0xf')](_0x2f58f7));_0x26a212(_0x2f58f7);})['catch'](function(_0x3f1502){logger['error']('GetFreshsalesAccount',_0x3f1502['message'],_0x53b12b);_0x48f037(_0x5d61a0[_0x6549('0x10')](0x1f4,_0x3f1502[_0x6549('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x30aac6){var _0x194ae7=this;return new Promise(function(_0x2e481f,_0x102a21){return db[_0x6549('0x1f')][_0x6549('0x20')]({'raw':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')][_0x6549('0x19')]||null:null,'attributes':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')]['attributes']||null:null,'include':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x1c')]?_['map'](_0x30aac6[_0x6549('0x17')][_0x6549('0x1c')],function(_0x3d9e9e){return{'model':db[_0x3d9e9e['model']],'as':_0x3d9e9e['as'],'attributes':_0x3d9e9e[_0x6549('0x1a')],'include':_0x3d9e9e[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x3d9e9e[_0x6549('0x1c')],function(_0x5b8624){return{'model':db[_0x5b8624['model']],'as':_0x5b8624['as'],'attributes':_0x5b8624['attributes'],'include':_0x5b8624[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x5b8624['include'],function(_0x43220f){return{'model':db[_0x43220f[_0x6549('0x1e')]],'as':_0x43220f['as'],'attributes':_0x43220f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x3741f5){logger['info']('ShowFreshsalesAccount',_0x30aac6);logger[_0x6549('0xe')](_0x6549('0x21'),_0x30aac6,JSON[_0x6549('0xf')](_0x3741f5));_0x2e481f(_0x3741f5);})[_0x6549('0x14')](function(_0xa96598){logger[_0x6549('0x10')](_0x6549('0x21'),_0xa96598[_0x6549('0x12')],_0x30aac6);_0x102a21(_0x194ae7[_0x6549('0x10')](0x1f4,_0xa96598[_0x6549('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 639353b..7bad4bf 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 _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 +var _0x55d7=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','/:id/subjects','/:id/fields','getFields','create','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x16292c,_0x451724){var _0xfb49b3=function(_0x1adbe9){while(--_0x1adbe9){_0x16292c['push'](_0x16292c['shift']());}};_0xfb49b3(++_0x451724);}(_0x55d7,0x188));var _0x755d=function(_0x5d5d25,_0x3b8c9d){_0x5d5d25=_0x5d5d25-0x0;var _0x4b25ca=_0x55d7[_0x5d5d25];return _0x4b25ca;};'use strict';var multer=require('multer');var util=require(_0x755d('0x0'));var path=require(_0x755d('0x1'));var timeout=require(_0x755d('0x2'));var express=require(_0x755d('0x3'));var router=express[_0x755d('0x4')]();var fs_extra=require(_0x755d('0x5'));var auth=require(_0x755d('0x6'));var interaction=require(_0x755d('0x7'));var config=require(_0x755d('0x8'));var controller=require(_0x755d('0x9'));router['get']('/',auth[_0x755d('0xa')](),controller[_0x755d('0xb')]);router[_0x755d('0xc')](_0x755d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x755d('0xc')](_0x755d('0xe'),auth[_0x755d('0xa')](),controller['getSubjects']);router[_0x755d('0xc')]('/:id/descriptions',auth[_0x755d('0xa')](),controller['getDescriptions']);router[_0x755d('0xc')](_0x755d('0xf'),auth[_0x755d('0xa')](),controller[_0x755d('0x10')]);router['post']('/',auth[_0x755d('0xa')](),controller[_0x755d('0x11')]);router['put']('/:id',auth[_0x755d('0xa')](),controller['update']);router[_0x755d('0x12')](_0x755d('0xd'),auth[_0x755d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6c255a7..99bffdd 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 _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 +var _0xcbf0=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbf0,0xe3));var _0x0cbf=function(_0x288b60,_0x11fa8e){_0x288b60=_0x288b60-0x0;var _0x174d7c=_0xcbf0[_0x288b60];return _0x174d7c;};'use strict';var Sequelize=require(_0x0cbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x0cbf('0x1')]},'description':{'type':Sequelize[_0x0cbf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index df9d461..aea95cc 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 _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 +var _0x243c=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','then','error','stack','name','index','map','FreshsalesConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','rawAttributes','options','find','create','body','destroy','getSubjects','FreshsalesField','hasOwnProperty','getDescriptions','getFields','findOne','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x140ac,_0x27e9b7){var _0x576afe=function(_0x301033){while(--_0x301033){_0x140ac['push'](_0x140ac['shift']());}};_0x576afe(++_0x27e9b7);}(_0x243c,0x86));var _0xc243=function(_0x4fcbee,_0x1a2466){_0x4fcbee=_0x4fcbee-0x0;var _0x5d171f=_0x243c[_0x4fcbee];return _0x5d171f;};'use strict';var emlformat=require(_0xc243('0x0'));var rimraf=require(_0xc243('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc243('0x2'));var rp=require(_0xc243('0x3'));var moment=require('moment');var BPromise=require(_0xc243('0x4'));var Mustache=require('mustache');var util=require(_0xc243('0x5'));var path=require(_0xc243('0x6'));var sox=require('sox');var csv=require(_0xc243('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc243('0x8'));var _=require('lodash');var squel=require(_0xc243('0x9'));var crypto=require(_0xc243('0xa'));var jsforce=require(_0xc243('0xb'));var deskjs=require(_0xc243('0xc'));var toCsv=require(_0xc243('0x7'));var querystring=require(_0xc243('0xd'));var Papa=require(_0xc243('0xe'));var Redis=require(_0xc243('0xf'));var authService=require(_0xc243('0x10'));var qs=require(_0xc243('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc243('0x12'));var logger=require(_0xc243('0x13'))('api');var utils=require(_0xc243('0x14'));var config=require(_0xc243('0x15'));var licenseUtil=require(_0xc243('0x16'));var db=require(_0xc243('0x17'))['db'];function respondWithStatusCode(_0x345ed3,_0x29ee33){_0x29ee33=_0x29ee33||0xcc;return function(_0x3f0cc1){if(_0x3f0cc1){return _0x345ed3[_0xc243('0x18')](_0x29ee33);}return _0x345ed3['status'](_0x29ee33)[_0xc243('0x19')]();};}function respondWithResult(_0x579ade,_0x467c77){_0x467c77=_0x467c77||0xc8;return function(_0xcc8a8a){if(_0xcc8a8a){return _0x579ade[_0xc243('0x1a')](_0x467c77)[_0xc243('0x1b')](_0xcc8a8a);}};}function respondWithFilteredResult(_0x606529,_0x3ac29e){return function(_0x199602){if(_0x199602){var _0x11ed9a=typeof _0x3ac29e[_0xc243('0x1c')]===_0xc243('0x1d')&&typeof _0x3ac29e[_0xc243('0x1e')]===_0xc243('0x1d');var _0x1ae6ce=_0x199602[_0xc243('0x1f')];var _0x336d2b=_0x11ed9a?0x0:_0x3ac29e[_0xc243('0x1c')];var _0x27672c=_0x11ed9a?_0x199602['count']:_0x3ac29e[_0xc243('0x1c')]+_0x3ac29e[_0xc243('0x1e')];var _0x48b4c4;if(_0x27672c>=_0x1ae6ce){_0x27672c=_0x1ae6ce;_0x48b4c4=0xc8;}else{_0x48b4c4=0xce;}_0x606529[_0xc243('0x1a')](_0x48b4c4);return _0x606529[_0xc243('0x20')]('Content-Range',_0x336d2b+'-'+_0x27672c+'/'+_0x1ae6ce)[_0xc243('0x1b')](_0x199602);}return null;};}function patchUpdates(_0x2d190a){return function(_0x74e4ce){try{jsonpatch[_0xc243('0x21')](_0x74e4ce,_0x2d190a,!![]);}catch(_0x520f29){return BPromise[_0xc243('0x22')](_0x520f29);}return _0x74e4ce['save']();};}function saveUpdates(_0x4d918b,_0x50f9d6){return function(_0x34c11d){if(_0x34c11d){return _0x34c11d['update'](_0x4d918b)['then'](function(_0x57fd13){return _0x57fd13;});}return null;};}function removeEntity(_0x3eee64,_0x4dad8f){return function(_0x42c724){if(_0x42c724){return _0x42c724['destroy']()[_0xc243('0x23')](function(){_0x3eee64['status'](0xcc)[_0xc243('0x19')]();});}};}function handleEntityNotFound(_0x33fabc,_0x441bc8){return function(_0x1130ad){if(!_0x1130ad){_0x33fabc[_0xc243('0x18')](0x194);}return _0x1130ad;};}function handleError(_0x5beb46,_0x265201){_0x265201=_0x265201||0x1f4;return function(_0x2e147f){logger[_0xc243('0x24')](_0x2e147f[_0xc243('0x25')]);if(_0x2e147f[_0xc243('0x26')]){delete _0x2e147f[_0xc243('0x26')];}_0x5beb46[_0xc243('0x1a')](_0x265201)['send'](_0x2e147f);};}exports[_0xc243('0x27')]=function(_0x18f9aa,_0x1eaa5a){var _0x43e473={},_0x5d3595={},_0x4a448b={'count':0x0,'rows':[]};var _0x30eab3=_[_0xc243('0x28')](db[_0xc243('0x29')]['rawAttributes'],function(_0x37d401){return{'name':_0x37d401['fieldName'],'type':_0x37d401[_0xc243('0x2a')][_0xc243('0x2b')]};});_0x5d3595[_0xc243('0x2c')]=_['map'](_0x30eab3,_0xc243('0x26'));_0x5d3595[_0xc243('0x2d')]=_['keys'](_0x18f9aa[_0xc243('0x2d')]);_0x5d3595[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x5d3595[_0xc243('0x2c')],_0x5d3595['query']);_0x43e473[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x5d3595[_0xc243('0x2c')],qs['fields'](_0x18f9aa[_0xc243('0x2d')][_0xc243('0x31')]));_0x43e473['attributes']=_0x43e473[_0xc243('0x30')][_0xc243('0x32')]?_0x43e473[_0xc243('0x30')]:_0x5d3595['model'];if(!_0x18f9aa['query']['hasOwnProperty'](_0xc243('0x33'))){_0x43e473[_0xc243('0x1e')]=qs[_0xc243('0x1e')](_0x18f9aa[_0xc243('0x2d')][_0xc243('0x1e')]);_0x43e473[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x18f9aa[_0xc243('0x2d')][_0xc243('0x1c')]);}_0x43e473[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x18f9aa['query'][_0xc243('0x35')]);_0x43e473[_0xc243('0x36')]=qs[_0xc243('0x2e')](_[_0xc243('0x37')](_0x18f9aa['query'],_0x5d3595[_0xc243('0x2e')]),_0x30eab3);if(_0x18f9aa[_0xc243('0x2d')][_0xc243('0x38')]){_0x43e473['where']=_[_0xc243('0x39')](_0x43e473[_0xc243('0x36')],{'$or':_[_0xc243('0x28')](_0x30eab3,function(_0x2177d9){if(_0x2177d9[_0xc243('0x2a')]!==_0xc243('0x3a')){var _0x1cad64={};_0x1cad64[_0x2177d9[_0xc243('0x26')]]={'$like':'%'+_0x18f9aa['query'][_0xc243('0x38')]+'%'};return _0x1cad64;}})});}_0x43e473=_[_0xc243('0x39')]({},_0x43e473,_0x18f9aa['options']);var _0x29d489={'where':_0x43e473['where']};return db[_0xc243('0x29')][_0xc243('0x1f')](_0x29d489)[_0xc243('0x23')](function(_0x5e04ff){_0x4a448b[_0xc243('0x1f')]=_0x5e04ff;if(_0x18f9aa['query'][_0xc243('0x3b')]){_0x43e473[_0xc243('0x3c')]=[{'all':!![]}];}return db[_0xc243('0x29')]['findAll'](_0x43e473);})[_0xc243('0x23')](function(_0x41fb44){_0x4a448b['rows']=_0x41fb44;return _0x4a448b;})[_0xc243('0x23')](respondWithFilteredResult(_0x1eaa5a,_0x43e473))[_0xc243('0x3d')](handleError(_0x1eaa5a,null));};exports[_0xc243('0x3e')]=function(_0x547c2d,_0x16d54f){var _0x2a3a83={'raw':![],'where':{'id':_0x547c2d[_0xc243('0x3f')]['id']}},_0x3b00dc={};_0x3b00dc[_0xc243('0x2c')]=_[_0xc243('0x40')](db[_0xc243('0x29')][_0xc243('0x41')]);_0x3b00dc[_0xc243('0x2d')]=_[_0xc243('0x40')](_0x547c2d[_0xc243('0x2d')]);_0x3b00dc[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x3b00dc[_0xc243('0x2c')],_0x3b00dc['query']);_0x2a3a83[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x3b00dc[_0xc243('0x2c')],qs[_0xc243('0x31')](_0x547c2d[_0xc243('0x2d')][_0xc243('0x31')]));_0x2a3a83[_0xc243('0x30')]=_0x2a3a83[_0xc243('0x30')][_0xc243('0x32')]?_0x2a3a83['attributes']:_0x3b00dc['model'];if(_0x547c2d[_0xc243('0x2d')]['includeAll']){_0x2a3a83[_0xc243('0x3c')]=[{'all':!![]}];}_0x2a3a83=_[_0xc243('0x39')]({},_0x2a3a83,_0x547c2d[_0xc243('0x42')]);return db[_0xc243('0x29')][_0xc243('0x43')](_0x2a3a83)[_0xc243('0x23')](handleEntityNotFound(_0x16d54f,null))[_0xc243('0x23')](respondWithResult(_0x16d54f,null))[_0xc243('0x3d')](handleError(_0x16d54f,null));};exports[_0xc243('0x44')]=function(_0x18bbb8,_0x28e54f){return db[_0xc243('0x29')]['create'](_0x18bbb8[_0xc243('0x45')],{})['then'](respondWithResult(_0x28e54f,0xc9))[_0xc243('0x3d')](handleError(_0x28e54f,null));};exports['update']=function(_0x4f6972,_0x4e84da){if(_0x4f6972[_0xc243('0x45')]['id']){delete _0x4f6972[_0xc243('0x45')]['id'];}return db[_0xc243('0x29')][_0xc243('0x43')]({'where':{'id':_0x4f6972[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x4e84da,null))[_0xc243('0x23')](saveUpdates(_0x4f6972['body'],null))[_0xc243('0x23')](respondWithResult(_0x4e84da,null))['catch'](handleError(_0x4e84da,null));};exports[_0xc243('0x46')]=function(_0x2fd63e,_0x219c01){return db[_0xc243('0x29')][_0xc243('0x43')]({'where':{'id':_0x2fd63e['params']['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x219c01,null))[_0xc243('0x23')](removeEntity(_0x219c01,null))['catch'](handleError(_0x219c01,null));};exports[_0xc243('0x47')]=function(_0x16d110,_0x3616fe,_0x120a8f){var _0x25e45c={};var _0x5c6629={};var _0x4c7338;var _0x3767ee;return db[_0xc243('0x29')]['findOne']({'where':{'id':_0x16d110[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x3616fe,null))[_0xc243('0x23')](function(_0x1a10ea){if(_0x1a10ea){_0x4c7338=_0x1a10ea;_0x5c6629['model']=_[_0xc243('0x40')](db[_0xc243('0x48')]['rawAttributes']);_0x5c6629[_0xc243('0x2d')]=_[_0xc243('0x40')](_0x16d110['query']);_0x5c6629[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x5c6629[_0xc243('0x2c')],_0x5c6629[_0xc243('0x2d')]);_0x25e45c[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x5c6629['model'],qs[_0xc243('0x31')](_0x16d110[_0xc243('0x2d')]['fields']));_0x25e45c[_0xc243('0x30')]=_0x25e45c[_0xc243('0x30')]['length']?_0x25e45c['attributes']:_0x5c6629[_0xc243('0x2c')];_0x25e45c[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x16d110[_0xc243('0x2d')]['sort']);_0x25e45c[_0xc243('0x36')]=qs['filters'](_[_0xc243('0x37')](_0x16d110['query'],_0x5c6629[_0xc243('0x2e')]));if(_0x16d110[_0xc243('0x2d')]['filter']){_0x25e45c['where']=_[_0xc243('0x39')](_0x25e45c[_0xc243('0x36')],{'$or':_['map'](_0x25e45c[_0xc243('0x30')],function(_0x325545){var _0x583e8c={};_0x583e8c[_0x325545]={'$like':'%'+_0x16d110[_0xc243('0x2d')][_0xc243('0x38')]+'%'};return _0x583e8c;})});}_0x25e45c=_[_0xc243('0x39')]({},_0x25e45c,_0x16d110[_0xc243('0x42')]);return _0x4c7338[_0xc243('0x47')](_0x25e45c);}})[_0xc243('0x23')](function(_0x4c86d2){if(_0x4c86d2){_0x3767ee=_0x4c86d2[_0xc243('0x32')];if(!_0x16d110['query'][_0xc243('0x49')](_0xc243('0x33'))){_0x25e45c[_0xc243('0x1e')]=qs[_0xc243('0x1e')](_0x16d110[_0xc243('0x2d')][_0xc243('0x1e')]);_0x25e45c[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x16d110['query']['offset']);}return _0x4c7338['getSubjects'](_0x25e45c);}})[_0xc243('0x23')](function(_0x23bcf9){if(_0x23bcf9){return _0x23bcf9?{'count':_0x3767ee,'rows':_0x23bcf9}:null;}})[_0xc243('0x23')](respondWithResult(_0x3616fe,null))[_0xc243('0x3d')](handleError(_0x3616fe,null));};exports[_0xc243('0x4a')]=function(_0x573fdb,_0x11925e,_0x243ca6){var _0x5a27a9={};var _0x58bb1f={};var _0x2cce11;var _0x43ffbd;return db[_0xc243('0x29')]['findOne']({'where':{'id':_0x573fdb[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x11925e,null))['then'](function(_0x290caa){if(_0x290caa){_0x2cce11=_0x290caa;_0x58bb1f['model']=_[_0xc243('0x40')](db[_0xc243('0x48')][_0xc243('0x41')]);_0x58bb1f['query']=_['keys'](_0x573fdb[_0xc243('0x2d')]);_0x58bb1f[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x58bb1f[_0xc243('0x2c')],_0x58bb1f[_0xc243('0x2d')]);_0x5a27a9[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x58bb1f['model'],qs[_0xc243('0x31')](_0x573fdb[_0xc243('0x2d')][_0xc243('0x31')]));_0x5a27a9['attributes']=_0x5a27a9[_0xc243('0x30')][_0xc243('0x32')]?_0x5a27a9[_0xc243('0x30')]:_0x58bb1f['model'];_0x5a27a9[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x573fdb['query'][_0xc243('0x35')]);_0x5a27a9['where']=qs['filters'](_['pick'](_0x573fdb[_0xc243('0x2d')],_0x58bb1f['filters']));if(_0x573fdb['query'][_0xc243('0x38')]){_0x5a27a9[_0xc243('0x36')]=_['merge'](_0x5a27a9[_0xc243('0x36')],{'$or':_[_0xc243('0x28')](_0x5a27a9[_0xc243('0x30')],function(_0x49c3f9){var _0x43fec9={};_0x43fec9[_0x49c3f9]={'$like':'%'+_0x573fdb[_0xc243('0x2d')][_0xc243('0x38')]+'%'};return _0x43fec9;})});}_0x5a27a9=_[_0xc243('0x39')]({},_0x5a27a9,_0x573fdb[_0xc243('0x42')]);return _0x2cce11[_0xc243('0x4a')](_0x5a27a9);}})[_0xc243('0x23')](function(_0x3a08d4){if(_0x3a08d4){_0x43ffbd=_0x3a08d4[_0xc243('0x32')];if(!_0x573fdb['query']['hasOwnProperty'](_0xc243('0x33'))){_0x5a27a9[_0xc243('0x1e')]=qs['limit'](_0x573fdb[_0xc243('0x2d')][_0xc243('0x1e')]);_0x5a27a9[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x573fdb[_0xc243('0x2d')][_0xc243('0x1c')]);}return _0x2cce11[_0xc243('0x4a')](_0x5a27a9);}})[_0xc243('0x23')](function(_0x1cd38b){if(_0x1cd38b){return _0x1cd38b?{'count':_0x43ffbd,'rows':_0x1cd38b}:null;}})[_0xc243('0x23')](respondWithResult(_0x11925e,null))[_0xc243('0x3d')](handleError(_0x11925e,null));};exports[_0xc243('0x4b')]=function(_0x52f344,_0x548ba5,_0x5b4a27){var _0x3637fc={};var _0x20912f={};var _0x2cb872;var _0x14062d;return db['FreshsalesConfiguration'][_0xc243('0x4c')]({'where':{'id':_0x52f344[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x548ba5,null))[_0xc243('0x23')](function(_0x406d2b){if(_0x406d2b){_0x2cb872=_0x406d2b;_0x20912f['model']=_[_0xc243('0x40')](db[_0xc243('0x48')]['rawAttributes']);_0x20912f[_0xc243('0x2d')]=_[_0xc243('0x40')](_0x52f344[_0xc243('0x2d')]);_0x20912f['filters']=_['intersection'](_0x20912f[_0xc243('0x2c')],_0x20912f[_0xc243('0x2d')]);_0x3637fc['attributes']=_[_0xc243('0x2f')](_0x20912f[_0xc243('0x2c')],qs[_0xc243('0x31')](_0x52f344[_0xc243('0x2d')][_0xc243('0x31')]));_0x3637fc[_0xc243('0x30')]=_0x3637fc[_0xc243('0x30')][_0xc243('0x32')]?_0x3637fc['attributes']:_0x20912f[_0xc243('0x2c')];_0x3637fc[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x52f344[_0xc243('0x2d')]['sort']);_0x3637fc[_0xc243('0x36')]=qs['filters'](_[_0xc243('0x37')](_0x52f344[_0xc243('0x2d')],_0x20912f[_0xc243('0x2e')]));if(_0x52f344[_0xc243('0x2d')][_0xc243('0x38')]){_0x3637fc[_0xc243('0x36')]=_['merge'](_0x3637fc[_0xc243('0x36')],{'$or':_[_0xc243('0x28')](_0x3637fc[_0xc243('0x30')],function(_0x2798f5){var _0x554c07={};_0x554c07[_0x2798f5]={'$like':'%'+_0x52f344[_0xc243('0x2d')][_0xc243('0x38')]+'%'};return _0x554c07;})});}_0x3637fc=_[_0xc243('0x39')]({},_0x3637fc,_0x52f344[_0xc243('0x42')]);return _0x2cb872[_0xc243('0x4b')](_0x3637fc);}})['then'](function(_0x4e5932){if(_0x4e5932){_0x14062d=_0x4e5932['length'];if(!_0x52f344['query'][_0xc243('0x49')](_0xc243('0x33'))){_0x3637fc[_0xc243('0x1e')]=qs[_0xc243('0x1e')](_0x52f344[_0xc243('0x2d')]['limit']);_0x3637fc[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x52f344[_0xc243('0x2d')][_0xc243('0x1c')]);}return _0x2cb872[_0xc243('0x4b')](_0x3637fc);}})[_0xc243('0x23')](function(_0x316738){if(_0x316738){return _0x316738?{'count':_0x14062d,'rows':_0x316738}:null;}})[_0xc243('0x23')](respondWithResult(_0x548ba5,null))['catch'](handleError(_0x548ba5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7ba5f06..33d7e7e 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 _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 +var _0xe0f9=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x3a84b9,_0x529c82){var _0x566814=function(_0x5f31d0){while(--_0x5f31d0){_0x3a84b9['push'](_0x3a84b9['shift']());}};_0x566814(++_0x529c82);}(_0xe0f9,0xb5));var _0x9e0f=function(_0xd326ae,_0x2ad48e){_0xd326ae=_0xd326ae-0x0;var _0xdc099d=_0xe0f9[_0xd326ae];return _0xdc099d;};'use strict';var _=require(_0x9e0f('0x0'));var util=require(_0x9e0f('0x1'));var logger=require(_0x9e0f('0x2'))(_0x9e0f('0x3'));var moment=require(_0x9e0f('0x4'));var BPromise=require(_0x9e0f('0x5'));var rp=require(_0x9e0f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e0f('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e0f('0x8'));module[_0x9e0f('0x9')]=function(_0xb60648,_0x4ab50a){return _0xb60648[_0x9e0f('0xa')](_0x9e0f('0xb'),attributes,{'tableName':_0x9e0f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index b100a2b..b96bd19 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 _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 +var _0x6f7b=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','catch','util','moment'];(function(_0x92f9d5,_0x11a2fa){var _0xd4e98a=function(_0x12e3b6){while(--_0x12e3b6){_0x92f9d5['push'](_0x92f9d5['shift']());}};_0xd4e98a(++_0x11a2fa);}(_0x6f7b,0x11f));var _0xb6f7=function(_0x364b08,_0x1d35a0){_0x364b08=_0x364b08-0x0;var _0x17d900=_0x6f7b[_0x364b08];return _0x17d900;};'use strict';var _=require('lodash');var util=require(_0xb6f7('0x0'));var moment=require(_0xb6f7('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6f7('0x2'));var fs=require('fs');var Redis=require(_0xb6f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6f7('0x4'));var logger=require('../../config/logger')(_0xb6f7('0x5'));var config=require(_0xb6f7('0x6'));var jayson=require(_0xb6f7('0x7'));var client=jayson[_0xb6f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4672ce,_0x120edb,_0x3b5248){return new BPromise(function(_0x3fd281,_0x589234){return client['request'](_0x4672ce,_0x3b5248)['then'](function(_0x2db80c){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x120edb,_0xb6f7('0x9'));logger['debug'](_0xb6f7('0xa'),_0x120edb,_0xb6f7('0x9'),JSON['stringify'](_0x2db80c));if(_0x2db80c['error']){if(_0x2db80c[_0xb6f7('0xb')][_0xb6f7('0xc')]===0x1f4){logger[_0xb6f7('0xb')](_0xb6f7('0xd'),_0x120edb,_0x2db80c['error'][_0xb6f7('0xe')]);return _0x589234(_0x2db80c['error'][_0xb6f7('0xe')]);}logger[_0xb6f7('0xb')](_0xb6f7('0xd'),_0x120edb,_0x2db80c['error'][_0xb6f7('0xe')]);return _0x3fd281(_0x2db80c[_0xb6f7('0xb')][_0xb6f7('0xe')]);}else{logger[_0xb6f7('0xf')](_0xb6f7('0xd'),_0x120edb,_0xb6f7('0x9'));_0x3fd281(_0x2db80c['result'][_0xb6f7('0xe')]);}})[_0xb6f7('0x10')](function(_0xe0f0f6){logger[_0xb6f7('0xb')](_0xb6f7('0xd'),_0x120edb,_0xe0f0f6);_0x589234(_0xe0f0f6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 6f34ce8..8c086df 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 _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 +var _0x6c6f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x4e3596,_0x396b1c){_0x4e3596=_0x4e3596-0x0;var _0x1a2b21=_0x6c6f[_0x4e3596];return _0x1a2b21;};'use strict';var multer=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var path=require(_0xf6c6('0x2'));var timeout=require(_0xf6c6('0x3'));var express=require(_0xf6c6('0x4'));var router=express[_0xf6c6('0x5')]();var fs_extra=require(_0xf6c6('0x6'));var auth=require(_0xf6c6('0x7'));var interaction=require(_0xf6c6('0x8'));var config=require(_0xf6c6('0x9'));var controller=require(_0xf6c6('0xa'));router['get']('/',auth[_0xf6c6('0xb')](),controller['index']);router['get'](_0xf6c6('0xc'),auth['isAuthenticated'](),controller[_0xf6c6('0xd')]);router[_0xf6c6('0xe')]('/',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0xf')]);router[_0xf6c6('0x10')]('/:id',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x11')]);router['delete'](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5c9d073..6774b47 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 _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 +var _0xeeb5=['ENUM','variable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x42bfc9,_0x92ccf5){var _0x645e2b=function(_0x5d7d7d){while(--_0x5d7d7d){_0x42bfc9['push'](_0x42bfc9['shift']());}};_0x645e2b(++_0x92ccf5);}(_0xeeb5,0x6a));var _0x5eeb=function(_0x169ea9,_0xf9fc24){_0x169ea9=_0x169ea9-0x0;var _0x1ab3e3=_0xeeb5[_0x169ea9];return _0x1ab3e3;};'use strict';var Sequelize=require(_0x5eeb('0x0'));module[_0x5eeb('0x1')]={'type':{'type':Sequelize[_0x5eeb('0x2')]('string',_0x5eeb('0x3'),'customVariable',_0x5eeb('0x4'),_0x5eeb('0x5')),'defaultValue':_0x5eeb('0x6')},'content':{'type':Sequelize[_0x5eeb('0x7')]},'key':{'type':Sequelize[_0x5eeb('0x7')]},'keyType':{'type':Sequelize[_0x5eeb('0x2')](_0x5eeb('0x6'),_0x5eeb('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5eeb('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5eeb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5eeb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7953c0e..a72b001 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 _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 +var _0x7137=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','fieldName','type','key','keys','query','filters','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','rawAttributes','intersection','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7137,0xd0));var _0x7713=function(_0x1460fd,_0x2c3e08){_0x1460fd=_0x1460fd-0x0;var _0x44f25c=_0x7137[_0x1460fd];return _0x44f25c;};'use strict';var emlformat=require(_0x7713('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7713('0x1'));var jsonpatch=require(_0x7713('0x2'));var rp=require(_0x7713('0x3'));var moment=require('moment');var BPromise=require(_0x7713('0x4'));var Mustache=require(_0x7713('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7713('0x6'));var ejs=require(_0x7713('0x7'));var fs=require('fs');var fs_extra=require(_0x7713('0x8'));var _=require('lodash');var squel=require(_0x7713('0x9'));var crypto=require(_0x7713('0xa'));var jsforce=require(_0x7713('0xb'));var deskjs=require(_0x7713('0xc'));var toCsv=require(_0x7713('0x6'));var querystring=require(_0x7713('0xd'));var Papa=require(_0x7713('0xe'));var Redis=require(_0x7713('0xf'));var authService=require(_0x7713('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7713('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7713('0x12'))(_0x7713('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7713('0x14'));var db=require(_0x7713('0x15'))['db'];function respondWithStatusCode(_0x5b48ca,_0x366a8c){_0x366a8c=_0x366a8c||0xcc;return function(_0x855aa7){if(_0x855aa7){return _0x5b48ca[_0x7713('0x16')](_0x366a8c);}return _0x5b48ca[_0x7713('0x17')](_0x366a8c)[_0x7713('0x18')]();};}function respondWithResult(_0x36470e,_0x2e3c37){_0x2e3c37=_0x2e3c37||0xc8;return function(_0xb7e965){if(_0xb7e965){return _0x36470e[_0x7713('0x17')](_0x2e3c37)[_0x7713('0x19')](_0xb7e965);}};}function respondWithFilteredResult(_0x3b06b9,_0x213e74){return function(_0x587b5c){if(_0x587b5c){var _0x3c4e72=typeof _0x213e74[_0x7713('0x1a')]===_0x7713('0x1b')&&typeof _0x213e74[_0x7713('0x1c')]==='undefined';var _0x1465f0=_0x587b5c['count'];var _0x101235=_0x3c4e72?0x0:_0x213e74[_0x7713('0x1a')];var _0x2b3870=_0x3c4e72?_0x587b5c[_0x7713('0x1d')]:_0x213e74['offset']+_0x213e74[_0x7713('0x1c')];var _0x46a8fa;if(_0x2b3870>=_0x1465f0){_0x2b3870=_0x1465f0;_0x46a8fa=0xc8;}else{_0x46a8fa=0xce;}_0x3b06b9[_0x7713('0x17')](_0x46a8fa);return _0x3b06b9[_0x7713('0x1e')](_0x7713('0x1f'),_0x101235+'-'+_0x2b3870+'/'+_0x1465f0)[_0x7713('0x19')](_0x587b5c);}return null;};}function patchUpdates(_0x2f3e6a){return function(_0x52c7c8){try{jsonpatch[_0x7713('0x20')](_0x52c7c8,_0x2f3e6a,!![]);}catch(_0x5281be){return BPromise[_0x7713('0x21')](_0x5281be);}return _0x52c7c8[_0x7713('0x22')]();};}function saveUpdates(_0x273dfa,_0x2e4458){return function(_0x2c7818){if(_0x2c7818){return _0x2c7818['update'](_0x273dfa)[_0x7713('0x23')](function(_0x33709d){return _0x33709d;});}return null;};}function removeEntity(_0x35a250,_0x5d609e){return function(_0x14ce1e){if(_0x14ce1e){return _0x14ce1e[_0x7713('0x24')]()[_0x7713('0x23')](function(){_0x35a250['status'](0xcc)[_0x7713('0x18')]();});}};}function handleEntityNotFound(_0x232c79,_0x32a1dc){return function(_0x36a8cb){if(!_0x36a8cb){_0x232c79['sendStatus'](0x194);}return _0x36a8cb;};}function handleError(_0x1f68bb,_0xdc0b41){_0xdc0b41=_0xdc0b41||0x1f4;return function(_0xcd6a35){logger[_0x7713('0x25')](_0xcd6a35[_0x7713('0x26')]);if(_0xcd6a35[_0x7713('0x27')]){delete _0xcd6a35[_0x7713('0x27')];}_0x1f68bb['status'](_0xdc0b41)[_0x7713('0x28')](_0xcd6a35);};}exports['index']=function(_0x2f3d0d,_0x2a1239){var _0x4f370d={},_0x537ba3={},_0x3299d3={'count':0x0,'rows':[]};var _0x1ee8a3=_[_0x7713('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x22cc72){return{'name':_0x22cc72[_0x7713('0x2a')],'type':_0x22cc72[_0x7713('0x2b')][_0x7713('0x2c')]};});_0x537ba3['model']=_['map'](_0x1ee8a3,_0x7713('0x27'));_0x537ba3['query']=_[_0x7713('0x2d')](_0x2f3d0d[_0x7713('0x2e')]);_0x537ba3[_0x7713('0x2f')]=_['intersection'](_0x537ba3['model'],_0x537ba3[_0x7713('0x2e')]);_0x4f370d[_0x7713('0x30')]=_['intersection'](_0x537ba3[_0x7713('0x31')],qs[_0x7713('0x32')](_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x32')]));_0x4f370d['attributes']=_0x4f370d[_0x7713('0x30')]['length']?_0x4f370d[_0x7713('0x30')]:_0x537ba3[_0x7713('0x31')];if(!_0x2f3d0d['query'][_0x7713('0x33')](_0x7713('0x34'))){_0x4f370d['limit']=qs[_0x7713('0x1c')](_0x2f3d0d['query'][_0x7713('0x1c')]);_0x4f370d[_0x7713('0x1a')]=qs['offset'](_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x1a')]);}_0x4f370d[_0x7713('0x35')]=qs[_0x7713('0x36')](_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x36')]);_0x4f370d[_0x7713('0x37')]=qs[_0x7713('0x2f')](_[_0x7713('0x38')](_0x2f3d0d[_0x7713('0x2e')],_0x537ba3['filters']),_0x1ee8a3);if(_0x2f3d0d[_0x7713('0x2e')]['filter']){_0x4f370d[_0x7713('0x37')]=_['merge'](_0x4f370d[_0x7713('0x37')],{'$or':_['map'](_0x1ee8a3,function(_0x13f5c6){if(_0x13f5c6[_0x7713('0x2b')]!=='VIRTUAL'){var _0x5e6940={};_0x5e6940[_0x13f5c6[_0x7713('0x27')]]={'$like':'%'+_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x39')]+'%'};return _0x5e6940;}})});}_0x4f370d=_[_0x7713('0x3a')]({},_0x4f370d,_0x2f3d0d[_0x7713('0x3b')]);var _0x284b3e={'where':_0x4f370d[_0x7713('0x37')]};return db[_0x7713('0x3c')][_0x7713('0x1d')](_0x284b3e)['then'](function(_0x54e901){_0x3299d3[_0x7713('0x1d')]=_0x54e901;if(_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x3d')]){_0x4f370d[_0x7713('0x3e')]=[{'all':!![]}];}return db[_0x7713('0x3c')][_0x7713('0x3f')](_0x4f370d);})[_0x7713('0x23')](function(_0x5bfdde){_0x3299d3[_0x7713('0x40')]=_0x5bfdde;return _0x3299d3;})['then'](respondWithFilteredResult(_0x2a1239,_0x4f370d))[_0x7713('0x41')](handleError(_0x2a1239,null));};exports['show']=function(_0x12c2a0,_0x510231){var _0x4b8de7={'raw':!![],'where':{'id':_0x12c2a0['params']['id']}},_0x3c5d27={};_0x3c5d27[_0x7713('0x31')]=_[_0x7713('0x2d')](db['FreshsalesField'][_0x7713('0x42')]);_0x3c5d27[_0x7713('0x2e')]=_[_0x7713('0x2d')](_0x12c2a0['query']);_0x3c5d27[_0x7713('0x2f')]=_[_0x7713('0x43')](_0x3c5d27[_0x7713('0x31')],_0x3c5d27['query']);_0x4b8de7[_0x7713('0x30')]=_[_0x7713('0x43')](_0x3c5d27[_0x7713('0x31')],qs[_0x7713('0x32')](_0x12c2a0[_0x7713('0x2e')][_0x7713('0x32')]));_0x4b8de7[_0x7713('0x30')]=_0x4b8de7[_0x7713('0x30')][_0x7713('0x44')]?_0x4b8de7[_0x7713('0x30')]:_0x3c5d27[_0x7713('0x31')];if(_0x12c2a0[_0x7713('0x2e')][_0x7713('0x3d')]){_0x4b8de7[_0x7713('0x3e')]=[{'all':!![]}];}_0x4b8de7=_[_0x7713('0x3a')]({},_0x4b8de7,_0x12c2a0[_0x7713('0x3b')]);return db['FreshsalesField'][_0x7713('0x45')](_0x4b8de7)[_0x7713('0x23')](handleEntityNotFound(_0x510231,null))[_0x7713('0x23')](respondWithResult(_0x510231,null))['catch'](handleError(_0x510231,null));};exports[_0x7713('0x46')]=function(_0x5a5e45,_0x41eba1){return db[_0x7713('0x3c')][_0x7713('0x46')](_0x5a5e45[_0x7713('0x47')],{})[_0x7713('0x23')](respondWithResult(_0x41eba1,0xc9))[_0x7713('0x41')](handleError(_0x41eba1,null));};exports['update']=function(_0x4820c0,_0x24af69){if(_0x4820c0[_0x7713('0x47')]['id']){delete _0x4820c0[_0x7713('0x47')]['id'];}return db[_0x7713('0x3c')]['find']({'where':{'id':_0x4820c0[_0x7713('0x48')]['id']}})['then'](handleEntityNotFound(_0x24af69,null))[_0x7713('0x23')](saveUpdates(_0x4820c0[_0x7713('0x47')],null))[_0x7713('0x23')](respondWithResult(_0x24af69,null))['catch'](handleError(_0x24af69,null));};exports[_0x7713('0x24')]=function(_0x5b5e31,_0x20158e){return db['FreshsalesField'][_0x7713('0x45')]({'where':{'id':_0x5b5e31[_0x7713('0x48')]['id']}})[_0x7713('0x23')](handleEntityNotFound(_0x20158e,null))[_0x7713('0x23')](removeEntity(_0x20158e,null))[_0x7713('0x41')](handleError(_0x20158e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 572188f..07fb09d 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 _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 +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x37e4fb,_0x5be57d){var _0x30f3b3=function(_0x4c4f86){while(--_0x4c4f86){_0x37e4fb['push'](_0x37e4fb['shift']());}};_0x30f3b3(++_0x5be57d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3efdd8,_0x3728e3){_0x3efdd8=_0x3efdd8-0x0;var _0x395759=_0xb10b[_0x3efdd8];return _0x395759;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('FreshsalesField',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xd'),_0xbb10('0xe')],'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 127aced..2bf9a0e 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 _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 +var _0x7a54=['info','FreshsalesField,\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(_0x1119fa,_0x59f7d9){_0x1119fa=_0x1119fa-0x0;var _0x1a54d2=_0x7a54[_0x1119fa];return _0x1a54d2;};'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')]('FreshsalesField,\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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f4a8bf3..9732e7a 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(_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 +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(_0x35203f,_0x26b448){var _0x15e4d7=function(_0x480b8f){while(--_0x480b8f){_0x35203f['push'](_0x35203f['shift']());}};_0x15e4d7(++_0x26b448);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 6bc78fc..d700868 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 _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 +var _0x8c7a=['integrationTab','newTab','sequelize','exports','STRING'];(function(_0x59b59d,_0x132d97){var _0x5a2f6f=function(_0x17d885){while(--_0x17d885){_0x59b59d['push'](_0x59b59d['shift']());}};_0x5a2f6f(++_0x132d97);}(_0x8c7a,0x197));var _0xa8c7=function(_0x2d6962,_0x46de87){_0x2d6962=_0x2d6962-0x0;var _0x3bcf12=_0x8c7a[_0x2d6962];return _0x3bcf12;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module[_0xa8c7('0x1')]={'name':{'type':Sequelize[_0xa8c7('0x2')]},'description':{'type':Sequelize[_0xa8c7('0x2')]},'username':{'type':Sequelize[_0xa8c7('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa8c7('0x2')]},'clientSecret':{'type':Sequelize[_0xa8c7('0x2')]},'securityToken':{'type':Sequelize[_0xa8c7('0x2')]},'serverUrl':{'type':Sequelize[_0xa8c7('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa8c7('0x3'),_0xa8c7('0x4')),'defaultValue':_0xa8c7('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 317dbe5..61ad9c5 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 _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 +var _0x3d44=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','order','filter','addConfiguration','AccountId','Descriptions','getDescriptions','channel','SalesforceField','Subjects','getFields','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','True','False','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x3d44,0xea));var _0x43d4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3d44[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x43d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43d4('0x2'));var moment=require(_0x43d4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43d4('0x4'));var util=require('util');var path=require(_0x43d4('0x5'));var sox=require(_0x43d4('0x6'));var csv=require('to-csv');var ejs=require(_0x43d4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43d4('0x8'));var squel=require(_0x43d4('0x9'));var crypto=require(_0x43d4('0xa'));var jsforce=require(_0x43d4('0xb'));var deskjs=require(_0x43d4('0xc'));var toCsv=require(_0x43d4('0xd'));var querystring=require(_0x43d4('0xe'));var Papa=require(_0x43d4('0xf'));var Redis=require('ioredis');var authService=require(_0x43d4('0x10'));var qs=require(_0x43d4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43d4('0x12'));var logger=require(_0x43d4('0x13'))(_0x43d4('0x14'));var utils=require(_0x43d4('0x15'));var config=require(_0x43d4('0x16'));var licenseUtil=require(_0x43d4('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x43d4('0x18'));function respondWithStatusCode(_0x385996,_0x25f124){_0x25f124=_0x25f124||0xcc;return function(_0x243050){if(_0x243050){return _0x385996[_0x43d4('0x19')](_0x25f124);}return _0x385996[_0x43d4('0x1a')](_0x25f124)[_0x43d4('0x1b')]();};}function respondWithResult(_0x5d38a3,_0x24d121){_0x24d121=_0x24d121||0xc8;return function(_0x542d29){if(_0x542d29){return _0x5d38a3[_0x43d4('0x1a')](_0x24d121)['json'](_0x542d29);}};}function respondWithFilteredResult(_0x4c7759,_0x1319fb){return function(_0xefe18c){if(_0xefe18c){var _0x5e06aa=typeof _0x1319fb[_0x43d4('0x1c')]==='undefined'&&typeof _0x1319fb[_0x43d4('0x1d')]==='undefined';var _0x2f32eb=_0xefe18c[_0x43d4('0x1e')];var _0x3af440=_0x5e06aa?0x0:_0x1319fb[_0x43d4('0x1c')];var _0x35606f=_0x5e06aa?_0xefe18c['count']:_0x1319fb[_0x43d4('0x1c')]+_0x1319fb[_0x43d4('0x1d')];var _0x3e3995;if(_0x35606f>=_0x2f32eb){_0x35606f=_0x2f32eb;_0x3e3995=0xc8;}else{_0x3e3995=0xce;}_0x4c7759[_0x43d4('0x1a')](_0x3e3995);return _0x4c7759[_0x43d4('0x1f')](_0x43d4('0x20'),_0x3af440+'-'+_0x35606f+'/'+_0x2f32eb)['json'](_0xefe18c);}return null;};}function patchUpdates(_0x709a6){return function(_0x38605c){try{jsonpatch[_0x43d4('0x21')](_0x38605c,_0x709a6,!![]);}catch(_0x2e7a03){return BPromise['reject'](_0x2e7a03);}return _0x38605c[_0x43d4('0x22')]();};}function saveUpdates(_0x2d7c21,_0x5a6eee){return function(_0x17cb6b){if(_0x17cb6b){return _0x17cb6b[_0x43d4('0x23')](_0x2d7c21)[_0x43d4('0x24')](function(_0x4a8240){return _0x4a8240;});}return null;};}function removeEntity(_0x194c06,_0x2e4dae){return function(_0x3587b6){if(_0x3587b6){return _0x3587b6[_0x43d4('0x25')]()['then'](function(){_0x194c06[_0x43d4('0x1a')](0xcc)[_0x43d4('0x1b')]();});}};}function handleEntityNotFound(_0x8be6be,_0x280c49){return function(_0x393024){if(!_0x393024){_0x8be6be['sendStatus'](0x194);}return _0x393024;};}function handleError(_0x503584,_0xe9c254){_0xe9c254=_0xe9c254||0x1f4;return function(_0x4e2031){logger[_0x43d4('0x26')](_0x4e2031[_0x43d4('0x27')]);if(_0x4e2031[_0x43d4('0x28')]){delete _0x4e2031[_0x43d4('0x28')];}_0x503584[_0x43d4('0x1a')](_0xe9c254)[_0x43d4('0x29')](_0x4e2031);};}exports[_0x43d4('0x2a')]=function(_0x29f84c,_0x4c61f1){var _0x3286f1={},_0x4225ba={},_0x554749={'count':0x0,'rows':[]};var _0x1ac2d5=_['map'](db[_0x43d4('0x2b')][_0x43d4('0x2c')],function(_0x43bc02){return{'name':_0x43bc02[_0x43d4('0x2d')],'type':_0x43bc02[_0x43d4('0x2e')][_0x43d4('0x2f')]};});_0x4225ba[_0x43d4('0x30')]=_['map'](_0x1ac2d5,_0x43d4('0x28'));_0x4225ba['query']=_[_0x43d4('0x31')](_0x29f84c[_0x43d4('0x32')]);_0x4225ba[_0x43d4('0x33')]=_[_0x43d4('0x34')](_0x4225ba[_0x43d4('0x30')],_0x4225ba[_0x43d4('0x32')]);_0x3286f1[_0x43d4('0x35')]=_[_0x43d4('0x34')](_0x4225ba[_0x43d4('0x30')],qs[_0x43d4('0x36')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x36')]));_0x3286f1[_0x43d4('0x35')]=_0x3286f1[_0x43d4('0x35')][_0x43d4('0x37')]?_0x3286f1[_0x43d4('0x35')]:_0x4225ba[_0x43d4('0x30')];if(!_0x29f84c[_0x43d4('0x32')][_0x43d4('0x38')](_0x43d4('0x39'))){_0x3286f1[_0x43d4('0x1d')]=qs[_0x43d4('0x1d')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x1d')]);_0x3286f1[_0x43d4('0x1c')]=qs[_0x43d4('0x1c')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x1c')]);}_0x3286f1['order']=qs[_0x43d4('0x3a')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x3a')]);_0x3286f1[_0x43d4('0x3b')]=qs[_0x43d4('0x33')](_[_0x43d4('0x3c')](_0x29f84c[_0x43d4('0x32')],_0x4225ba['filters']),_0x1ac2d5);if(_0x29f84c[_0x43d4('0x32')]['filter']){_0x3286f1[_0x43d4('0x3b')]=_['merge'](_0x3286f1['where'],{'$or':_[_0x43d4('0x3d')](_0x1ac2d5,function(_0x55afca){if(_0x55afca['type']!==_0x43d4('0x3e')){var _0x487802={};_0x487802[_0x55afca[_0x43d4('0x28')]]={'$like':'%'+_0x29f84c[_0x43d4('0x32')]['filter']+'%'};return _0x487802;}})});}_0x3286f1=_[_0x43d4('0x3f')]({},_0x3286f1,_0x29f84c[_0x43d4('0x40')]);var _0x4b36f4={'where':_0x3286f1[_0x43d4('0x3b')]};return db[_0x43d4('0x2b')][_0x43d4('0x1e')](_0x4b36f4)[_0x43d4('0x24')](function(_0x48d15a){_0x554749[_0x43d4('0x1e')]=_0x48d15a;if(_0x29f84c['query'][_0x43d4('0x41')]){_0x3286f1[_0x43d4('0x42')]=[{'all':!![]}];}return db[_0x43d4('0x2b')][_0x43d4('0x43')](_0x3286f1);})['then'](function(_0x13b714){_0x554749[_0x43d4('0x44')]=_0x13b714;return _0x554749;})[_0x43d4('0x24')](respondWithFilteredResult(_0x4c61f1,_0x3286f1))['catch'](handleError(_0x4c61f1,null));};exports['show']=function(_0x3f38e9,_0x899e09){var _0x301d52={'raw':![],'where':{'id':_0x3f38e9[_0x43d4('0x45')]['id']}},_0x118df5={};_0x118df5[_0x43d4('0x30')]=_['keys'](db[_0x43d4('0x2b')][_0x43d4('0x2c')]);_0x118df5[_0x43d4('0x32')]=_[_0x43d4('0x31')](_0x3f38e9[_0x43d4('0x32')]);_0x118df5[_0x43d4('0x33')]=_['intersection'](_0x118df5[_0x43d4('0x30')],_0x118df5[_0x43d4('0x32')]);_0x301d52[_0x43d4('0x35')]=_[_0x43d4('0x34')](_0x118df5[_0x43d4('0x30')],qs[_0x43d4('0x36')](_0x3f38e9['query'][_0x43d4('0x36')]));_0x301d52[_0x43d4('0x35')]=_0x301d52[_0x43d4('0x35')][_0x43d4('0x37')]?_0x301d52[_0x43d4('0x35')]:_0x118df5[_0x43d4('0x30')];if(_0x3f38e9[_0x43d4('0x32')][_0x43d4('0x41')]){_0x301d52[_0x43d4('0x42')]=[{'all':!![]}];}_0x301d52=_['merge']({},_0x301d52,_0x3f38e9[_0x43d4('0x40')]);return db[_0x43d4('0x2b')][_0x43d4('0x46')](_0x301d52)[_0x43d4('0x24')](handleEntityNotFound(_0x899e09,null))[_0x43d4('0x24')](respondWithResult(_0x899e09,null))[_0x43d4('0x47')](handleError(_0x899e09,null));};exports[_0x43d4('0x48')]=function(_0x4369ad,_0xc6309){return db[_0x43d4('0x2b')][_0x43d4('0x48')](_0x4369ad[_0x43d4('0x49')],{})['then'](respondWithResult(_0xc6309,0xc9))[_0x43d4('0x47')](handleError(_0xc6309,null));};exports[_0x43d4('0x23')]=function(_0x46974a,_0x24014b){if(_0x46974a[_0x43d4('0x49')]['id']){delete _0x46974a[_0x43d4('0x49')]['id'];}return db[_0x43d4('0x2b')][_0x43d4('0x46')]({'where':{'id':_0x46974a[_0x43d4('0x45')]['id']}})[_0x43d4('0x24')](handleEntityNotFound(_0x24014b,null))[_0x43d4('0x24')](saveUpdates(_0x46974a[_0x43d4('0x49')],null))[_0x43d4('0x24')](respondWithResult(_0x24014b,null))[_0x43d4('0x47')](handleError(_0x24014b,null));};exports[_0x43d4('0x25')]=function(_0x4b31d3,_0x22f9c6){return db['SalesforceAccount']['find']({'where':{'id':_0x4b31d3[_0x43d4('0x45')]['id']}})[_0x43d4('0x24')](handleEntityNotFound(_0x22f9c6,null))['then'](removeEntity(_0x22f9c6,null))[_0x43d4('0x47')](handleError(_0x22f9c6,null));};exports[_0x43d4('0x4a')]=function(_0x4f6f00,_0x2b2eee,_0x138a46){var _0x1ff498={};var _0x397904={};var _0xc85f99;var _0x2bf7cd;return db[_0x43d4('0x2b')][_0x43d4('0x4b')]({'where':{'id':_0x4f6f00[_0x43d4('0x45')]['id']}})[_0x43d4('0x24')](handleEntityNotFound(_0x2b2eee,null))[_0x43d4('0x24')](function(_0x285edf){if(_0x285edf){_0xc85f99=_0x285edf;_0x397904[_0x43d4('0x30')]=_['keys'](db[_0x43d4('0x4c')][_0x43d4('0x2c')]);_0x397904[_0x43d4('0x32')]=_['keys'](_0x4f6f00[_0x43d4('0x32')]);_0x397904[_0x43d4('0x33')]=_[_0x43d4('0x34')](_0x397904['model'],_0x397904[_0x43d4('0x32')]);_0x1ff498['attributes']=_['intersection'](_0x397904[_0x43d4('0x30')],qs['fields'](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x36')]));_0x1ff498['attributes']=_0x1ff498[_0x43d4('0x35')][_0x43d4('0x37')]?_0x1ff498[_0x43d4('0x35')]:_0x397904[_0x43d4('0x30')];_0x1ff498[_0x43d4('0x4d')]=qs['sort'](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x3a')]);_0x1ff498[_0x43d4('0x3b')]=qs[_0x43d4('0x33')](_['pick'](_0x4f6f00['query'],_0x397904['filters']));if(_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x4e')]){_0x1ff498[_0x43d4('0x3b')]=_['merge'](_0x1ff498[_0x43d4('0x3b')],{'$or':_[_0x43d4('0x3d')](_0x1ff498[_0x43d4('0x35')],function(_0x105eda){var _0x3c6286={};_0x3c6286[_0x105eda]={'$like':'%'+_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x4e')]+'%'};return _0x3c6286;})});}_0x1ff498=_[_0x43d4('0x3f')]({},_0x1ff498,_0x4f6f00[_0x43d4('0x40')]);return _0xc85f99[_0x43d4('0x4a')](_0x1ff498);}})[_0x43d4('0x24')](function(_0x38a71c){if(_0x38a71c){_0x2bf7cd=_0x38a71c['length'];if(!_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x38')]('nolimit')){_0x1ff498[_0x43d4('0x1d')]=qs[_0x43d4('0x1d')](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x1d')]);_0x1ff498[_0x43d4('0x1c')]=qs[_0x43d4('0x1c')](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x1c')]);}return _0xc85f99[_0x43d4('0x4a')](_0x1ff498);}})[_0x43d4('0x24')](function(_0x398f63){if(_0x398f63){return _0x398f63?{'count':_0x2bf7cd,'rows':_0x398f63}:null;}})[_0x43d4('0x24')](respondWithResult(_0x2b2eee,null))[_0x43d4('0x47')](handleError(_0x2b2eee,null));};exports[_0x43d4('0x4f')]=function(_0x5eed91,_0x1ccdc5,_0x3cc02d){if(_0x5eed91['body']['id']){delete _0x5eed91[_0x43d4('0x49')]['id'];}return db['SalesforceAccount'][_0x43d4('0x4b')]({'where':{'id':_0x5eed91[_0x43d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ccdc5,null))[_0x43d4('0x24')](function(_0x37c96c){if(_0x37c96c){_0x5eed91['body'][_0x43d4('0x50')]=_0x37c96c['id'];_0x5eed91[_0x43d4('0x49')]['Subjects']=integrations['getSubjects'](_0x5eed91[_0x43d4('0x49')]['channel'],_0x5eed91[_0x43d4('0x49')][_0x43d4('0x2e')]);_0x5eed91['body'][_0x43d4('0x51')]=integrations[_0x43d4('0x52')](_0x5eed91[_0x43d4('0x49')][_0x43d4('0x53')],_0x5eed91[_0x43d4('0x49')][_0x43d4('0x2e')]);return db['SalesforceConfiguration']['create'](_0x5eed91['body'],{'include':[{'model':db[_0x43d4('0x54')],'as':_0x43d4('0x55')},{'model':db[_0x43d4('0x54')],'as':_0x43d4('0x51')}]});}return null;})[_0x43d4('0x24')](respondWithResult(_0x1ccdc5,null))[_0x43d4('0x47')](handleError(_0x1ccdc5,null));};exports[_0x43d4('0x56')]=function(_0x36849c,_0x5cd405,_0x59ab40){var _0x409aa8;var _0x35c073='';var _0x351b56='Task';return db[_0x43d4('0x2b')]['findOne']({'where':{'id':_0x36849c[_0x43d4('0x45')]['id']},'attributes':['id',_0x43d4('0x57'),_0x43d4('0x58'),'clientSecret',_0x43d4('0x59'),_0x43d4('0x5a'),_0x43d4('0x5b')]})['then'](handleEntityNotFound(_0x5cd405,null))[_0x43d4('0x24')](function(_0x15bd45){if(_0x15bd45){_0x35c073=_0x15bd45[_0x43d4('0x57')];var _0x4b8e07=_0x35c073[_0x43d4('0x5c')](-0x1);if(_0x4b8e07==='/'){_0x35c073=_0x35c073[_0x43d4('0x5d')](0x0,_0x35c073[_0x43d4('0x5e')](_0x4b8e07));}_0x409aa8=new jsforce[(_0x43d4('0x5f'))]({'oauth2':{'loginUrl':_0x35c073,'clientId':_0x15bd45[_0x43d4('0x58')],'clientSecret':_0x15bd45[_0x43d4('0x60')]}});return _0x409aa8['login'](_0x15bd45[_0x43d4('0x59')],_0x15bd45[_0x43d4('0x5a')][_0x43d4('0x61')](_0x15bd45['securityToken']));}})['then'](function(_0x467ad9){if(_0x467ad9){if(!_[_0x43d4('0x62')](_0x36849c[_0x43d4('0x32')][_0x43d4('0x63')])){_0x351b56=_0x36849c[_0x43d4('0x32')][_0x43d4('0x63')];}return _0x409aa8[_0x43d4('0x64')](_0x351b56)[_0x43d4('0x65')]();}})['then'](function(_0x369ff3){var _0x309211=['OwnerId',_0x43d4('0x66'),_0x43d4('0x67'),_0x43d4('0x68'),_0x43d4('0x69'),_0x43d4('0x6a')];var _0x534357=[_0x43d4('0x6b'),'int',_0x43d4('0x6c'),'boolean',_0x43d4('0x6d'),_0x43d4('0x6e'),_0x43d4('0x6f')];if(_0x369ff3){_[_0x43d4('0x70')](_0x369ff3[_0x43d4('0x36')],function(_0x1b8591){return _0x309211[_0x43d4('0x71')](_0x1b8591[_0x43d4('0x28')])||!_0x534357[_0x43d4('0x71')](_0x1b8591[_0x43d4('0x2e')]);});return{'count':_0x369ff3['fields'][_0x43d4('0x37')],'rows':_[_0x43d4('0x3d')](_0x369ff3[_0x43d4('0x36')],function(_0x3cc82f){return{'id':_0x3cc82f[_0x43d4('0x28')],'name':_0x3cc82f[_0x43d4('0x72')],'custom':_0x3cc82f[_0x43d4('0x73')],'options':_0x3cc82f['picklistValues']['length']>0x0?_[_0x43d4('0x3d')](_0x3cc82f[_0x43d4('0x74')],function(_0x277c7c){return{'name':_0x277c7c[_0x43d4('0x72')],'value':_0x277c7c[_0x43d4('0x75')]};}):_0x3cc82f[_0x43d4('0x2e')]==_0x43d4('0x76')?[{'name':_0x43d4('0x77'),'value':'true'},{'name':_0x43d4('0x78'),'value':'false'}]:[]};})};}})[_0x43d4('0x24')](respondWithResult(_0x5cd405,null))[_0x43d4('0x47')](function(_0x1c42b6){var _0x38981f=_0x36849c[_0x43d4('0x32')][_0x43d4('0x79')]?0x1f4:_0x1c42b6[_0x43d4('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x43d4('0x56'),_0x38981f,JSON['stringify'](_0x1c42b6));delete _0x1c42b6[_0x43d4('0x28')];if(_0x38981f===0x191){_0x38981f=0x190;}_0x5cd405['status'](_0x38981f)[_0x43d4('0x29')](_0x36849c[_0x43d4('0x32')][_0x43d4('0x79')]?{'message':_0x43d4('0x7b'),'statusCode':_0x1c42b6[_0x43d4('0x7a')]}:_0x1c42b6);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 363ffd9..5260cb4 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 _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 +var _0x7311=['./intSalesforceAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x527799,_0x51370a){var _0x2cb74f=function(_0x5a911d){while(--_0x5a911d){_0x527799['push'](_0x527799['shift']());}};_0x2cb74f(++_0x51370a);}(_0x7311,0x148));var _0x1731=function(_0x5c5f2f,_0x4325f3){_0x5c5f2f=_0x5c5f2f-0x0;var _0x4ecef=_0x7311[_0x5c5f2f];return _0x4ecef;};'use strict';var _=require(_0x1731('0x0'));var util=require(_0x1731('0x1'));var logger=require(_0x1731('0x2'))(_0x1731('0x3'));var moment=require(_0x1731('0x4'));var BPromise=require(_0x1731('0x5'));var rp=require(_0x1731('0x6'));var fs=require('fs');var path=require(_0x1731('0x7'));var rimraf=require(_0x1731('0x8'));var config=require(_0x1731('0x9'));var attributes=require(_0x1731('0xa'));var integrations=require(_0x1731('0xb'));module['exports']=function(_0x39e9cb,_0x3e5ead){return _0x39e9cb[_0x1731('0xc')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','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 a2f8760..1265b0c 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 _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 +var _0xffdd=['attributes','GetSalesforceAccount','catch','find','where','model','ShowSalesforceAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','stringify','error','code','message','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount','findAll','options','raw','limit','include','map'];(function(_0x399a65,_0x2112da){var _0xa0ffca=function(_0xc30e1a){while(--_0xc30e1a){_0x399a65['push'](_0x399a65['shift']());}};_0xa0ffca(++_0x2112da);}(_0xffdd,0x193));var _0xdffd=function(_0x372080,_0x65d24){_0x372080=_0x372080-0x0;var _0x2405ec=_0xffdd[_0x372080];return _0x2405ec;};'use strict';var _=require(_0xdffd('0x0'));var util=require(_0xdffd('0x1'));var moment=require(_0xdffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdffd('0x3'));var db=require(_0xdffd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdffd('0x5'))(_0xdffd('0x6'));var config=require(_0xdffd('0x7'));var jayson=require(_0xdffd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4835f6,_0x372e34,_0x25cd14){return new BPromise(function(_0x1c39c6,_0x2e9eb0){return client[_0xdffd('0x9')](_0x4835f6,_0x25cd14)[_0xdffd('0xa')](function(_0x19137c){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x372e34,'request\x20sent');logger[_0xdffd('0xb')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x372e34,'request\x20sent',JSON[_0xdffd('0xc')](_0x19137c));if(_0x19137c[_0xdffd('0xd')]){if(_0x19137c[_0xdffd('0xd')][_0xdffd('0xe')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x372e34,_0x19137c[_0xdffd('0xd')]['message']);return _0x2e9eb0(_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);}logger[_0xdffd('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x372e34,_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);return _0x1c39c6(_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);}else{logger[_0xdffd('0x10')](_0xdffd('0x11'),_0x372e34,_0xdffd('0x12'));_0x1c39c6(_0x19137c['result'][_0xdffd('0xf')]);}})['catch'](function(_0xa5dd99){logger[_0xdffd('0xd')](_0xdffd('0x11'),_0x372e34,_0xa5dd99);_0x2e9eb0(_0xa5dd99);});});}exports['GetSalesforceAccount']=function(_0xdcc09f){var _0x5583ac=this;return new Promise(function(_0x16a733,_0x9d52b){return db[_0xdffd('0x13')][_0xdffd('0x14')]({'raw':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f[_0xdffd('0x15')][_0xdffd('0x16')]===undefined?!![]:![]:!![],'where':_0xdcc09f['options']?_0xdcc09f[_0xdffd('0x15')]['where']||null:null,'attributes':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f[_0xdffd('0x15')]['attributes']||null:null,'limit':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f['options'][_0xdffd('0x17')]||null:null,'include':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f[_0xdffd('0x15')][_0xdffd('0x18')]?_[_0xdffd('0x19')](_0xdcc09f['options'][_0xdffd('0x18')],function(_0x1a5926){return{'model':db[_0x1a5926['model']],'as':_0x1a5926['as'],'attributes':_0x1a5926[_0xdffd('0x1a')],'include':_0x1a5926[_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x1a5926['include'],function(_0x324b3e){return{'model':db[_0x324b3e['model']],'as':_0x324b3e['as'],'attributes':_0x324b3e[_0xdffd('0x1a')],'include':_0x324b3e[_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x324b3e[_0xdffd('0x18')],function(_0x2f0c69){return{'model':db[_0x2f0c69['model']],'as':_0x2f0c69['as'],'attributes':_0x2f0c69[_0xdffd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdffd('0xa')](function(_0x5c544f){logger[_0xdffd('0x10')](_0xdffd('0x1b'),_0xdcc09f);logger[_0xdffd('0xb')](_0xdffd('0x1b'),_0xdcc09f,JSON[_0xdffd('0xc')](_0x5c544f));_0x16a733(_0x5c544f);})[_0xdffd('0x1c')](function(_0x1c3289){logger[_0xdffd('0xd')]('GetSalesforceAccount',_0x1c3289['message'],_0xdcc09f);_0x9d52b(_0x5583ac['error'](0x1f4,_0x1c3289[_0xdffd('0xf')]));});});};exports['ShowSalesforceAccount']=function(_0x5c5761){var _0x45f8e9=this;return new Promise(function(_0x11b58d,_0x491dcd){return db['SalesforceAccount'][_0xdffd('0x1d')]({'raw':_0x5c5761[_0xdffd('0x15')]?_0x5c5761[_0xdffd('0x15')][_0xdffd('0x16')]===undefined?!![]:![]:!![],'where':_0x5c5761['options']?_0x5c5761['options'][_0xdffd('0x1e')]||null:null,'attributes':_0x5c5761[_0xdffd('0x15')]?_0x5c5761['options'][_0xdffd('0x1a')]||null:null,'include':_0x5c5761['options']?_0x5c5761[_0xdffd('0x15')][_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x5c5761[_0xdffd('0x15')]['include'],function(_0xf7d01){return{'model':db[_0xf7d01['model']],'as':_0xf7d01['as'],'attributes':_0xf7d01[_0xdffd('0x1a')],'include':_0xf7d01['include']?_[_0xdffd('0x19')](_0xf7d01[_0xdffd('0x18')],function(_0x147f39){return{'model':db[_0x147f39[_0xdffd('0x1f')]],'as':_0x147f39['as'],'attributes':_0x147f39[_0xdffd('0x1a')],'include':_0x147f39[_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x147f39[_0xdffd('0x18')],function(_0x595d9d){return{'model':db[_0x595d9d['model']],'as':_0x595d9d['as'],'attributes':_0x595d9d['attributes']};}):[]};}):[]};}):[]:[]})[_0xdffd('0xa')](function(_0x1954e9){logger[_0xdffd('0x10')](_0xdffd('0x20'),_0x5c5761);logger['debug'](_0xdffd('0x20'),_0x5c5761,JSON[_0xdffd('0xc')](_0x1954e9));_0x11b58d(_0x1954e9);})[_0xdffd('0x1c')](function(_0x45c185){logger[_0xdffd('0xd')](_0xdffd('0x20'),_0x45c185[_0xdffd('0xf')],_0x5c5761);_0x491dcd(_0x45f8e9[_0xdffd('0xd')](0x1f4,_0x45c185[_0xdffd('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 68f141e..f6aaf87 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 _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 +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b6420,_0x126201){_0x4b6420=_0x4b6420-0x0;var _0x37076f=_0x0b0e[_0x4b6420];return _0x37076f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 6bc0cc4..74816d7 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 _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 +var _0xa104=['account','nothing','STRING','sequelize','exports','ENUM','Task','Case','contact_lead','lead','account_contact_lead'];(function(_0x3842fa,_0x40f55f){var _0x1143ae=function(_0x218b2c){while(--_0x218b2c){_0x3842fa['push'](_0x3842fa['shift']());}};_0x1143ae(++_0x40f55f);}(_0xa104,0xc9));var _0x4a10=function(_0x57979d,_0x354826){_0x57979d=_0x57979d-0x0;var _0x3d5b11=_0xa104[_0x57979d];return _0x3d5b11;};'use strict';var Sequelize=require(_0x4a10('0x0'));module[_0x4a10('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4a10('0x2')](_0x4a10('0x3'),_0x4a10('0x4')),'defaultValue':_0x4a10('0x3')},'moduleSearch':{'type':Sequelize[_0x4a10('0x2')](_0x4a10('0x5'),'contact',_0x4a10('0x6'),_0x4a10('0x7'),_0x4a10('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x4a10('0x2')](_0x4a10('0x9'),'contact',_0x4a10('0x6'),_0x4a10('0x8')),'defaultValue':_0x4a10('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x4a10('0xa')]},'additionalSearchContact':{'type':Sequelize[_0x4a10('0xa')]},'additionalSearchLead':{'type':Sequelize[_0x4a10('0xa')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f4b7d90..186e23e 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 _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 +var _0x13c4=['fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x13c4,0xf9));var _0x413c=function(_0x37eddf,_0x2d3277){_0x37eddf=_0x37eddf-0x0;var _0x376594=_0x13c4[_0x37eddf];return _0x376594;};'use strict';var emlformat=require(_0x413c('0x0'));var rimraf=require(_0x413c('0x1'));var zipdir=require(_0x413c('0x2'));var jsonpatch=require(_0x413c('0x3'));var rp=require(_0x413c('0x4'));var moment=require(_0x413c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x413c('0x6'));var sox=require(_0x413c('0x7'));var csv=require('to-csv');var ejs=require(_0x413c('0x8'));var fs=require('fs');var fs_extra=require(_0x413c('0x9'));var _=require(_0x413c('0xa'));var squel=require(_0x413c('0xb'));var crypto=require(_0x413c('0xc'));var jsforce=require(_0x413c('0xd'));var deskjs=require(_0x413c('0xe'));var toCsv=require(_0x413c('0xf'));var querystring=require(_0x413c('0x10'));var Papa=require(_0x413c('0x11'));var Redis=require('ioredis');var authService=require(_0x413c('0x12'));var qs=require(_0x413c('0x13'));var as=require(_0x413c('0x14'));var hardwareService=require(_0x413c('0x15'));var logger=require(_0x413c('0x16'))(_0x413c('0x17'));var utils=require(_0x413c('0x18'));var config=require(_0x413c('0x19'));var licenseUtil=require(_0x413c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9bd289,_0x16f78f){_0x16f78f=_0x16f78f||0xcc;return function(_0x84e77c){if(_0x84e77c){return _0x9bd289[_0x413c('0x1b')](_0x16f78f);}return _0x9bd289[_0x413c('0x1c')](_0x16f78f)['end']();};}function respondWithResult(_0x46b7a8,_0x2259a5){_0x2259a5=_0x2259a5||0xc8;return function(_0x23ec89){if(_0x23ec89){return _0x46b7a8['status'](_0x2259a5)[_0x413c('0x1d')](_0x23ec89);}};}function respondWithFilteredResult(_0xff0f28,_0x3c8ffb){return function(_0x1b6e3b){if(_0x1b6e3b){var _0x2a45be=typeof _0x3c8ffb['offset']==='undefined'&&typeof _0x3c8ffb[_0x413c('0x1e')]===_0x413c('0x1f');var _0x58e368=_0x1b6e3b[_0x413c('0x20')];var _0x3df3f0=_0x2a45be?0x0:_0x3c8ffb[_0x413c('0x21')];var _0x56954b=_0x2a45be?_0x1b6e3b['count']:_0x3c8ffb[_0x413c('0x21')]+_0x3c8ffb['limit'];var _0x4b2aa9;if(_0x56954b>=_0x58e368){_0x56954b=_0x58e368;_0x4b2aa9=0xc8;}else{_0x4b2aa9=0xce;}_0xff0f28[_0x413c('0x1c')](_0x4b2aa9);return _0xff0f28[_0x413c('0x22')](_0x413c('0x23'),_0x3df3f0+'-'+_0x56954b+'/'+_0x58e368)['json'](_0x1b6e3b);}return null;};}function patchUpdates(_0x5f38cb){return function(_0xff7efb){try{jsonpatch[_0x413c('0x24')](_0xff7efb,_0x5f38cb,!![]);}catch(_0x42f2e){return BPromise[_0x413c('0x25')](_0x42f2e);}return _0xff7efb['save']();};}function saveUpdates(_0x28fd8c,_0x100e92){return function(_0x5b2a13){if(_0x5b2a13){return _0x5b2a13[_0x413c('0x26')](_0x28fd8c)[_0x413c('0x27')](function(_0x559e59){return _0x559e59;});}return null;};}function removeEntity(_0xe177e0,_0x2930f9){return function(_0x56bb67){if(_0x56bb67){return _0x56bb67[_0x413c('0x28')]()['then'](function(){_0xe177e0[_0x413c('0x1c')](0xcc)[_0x413c('0x29')]();});}};}function handleEntityNotFound(_0x3078b0,_0x2a2097){return function(_0x356e71){if(!_0x356e71){_0x3078b0[_0x413c('0x1b')](0x194);}return _0x356e71;};}function handleError(_0x37bcbd,_0x2ae36d){_0x2ae36d=_0x2ae36d||0x1f4;return function(_0x4a8d05){logger[_0x413c('0x2a')](_0x4a8d05[_0x413c('0x2b')]);if(_0x4a8d05['name']){delete _0x4a8d05[_0x413c('0x2c')];}_0x37bcbd[_0x413c('0x1c')](_0x2ae36d)['send'](_0x4a8d05);};}exports[_0x413c('0x2d')]=function(_0x3d3922,_0x54df05){var _0x38e37c={},_0x209140={},_0x48a479={'count':0x0,'rows':[]};var _0x5f353f=_[_0x413c('0x2e')](db[_0x413c('0x2f')][_0x413c('0x30')],function(_0x4cdd79){return{'name':_0x4cdd79[_0x413c('0x31')],'type':_0x4cdd79[_0x413c('0x32')][_0x413c('0x33')]};});_0x209140[_0x413c('0x34')]=_['map'](_0x5f353f,'name');_0x209140[_0x413c('0x35')]=_[_0x413c('0x36')](_0x3d3922[_0x413c('0x35')]);_0x209140[_0x413c('0x37')]=_['intersection'](_0x209140[_0x413c('0x34')],_0x209140[_0x413c('0x35')]);_0x38e37c[_0x413c('0x38')]=_['intersection'](_0x209140['model'],qs[_0x413c('0x39')](_0x3d3922[_0x413c('0x35')]['fields']));_0x38e37c[_0x413c('0x38')]=_0x38e37c['attributes'][_0x413c('0x3a')]?_0x38e37c[_0x413c('0x38')]:_0x209140[_0x413c('0x34')];if(!_0x3d3922[_0x413c('0x35')][_0x413c('0x3b')](_0x413c('0x3c'))){_0x38e37c['limit']=qs[_0x413c('0x1e')](_0x3d3922[_0x413c('0x35')][_0x413c('0x1e')]);_0x38e37c[_0x413c('0x21')]=qs[_0x413c('0x21')](_0x3d3922['query']['offset']);}_0x38e37c['order']=qs['sort'](_0x3d3922[_0x413c('0x35')][_0x413c('0x3d')]);_0x38e37c['where']=qs['filters'](_[_0x413c('0x3e')](_0x3d3922[_0x413c('0x35')],_0x209140[_0x413c('0x37')]),_0x5f353f);if(_0x3d3922[_0x413c('0x35')][_0x413c('0x3f')]){_0x38e37c[_0x413c('0x40')]=_['merge'](_0x38e37c[_0x413c('0x40')],{'$or':_['map'](_0x5f353f,function(_0x446e49){if(_0x446e49[_0x413c('0x32')]!==_0x413c('0x41')){var _0x2f1e={};_0x2f1e[_0x446e49[_0x413c('0x2c')]]={'$like':'%'+_0x3d3922[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0x2f1e;}})});}_0x38e37c=_[_0x413c('0x42')]({},_0x38e37c,_0x3d3922['options']);var _0x5265c3={'where':_0x38e37c[_0x413c('0x40')]};return db[_0x413c('0x2f')]['count'](_0x5265c3)[_0x413c('0x27')](function(_0x43fa3d){_0x48a479[_0x413c('0x20')]=_0x43fa3d;if(_0x3d3922[_0x413c('0x35')][_0x413c('0x43')]){_0x38e37c[_0x413c('0x44')]=[{'all':!![]}];}return db[_0x413c('0x2f')]['findAll'](_0x38e37c);})['then'](function(_0xb7831a){_0x48a479[_0x413c('0x45')]=_0xb7831a;return _0x48a479;})[_0x413c('0x27')](respondWithFilteredResult(_0x54df05,_0x38e37c))[_0x413c('0x46')](handleError(_0x54df05,null));};exports[_0x413c('0x47')]=function(_0x7ebf2,_0x30a69c){var _0xdc0a8c={'raw':![],'where':{'id':_0x7ebf2[_0x413c('0x48')]['id']}},_0x14a4e8={};_0x14a4e8[_0x413c('0x34')]=_[_0x413c('0x36')](db[_0x413c('0x2f')][_0x413c('0x30')]);_0x14a4e8[_0x413c('0x35')]=_[_0x413c('0x36')](_0x7ebf2['query']);_0x14a4e8['filters']=_[_0x413c('0x49')](_0x14a4e8['model'],_0x14a4e8[_0x413c('0x35')]);_0xdc0a8c['attributes']=_[_0x413c('0x49')](_0x14a4e8['model'],qs[_0x413c('0x39')](_0x7ebf2[_0x413c('0x35')][_0x413c('0x39')]));_0xdc0a8c['attributes']=_0xdc0a8c[_0x413c('0x38')]['length']?_0xdc0a8c['attributes']:_0x14a4e8[_0x413c('0x34')];if(_0x7ebf2[_0x413c('0x35')][_0x413c('0x43')]){_0xdc0a8c[_0x413c('0x44')]=[{'all':!![]}];}_0xdc0a8c=_[_0x413c('0x42')]({},_0xdc0a8c,_0x7ebf2[_0x413c('0x4a')]);return db[_0x413c('0x2f')][_0x413c('0x4b')](_0xdc0a8c)[_0x413c('0x27')](handleEntityNotFound(_0x30a69c,null))[_0x413c('0x27')](respondWithResult(_0x30a69c,null))['catch'](handleError(_0x30a69c,null));};exports[_0x413c('0x4c')]=function(_0x3aaf52,_0x4ef965){return db[_0x413c('0x2f')][_0x413c('0x4c')](_0x3aaf52[_0x413c('0x4d')],{})[_0x413c('0x27')](respondWithResult(_0x4ef965,0xc9))['catch'](handleError(_0x4ef965,null));};exports[_0x413c('0x26')]=function(_0x4ec858,_0x394204){if(_0x4ec858['body']['id']){delete _0x4ec858[_0x413c('0x4d')]['id'];}return db[_0x413c('0x2f')]['find']({'where':{'id':_0x4ec858['params']['id']}})[_0x413c('0x27')](handleEntityNotFound(_0x394204,null))[_0x413c('0x27')](saveUpdates(_0x4ec858['body'],null))[_0x413c('0x27')](respondWithResult(_0x394204,null))[_0x413c('0x46')](handleError(_0x394204,null));};exports[_0x413c('0x28')]=function(_0x2b0828,_0x3ba384){return db[_0x413c('0x2f')][_0x413c('0x4b')]({'where':{'id':_0x2b0828['params']['id']}})[_0x413c('0x27')](handleEntityNotFound(_0x3ba384,null))[_0x413c('0x27')](removeEntity(_0x3ba384,null))['catch'](handleError(_0x3ba384,null));};exports[_0x413c('0x4e')]=function(_0x5ddcf1,_0x3b7090,_0x2c1436){var _0xb094f9={};var _0x2fd748={};var _0x53a202;var _0x5b175a;return db[_0x413c('0x2f')][_0x413c('0x4f')]({'where':{'id':_0x5ddcf1['params']['id']}})[_0x413c('0x27')](handleEntityNotFound(_0x3b7090,null))['then'](function(_0x18f001){if(_0x18f001){_0x53a202=_0x18f001;_0x2fd748['model']=_[_0x413c('0x36')](db[_0x413c('0x50')][_0x413c('0x30')]);_0x2fd748[_0x413c('0x35')]=_['keys'](_0x5ddcf1[_0x413c('0x35')]);_0x2fd748[_0x413c('0x37')]=_[_0x413c('0x49')](_0x2fd748[_0x413c('0x34')],_0x2fd748[_0x413c('0x35')]);_0xb094f9['attributes']=_[_0x413c('0x49')](_0x2fd748['model'],qs[_0x413c('0x39')](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x39')]));_0xb094f9[_0x413c('0x38')]=_0xb094f9[_0x413c('0x38')][_0x413c('0x3a')]?_0xb094f9[_0x413c('0x38')]:_0x2fd748['model'];_0xb094f9[_0x413c('0x51')]=qs[_0x413c('0x3d')](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3d')]);_0xb094f9['where']=qs[_0x413c('0x37')](_[_0x413c('0x3e')](_0x5ddcf1[_0x413c('0x35')],_0x2fd748[_0x413c('0x37')]));if(_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3f')]){_0xb094f9[_0x413c('0x40')]=_[_0x413c('0x42')](_0xb094f9[_0x413c('0x40')],{'$or':_[_0x413c('0x2e')](_0xb094f9[_0x413c('0x38')],function(_0x4062c3){var _0x27148b={};_0x27148b[_0x4062c3]={'$like':'%'+_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0x27148b;})});}_0xb094f9=_[_0x413c('0x42')]({},_0xb094f9,_0x5ddcf1['options']);return _0x53a202['getFields'](_0xb094f9);}})[_0x413c('0x27')](function(_0x1bb761){if(_0x1bb761){_0x5b175a=_0x1bb761['length'];if(!_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3b')](_0x413c('0x3c'))){_0xb094f9[_0x413c('0x1e')]=qs['limit'](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x1e')]);_0xb094f9['offset']=qs[_0x413c('0x21')](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x21')]);}return _0x53a202[_0x413c('0x4e')](_0xb094f9);}})[_0x413c('0x27')](function(_0x34fe60){if(_0x34fe60){return _0x34fe60?{'count':_0x5b175a,'rows':_0x34fe60}:null;}})['then'](respondWithResult(_0x3b7090,null))['catch'](handleError(_0x3b7090,null));};exports[_0x413c('0x52')]=function(_0x1695cf,_0x15e11c,_0x3bf88c){var _0x7e0e6e={};var _0x1fd588={};var _0x19b66c;var _0x1acf6d;return db['SalesforceConfiguration'][_0x413c('0x4f')]({'where':{'id':_0x1695cf[_0x413c('0x48')]['id']}})['then'](handleEntityNotFound(_0x15e11c,null))[_0x413c('0x27')](function(_0x534263){if(_0x534263){_0x19b66c=_0x534263;_0x1fd588['model']=_[_0x413c('0x36')](db[_0x413c('0x50')][_0x413c('0x30')]);_0x1fd588['query']=_['keys'](_0x1695cf[_0x413c('0x35')]);_0x1fd588[_0x413c('0x37')]=_[_0x413c('0x49')](_0x1fd588[_0x413c('0x34')],_0x1fd588[_0x413c('0x35')]);_0x7e0e6e[_0x413c('0x38')]=_[_0x413c('0x49')](_0x1fd588['model'],qs[_0x413c('0x39')](_0x1695cf[_0x413c('0x35')][_0x413c('0x39')]));_0x7e0e6e[_0x413c('0x38')]=_0x7e0e6e[_0x413c('0x38')][_0x413c('0x3a')]?_0x7e0e6e['attributes']:_0x1fd588[_0x413c('0x34')];_0x7e0e6e['order']=qs['sort'](_0x1695cf[_0x413c('0x35')][_0x413c('0x3d')]);_0x7e0e6e[_0x413c('0x40')]=qs[_0x413c('0x37')](_[_0x413c('0x3e')](_0x1695cf[_0x413c('0x35')],_0x1fd588[_0x413c('0x37')]));if(_0x1695cf[_0x413c('0x35')][_0x413c('0x3f')]){_0x7e0e6e[_0x413c('0x40')]=_[_0x413c('0x42')](_0x7e0e6e[_0x413c('0x40')],{'$or':_['map'](_0x7e0e6e[_0x413c('0x38')],function(_0x45723d){var _0xfabe2e={};_0xfabe2e[_0x45723d]={'$like':'%'+_0x1695cf[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0xfabe2e;})});}_0x7e0e6e=_[_0x413c('0x42')]({},_0x7e0e6e,_0x1695cf[_0x413c('0x4a')]);return _0x19b66c[_0x413c('0x52')](_0x7e0e6e);}})[_0x413c('0x27')](function(_0x2afb23){if(_0x2afb23){_0x1acf6d=_0x2afb23[_0x413c('0x3a')];if(!_0x1695cf['query'][_0x413c('0x3b')](_0x413c('0x3c'))){_0x7e0e6e['limit']=qs[_0x413c('0x1e')](_0x1695cf[_0x413c('0x35')]['limit']);_0x7e0e6e[_0x413c('0x21')]=qs['offset'](_0x1695cf[_0x413c('0x35')]['offset']);}return _0x19b66c[_0x413c('0x52')](_0x7e0e6e);}})['then'](function(_0x56bc1a){if(_0x56bc1a){return _0x56bc1a?{'count':_0x1acf6d,'rows':_0x56bc1a}:null;}})[_0x413c('0x27')](respondWithResult(_0x15e11c,null))[_0x413c('0x46')](handleError(_0x15e11c,null));};exports['getDescriptions']=function(_0x24bbc7,_0x12f632,_0x37302c){var _0x36293d={};var _0x27122b={};var _0x26d1ac;var _0xc32109;return db[_0x413c('0x2f')][_0x413c('0x4f')]({'where':{'id':_0x24bbc7[_0x413c('0x48')]['id']}})['then'](handleEntityNotFound(_0x12f632,null))['then'](function(_0x4c0721){if(_0x4c0721){_0x26d1ac=_0x4c0721;_0x27122b[_0x413c('0x34')]=_[_0x413c('0x36')](db['SalesforceField'][_0x413c('0x30')]);_0x27122b['query']=_[_0x413c('0x36')](_0x24bbc7[_0x413c('0x35')]);_0x27122b[_0x413c('0x37')]=_[_0x413c('0x49')](_0x27122b[_0x413c('0x34')],_0x27122b[_0x413c('0x35')]);_0x36293d[_0x413c('0x38')]=_[_0x413c('0x49')](_0x27122b[_0x413c('0x34')],qs[_0x413c('0x39')](_0x24bbc7['query'][_0x413c('0x39')]));_0x36293d[_0x413c('0x38')]=_0x36293d[_0x413c('0x38')][_0x413c('0x3a')]?_0x36293d['attributes']:_0x27122b[_0x413c('0x34')];_0x36293d['order']=qs['sort'](_0x24bbc7[_0x413c('0x35')][_0x413c('0x3d')]);_0x36293d['where']=qs[_0x413c('0x37')](_[_0x413c('0x3e')](_0x24bbc7[_0x413c('0x35')],_0x27122b['filters']));if(_0x24bbc7[_0x413c('0x35')][_0x413c('0x3f')]){_0x36293d[_0x413c('0x40')]=_['merge'](_0x36293d[_0x413c('0x40')],{'$or':_[_0x413c('0x2e')](_0x36293d[_0x413c('0x38')],function(_0x5f381f){var _0x4cd00e={};_0x4cd00e[_0x5f381f]={'$like':'%'+_0x24bbc7[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0x4cd00e;})});}_0x36293d=_[_0x413c('0x42')]({},_0x36293d,_0x24bbc7[_0x413c('0x4a')]);return _0x26d1ac[_0x413c('0x53')](_0x36293d);}})[_0x413c('0x27')](function(_0x1d63bd){if(_0x1d63bd){_0xc32109=_0x1d63bd[_0x413c('0x3a')];if(!_0x24bbc7[_0x413c('0x35')]['hasOwnProperty']('nolimit')){_0x36293d[_0x413c('0x1e')]=qs[_0x413c('0x1e')](_0x24bbc7[_0x413c('0x35')][_0x413c('0x1e')]);_0x36293d[_0x413c('0x21')]=qs[_0x413c('0x21')](_0x24bbc7['query'][_0x413c('0x21')]);}return _0x26d1ac['getDescriptions'](_0x36293d);}})[_0x413c('0x27')](function(_0x467e09){if(_0x467e09){return _0x467e09?{'count':_0xc32109,'rows':_0x467e09}:null;}})[_0x413c('0x27')](respondWithResult(_0x12f632,null))['catch'](handleError(_0x12f632,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f735369..51717b1 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 _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 +var _0x2472=['define','SalesforceConfiguration','lodash','../../config/logger','api','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x2472,0x188));var _0x2247=function(_0x282c17,_0x99a901){_0x282c17=_0x282c17-0x0;var _0x543428=_0x2472[_0x282c17];return _0x543428;};'use strict';var _=require(_0x2247('0x0'));var util=require('util');var logger=require(_0x2247('0x1'))(_0x2247('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2247('0x3'));var fs=require('fs');var path=require(_0x2247('0x4'));var rimraf=require(_0x2247('0x5'));var config=require('../../config/environment');var attributes=require(_0x2247('0x6'));module[_0x2247('0x7')]=function(_0x19c61c,_0x3a93ff){return _0x19c61c[_0x2247('0x8')](_0x2247('0x9'),attributes,{'tableName':'int_salesforce_configurations','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 c18edc3..1df168c 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 _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 +var _0xe3e3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xe3e3,0x1b2));var _0x3e3e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe3e3[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x3e3e('0x0'));var util=require(_0x3e3e('0x1'));var moment=require(_0x3e3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e3e('0x3'));var fs=require('fs');var Redis=require(_0x3e3e('0x4'));var db=require(_0x3e3e('0x5'))['db'];var utils=require(_0x3e3e('0x6'));var logger=require(_0x3e3e('0x7'))('rpc');var config=require(_0x3e3e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6d267a,_0x48bcc1,_0x73c273){return new BPromise(function(_0x3606fe,_0x3d1f31){return client[_0x3e3e('0xa')](_0x6d267a,_0x73c273)[_0x3e3e('0xb')](function(_0x11ec49){logger['info'](_0x3e3e('0xc'),_0x48bcc1,_0x3e3e('0xd'));logger[_0x3e3e('0xe')](_0x3e3e('0xf'),_0x48bcc1,_0x3e3e('0xd'),JSON[_0x3e3e('0x10')](_0x11ec49));if(_0x11ec49[_0x3e3e('0x11')]){if(_0x11ec49['error'][_0x3e3e('0x12')]===0x1f4){logger[_0x3e3e('0x11')](_0x3e3e('0xc'),_0x48bcc1,_0x11ec49[_0x3e3e('0x11')][_0x3e3e('0x13')]);return _0x3d1f31(_0x11ec49[_0x3e3e('0x11')][_0x3e3e('0x13')]);}logger[_0x3e3e('0x11')](_0x3e3e('0xc'),_0x48bcc1,_0x11ec49['error']['message']);return _0x3606fe(_0x11ec49[_0x3e3e('0x11')][_0x3e3e('0x13')]);}else{logger[_0x3e3e('0x14')](_0x3e3e('0xc'),_0x48bcc1,_0x3e3e('0xd'));_0x3606fe(_0x11ec49[_0x3e3e('0x15')]['message']);}})[_0x3e3e('0x16')](function(_0x302692){logger[_0x3e3e('0x11')](_0x3e3e('0xc'),_0x48bcc1,_0x302692);_0x3d1f31(_0x302692);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b8ba0c2..b39eaff 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 _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 +var _0x6449=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0xd92e0f,_0x4c28de){var _0x408a33=function(_0x35be94){while(--_0x35be94){_0xd92e0f['push'](_0xd92e0f['shift']());}};_0x408a33(++_0x4c28de);}(_0x6449,0x12a));var _0x9644=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x6449[_0x28611e];return _0x530f69;};'use strict';var multer=require(_0x9644('0x0'));var util=require(_0x9644('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9644('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9644('0x3'));var interaction=require(_0x9644('0x4'));var config=require(_0x9644('0x5'));var controller=require(_0x9644('0x6'));router[_0x9644('0x7')]('/',auth[_0x9644('0x8')](),controller[_0x9644('0x9')]);router[_0x9644('0x7')](_0x9644('0xa'),auth[_0x9644('0x8')](),controller[_0x9644('0xb')]);router[_0x9644('0xc')]('/',auth[_0x9644('0x8')](),controller[_0x9644('0xd')]);router[_0x9644('0xe')](_0x9644('0xa'),auth[_0x9644('0x8')](),controller['update']);router[_0x9644('0xf')](_0x9644('0xa'),auth['isAuthenticated'](),controller[_0x9644('0x10')]);module[_0x9644('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 7baea86..c48bf92 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 _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 +var _0x802b=['ENUM','sequelize','exports','string','variable','customVariable','picklist','STRING'];(function(_0x37ad0c,_0xff328d){var _0x148e24=function(_0x4830d3){while(--_0x4830d3){_0x37ad0c['push'](_0x37ad0c['shift']());}};_0x148e24(++_0xff328d);}(_0x802b,0x1b9));var _0xb802=function(_0x3f5d5c,_0xefb026){_0x3f5d5c=_0x3f5d5c-0x0;var _0x27155c=_0x802b[_0x3f5d5c];return _0x27155c;};'use strict';var Sequelize=require(_0xb802('0x0'));module[_0xb802('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb802('0x2'),_0xb802('0x3'),_0xb802('0x4'),'keyValue',_0xb802('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb802('0x6')]},'key':{'type':Sequelize[_0xb802('0x6')]},'keyType':{'type':Sequelize[_0xb802('0x7')]('string',_0xb802('0x3'),_0xb802('0x4'))},'keyContent':{'type':Sequelize[_0xb802('0x6')]},'idField':{'type':Sequelize[_0xb802('0x6')]},'variableName':{'type':Sequelize[_0xb802('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ca7dee3..1b64189 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 _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 +var _0x38d8=['SalesforceField','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','sendStatus','error','name','send','index','map'];(function(_0x44f91e,_0x47e2eb){var _0x33a0bd=function(_0x6e7327){while(--_0x6e7327){_0x44f91e['push'](_0x44f91e['shift']());}};_0x33a0bd(++_0x47e2eb);}(_0x38d8,0xb9));var _0x838d=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x38d8[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x838d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x838d('0x1'));var rp=require(_0x838d('0x2'));var moment=require(_0x838d('0x3'));var BPromise=require(_0x838d('0x4'));var Mustache=require(_0x838d('0x5'));var util=require(_0x838d('0x6'));var path=require(_0x838d('0x7'));var sox=require(_0x838d('0x8'));var csv=require(_0x838d('0x9'));var ejs=require(_0x838d('0xa'));var fs=require('fs');var fs_extra=require(_0x838d('0xb'));var _=require(_0x838d('0xc'));var squel=require(_0x838d('0xd'));var crypto=require(_0x838d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x838d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x838d('0x10'));var Papa=require(_0x838d('0x11'));var Redis=require('ioredis');var authService=require(_0x838d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x838d('0x13'));var hardwareService=require(_0x838d('0x14'));var logger=require(_0x838d('0x15'))(_0x838d('0x16'));var utils=require(_0x838d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x838d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29017f,_0x5e9dc2){_0x5e9dc2=_0x5e9dc2||0xcc;return function(_0x5962d0){if(_0x5962d0){return _0x29017f['sendStatus'](_0x5e9dc2);}return _0x29017f[_0x838d('0x19')](_0x5e9dc2)[_0x838d('0x1a')]();};}function respondWithResult(_0x208252,_0x4f3992){_0x4f3992=_0x4f3992||0xc8;return function(_0x177c0a){if(_0x177c0a){return _0x208252[_0x838d('0x19')](_0x4f3992)[_0x838d('0x1b')](_0x177c0a);}};}function respondWithFilteredResult(_0x353cfd,_0xeecdaf){return function(_0x571f8a){if(_0x571f8a){var _0x427184=typeof _0xeecdaf[_0x838d('0x1c')]===_0x838d('0x1d')&&typeof _0xeecdaf[_0x838d('0x1e')]===_0x838d('0x1d');var _0x583178=_0x571f8a['count'];var _0x47975c=_0x427184?0x0:_0xeecdaf[_0x838d('0x1c')];var _0x5a87e5=_0x427184?_0x571f8a[_0x838d('0x1f')]:_0xeecdaf[_0x838d('0x1c')]+_0xeecdaf[_0x838d('0x1e')];var _0x156429;if(_0x5a87e5>=_0x583178){_0x5a87e5=_0x583178;_0x156429=0xc8;}else{_0x156429=0xce;}_0x353cfd['status'](_0x156429);return _0x353cfd['set'](_0x838d('0x20'),_0x47975c+'-'+_0x5a87e5+'/'+_0x583178)[_0x838d('0x1b')](_0x571f8a);}return null;};}function patchUpdates(_0x262a72){return function(_0x5e6113){try{jsonpatch[_0x838d('0x21')](_0x5e6113,_0x262a72,!![]);}catch(_0xfcac35){return BPromise[_0x838d('0x22')](_0xfcac35);}return _0x5e6113[_0x838d('0x23')]();};}function saveUpdates(_0x3c8925,_0x40b9a7){return function(_0x94be6c){if(_0x94be6c){return _0x94be6c[_0x838d('0x24')](_0x3c8925)['then'](function(_0x2a4d9c){return _0x2a4d9c;});}return null;};}function removeEntity(_0x4d7b5d,_0x57adbc){return function(_0x53b327){if(_0x53b327){return _0x53b327['destroy']()['then'](function(){_0x4d7b5d[_0x838d('0x19')](0xcc)[_0x838d('0x1a')]();});}};}function handleEntityNotFound(_0x23336e,_0x3380cb){return function(_0x5ca543){if(!_0x5ca543){_0x23336e[_0x838d('0x25')](0x194);}return _0x5ca543;};}function handleError(_0xad20c,_0x24c0a9){_0x24c0a9=_0x24c0a9||0x1f4;return function(_0x570b90){logger[_0x838d('0x26')](_0x570b90['stack']);if(_0x570b90[_0x838d('0x27')]){delete _0x570b90[_0x838d('0x27')];}_0xad20c[_0x838d('0x19')](_0x24c0a9)[_0x838d('0x28')](_0x570b90);};}exports[_0x838d('0x29')]=function(_0x2d311f,_0x5a5bcc){var _0x1cb83f={},_0x2fe556={},_0x5d1263={'count':0x0,'rows':[]};var _0xc97a3d=_[_0x838d('0x2a')](db[_0x838d('0x2b')][_0x838d('0x2c')],function(_0x5bc396){return{'name':_0x5bc396['fieldName'],'type':_0x5bc396[_0x838d('0x2d')][_0x838d('0x2e')]};});_0x2fe556[_0x838d('0x2f')]=_['map'](_0xc97a3d,_0x838d('0x27'));_0x2fe556[_0x838d('0x30')]=_[_0x838d('0x31')](_0x2d311f[_0x838d('0x30')]);_0x2fe556['filters']=_['intersection'](_0x2fe556['model'],_0x2fe556[_0x838d('0x30')]);_0x1cb83f[_0x838d('0x32')]=_[_0x838d('0x33')](_0x2fe556['model'],qs['fields'](_0x2d311f[_0x838d('0x30')][_0x838d('0x34')]));_0x1cb83f['attributes']=_0x1cb83f[_0x838d('0x32')][_0x838d('0x35')]?_0x1cb83f[_0x838d('0x32')]:_0x2fe556[_0x838d('0x2f')];if(!_0x2d311f['query'][_0x838d('0x36')](_0x838d('0x37'))){_0x1cb83f[_0x838d('0x1e')]=qs[_0x838d('0x1e')](_0x2d311f[_0x838d('0x30')]['limit']);_0x1cb83f[_0x838d('0x1c')]=qs[_0x838d('0x1c')](_0x2d311f[_0x838d('0x30')][_0x838d('0x1c')]);}_0x1cb83f[_0x838d('0x38')]=qs[_0x838d('0x39')](_0x2d311f[_0x838d('0x30')][_0x838d('0x39')]);_0x1cb83f['where']=qs[_0x838d('0x3a')](_['pick'](_0x2d311f[_0x838d('0x30')],_0x2fe556[_0x838d('0x3a')]),_0xc97a3d);if(_0x2d311f['query'][_0x838d('0x3b')]){_0x1cb83f[_0x838d('0x3c')]=_[_0x838d('0x3d')](_0x1cb83f[_0x838d('0x3c')],{'$or':_['map'](_0xc97a3d,function(_0x50fdbb){if(_0x50fdbb[_0x838d('0x2d')]!==_0x838d('0x3e')){var _0x1e58cf={};_0x1e58cf[_0x50fdbb['name']]={'$like':'%'+_0x2d311f['query']['filter']+'%'};return _0x1e58cf;}})});}_0x1cb83f=_[_0x838d('0x3d')]({},_0x1cb83f,_0x2d311f['options']);var _0xa1188={'where':_0x1cb83f[_0x838d('0x3c')]};return db[_0x838d('0x2b')][_0x838d('0x1f')](_0xa1188)[_0x838d('0x3f')](function(_0x5a2353){_0x5d1263[_0x838d('0x1f')]=_0x5a2353;if(_0x2d311f[_0x838d('0x30')][_0x838d('0x40')]){_0x1cb83f[_0x838d('0x41')]=[{'all':!![]}];}return db[_0x838d('0x2b')][_0x838d('0x42')](_0x1cb83f);})['then'](function(_0x417da8){_0x5d1263[_0x838d('0x43')]=_0x417da8;return _0x5d1263;})[_0x838d('0x3f')](respondWithFilteredResult(_0x5a5bcc,_0x1cb83f))['catch'](handleError(_0x5a5bcc,null));};exports[_0x838d('0x44')]=function(_0x1dbc38,_0x27341d){var _0x4fbb67={'raw':!![],'where':{'id':_0x1dbc38[_0x838d('0x45')]['id']}},_0x223c4f={};_0x223c4f[_0x838d('0x2f')]=_[_0x838d('0x31')](db[_0x838d('0x2b')][_0x838d('0x2c')]);_0x223c4f[_0x838d('0x30')]=_[_0x838d('0x31')](_0x1dbc38[_0x838d('0x30')]);_0x223c4f[_0x838d('0x3a')]=_[_0x838d('0x33')](_0x223c4f[_0x838d('0x2f')],_0x223c4f[_0x838d('0x30')]);_0x4fbb67[_0x838d('0x32')]=_[_0x838d('0x33')](_0x223c4f['model'],qs[_0x838d('0x34')](_0x1dbc38[_0x838d('0x30')][_0x838d('0x34')]));_0x4fbb67['attributes']=_0x4fbb67[_0x838d('0x32')]['length']?_0x4fbb67[_0x838d('0x32')]:_0x223c4f[_0x838d('0x2f')];if(_0x1dbc38[_0x838d('0x30')]['includeAll']){_0x4fbb67[_0x838d('0x41')]=[{'all':!![]}];}_0x4fbb67=_[_0x838d('0x3d')]({},_0x4fbb67,_0x1dbc38[_0x838d('0x46')]);return db[_0x838d('0x2b')][_0x838d('0x47')](_0x4fbb67)[_0x838d('0x3f')](handleEntityNotFound(_0x27341d,null))[_0x838d('0x3f')](respondWithResult(_0x27341d,null))[_0x838d('0x48')](handleError(_0x27341d,null));};exports[_0x838d('0x49')]=function(_0x5b7835,_0x98200a){return db['SalesforceField']['create'](_0x5b7835[_0x838d('0x4a')],{})[_0x838d('0x3f')](respondWithResult(_0x98200a,0xc9))[_0x838d('0x48')](handleError(_0x98200a,null));};exports[_0x838d('0x24')]=function(_0x2c59fd,_0x23ecc4){if(_0x2c59fd['body']['id']){delete _0x2c59fd[_0x838d('0x4a')]['id'];}return db[_0x838d('0x2b')]['find']({'where':{'id':_0x2c59fd[_0x838d('0x45')]['id']}})[_0x838d('0x3f')](handleEntityNotFound(_0x23ecc4,null))[_0x838d('0x3f')](saveUpdates(_0x2c59fd[_0x838d('0x4a')],null))[_0x838d('0x3f')](respondWithResult(_0x23ecc4,null))[_0x838d('0x48')](handleError(_0x23ecc4,null));};exports[_0x838d('0x4b')]=function(_0x428d60,_0xddfe60){return db[_0x838d('0x2b')][_0x838d('0x47')]({'where':{'id':_0x428d60[_0x838d('0x45')]['id']}})[_0x838d('0x3f')](handleEntityNotFound(_0xddfe60,null))[_0x838d('0x3f')](removeEntity(_0xddfe60,null))['catch'](handleError(_0xddfe60,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c16e95f..e8d18e9 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 _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 +var _0x32d6=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','moment','bluebird','request-promise','path'];(function(_0x2cfb9e,_0x21fcfd){var _0x5e76b5=function(_0x2362db){while(--_0x2362db){_0x2cfb9e['push'](_0x2cfb9e['shift']());}};_0x5e76b5(++_0x21fcfd);}(_0x32d6,0x1d7));var _0x632d=function(_0x35eb7c,_0xd39f5b){_0x35eb7c=_0x35eb7c-0x0;var _0x3b43ba=_0x32d6[_0x35eb7c];return _0x3b43ba;};'use strict';var _=require(_0x632d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x632d('0x1'));var BPromise=require(_0x632d('0x2'));var rp=require(_0x632d('0x3'));var fs=require('fs');var path=require(_0x632d('0x4'));var rimraf=require(_0x632d('0x5'));var config=require(_0x632d('0x6'));var attributes=require(_0x632d('0x7'));module[_0x632d('0x8')]=function(_0x334baf,_0x281245){return _0x334baf[_0x632d('0x9')](_0x632d('0xa'),attributes,{'tableName':_0x632d('0xb'),'paranoid':![],'indexes':[{'name':_0x632d('0xc'),'fields':[_0x632d('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index f6eba4f..d8d5466 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 _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 +var _0xf152=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0x1d60c0,_0x363996){var _0x169042=function(_0x4e29ba){while(--_0x4e29ba){_0x1d60c0['push'](_0x1d60c0['shift']());}};_0x169042(++_0x363996);}(_0xf152,0x7c));var _0x2f15=function(_0x508167,_0x2a24ec){_0x508167=_0x508167-0x0;var _0x5e7a78=_0xf152[_0x508167];return _0x5e7a78;};'use strict';var _=require(_0x2f15('0x0'));var util=require('util');var moment=require(_0x2f15('0x1'));var BPromise=require(_0x2f15('0x2'));var rs=require(_0x2f15('0x3'));var fs=require('fs');var Redis=require(_0x2f15('0x4'));var db=require(_0x2f15('0x5'))['db'];var utils=require(_0x2f15('0x6'));var logger=require(_0x2f15('0x7'))(_0x2f15('0x8'));var config=require(_0x2f15('0x9'));var jayson=require(_0x2f15('0xa'));var client=jayson[_0x2f15('0xb')][_0x2f15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e4a55,_0x5cb626,_0x38bccb){return new BPromise(function(_0x5c6ef4,_0x52eaab){return client[_0x2f15('0xd')](_0x2e4a55,_0x38bccb)[_0x2f15('0xe')](function(_0x22f5be){logger['info']('SalesforceField,\x20%s,\x20%s',_0x5cb626,'request\x20sent');logger['debug'](_0x2f15('0xf'),_0x5cb626,_0x2f15('0x10'),JSON[_0x2f15('0x11')](_0x22f5be));if(_0x22f5be[_0x2f15('0x12')]){if(_0x22f5be[_0x2f15('0x12')][_0x2f15('0x13')]===0x1f4){logger[_0x2f15('0x12')]('SalesforceField,\x20%s,\x20%s',_0x5cb626,_0x22f5be[_0x2f15('0x12')][_0x2f15('0x14')]);return _0x52eaab(_0x22f5be['error'][_0x2f15('0x14')]);}logger[_0x2f15('0x12')](_0x2f15('0x15'),_0x5cb626,_0x22f5be[_0x2f15('0x12')][_0x2f15('0x14')]);return _0x5c6ef4(_0x22f5be['error'][_0x2f15('0x14')]);}else{logger[_0x2f15('0x16')](_0x2f15('0x15'),_0x5cb626,_0x2f15('0x10'));_0x5c6ef4(_0x22f5be[_0x2f15('0x17')][_0x2f15('0x14')]);}})[_0x2f15('0x18')](function(_0x197d1a){logger[_0x2f15('0x12')](_0x2f15('0x15'),_0x5cb626,_0x197d1a);_0x52eaab(_0x197d1a);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 022bc8f..ce0e069 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 _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 +var _0x073e=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x4b8cc8,_0x316e38){var _0x15d14c=function(_0x1ccbe9){while(--_0x1ccbe9){_0x4b8cc8['push'](_0x4b8cc8['shift']());}};_0x15d14c(++_0x316e38);}(_0x073e,0x181));var _0xe073=function(_0x28dc29,_0x5addd8){_0x28dc29=_0x28dc29-0x0;var _0x5adba9=_0x073e[_0x28dc29];return _0x5adba9;};'use strict';var multer=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var path=require(_0xe073('0x2'));var timeout=require(_0xe073('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe073('0x4'));var interaction=require(_0xe073('0x5'));var config=require(_0xe073('0x6'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe073('0x7')]);router[_0xe073('0x8')](_0xe073('0x9'),auth[_0xe073('0xa')](),controller[_0xe073('0xb')]);router[_0xe073('0x8')]('/:id/configurations',auth[_0xe073('0xa')](),controller[_0xe073('0xc')]);router[_0xe073('0x8')](_0xe073('0xd'),auth['isAuthenticated'](),controller[_0xe073('0xe')]);router[_0xe073('0xf')]('/',auth[_0xe073('0xa')](),controller[_0xe073('0x10')]);router[_0xe073('0xf')](_0xe073('0x11'),auth['isAuthenticated'](),controller[_0xe073('0x12')]);router['put'](_0xe073('0x9'),auth['isAuthenticated'](),controller[_0xe073('0x13')]);router['delete'](_0xe073('0x9'),auth[_0xe073('0xa')](),controller[_0xe073('0x14')]);module[_0xe073('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 20b2ed1..4da8ae3 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 _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 +var _0x7c7d=['exports','STRING','remoteUri','sequelize'];(function(_0x41c1d7,_0x4d28fc){var _0x46244c=function(_0x41bd9c){while(--_0x41bd9c){_0x41c1d7['push'](_0x41c1d7['shift']());}};_0x46244c(++_0x4d28fc);}(_0x7c7d,0x113));var _0xd7c7=function(_0x574984,_0x569bd1){_0x574984=_0x574984-0x0;var _0x2ba85c=_0x7c7d[_0x574984];return _0x2ba85c;};'use strict';var Sequelize=require(_0xd7c7('0x0'));module[_0xd7c7('0x1')]={'name':{'type':Sequelize[_0xd7c7('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd7c7('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xd7c7('0x2')]},'email':{'type':Sequelize[_0xd7c7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd7c7('0x3')},'serverUrl':{'type':Sequelize[_0xd7c7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 3c8d2b0..874fbd4 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 _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 +var _0x0852=['set','Content-Range','apply','reject','update','then','error','name','send','map','ServicenowAccount','rawAttributes','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','notify','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','test','Wrong\x20credentials','statusCode','false','GET','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x1a521c,_0x3e2cf9){var _0x3cb2e4=function(_0x2d65dd){while(--_0x2d65dd){_0x1a521c['push'](_0x1a521c['shift']());}};_0x3cb2e4(++_0x3e2cf9);}(_0x0852,0x140));var _0x2085=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0852[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x2085('0x0'));var rimraf=require(_0x2085('0x1'));var zipdir=require(_0x2085('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2085('0x3'));var moment=require(_0x2085('0x4'));var BPromise=require(_0x2085('0x5'));var Mustache=require(_0x2085('0x6'));var util=require(_0x2085('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2085('0x8'));var ejs=require(_0x2085('0x9'));var fs=require('fs');var fs_extra=require(_0x2085('0xa'));var _=require(_0x2085('0xb'));var squel=require('squel');var crypto=require(_0x2085('0xc'));var jsforce=require(_0x2085('0xd'));var deskjs=require(_0x2085('0xe'));var toCsv=require(_0x2085('0x8'));var querystring=require(_0x2085('0xf'));var Papa=require(_0x2085('0x10'));var Redis=require(_0x2085('0x11'));var authService=require(_0x2085('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2085('0x13'));var hardwareService=require(_0x2085('0x14'));var logger=require(_0x2085('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2085('0x16'))['db'];var integrations=require(_0x2085('0x17'));function respondWithStatusCode(_0x14a95b,_0x235815){_0x235815=_0x235815||0xcc;return function(_0x789063){if(_0x789063){return _0x14a95b[_0x2085('0x18')](_0x235815);}return _0x14a95b[_0x2085('0x19')](_0x235815)[_0x2085('0x1a')]();};}function respondWithResult(_0x517b47,_0x4548bc){_0x4548bc=_0x4548bc||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0x517b47['status'](_0x4548bc)[_0x2085('0x1b')](_0x1c84d3);}};}function respondWithFilteredResult(_0x5e9bfd,_0x10fa0c){return function(_0x521031){if(_0x521031){var _0x397818=typeof _0x10fa0c[_0x2085('0x1c')]==='undefined'&&typeof _0x10fa0c['limit']===_0x2085('0x1d');var _0x51fc96=_0x521031['count'];var _0x362c9c=_0x397818?0x0:_0x10fa0c[_0x2085('0x1c')];var _0x1e2609=_0x397818?_0x521031[_0x2085('0x1e')]:_0x10fa0c[_0x2085('0x1c')]+_0x10fa0c[_0x2085('0x1f')];var _0x41d4a0;if(_0x1e2609>=_0x51fc96){_0x1e2609=_0x51fc96;_0x41d4a0=0xc8;}else{_0x41d4a0=0xce;}_0x5e9bfd[_0x2085('0x19')](_0x41d4a0);return _0x5e9bfd[_0x2085('0x20')](_0x2085('0x21'),_0x362c9c+'-'+_0x1e2609+'/'+_0x51fc96)[_0x2085('0x1b')](_0x521031);}return null;};}function patchUpdates(_0x520f95){return function(_0x5bd076){try{jsonpatch[_0x2085('0x22')](_0x5bd076,_0x520f95,!![]);}catch(_0xb7f83b){return BPromise[_0x2085('0x23')](_0xb7f83b);}return _0x5bd076['save']();};}function saveUpdates(_0x3a832b,_0x9b7e5a){return function(_0x921112){if(_0x921112){return _0x921112[_0x2085('0x24')](_0x3a832b)['then'](function(_0x3a387f){return _0x3a387f;});}return null;};}function removeEntity(_0x45d3be,_0x37dc63){return function(_0x535411){if(_0x535411){return _0x535411['destroy']()[_0x2085('0x25')](function(){_0x45d3be[_0x2085('0x19')](0xcc)[_0x2085('0x1a')]();});}};}function handleEntityNotFound(_0x5322d6,_0x385a53){return function(_0x43d510){if(!_0x43d510){_0x5322d6[_0x2085('0x18')](0x194);}return _0x43d510;};}function handleError(_0x41f523,_0x3b3380){_0x3b3380=_0x3b3380||0x1f4;return function(_0x529c87){logger[_0x2085('0x26')](_0x529c87['stack']);if(_0x529c87[_0x2085('0x27')]){delete _0x529c87[_0x2085('0x27')];}_0x41f523['status'](_0x3b3380)[_0x2085('0x28')](_0x529c87);};}exports['index']=function(_0x44b22c,_0x103f1f){var _0xf532fb={},_0x283f53={},_0x518b16={'count':0x0,'rows':[]};var _0x2f9c46=_[_0x2085('0x29')](db[_0x2085('0x2a')][_0x2085('0x2b')],function(_0x263a5d){return{'name':_0x263a5d['fieldName'],'type':_0x263a5d['type'][_0x2085('0x2c')]};});_0x283f53['model']=_[_0x2085('0x29')](_0x2f9c46,_0x2085('0x27'));_0x283f53[_0x2085('0x2d')]=_[_0x2085('0x2e')](_0x44b22c[_0x2085('0x2d')]);_0x283f53['filters']=_['intersection'](_0x283f53[_0x2085('0x2f')],_0x283f53[_0x2085('0x2d')]);_0xf532fb['attributes']=_[_0x2085('0x30')](_0x283f53[_0x2085('0x2f')],qs[_0x2085('0x31')](_0x44b22c[_0x2085('0x2d')][_0x2085('0x31')]));_0xf532fb[_0x2085('0x32')]=_0xf532fb['attributes'][_0x2085('0x33')]?_0xf532fb[_0x2085('0x32')]:_0x283f53[_0x2085('0x2f')];if(!_0x44b22c['query'][_0x2085('0x34')](_0x2085('0x35'))){_0xf532fb['limit']=qs[_0x2085('0x1f')](_0x44b22c[_0x2085('0x2d')][_0x2085('0x1f')]);_0xf532fb[_0x2085('0x1c')]=qs[_0x2085('0x1c')](_0x44b22c['query']['offset']);}_0xf532fb[_0x2085('0x36')]=qs[_0x2085('0x37')](_0x44b22c[_0x2085('0x2d')]['sort']);_0xf532fb[_0x2085('0x38')]=qs[_0x2085('0x39')](_[_0x2085('0x3a')](_0x44b22c[_0x2085('0x2d')],_0x283f53[_0x2085('0x39')]),_0x2f9c46);if(_0x44b22c[_0x2085('0x2d')]['filter']){_0xf532fb[_0x2085('0x38')]=_[_0x2085('0x3b')](_0xf532fb[_0x2085('0x38')],{'$or':_[_0x2085('0x29')](_0x2f9c46,function(_0x1bff34){if(_0x1bff34[_0x2085('0x3c')]!=='VIRTUAL'){var _0x155210={};_0x155210[_0x1bff34[_0x2085('0x27')]]={'$like':'%'+_0x44b22c['query'][_0x2085('0x3d')]+'%'};return _0x155210;}})});}_0xf532fb=_[_0x2085('0x3b')]({},_0xf532fb,_0x44b22c[_0x2085('0x3e')]);var _0xe788f9={'where':_0xf532fb[_0x2085('0x38')]};return db[_0x2085('0x2a')][_0x2085('0x1e')](_0xe788f9)[_0x2085('0x25')](function(_0x3f3cd8){_0x518b16['count']=_0x3f3cd8;if(_0x44b22c[_0x2085('0x2d')][_0x2085('0x3f')]){_0xf532fb[_0x2085('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x2085('0x41')](_0xf532fb);})[_0x2085('0x25')](function(_0xa0b3a9){_0x518b16[_0x2085('0x42')]=_0xa0b3a9;return _0x518b16;})[_0x2085('0x25')](respondWithFilteredResult(_0x103f1f,_0xf532fb))[_0x2085('0x43')](handleError(_0x103f1f,null));};exports[_0x2085('0x44')]=function(_0x34e678,_0x1c1395){var _0x4eff5b={'raw':![],'where':{'id':_0x34e678['params']['id']}},_0x299199={};_0x299199['model']=_[_0x2085('0x2e')](db['ServicenowAccount'][_0x2085('0x2b')]);_0x299199[_0x2085('0x2d')]=_[_0x2085('0x2e')](_0x34e678[_0x2085('0x2d')]);_0x299199[_0x2085('0x39')]=_[_0x2085('0x30')](_0x299199[_0x2085('0x2f')],_0x299199['query']);_0x4eff5b[_0x2085('0x32')]=_[_0x2085('0x30')](_0x299199[_0x2085('0x2f')],qs[_0x2085('0x31')](_0x34e678[_0x2085('0x2d')][_0x2085('0x31')]));_0x4eff5b[_0x2085('0x32')]=_0x4eff5b[_0x2085('0x32')][_0x2085('0x33')]?_0x4eff5b[_0x2085('0x32')]:_0x299199[_0x2085('0x2f')];if(_0x34e678[_0x2085('0x2d')][_0x2085('0x3f')]){_0x4eff5b[_0x2085('0x40')]=[{'all':!![]}];}_0x4eff5b=_[_0x2085('0x3b')]({},_0x4eff5b,_0x34e678[_0x2085('0x3e')]);return db[_0x2085('0x2a')]['find'](_0x4eff5b)[_0x2085('0x25')](handleEntityNotFound(_0x1c1395,null))[_0x2085('0x25')](respondWithResult(_0x1c1395,null))[_0x2085('0x43')](handleError(_0x1c1395,null));};exports[_0x2085('0x45')]=function(_0x5e68a1,_0x58cd99){return db[_0x2085('0x2a')][_0x2085('0x45')](_0x5e68a1[_0x2085('0x46')],{})[_0x2085('0x25')](respondWithResult(_0x58cd99,0xc9))['catch'](handleError(_0x58cd99,null));};exports[_0x2085('0x24')]=function(_0x1cd887,_0x24655e){if(_0x1cd887[_0x2085('0x46')]['id']){delete _0x1cd887['body']['id'];}return db['ServicenowAccount'][_0x2085('0x47')]({'where':{'id':_0x1cd887[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x24655e,null))[_0x2085('0x25')](saveUpdates(_0x1cd887[_0x2085('0x46')],null))['then'](respondWithResult(_0x24655e,null))[_0x2085('0x43')](handleError(_0x24655e,null));};exports[_0x2085('0x49')]=function(_0xd0d425,_0x74b88d){return db['ServicenowAccount'][_0x2085('0x47')]({'where':{'id':_0xd0d425[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x74b88d,null))[_0x2085('0x25')](removeEntity(_0x74b88d,null))[_0x2085('0x43')](handleError(_0x74b88d,null));};exports[_0x2085('0x4a')]=function(_0x141066,_0x1bc47c,_0xa449ad){var _0x74f898={};var _0x2e4098={};var _0x2b33d6;var _0x55cb67;return db[_0x2085('0x2a')][_0x2085('0x4b')]({'where':{'id':_0x141066[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x1bc47c,null))[_0x2085('0x25')](function(_0x48392b){if(_0x48392b){_0x2b33d6=_0x48392b;_0x2e4098[_0x2085('0x2f')]=_['keys'](db[_0x2085('0x4c')][_0x2085('0x2b')]);_0x2e4098['query']=_[_0x2085('0x2e')](_0x141066[_0x2085('0x2d')]);_0x2e4098[_0x2085('0x39')]=_[_0x2085('0x30')](_0x2e4098[_0x2085('0x2f')],_0x2e4098[_0x2085('0x2d')]);_0x74f898[_0x2085('0x32')]=_['intersection'](_0x2e4098[_0x2085('0x2f')],qs[_0x2085('0x31')](_0x141066[_0x2085('0x2d')][_0x2085('0x31')]));_0x74f898[_0x2085('0x32')]=_0x74f898[_0x2085('0x32')][_0x2085('0x33')]?_0x74f898[_0x2085('0x32')]:_0x2e4098['model'];_0x74f898[_0x2085('0x36')]=qs[_0x2085('0x37')](_0x141066['query'][_0x2085('0x37')]);_0x74f898[_0x2085('0x38')]=qs['filters'](_[_0x2085('0x3a')](_0x141066[_0x2085('0x2d')],_0x2e4098[_0x2085('0x39')]));if(_0x141066['query'][_0x2085('0x3d')]){_0x74f898[_0x2085('0x38')]=_[_0x2085('0x3b')](_0x74f898[_0x2085('0x38')],{'$or':_[_0x2085('0x29')](_0x74f898[_0x2085('0x32')],function(_0x4c2da9){var _0x23959a={};_0x23959a[_0x4c2da9]={'$like':'%'+_0x141066[_0x2085('0x2d')][_0x2085('0x3d')]+'%'};return _0x23959a;})});}_0x74f898=_['merge']({},_0x74f898,_0x141066[_0x2085('0x3e')]);return _0x2b33d6[_0x2085('0x4a')](_0x74f898);}})[_0x2085('0x25')](function(_0x4a56da){if(_0x4a56da){_0x55cb67=_0x4a56da[_0x2085('0x33')];if(!_0x141066[_0x2085('0x2d')]['hasOwnProperty']('nolimit')){_0x74f898[_0x2085('0x1f')]=qs[_0x2085('0x1f')](_0x141066[_0x2085('0x2d')][_0x2085('0x1f')]);_0x74f898[_0x2085('0x1c')]=qs['offset'](_0x141066[_0x2085('0x2d')]['offset']);}return _0x2b33d6[_0x2085('0x4a')](_0x74f898);}})[_0x2085('0x25')](function(_0x3c6881){if(_0x3c6881){return _0x3c6881?{'count':_0x55cb67,'rows':_0x3c6881}:null;}})['then'](respondWithResult(_0x1bc47c,null))[_0x2085('0x43')](handleError(_0x1bc47c,null));};exports[_0x2085('0x4d')]=function(_0x463cea,_0x48e08f,_0x2934f8){if(_0x463cea[_0x2085('0x46')]['id']){delete _0x463cea['body']['id'];}return db[_0x2085('0x2a')][_0x2085('0x4b')]({'where':{'id':_0x463cea[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x48e08f,null))['then'](function(_0x29f8a6){if(_0x29f8a6){_0x463cea[_0x2085('0x46')][_0x2085('0x4e')]=_0x29f8a6['id'];_0x463cea[_0x2085('0x46')][_0x2085('0x4f')]=integrations[_0x2085('0x50')](_0x463cea[_0x2085('0x46')][_0x2085('0x51')],_0x463cea[_0x2085('0x46')]['type']);_0x463cea[_0x2085('0x46')][_0x2085('0x52')]=integrations[_0x2085('0x53')](_0x463cea['body'][_0x2085('0x51')],_0x463cea[_0x2085('0x46')]['type']);return db[_0x2085('0x4c')][_0x2085('0x45')](_0x463cea['body'],{'include':[{'model':db[_0x2085('0x54')],'as':'Subjects'},{'model':db[_0x2085('0x54')],'as':_0x2085('0x52')}]});}return null;})[_0x2085('0x25')](respondWithResult(_0x48e08f,null))[_0x2085('0x43')](handleError(_0x48e08f,null));};exports['getFields']=function(_0x2532df,_0x323a34,_0x2e3b50){var _0x3a5409=[_0x2085('0x55'),_0x2085('0x56'),_0x2085('0x57'),'subcategory','close_code',_0x2085('0x58'),'incident_state','severity',_0x2085('0x59')];var _0x2650b3=[_0x2085('0x5a'),'made_sla','caused_by',_0x2085('0x5b'),_0x2085('0x5c'),_0x2085('0x5d'),_0x2085('0x5e'),_0x2085('0x56'),'approval_history',_0x2085('0x5f'),_0x2085('0x60'),_0x2085('0x61'),'opened_by','user_input',_0x2085('0x62'),_0x2085('0x63'),'state',_0x2085('0x64'),_0x2085('0x57'),_0x2085('0x36'),_0x2085('0x65'),_0x2085('0x66'),_0x2085('0x67'),'delivery_plan',_0x2085('0x68'),_0x2085('0x69'),_0x2085('0x6a'),_0x2085('0x6b'),_0x2085('0x6c'),_0x2085('0x6d'),'rfc',_0x2085('0x6e'),_0x2085('0x6f'),_0x2085('0x70'),_0x2085('0x71'),_0x2085('0x72'),_0x2085('0x73'),_0x2085('0x74'),_0x2085('0x75'),'caller_id',_0x2085('0x76'),_0x2085('0x77'),_0x2085('0x78'),_0x2085('0x79'),'close_code',_0x2085('0x7a'),_0x2085('0x7b'),'work_start','assignment_group',_0x2085('0x7c'),_0x2085('0x7d'),_0x2085('0x7e'),_0x2085('0x7f'),_0x2085('0x58'),'sys_class_name',_0x2085('0x80'),_0x2085('0x81'),'follow_up',_0x2085('0x82'),'sys_id',_0x2085('0x83'),_0x2085('0x84'),_0x2085('0x85'),_0x2085('0x86'),_0x2085('0x87'),'company','reassignment_count',_0x2085('0x88'),_0x2085('0x89'),_0x2085('0x8a'),_0x2085('0x8b'),'sla_due',_0x2085('0x8c'),_0x2085('0x8d'),_0x2085('0x8e'),_0x2085('0x8f'),_0x2085('0x90'),'sys_tags',_0x2085('0x91'),_0x2085('0x92'),'correlation_id',_0x2085('0x93'),_0x2085('0x59')];var _0x148cf1='';var _0x4968a5='';var _0x2ff7cd=[];var _0x4e3534='';var _0x58f179='';var _0x186814=[];var _0x5452cf='';var _0x1b9b6b='';var _0x54d5c4={};var _0x3c89ec='';return db[_0x2085('0x2a')][_0x2085('0x4b')]({'where':{'id':_0x2532df[_0x2085('0x48')]['id']},'attributes':['id','username',_0x2085('0x94'),_0x2085('0x95'),_0x2085('0x96'),'serverUrl']})[_0x2085('0x25')](handleEntityNotFound(_0x323a34,null))[_0x2085('0x25')](function(_0x2521c0){if(_0x2521c0){_0x3c89ec=_0x2521c0[_0x2085('0x96')];var _0x5e0c6f=_0x3c89ec[_0x2085('0x97')](-0x1);if(_0x5e0c6f==='/'){_0x3c89ec=_0x3c89ec[_0x2085('0x98')](0x0,_0x3c89ec[_0x2085('0x99')](_0x5e0c6f));}_0x1b9b6b=util[_0x2085('0x9a')](_0x2085('0x9b'),_0x3c89ec);_0x5452cf=util[_0x2085('0x9a')](_0x2085('0x9c'),_0x3c89ec);_0x54d5c4={'user':_0x2521c0[_0x2085('0x9d')],'pass':_0x2521c0[_0x2085('0x94')]};var _0x2e4966={'method':'GET','uri':_0x1b9b6b+'incident?sysparm_display_value=all','auth':_0x54d5c4,'json':!![]};return rp(_0x2e4966);}})[_0x2085('0x25')](function(_0x116c37){if(_0x116c37[_0x2085('0x9e')]['length']>0x0){_0x148cf1=_0x116c37[_0x2085('0x9e')];}console[_0x2085('0x9f')](_0x2085('0xa0'),_0x148cf1);_0x186814=[];_0x4968a5=Object[_0x2085('0xa1')]([],_0x148cf1);_[_0x2085('0xa2')](_0x4968a5,function(_0x2f7c27){return!_0x3a5409[_0x2085('0xa3')](_0x2f7c27['name']);});_0x4968a5[_0x2085('0xa4')](function(_0x2e0917){var _0x213549=createFieldObject(_0x5452cf,_0x54d5c4,_0x2e0917['internalType'],_0x2e0917[_0x2085('0x27')],_0x2e0917['label'],![]);_0x186814['push'](_0x213549);});return Promise[_0x2085('0xa5')](_0x186814);})['then'](function(_0x4f3ddd){_0x2ff7cd=_0x4f3ddd;_0x4e3534=Object[_0x2085('0xa1')]([],_0x148cf1);console['log']('TCL:\x20_object',_0x148cf1);_['remove'](_0x4e3534,function(_0x90880c){return _0x2650b3[_0x2085('0xa3')](_0x90880c[_0x2085('0x27')]);});console['log'](_0x2085('0xa6'),_0x4e3534);_0x186814=[];_0x4e3534[_0x2085('0xa4')](function(_0x24a4d1){var _0xa04661=createFieldObject(_0x5452cf,_0x54d5c4,_0x24a4d1[_0x2085('0xa7')],_0x24a4d1[_0x2085('0x27')],_0x24a4d1['label'],!![]);_0x186814[_0x2085('0xa8')](_0xa04661);});return Promise[_0x2085('0xa5')](_0x186814);})[_0x2085('0x25')](function(_0x2dd64d){_0x58f179=_0x2dd64d;var _0x2697e1=_0x2ff7cd['concat'](_0x58f179);return{'count':_0x2697e1[_0x2085('0x33')],'rows':_0x2697e1};})[_0x2085('0x25')](respondWithResult(_0x323a34,null))['catch'](function(_0x5ad2de){console[_0x2085('0x9f')]('ServiceNow\x20error:\x20'+_0x5ad2de);var _0x4600d7=_0x2532df[_0x2085('0x2d')][_0x2085('0xa9')]?0x1f4:_0x5ad2de['statusCode']||0x1f4;logger[_0x2085('0x26')](_0x5ad2de['stack']);delete _0x5ad2de[_0x2085('0x27')];if(_0x4600d7===0x191){_0x4600d7=0x190;}_0x323a34[_0x2085('0x19')](_0x4600d7)['send'](_0x2532df['query'][_0x2085('0xa9')]?{'message':_0x2085('0xaa'),'statusCode':_0x5ad2de[_0x2085('0xab')]}:_0x5ad2de);});};function createFieldObject(_0x1400c9,_0xb8c392,_0x14b956,_0xe1acca,_0x5ac72c,_0x43c0cf){return new Promise(function(_0x43f946,_0x57b99e){var _0x3547ee={'id':_0xe1acca,'name':_0x5ac72c,'custom':_0x43c0cf};if(_0x14b956==='boolean'){_0x3547ee['options']=[{'name':'True','value':'true'},{'name':'False','value':_0x2085('0xac')}];_0x43f946(_0x3547ee);}else{var _0x39debc={'method':_0x2085('0xad'),'uri':_0x1400c9+_0x2085('0xae')+_0xe1acca,'auth':_0xb8c392,'json':!![]};return rp(_0x39debc)[_0x2085('0x25')](function(_0xe8f135){var _0x3562ae=[];if(_0xe8f135['result']['length']>0x0){_0xe8f135[_0x2085('0x9e')][_0x2085('0xa4')](function(_0x5485d0){if(_0x5485d0['inactive']===_0x2085('0xac')){var _0x30cb7c={'name':_0x5485d0['label'],'value':_0x5485d0[_0x2085('0xaf')]};_0x3562ae[_0x2085('0xa8')](_0x30cb7c);}});}_0x3547ee['options']=_0x3562ae;if(_0x3547ee[_0x2085('0x3e')][_0x2085('0x33')]>0x0){_0x43f946(_0x3547ee);}else{if(_0x43c0cf==![]){_0x43f946();}else{_0x43f946(_0x3547ee);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index efd3408..ffd4353 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 _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 +var _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x455907,_0x1452a6){var _0x25b30b=function(_0x5e4a93){while(--_0x5e4a93){_0x455907['push'](_0x455907['shift']());}};_0x25b30b(++_0x1452a6);}(_0xb138,0x1dd));var _0x8b13=function(_0xd30b00,_0x168daa){_0xd30b00=_0xd30b00-0x0;var _0x1dc8fa=_0xb138[_0xd30b00];return _0x1dc8fa;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'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 20d4bd1..e72c498 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 _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 +var _0x5b76=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','ServicenowAccount,\x20%s,\x20%s','result','catch','ServicenowAccount','options','where','attributes','limit','map','include','model','GetServicenowAccount','stringify','ShowServicenowAccount','raw','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x22dd17,_0x56d249){var _0x517196=function(_0xdb7874){while(--_0xdb7874){_0x22dd17['push'](_0x22dd17['shift']());}};_0x517196(++_0x56d249);}(_0x5b76,0xba));var _0x65b7=function(_0x1dcc42,_0x2d45c6){_0x1dcc42=_0x1dcc42-0x0;var _0x5804d4=_0x5b76[_0x1dcc42];return _0x5804d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x65b7('0x0'));var BPromise=require(_0x65b7('0x1'));var rs=require(_0x65b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x65b7('0x4'))(_0x65b7('0x5'));var config=require(_0x65b7('0x6'));var jayson=require(_0x65b7('0x7'));var client=jayson[_0x65b7('0x8')][_0x65b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1eae42,_0x1f46a1,_0x4f223f){return new BPromise(function(_0x5298a6,_0x3da72a){return client['request'](_0x1eae42,_0x4f223f)[_0x65b7('0xa')](function(_0x152fa4){logger[_0x65b7('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x1f46a1,_0x65b7('0xc'));logger[_0x65b7('0xd')](_0x65b7('0xe'),_0x1f46a1,_0x65b7('0xc'),JSON['stringify'](_0x152fa4));if(_0x152fa4[_0x65b7('0xf')]){if(_0x152fa4['error']['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1f46a1,_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);return _0x3da72a(_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);}logger[_0x65b7('0xf')](_0x65b7('0x11'),_0x1f46a1,_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);return _0x5298a6(_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);}else{logger[_0x65b7('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x1f46a1,_0x65b7('0xc'));_0x5298a6(_0x152fa4[_0x65b7('0x12')][_0x65b7('0x10')]);}})[_0x65b7('0x13')](function(_0x2969b0){logger[_0x65b7('0xf')](_0x65b7('0x11'),_0x1f46a1,_0x2969b0);_0x3da72a(_0x2969b0);});});}exports['GetServicenowAccount']=function(_0x31a5d7){var _0x43e67f=this;return new Promise(function(_0x3fbb10,_0x20338e){return db[_0x65b7('0x14')]['findAll']({'raw':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7[_0x65b7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7[_0x65b7('0x15')][_0x65b7('0x16')]||null:null,'attributes':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7['options'][_0x65b7('0x17')]||null:null,'limit':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7[_0x65b7('0x15')][_0x65b7('0x18')]||null:null,'include':_0x31a5d7['options']?_0x31a5d7[_0x65b7('0x15')]['include']?_[_0x65b7('0x19')](_0x31a5d7[_0x65b7('0x15')][_0x65b7('0x1a')],function(_0x4ba7fc){return{'model':db[_0x4ba7fc[_0x65b7('0x1b')]],'as':_0x4ba7fc['as'],'attributes':_0x4ba7fc['attributes'],'include':_0x4ba7fc['include']?_[_0x65b7('0x19')](_0x4ba7fc[_0x65b7('0x1a')],function(_0x3fae32){return{'model':db[_0x3fae32[_0x65b7('0x1b')]],'as':_0x3fae32['as'],'attributes':_0x3fae32[_0x65b7('0x17')],'include':_0x3fae32[_0x65b7('0x1a')]?_['map'](_0x3fae32[_0x65b7('0x1a')],function(_0x2498a7){return{'model':db[_0x2498a7[_0x65b7('0x1b')]],'as':_0x2498a7['as'],'attributes':_0x2498a7[_0x65b7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x65b7('0xa')](function(_0x3ac4c5){logger['info']('GetServicenowAccount',_0x31a5d7);logger[_0x65b7('0xd')](_0x65b7('0x1c'),_0x31a5d7,JSON[_0x65b7('0x1d')](_0x3ac4c5));_0x3fbb10(_0x3ac4c5);})[_0x65b7('0x13')](function(_0x14ab1e){logger[_0x65b7('0xf')](_0x65b7('0x1c'),_0x14ab1e[_0x65b7('0x10')],_0x31a5d7);_0x20338e(_0x43e67f['error'](0x1f4,_0x14ab1e[_0x65b7('0x10')]));});});};exports[_0x65b7('0x1e')]=function(_0x3696ba){var _0x43099b=this;return new Promise(function(_0x550e44,_0x45bf8c){return db[_0x65b7('0x14')]['find']({'raw':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x1f')]===undefined?!![]:![]:!![],'where':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x16')]||null:null,'attributes':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x17')]||null:null,'include':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x1a')]?_[_0x65b7('0x19')](_0x3696ba[_0x65b7('0x15')][_0x65b7('0x1a')],function(_0xc1467f){return{'model':db[_0xc1467f['model']],'as':_0xc1467f['as'],'attributes':_0xc1467f['attributes'],'include':_0xc1467f[_0x65b7('0x1a')]?_[_0x65b7('0x19')](_0xc1467f[_0x65b7('0x1a')],function(_0x2596ed){return{'model':db[_0x2596ed[_0x65b7('0x1b')]],'as':_0x2596ed['as'],'attributes':_0x2596ed['attributes'],'include':_0x2596ed[_0x65b7('0x1a')]?_[_0x65b7('0x19')](_0x2596ed[_0x65b7('0x1a')],function(_0x3f90c0){return{'model':db[_0x3f90c0[_0x65b7('0x1b')]],'as':_0x3f90c0['as'],'attributes':_0x3f90c0[_0x65b7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x65b7('0xa')](function(_0x1aef39){logger[_0x65b7('0xb')](_0x65b7('0x1e'),_0x3696ba);logger[_0x65b7('0xd')](_0x65b7('0x1e'),_0x3696ba,JSON[_0x65b7('0x1d')](_0x1aef39));_0x550e44(_0x1aef39);})[_0x65b7('0x13')](function(_0x2bb52d){logger['error']('ShowServicenowAccount',_0x2bb52d[_0x65b7('0x10')],_0x3696ba);_0x45bf8c(_0x43099b['error'](0x1f4,_0x2bb52d[_0x65b7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e912a5d..a8ed5a0 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 _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 +var _0x66cb=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','delete','/:id','destroy','exports','multer'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x66cb,0xbc));var _0xb66c=function(_0x2234cb,_0x3539cb){_0x2234cb=_0x2234cb-0x0;var _0x577c8b=_0x66cb[_0x2234cb];return _0x577c8b;};'use strict';var multer=require(_0xb66c('0x0'));var util=require('util');var path=require(_0xb66c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb66c('0x2')]();var fs_extra=require(_0xb66c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb66c('0x4'));var config=require(_0xb66c('0x5'));var controller=require(_0xb66c('0x6'));router[_0xb66c('0x7')]('/',auth[_0xb66c('0x8')](),controller[_0xb66c('0x9')]);router['get']('/:id',auth[_0xb66c('0x8')](),controller[_0xb66c('0xa')]);router[_0xb66c('0x7')](_0xb66c('0xb'),auth[_0xb66c('0x8')](),controller[_0xb66c('0xc')]);router[_0xb66c('0x7')]('/:id/subjects',auth[_0xb66c('0x8')](),controller[_0xb66c('0xd')]);router[_0xb66c('0x7')](_0xb66c('0xe'),auth[_0xb66c('0x8')](),controller['getDescriptions']);router[_0xb66c('0xf')]('/',auth[_0xb66c('0x8')](),controller[_0xb66c('0x10')]);router['put']('/:id',auth[_0xb66c('0x8')](),controller['update']);router[_0xb66c('0x11')](_0xb66c('0x12'),auth[_0xb66c('0x8')](),controller[_0xb66c('0x13')]);module[_0xb66c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 45374c0..97d251a 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 _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 +var _0xd472=['sequelize'];(function(_0xb7e3dc,_0x1ab66e){var _0x3dfa0b=function(_0x268574){while(--_0x268574){_0xb7e3dc['push'](_0xb7e3dc['shift']());}};_0x3dfa0b(++_0x1ab66e);}(_0xd472,0x190));var _0x2d47=function(_0x22d926,_0x5c9e32){_0x22d926=_0x22d926-0x0;var _0x369030=_0xd472[_0x22d926];return _0x369030;};'use strict';var Sequelize=require(_0x2d47('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 34d69a0..e670972 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 _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 +var _0x21ee=['Content-Range','json','reject','save','destroy','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','then','include','findAll','catch','show','params','keys','intersection','includeAll','options','create','body','find','getFields','findOne','filter','hasOwnProperty','getSubjects','ServicenowField','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x136026,_0x16ce48){var _0x55a090=function(_0x1c21c8){while(--_0x1c21c8){_0x136026['push'](_0x136026['shift']());}};_0x55a090(++_0x16ce48);}(_0x21ee,0xd1));var _0xe21e=function(_0x54f9ea,_0x13912f){_0x54f9ea=_0x54f9ea-0x0;var _0x590a38=_0x21ee[_0x54f9ea];return _0x590a38;};'use strict';var emlformat=require(_0xe21e('0x0'));var rimraf=require(_0xe21e('0x1'));var zipdir=require(_0xe21e('0x2'));var jsonpatch=require(_0xe21e('0x3'));var rp=require(_0xe21e('0x4'));var moment=require(_0xe21e('0x5'));var BPromise=require(_0xe21e('0x6'));var Mustache=require(_0xe21e('0x7'));var util=require(_0xe21e('0x8'));var path=require(_0xe21e('0x9'));var sox=require('sox');var csv=require(_0xe21e('0xa'));var ejs=require(_0xe21e('0xb'));var fs=require('fs');var fs_extra=require(_0xe21e('0xc'));var _=require(_0xe21e('0xd'));var squel=require(_0xe21e('0xe'));var crypto=require('crypto');var jsforce=require(_0xe21e('0xf'));var deskjs=require(_0xe21e('0x10'));var toCsv=require(_0xe21e('0xa'));var querystring=require(_0xe21e('0x11'));var Papa=require(_0xe21e('0x12'));var Redis=require(_0xe21e('0x13'));var authService=require(_0xe21e('0x14'));var qs=require(_0xe21e('0x15'));var as=require(_0xe21e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe21e('0x17'))(_0xe21e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe21e('0x19'))['db'];function respondWithStatusCode(_0xad1709,_0x5131c7){_0x5131c7=_0x5131c7||0xcc;return function(_0x1b24b3){if(_0x1b24b3){return _0xad1709[_0xe21e('0x1a')](_0x5131c7);}return _0xad1709[_0xe21e('0x1b')](_0x5131c7)[_0xe21e('0x1c')]();};}function respondWithResult(_0xa8f34f,_0x573df1){_0x573df1=_0x573df1||0xc8;return function(_0xa70403){if(_0xa70403){return _0xa8f34f[_0xe21e('0x1b')](_0x573df1)['json'](_0xa70403);}};}function respondWithFilteredResult(_0x4bc152,_0x23f766){return function(_0x75e74d){if(_0x75e74d){var _0x353ce0=typeof _0x23f766[_0xe21e('0x1d')]===_0xe21e('0x1e')&&typeof _0x23f766[_0xe21e('0x1f')]==='undefined';var _0x46829e=_0x75e74d[_0xe21e('0x20')];var _0x123805=_0x353ce0?0x0:_0x23f766[_0xe21e('0x1d')];var _0x469c9b=_0x353ce0?_0x75e74d['count']:_0x23f766[_0xe21e('0x1d')]+_0x23f766['limit'];var _0xc9f154;if(_0x469c9b>=_0x46829e){_0x469c9b=_0x46829e;_0xc9f154=0xc8;}else{_0xc9f154=0xce;}_0x4bc152[_0xe21e('0x1b')](_0xc9f154);return _0x4bc152[_0xe21e('0x21')](_0xe21e('0x22'),_0x123805+'-'+_0x469c9b+'/'+_0x46829e)[_0xe21e('0x23')](_0x75e74d);}return null;};}function patchUpdates(_0x6d1522){return function(_0x45ceec){try{jsonpatch['apply'](_0x45ceec,_0x6d1522,!![]);}catch(_0x2575b4){return BPromise[_0xe21e('0x24')](_0x2575b4);}return _0x45ceec[_0xe21e('0x25')]();};}function saveUpdates(_0x562e27,_0x5e9962){return function(_0x29aeab){if(_0x29aeab){return _0x29aeab['update'](_0x562e27)['then'](function(_0x34d1ad){return _0x34d1ad;});}return null;};}function removeEntity(_0x9f058e,_0xdf0daa){return function(_0x4dab17){if(_0x4dab17){return _0x4dab17[_0xe21e('0x26')]()['then'](function(){_0x9f058e[_0xe21e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557061,_0x25ece1){return function(_0x3f2c99){if(!_0x3f2c99){_0x557061['sendStatus'](0x194);}return _0x3f2c99;};}function handleError(_0x1569e8,_0x2bd460){_0x2bd460=_0x2bd460||0x1f4;return function(_0x1736ce){logger[_0xe21e('0x27')](_0x1736ce[_0xe21e('0x28')]);if(_0x1736ce[_0xe21e('0x29')]){delete _0x1736ce[_0xe21e('0x29')];}_0x1569e8[_0xe21e('0x1b')](_0x2bd460)['send'](_0x1736ce);};}exports[_0xe21e('0x2a')]=function(_0x49c015,_0x55a055){var _0x19171b={},_0x3a05a7={},_0x5c454d={'count':0x0,'rows':[]};var _0x5e78b9=_[_0xe21e('0x2b')](db[_0xe21e('0x2c')][_0xe21e('0x2d')],function(_0x562229){return{'name':_0x562229[_0xe21e('0x2e')],'type':_0x562229[_0xe21e('0x2f')]['key']};});_0x3a05a7[_0xe21e('0x30')]=_[_0xe21e('0x2b')](_0x5e78b9,_0xe21e('0x29'));_0x3a05a7[_0xe21e('0x31')]=_['keys'](_0x49c015[_0xe21e('0x31')]);_0x3a05a7[_0xe21e('0x32')]=_['intersection'](_0x3a05a7[_0xe21e('0x30')],_0x3a05a7['query']);_0x19171b[_0xe21e('0x33')]=_['intersection'](_0x3a05a7[_0xe21e('0x30')],qs[_0xe21e('0x34')](_0x49c015[_0xe21e('0x31')][_0xe21e('0x34')]));_0x19171b[_0xe21e('0x33')]=_0x19171b[_0xe21e('0x33')][_0xe21e('0x35')]?_0x19171b['attributes']:_0x3a05a7[_0xe21e('0x30')];if(!_0x49c015['query']['hasOwnProperty'](_0xe21e('0x36'))){_0x19171b[_0xe21e('0x1f')]=qs[_0xe21e('0x1f')](_0x49c015[_0xe21e('0x31')][_0xe21e('0x1f')]);_0x19171b['offset']=qs[_0xe21e('0x1d')](_0x49c015[_0xe21e('0x31')][_0xe21e('0x1d')]);}_0x19171b['order']=qs[_0xe21e('0x37')](_0x49c015['query']['sort']);_0x19171b[_0xe21e('0x38')]=qs['filters'](_[_0xe21e('0x39')](_0x49c015[_0xe21e('0x31')],_0x3a05a7[_0xe21e('0x32')]),_0x5e78b9);if(_0x49c015[_0xe21e('0x31')]['filter']){_0x19171b[_0xe21e('0x38')]=_[_0xe21e('0x3a')](_0x19171b['where'],{'$or':_[_0xe21e('0x2b')](_0x5e78b9,function(_0x256c02){if(_0x256c02[_0xe21e('0x2f')]!==_0xe21e('0x3b')){var _0x1933b6={};_0x1933b6[_0x256c02[_0xe21e('0x29')]]={'$like':'%'+_0x49c015['query']['filter']+'%'};return _0x1933b6;}})});}_0x19171b=_[_0xe21e('0x3a')]({},_0x19171b,_0x49c015['options']);var _0x2efceb={'where':_0x19171b[_0xe21e('0x38')]};return db[_0xe21e('0x2c')][_0xe21e('0x20')](_0x2efceb)[_0xe21e('0x3c')](function(_0x382f9e){_0x5c454d[_0xe21e('0x20')]=_0x382f9e;if(_0x49c015['query']['includeAll']){_0x19171b[_0xe21e('0x3d')]=[{'all':!![]}];}return db[_0xe21e('0x2c')][_0xe21e('0x3e')](_0x19171b);})[_0xe21e('0x3c')](function(_0x59b57d){_0x5c454d['rows']=_0x59b57d;return _0x5c454d;})[_0xe21e('0x3c')](respondWithFilteredResult(_0x55a055,_0x19171b))[_0xe21e('0x3f')](handleError(_0x55a055,null));};exports[_0xe21e('0x40')]=function(_0x3c27aa,_0x55f620){var _0x2a17f4={'raw':![],'where':{'id':_0x3c27aa[_0xe21e('0x41')]['id']}},_0x1fbab7={};_0x1fbab7[_0xe21e('0x30')]=_[_0xe21e('0x42')](db[_0xe21e('0x2c')][_0xe21e('0x2d')]);_0x1fbab7[_0xe21e('0x31')]=_[_0xe21e('0x42')](_0x3c27aa['query']);_0x1fbab7['filters']=_[_0xe21e('0x43')](_0x1fbab7[_0xe21e('0x30')],_0x1fbab7[_0xe21e('0x31')]);_0x2a17f4[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x1fbab7[_0xe21e('0x30')],qs[_0xe21e('0x34')](_0x3c27aa[_0xe21e('0x31')][_0xe21e('0x34')]));_0x2a17f4[_0xe21e('0x33')]=_0x2a17f4[_0xe21e('0x33')]['length']?_0x2a17f4[_0xe21e('0x33')]:_0x1fbab7[_0xe21e('0x30')];if(_0x3c27aa['query'][_0xe21e('0x44')]){_0x2a17f4['include']=[{'all':!![]}];}_0x2a17f4=_[_0xe21e('0x3a')]({},_0x2a17f4,_0x3c27aa[_0xe21e('0x45')]);return db[_0xe21e('0x2c')]['find'](_0x2a17f4)[_0xe21e('0x3c')](handleEntityNotFound(_0x55f620,null))[_0xe21e('0x3c')](respondWithResult(_0x55f620,null))[_0xe21e('0x3f')](handleError(_0x55f620,null));};exports[_0xe21e('0x46')]=function(_0x2c4640,_0x4bda7){return db[_0xe21e('0x2c')][_0xe21e('0x46')](_0x2c4640[_0xe21e('0x47')],{})[_0xe21e('0x3c')](respondWithResult(_0x4bda7,0xc9))[_0xe21e('0x3f')](handleError(_0x4bda7,null));};exports['update']=function(_0x83225d,_0x5758d2){if(_0x83225d[_0xe21e('0x47')]['id']){delete _0x83225d[_0xe21e('0x47')]['id'];}return db[_0xe21e('0x2c')][_0xe21e('0x48')]({'where':{'id':_0x83225d[_0xe21e('0x41')]['id']}})[_0xe21e('0x3c')](handleEntityNotFound(_0x5758d2,null))['then'](saveUpdates(_0x83225d[_0xe21e('0x47')],null))[_0xe21e('0x3c')](respondWithResult(_0x5758d2,null))[_0xe21e('0x3f')](handleError(_0x5758d2,null));};exports['destroy']=function(_0x98fd0b,_0x59b2c8){return db[_0xe21e('0x2c')][_0xe21e('0x48')]({'where':{'id':_0x98fd0b['params']['id']}})[_0xe21e('0x3c')](handleEntityNotFound(_0x59b2c8,null))[_0xe21e('0x3c')](removeEntity(_0x59b2c8,null))[_0xe21e('0x3f')](handleError(_0x59b2c8,null));};exports[_0xe21e('0x49')]=function(_0x3f3f6d,_0x5b9d31,_0x626227){var _0x2fafbb={};var _0x1eaa12={};var _0x2f8045;var _0x416ff9;return db['ServicenowConfiguration'][_0xe21e('0x4a')]({'where':{'id':_0x3f3f6d['params']['id']}})['then'](handleEntityNotFound(_0x5b9d31,null))['then'](function(_0x4b4d35){if(_0x4b4d35){_0x2f8045=_0x4b4d35;_0x1eaa12[_0xe21e('0x30')]=_[_0xe21e('0x42')](db['ServicenowField'][_0xe21e('0x2d')]);_0x1eaa12[_0xe21e('0x31')]=_['keys'](_0x3f3f6d[_0xe21e('0x31')]);_0x1eaa12[_0xe21e('0x32')]=_[_0xe21e('0x43')](_0x1eaa12[_0xe21e('0x30')],_0x1eaa12[_0xe21e('0x31')]);_0x2fafbb[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x1eaa12['model'],qs['fields'](_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x34')]));_0x2fafbb[_0xe21e('0x33')]=_0x2fafbb[_0xe21e('0x33')][_0xe21e('0x35')]?_0x2fafbb[_0xe21e('0x33')]:_0x1eaa12['model'];_0x2fafbb['order']=qs[_0xe21e('0x37')](_0x3f3f6d[_0xe21e('0x31')]['sort']);_0x2fafbb[_0xe21e('0x38')]=qs[_0xe21e('0x32')](_[_0xe21e('0x39')](_0x3f3f6d['query'],_0x1eaa12['filters']));if(_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x4b')]){_0x2fafbb['where']=_['merge'](_0x2fafbb['where'],{'$or':_[_0xe21e('0x2b')](_0x2fafbb['attributes'],function(_0x3ec815){var _0x2762f3={};_0x2762f3[_0x3ec815]={'$like':'%'+_0x3f3f6d[_0xe21e('0x31')]['filter']+'%'};return _0x2762f3;})});}_0x2fafbb=_[_0xe21e('0x3a')]({},_0x2fafbb,_0x3f3f6d[_0xe21e('0x45')]);return _0x2f8045[_0xe21e('0x49')](_0x2fafbb);}})['then'](function(_0x5131eb){if(_0x5131eb){_0x416ff9=_0x5131eb[_0xe21e('0x35')];if(!_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x4c')](_0xe21e('0x36'))){_0x2fafbb[_0xe21e('0x1f')]=qs[_0xe21e('0x1f')](_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x1f')]);_0x2fafbb[_0xe21e('0x1d')]=qs[_0xe21e('0x1d')](_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x1d')]);}return _0x2f8045[_0xe21e('0x49')](_0x2fafbb);}})[_0xe21e('0x3c')](function(_0x43d2f5){if(_0x43d2f5){return _0x43d2f5?{'count':_0x416ff9,'rows':_0x43d2f5}:null;}})[_0xe21e('0x3c')](respondWithResult(_0x5b9d31,null))[_0xe21e('0x3f')](handleError(_0x5b9d31,null));};exports['getSubjects']=function(_0x3c1bf8,_0x2acaaa,_0x1c0291){var _0x5f808a={};var _0x3a252e={};var _0x5da4c7;var _0x5b7dd9;return db[_0xe21e('0x2c')][_0xe21e('0x4a')]({'where':{'id':_0x3c1bf8[_0xe21e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2acaaa,null))[_0xe21e('0x3c')](function(_0x8740d4){if(_0x8740d4){_0x5da4c7=_0x8740d4;_0x3a252e['model']=_[_0xe21e('0x42')](db['ServicenowField'][_0xe21e('0x2d')]);_0x3a252e['query']=_[_0xe21e('0x42')](_0x3c1bf8[_0xe21e('0x31')]);_0x3a252e[_0xe21e('0x32')]=_[_0xe21e('0x43')](_0x3a252e[_0xe21e('0x30')],_0x3a252e[_0xe21e('0x31')]);_0x5f808a[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x3a252e[_0xe21e('0x30')],qs['fields'](_0x3c1bf8['query']['fields']));_0x5f808a[_0xe21e('0x33')]=_0x5f808a[_0xe21e('0x33')][_0xe21e('0x35')]?_0x5f808a['attributes']:_0x3a252e[_0xe21e('0x30')];_0x5f808a['order']=qs[_0xe21e('0x37')](_0x3c1bf8[_0xe21e('0x31')][_0xe21e('0x37')]);_0x5f808a[_0xe21e('0x38')]=qs[_0xe21e('0x32')](_['pick'](_0x3c1bf8[_0xe21e('0x31')],_0x3a252e['filters']));if(_0x3c1bf8['query'][_0xe21e('0x4b')]){_0x5f808a[_0xe21e('0x38')]=_['merge'](_0x5f808a[_0xe21e('0x38')],{'$or':_[_0xe21e('0x2b')](_0x5f808a[_0xe21e('0x33')],function(_0x51c38a){var _0x4c5f78={};_0x4c5f78[_0x51c38a]={'$like':'%'+_0x3c1bf8[_0xe21e('0x31')]['filter']+'%'};return _0x4c5f78;})});}_0x5f808a=_[_0xe21e('0x3a')]({},_0x5f808a,_0x3c1bf8[_0xe21e('0x45')]);return _0x5da4c7['getSubjects'](_0x5f808a);}})['then'](function(_0x3eab10){if(_0x3eab10){_0x5b7dd9=_0x3eab10['length'];if(!_0x3c1bf8['query'][_0xe21e('0x4c')](_0xe21e('0x36'))){_0x5f808a[_0xe21e('0x1f')]=qs[_0xe21e('0x1f')](_0x3c1bf8['query'][_0xe21e('0x1f')]);_0x5f808a['offset']=qs[_0xe21e('0x1d')](_0x3c1bf8[_0xe21e('0x31')][_0xe21e('0x1d')]);}return _0x5da4c7[_0xe21e('0x4d')](_0x5f808a);}})[_0xe21e('0x3c')](function(_0xc88018){if(_0xc88018){return _0xc88018?{'count':_0x5b7dd9,'rows':_0xc88018}:null;}})[_0xe21e('0x3c')](respondWithResult(_0x2acaaa,null))['catch'](handleError(_0x2acaaa,null));};exports['getDescriptions']=function(_0x4a862e,_0xd1e5ae,_0x2338b7){var _0x147a17={};var _0x159625={};var _0x27ec34;var _0x27113a;return db[_0xe21e('0x2c')][_0xe21e('0x4a')]({'where':{'id':_0x4a862e[_0xe21e('0x41')]['id']}})[_0xe21e('0x3c')](handleEntityNotFound(_0xd1e5ae,null))[_0xe21e('0x3c')](function(_0x68b043){if(_0x68b043){_0x27ec34=_0x68b043;_0x159625[_0xe21e('0x30')]=_[_0xe21e('0x42')](db[_0xe21e('0x4e')][_0xe21e('0x2d')]);_0x159625[_0xe21e('0x31')]=_[_0xe21e('0x42')](_0x4a862e['query']);_0x159625[_0xe21e('0x32')]=_[_0xe21e('0x43')](_0x159625['model'],_0x159625[_0xe21e('0x31')]);_0x147a17[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x159625[_0xe21e('0x30')],qs[_0xe21e('0x34')](_0x4a862e[_0xe21e('0x31')][_0xe21e('0x34')]));_0x147a17[_0xe21e('0x33')]=_0x147a17[_0xe21e('0x33')][_0xe21e('0x35')]?_0x147a17['attributes']:_0x159625['model'];_0x147a17[_0xe21e('0x4f')]=qs[_0xe21e('0x37')](_0x4a862e[_0xe21e('0x31')]['sort']);_0x147a17[_0xe21e('0x38')]=qs['filters'](_[_0xe21e('0x39')](_0x4a862e[_0xe21e('0x31')],_0x159625[_0xe21e('0x32')]));if(_0x4a862e['query'][_0xe21e('0x4b')]){_0x147a17['where']=_['merge'](_0x147a17[_0xe21e('0x38')],{'$or':_['map'](_0x147a17[_0xe21e('0x33')],function(_0x26be0f){var _0x13efa9={};_0x13efa9[_0x26be0f]={'$like':'%'+_0x4a862e[_0xe21e('0x31')][_0xe21e('0x4b')]+'%'};return _0x13efa9;})});}_0x147a17=_[_0xe21e('0x3a')]({},_0x147a17,_0x4a862e[_0xe21e('0x45')]);return _0x27ec34['getDescriptions'](_0x147a17);}})['then'](function(_0x2759bf){if(_0x2759bf){_0x27113a=_0x2759bf['length'];if(!_0x4a862e[_0xe21e('0x31')][_0xe21e('0x4c')](_0xe21e('0x36'))){_0x147a17[_0xe21e('0x1f')]=qs['limit'](_0x4a862e[_0xe21e('0x31')][_0xe21e('0x1f')]);_0x147a17[_0xe21e('0x1d')]=qs[_0xe21e('0x1d')](_0x4a862e[_0xe21e('0x31')][_0xe21e('0x1d')]);}return _0x27ec34[_0xe21e('0x50')](_0x147a17);}})[_0xe21e('0x3c')](function(_0x335863){if(_0x335863){return _0x335863?{'count':_0x27113a,'rows':_0x335863}:null;}})['then'](respondWithResult(_0xd1e5ae,null))[_0xe21e('0x3f')](handleError(_0xd1e5ae,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2ef495f..3572016 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 _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 +var _0xdc9b=['define','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0xdc9b,0x70));var _0xbdc9=function(_0x29aa98,_0x225c56){_0x29aa98=_0x29aa98-0x0;var _0x56745c=_0xdc9b[_0x29aa98];return _0x56745c;};'use strict';var _=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var logger=require(_0xbdc9('0x2'))('api');var moment=require(_0xbdc9('0x3'));var BPromise=require(_0xbdc9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdc9('0x5'));var config=require(_0xbdc9('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xbdc9('0x7')]=function(_0x3065a8,_0x5bf8bc){return _0x3065a8[_0xbdc9('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xbdc9('0x9'),'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 4fd70c5..d148331 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 _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 +var _0xdaaf=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x48415d,_0x339044){var _0x2f6650=function(_0x40b2d4){while(--_0x40b2d4){_0x48415d['push'](_0x48415d['shift']());}};_0x2f6650(++_0x339044);}(_0xdaaf,0x130));var _0xfdaa=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdaaf[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xfdaa('0x0'));var moment=require(_0xfdaa('0x1'));var BPromise=require(_0xfdaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdaa('0x3'));var db=require(_0xfdaa('0x4'))['db'];var utils=require(_0xfdaa('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfdaa('0x6')][_0xfdaa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49da41,_0x22d2c5,_0xde4ecd){return new BPromise(function(_0x74474f,_0x1ac37b){return client[_0xfdaa('0x8')](_0x49da41,_0xde4ecd)[_0xfdaa('0x9')](function(_0x53d2eb){logger['info'](_0xfdaa('0xa'),_0x22d2c5,_0xfdaa('0xb'));logger[_0xfdaa('0xc')](_0xfdaa('0xd'),_0x22d2c5,_0xfdaa('0xb'),JSON['stringify'](_0x53d2eb));if(_0x53d2eb['error']){if(_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0xf')]===0x1f4){logger['error'](_0xfdaa('0xa'),_0x22d2c5,_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0x10')]);return _0x1ac37b(_0x53d2eb['error'][_0xfdaa('0x10')]);}logger['error'](_0xfdaa('0xa'),_0x22d2c5,_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0x10')]);return _0x74474f(_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0x10')]);}else{logger[_0xfdaa('0x11')](_0xfdaa('0xa'),_0x22d2c5,'request\x20sent');_0x74474f(_0x53d2eb[_0xfdaa('0x12')][_0xfdaa('0x10')]);}})[_0xfdaa('0x13')](function(_0x44a556){logger[_0xfdaa('0xe')](_0xfdaa('0xa'),_0x22d2c5,_0x44a556);_0x1ac37b(_0x44a556);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3e45292..e571740 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 _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 +var _0xf1dd=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0xd02116,_0x177f37){var _0x2db2b7=function(_0x6646ba){while(--_0x6646ba){_0xd02116['push'](_0xd02116['shift']());}};_0x2db2b7(++_0x177f37);}(_0xf1dd,0x1c2));var _0xdf1d=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xf1dd[_0x3452a8];return _0x233814;};'use strict';var multer=require(_0xdf1d('0x0'));var util=require('util');var path=require(_0xdf1d('0x1'));var timeout=require(_0xdf1d('0x2'));var express=require('express');var router=express[_0xdf1d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdf1d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdf1d('0x5'));var controller=require('./intServicenowField.controller');router[_0xdf1d('0x6')]('/',auth[_0xdf1d('0x7')](),controller['index']);router[_0xdf1d('0x6')](_0xdf1d('0x8'),auth[_0xdf1d('0x7')](),controller[_0xdf1d('0x9')]);router[_0xdf1d('0xa')]('/',auth[_0xdf1d('0x7')](),controller[_0xdf1d('0xb')]);router[_0xdf1d('0xc')]('/:id',auth[_0xdf1d('0x7')](),controller[_0xdf1d('0xd')]);router[_0xdf1d('0xe')](_0xdf1d('0x8'),auth[_0xdf1d('0x7')](),controller[_0xdf1d('0xf')]);module[_0xdf1d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c19ff49..e55dd1f 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 _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 +var _0x33cc=['ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','exports'];(function(_0x541155,_0x54f085){var _0x519cf5=function(_0x24faf0){while(--_0x24faf0){_0x541155['push'](_0x541155['shift']());}};_0x519cf5(++_0x54f085);}(_0x33cc,0x14c));var _0xc33c=function(_0x31bf4a,_0x2c90e7){_0x31bf4a=_0x31bf4a-0x0;var _0x542d25=_0x33cc[_0x31bf4a];return _0x542d25;};'use strict';var Sequelize=require('sequelize');module[_0xc33c('0x0')]={'type':{'type':Sequelize[_0xc33c('0x1')]('string',_0xc33c('0x2'),_0xc33c('0x3'),_0xc33c('0x4'),_0xc33c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc33c('0x6')]},'key':{'type':Sequelize[_0xc33c('0x6')]},'keyType':{'type':Sequelize[_0xc33c('0x1')](_0xc33c('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xc33c('0x6')]},'idField':{'type':Sequelize[_0xc33c('0x6')]},'nameField':{'type':Sequelize[_0xc33c('0x6')]},'customField':{'type':Sequelize[_0xc33c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc33c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 76cdbe6..1232da7 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 _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 +var _0xc5b7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ServicenowField','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0xc5b7,0x1b2));var _0x7c5b=function(_0x2591b1,_0x2b5a30){_0x2591b1=_0x2591b1-0x0;var _0x19d29a=_0xc5b7[_0x2591b1];return _0x19d29a;};'use strict';var emlformat=require(_0x7c5b('0x0'));var rimraf=require(_0x7c5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c5b('0x2'));var rp=require(_0x7c5b('0x3'));var moment=require(_0x7c5b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7c5b('0x5'));var path=require(_0x7c5b('0x6'));var sox=require(_0x7c5b('0x7'));var csv=require(_0x7c5b('0x8'));var ejs=require(_0x7c5b('0x9'));var fs=require('fs');var fs_extra=require(_0x7c5b('0xa'));var _=require(_0x7c5b('0xb'));var squel=require(_0x7c5b('0xc'));var crypto=require(_0x7c5b('0xd'));var jsforce=require(_0x7c5b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7c5b('0x8'));var querystring=require('querystring');var Papa=require(_0x7c5b('0xf'));var Redis=require(_0x7c5b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7c5b('0x11'));var as=require(_0x7c5b('0x12'));var hardwareService=require(_0x7c5b('0x13'));var logger=require(_0x7c5b('0x14'))(_0x7c5b('0x15'));var utils=require(_0x7c5b('0x16'));var config=require(_0x7c5b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115683,_0x41c8c5){_0x41c8c5=_0x41c8c5||0xcc;return function(_0x5212f9){if(_0x5212f9){return _0x115683['sendStatus'](_0x41c8c5);}return _0x115683['status'](_0x41c8c5)['end']();};}function respondWithResult(_0x218200,_0x428c4b){_0x428c4b=_0x428c4b||0xc8;return function(_0x33a544){if(_0x33a544){return _0x218200[_0x7c5b('0x18')](_0x428c4b)[_0x7c5b('0x19')](_0x33a544);}};}function respondWithFilteredResult(_0x4647ba,_0x130af2){return function(_0x1939c6){if(_0x1939c6){var _0x4213ce=typeof _0x130af2[_0x7c5b('0x1a')]===_0x7c5b('0x1b')&&typeof _0x130af2[_0x7c5b('0x1c')]===_0x7c5b('0x1b');var _0x2b25d4=_0x1939c6[_0x7c5b('0x1d')];var _0xf353b9=_0x4213ce?0x0:_0x130af2['offset'];var _0x4a4a93=_0x4213ce?_0x1939c6[_0x7c5b('0x1d')]:_0x130af2['offset']+_0x130af2[_0x7c5b('0x1c')];var _0x79d9f4;if(_0x4a4a93>=_0x2b25d4){_0x4a4a93=_0x2b25d4;_0x79d9f4=0xc8;}else{_0x79d9f4=0xce;}_0x4647ba[_0x7c5b('0x18')](_0x79d9f4);return _0x4647ba[_0x7c5b('0x1e')](_0x7c5b('0x1f'),_0xf353b9+'-'+_0x4a4a93+'/'+_0x2b25d4)[_0x7c5b('0x19')](_0x1939c6);}return null;};}function patchUpdates(_0x4f58e3){return function(_0x12a453){try{jsonpatch[_0x7c5b('0x20')](_0x12a453,_0x4f58e3,!![]);}catch(_0x4c6361){return BPromise['reject'](_0x4c6361);}return _0x12a453[_0x7c5b('0x21')]();};}function saveUpdates(_0x26c869,_0x5b9ce7){return function(_0x15c1d7){if(_0x15c1d7){return _0x15c1d7[_0x7c5b('0x22')](_0x26c869)[_0x7c5b('0x23')](function(_0x4cea29){return _0x4cea29;});}return null;};}function removeEntity(_0x4c55a2,_0x2c4347){return function(_0x30c368){if(_0x30c368){return _0x30c368['destroy']()[_0x7c5b('0x23')](function(){_0x4c55a2['status'](0xcc)[_0x7c5b('0x24')]();});}};}function handleEntityNotFound(_0x235b46,_0x1f43b5){return function(_0x49ffb1){if(!_0x49ffb1){_0x235b46['sendStatus'](0x194);}return _0x49ffb1;};}function handleError(_0x5db185,_0x5549ca){_0x5549ca=_0x5549ca||0x1f4;return function(_0x4c373d){logger[_0x7c5b('0x25')](_0x4c373d[_0x7c5b('0x26')]);if(_0x4c373d[_0x7c5b('0x27')]){delete _0x4c373d['name'];}_0x5db185[_0x7c5b('0x18')](_0x5549ca)[_0x7c5b('0x28')](_0x4c373d);};}exports[_0x7c5b('0x29')]=function(_0x330619,_0x480831){var _0x556741={},_0x43f544={},_0x49e8eb={'count':0x0,'rows':[]};var _0x38e222=_[_0x7c5b('0x2a')](db[_0x7c5b('0x2b')]['rawAttributes'],function(_0x12bf28){return{'name':_0x12bf28['fieldName'],'type':_0x12bf28[_0x7c5b('0x2c')][_0x7c5b('0x2d')]};});_0x43f544[_0x7c5b('0x2e')]=_[_0x7c5b('0x2a')](_0x38e222,_0x7c5b('0x27'));_0x43f544[_0x7c5b('0x2f')]=_[_0x7c5b('0x30')](_0x330619[_0x7c5b('0x2f')]);_0x43f544[_0x7c5b('0x31')]=_[_0x7c5b('0x32')](_0x43f544[_0x7c5b('0x2e')],_0x43f544[_0x7c5b('0x2f')]);_0x556741['attributes']=_[_0x7c5b('0x32')](_0x43f544[_0x7c5b('0x2e')],qs[_0x7c5b('0x33')](_0x330619['query'][_0x7c5b('0x33')]));_0x556741[_0x7c5b('0x34')]=_0x556741['attributes'][_0x7c5b('0x35')]?_0x556741[_0x7c5b('0x34')]:_0x43f544['model'];if(!_0x330619[_0x7c5b('0x2f')]['hasOwnProperty'](_0x7c5b('0x36'))){_0x556741[_0x7c5b('0x1c')]=qs[_0x7c5b('0x1c')](_0x330619[_0x7c5b('0x2f')][_0x7c5b('0x1c')]);_0x556741[_0x7c5b('0x1a')]=qs[_0x7c5b('0x1a')](_0x330619[_0x7c5b('0x2f')][_0x7c5b('0x1a')]);}_0x556741[_0x7c5b('0x37')]=qs[_0x7c5b('0x38')](_0x330619[_0x7c5b('0x2f')][_0x7c5b('0x38')]);_0x556741[_0x7c5b('0x39')]=qs['filters'](_[_0x7c5b('0x3a')](_0x330619[_0x7c5b('0x2f')],_0x43f544['filters']),_0x38e222);if(_0x330619['query'][_0x7c5b('0x3b')]){_0x556741[_0x7c5b('0x39')]=_['merge'](_0x556741[_0x7c5b('0x39')],{'$or':_['map'](_0x38e222,function(_0x1b37f5){if(_0x1b37f5[_0x7c5b('0x2c')]!==_0x7c5b('0x3c')){var _0x522f6c={};_0x522f6c[_0x1b37f5[_0x7c5b('0x27')]]={'$like':'%'+_0x330619[_0x7c5b('0x2f')]['filter']+'%'};return _0x522f6c;}})});}_0x556741=_[_0x7c5b('0x3d')]({},_0x556741,_0x330619[_0x7c5b('0x3e')]);var _0x4d2e3b={'where':_0x556741[_0x7c5b('0x39')]};return db['ServicenowField'][_0x7c5b('0x1d')](_0x4d2e3b)[_0x7c5b('0x23')](function(_0x240148){_0x49e8eb[_0x7c5b('0x1d')]=_0x240148;if(_0x330619[_0x7c5b('0x2f')]['includeAll']){_0x556741[_0x7c5b('0x3f')]=[{'all':!![]}];}return db['ServicenowField'][_0x7c5b('0x40')](_0x556741);})[_0x7c5b('0x23')](function(_0x19ac69){_0x49e8eb[_0x7c5b('0x41')]=_0x19ac69;return _0x49e8eb;})['then'](respondWithFilteredResult(_0x480831,_0x556741))['catch'](handleError(_0x480831,null));};exports[_0x7c5b('0x42')]=function(_0x5034f2,_0x3c5e44){var _0x2217b8={'raw':!![],'where':{'id':_0x5034f2['params']['id']}},_0x519c79={};_0x519c79[_0x7c5b('0x2e')]=_['keys'](db[_0x7c5b('0x2b')][_0x7c5b('0x43')]);_0x519c79[_0x7c5b('0x2f')]=_[_0x7c5b('0x30')](_0x5034f2[_0x7c5b('0x2f')]);_0x519c79['filters']=_['intersection'](_0x519c79['model'],_0x519c79[_0x7c5b('0x2f')]);_0x2217b8['attributes']=_[_0x7c5b('0x32')](_0x519c79[_0x7c5b('0x2e')],qs[_0x7c5b('0x33')](_0x5034f2[_0x7c5b('0x2f')][_0x7c5b('0x33')]));_0x2217b8[_0x7c5b('0x34')]=_0x2217b8['attributes'][_0x7c5b('0x35')]?_0x2217b8[_0x7c5b('0x34')]:_0x519c79['model'];if(_0x5034f2[_0x7c5b('0x2f')][_0x7c5b('0x44')]){_0x2217b8[_0x7c5b('0x3f')]=[{'all':!![]}];}_0x2217b8=_[_0x7c5b('0x3d')]({},_0x2217b8,_0x5034f2[_0x7c5b('0x3e')]);return db[_0x7c5b('0x2b')][_0x7c5b('0x45')](_0x2217b8)[_0x7c5b('0x23')](handleEntityNotFound(_0x3c5e44,null))[_0x7c5b('0x23')](respondWithResult(_0x3c5e44,null))[_0x7c5b('0x46')](handleError(_0x3c5e44,null));};exports[_0x7c5b('0x47')]=function(_0x1af90d,_0xc1f513){return db[_0x7c5b('0x2b')][_0x7c5b('0x47')](_0x1af90d[_0x7c5b('0x48')],{})[_0x7c5b('0x23')](respondWithResult(_0xc1f513,0xc9))[_0x7c5b('0x46')](handleError(_0xc1f513,null));};exports[_0x7c5b('0x22')]=function(_0x2a6c58,_0x1e80da){if(_0x2a6c58[_0x7c5b('0x48')]['id']){delete _0x2a6c58['body']['id'];}return db['ServicenowField'][_0x7c5b('0x45')]({'where':{'id':_0x2a6c58['params']['id']}})[_0x7c5b('0x23')](handleEntityNotFound(_0x1e80da,null))[_0x7c5b('0x23')](saveUpdates(_0x2a6c58['body'],null))[_0x7c5b('0x23')](respondWithResult(_0x1e80da,null))['catch'](handleError(_0x1e80da,null));};exports[_0x7c5b('0x49')]=function(_0x43e595,_0xfb90a9){return db[_0x7c5b('0x2b')][_0x7c5b('0x45')]({'where':{'id':_0x43e595[_0x7c5b('0x4a')]['id']}})[_0x7c5b('0x23')](handleEntityNotFound(_0xfb90a9,null))[_0x7c5b('0x23')](removeEntity(_0xfb90a9,null))[_0x7c5b('0x46')](handleError(_0xfb90a9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1e7c397..06ffc0a 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 _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 +var _0x7a06=['path','../../config/environment','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','moment','bluebird','request-promise'];(function(_0xf3dccf,_0x1b2256){var _0xfe770=function(_0x51e209){while(--_0x51e209){_0xf3dccf['push'](_0xf3dccf['shift']());}};_0xfe770(++_0x1b2256);}(_0x7a06,0x100));var _0x67a0=function(_0x4c6c8c,_0x3b624a){_0x4c6c8c=_0x4c6c8c-0x0;var _0x28aecd=_0x7a06[_0x4c6c8c];return _0x28aecd;};'use strict';var _=require(_0x67a0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x67a0('0x1'));var BPromise=require(_0x67a0('0x2'));var rp=require(_0x67a0('0x3'));var fs=require('fs');var path=require(_0x67a0('0x4'));var rimraf=require('rimraf');var config=require(_0x67a0('0x5'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x44664a,_0xa37e9a){return _0x44664a['define'](_0x67a0('0x6'),attributes,{'tableName':_0x67a0('0x7'),'paranoid':![],'indexes':[{'name':_0x67a0('0x8'),'fields':['idField',_0x67a0('0x9')],'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 47fe990..358817b 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 _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 +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1b1f04,_0xc66e12){_0x1b1f04=_0x1b1f04-0x0;var _0x1c0109=_0xbdb7[_0x1b1f04];return _0x1c0109;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1047073..8763dae 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(_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 +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5f5d2c,_0x23ce26){var _0xc6240=function(_0xe9429d){while(--_0xe9429d){_0x5f5d2c['push'](_0x5f5d2c['shift']());}};_0xc6240(++_0x23ce26);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 478cf38..0f7d52a 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(_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 +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x513eec,_0x303e88){var _0x413772=function(_0x2350ec){while(--_0x2350ec){_0x513eec['push'](_0x513eec['shift']());}};_0x413772(++_0x303e88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'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 36dda58..e53b4e5 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 _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 +var _0xf675=['rawAttributes','includeAll','find','catch','create','body','params','SugarcrmConfiguration','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','stringify','Calls','values','module_fields','remove','label','endsWith','options','value','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','SugarcrmAccount','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','show'];(function(_0x1a6588,_0x1fea73){var _0x109b37=function(_0x595600){while(--_0x595600){_0x1a6588['push'](_0x1a6588['shift']());}};_0x109b37(++_0x1fea73);}(_0xf675,0xae));var _0x5f67=function(_0x15ddc9,_0x209223){_0x15ddc9=_0x15ddc9-0x0;var _0x2fc9e8=_0xf675[_0x15ddc9];return _0x2fc9e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f67('0x0'));var zipdir=require(_0x5f67('0x1'));var jsonpatch=require(_0x5f67('0x2'));var rp=require(_0x5f67('0x3'));var moment=require(_0x5f67('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5f67('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f67('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f67('0x7'));var jsforce=require(_0x5f67('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x5f67('0x9'));var querystring=require(_0x5f67('0xa'));var Papa=require(_0x5f67('0xb'));var Redis=require('ioredis');var authService=require(_0x5f67('0xc'));var qs=require(_0x5f67('0xd'));var as=require(_0x5f67('0xe'));var hardwareService=require(_0x5f67('0xf'));var logger=require(_0x5f67('0x10'))(_0x5f67('0x11'));var utils=require(_0x5f67('0x12'));var config=require(_0x5f67('0x13'));var licenseUtil=require(_0x5f67('0x14'));var db=require(_0x5f67('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1958d7,_0x586788){_0x586788=_0x586788||0xcc;return function(_0x25be40){if(_0x25be40){return _0x1958d7[_0x5f67('0x16')](_0x586788);}return _0x1958d7[_0x5f67('0x17')](_0x586788)[_0x5f67('0x18')]();};}function respondWithResult(_0x851888,_0x3e0bf6){_0x3e0bf6=_0x3e0bf6||0xc8;return function(_0x20b067){if(_0x20b067){return _0x851888[_0x5f67('0x17')](_0x3e0bf6)[_0x5f67('0x19')](_0x20b067);}};}function respondWithFilteredResult(_0x22a959,_0x5b23a8){return function(_0x189653){if(_0x189653){var _0x392b99=typeof _0x5b23a8[_0x5f67('0x1a')]===_0x5f67('0x1b')&&typeof _0x5b23a8['limit']===_0x5f67('0x1b');var _0x5adf16=_0x189653[_0x5f67('0x1c')];var _0x4e61bd=_0x392b99?0x0:_0x5b23a8[_0x5f67('0x1a')];var _0x519205=_0x392b99?_0x189653[_0x5f67('0x1c')]:_0x5b23a8[_0x5f67('0x1a')]+_0x5b23a8[_0x5f67('0x1d')];var _0x375a26;if(_0x519205>=_0x5adf16){_0x519205=_0x5adf16;_0x375a26=0xc8;}else{_0x375a26=0xce;}_0x22a959[_0x5f67('0x17')](_0x375a26);return _0x22a959['set'](_0x5f67('0x1e'),_0x4e61bd+'-'+_0x519205+'/'+_0x5adf16)[_0x5f67('0x19')](_0x189653);}return null;};}function patchUpdates(_0x1600bb){return function(_0x3d3702){try{jsonpatch[_0x5f67('0x1f')](_0x3d3702,_0x1600bb,!![]);}catch(_0x565a1f){return BPromise[_0x5f67('0x20')](_0x565a1f);}return _0x3d3702[_0x5f67('0x21')]();};}function saveUpdates(_0x2104b3,_0x24a9a8){return function(_0x4849f3){if(_0x4849f3){return _0x4849f3[_0x5f67('0x22')](_0x2104b3)['then'](function(_0x259f80){return _0x259f80;});}return null;};}function removeEntity(_0x29a0a4,_0x3ba26d){return function(_0x3da5e2){if(_0x3da5e2){return _0x3da5e2[_0x5f67('0x23')]()[_0x5f67('0x24')](function(){_0x29a0a4['status'](0xcc)[_0x5f67('0x18')]();});}};}function handleEntityNotFound(_0x10de0f,_0x453868){return function(_0x472f2c){if(!_0x472f2c){_0x10de0f[_0x5f67('0x16')](0x194);}return _0x472f2c;};}function handleError(_0xdeba6e,_0x3983e0){_0x3983e0=_0x3983e0||0x1f4;return function(_0x13635e){logger[_0x5f67('0x25')](_0x13635e['stack']);if(_0x13635e[_0x5f67('0x26')]){delete _0x13635e[_0x5f67('0x26')];}_0xdeba6e[_0x5f67('0x17')](_0x3983e0)[_0x5f67('0x27')](_0x13635e);};}exports[_0x5f67('0x28')]=function(_0x4af468,_0x58998a){var _0x3e64c5={},_0x3d2bfc={},_0x131442={'count':0x0,'rows':[]};var _0x333369=_['map'](db[_0x5f67('0x29')]['rawAttributes'],function(_0x441839){return{'name':_0x441839[_0x5f67('0x2a')],'type':_0x441839[_0x5f67('0x2b')][_0x5f67('0x2c')]};});_0x3d2bfc[_0x5f67('0x2d')]=_[_0x5f67('0x2e')](_0x333369,'name');_0x3d2bfc[_0x5f67('0x2f')]=_[_0x5f67('0x30')](_0x4af468['query']);_0x3d2bfc['filters']=_['intersection'](_0x3d2bfc[_0x5f67('0x2d')],_0x3d2bfc[_0x5f67('0x2f')]);_0x3e64c5['attributes']=_[_0x5f67('0x31')](_0x3d2bfc[_0x5f67('0x2d')],qs[_0x5f67('0x32')](_0x4af468[_0x5f67('0x2f')][_0x5f67('0x32')]));_0x3e64c5[_0x5f67('0x33')]=_0x3e64c5[_0x5f67('0x33')][_0x5f67('0x34')]?_0x3e64c5['attributes']:_0x3d2bfc[_0x5f67('0x2d')];if(!_0x4af468[_0x5f67('0x2f')]['hasOwnProperty'](_0x5f67('0x35'))){_0x3e64c5[_0x5f67('0x1d')]=qs[_0x5f67('0x1d')](_0x4af468['query'][_0x5f67('0x1d')]);_0x3e64c5[_0x5f67('0x1a')]=qs['offset'](_0x4af468[_0x5f67('0x2f')][_0x5f67('0x1a')]);}_0x3e64c5[_0x5f67('0x36')]=qs[_0x5f67('0x37')](_0x4af468[_0x5f67('0x2f')][_0x5f67('0x37')]);_0x3e64c5[_0x5f67('0x38')]=qs[_0x5f67('0x39')](_[_0x5f67('0x3a')](_0x4af468[_0x5f67('0x2f')],_0x3d2bfc[_0x5f67('0x39')]),_0x333369);if(_0x4af468[_0x5f67('0x2f')][_0x5f67('0x3b')]){_0x3e64c5[_0x5f67('0x38')]=_[_0x5f67('0x3c')](_0x3e64c5[_0x5f67('0x38')],{'$or':_[_0x5f67('0x2e')](_0x333369,function(_0x536054){if(_0x536054[_0x5f67('0x2b')]!==_0x5f67('0x3d')){var _0x48f6a7={};_0x48f6a7[_0x536054[_0x5f67('0x26')]]={'$like':'%'+_0x4af468[_0x5f67('0x2f')]['filter']+'%'};return _0x48f6a7;}})});}_0x3e64c5=_['merge']({},_0x3e64c5,_0x4af468['options']);var _0x494afd={'where':_0x3e64c5[_0x5f67('0x38')]};return db[_0x5f67('0x29')][_0x5f67('0x1c')](_0x494afd)['then'](function(_0x1d8db5){_0x131442['count']=_0x1d8db5;if(_0x4af468[_0x5f67('0x2f')]['includeAll']){_0x3e64c5[_0x5f67('0x3e')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x5f67('0x3f')](_0x3e64c5);})[_0x5f67('0x24')](function(_0x519cbf){_0x131442[_0x5f67('0x40')]=_0x519cbf;return _0x131442;})['then'](respondWithFilteredResult(_0x58998a,_0x3e64c5))['catch'](handleError(_0x58998a,null));};exports[_0x5f67('0x41')]=function(_0x1f79a1,_0x3c627f){var _0x102418={'raw':![],'where':{'id':_0x1f79a1['params']['id']}},_0x4663df={};_0x4663df[_0x5f67('0x2d')]=_[_0x5f67('0x30')](db[_0x5f67('0x29')][_0x5f67('0x42')]);_0x4663df['query']=_[_0x5f67('0x30')](_0x1f79a1[_0x5f67('0x2f')]);_0x4663df[_0x5f67('0x39')]=_[_0x5f67('0x31')](_0x4663df[_0x5f67('0x2d')],_0x4663df[_0x5f67('0x2f')]);_0x102418['attributes']=_[_0x5f67('0x31')](_0x4663df[_0x5f67('0x2d')],qs[_0x5f67('0x32')](_0x1f79a1[_0x5f67('0x2f')][_0x5f67('0x32')]));_0x102418[_0x5f67('0x33')]=_0x102418[_0x5f67('0x33')]['length']?_0x102418[_0x5f67('0x33')]:_0x4663df[_0x5f67('0x2d')];if(_0x1f79a1[_0x5f67('0x2f')][_0x5f67('0x43')]){_0x102418[_0x5f67('0x3e')]=[{'all':!![]}];}_0x102418=_['merge']({},_0x102418,_0x1f79a1['options']);return db[_0x5f67('0x29')][_0x5f67('0x44')](_0x102418)[_0x5f67('0x24')](handleEntityNotFound(_0x3c627f,null))[_0x5f67('0x24')](respondWithResult(_0x3c627f,null))[_0x5f67('0x45')](handleError(_0x3c627f,null));};exports[_0x5f67('0x46')]=function(_0x59ab0b,_0x2b5c75){return db[_0x5f67('0x29')][_0x5f67('0x46')](_0x59ab0b[_0x5f67('0x47')],{})[_0x5f67('0x24')](respondWithResult(_0x2b5c75,0xc9))[_0x5f67('0x45')](handleError(_0x2b5c75,null));};exports['update']=function(_0x595896,_0xd6f538){if(_0x595896[_0x5f67('0x47')]['id']){delete _0x595896[_0x5f67('0x47')]['id'];}return db[_0x5f67('0x29')][_0x5f67('0x44')]({'where':{'id':_0x595896[_0x5f67('0x48')]['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0xd6f538,null))[_0x5f67('0x24')](saveUpdates(_0x595896['body'],null))[_0x5f67('0x24')](respondWithResult(_0xd6f538,null))[_0x5f67('0x45')](handleError(_0xd6f538,null));};exports['destroy']=function(_0x31c555,_0x50c7a3){return db[_0x5f67('0x29')][_0x5f67('0x44')]({'where':{'id':_0x31c555[_0x5f67('0x48')]['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0x50c7a3,null))[_0x5f67('0x24')](removeEntity(_0x50c7a3,null))[_0x5f67('0x45')](handleError(_0x50c7a3,null));};exports['getConfigurations']=function(_0x231a14,_0x118a25,_0x348e40){var _0x46d7e4={};var _0x5bc615={};var _0x1d4e00;var _0x1f735c;return db[_0x5f67('0x29')]['findOne']({'where':{'id':_0x231a14[_0x5f67('0x48')]['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0x118a25,null))[_0x5f67('0x24')](function(_0x6c1f3b){if(_0x6c1f3b){_0x1d4e00=_0x6c1f3b;_0x5bc615[_0x5f67('0x2d')]=_['keys'](db[_0x5f67('0x49')][_0x5f67('0x42')]);_0x5bc615[_0x5f67('0x2f')]=_[_0x5f67('0x30')](_0x231a14[_0x5f67('0x2f')]);_0x5bc615[_0x5f67('0x39')]=_[_0x5f67('0x31')](_0x5bc615[_0x5f67('0x2d')],_0x5bc615[_0x5f67('0x2f')]);_0x46d7e4[_0x5f67('0x33')]=_['intersection'](_0x5bc615[_0x5f67('0x2d')],qs['fields'](_0x231a14['query'][_0x5f67('0x32')]));_0x46d7e4[_0x5f67('0x33')]=_0x46d7e4[_0x5f67('0x33')]['length']?_0x46d7e4['attributes']:_0x5bc615[_0x5f67('0x2d')];_0x46d7e4['order']=qs[_0x5f67('0x37')](_0x231a14[_0x5f67('0x2f')][_0x5f67('0x37')]);_0x46d7e4[_0x5f67('0x38')]=qs[_0x5f67('0x39')](_['pick'](_0x231a14['query'],_0x5bc615[_0x5f67('0x39')]));if(_0x231a14[_0x5f67('0x2f')][_0x5f67('0x3b')]){_0x46d7e4[_0x5f67('0x38')]=_[_0x5f67('0x3c')](_0x46d7e4[_0x5f67('0x38')],{'$or':_[_0x5f67('0x2e')](_0x46d7e4[_0x5f67('0x33')],function(_0x99ff45){var _0x366ca8={};_0x366ca8[_0x99ff45]={'$like':'%'+_0x231a14[_0x5f67('0x2f')][_0x5f67('0x3b')]+'%'};return _0x366ca8;})});}_0x46d7e4=_[_0x5f67('0x3c')]({},_0x46d7e4,_0x231a14['options']);return _0x1d4e00[_0x5f67('0x4a')](_0x46d7e4);}})[_0x5f67('0x24')](function(_0xd69194){if(_0xd69194){_0x1f735c=_0xd69194[_0x5f67('0x34')];if(!_0x231a14[_0x5f67('0x2f')][_0x5f67('0x4b')](_0x5f67('0x35'))){_0x46d7e4[_0x5f67('0x1d')]=qs['limit'](_0x231a14[_0x5f67('0x2f')][_0x5f67('0x1d')]);_0x46d7e4[_0x5f67('0x1a')]=qs[_0x5f67('0x1a')](_0x231a14[_0x5f67('0x2f')][_0x5f67('0x1a')]);}return _0x1d4e00[_0x5f67('0x4a')](_0x46d7e4);}})['then'](function(_0x3ffb1b){if(_0x3ffb1b){return _0x3ffb1b?{'count':_0x1f735c,'rows':_0x3ffb1b}:null;}})[_0x5f67('0x24')](respondWithResult(_0x118a25,null))[_0x5f67('0x45')](handleError(_0x118a25,null));};exports['addConfiguration']=function(_0x45ebc7,_0x4e35ea,_0xb088d8){if(_0x45ebc7[_0x5f67('0x47')]['id']){delete _0x45ebc7[_0x5f67('0x47')]['id'];}return db[_0x5f67('0x29')][_0x5f67('0x4c')]({'where':{'id':_0x45ebc7['params']['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0x4e35ea,null))['then'](function(_0x9192f4){if(_0x9192f4){_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x4d')]=_0x9192f4['id'];_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x4e')]=integrations['getSubjects'](_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x4f')],_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x2b')]);_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x50')]=integrations[_0x5f67('0x51')](_0x45ebc7['body'][_0x5f67('0x4f')],_0x45ebc7['body'][_0x5f67('0x2b')]);return db[_0x5f67('0x49')]['create'](_0x45ebc7['body'],{'include':[{'model':db[_0x5f67('0x52')],'as':_0x5f67('0x4e')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4e35ea,null))['catch'](handleError(_0x4e35ea,null));};exports[_0x5f67('0x53')]=function(_0x2c58f4,_0xc05abe,_0x1eb6af){var _0x327182='';var _0x1301da=['id',_0x5f67('0x26'),_0x5f67('0x54'),_0x5f67('0x55'),_0x5f67('0x56'),'date_start',_0x5f67('0x57'),_0x5f67('0x58'),_0x5f67('0x59'),_0x5f67('0x5a'),'parent_name',_0x5f67('0x5b')];return db[_0x5f67('0x29')][_0x5f67('0x4c')]({'where':{'id':_0x2c58f4['params']['id']},'attributes':['id',_0x5f67('0x5c'),_0x5f67('0x5d'),_0x5f67('0x5e')]})[_0x5f67('0x24')](handleEntityNotFound(_0xc05abe,null))[_0x5f67('0x24')](function(_0x19d356){if(_0x19d356){_0x327182=_0x19d356[_0x5f67('0x5e')];var _0xe184d9=_0x327182[_0x5f67('0x5f')](-0x1);if(_0xe184d9==='/'){_0x327182=_0x327182[_0x5f67('0x60')](0x0,_0x327182['lastIndexOf'](_0xe184d9));}return rp({'method':_0x5f67('0x61'),'uri':util[_0x5f67('0x62')](_0x5f67('0x63'),_0x327182,_0x5f67('0x64')),'json':!![],'form':{'method':_0x5f67('0x65'),'input_type':_0x5f67('0x66'),'response_type':_0x5f67('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x19d356['username'],'password':_0x19d356[_0x5f67('0x5d')],'encryption':_0x5f67('0x67')},'application':_0x5f67('0x68')})}});}})['then'](function(_0xa8d9ae){if(_0xa8d9ae&&_0xa8d9ae[_0x5f67('0x26')]!==_0x5f67('0x69')&&_0xa8d9ae['name']!=='Password\x20Expired'){return rp({'method':_0x5f67('0x61'),'uri':util['format']('%s%s',_0x327182,_0x5f67('0x64')),'json':!![],'form':{'method':_0x5f67('0x6a'),'input_type':_0x5f67('0x66'),'response_type':_0x5f67('0x66'),'rest_data':JSON[_0x5f67('0x6b')]({'session':_0xa8d9ae['id'],'module_name':_0x5f67('0x6c')})}})[_0x5f67('0x24')](function(_0x14bb22){if(_0x14bb22){var _0x5bfb38=_[_0x5f67('0x6d')](_0x14bb22[_0x5f67('0x6e')]);_[_0x5f67('0x6f')](_0x5bfb38,function(_0x49f61a){return _0x1301da['includes'](_0x49f61a[_0x5f67('0x26')]);});return{'count':_0x5bfb38[_0x5f67('0x34')],'rows':_[_0x5f67('0x2e')](_0x5bfb38,function(_0xea6648){return{'id':_0xea6648['name'],'name':_0xea6648[_0x5f67('0x70')],'custom':_[_0x5f67('0x71')](_0xea6648[_0x5f67('0x26')],'_c')?!![]:![],'options':_0xea6648[_0x5f67('0x72')]?_[_0x5f67('0x2e')](_[_0x5f67('0x6d')](_0xea6648[_0x5f67('0x72')]),function(_0x4e531d){return{'name':_0x4e531d[_0x5f67('0x73')],'value':_0x4e531d['name']};}):[]};})};}})[_0x5f67('0x24')](respondWithResult(_0xc05abe,null))[_0x5f67('0x45')](function(_0x3e2d1b){var _0x52eea2=_0x2c58f4[_0x5f67('0x2f')][_0x5f67('0x74')]?0x1f4:_0x3e2d1b['statusCode']||0x1f4;logger['error'](_0x5f67('0x75'),_0x5f67('0x53'),_0x52eea2,JSON['stringify'](_0x3e2d1b));delete _0x3e2d1b[_0x5f67('0x26')];if(_0x52eea2===0x191){_0x52eea2=0x190;}_0xc05abe[_0x5f67('0x17')](_0x52eea2)[_0x5f67('0x27')](_0x2c58f4[_0x5f67('0x2f')][_0x5f67('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x3e2d1b[_0x5f67('0x76')]}:_0x3e2d1b);});}else{var _0xae3ad2=0x1f4;_0xc05abe[_0x5f67('0x17')](_0xae3ad2)[_0x5f67('0x27')]({'message':_0x5f67('0x77'),'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 533527e..be8ca12 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 _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 +var _0x8b33=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','util','api','moment','bluebird'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x8b33,0x64));var _0x38b3=function(_0x383841,_0x2043b3){_0x383841=_0x383841-0x0;var _0x513210=_0x8b33[_0x383841];return _0x513210;};'use strict';var _=require('lodash');var util=require(_0x38b3('0x0'));var logger=require('../../config/logger')(_0x38b3('0x1'));var moment=require(_0x38b3('0x2'));var BPromise=require(_0x38b3('0x3'));var rp=require(_0x38b3('0x4'));var fs=require('fs');var path=require(_0x38b3('0x5'));var rimraf=require(_0x38b3('0x6'));var config=require(_0x38b3('0x7'));var attributes=require(_0x38b3('0x8'));var integrations=require(_0x38b3('0x9'));module['exports']=function(_0x48d8c7,_0x174a8d){return _0x48d8c7[_0x38b3('0xa')](_0x38b3('0xb'),attributes,{'tableName':_0x38b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index c4a2a9a..b632f3f 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 _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 +var _0x28c0=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','attributes','map','model','ShowSugarcrmAccount','find','lodash','util'];(function(_0x12727b,_0xb9db62){var _0x1f871e=function(_0x1a535c){while(--_0x1a535c){_0x12727b['push'](_0x12727b['shift']());}};_0x1f871e(++_0xb9db62);}(_0x28c0,0x1ec));var _0x028c=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x28c0[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x028c('0x0'));var util=require(_0x028c('0x1'));var moment=require(_0x028c('0x2'));var BPromise=require(_0x028c('0x3'));var rs=require(_0x028c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x028c('0x5'))['db'];var utils=require(_0x028c('0x6'));var logger=require(_0x028c('0x7'))(_0x028c('0x8'));var config=require(_0x028c('0x9'));var jayson=require(_0x028c('0xa'));var client=jayson[_0x028c('0xb')][_0x028c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15a064,_0x251348,_0x133a22){return new BPromise(function(_0x12f991,_0xe8f431){return client[_0x028c('0xd')](_0x15a064,_0x133a22)[_0x028c('0xe')](function(_0x3c33cb){logger[_0x028c('0xf')](_0x028c('0x10'),_0x251348,_0x028c('0x11'));logger[_0x028c('0x12')](_0x028c('0x13'),_0x251348,'request\x20sent',JSON[_0x028c('0x14')](_0x3c33cb));if(_0x3c33cb[_0x028c('0x15')]){if(_0x3c33cb[_0x028c('0x15')]['code']===0x1f4){logger['error'](_0x028c('0x10'),_0x251348,_0x3c33cb[_0x028c('0x15')][_0x028c('0x16')]);return _0xe8f431(_0x3c33cb[_0x028c('0x15')][_0x028c('0x16')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x251348,_0x3c33cb[_0x028c('0x15')]['message']);return _0x12f991(_0x3c33cb['error']['message']);}else{logger[_0x028c('0xf')](_0x028c('0x10'),_0x251348,_0x028c('0x11'));_0x12f991(_0x3c33cb[_0x028c('0x17')][_0x028c('0x16')]);}})[_0x028c('0x18')](function(_0x34e95e){logger[_0x028c('0x15')](_0x028c('0x10'),_0x251348,_0x34e95e);_0xe8f431(_0x34e95e);});});}exports[_0x028c('0x19')]=function(_0x3b9542){var _0x228e8e=this;return new Promise(function(_0x17de42,_0x2356cc){return db[_0x028c('0x1a')][_0x028c('0x1b')]({'raw':_0x3b9542[_0x028c('0x1c')]?_0x3b9542['options'][_0x028c('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b9542['options']?_0x3b9542['options'][_0x028c('0x1e')]||null:null,'attributes':_0x3b9542[_0x028c('0x1c')]?_0x3b9542['options']['attributes']||null:null,'limit':_0x3b9542['options']?_0x3b9542[_0x028c('0x1c')][_0x028c('0x1f')]||null:null,'include':_0x3b9542['options']?_0x3b9542[_0x028c('0x1c')][_0x028c('0x20')]?_['map'](_0x3b9542['options'][_0x028c('0x20')],function(_0x15d67b){return{'model':db[_0x15d67b['model']],'as':_0x15d67b['as'],'attributes':_0x15d67b[_0x028c('0x21')],'include':_0x15d67b[_0x028c('0x20')]?_['map'](_0x15d67b['include'],function(_0x385764){return{'model':db[_0x385764['model']],'as':_0x385764['as'],'attributes':_0x385764[_0x028c('0x21')],'include':_0x385764[_0x028c('0x20')]?_[_0x028c('0x22')](_0x385764[_0x028c('0x20')],function(_0x18e9e7){return{'model':db[_0x18e9e7[_0x028c('0x23')]],'as':_0x18e9e7['as'],'attributes':_0x18e9e7[_0x028c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe78189){logger[_0x028c('0xf')](_0x028c('0x19'),_0x3b9542);logger[_0x028c('0x12')](_0x028c('0x19'),_0x3b9542,JSON['stringify'](_0xe78189));_0x17de42(_0xe78189);})[_0x028c('0x18')](function(_0x211209){logger[_0x028c('0x15')]('GetSugarcrmAccount',_0x211209[_0x028c('0x16')],_0x3b9542);_0x2356cc(_0x228e8e[_0x028c('0x15')](0x1f4,_0x211209[_0x028c('0x16')]));});});};exports[_0x028c('0x24')]=function(_0x130f93){var _0x40f87c=this;return new Promise(function(_0x1cdd33,_0x5e91c0){return db[_0x028c('0x1a')][_0x028c('0x25')]({'raw':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x1d')]===undefined?!![]:![]:!![],'where':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x1e')]||null:null,'attributes':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x21')]||null:null,'include':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x20')]?_['map'](_0x130f93[_0x028c('0x1c')]['include'],function(_0x4d8e83){return{'model':db[_0x4d8e83[_0x028c('0x23')]],'as':_0x4d8e83['as'],'attributes':_0x4d8e83[_0x028c('0x21')],'include':_0x4d8e83[_0x028c('0x20')]?_[_0x028c('0x22')](_0x4d8e83[_0x028c('0x20')],function(_0x26f580){return{'model':db[_0x26f580['model']],'as':_0x26f580['as'],'attributes':_0x26f580[_0x028c('0x21')],'include':_0x26f580[_0x028c('0x20')]?_[_0x028c('0x22')](_0x26f580[_0x028c('0x20')],function(_0x17b82e){return{'model':db[_0x17b82e[_0x028c('0x23')]],'as':_0x17b82e['as'],'attributes':_0x17b82e[_0x028c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x028c('0xe')](function(_0x3b82bc){logger[_0x028c('0xf')](_0x028c('0x24'),_0x130f93);logger[_0x028c('0x12')]('ShowSugarcrmAccount',_0x130f93,JSON[_0x028c('0x14')](_0x3b82bc));_0x1cdd33(_0x3b82bc);})[_0x028c('0x18')](function(_0x43a601){logger['error'](_0x028c('0x24'),_0x43a601[_0x028c('0x16')],_0x130f93);_0x5e91c0(_0x40f87c[_0x028c('0x15')](0x1f4,_0x43a601[_0x028c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bd75d55..44e94df 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 _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 +var _0x563f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x36fac3,_0x2ecf8b){var _0x576082=function(_0x50a248){while(--_0x50a248){_0x36fac3['push'](_0x36fac3['shift']());}};_0x576082(++_0x2ecf8b);}(_0x563f,0x131));var _0xf563=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x563f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xf563('0x0'));var util=require(_0xf563('0x1'));var path=require(_0xf563('0x2'));var timeout=require(_0xf563('0x3'));var express=require(_0xf563('0x4'));var router=express[_0xf563('0x5')]();var fs_extra=require(_0xf563('0x6'));var auth=require(_0xf563('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf563('0x8'));var controller=require(_0xf563('0x9'));router['get']('/',auth[_0xf563('0xa')](),controller[_0xf563('0xb')]);router['get'](_0xf563('0xc'),auth[_0xf563('0xa')](),controller[_0xf563('0xd')]);router[_0xf563('0xe')](_0xf563('0xf'),auth[_0xf563('0xa')](),controller[_0xf563('0x10')]);router[_0xf563('0xe')](_0xf563('0x11'),auth['isAuthenticated'](),controller[_0xf563('0x12')]);router[_0xf563('0xe')](_0xf563('0x13'),auth[_0xf563('0xa')](),controller[_0xf563('0x14')]);router[_0xf563('0x15')]('/',auth[_0xf563('0xa')](),controller[_0xf563('0x16')]);router[_0xf563('0x17')](_0xf563('0xc'),auth[_0xf563('0xa')](),controller[_0xf563('0x18')]);router[_0xf563('0x19')](_0xf563('0xc'),auth['isAuthenticated'](),controller[_0xf563('0x1a')]);module[_0xf563('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 03b235f..b59b6a3 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 _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 +var _0x0c00=['exports','STRING','sequelize'];(function(_0x53d7c4,_0x21ebe1){var _0x4107d9=function(_0x5cac1e){while(--_0x5cac1e){_0x53d7c4['push'](_0x53d7c4['shift']());}};_0x4107d9(++_0x21ebe1);}(_0x0c00,0x77));var _0x00c0=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x0c00[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x00c0('0x0'));module[_0x00c0('0x1')]={'name':{'type':Sequelize[_0x00c0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a40a266..74dd0be 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 _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 +var _0x0e26=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','intersection','includeAll','find','catch','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x2327ce,_0x5c2ded){var _0x72dc62=function(_0x1d05f8){while(--_0x1d05f8){_0x2327ce['push'](_0x2327ce['shift']());}};_0x72dc62(++_0x5c2ded);}(_0x0e26,0x10c));var _0x60e2=function(_0x57de79,_0x4165d4){_0x57de79=_0x57de79-0x0;var _0xce00f7=_0x0e26[_0x57de79];return _0xce00f7;};'use strict';var emlformat=require(_0x60e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x60e2('0x1'));var jsonpatch=require(_0x60e2('0x2'));var rp=require('request-promise');var moment=require(_0x60e2('0x3'));var BPromise=require(_0x60e2('0x4'));var Mustache=require(_0x60e2('0x5'));var util=require(_0x60e2('0x6'));var path=require(_0x60e2('0x7'));var sox=require(_0x60e2('0x8'));var csv=require(_0x60e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60e2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x60e2('0xb'));var jsforce=require(_0x60e2('0xc'));var deskjs=require(_0x60e2('0xd'));var toCsv=require(_0x60e2('0x9'));var querystring=require(_0x60e2('0xe'));var Papa=require(_0x60e2('0xf'));var Redis=require(_0x60e2('0x10'));var authService=require(_0x60e2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x60e2('0x12'))(_0x60e2('0x13'));var utils=require(_0x60e2('0x14'));var config=require(_0x60e2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x60e2('0x16'))['db'];function respondWithStatusCode(_0x12cb74,_0x3ef58d){_0x3ef58d=_0x3ef58d||0xcc;return function(_0x88b5c4){if(_0x88b5c4){return _0x12cb74['sendStatus'](_0x3ef58d);}return _0x12cb74[_0x60e2('0x17')](_0x3ef58d)[_0x60e2('0x18')]();};}function respondWithResult(_0x274fbd,_0x46719c){_0x46719c=_0x46719c||0xc8;return function(_0x45a051){if(_0x45a051){return _0x274fbd[_0x60e2('0x17')](_0x46719c)[_0x60e2('0x19')](_0x45a051);}};}function respondWithFilteredResult(_0x19236b,_0x3d6275){return function(_0x346b3c){if(_0x346b3c){var _0xe31ac7=typeof _0x3d6275[_0x60e2('0x1a')]===_0x60e2('0x1b')&&typeof _0x3d6275['limit']===_0x60e2('0x1b');var _0x45f827=_0x346b3c['count'];var _0xd24e2c=_0xe31ac7?0x0:_0x3d6275[_0x60e2('0x1a')];var _0x42ff26=_0xe31ac7?_0x346b3c[_0x60e2('0x1c')]:_0x3d6275[_0x60e2('0x1a')]+_0x3d6275[_0x60e2('0x1d')];var _0x3a2d2a;if(_0x42ff26>=_0x45f827){_0x42ff26=_0x45f827;_0x3a2d2a=0xc8;}else{_0x3a2d2a=0xce;}_0x19236b['status'](_0x3a2d2a);return _0x19236b[_0x60e2('0x1e')](_0x60e2('0x1f'),_0xd24e2c+'-'+_0x42ff26+'/'+_0x45f827)[_0x60e2('0x19')](_0x346b3c);}return null;};}function patchUpdates(_0x1e4801){return function(_0x1763ee){try{jsonpatch[_0x60e2('0x20')](_0x1763ee,_0x1e4801,!![]);}catch(_0x3cc4ad){return BPromise[_0x60e2('0x21')](_0x3cc4ad);}return _0x1763ee['save']();};}function saveUpdates(_0x5eebb7,_0x1eaabe){return function(_0x3e0b7c){if(_0x3e0b7c){return _0x3e0b7c[_0x60e2('0x22')](_0x5eebb7)['then'](function(_0x4ec795){return _0x4ec795;});}return null;};}function removeEntity(_0x397ed3,_0x2f3cf1){return function(_0x9e5979){if(_0x9e5979){return _0x9e5979['destroy']()[_0x60e2('0x23')](function(){_0x397ed3[_0x60e2('0x17')](0xcc)[_0x60e2('0x18')]();});}};}function handleEntityNotFound(_0x47d2cf,_0x1a0eb9){return function(_0x33c3b9){if(!_0x33c3b9){_0x47d2cf[_0x60e2('0x24')](0x194);}return _0x33c3b9;};}function handleError(_0xf0a99f,_0x1a3e49){_0x1a3e49=_0x1a3e49||0x1f4;return function(_0x3e59de){logger[_0x60e2('0x25')](_0x3e59de[_0x60e2('0x26')]);if(_0x3e59de[_0x60e2('0x27')]){delete _0x3e59de[_0x60e2('0x27')];}_0xf0a99f[_0x60e2('0x17')](_0x1a3e49)['send'](_0x3e59de);};}exports[_0x60e2('0x28')]=function(_0xc3536e,_0x5df149){var _0x5e7bff={},_0x38b614={},_0xe7d5d1={'count':0x0,'rows':[]};var _0x3fcafa=_[_0x60e2('0x29')](db[_0x60e2('0x2a')]['rawAttributes'],function(_0x39a59b){return{'name':_0x39a59b[_0x60e2('0x2b')],'type':_0x39a59b[_0x60e2('0x2c')][_0x60e2('0x2d')]};});_0x38b614[_0x60e2('0x2e')]=_['map'](_0x3fcafa,_0x60e2('0x27'));_0x38b614[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0xc3536e['query']);_0x38b614[_0x60e2('0x31')]=_['intersection'](_0x38b614[_0x60e2('0x2e')],_0x38b614[_0x60e2('0x2f')]);_0x5e7bff[_0x60e2('0x32')]=_['intersection'](_0x38b614[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x33')]));_0x5e7bff[_0x60e2('0x32')]=_0x5e7bff[_0x60e2('0x32')][_0x60e2('0x34')]?_0x5e7bff[_0x60e2('0x32')]:_0x38b614[_0x60e2('0x2e')];if(!_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x35')](_0x60e2('0x36'))){_0x5e7bff[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x5e7bff[_0x60e2('0x1a')]=qs[_0x60e2('0x1a')](_0xc3536e['query'][_0x60e2('0x1a')]);}_0x5e7bff[_0x60e2('0x37')]=qs[_0x60e2('0x38')](_0xc3536e[_0x60e2('0x2f')]['sort']);_0x5e7bff['where']=qs[_0x60e2('0x31')](_[_0x60e2('0x39')](_0xc3536e[_0x60e2('0x2f')],_0x38b614[_0x60e2('0x31')]),_0x3fcafa);if(_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x3a')]){_0x5e7bff[_0x60e2('0x3b')]=_[_0x60e2('0x3c')](_0x5e7bff['where'],{'$or':_[_0x60e2('0x29')](_0x3fcafa,function(_0xfbb745){if(_0xfbb745[_0x60e2('0x2c')]!==_0x60e2('0x3d')){var _0x35c15f={};_0x35c15f[_0xfbb745[_0x60e2('0x27')]]={'$like':'%'+_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x3a')]+'%'};return _0x35c15f;}})});}_0x5e7bff=_[_0x60e2('0x3c')]({},_0x5e7bff,_0xc3536e[_0x60e2('0x3e')]);var _0x3f6cb4={'where':_0x5e7bff['where']};return db['SugarcrmConfiguration'][_0x60e2('0x1c')](_0x3f6cb4)[_0x60e2('0x23')](function(_0xd658a5){_0xe7d5d1[_0x60e2('0x1c')]=_0xd658a5;if(_0xc3536e[_0x60e2('0x2f')]['includeAll']){_0x5e7bff[_0x60e2('0x3f')]=[{'all':!![]}];}return db[_0x60e2('0x2a')][_0x60e2('0x40')](_0x5e7bff);})['then'](function(_0xe07e20){_0xe7d5d1[_0x60e2('0x41')]=_0xe07e20;return _0xe7d5d1;})[_0x60e2('0x23')](respondWithFilteredResult(_0x5df149,_0x5e7bff))['catch'](handleError(_0x5df149,null));};exports['show']=function(_0x429316,_0x3e275b){var _0x5381c7={'raw':![],'where':{'id':_0x429316[_0x60e2('0x42')]['id']}},_0x3ffc99={};_0x3ffc99[_0x60e2('0x2e')]=_[_0x60e2('0x30')](db[_0x60e2('0x2a')][_0x60e2('0x43')]);_0x3ffc99[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0x429316['query']);_0x3ffc99[_0x60e2('0x31')]=_['intersection'](_0x3ffc99['model'],_0x3ffc99[_0x60e2('0x2f')]);_0x5381c7[_0x60e2('0x32')]=_[_0x60e2('0x44')](_0x3ffc99[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0x429316[_0x60e2('0x2f')][_0x60e2('0x33')]));_0x5381c7['attributes']=_0x5381c7[_0x60e2('0x32')][_0x60e2('0x34')]?_0x5381c7['attributes']:_0x3ffc99[_0x60e2('0x2e')];if(_0x429316[_0x60e2('0x2f')][_0x60e2('0x45')]){_0x5381c7[_0x60e2('0x3f')]=[{'all':!![]}];}_0x5381c7=_[_0x60e2('0x3c')]({},_0x5381c7,_0x429316['options']);return db[_0x60e2('0x2a')][_0x60e2('0x46')](_0x5381c7)[_0x60e2('0x23')](handleEntityNotFound(_0x3e275b,null))['then'](respondWithResult(_0x3e275b,null))[_0x60e2('0x47')](handleError(_0x3e275b,null));};exports[_0x60e2('0x48')]=function(_0x2b9cad,_0x3c772d){return db[_0x60e2('0x2a')][_0x60e2('0x48')](_0x2b9cad[_0x60e2('0x49')],{})[_0x60e2('0x23')](respondWithResult(_0x3c772d,0xc9))[_0x60e2('0x47')](handleError(_0x3c772d,null));};exports[_0x60e2('0x22')]=function(_0x4d01b2,_0x3e7173){if(_0x4d01b2[_0x60e2('0x49')]['id']){delete _0x4d01b2[_0x60e2('0x49')]['id'];}return db[_0x60e2('0x2a')]['find']({'where':{'id':_0x4d01b2[_0x60e2('0x42')]['id']}})[_0x60e2('0x23')](handleEntityNotFound(_0x3e7173,null))['then'](saveUpdates(_0x4d01b2['body'],null))[_0x60e2('0x23')](respondWithResult(_0x3e7173,null))['catch'](handleError(_0x3e7173,null));};exports[_0x60e2('0x4a')]=function(_0x171206,_0x25b0b3){return db[_0x60e2('0x2a')][_0x60e2('0x46')]({'where':{'id':_0x171206[_0x60e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x25b0b3,null))[_0x60e2('0x23')](removeEntity(_0x25b0b3,null))[_0x60e2('0x47')](handleError(_0x25b0b3,null));};exports[_0x60e2('0x4b')]=function(_0x2b3a1d,_0x47836a,_0x112e5c){var _0x5b06c0={};var _0x3e1a0a={};var _0x4002fc;var _0x1ae672;return db[_0x60e2('0x2a')][_0x60e2('0x4c')]({'where':{'id':_0x2b3a1d[_0x60e2('0x42')]['id']}})[_0x60e2('0x23')](handleEntityNotFound(_0x47836a,null))[_0x60e2('0x23')](function(_0xbfa673){if(_0xbfa673){_0x4002fc=_0xbfa673;_0x3e1a0a[_0x60e2('0x2e')]=_[_0x60e2('0x30')](db[_0x60e2('0x4d')][_0x60e2('0x43')]);_0x3e1a0a[_0x60e2('0x2f')]=_['keys'](_0x2b3a1d[_0x60e2('0x2f')]);_0x3e1a0a['filters']=_[_0x60e2('0x44')](_0x3e1a0a[_0x60e2('0x2e')],_0x3e1a0a[_0x60e2('0x2f')]);_0x5b06c0[_0x60e2('0x32')]=_[_0x60e2('0x44')](_0x3e1a0a[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x33')]));_0x5b06c0[_0x60e2('0x32')]=_0x5b06c0[_0x60e2('0x32')][_0x60e2('0x34')]?_0x5b06c0[_0x60e2('0x32')]:_0x3e1a0a[_0x60e2('0x2e')];_0x5b06c0['order']=qs[_0x60e2('0x38')](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x38')]);_0x5b06c0[_0x60e2('0x3b')]=qs[_0x60e2('0x31')](_['pick'](_0x2b3a1d[_0x60e2('0x2f')],_0x3e1a0a[_0x60e2('0x31')]));if(_0x2b3a1d[_0x60e2('0x2f')]['filter']){_0x5b06c0[_0x60e2('0x3b')]=_['merge'](_0x5b06c0[_0x60e2('0x3b')],{'$or':_[_0x60e2('0x29')](_0x5b06c0[_0x60e2('0x32')],function(_0x4185a3){var _0x1400f2={};_0x1400f2[_0x4185a3]={'$like':'%'+_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x3a')]+'%'};return _0x1400f2;})});}_0x5b06c0=_['merge']({},_0x5b06c0,_0x2b3a1d['options']);return _0x4002fc['getFields'](_0x5b06c0);}})[_0x60e2('0x23')](function(_0x55e61c){if(_0x55e61c){_0x1ae672=_0x55e61c[_0x60e2('0x34')];if(!_0x2b3a1d[_0x60e2('0x2f')]['hasOwnProperty'](_0x60e2('0x36'))){_0x5b06c0[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x5b06c0[_0x60e2('0x1a')]=qs['offset'](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x1a')]);}return _0x4002fc['getFields'](_0x5b06c0);}})[_0x60e2('0x23')](function(_0x54be52){if(_0x54be52){return _0x54be52?{'count':_0x1ae672,'rows':_0x54be52}:null;}})[_0x60e2('0x23')](respondWithResult(_0x47836a,null))[_0x60e2('0x47')](handleError(_0x47836a,null));};exports[_0x60e2('0x4e')]=function(_0xf990c9,_0x65c8f2,_0x1b9e01){var _0x442084={};var _0x527ee1={};var _0x48b235;var _0x59f370;return db[_0x60e2('0x2a')][_0x60e2('0x4c')]({'where':{'id':_0xf990c9[_0x60e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x65c8f2,null))[_0x60e2('0x23')](function(_0x238588){if(_0x238588){_0x48b235=_0x238588;_0x527ee1['model']=_['keys'](db[_0x60e2('0x4d')][_0x60e2('0x43')]);_0x527ee1[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0xf990c9['query']);_0x527ee1['filters']=_['intersection'](_0x527ee1['model'],_0x527ee1[_0x60e2('0x2f')]);_0x442084['attributes']=_[_0x60e2('0x44')](_0x527ee1[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0xf990c9['query'][_0x60e2('0x33')]));_0x442084[_0x60e2('0x32')]=_0x442084[_0x60e2('0x32')][_0x60e2('0x34')]?_0x442084[_0x60e2('0x32')]:_0x527ee1[_0x60e2('0x2e')];_0x442084[_0x60e2('0x37')]=qs[_0x60e2('0x38')](_0xf990c9['query'][_0x60e2('0x38')]);_0x442084['where']=qs[_0x60e2('0x31')](_[_0x60e2('0x39')](_0xf990c9['query'],_0x527ee1[_0x60e2('0x31')]));if(_0xf990c9[_0x60e2('0x2f')][_0x60e2('0x3a')]){_0x442084[_0x60e2('0x3b')]=_[_0x60e2('0x3c')](_0x442084[_0x60e2('0x3b')],{'$or':_[_0x60e2('0x29')](_0x442084[_0x60e2('0x32')],function(_0x186301){var _0xd5325d={};_0xd5325d[_0x186301]={'$like':'%'+_0xf990c9[_0x60e2('0x2f')]['filter']+'%'};return _0xd5325d;})});}_0x442084=_[_0x60e2('0x3c')]({},_0x442084,_0xf990c9[_0x60e2('0x3e')]);return _0x48b235[_0x60e2('0x4e')](_0x442084);}})[_0x60e2('0x23')](function(_0x3ff89f){if(_0x3ff89f){_0x59f370=_0x3ff89f[_0x60e2('0x34')];if(!_0xf990c9[_0x60e2('0x2f')]['hasOwnProperty'](_0x60e2('0x36'))){_0x442084[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0xf990c9[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x442084[_0x60e2('0x1a')]=qs[_0x60e2('0x1a')](_0xf990c9[_0x60e2('0x2f')][_0x60e2('0x1a')]);}return _0x48b235[_0x60e2('0x4e')](_0x442084);}})[_0x60e2('0x23')](function(_0x5c65cd){if(_0x5c65cd){return _0x5c65cd?{'count':_0x59f370,'rows':_0x5c65cd}:null;}})[_0x60e2('0x23')](respondWithResult(_0x65c8f2,null))[_0x60e2('0x47')](handleError(_0x65c8f2,null));};exports['getDescriptions']=function(_0x4e979a,_0x438d06,_0x513539){var _0x222df0={};var _0xf7222c={};var _0x5ce096;var _0x4d2a90;return db[_0x60e2('0x2a')][_0x60e2('0x4c')]({'where':{'id':_0x4e979a[_0x60e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x438d06,null))[_0x60e2('0x23')](function(_0x44d376){if(_0x44d376){_0x5ce096=_0x44d376;_0xf7222c[_0x60e2('0x2e')]=_['keys'](db[_0x60e2('0x4d')][_0x60e2('0x43')]);_0xf7222c[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0x4e979a['query']);_0xf7222c[_0x60e2('0x31')]=_[_0x60e2('0x44')](_0xf7222c[_0x60e2('0x2e')],_0xf7222c[_0x60e2('0x2f')]);_0x222df0[_0x60e2('0x32')]=_[_0x60e2('0x44')](_0xf7222c[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0x4e979a['query'][_0x60e2('0x33')]));_0x222df0['attributes']=_0x222df0[_0x60e2('0x32')]['length']?_0x222df0[_0x60e2('0x32')]:_0xf7222c['model'];_0x222df0[_0x60e2('0x37')]=qs[_0x60e2('0x38')](_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x38')]);_0x222df0[_0x60e2('0x3b')]=qs[_0x60e2('0x31')](_[_0x60e2('0x39')](_0x4e979a['query'],_0xf7222c[_0x60e2('0x31')]));if(_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x3a')]){_0x222df0[_0x60e2('0x3b')]=_[_0x60e2('0x3c')](_0x222df0[_0x60e2('0x3b')],{'$or':_[_0x60e2('0x29')](_0x222df0[_0x60e2('0x32')],function(_0x33c41a){var _0x5f9728={};_0x5f9728[_0x33c41a]={'$like':'%'+_0x4e979a['query'][_0x60e2('0x3a')]+'%'};return _0x5f9728;})});}_0x222df0=_[_0x60e2('0x3c')]({},_0x222df0,_0x4e979a[_0x60e2('0x3e')]);return _0x5ce096[_0x60e2('0x4f')](_0x222df0);}})[_0x60e2('0x23')](function(_0x19051d){if(_0x19051d){_0x4d2a90=_0x19051d[_0x60e2('0x34')];if(!_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x35')](_0x60e2('0x36'))){_0x222df0[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x222df0['offset']=qs[_0x60e2('0x1a')](_0x4e979a[_0x60e2('0x2f')]['offset']);}return _0x5ce096[_0x60e2('0x4f')](_0x222df0);}})['then'](function(_0x44e512){if(_0x44e512){return _0x44e512?{'count':_0x4d2a90,'rows':_0x44e512}:null;}})[_0x60e2('0x23')](respondWithResult(_0x438d06,null))[_0x60e2('0x47')](handleError(_0x438d06,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 77f12f6..c8ca621 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 _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 +var _0x1340=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2627e4,_0x1a02e0){var _0x102358=function(_0x369701){while(--_0x369701){_0x2627e4['push'](_0x2627e4['shift']());}};_0x102358(++_0x1a02e0);}(_0x1340,0xa1));var _0x0134=function(_0x51def8,_0x21d4ac){_0x51def8=_0x51def8-0x0;var _0x4455ff=_0x1340[_0x51def8];return _0x4455ff;};'use strict';var _=require(_0x0134('0x0'));var util=require(_0x0134('0x1'));var logger=require(_0x0134('0x2'))(_0x0134('0x3'));var moment=require(_0x0134('0x4'));var BPromise=require('bluebird');var rp=require(_0x0134('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0134('0x6'));var config=require(_0x0134('0x7'));var attributes=require(_0x0134('0x8'));module[_0x0134('0x9')]=function(_0x1e790b,_0x195f28){return _0x1e790b[_0x0134('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x0134('0xb'),'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 71f00b5..5a59e80 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 _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 +var _0xa51f=['rpc','../../config/environment','jayson/promise','client','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a09f3,_0x55835f){var _0x4bf28c=function(_0x543041){while(--_0x543041){_0x1a09f3['push'](_0x1a09f3['shift']());}};_0x4bf28c(++_0x55835f);}(_0xa51f,0x12f));var _0xfa51=function(_0x4b4ce5,_0x573d2d){_0x4b4ce5=_0x4b4ce5-0x0;var _0x6522f3=_0xa51f[_0x4b4ce5];return _0x6522f3;};'use strict';var _=require(_0xfa51('0x0'));var util=require(_0xfa51('0x1'));var moment=require(_0xfa51('0x2'));var BPromise=require(_0xfa51('0x3'));var rs=require(_0xfa51('0x4'));var fs=require('fs');var Redis=require(_0xfa51('0x5'));var db=require(_0xfa51('0x6'))['db'];var utils=require(_0xfa51('0x7'));var logger=require(_0xfa51('0x8'))(_0xfa51('0x9'));var config=require(_0xfa51('0xa'));var jayson=require(_0xfa51('0xb'));var client=jayson[_0xfa51('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44714c,_0x4557ed,_0x1dcaab){return new BPromise(function(_0x3d13cd,_0x299f06){return client['request'](_0x44714c,_0x1dcaab)[_0xfa51('0xd')](function(_0x2d5067){logger['info'](_0xfa51('0xe'),_0x4557ed,_0xfa51('0xf'));logger['debug'](_0xfa51('0x10'),_0x4557ed,_0xfa51('0xf'),JSON[_0xfa51('0x11')](_0x2d5067));if(_0x2d5067[_0xfa51('0x12')]){if(_0x2d5067[_0xfa51('0x12')][_0xfa51('0x13')]===0x1f4){logger[_0xfa51('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4557ed,_0x2d5067['error'][_0xfa51('0x14')]);return _0x299f06(_0x2d5067['error'][_0xfa51('0x14')]);}logger['error'](_0xfa51('0xe'),_0x4557ed,_0x2d5067[_0xfa51('0x12')]['message']);return _0x3d13cd(_0x2d5067[_0xfa51('0x12')][_0xfa51('0x14')]);}else{logger[_0xfa51('0x15')](_0xfa51('0xe'),_0x4557ed,_0xfa51('0xf'));_0x3d13cd(_0x2d5067[_0xfa51('0x16')]['message']);}})[_0xfa51('0x17')](function(_0x52194a){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4557ed,_0x52194a);_0x299f06(_0x52194a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1795752..d2546c9 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 _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 +var _0x9846=['isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get'];(function(_0x3d797c,_0x2c994d){var _0x385aab=function(_0x34ee54){while(--_0x34ee54){_0x3d797c['push'](_0x3d797c['shift']());}};_0x385aab(++_0x2c994d);}(_0x9846,0x13a));var _0x6984=function(_0x2cd8b9,_0x285479){_0x2cd8b9=_0x2cd8b9-0x0;var _0x54d956=_0x9846[_0x2cd8b9];return _0x54d956;};'use strict';var multer=require(_0x6984('0x0'));var util=require(_0x6984('0x1'));var path=require(_0x6984('0x2'));var timeout=require('connect-timeout');var express=require(_0x6984('0x3'));var router=express[_0x6984('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6984('0x5'));var interaction=require(_0x6984('0x6'));var config=require('../../config/environment');var controller=require(_0x6984('0x7'));router[_0x6984('0x8')]('/',auth[_0x6984('0x9')](),controller['index']);router['get']('/:id',auth[_0x6984('0x9')](),controller[_0x6984('0xa')]);router[_0x6984('0xb')]('/',auth['isAuthenticated'](),controller[_0x6984('0xc')]);router[_0x6984('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6984('0xe')]);router[_0x6984('0xf')](_0x6984('0x10'),auth[_0x6984('0x9')](),controller[_0x6984('0x11')]);module[_0x6984('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 920ab46..4a4aa9e 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 _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 +var _0x19af=['exports','ENUM','string','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0xd60720,_0x30c5b7){var _0x1684dd=function(_0x3b2c35){while(--_0x3b2c35){_0xd60720['push'](_0xd60720['shift']());}};_0x1684dd(++_0x30c5b7);}(_0x19af,0x17f));var _0xf19a=function(_0x2a04c9,_0x391d1d){_0x2a04c9=_0x2a04c9-0x0;var _0x52a437=_0x19af[_0x2a04c9];return _0x52a437;};'use strict';var Sequelize=require(_0xf19a('0x0'));module[_0xf19a('0x1')]={'type':{'type':Sequelize[_0xf19a('0x2')]('string','variable','customVariable','keyValue','picklist'),'defaultValue':_0xf19a('0x3')},'content':{'type':Sequelize[_0xf19a('0x4')]},'key':{'type':Sequelize[_0xf19a('0x4')]},'keyType':{'type':Sequelize[_0xf19a('0x2')](_0xf19a('0x3'),_0xf19a('0x5'),_0xf19a('0x6'))},'keyContent':{'type':Sequelize[_0xf19a('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf19a('0x4')]},'customField':{'type':Sequelize[_0xf19a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf19a('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3d3c569..16133ba 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 _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 +var _0x03ba=['bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SugarcrmField','include','findAll','rows','includeAll','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3e1eee,_0x202435){var _0x234779=function(_0xee00a1){while(--_0xee00a1){_0x3e1eee['push'](_0x3e1eee['shift']());}};_0x234779(++_0x202435);}(_0x03ba,0x88));var _0xa03b=function(_0x4e617e,_0x2f1088){_0x4e617e=_0x4e617e-0x0;var _0x1fcd72=_0x03ba[_0x4e617e];return _0x1fcd72;};'use strict';var emlformat=require(_0xa03b('0x0'));var rimraf=require(_0xa03b('0x1'));var zipdir=require(_0xa03b('0x2'));var jsonpatch=require(_0xa03b('0x3'));var rp=require(_0xa03b('0x4'));var moment=require(_0xa03b('0x5'));var BPromise=require(_0xa03b('0x6'));var Mustache=require('mustache');var util=require(_0xa03b('0x7'));var path=require(_0xa03b('0x8'));var sox=require(_0xa03b('0x9'));var csv=require('to-csv');var ejs=require(_0xa03b('0xa'));var fs=require('fs');var fs_extra=require(_0xa03b('0xb'));var _=require('lodash');var squel=require(_0xa03b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa03b('0xd'));var deskjs=require(_0xa03b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa03b('0xf'));var Papa=require('papaparse');var Redis=require(_0xa03b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa03b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa03b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa03b('0x13'));var db=require(_0xa03b('0x14'))['db'];function respondWithStatusCode(_0x480b63,_0x3c46c8){_0x3c46c8=_0x3c46c8||0xcc;return function(_0x19395c){if(_0x19395c){return _0x480b63['sendStatus'](_0x3c46c8);}return _0x480b63[_0xa03b('0x15')](_0x3c46c8)['end']();};}function respondWithResult(_0x2356a6,_0x34cfd4){_0x34cfd4=_0x34cfd4||0xc8;return function(_0x358ab4){if(_0x358ab4){return _0x2356a6['status'](_0x34cfd4)[_0xa03b('0x16')](_0x358ab4);}};}function respondWithFilteredResult(_0x42d93b,_0xd5aa71){return function(_0x4fa277){if(_0x4fa277){var _0x53024f=typeof _0xd5aa71['offset']===_0xa03b('0x17')&&typeof _0xd5aa71[_0xa03b('0x18')]===_0xa03b('0x17');var _0x5c3baa=_0x4fa277['count'];var _0x3d06c2=_0x53024f?0x0:_0xd5aa71[_0xa03b('0x19')];var _0x57afde=_0x53024f?_0x4fa277[_0xa03b('0x1a')]:_0xd5aa71[_0xa03b('0x19')]+_0xd5aa71[_0xa03b('0x18')];var _0x7ba666;if(_0x57afde>=_0x5c3baa){_0x57afde=_0x5c3baa;_0x7ba666=0xc8;}else{_0x7ba666=0xce;}_0x42d93b['status'](_0x7ba666);return _0x42d93b[_0xa03b('0x1b')](_0xa03b('0x1c'),_0x3d06c2+'-'+_0x57afde+'/'+_0x5c3baa)['json'](_0x4fa277);}return null;};}function patchUpdates(_0x6ccd5f){return function(_0x41bd7e){try{jsonpatch[_0xa03b('0x1d')](_0x41bd7e,_0x6ccd5f,!![]);}catch(_0x1a27a6){return BPromise['reject'](_0x1a27a6);}return _0x41bd7e[_0xa03b('0x1e')]();};}function saveUpdates(_0x9de565,_0x44e286){return function(_0x2802b5){if(_0x2802b5){return _0x2802b5['update'](_0x9de565)[_0xa03b('0x1f')](function(_0x28ba5d){return _0x28ba5d;});}return null;};}function removeEntity(_0x1e53d7,_0x1ba86e){return function(_0x3d81ee){if(_0x3d81ee){return _0x3d81ee[_0xa03b('0x20')]()[_0xa03b('0x1f')](function(){_0x1e53d7[_0xa03b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x434756,_0x202b96){return function(_0x14f1d1){if(!_0x14f1d1){_0x434756[_0xa03b('0x21')](0x194);}return _0x14f1d1;};}function handleError(_0x204750,_0x44962f){_0x44962f=_0x44962f||0x1f4;return function(_0x1e5b2c){logger[_0xa03b('0x22')](_0x1e5b2c[_0xa03b('0x23')]);if(_0x1e5b2c[_0xa03b('0x24')]){delete _0x1e5b2c['name'];}_0x204750[_0xa03b('0x15')](_0x44962f)[_0xa03b('0x25')](_0x1e5b2c);};}exports[_0xa03b('0x26')]=function(_0x171f34,_0x1eab77){var _0x2ecfc1={},_0x5d8244={},_0x2e437c={'count':0x0,'rows':[]};var _0xb43a65=_[_0xa03b('0x27')](db['SugarcrmField'][_0xa03b('0x28')],function(_0x261325){return{'name':_0x261325[_0xa03b('0x29')],'type':_0x261325[_0xa03b('0x2a')][_0xa03b('0x2b')]};});_0x5d8244[_0xa03b('0x2c')]=_['map'](_0xb43a65,_0xa03b('0x24'));_0x5d8244[_0xa03b('0x2d')]=_[_0xa03b('0x2e')](_0x171f34[_0xa03b('0x2d')]);_0x5d8244[_0xa03b('0x2f')]=_[_0xa03b('0x30')](_0x5d8244[_0xa03b('0x2c')],_0x5d8244[_0xa03b('0x2d')]);_0x2ecfc1[_0xa03b('0x31')]=_[_0xa03b('0x30')](_0x5d8244[_0xa03b('0x2c')],qs['fields'](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x32')]));_0x2ecfc1['attributes']=_0x2ecfc1[_0xa03b('0x31')]['length']?_0x2ecfc1['attributes']:_0x5d8244[_0xa03b('0x2c')];if(!_0x171f34['query'][_0xa03b('0x33')](_0xa03b('0x34'))){_0x2ecfc1['limit']=qs[_0xa03b('0x18')](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x18')]);_0x2ecfc1['offset']=qs[_0xa03b('0x19')](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x19')]);}_0x2ecfc1[_0xa03b('0x35')]=qs[_0xa03b('0x36')](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x36')]);_0x2ecfc1[_0xa03b('0x37')]=qs[_0xa03b('0x2f')](_[_0xa03b('0x38')](_0x171f34[_0xa03b('0x2d')],_0x5d8244[_0xa03b('0x2f')]),_0xb43a65);if(_0x171f34[_0xa03b('0x2d')][_0xa03b('0x39')]){_0x2ecfc1['where']=_[_0xa03b('0x3a')](_0x2ecfc1['where'],{'$or':_[_0xa03b('0x27')](_0xb43a65,function(_0x17d4b5){if(_0x17d4b5[_0xa03b('0x2a')]!=='VIRTUAL'){var _0x45718c={};_0x45718c[_0x17d4b5[_0xa03b('0x24')]]={'$like':'%'+_0x171f34[_0xa03b('0x2d')][_0xa03b('0x39')]+'%'};return _0x45718c;}})});}_0x2ecfc1=_[_0xa03b('0x3a')]({},_0x2ecfc1,_0x171f34['options']);var _0x6e3d4c={'where':_0x2ecfc1['where']};return db[_0xa03b('0x3b')][_0xa03b('0x1a')](_0x6e3d4c)[_0xa03b('0x1f')](function(_0x3951e1){_0x2e437c[_0xa03b('0x1a')]=_0x3951e1;if(_0x171f34[_0xa03b('0x2d')]['includeAll']){_0x2ecfc1[_0xa03b('0x3c')]=[{'all':!![]}];}return db[_0xa03b('0x3b')][_0xa03b('0x3d')](_0x2ecfc1);})[_0xa03b('0x1f')](function(_0x44ba67){_0x2e437c[_0xa03b('0x3e')]=_0x44ba67;return _0x2e437c;})[_0xa03b('0x1f')](respondWithFilteredResult(_0x1eab77,_0x2ecfc1))['catch'](handleError(_0x1eab77,null));};exports['show']=function(_0x3f9f8b,_0x37deb3){var _0x1959b2={'raw':!![],'where':{'id':_0x3f9f8b['params']['id']}},_0x33753a={};_0x33753a[_0xa03b('0x2c')]=_[_0xa03b('0x2e')](db['SugarcrmField']['rawAttributes']);_0x33753a['query']=_[_0xa03b('0x2e')](_0x3f9f8b[_0xa03b('0x2d')]);_0x33753a[_0xa03b('0x2f')]=_['intersection'](_0x33753a[_0xa03b('0x2c')],_0x33753a['query']);_0x1959b2['attributes']=_[_0xa03b('0x30')](_0x33753a[_0xa03b('0x2c')],qs['fields'](_0x3f9f8b['query'][_0xa03b('0x32')]));_0x1959b2[_0xa03b('0x31')]=_0x1959b2[_0xa03b('0x31')]['length']?_0x1959b2[_0xa03b('0x31')]:_0x33753a[_0xa03b('0x2c')];if(_0x3f9f8b[_0xa03b('0x2d')][_0xa03b('0x3f')]){_0x1959b2[_0xa03b('0x3c')]=[{'all':!![]}];}_0x1959b2=_[_0xa03b('0x3a')]({},_0x1959b2,_0x3f9f8b[_0xa03b('0x40')]);return db['SugarcrmField'][_0xa03b('0x41')](_0x1959b2)[_0xa03b('0x1f')](handleEntityNotFound(_0x37deb3,null))['then'](respondWithResult(_0x37deb3,null))[_0xa03b('0x42')](handleError(_0x37deb3,null));};exports[_0xa03b('0x43')]=function(_0x591778,_0x225513){return db['SugarcrmField'][_0xa03b('0x43')](_0x591778[_0xa03b('0x44')],{})[_0xa03b('0x1f')](respondWithResult(_0x225513,0xc9))['catch'](handleError(_0x225513,null));};exports[_0xa03b('0x45')]=function(_0x30e891,_0x3d28fd){if(_0x30e891['body']['id']){delete _0x30e891[_0xa03b('0x44')]['id'];}return db[_0xa03b('0x3b')][_0xa03b('0x41')]({'where':{'id':_0x30e891['params']['id']}})['then'](handleEntityNotFound(_0x3d28fd,null))[_0xa03b('0x1f')](saveUpdates(_0x30e891[_0xa03b('0x44')],null))[_0xa03b('0x1f')](respondWithResult(_0x3d28fd,null))[_0xa03b('0x42')](handleError(_0x3d28fd,null));};exports[_0xa03b('0x20')]=function(_0x293703,_0x4cacba){return db['SugarcrmField'][_0xa03b('0x41')]({'where':{'id':_0x293703[_0xa03b('0x46')]['id']}})[_0xa03b('0x1f')](handleEntityNotFound(_0x4cacba,null))['then'](removeEntity(_0x4cacba,null))['catch'](handleError(_0x4cacba,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 3186d18..6a40de8 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 _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 +var _0x4339=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x337216,_0x4184e2){var _0x113fdb=function(_0x34e656){while(--_0x34e656){_0x337216['push'](_0x337216['shift']());}};_0x113fdb(++_0x4184e2);}(_0x4339,0x1f0));var _0x9433=function(_0x44a862,_0xf79730){_0x44a862=_0x44a862-0x0;var _0x113b35=_0x4339[_0x44a862];return _0x113b35;};'use strict';var _=require(_0x9433('0x0'));var util=require('util');var logger=require(_0x9433('0x1'))(_0x9433('0x2'));var moment=require(_0x9433('0x3'));var BPromise=require(_0x9433('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9433('0x5'));var rimraf=require(_0x9433('0x6'));var config=require(_0x9433('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x889fcb,_0x46ba05){return _0x889fcb['define'](_0x9433('0x8'),attributes,{'tableName':_0x9433('0x9'),'paranoid':![],'indexes':[{'name':_0x9433('0xa'),'fields':[_0x9433('0xb'),_0x9433('0xc')],'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 547a2ce..78468d1 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 _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 +var _0xbea6=['error','message','info','result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1c1509,_0x2dfa81){var _0xf11b7=function(_0x17949e){while(--_0x17949e){_0x1c1509['push'](_0x1c1509['shift']());}};_0xf11b7(++_0x2dfa81);}(_0xbea6,0xb8));var _0x6bea=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xbea6[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x6bea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6bea('0x1'));var rs=require(_0x6bea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6bea('0x3'));var logger=require(_0x6bea('0x4'))(_0x6bea('0x5'));var config=require(_0x6bea('0x6'));var jayson=require(_0x6bea('0x7'));var client=jayson[_0x6bea('0x8')][_0x6bea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371ce8,_0x89a7a5,_0x1bc49e){return new BPromise(function(_0x35b910,_0x12f8a6){return client[_0x6bea('0xa')](_0x371ce8,_0x1bc49e)['then'](function(_0x3d0c19){logger['info'](_0x6bea('0xb'),_0x89a7a5,_0x6bea('0xc'));logger[_0x6bea('0xd')](_0x6bea('0xe'),_0x89a7a5,_0x6bea('0xc'),JSON[_0x6bea('0xf')](_0x3d0c19));if(_0x3d0c19['error']){if(_0x3d0c19[_0x6bea('0x10')]['code']===0x1f4){logger['error'](_0x6bea('0xb'),_0x89a7a5,_0x3d0c19[_0x6bea('0x10')][_0x6bea('0x11')]);return _0x12f8a6(_0x3d0c19[_0x6bea('0x10')][_0x6bea('0x11')]);}logger[_0x6bea('0x10')](_0x6bea('0xb'),_0x89a7a5,_0x3d0c19['error'][_0x6bea('0x11')]);return _0x35b910(_0x3d0c19['error']['message']);}else{logger[_0x6bea('0x12')](_0x6bea('0xb'),_0x89a7a5,_0x6bea('0xc'));_0x35b910(_0x3d0c19[_0x6bea('0x13')][_0x6bea('0x11')]);}})['catch'](function(_0x3252de){logger[_0x6bea('0x10')](_0x6bea('0xb'),_0x89a7a5,_0x3252de);_0x12f8a6(_0x3252de);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 35a3f6f..ede1a57 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 _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 +var _0x925e=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id'];(function(_0x17633a,_0xf7f335){var _0x55c40b=function(_0x13863b){while(--_0x13863b){_0x17633a['push'](_0x17633a['shift']());}};_0x55c40b(++_0xf7f335);}(_0x925e,0x199));var _0xe925=function(_0x342186,_0x24596f){_0x342186=_0x342186-0x0;var _0x58fd4a=_0x925e[_0x342186];return _0x58fd4a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe925('0x0'));var timeout=require(_0xe925('0x1'));var express=require(_0xe925('0x2'));var router=express['Router']();var fs_extra=require(_0xe925('0x3'));var auth=require(_0xe925('0x4'));var interaction=require(_0xe925('0x5'));var config=require(_0xe925('0x6'));var controller=require(_0xe925('0x7'));router[_0xe925('0x8')]('/',auth[_0xe925('0x9')](),controller[_0xe925('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe925('0xb')]);router['get'](_0xe925('0xc'),auth['isAuthenticated'](),controller[_0xe925('0xd')]);router[_0xe925('0x8')](_0xe925('0xe'),auth[_0xe925('0x9')](),controller[_0xe925('0xf')]);router[_0xe925('0x10')]('/',auth[_0xe925('0x9')](),controller[_0xe925('0x11')]);router[_0xe925('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe925('0x12')]);router[_0xe925('0x13')]('/:id',auth[_0xe925('0x9')](),controller[_0xe925('0x14')]);router[_0xe925('0x15')](_0xe925('0x16'),auth[_0xe925('0x9')](),controller['destroy']);module[_0xe925('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a6ad263..b8913f9 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 _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 +var _0x907b=['exports','STRING'];(function(_0x2e708c,_0x5eaa80){var _0x71f836=function(_0x57121a){while(--_0x57121a){_0x2e708c['push'](_0x2e708c['shift']());}};_0x71f836(++_0x5eaa80);}(_0x907b,0x150));var _0xb907=function(_0x444f91,_0x2a61f2){_0x444f91=_0x444f91-0x0;var _0x3248ab=_0x907b[_0x444f91];return _0x3248ab;};'use strict';var Sequelize=require('sequelize');module[_0xb907('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb907('0x1')]},'username':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb907('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 414e4d1..f2954c3 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 _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 +var _0x4aaf=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','error','name','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','options','find','create','body','update','findOne','pick','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','success','GET','describe','sessionName','reference','owner','remove','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','send','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x5047de,_0x3a2b23){var _0x516bb3=function(_0x3d279d){while(--_0x3d279d){_0x5047de['push'](_0x5047de['shift']());}};_0x516bb3(++_0x3a2b23);}(_0x4aaf,0x1d8));var _0xf4aa=function(_0x192895,_0xd92c82){_0x192895=_0x192895-0x0;var _0x6d6bb=_0x4aaf[_0x192895];return _0x6d6bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4aa('0x0'));var zipdir=require(_0xf4aa('0x1'));var jsonpatch=require(_0xf4aa('0x2'));var rp=require('request-promise');var moment=require(_0xf4aa('0x3'));var BPromise=require(_0xf4aa('0x4'));var Mustache=require(_0xf4aa('0x5'));var util=require(_0xf4aa('0x6'));var path=require(_0xf4aa('0x7'));var sox=require(_0xf4aa('0x8'));var csv=require(_0xf4aa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4aa('0xa'));var squel=require(_0xf4aa('0xb'));var crypto=require('crypto');var jsforce=require(_0xf4aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf4aa('0x9'));var querystring=require(_0xf4aa('0xd'));var Papa=require(_0xf4aa('0xe'));var Redis=require(_0xf4aa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf4aa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4aa('0x11'));var logger=require(_0xf4aa('0x12'))(_0xf4aa('0x13'));var utils=require(_0xf4aa('0x14'));var config=require(_0xf4aa('0x15'));var licenseUtil=require(_0xf4aa('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf4aa('0x17'));function respondWithStatusCode(_0x46ef3e,_0x3c198f){_0x3c198f=_0x3c198f||0xcc;return function(_0x3ab046){if(_0x3ab046){return _0x46ef3e[_0xf4aa('0x18')](_0x3c198f);}return _0x46ef3e[_0xf4aa('0x19')](_0x3c198f)[_0xf4aa('0x1a')]();};}function respondWithResult(_0x8cc882,_0x10b7f3){_0x10b7f3=_0x10b7f3||0xc8;return function(_0x2b283e){if(_0x2b283e){return _0x8cc882['status'](_0x10b7f3)[_0xf4aa('0x1b')](_0x2b283e);}};}function respondWithFilteredResult(_0x4e6794,_0x70776a){return function(_0x31309d){if(_0x31309d){var _0x426b56=typeof _0x70776a['offset']===_0xf4aa('0x1c')&&typeof _0x70776a[_0xf4aa('0x1d')]===_0xf4aa('0x1c');var _0x2f9120=_0x31309d['count'];var _0x22f289=_0x426b56?0x0:_0x70776a[_0xf4aa('0x1e')];var _0x552c63=_0x426b56?_0x31309d[_0xf4aa('0x1f')]:_0x70776a[_0xf4aa('0x1e')]+_0x70776a[_0xf4aa('0x1d')];var _0x37908f;if(_0x552c63>=_0x2f9120){_0x552c63=_0x2f9120;_0x37908f=0xc8;}else{_0x37908f=0xce;}_0x4e6794[_0xf4aa('0x19')](_0x37908f);return _0x4e6794[_0xf4aa('0x20')](_0xf4aa('0x21'),_0x22f289+'-'+_0x552c63+'/'+_0x2f9120)['json'](_0x31309d);}return null;};}function patchUpdates(_0x4604b9){return function(_0x41317c){try{jsonpatch[_0xf4aa('0x22')](_0x41317c,_0x4604b9,!![]);}catch(_0x482e24){return BPromise[_0xf4aa('0x23')](_0x482e24);}return _0x41317c[_0xf4aa('0x24')]();};}function saveUpdates(_0x18cd58,_0x1393af){return function(_0x338bb6){if(_0x338bb6){return _0x338bb6['update'](_0x18cd58)[_0xf4aa('0x25')](function(_0xcd71ee){return _0xcd71ee;});}return null;};}function removeEntity(_0x4f4616,_0x35ee5f){return function(_0x1cb850){if(_0x1cb850){return _0x1cb850['destroy']()['then'](function(){_0x4f4616[_0xf4aa('0x19')](0xcc)[_0xf4aa('0x1a')]();});}};}function handleEntityNotFound(_0x23b054,_0xcd97e4){return function(_0xc79c6c){if(!_0xc79c6c){_0x23b054[_0xf4aa('0x18')](0x194);}return _0xc79c6c;};}function handleError(_0x5051d4,_0x30cfd7){_0x30cfd7=_0x30cfd7||0x1f4;return function(_0x4db39d){logger[_0xf4aa('0x26')](_0x4db39d['stack']);if(_0x4db39d[_0xf4aa('0x27')]){delete _0x4db39d[_0xf4aa('0x27')];}_0x5051d4[_0xf4aa('0x19')](_0x30cfd7)['send'](_0x4db39d);};}exports['index']=function(_0x146b2a,_0xc8a66f){var _0x55a81e={},_0x2de3c6={},_0x579ccb={'count':0x0,'rows':[]};var _0xcb8a48=_[_0xf4aa('0x28')](db[_0xf4aa('0x29')][_0xf4aa('0x2a')],function(_0x45760a){return{'name':_0x45760a[_0xf4aa('0x2b')],'type':_0x45760a[_0xf4aa('0x2c')][_0xf4aa('0x2d')]};});_0x2de3c6[_0xf4aa('0x2e')]=_[_0xf4aa('0x28')](_0xcb8a48,_0xf4aa('0x27'));_0x2de3c6['query']=_['keys'](_0x146b2a[_0xf4aa('0x2f')]);_0x2de3c6[_0xf4aa('0x30')]=_[_0xf4aa('0x31')](_0x2de3c6[_0xf4aa('0x2e')],_0x2de3c6[_0xf4aa('0x2f')]);_0x55a81e[_0xf4aa('0x32')]=_[_0xf4aa('0x31')](_0x2de3c6[_0xf4aa('0x2e')],qs[_0xf4aa('0x33')](_0x146b2a[_0xf4aa('0x2f')]['fields']));_0x55a81e['attributes']=_0x55a81e[_0xf4aa('0x32')][_0xf4aa('0x34')]?_0x55a81e['attributes']:_0x2de3c6['model'];if(!_0x146b2a[_0xf4aa('0x2f')]['hasOwnProperty'](_0xf4aa('0x35'))){_0x55a81e['limit']=qs[_0xf4aa('0x1d')](_0x146b2a['query'][_0xf4aa('0x1d')]);_0x55a81e[_0xf4aa('0x1e')]=qs[_0xf4aa('0x1e')](_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x1e')]);}_0x55a81e[_0xf4aa('0x36')]=qs['sort'](_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x37')]);_0x55a81e[_0xf4aa('0x38')]=qs[_0xf4aa('0x30')](_['pick'](_0x146b2a['query'],_0x2de3c6['filters']),_0xcb8a48);if(_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x39')]){_0x55a81e['where']=_[_0xf4aa('0x3a')](_0x55a81e[_0xf4aa('0x38')],{'$or':_[_0xf4aa('0x28')](_0xcb8a48,function(_0x47a087){if(_0x47a087['type']!==_0xf4aa('0x3b')){var _0x34e1da={};_0x34e1da[_0x47a087['name']]={'$like':'%'+_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x39')]+'%'};return _0x34e1da;}})});}_0x55a81e=_[_0xf4aa('0x3a')]({},_0x55a81e,_0x146b2a['options']);var _0x153e7b={'where':_0x55a81e[_0xf4aa('0x38')]};return db[_0xf4aa('0x29')][_0xf4aa('0x1f')](_0x153e7b)[_0xf4aa('0x25')](function(_0x1f3014){_0x579ccb[_0xf4aa('0x1f')]=_0x1f3014;if(_0x146b2a['query'][_0xf4aa('0x3c')]){_0x55a81e[_0xf4aa('0x3d')]=[{'all':!![]}];}return db[_0xf4aa('0x29')]['findAll'](_0x55a81e);})[_0xf4aa('0x25')](function(_0x4f9bfa){_0x579ccb['rows']=_0x4f9bfa;return _0x579ccb;})[_0xf4aa('0x25')](respondWithFilteredResult(_0xc8a66f,_0x55a81e))[_0xf4aa('0x3e')](handleError(_0xc8a66f,null));};exports[_0xf4aa('0x3f')]=function(_0x3036e5,_0x5b40f7){var _0x15adc4={'raw':![],'where':{'id':_0x3036e5[_0xf4aa('0x40')]['id']}},_0x33d403={};_0x33d403[_0xf4aa('0x2e')]=_[_0xf4aa('0x41')](db[_0xf4aa('0x29')]['rawAttributes']);_0x33d403[_0xf4aa('0x2f')]=_[_0xf4aa('0x41')](_0x3036e5[_0xf4aa('0x2f')]);_0x33d403[_0xf4aa('0x30')]=_['intersection'](_0x33d403['model'],_0x33d403['query']);_0x15adc4[_0xf4aa('0x32')]=_['intersection'](_0x33d403[_0xf4aa('0x2e')],qs['fields'](_0x3036e5[_0xf4aa('0x2f')][_0xf4aa('0x33')]));_0x15adc4[_0xf4aa('0x32')]=_0x15adc4[_0xf4aa('0x32')][_0xf4aa('0x34')]?_0x15adc4[_0xf4aa('0x32')]:_0x33d403['model'];if(_0x3036e5[_0xf4aa('0x2f')][_0xf4aa('0x3c')]){_0x15adc4[_0xf4aa('0x3d')]=[{'all':!![]}];}_0x15adc4=_[_0xf4aa('0x3a')]({},_0x15adc4,_0x3036e5[_0xf4aa('0x42')]);return db[_0xf4aa('0x29')][_0xf4aa('0x43')](_0x15adc4)[_0xf4aa('0x25')](handleEntityNotFound(_0x5b40f7,null))[_0xf4aa('0x25')](respondWithResult(_0x5b40f7,null))['catch'](handleError(_0x5b40f7,null));};exports[_0xf4aa('0x44')]=function(_0x7c94cb,_0x81a6c3){return db['VtigerAccount'][_0xf4aa('0x44')](_0x7c94cb[_0xf4aa('0x45')],{})[_0xf4aa('0x25')](respondWithResult(_0x81a6c3,0xc9))[_0xf4aa('0x3e')](handleError(_0x81a6c3,null));};exports[_0xf4aa('0x46')]=function(_0x2ff67b,_0x2ef34f){if(_0x2ff67b[_0xf4aa('0x45')]['id']){delete _0x2ff67b['body']['id'];}return db[_0xf4aa('0x29')]['find']({'where':{'id':_0x2ff67b[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x2ef34f,null))[_0xf4aa('0x25')](saveUpdates(_0x2ff67b[_0xf4aa('0x45')],null))[_0xf4aa('0x25')](respondWithResult(_0x2ef34f,null))[_0xf4aa('0x3e')](handleError(_0x2ef34f,null));};exports['destroy']=function(_0x238649,_0x16006c){return db[_0xf4aa('0x29')][_0xf4aa('0x43')]({'where':{'id':_0x238649[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x16006c,null))['then'](removeEntity(_0x16006c,null))['catch'](handleError(_0x16006c,null));};exports['getConfigurations']=function(_0x37b6e6,_0x548437,_0x5932da){var _0x1dcd64={};var _0x492ecc={};var _0x1769b3;var _0x288475;return db[_0xf4aa('0x29')][_0xf4aa('0x47')]({'where':{'id':_0x37b6e6[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x548437,null))[_0xf4aa('0x25')](function(_0x5ceb5d){if(_0x5ceb5d){_0x1769b3=_0x5ceb5d;_0x492ecc[_0xf4aa('0x2e')]=_[_0xf4aa('0x41')](db['VtigerConfiguration'][_0xf4aa('0x2a')]);_0x492ecc[_0xf4aa('0x2f')]=_[_0xf4aa('0x41')](_0x37b6e6[_0xf4aa('0x2f')]);_0x492ecc[_0xf4aa('0x30')]=_[_0xf4aa('0x31')](_0x492ecc['model'],_0x492ecc[_0xf4aa('0x2f')]);_0x1dcd64[_0xf4aa('0x32')]=_[_0xf4aa('0x31')](_0x492ecc[_0xf4aa('0x2e')],qs[_0xf4aa('0x33')](_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x33')]));_0x1dcd64[_0xf4aa('0x32')]=_0x1dcd64[_0xf4aa('0x32')][_0xf4aa('0x34')]?_0x1dcd64[_0xf4aa('0x32')]:_0x492ecc['model'];_0x1dcd64[_0xf4aa('0x36')]=qs[_0xf4aa('0x37')](_0x37b6e6['query'][_0xf4aa('0x37')]);_0x1dcd64[_0xf4aa('0x38')]=qs[_0xf4aa('0x30')](_[_0xf4aa('0x48')](_0x37b6e6[_0xf4aa('0x2f')],_0x492ecc[_0xf4aa('0x30')]));if(_0x37b6e6['query'][_0xf4aa('0x39')]){_0x1dcd64['where']=_[_0xf4aa('0x3a')](_0x1dcd64['where'],{'$or':_['map'](_0x1dcd64['attributes'],function(_0x337afe){var _0x4c754e={};_0x4c754e[_0x337afe]={'$like':'%'+_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x39')]+'%'};return _0x4c754e;})});}_0x1dcd64=_['merge']({},_0x1dcd64,_0x37b6e6['options']);return _0x1769b3[_0xf4aa('0x49')](_0x1dcd64);}})['then'](function(_0x118ffd){if(_0x118ffd){_0x288475=_0x118ffd[_0xf4aa('0x34')];if(!_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x4a')](_0xf4aa('0x35'))){_0x1dcd64[_0xf4aa('0x1d')]=qs['limit'](_0x37b6e6[_0xf4aa('0x2f')]['limit']);_0x1dcd64[_0xf4aa('0x1e')]=qs[_0xf4aa('0x1e')](_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x1e')]);}return _0x1769b3[_0xf4aa('0x49')](_0x1dcd64);}})[_0xf4aa('0x25')](function(_0x424bbb){if(_0x424bbb){return _0x424bbb?{'count':_0x288475,'rows':_0x424bbb}:null;}})[_0xf4aa('0x25')](respondWithResult(_0x548437,null))['catch'](handleError(_0x548437,null));};exports[_0xf4aa('0x4b')]=function(_0x1b0761,_0x2fd8a2,_0x1ee7f6){if(_0x1b0761[_0xf4aa('0x45')]['id']){delete _0x1b0761[_0xf4aa('0x45')]['id'];}return db[_0xf4aa('0x29')][_0xf4aa('0x47')]({'where':{'id':_0x1b0761[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x2fd8a2,null))[_0xf4aa('0x25')](function(_0x456dbe){if(_0x456dbe){_0x1b0761[_0xf4aa('0x45')][_0xf4aa('0x4c')]=_0x456dbe['id'];_0x1b0761[_0xf4aa('0x45')][_0xf4aa('0x4d')]=integrations[_0xf4aa('0x4e')](_0x1b0761['body']['channel'],_0x1b0761['body'][_0xf4aa('0x2c')]);_0x1b0761[_0xf4aa('0x45')]['Descriptions']=integrations[_0xf4aa('0x4f')](_0x1b0761['body'][_0xf4aa('0x50')],_0x1b0761['body'][_0xf4aa('0x2c')]);return db[_0xf4aa('0x51')][_0xf4aa('0x44')](_0x1b0761['body'],{'include':[{'model':db[_0xf4aa('0x52')],'as':_0xf4aa('0x4d')},{'model':db['VtigerField'],'as':_0xf4aa('0x53')}]});}return null;})[_0xf4aa('0x25')](respondWithResult(_0x2fd8a2,null))[_0xf4aa('0x3e')](handleError(_0x2fd8a2,null));};var md5=require(_0xf4aa('0x54'));exports[_0xf4aa('0x55')]=function(_0x18f3e0,_0x13e623,_0x12d2aa){var _0x145e87=null;var _0x2c02bb=null;var _0xe1c170=null;var _0x1f1de2=null;var _0x23320c='';return db['VtigerAccount'][_0xf4aa('0x47')]({'where':{'id':_0x18f3e0[_0xf4aa('0x40')]['id']},'attributes':['id',_0xf4aa('0x27'),_0xf4aa('0x56'),_0xf4aa('0x57'),'moduleName',_0xf4aa('0x58'),_0xf4aa('0x59'),_0xf4aa('0x5a')]})[_0xf4aa('0x25')](handleEntityNotFound(_0x13e623,null))[_0xf4aa('0x25')](function(_0x1d5224){if(_0x1d5224){_0x145e87=_0x1d5224['username'];_0x2c02bb=_0x1d5224[_0xf4aa('0x5a')];_0xe1c170=_0x1d5224[_0xf4aa('0x5b')];_0x23320c=_0x1d5224[_0xf4aa('0x58')];var _0x18b1d6=_0x23320c['slice'](-0x1);if(_0x18b1d6==='/'){_0x23320c=_0x23320c[_0xf4aa('0x5c')](0x0,_0x23320c[_0xf4aa('0x5d')](_0x18b1d6));}_0x1f1de2=util[_0xf4aa('0x5e')](_0xf4aa('0x5f'),_0x23320c);var _0x18c404={'method':'GET','uri':_0x1f1de2,'qs':{'operation':_0xf4aa('0x60'),'username':_0x1d5224['username']},'json':!![]};return rp(_0x18c404);}})[_0xf4aa('0x25')](function(_0x426c5c){if(_0x426c5c['success']){var _0x396c8d={'method':_0xf4aa('0x61'),'uri':_0x1f1de2,'form':{'operation':_0xf4aa('0x62'),'username':_0x145e87,'accessKey':md5(_0x426c5c[_0xf4aa('0x63')][_0xf4aa('0x64')]+_0x2c02bb)},'json':!![]};return rp(_0x396c8d);}})[_0xf4aa('0x25')](function(_0x4c85e8){if(_0x4c85e8[_0xf4aa('0x65')]){var _0x3877c3={'method':_0xf4aa('0x66'),'uri':_0x1f1de2,'qs':{'operation':_0xf4aa('0x67'),'username':_0x145e87,'sessionName':_0x4c85e8['result'][_0xf4aa('0x68')],'elementType':_0xe1c170},'json':!![]};return rp(_0x3877c3);}})[_0xf4aa('0x25')](function(_0x43fdcb){if(_0x43fdcb[_0xf4aa('0x65')]){var _0x805d9a=['autogenerated',_0xf4aa('0x69'),_0xf4aa('0x6a')];_[_0xf4aa('0x6b')](_0x43fdcb['result']['fields'],function(_0x5b23b6){return _0x805d9a['includes'](_0x5b23b6[_0xf4aa('0x2c')]['name']);});_['remove'](_0x43fdcb[_0xf4aa('0x63')]['fields'],function(_0x2c23de){return _0x2c23de[_0xf4aa('0x6c')]===_0xf4aa('0x6d');});return{'count':_0x43fdcb[_0xf4aa('0x63')][_0xf4aa('0x33')][_0xf4aa('0x34')],'rows':_['map'](_0x43fdcb['result'][_0xf4aa('0x33')],function(_0x41ac9b){return{'id':_0x41ac9b[_0xf4aa('0x27')],'name':_0x41ac9b[_0xf4aa('0x6e')],'custom':_[_0xf4aa('0x6f')](_0x41ac9b[_0xf4aa('0x27')],_0xf4aa('0x70'))?!![]:![],'options':_0x41ac9b[_0xf4aa('0x2c')][_0xf4aa('0x27')]==='picklist'&&_0x41ac9b[_0xf4aa('0x2c')][_0xf4aa('0x71')][_0xf4aa('0x34')]>0x0?_['map'](_0x41ac9b['type']['picklistValues'],function(_0x4828ee){return{'name':_0x4828ee[_0xf4aa('0x6e')],'value':_0x4828ee[_0xf4aa('0x72')]};}):[]};})};}})[_0xf4aa('0x25')](respondWithResult(_0x13e623,null))[_0xf4aa('0x3e')](function(_0x49fd4c){console[_0xf4aa('0x73')](_0xf4aa('0x74')+_0x49fd4c);var _0x31af55=_0x18f3e0[_0xf4aa('0x2f')][_0xf4aa('0x75')]?0x1f4:_0x49fd4c[_0xf4aa('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xf4aa('0x55'),_0x31af55,JSON[_0xf4aa('0x77')](_0x49fd4c));delete _0x49fd4c[_0xf4aa('0x27')];if(_0x31af55===0x191){_0x31af55=0x190;}_0x13e623[_0xf4aa('0x19')](_0x31af55)[_0xf4aa('0x78')](_0x18f3e0['query'][_0xf4aa('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x49fd4c[_0xf4aa('0x76')]}:_0x49fd4c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index fb74e0d..566b20b 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 _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 +var _0xe8bb=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','path'];(function(_0xe28899,_0x18cb5c){var _0x2639ec=function(_0x32ce8d){while(--_0x32ce8d){_0xe28899['push'](_0xe28899['shift']());}};_0x2639ec(++_0x18cb5c);}(_0xe8bb,0xfe));var _0xbe8b=function(_0x3d0bfe,_0x42e9ff){_0x3d0bfe=_0x3d0bfe-0x0;var _0x4cea77=_0xe8bb[_0x3d0bfe];return _0x4cea77;};'use strict';var _=require(_0xbe8b('0x0'));var util=require(_0xbe8b('0x1'));var logger=require(_0xbe8b('0x2'))(_0xbe8b('0x3'));var moment=require(_0xbe8b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe8b('0x5'));var rimraf=require(_0xbe8b('0x6'));var config=require(_0xbe8b('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xbe8b('0x8'));module[_0xbe8b('0x9')]=function(_0x583fe3,_0x9299d8){return _0x583fe3[_0xbe8b('0xa')](_0xbe8b('0xb'),attributes,{'tableName':_0xbe8b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index e7ae24d..6661909 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 _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 +var _0x9354=['catch','GetVtigerAccount','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowVtigerAccount','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x2549ae,_0x29da72){var _0x58e1a1=function(_0x79987e){while(--_0x79987e){_0x2549ae['push'](_0x2549ae['shift']());}};_0x58e1a1(++_0x29da72);}(_0x9354,0x96));var _0x4935=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x9354[_0x35c5a8];return _0x34782c;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});}exports[_0x4935('0x15')]=function(_0x429ef3){var _0x4ebc63=this;return new Promise(function(_0xd70eff,_0x145277){return db['VtigerAccount'][_0x4935('0x16')]({'raw':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x18')]||null:null,'attributes':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x19')]||null:null,'limit':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x1a')]||null:null,'include':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')],function(_0x53530f){return{'model':db[_0x53530f['model']],'as':_0x53530f['as'],'attributes':_0x53530f[_0x4935('0x19')],'include':_0x53530f[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x53530f[_0x4935('0x1b')],function(_0x344e51){return{'model':db[_0x344e51[_0x4935('0x1d')]],'as':_0x344e51['as'],'attributes':_0x344e51[_0x4935('0x19')],'include':_0x344e51[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x344e51[_0x4935('0x1b')],function(_0x1d08b5){return{'model':db[_0x1d08b5[_0x4935('0x1d')]],'as':_0x1d08b5['as'],'attributes':_0x1d08b5[_0x4935('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x359522){logger['info']('GetVtigerAccount',_0x429ef3);logger['debug'](_0x4935('0x15'),_0x429ef3,JSON[_0x4935('0x1f')](_0x359522));_0xd70eff(_0x359522);})['catch'](function(_0x3f0707){logger[_0x4935('0x11')](_0x4935('0x15'),_0x3f0707[_0x4935('0x12')],_0x429ef3);_0x145277(_0x4ebc63[_0x4935('0x11')](0x1f4,_0x3f0707[_0x4935('0x12')]));});});};exports[_0x4935('0x20')]=function(_0x2fe6da){var _0x5b3c8e=this;return new Promise(function(_0xb7fe2a,_0x2dcb0b){return db['VtigerAccount']['find']({'raw':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da['options'][_0x4935('0x21')]===undefined?!![]:![]:!![],'where':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da[_0x4935('0x17')]['where']||null:null,'attributes':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x19')]||null:null,'include':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')],function(_0x4a69bc){return{'model':db[_0x4a69bc['model']],'as':_0x4a69bc['as'],'attributes':_0x4a69bc[_0x4935('0x19')],'include':_0x4a69bc[_0x4935('0x1b')]?_['map'](_0x4a69bc['include'],function(_0xb3d934){return{'model':db[_0xb3d934['model']],'as':_0xb3d934['as'],'attributes':_0xb3d934[_0x4935('0x19')],'include':_0xb3d934[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0xb3d934[_0x4935('0x1b')],function(_0x1d77b8){return{'model':db[_0x1d77b8[_0x4935('0x1d')]],'as':_0x1d77b8['as'],'attributes':_0x1d77b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x51b7ac){logger[_0x4935('0xc')]('ShowVtigerAccount',_0x2fe6da);logger[_0x4935('0xf')]('ShowVtigerAccount',_0x2fe6da,JSON[_0x4935('0x1f')](_0x51b7ac));_0xb7fe2a(_0x51b7ac);})[_0x4935('0x14')](function(_0x352679){logger[_0x4935('0x11')](_0x4935('0x20'),_0x352679[_0x4935('0x12')],_0x2fe6da);_0x2dcb0b(_0x5b3c8e[_0x4935('0x11')](0x1f4,_0x352679['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 20fc8b0..5ba2f63 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 _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 +var _0x8fa4=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','post','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x578e0d,_0x3af1d0){var _0x2bcb45=function(_0x52e20e){while(--_0x52e20e){_0x578e0d['push'](_0x578e0d['shift']());}};_0x2bcb45(++_0x3af1d0);}(_0x8fa4,0x177));var _0x48fa=function(_0x1e1625,_0x25bece){_0x1e1625=_0x1e1625-0x0;var _0x506714=_0x8fa4[_0x1e1625];return _0x506714;};'use strict';var multer=require(_0x48fa('0x0'));var util=require(_0x48fa('0x1'));var path=require(_0x48fa('0x2'));var timeout=require(_0x48fa('0x3'));var express=require('express');var router=express[_0x48fa('0x4')]();var fs_extra=require(_0x48fa('0x5'));var auth=require(_0x48fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x48fa('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x48fa('0x8')]('/',auth[_0x48fa('0x9')](),controller['index']);router[_0x48fa('0x8')]('/:id',auth[_0x48fa('0x9')](),controller[_0x48fa('0xa')]);router[_0x48fa('0x8')](_0x48fa('0xb'),auth[_0x48fa('0x9')](),controller['getFields']);router[_0x48fa('0x8')](_0x48fa('0xc'),auth[_0x48fa('0x9')](),controller[_0x48fa('0xd')]);router[_0x48fa('0x8')]('/:id/descriptions',auth[_0x48fa('0x9')](),controller['getDescriptions']);router[_0x48fa('0xe')]('/',auth[_0x48fa('0x9')](),controller[_0x48fa('0xf')]);router[_0x48fa('0x10')](_0x48fa('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x48fa('0x12')]('/:id',auth[_0x48fa('0x9')](),controller[_0x48fa('0x13')]);module[_0x48fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6bc7f2c..e9bb8d9 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 _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 +var _0xd0e3=['STRING','exports'];(function(_0x156515,_0x760da4){var _0x3e1e8b=function(_0x23970a){while(--_0x23970a){_0x156515['push'](_0x156515['shift']());}};_0x3e1e8b(++_0x760da4);}(_0xd0e3,0xd9));var _0x3d0e=function(_0x10da90,_0x4fcd65){_0x10da90=_0x10da90-0x0;var _0x533962=_0xd0e3[_0x10da90];return _0x533962;};'use strict';var Sequelize=require('sequelize');module[_0x3d0e('0x0')]={'name':{'type':Sequelize[_0x3d0e('0x1')]},'description':{'type':Sequelize[_0x3d0e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c72d77d..d3a6d62 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 _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 +var _0x4eca=['create','body','update','params','findOne','VtigerField','order','merge','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','save','then','destroy','end','error','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch'];(function(_0x517a7c,_0x508b9e){var _0x354b27=function(_0x44b32b){while(--_0x44b32b){_0x517a7c['push'](_0x517a7c['shift']());}};_0x354b27(++_0x508b9e);}(_0x4eca,0xab));var _0xa4ec=function(_0x15ca41,_0x3429d0){_0x15ca41=_0x15ca41-0x0;var _0x3cecb4=_0x4eca[_0x15ca41];return _0x3cecb4;};'use strict';var emlformat=require(_0xa4ec('0x0'));var rimraf=require(_0xa4ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4ec('0x2'));var rp=require(_0xa4ec('0x3'));var moment=require(_0xa4ec('0x4'));var BPromise=require(_0xa4ec('0x5'));var Mustache=require('mustache');var util=require(_0xa4ec('0x6'));var path=require(_0xa4ec('0x7'));var sox=require(_0xa4ec('0x8'));var csv=require(_0xa4ec('0x9'));var ejs=require(_0xa4ec('0xa'));var fs=require('fs');var fs_extra=require(_0xa4ec('0xb'));var _=require('lodash');var squel=require(_0xa4ec('0xc'));var crypto=require('crypto');var jsforce=require(_0xa4ec('0xd'));var deskjs=require(_0xa4ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa4ec('0xf'));var Papa=require(_0xa4ec('0x10'));var Redis=require(_0xa4ec('0x11'));var authService=require(_0xa4ec('0x12'));var qs=require(_0xa4ec('0x13'));var as=require(_0xa4ec('0x14'));var hardwareService=require(_0xa4ec('0x15'));var logger=require('../../config/logger')(_0xa4ec('0x16'));var utils=require('../../config/utils');var config=require(_0xa4ec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4ec('0x18'))['db'];function respondWithStatusCode(_0x4edb4b,_0x1d279b){_0x1d279b=_0x1d279b||0xcc;return function(_0x46a855){if(_0x46a855){return _0x4edb4b['sendStatus'](_0x1d279b);}return _0x4edb4b[_0xa4ec('0x19')](_0x1d279b)['end']();};}function respondWithResult(_0x5172ea,_0x3b57ff){_0x3b57ff=_0x3b57ff||0xc8;return function(_0x606a18){if(_0x606a18){return _0x5172ea['status'](_0x3b57ff)[_0xa4ec('0x1a')](_0x606a18);}};}function respondWithFilteredResult(_0x3a8174,_0x31de8d){return function(_0x297e86){if(_0x297e86){var _0xeca077=typeof _0x31de8d['offset']===_0xa4ec('0x1b')&&typeof _0x31de8d[_0xa4ec('0x1c')]==='undefined';var _0x1e8157=_0x297e86[_0xa4ec('0x1d')];var _0x4681b3=_0xeca077?0x0:_0x31de8d['offset'];var _0x444d2e=_0xeca077?_0x297e86[_0xa4ec('0x1d')]:_0x31de8d[_0xa4ec('0x1e')]+_0x31de8d[_0xa4ec('0x1c')];var _0x47e497;if(_0x444d2e>=_0x1e8157){_0x444d2e=_0x1e8157;_0x47e497=0xc8;}else{_0x47e497=0xce;}_0x3a8174[_0xa4ec('0x19')](_0x47e497);return _0x3a8174[_0xa4ec('0x1f')]('Content-Range',_0x4681b3+'-'+_0x444d2e+'/'+_0x1e8157)[_0xa4ec('0x1a')](_0x297e86);}return null;};}function patchUpdates(_0x33bda7){return function(_0x132274){try{jsonpatch[_0xa4ec('0x20')](_0x132274,_0x33bda7,!![]);}catch(_0x25200a){return BPromise['reject'](_0x25200a);}return _0x132274[_0xa4ec('0x21')]();};}function saveUpdates(_0x3f3777,_0x1fad06){return function(_0x490df9){if(_0x490df9){return _0x490df9['update'](_0x3f3777)[_0xa4ec('0x22')](function(_0x36a65a){return _0x36a65a;});}return null;};}function removeEntity(_0x51784c,_0x29a211){return function(_0x1faa9f){if(_0x1faa9f){return _0x1faa9f[_0xa4ec('0x23')]()[_0xa4ec('0x22')](function(){_0x51784c[_0xa4ec('0x19')](0xcc)[_0xa4ec('0x24')]();});}};}function handleEntityNotFound(_0x260c92,_0x15d563){return function(_0x1178f2){if(!_0x1178f2){_0x260c92['sendStatus'](0x194);}return _0x1178f2;};}function handleError(_0x417b02,_0x47888d){_0x47888d=_0x47888d||0x1f4;return function(_0x587bfa){logger[_0xa4ec('0x25')](_0x587bfa['stack']);if(_0x587bfa['name']){delete _0x587bfa[_0xa4ec('0x26')];}_0x417b02[_0xa4ec('0x19')](_0x47888d)[_0xa4ec('0x27')](_0x587bfa);};}exports[_0xa4ec('0x28')]=function(_0x3dd9da,_0x58e01a){var _0x113792={},_0x5ee1b7={},_0x24adc0={'count':0x0,'rows':[]};var _0x1602e0=_[_0xa4ec('0x29')](db[_0xa4ec('0x2a')][_0xa4ec('0x2b')],function(_0x3b4e31){return{'name':_0x3b4e31['fieldName'],'type':_0x3b4e31[_0xa4ec('0x2c')][_0xa4ec('0x2d')]};});_0x5ee1b7[_0xa4ec('0x2e')]=_[_0xa4ec('0x29')](_0x1602e0,'name');_0x5ee1b7[_0xa4ec('0x2f')]=_['keys'](_0x3dd9da[_0xa4ec('0x2f')]);_0x5ee1b7['filters']=_['intersection'](_0x5ee1b7[_0xa4ec('0x2e')],_0x5ee1b7['query']);_0x113792[_0xa4ec('0x30')]=_[_0xa4ec('0x31')](_0x5ee1b7[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x113792[_0xa4ec('0x30')]=_0x113792[_0xa4ec('0x30')][_0xa4ec('0x33')]?_0x113792[_0xa4ec('0x30')]:_0x5ee1b7['model'];if(!_0x3dd9da['query'][_0xa4ec('0x34')](_0xa4ec('0x35'))){_0x113792[_0xa4ec('0x1c')]=qs[_0xa4ec('0x1c')](_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x1c')]);_0x113792['offset']=qs[_0xa4ec('0x1e')](_0x3dd9da['query'][_0xa4ec('0x1e')]);}_0x113792['order']=qs['sort'](_0x3dd9da['query'][_0xa4ec('0x36')]);_0x113792[_0xa4ec('0x37')]=qs[_0xa4ec('0x38')](_[_0xa4ec('0x39')](_0x3dd9da[_0xa4ec('0x2f')],_0x5ee1b7[_0xa4ec('0x38')]),_0x1602e0);if(_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x3a')]){_0x113792['where']=_['merge'](_0x113792[_0xa4ec('0x37')],{'$or':_['map'](_0x1602e0,function(_0x2383c1){if(_0x2383c1['type']!==_0xa4ec('0x3b')){var _0x573b45={};_0x573b45[_0x2383c1[_0xa4ec('0x26')]]={'$like':'%'+_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x3a')]+'%'};return _0x573b45;}})});}_0x113792=_['merge']({},_0x113792,_0x3dd9da[_0xa4ec('0x3c')]);var _0x44012b={'where':_0x113792[_0xa4ec('0x37')]};return db['VtigerConfiguration'][_0xa4ec('0x1d')](_0x44012b)['then'](function(_0x554a99){_0x24adc0[_0xa4ec('0x1d')]=_0x554a99;if(_0x3dd9da['query'][_0xa4ec('0x3d')]){_0x113792[_0xa4ec('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xa4ec('0x3f')](_0x113792);})[_0xa4ec('0x22')](function(_0x282422){_0x24adc0[_0xa4ec('0x40')]=_0x282422;return _0x24adc0;})[_0xa4ec('0x22')](respondWithFilteredResult(_0x58e01a,_0x113792))['catch'](handleError(_0x58e01a,null));};exports[_0xa4ec('0x41')]=function(_0x344bed,_0x1d86f9){var _0x5bde3d={'raw':![],'where':{'id':_0x344bed['params']['id']}},_0x3ab48d={};_0x3ab48d[_0xa4ec('0x2e')]=_[_0xa4ec('0x42')](db['VtigerConfiguration'][_0xa4ec('0x2b')]);_0x3ab48d[_0xa4ec('0x2f')]=_[_0xa4ec('0x42')](_0x344bed[_0xa4ec('0x2f')]);_0x3ab48d['filters']=_[_0xa4ec('0x31')](_0x3ab48d[_0xa4ec('0x2e')],_0x3ab48d[_0xa4ec('0x2f')]);_0x5bde3d[_0xa4ec('0x30')]=_[_0xa4ec('0x31')](_0x3ab48d[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x344bed[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x5bde3d[_0xa4ec('0x30')]=_0x5bde3d[_0xa4ec('0x30')][_0xa4ec('0x33')]?_0x5bde3d[_0xa4ec('0x30')]:_0x3ab48d[_0xa4ec('0x2e')];if(_0x344bed[_0xa4ec('0x2f')]['includeAll']){_0x5bde3d[_0xa4ec('0x3e')]=[{'all':!![]}];}_0x5bde3d=_['merge']({},_0x5bde3d,_0x344bed['options']);return db[_0xa4ec('0x2a')][_0xa4ec('0x43')](_0x5bde3d)[_0xa4ec('0x22')](handleEntityNotFound(_0x1d86f9,null))[_0xa4ec('0x22')](respondWithResult(_0x1d86f9,null))[_0xa4ec('0x44')](handleError(_0x1d86f9,null));};exports[_0xa4ec('0x45')]=function(_0x21ca88,_0x538ab8){return db[_0xa4ec('0x2a')][_0xa4ec('0x45')](_0x21ca88[_0xa4ec('0x46')],{})[_0xa4ec('0x22')](respondWithResult(_0x538ab8,0xc9))[_0xa4ec('0x44')](handleError(_0x538ab8,null));};exports[_0xa4ec('0x47')]=function(_0x5da120,_0x533b6c){if(_0x5da120[_0xa4ec('0x46')]['id']){delete _0x5da120[_0xa4ec('0x46')]['id'];}return db[_0xa4ec('0x2a')][_0xa4ec('0x43')]({'where':{'id':_0x5da120[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x533b6c,null))[_0xa4ec('0x22')](saveUpdates(_0x5da120['body'],null))[_0xa4ec('0x22')](respondWithResult(_0x533b6c,null))[_0xa4ec('0x44')](handleError(_0x533b6c,null));};exports[_0xa4ec('0x23')]=function(_0x55e024,_0x3dc24b){return db[_0xa4ec('0x2a')][_0xa4ec('0x43')]({'where':{'id':_0x55e024[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x3dc24b,null))[_0xa4ec('0x22')](removeEntity(_0x3dc24b,null))[_0xa4ec('0x44')](handleError(_0x3dc24b,null));};exports['getFields']=function(_0x2e24ab,_0x1d2140,_0x4ebc47){var _0x17db00={};var _0x3dcb5b={};var _0xe67b85;var _0x717e1a;return db['VtigerConfiguration'][_0xa4ec('0x49')]({'where':{'id':_0x2e24ab[_0xa4ec('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d2140,null))[_0xa4ec('0x22')](function(_0x4f82a2){if(_0x4f82a2){_0xe67b85=_0x4f82a2;_0x3dcb5b[_0xa4ec('0x2e')]=_[_0xa4ec('0x42')](db[_0xa4ec('0x4a')][_0xa4ec('0x2b')]);_0x3dcb5b[_0xa4ec('0x2f')]=_[_0xa4ec('0x42')](_0x2e24ab[_0xa4ec('0x2f')]);_0x3dcb5b[_0xa4ec('0x38')]=_[_0xa4ec('0x31')](_0x3dcb5b['model'],_0x3dcb5b['query']);_0x17db00[_0xa4ec('0x30')]=_['intersection'](_0x3dcb5b[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x2e24ab['query'][_0xa4ec('0x32')]));_0x17db00[_0xa4ec('0x30')]=_0x17db00[_0xa4ec('0x30')][_0xa4ec('0x33')]?_0x17db00['attributes']:_0x3dcb5b[_0xa4ec('0x2e')];_0x17db00[_0xa4ec('0x4b')]=qs[_0xa4ec('0x36')](_0x2e24ab['query'][_0xa4ec('0x36')]);_0x17db00[_0xa4ec('0x37')]=qs[_0xa4ec('0x38')](_[_0xa4ec('0x39')](_0x2e24ab[_0xa4ec('0x2f')],_0x3dcb5b[_0xa4ec('0x38')]));if(_0x2e24ab[_0xa4ec('0x2f')][_0xa4ec('0x3a')]){_0x17db00[_0xa4ec('0x37')]=_[_0xa4ec('0x4c')](_0x17db00[_0xa4ec('0x37')],{'$or':_['map'](_0x17db00['attributes'],function(_0x3c0318){var _0x49c460={};_0x49c460[_0x3c0318]={'$like':'%'+_0x2e24ab[_0xa4ec('0x2f')]['filter']+'%'};return _0x49c460;})});}_0x17db00=_[_0xa4ec('0x4c')]({},_0x17db00,_0x2e24ab[_0xa4ec('0x3c')]);return _0xe67b85[_0xa4ec('0x4d')](_0x17db00);}})['then'](function(_0x217981){if(_0x217981){_0x717e1a=_0x217981[_0xa4ec('0x33')];if(!_0x2e24ab[_0xa4ec('0x2f')]['hasOwnProperty']('nolimit')){_0x17db00[_0xa4ec('0x1c')]=qs[_0xa4ec('0x1c')](_0x2e24ab[_0xa4ec('0x2f')][_0xa4ec('0x1c')]);_0x17db00[_0xa4ec('0x1e')]=qs[_0xa4ec('0x1e')](_0x2e24ab[_0xa4ec('0x2f')][_0xa4ec('0x1e')]);}return _0xe67b85['getFields'](_0x17db00);}})[_0xa4ec('0x22')](function(_0x316401){if(_0x316401){return _0x316401?{'count':_0x717e1a,'rows':_0x316401}:null;}})['then'](respondWithResult(_0x1d2140,null))[_0xa4ec('0x44')](handleError(_0x1d2140,null));};exports[_0xa4ec('0x4e')]=function(_0x38e78c,_0x39bf8e,_0x3e381b){var _0x587e73={};var _0x111697={};var _0x30aa2f;var _0x51bd80;return db[_0xa4ec('0x2a')][_0xa4ec('0x49')]({'where':{'id':_0x38e78c[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x39bf8e,null))[_0xa4ec('0x22')](function(_0x12e740){if(_0x12e740){_0x30aa2f=_0x12e740;_0x111697[_0xa4ec('0x2e')]=_[_0xa4ec('0x42')](db[_0xa4ec('0x4a')][_0xa4ec('0x2b')]);_0x111697[_0xa4ec('0x2f')]=_[_0xa4ec('0x42')](_0x38e78c['query']);_0x111697[_0xa4ec('0x38')]=_[_0xa4ec('0x31')](_0x111697[_0xa4ec('0x2e')],_0x111697[_0xa4ec('0x2f')]);_0x587e73['attributes']=_[_0xa4ec('0x31')](_0x111697[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x38e78c[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x587e73[_0xa4ec('0x30')]=_0x587e73[_0xa4ec('0x30')]['length']?_0x587e73[_0xa4ec('0x30')]:_0x111697['model'];_0x587e73[_0xa4ec('0x4b')]=qs['sort'](_0x38e78c[_0xa4ec('0x2f')]['sort']);_0x587e73[_0xa4ec('0x37')]=qs[_0xa4ec('0x38')](_['pick'](_0x38e78c['query'],_0x111697['filters']));if(_0x38e78c['query'][_0xa4ec('0x3a')]){_0x587e73[_0xa4ec('0x37')]=_[_0xa4ec('0x4c')](_0x587e73['where'],{'$or':_[_0xa4ec('0x29')](_0x587e73[_0xa4ec('0x30')],function(_0x5d3775){var _0x10d77b={};_0x10d77b[_0x5d3775]={'$like':'%'+_0x38e78c[_0xa4ec('0x2f')][_0xa4ec('0x3a')]+'%'};return _0x10d77b;})});}_0x587e73=_[_0xa4ec('0x4c')]({},_0x587e73,_0x38e78c[_0xa4ec('0x3c')]);return _0x30aa2f[_0xa4ec('0x4e')](_0x587e73);}})[_0xa4ec('0x22')](function(_0x3c2110){if(_0x3c2110){_0x51bd80=_0x3c2110[_0xa4ec('0x33')];if(!_0x38e78c[_0xa4ec('0x2f')][_0xa4ec('0x34')]('nolimit')){_0x587e73[_0xa4ec('0x1c')]=qs['limit'](_0x38e78c[_0xa4ec('0x2f')]['limit']);_0x587e73[_0xa4ec('0x1e')]=qs[_0xa4ec('0x1e')](_0x38e78c['query'][_0xa4ec('0x1e')]);}return _0x30aa2f[_0xa4ec('0x4e')](_0x587e73);}})['then'](function(_0x4dede4){if(_0x4dede4){return _0x4dede4?{'count':_0x51bd80,'rows':_0x4dede4}:null;}})[_0xa4ec('0x22')](respondWithResult(_0x39bf8e,null))[_0xa4ec('0x44')](handleError(_0x39bf8e,null));};exports[_0xa4ec('0x4f')]=function(_0x575b5c,_0x2397e2,_0x2218d5){var _0x4f4e71={};var _0x32de6f={};var _0x17f6ed;var _0x14737d;return db['VtigerConfiguration'][_0xa4ec('0x49')]({'where':{'id':_0x575b5c[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x2397e2,null))[_0xa4ec('0x22')](function(_0x1d0c73){if(_0x1d0c73){_0x17f6ed=_0x1d0c73;_0x32de6f[_0xa4ec('0x2e')]=_['keys'](db[_0xa4ec('0x4a')]['rawAttributes']);_0x32de6f['query']=_[_0xa4ec('0x42')](_0x575b5c[_0xa4ec('0x2f')]);_0x32de6f[_0xa4ec('0x38')]=_['intersection'](_0x32de6f[_0xa4ec('0x2e')],_0x32de6f['query']);_0x4f4e71['attributes']=_[_0xa4ec('0x31')](_0x32de6f[_0xa4ec('0x2e')],qs['fields'](_0x575b5c[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x4f4e71['attributes']=_0x4f4e71['attributes'][_0xa4ec('0x33')]?_0x4f4e71[_0xa4ec('0x30')]:_0x32de6f[_0xa4ec('0x2e')];_0x4f4e71[_0xa4ec('0x4b')]=qs[_0xa4ec('0x36')](_0x575b5c[_0xa4ec('0x2f')]['sort']);_0x4f4e71['where']=qs[_0xa4ec('0x38')](_[_0xa4ec('0x39')](_0x575b5c[_0xa4ec('0x2f')],_0x32de6f[_0xa4ec('0x38')]));if(_0x575b5c['query'][_0xa4ec('0x3a')]){_0x4f4e71[_0xa4ec('0x37')]=_['merge'](_0x4f4e71[_0xa4ec('0x37')],{'$or':_['map'](_0x4f4e71[_0xa4ec('0x30')],function(_0x417c77){var _0x44319a={};_0x44319a[_0x417c77]={'$like':'%'+_0x575b5c['query'][_0xa4ec('0x3a')]+'%'};return _0x44319a;})});}_0x4f4e71=_['merge']({},_0x4f4e71,_0x575b5c['options']);return _0x17f6ed[_0xa4ec('0x4f')](_0x4f4e71);}})[_0xa4ec('0x22')](function(_0x78a826){if(_0x78a826){_0x14737d=_0x78a826[_0xa4ec('0x33')];if(!_0x575b5c[_0xa4ec('0x2f')][_0xa4ec('0x34')](_0xa4ec('0x35'))){_0x4f4e71[_0xa4ec('0x1c')]=qs[_0xa4ec('0x1c')](_0x575b5c['query']['limit']);_0x4f4e71[_0xa4ec('0x1e')]=qs['offset'](_0x575b5c[_0xa4ec('0x2f')][_0xa4ec('0x1e')]);}return _0x17f6ed['getDescriptions'](_0x4f4e71);}})[_0xa4ec('0x22')](function(_0x43eba6){if(_0x43eba6){return _0x43eba6?{'count':_0x14737d,'rows':_0x43eba6}:null;}})[_0xa4ec('0x22')](respondWithResult(_0x2397e2,null))[_0xa4ec('0x44')](handleError(_0x2397e2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2436259..f5d87a5 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 _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 +var _0x7874=['request-promise','rimraf','./intVtigerConfiguration.attributes','int_vtiger_configurations','util','../../config/logger','api','moment'];(function(_0x51bb23,_0x378d1e){var _0x3a2fb9=function(_0x2c8409){while(--_0x2c8409){_0x51bb23['push'](_0x51bb23['shift']());}};_0x3a2fb9(++_0x378d1e);}(_0x7874,0xbc));var _0x4787=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x7874[_0x1e7701];return _0x3ab707;};'use strict';var _=require('lodash');var util=require(_0x4787('0x0'));var logger=require(_0x4787('0x1'))(_0x4787('0x2'));var moment=require(_0x4787('0x3'));var BPromise=require('bluebird');var rp=require(_0x4787('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4787('0x5'));var config=require('../../config/environment');var attributes=require(_0x4787('0x6'));module['exports']=function(_0x2e14e3,_0x127049){return _0x2e14e3['define']('VtigerConfiguration',attributes,{'tableName':_0x4787('0x7'),'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 afd5495..b3e67c6 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 _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 +var _0x0c8f=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x3e67e9,_0x1187a1){var _0x54abbb=function(_0x142996){while(--_0x142996){_0x3e67e9['push'](_0x3e67e9['shift']());}};_0x54abbb(++_0x1187a1);}(_0x0c8f,0x155));var _0xf0c8=function(_0x583790,_0x28322d){_0x583790=_0x583790-0x0;var _0x2fcf11=_0x0c8f[_0x583790];return _0x2fcf11;};'use strict';var _=require('lodash');var util=require(_0xf0c8('0x0'));var moment=require(_0xf0c8('0x1'));var BPromise=require(_0xf0c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0c8('0x3'));var logger=require(_0xf0c8('0x4'))(_0xf0c8('0x5'));var config=require(_0xf0c8('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x441fa4,_0x41708f,_0x4d2e93){return new BPromise(function(_0x2b5343,_0x1ddded){return client[_0xf0c8('0x7')](_0x441fa4,_0x4d2e93)[_0xf0c8('0x8')](function(_0x14c008){logger['info'](_0xf0c8('0x9'),_0x41708f,_0xf0c8('0xa'));logger[_0xf0c8('0xb')](_0xf0c8('0xc'),_0x41708f,_0xf0c8('0xa'),JSON[_0xf0c8('0xd')](_0x14c008));if(_0x14c008[_0xf0c8('0xe')]){if(_0x14c008[_0xf0c8('0xe')][_0xf0c8('0xf')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x41708f,_0x14c008[_0xf0c8('0xe')][_0xf0c8('0x10')]);return _0x1ddded(_0x14c008[_0xf0c8('0xe')][_0xf0c8('0x10')]);}logger[_0xf0c8('0xe')](_0xf0c8('0x9'),_0x41708f,_0x14c008[_0xf0c8('0xe')][_0xf0c8('0x10')]);return _0x2b5343(_0x14c008['error'][_0xf0c8('0x10')]);}else{logger['info'](_0xf0c8('0x9'),_0x41708f,'request\x20sent');_0x2b5343(_0x14c008[_0xf0c8('0x11')][_0xf0c8('0x10')]);}})[_0xf0c8('0x12')](function(_0x5849e2){logger[_0xf0c8('0xe')](_0xf0c8('0x9'),_0x41708f,_0x5849e2);_0x1ddded(_0x5849e2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4061c66..d3084d9 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 _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 +var _0xfe9c=['delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x4232da,_0x3c54b0){var _0x358411=function(_0xce0b5c){while(--_0xce0b5c){_0x4232da['push'](_0x4232da['shift']());}};_0x358411(++_0x3c54b0);}(_0xfe9c,0x1b3));var _0xcfe9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xfe9c[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xcfe9('0x0'));var util=require('util');var path=require(_0xcfe9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcfe9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcfe9('0x3'));var interaction=require(_0xcfe9('0x4'));var config=require('../../config/environment');var controller=require(_0xcfe9('0x5'));router[_0xcfe9('0x6')]('/',auth['isAuthenticated'](),controller[_0xcfe9('0x7')]);router[_0xcfe9('0x6')](_0xcfe9('0x8'),auth['isAuthenticated'](),controller[_0xcfe9('0x9')]);router[_0xcfe9('0xa')]('/',auth[_0xcfe9('0xb')](),controller[_0xcfe9('0xc')]);router[_0xcfe9('0xd')](_0xcfe9('0x8'),auth['isAuthenticated'](),controller[_0xcfe9('0xe')]);router[_0xcfe9('0xf')](_0xcfe9('0x8'),auth[_0xcfe9('0xb')](),controller[_0xcfe9('0x10')]);module[_0xcfe9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a4a5fe5..7459478 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 _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 +var _0x7f4c=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x219c82,_0xe6f67f){var _0x2195c9=function(_0x333d71){while(--_0x333d71){_0x219c82['push'](_0x219c82['shift']());}};_0x2195c9(++_0xe6f67f);}(_0x7f4c,0x1a6));var _0xc7f4=function(_0x36a922,_0x4da114){_0x36a922=_0x36a922-0x0;var _0x3bfba1=_0x7f4c[_0x36a922];return _0x3bfba1;};'use strict';var Sequelize=require(_0xc7f4('0x0'));module[_0xc7f4('0x1')]={'type':{'type':Sequelize[_0xc7f4('0x2')](_0xc7f4('0x3'),_0xc7f4('0x4'),_0xc7f4('0x5'),_0xc7f4('0x6'),_0xc7f4('0x7')),'defaultValue':_0xc7f4('0x3')},'content':{'type':Sequelize[_0xc7f4('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xc7f4('0x4'),_0xc7f4('0x5'))},'keyContent':{'type':Sequelize[_0xc7f4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc7f4('0x8')]},'customField':{'type':Sequelize[_0xc7f4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc7f4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 05995c2..47fb5a1 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 _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 +var _0xfb8a=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter'];(function(_0x227b98,_0x32f2c2){var _0x4f4146=function(_0x5a7aaa){while(--_0x5a7aaa){_0x227b98['push'](_0x227b98['shift']());}};_0x4f4146(++_0x32f2c2);}(_0xfb8a,0x1ca));var _0xafb8=function(_0x3c704b,_0xd6f86f){_0x3c704b=_0x3c704b-0x0;var _0x44cb8b=_0xfb8a[_0x3c704b];return _0x44cb8b;};'use strict';var emlformat=require(_0xafb8('0x0'));var rimraf=require(_0xafb8('0x1'));var zipdir=require(_0xafb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xafb8('0x3'));var BPromise=require(_0xafb8('0x4'));var Mustache=require(_0xafb8('0x5'));var util=require(_0xafb8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xafb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafb8('0x8'));var _=require(_0xafb8('0x9'));var squel=require('squel');var crypto=require(_0xafb8('0xa'));var jsforce=require(_0xafb8('0xb'));var deskjs=require(_0xafb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xafb8('0xd'));var Papa=require(_0xafb8('0xe'));var Redis=require('ioredis');var authService=require(_0xafb8('0xf'));var qs=require(_0xafb8('0x10'));var as=require(_0xafb8('0x11'));var hardwareService=require(_0xafb8('0x12'));var logger=require('../../config/logger')(_0xafb8('0x13'));var utils=require(_0xafb8('0x14'));var config=require(_0xafb8('0x15'));var licenseUtil=require(_0xafb8('0x16'));var db=require(_0xafb8('0x17'))['db'];function respondWithStatusCode(_0x210789,_0x50f7f3){_0x50f7f3=_0x50f7f3||0xcc;return function(_0x33a86b){if(_0x33a86b){return _0x210789['sendStatus'](_0x50f7f3);}return _0x210789[_0xafb8('0x18')](_0x50f7f3)[_0xafb8('0x19')]();};}function respondWithResult(_0x2ad18a,_0x2d0041){_0x2d0041=_0x2d0041||0xc8;return function(_0x278f02){if(_0x278f02){return _0x2ad18a[_0xafb8('0x18')](_0x2d0041)['json'](_0x278f02);}};}function respondWithFilteredResult(_0x5aa818,_0x11fa2f){return function(_0x5bbd19){if(_0x5bbd19){var _0x3cc798=typeof _0x11fa2f['offset']===_0xafb8('0x1a')&&typeof _0x11fa2f['limit']===_0xafb8('0x1a');var _0x4240ac=_0x5bbd19[_0xafb8('0x1b')];var _0x241e8b=_0x3cc798?0x0:_0x11fa2f[_0xafb8('0x1c')];var _0x5c97ce=_0x3cc798?_0x5bbd19[_0xafb8('0x1b')]:_0x11fa2f['offset']+_0x11fa2f[_0xafb8('0x1d')];var _0x4e0a13;if(_0x5c97ce>=_0x4240ac){_0x5c97ce=_0x4240ac;_0x4e0a13=0xc8;}else{_0x4e0a13=0xce;}_0x5aa818['status'](_0x4e0a13);return _0x5aa818[_0xafb8('0x1e')](_0xafb8('0x1f'),_0x241e8b+'-'+_0x5c97ce+'/'+_0x4240ac)[_0xafb8('0x20')](_0x5bbd19);}return null;};}function patchUpdates(_0xc5944d){return function(_0x2d2c5d){try{jsonpatch[_0xafb8('0x21')](_0x2d2c5d,_0xc5944d,!![]);}catch(_0x1feca6){return BPromise[_0xafb8('0x22')](_0x1feca6);}return _0x2d2c5d[_0xafb8('0x23')]();};}function saveUpdates(_0x4e5760,_0x5f1626){return function(_0x3511c7){if(_0x3511c7){return _0x3511c7['update'](_0x4e5760)[_0xafb8('0x24')](function(_0x540de9){return _0x540de9;});}return null;};}function removeEntity(_0x2fb36d,_0x1b7f51){return function(_0x1d490c){if(_0x1d490c){return _0x1d490c[_0xafb8('0x25')]()['then'](function(){_0x2fb36d[_0xafb8('0x18')](0xcc)[_0xafb8('0x19')]();});}};}function handleEntityNotFound(_0x4bb20e,_0x246ae1){return function(_0x23696a){if(!_0x23696a){_0x4bb20e[_0xafb8('0x26')](0x194);}return _0x23696a;};}function handleError(_0x2f4e3d,_0x409881){_0x409881=_0x409881||0x1f4;return function(_0x16d950){logger[_0xafb8('0x27')](_0x16d950['stack']);if(_0x16d950[_0xafb8('0x28')]){delete _0x16d950['name'];}_0x2f4e3d[_0xafb8('0x18')](_0x409881)[_0xafb8('0x29')](_0x16d950);};}exports['index']=function(_0x2bf56d,_0xbc57ba){var _0x2d4f37={},_0x155bc3={},_0x18a913={'count':0x0,'rows':[]};var _0x1529ae=_[_0xafb8('0x2a')](db[_0xafb8('0x2b')][_0xafb8('0x2c')],function(_0x67cac1){return{'name':_0x67cac1[_0xafb8('0x2d')],'type':_0x67cac1[_0xafb8('0x2e')][_0xafb8('0x2f')]};});_0x155bc3[_0xafb8('0x30')]=_[_0xafb8('0x2a')](_0x1529ae,_0xafb8('0x28'));_0x155bc3[_0xafb8('0x31')]=_['keys'](_0x2bf56d['query']);_0x155bc3['filters']=_[_0xafb8('0x32')](_0x155bc3['model'],_0x155bc3[_0xafb8('0x31')]);_0x2d4f37[_0xafb8('0x33')]=_[_0xafb8('0x32')](_0x155bc3['model'],qs[_0xafb8('0x34')](_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x34')]));_0x2d4f37[_0xafb8('0x33')]=_0x2d4f37[_0xafb8('0x33')][_0xafb8('0x35')]?_0x2d4f37[_0xafb8('0x33')]:_0x155bc3['model'];if(!_0x2bf56d[_0xafb8('0x31')]['hasOwnProperty']('nolimit')){_0x2d4f37[_0xafb8('0x1d')]=qs[_0xafb8('0x1d')](_0x2bf56d[_0xafb8('0x31')]['limit']);_0x2d4f37[_0xafb8('0x1c')]=qs[_0xafb8('0x1c')](_0x2bf56d['query'][_0xafb8('0x1c')]);}_0x2d4f37[_0xafb8('0x36')]=qs[_0xafb8('0x37')](_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x37')]);_0x2d4f37[_0xafb8('0x38')]=qs[_0xafb8('0x39')](_[_0xafb8('0x3a')](_0x2bf56d[_0xafb8('0x31')],_0x155bc3[_0xafb8('0x39')]),_0x1529ae);if(_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x3b')]){_0x2d4f37[_0xafb8('0x38')]=_[_0xafb8('0x3c')](_0x2d4f37[_0xafb8('0x38')],{'$or':_['map'](_0x1529ae,function(_0xc3685b){if(_0xc3685b[_0xafb8('0x2e')]!==_0xafb8('0x3d')){var _0x1c234b={};_0x1c234b[_0xc3685b[_0xafb8('0x28')]]={'$like':'%'+_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x3b')]+'%'};return _0x1c234b;}})});}_0x2d4f37=_[_0xafb8('0x3c')]({},_0x2d4f37,_0x2bf56d[_0xafb8('0x3e')]);var _0x1bfd23={'where':_0x2d4f37['where']};return db[_0xafb8('0x2b')][_0xafb8('0x1b')](_0x1bfd23)[_0xafb8('0x24')](function(_0x498453){_0x18a913[_0xafb8('0x1b')]=_0x498453;if(_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x3f')]){_0x2d4f37[_0xafb8('0x40')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x2d4f37);})[_0xafb8('0x24')](function(_0x5cceee){_0x18a913[_0xafb8('0x41')]=_0x5cceee;return _0x18a913;})['then'](respondWithFilteredResult(_0xbc57ba,_0x2d4f37))[_0xafb8('0x42')](handleError(_0xbc57ba,null));};exports[_0xafb8('0x43')]=function(_0x48cd1b,_0x91a4cf){var _0x28c082={'raw':!![],'where':{'id':_0x48cd1b[_0xafb8('0x44')]['id']}},_0x480094={};_0x480094[_0xafb8('0x30')]=_['keys'](db[_0xafb8('0x2b')][_0xafb8('0x2c')]);_0x480094[_0xafb8('0x31')]=_[_0xafb8('0x45')](_0x48cd1b[_0xafb8('0x31')]);_0x480094[_0xafb8('0x39')]=_[_0xafb8('0x32')](_0x480094['model'],_0x480094['query']);_0x28c082[_0xafb8('0x33')]=_[_0xafb8('0x32')](_0x480094[_0xafb8('0x30')],qs[_0xafb8('0x34')](_0x48cd1b['query'][_0xafb8('0x34')]));_0x28c082[_0xafb8('0x33')]=_0x28c082['attributes'][_0xafb8('0x35')]?_0x28c082['attributes']:_0x480094[_0xafb8('0x30')];if(_0x48cd1b[_0xafb8('0x31')][_0xafb8('0x3f')]){_0x28c082[_0xafb8('0x40')]=[{'all':!![]}];}_0x28c082=_[_0xafb8('0x3c')]({},_0x28c082,_0x48cd1b[_0xafb8('0x3e')]);return db['VtigerField'][_0xafb8('0x46')](_0x28c082)[_0xafb8('0x24')](handleEntityNotFound(_0x91a4cf,null))['then'](respondWithResult(_0x91a4cf,null))['catch'](handleError(_0x91a4cf,null));};exports[_0xafb8('0x47')]=function(_0x5804ff,_0x2aba58){return db[_0xafb8('0x2b')]['create'](_0x5804ff[_0xafb8('0x48')],{})[_0xafb8('0x24')](respondWithResult(_0x2aba58,0xc9))[_0xafb8('0x42')](handleError(_0x2aba58,null));};exports[_0xafb8('0x49')]=function(_0xabb625,_0x1ab472){if(_0xabb625[_0xafb8('0x48')]['id']){delete _0xabb625[_0xafb8('0x48')]['id'];}return db[_0xafb8('0x2b')][_0xafb8('0x46')]({'where':{'id':_0xabb625[_0xafb8('0x44')]['id']}})[_0xafb8('0x24')](handleEntityNotFound(_0x1ab472,null))[_0xafb8('0x24')](saveUpdates(_0xabb625[_0xafb8('0x48')],null))[_0xafb8('0x24')](respondWithResult(_0x1ab472,null))[_0xafb8('0x42')](handleError(_0x1ab472,null));};exports[_0xafb8('0x25')]=function(_0xe30f3c,_0x27fb37){return db[_0xafb8('0x2b')][_0xafb8('0x46')]({'where':{'id':_0xe30f3c[_0xafb8('0x44')]['id']}})['then'](handleEntityNotFound(_0x27fb37,null))[_0xafb8('0x24')](removeEntity(_0x27fb37,null))[_0xafb8('0x42')](handleError(_0x27fb37,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0f3ba3c..27bdee8 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 _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 +var _0x7548=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x51782b,_0x384ea7){var _0x3174eb=function(_0x21cb97){while(--_0x21cb97){_0x51782b['push'](_0x51782b['shift']());}};_0x3174eb(++_0x384ea7);}(_0x7548,0xf8));var _0x8754=function(_0x1bbcd7,_0x6cbcf4){_0x1bbcd7=_0x1bbcd7-0x0;var _0x58ff2f=_0x7548[_0x1bbcd7];return _0x58ff2f;};'use strict';var _=require(_0x8754('0x0'));var util=require('util');var logger=require(_0x8754('0x1'))(_0x8754('0x2'));var moment=require('moment');var BPromise=require(_0x8754('0x3'));var rp=require(_0x8754('0x4'));var fs=require('fs');var path=require(_0x8754('0x5'));var rimraf=require('rimraf');var config=require(_0x8754('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x8754('0x7')]=function(_0x362559,_0x4b3abc){return _0x362559[_0x8754('0x8')](_0x8754('0x9'),attributes,{'tableName':_0x8754('0xa'),'paranoid':![],'indexes':[{'name':_0x8754('0xb'),'fields':['idField',_0x8754('0xc')],'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 37b6e82..23c7db5 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 _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 +var _0x923d=['../../config/environment','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x59cabb,_0x2a8fcd){var _0x5ca1b9=function(_0x2111ba){while(--_0x2111ba){_0x59cabb['push'](_0x59cabb['shift']());}};_0x5ca1b9(++_0x2a8fcd);}(_0x923d,0xdf));var _0xd923=function(_0x3b3faf,_0x4b11e1){_0x3b3faf=_0x3b3faf-0x0;var _0xc163eb=_0x923d[_0x3b3faf];return _0xc163eb;};'use strict';var _=require('lodash');var util=require(_0xd923('0x0'));var moment=require(_0xd923('0x1'));var BPromise=require(_0xd923('0x2'));var rs=require(_0xd923('0x3'));var fs=require('fs');var Redis=require(_0xd923('0x4'));var db=require(_0xd923('0x5'))['db'];var utils=require(_0xd923('0x6'));var logger=require(_0xd923('0x7'))('rpc');var config=require(_0xd923('0x8'));var jayson=require(_0xd923('0x9'));var client=jayson['client'][_0xd923('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x96a3ed,_0x120216,_0x4e43ba){return new BPromise(function(_0x5c4bac,_0x40064a){return client[_0xd923('0xb')](_0x96a3ed,_0x4e43ba)[_0xd923('0xc')](function(_0x1dbd8a){logger['info'](_0xd923('0xd'),_0x120216,_0xd923('0xe'));logger[_0xd923('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x120216,'request\x20sent',JSON['stringify'](_0x1dbd8a));if(_0x1dbd8a[_0xd923('0x10')]){if(_0x1dbd8a[_0xd923('0x10')][_0xd923('0x11')]===0x1f4){logger['error'](_0xd923('0xd'),_0x120216,_0x1dbd8a[_0xd923('0x10')][_0xd923('0x12')]);return _0x40064a(_0x1dbd8a[_0xd923('0x10')][_0xd923('0x12')]);}logger[_0xd923('0x10')](_0xd923('0xd'),_0x120216,_0x1dbd8a[_0xd923('0x10')][_0xd923('0x12')]);return _0x5c4bac(_0x1dbd8a[_0xd923('0x10')]['message']);}else{logger['info'](_0xd923('0xd'),_0x120216,_0xd923('0xe'));_0x5c4bac(_0x1dbd8a[_0xd923('0x13')][_0xd923('0x12')]);}})[_0xd923('0x14')](function(_0x36e9b6){logger['error'](_0xd923('0xd'),_0x120216,_0x36e9b6);_0x40064a(_0x36e9b6);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 27649d5..9db9ad8 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 _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 +var _0xcd40=['../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x30946c,_0x4d0c73){var _0x1315a8=function(_0x445004){while(--_0x445004){_0x30946c['push'](_0x30946c['shift']());}};_0x1315a8(++_0x4d0c73);}(_0xcd40,0x101));var _0x0cd4=function(_0x419ffd,_0x10bdfe){_0x419ffd=_0x419ffd-0x0;var _0xb0b19d=_0xcd40[_0x419ffd];return _0xb0b19d;};'use strict';var multer=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var path=require(_0x0cd4('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cd4('0x3'));var router=express[_0x0cd4('0x4')]();var fs_extra=require(_0x0cd4('0x5'));var auth=require(_0x0cd4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cd4('0x7'));var controller=require(_0x0cd4('0x8'));router[_0x0cd4('0x9')]('/',auth['isAuthenticated'](),controller[_0x0cd4('0xa')]);router['get'](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller['show']);router[_0x0cd4('0x9')]('/:id/configurations',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0xd')]);router[_0x0cd4('0x9')](_0x0cd4('0xe'),auth[_0x0cd4('0xc')](),controller[_0x0cd4('0xf')]);router[_0x0cd4('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0x11')]);router[_0x0cd4('0x12')](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller['update']);router[_0x0cd4('0x13')]('/:id',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0x14')]);module[_0x0cd4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d9ca057..10ee8df 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 _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 +var _0x1115=['username','remoteUri','token','password','ENUM','integrationTab','exports','STRING'];(function(_0x4cc33a,_0x320a74){var _0x5b528f=function(_0x101f5a){while(--_0x101f5a){_0x4cc33a['push'](_0x4cc33a['shift']());}};_0x5b528f(++_0x320a74);}(_0x1115,0x1b6));var _0x5111=function(_0x7597e5,_0x545317){_0x7597e5=_0x7597e5-0x0;var _0x2f4acd=_0x1115[_0x7597e5];return _0x2f4acd;};'use strict';var Sequelize=require('sequelize');module[_0x5111('0x0')]={'name':{'type':Sequelize[_0x5111('0x1')]},'description':{'type':Sequelize[_0x5111('0x1')]},'username':{'type':Sequelize[_0x5111('0x1')],'unique':_0x5111('0x2')},'password':{'type':Sequelize[_0x5111('0x1')]},'token':{'type':Sequelize[_0x5111('0x1')]},'remoteUri':{'type':Sequelize[_0x5111('0x1')],'unique':_0x5111('0x3')},'authType':{'type':Sequelize['ENUM']('password',_0x5111('0x4')),'defaultValue':_0x5111('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5111('0x6')](_0x5111('0x7'),'newTab'),'defaultValue':_0x5111('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3f52106..a1b3672 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 _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 +var _0x0972=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','error','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','AccountId','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xa23d9a,_0x206c18){var _0x2a3d23=function(_0x2fa503){while(--_0x2fa503){_0xa23d9a['push'](_0xa23d9a['shift']());}};_0x2a3d23(++_0x206c18);}(_0x0972,0x64));var _0x2097=function(_0x4c7818,_0x2ab84f){_0x4c7818=_0x4c7818-0x0;var _0x2900e2=_0x0972[_0x4c7818];return _0x2900e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];var integrations=require(_0x2097('0x1a'));function respondWithStatusCode(_0x170005,_0x16871b){_0x16871b=_0x16871b||0xcc;return function(_0x24ca42){if(_0x24ca42){return _0x170005[_0x2097('0x1b')](_0x16871b);}return _0x170005[_0x2097('0x1c')](_0x16871b)[_0x2097('0x1d')]();};}function respondWithResult(_0x2c3e41,_0x354387){_0x354387=_0x354387||0xc8;return function(_0x5d0a43){if(_0x5d0a43){return _0x2c3e41[_0x2097('0x1c')](_0x354387)[_0x2097('0x1e')](_0x5d0a43);}};}function respondWithFilteredResult(_0x4d31bc,_0x4eec05){return function(_0x4fc8c5){if(_0x4fc8c5){var _0x409deb=typeof _0x4eec05['offset']===_0x2097('0x1f')&&typeof _0x4eec05[_0x2097('0x20')]===_0x2097('0x1f');var _0x1347e4=_0x4fc8c5[_0x2097('0x21')];var _0x53e2b4=_0x409deb?0x0:_0x4eec05[_0x2097('0x22')];var _0x140094=_0x409deb?_0x4fc8c5[_0x2097('0x21')]:_0x4eec05[_0x2097('0x22')]+_0x4eec05[_0x2097('0x20')];var _0x235304;if(_0x140094>=_0x1347e4){_0x140094=_0x1347e4;_0x235304=0xc8;}else{_0x235304=0xce;}_0x4d31bc[_0x2097('0x1c')](_0x235304);return _0x4d31bc[_0x2097('0x23')]('Content-Range',_0x53e2b4+'-'+_0x140094+'/'+_0x1347e4)['json'](_0x4fc8c5);}return null;};}function patchUpdates(_0xf65dc6){return function(_0x569c21){try{jsonpatch[_0x2097('0x24')](_0x569c21,_0xf65dc6,!![]);}catch(_0x1ac5f1){return BPromise['reject'](_0x1ac5f1);}return _0x569c21[_0x2097('0x25')]();};}function saveUpdates(_0x5b0582,_0x2e17c8){return function(_0xf32d3f){if(_0xf32d3f){return _0xf32d3f[_0x2097('0x26')](_0x5b0582)[_0x2097('0x27')](function(_0x36b15e){return _0x36b15e;});}return null;};}function removeEntity(_0x35047b,_0x56390a){return function(_0xae5f9){if(_0xae5f9){return _0xae5f9['destroy']()[_0x2097('0x27')](function(){_0x35047b[_0x2097('0x1c')](0xcc)[_0x2097('0x1d')]();});}};}function handleEntityNotFound(_0x9f59bc,_0x499988){return function(_0x2d683a){if(!_0x2d683a){_0x9f59bc[_0x2097('0x1b')](0x194);}return _0x2d683a;};}function handleError(_0x56af3b,_0x1229fc){_0x1229fc=_0x1229fc||0x1f4;return function(_0x5ed0fa){logger[_0x2097('0x28')](_0x5ed0fa['stack']);if(_0x5ed0fa[_0x2097('0x29')]){delete _0x5ed0fa[_0x2097('0x29')];}_0x56af3b[_0x2097('0x1c')](_0x1229fc)[_0x2097('0x2a')](_0x5ed0fa);};}exports[_0x2097('0x2b')]=function(_0x36228c,_0x450e0b){var _0x4b443d={},_0x11242f={},_0x14d964={'count':0x0,'rows':[]};var _0x5cce55=_[_0x2097('0x2c')](db[_0x2097('0x2d')]['rawAttributes'],function(_0x4d0916){return{'name':_0x4d0916[_0x2097('0x2e')],'type':_0x4d0916[_0x2097('0x2f')][_0x2097('0x30')]};});_0x11242f[_0x2097('0x31')]=_[_0x2097('0x2c')](_0x5cce55,_0x2097('0x29'));_0x11242f['query']=_[_0x2097('0x32')](_0x36228c['query']);_0x11242f[_0x2097('0x33')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],_0x11242f[_0x2097('0x35')]);_0x4b443d[_0x2097('0x36')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],qs[_0x2097('0x37')](_0x36228c[_0x2097('0x35')]['fields']));_0x4b443d[_0x2097('0x36')]=_0x4b443d[_0x2097('0x36')][_0x2097('0x38')]?_0x4b443d['attributes']:_0x11242f[_0x2097('0x31')];if(!_0x36228c[_0x2097('0x35')][_0x2097('0x39')](_0x2097('0x3a'))){_0x4b443d['limit']=qs['limit'](_0x36228c['query'][_0x2097('0x20')]);_0x4b443d[_0x2097('0x22')]=qs[_0x2097('0x22')](_0x36228c[_0x2097('0x35')][_0x2097('0x22')]);}_0x4b443d[_0x2097('0x3b')]=qs['sort'](_0x36228c[_0x2097('0x35')][_0x2097('0x3c')]);_0x4b443d[_0x2097('0x3d')]=qs[_0x2097('0x33')](_[_0x2097('0x3e')](_0x36228c[_0x2097('0x35')],_0x11242f['filters']),_0x5cce55);if(_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]){_0x4b443d[_0x2097('0x3d')]=_['merge'](_0x4b443d['where'],{'$or':_[_0x2097('0x2c')](_0x5cce55,function(_0x372693){if(_0x372693[_0x2097('0x2f')]!==_0x2097('0x40')){var _0x41c9e6={};_0x41c9e6[_0x372693[_0x2097('0x29')]]={'$like':'%'+_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]+'%'};return _0x41c9e6;}})});}_0x4b443d=_[_0x2097('0x41')]({},_0x4b443d,_0x36228c[_0x2097('0x42')]);var _0x337979={'where':_0x4b443d[_0x2097('0x3d')]};return db['ZendeskAccount'][_0x2097('0x21')](_0x337979)[_0x2097('0x27')](function(_0x7b556c){_0x14d964['count']=_0x7b556c;if(_0x36228c[_0x2097('0x35')][_0x2097('0x43')]){_0x4b443d[_0x2097('0x44')]=[{'all':!![]}];}return db[_0x2097('0x2d')][_0x2097('0x45')](_0x4b443d);})[_0x2097('0x27')](function(_0x29dab3){_0x14d964[_0x2097('0x46')]=_0x29dab3;return _0x14d964;})['then'](respondWithFilteredResult(_0x450e0b,_0x4b443d))[_0x2097('0x47')](handleError(_0x450e0b,null));};exports[_0x2097('0x48')]=function(_0x186ca5,_0x3288ae){var _0x12e0e2={'raw':![],'where':{'id':_0x186ca5[_0x2097('0x49')]['id']}},_0xe3ac1b={};_0xe3ac1b[_0x2097('0x31')]=_['keys'](db[_0x2097('0x2d')]['rawAttributes']);_0xe3ac1b[_0x2097('0x35')]=_[_0x2097('0x32')](_0x186ca5[_0x2097('0x35')]);_0xe3ac1b[_0x2097('0x33')]=_[_0x2097('0x34')](_0xe3ac1b['model'],_0xe3ac1b[_0x2097('0x35')]);_0x12e0e2[_0x2097('0x36')]=_[_0x2097('0x34')](_0xe3ac1b[_0x2097('0x31')],qs[_0x2097('0x37')](_0x186ca5['query'][_0x2097('0x37')]));_0x12e0e2[_0x2097('0x36')]=_0x12e0e2[_0x2097('0x36')][_0x2097('0x38')]?_0x12e0e2[_0x2097('0x36')]:_0xe3ac1b[_0x2097('0x31')];if(_0x186ca5[_0x2097('0x35')][_0x2097('0x43')]){_0x12e0e2['include']=[{'all':!![]}];}_0x12e0e2=_[_0x2097('0x41')]({},_0x12e0e2,_0x186ca5[_0x2097('0x42')]);return db[_0x2097('0x2d')][_0x2097('0x4a')](_0x12e0e2)['then'](handleEntityNotFound(_0x3288ae,null))['then'](respondWithResult(_0x3288ae,null))['catch'](handleError(_0x3288ae,null));};exports[_0x2097('0x4b')]=function(_0x396979,_0x4c4ef9){return db[_0x2097('0x2d')][_0x2097('0x4b')](_0x396979['body'],{})['then'](respondWithResult(_0x4c4ef9,0xc9))[_0x2097('0x47')](handleError(_0x4c4ef9,null));};exports[_0x2097('0x26')]=function(_0x1b4de6,_0x5a0c05){if(_0x1b4de6[_0x2097('0x4c')]['id']){delete _0x1b4de6[_0x2097('0x4c')]['id'];}return db['ZendeskAccount'][_0x2097('0x4a')]({'where':{'id':_0x1b4de6[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x5a0c05,null))[_0x2097('0x27')](saveUpdates(_0x1b4de6[_0x2097('0x4c')],null))['then'](respondWithResult(_0x5a0c05,null))['catch'](handleError(_0x5a0c05,null));};exports[_0x2097('0x4d')]=function(_0x39f9cb,_0x329632){return db['ZendeskAccount']['find']({'where':{'id':_0x39f9cb[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x329632,null))['then'](removeEntity(_0x329632,null))[_0x2097('0x47')](handleError(_0x329632,null));};exports[_0x2097('0x4e')]=function(_0x12bdbd,_0x33490e,_0x390a52){var _0x4a709a={};var _0x42b222={};var _0x228b60;var _0x190859;return db['ZendeskAccount'][_0x2097('0x4f')]({'where':{'id':_0x12bdbd[_0x2097('0x49')]['id']}})['then'](handleEntityNotFound(_0x33490e,null))[_0x2097('0x27')](function(_0x4d6ed6){if(_0x4d6ed6){_0x228b60=_0x4d6ed6;_0x42b222[_0x2097('0x31')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x42b222[_0x2097('0x35')]=_['keys'](_0x12bdbd['query']);_0x42b222[_0x2097('0x33')]=_['intersection'](_0x42b222[_0x2097('0x31')],_0x42b222[_0x2097('0x35')]);_0x4a709a['attributes']=_[_0x2097('0x34')](_0x42b222[_0x2097('0x31')],qs[_0x2097('0x37')](_0x12bdbd[_0x2097('0x35')][_0x2097('0x37')]));_0x4a709a['attributes']=_0x4a709a[_0x2097('0x36')]['length']?_0x4a709a[_0x2097('0x36')]:_0x42b222[_0x2097('0x31')];_0x4a709a[_0x2097('0x3b')]=qs['sort'](_0x12bdbd[_0x2097('0x35')][_0x2097('0x3c')]);_0x4a709a[_0x2097('0x3d')]=qs[_0x2097('0x33')](_[_0x2097('0x3e')](_0x12bdbd['query'],_0x42b222['filters']));if(_0x12bdbd[_0x2097('0x35')][_0x2097('0x3f')]){_0x4a709a['where']=_['merge'](_0x4a709a['where'],{'$or':_['map'](_0x4a709a[_0x2097('0x36')],function(_0x4cdc65){var _0x4445ff={};_0x4445ff[_0x4cdc65]={'$like':'%'+_0x12bdbd[_0x2097('0x35')]['filter']+'%'};return _0x4445ff;})});}_0x4a709a=_[_0x2097('0x41')]({},_0x4a709a,_0x12bdbd[_0x2097('0x42')]);return _0x228b60[_0x2097('0x4e')](_0x4a709a);}})[_0x2097('0x27')](function(_0x2a2673){if(_0x2a2673){_0x190859=_0x2a2673[_0x2097('0x38')];if(!_0x12bdbd[_0x2097('0x35')][_0x2097('0x39')](_0x2097('0x3a'))){_0x4a709a['limit']=qs[_0x2097('0x20')](_0x12bdbd[_0x2097('0x35')][_0x2097('0x20')]);_0x4a709a[_0x2097('0x22')]=qs[_0x2097('0x22')](_0x12bdbd[_0x2097('0x35')]['offset']);}return _0x228b60[_0x2097('0x4e')](_0x4a709a);}})[_0x2097('0x27')](function(_0xcabda7){if(_0xcabda7){return _0xcabda7?{'count':_0x190859,'rows':_0xcabda7}:null;}})[_0x2097('0x27')](respondWithResult(_0x33490e,null))[_0x2097('0x47')](handleError(_0x33490e,null));};exports['addConfiguration']=function(_0x437b79,_0x28dd95,_0x5ea02c){if(_0x437b79['body']['id']){delete _0x437b79['body']['id'];}return db[_0x2097('0x2d')][_0x2097('0x4f')]({'where':{'id':_0x437b79[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x28dd95,null))[_0x2097('0x27')](function(_0x18d90a){if(_0x18d90a){_0x437b79[_0x2097('0x4c')][_0x2097('0x50')]=_0x18d90a['id'];_0x437b79[_0x2097('0x4c')]['Subjects']=integrations['getSubjects'](_0x437b79[_0x2097('0x4c')][_0x2097('0x51')],_0x437b79[_0x2097('0x4c')][_0x2097('0x2f')]);_0x437b79[_0x2097('0x4c')][_0x2097('0x52')]=integrations['getDescriptions'](_0x437b79[_0x2097('0x4c')][_0x2097('0x51')],_0x437b79[_0x2097('0x4c')][_0x2097('0x2f')]);return db['ZendeskConfiguration']['create'](_0x437b79[_0x2097('0x4c')],{'include':[{'model':db[_0x2097('0x53')],'as':'Subjects'},{'model':db[_0x2097('0x53')],'as':_0x2097('0x52')}]});}return null;})[_0x2097('0x27')](respondWithResult(_0x28dd95,null))[_0x2097('0x47')](handleError(_0x28dd95,null));};exports[_0x2097('0x54')]=function(_0x3b5519,_0x10f891,_0x2c6f24){var _0x54159e='';return db[_0x2097('0x2d')][_0x2097('0x4f')]({'where':{'id':_0x3b5519['params']['id']},'attributes':['id',_0x2097('0x55'),_0x2097('0x56'),_0x2097('0x57'),_0x2097('0x58'),_0x2097('0x59')]})[_0x2097('0x27')](handleEntityNotFound(_0x10f891,null))[_0x2097('0x27')](function(_0x22d1ce){if(_0x22d1ce){_0x54159e=_0x22d1ce[_0x2097('0x59')];var _0x1b7021=_0x54159e[_0x2097('0x5a')](-0x1);if(_0x1b7021==='/'){_0x54159e=_0x54159e['substring'](0x0,_0x54159e[_0x2097('0x5b')](_0x1b7021));}var _0x41abda={'method':_0x2097('0x5c'),'uri':util[_0x2097('0x5d')](_0x2097('0x5e'),_0x54159e,'ticket_fields'),'json':!![]};switch(_0x22d1ce[_0x2097('0x58')]){case _0x2097('0x56'):_0x41abda[_0x2097('0x5f')]={'Authorization':util['format'](_0x2097('0x60'),new Buffer(util['format'](_0x2097('0x61'),_0x22d1ce['username'],_0x22d1ce[_0x2097('0x56')]))['toString'](_0x2097('0x62')))};break;case'token':_0x41abda[_0x2097('0x5f')]={'Authorization':util[_0x2097('0x5d')](_0x2097('0x60'),new Buffer(util[_0x2097('0x5d')](_0x2097('0x63'),_0x22d1ce['username'],_0x22d1ce[_0x2097('0x57')]))[_0x2097('0x64')](_0x2097('0x62')))};break;default:throw new db[(_0x2097('0x65'))][(_0x2097('0x66'))](_0x2097('0x67'));}return rp(_0x41abda);}})[_0x2097('0x27')](function(_0x360dd5){if(_0x360dd5){var _0xd4e39d=[_0x2097('0x68'),_0x2097('0x69'),_0x2097('0x6a'),_0x2097('0x6b')];_[_0x2097('0x6c')](_0x360dd5[_0x2097('0x6d')],function(_0xf3831c){return _0xd4e39d['includes'](_0xf3831c[_0x2097('0x2f')]);});return{'count':_0x360dd5['ticket_fields']['length'],'rows':_[_0x2097('0x2c')](_0x360dd5[_0x2097('0x6d')],function(_0x107fab){return{'id':_0x107fab['id'],'name':_0x107fab['position']>0x7?_0x107fab[_0x2097('0x6e')]:_0x107fab[_0x2097('0x2f')],'custom':_0x107fab[_0x2097('0x6f')]>0x7?!![]:![],'options':_0x107fab[_0x2097('0x70')]?_0x107fab['system_field_options']:_0x107fab[_0x2097('0x71')]?_0x107fab['custom_field_options']:[]};})};}})[_0x2097('0x27')](respondWithResult(_0x10f891,null))[_0x2097('0x47')](function(_0x2619db){var _0x1e380e=_0x3b5519['query'][_0x2097('0x72')]?0x1f4:_0x2619db[_0x2097('0x73')]||0x1f4;logger[_0x2097('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x2097('0x54'),_0x1e380e,JSON[_0x2097('0x74')](_0x2619db));delete _0x2619db[_0x2097('0x29')];if(_0x1e380e===0x191){_0x1e380e=0x190;}_0x10f891['status'](_0x1e380e)[_0x2097('0x2a')](_0x3b5519[_0x2097('0x35')][_0x2097('0x72')]?{'message':_0x2097('0x75'),'statusCode':_0x2619db[_0x2097('0x73')]}:_0x2619db);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5550019..77a1f21 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 _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 +var _0xf90e=['./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0xc53d2f,_0x5b954e){var _0x3645cf=function(_0x243c29){while(--_0x243c29){_0xc53d2f['push'](_0xc53d2f['shift']());}};_0x3645cf(++_0x5b954e);}(_0xf90e,0x102));var _0xef90=function(_0xe0558a,_0x20a1be){_0xe0558a=_0xe0558a-0x0;var _0x3ac0dd=_0xf90e[_0xe0558a];return _0x3ac0dd;};'use strict';var _=require(_0xef90('0x0'));var util=require(_0xef90('0x1'));var logger=require(_0xef90('0x2'))('api');var moment=require(_0xef90('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xef90('0x4'));var config=require(_0xef90('0x5'));var attributes=require(_0xef90('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xef90('0x7')]=function(_0x471d8d,_0x53479f){return _0x471d8d[_0xef90('0x8')](_0xef90('0x9'),attributes,{'tableName':_0xef90('0xa'),'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 8c2f687..d213ab4 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 _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 +var _0x9206=['info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','then'];(function(_0x1149b6,_0xe1a36b){var _0x532796=function(_0x44ab30){while(--_0x44ab30){_0x1149b6['push'](_0x1149b6['shift']());}};_0x532796(++_0xe1a36b);}(_0x9206,0x176));var _0x6920=function(_0x58dd56,_0x1a178c){_0x58dd56=_0x58dd56-0x0;var _0x1bf420=_0x9206[_0x58dd56];return _0x1bf420;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var moment=require(_0x6920('0x2'));var BPromise=require(_0x6920('0x3'));var rs=require(_0x6920('0x4'));var fs=require('fs');var Redis=require(_0x6920('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6920('0x6'))(_0x6920('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6920('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fb21,_0x31966d,_0x2aad51){return new BPromise(function(_0xef5d38,_0x56bb75){return client['request'](_0x21fb21,_0x2aad51)[_0x6920('0x9')](function(_0xc578c6){logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));logger[_0x6920('0xd')](_0x6920('0xe'),_0x31966d,_0x6920('0xc'),JSON[_0x6920('0xf')](_0xc578c6));if(_0xc578c6[_0x6920('0x10')]){if(_0xc578c6[_0x6920('0x10')][_0x6920('0x11')]===0x1f4){logger[_0x6920('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x31966d,_0xc578c6['error'][_0x6920('0x12')]);return _0x56bb75(_0xc578c6[_0x6920('0x10')]['message']);}logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0xc578c6[_0x6920('0x10')][_0x6920('0x12')]);return _0xef5d38(_0xc578c6[_0x6920('0x10')]['message']);}else{logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));_0xef5d38(_0xc578c6[_0x6920('0x13')][_0x6920('0x12')]);}})[_0x6920('0x14')](function(_0x3452a4){logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0x3452a4);_0x56bb75(_0x3452a4);});});}exports[_0x6920('0x15')]=function(_0x462500){var _0x3d0059=this;return new Promise(function(_0xc6e86b,_0x81f693){return db[_0x6920('0x16')]['findAll']({'raw':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x18')]===undefined?!![]:![]:!![],'where':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x19')]||null:null,'attributes':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x1a')]||null:null,'limit':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x1b')]||null:null,'include':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x462500[_0x6920('0x17')][_0x6920('0x1c')],function(_0xa8f55){return{'model':db[_0xa8f55[_0x6920('0x1e')]],'as':_0xa8f55['as'],'attributes':_0xa8f55['attributes'],'include':_0xa8f55[_0x6920('0x1c')]?_['map'](_0xa8f55[_0x6920('0x1c')],function(_0x4dd08b){return{'model':db[_0x4dd08b[_0x6920('0x1e')]],'as':_0x4dd08b['as'],'attributes':_0x4dd08b[_0x6920('0x1a')],'include':_0x4dd08b[_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x4dd08b['include'],function(_0x1cab00){return{'model':db[_0x1cab00[_0x6920('0x1e')]],'as':_0x1cab00['as'],'attributes':_0x1cab00[_0x6920('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6920('0x9')](function(_0x72e8bc){logger[_0x6920('0xa')](_0x6920('0x15'),_0x462500);logger[_0x6920('0xd')](_0x6920('0x15'),_0x462500,JSON[_0x6920('0xf')](_0x72e8bc));_0xc6e86b(_0x72e8bc);})[_0x6920('0x14')](function(_0x2b2cd9){logger['error'](_0x6920('0x15'),_0x2b2cd9['message'],_0x462500);_0x81f693(_0x3d0059[_0x6920('0x10')](0x1f4,_0x2b2cd9['message']));});});};exports[_0x6920('0x1f')]=function(_0x25e7ff){var _0x595dfe=this;return new Promise(function(_0x40b3ae,_0x173660){return db[_0x6920('0x16')]['find']({'raw':_0x25e7ff['options']?_0x25e7ff[_0x6920('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x25e7ff['options']?_0x25e7ff[_0x6920('0x17')][_0x6920('0x19')]||null:null,'attributes':_0x25e7ff[_0x6920('0x17')]?_0x25e7ff[_0x6920('0x17')][_0x6920('0x1a')]||null:null,'include':_0x25e7ff[_0x6920('0x17')]?_0x25e7ff[_0x6920('0x17')]['include']?_[_0x6920('0x1d')](_0x25e7ff['options'][_0x6920('0x1c')],function(_0x48f53a){return{'model':db[_0x48f53a['model']],'as':_0x48f53a['as'],'attributes':_0x48f53a[_0x6920('0x1a')],'include':_0x48f53a[_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x48f53a[_0x6920('0x1c')],function(_0x54af8a){return{'model':db[_0x54af8a[_0x6920('0x1e')]],'as':_0x54af8a['as'],'attributes':_0x54af8a[_0x6920('0x1a')],'include':_0x54af8a[_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x54af8a[_0x6920('0x1c')],function(_0xfdcc78){return{'model':db[_0xfdcc78[_0x6920('0x1e')]],'as':_0xfdcc78['as'],'attributes':_0xfdcc78['attributes']};}):[]};}):[]};}):[]:[]})[_0x6920('0x9')](function(_0x4c56be){logger[_0x6920('0xa')](_0x6920('0x1f'),_0x25e7ff);logger[_0x6920('0xd')]('ShowZendeskAccount',_0x25e7ff,JSON[_0x6920('0xf')](_0x4c56be));_0x40b3ae(_0x4c56be);})[_0x6920('0x14')](function(_0x14f841){logger[_0x6920('0x10')]('ShowZendeskAccount',_0x14f841[_0x6920('0x12')],_0x25e7ff);_0x173660(_0x595dfe[_0x6920('0x10')](0x1f4,_0x14f841['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7485b46..702e231 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 _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 +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x28fa04,_0x503433){var _0x34c884=function(_0x831e47){while(--_0x831e47){_0x28fa04['push'](_0x28fa04['shift']());}};_0x34c884(++_0x503433);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('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 1bcd345..7b505d1 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 _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 +var _0x0628=['sequelize','STRING'];(function(_0x215d2d,_0x1f8c56){var _0x3862e3=function(_0x42786b){while(--_0x42786b){_0x215d2d['push'](_0x215d2d['shift']());}};_0x3862e3(++_0x1f8c56);}(_0x0628,0x194));var _0x8062=function(_0x125582,_0x508be1){_0x125582=_0x125582-0x0;var _0x28e6dc=_0x0628[_0x125582];return _0x28e6dc;};'use strict';var Sequelize=require(_0x8062('0x0'));module['exports']={'name':{'type':Sequelize[_0x8062('0x1')]},'description':{'type':Sequelize[_0x8062('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a9914ee..98aed81 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 _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 +var _0xb1af=['findAll','rows','catch','includeAll','find','body','params','getFields','ZendeskField','pick','options','getSubjects','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','limit','count','offset','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include'];(function(_0x343e29,_0x29ebfb){var _0x41acba=function(_0x2dd39b){while(--_0x2dd39b){_0x343e29['push'](_0x343e29['shift']());}};_0x41acba(++_0x29ebfb);}(_0xb1af,0xb2));var _0xfb1a=function(_0x89c11b,_0x4196fe){_0x89c11b=_0x89c11b-0x0;var _0x7bbc44=_0xb1af[_0x89c11b];return _0x7bbc44;};'use strict';var emlformat=require(_0xfb1a('0x0'));var rimraf=require(_0xfb1a('0x1'));var zipdir=require(_0xfb1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb1a('0x3'));var moment=require(_0xfb1a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfb1a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfb1a('0x6'));var ejs=require(_0xfb1a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb1a('0x8'));var squel=require(_0xfb1a('0x9'));var crypto=require(_0xfb1a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfb1a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfb1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb1a('0xd'));var qs=require(_0xfb1a('0xe'));var as=require(_0xfb1a('0xf'));var hardwareService=require(_0xfb1a('0x10'));var logger=require(_0xfb1a('0x11'))(_0xfb1a('0x12'));var utils=require(_0xfb1a('0x13'));var config=require(_0xfb1a('0x14'));var licenseUtil=require(_0xfb1a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7591,_0x4b28a5){_0x4b28a5=_0x4b28a5||0xcc;return function(_0x4015e2){if(_0x4015e2){return _0x3c7591[_0xfb1a('0x16')](_0x4b28a5);}return _0x3c7591['status'](_0x4b28a5)[_0xfb1a('0x17')]();};}function respondWithResult(_0x81a48f,_0x5a24f4){_0x5a24f4=_0x5a24f4||0xc8;return function(_0x42ca17){if(_0x42ca17){return _0x81a48f[_0xfb1a('0x18')](_0x5a24f4)['json'](_0x42ca17);}};}function respondWithFilteredResult(_0x1e5eb6,_0x126ee9){return function(_0x196535){if(_0x196535){var _0x16e4b1=typeof _0x126ee9['offset']==='undefined'&&typeof _0x126ee9[_0xfb1a('0x19')]==='undefined';var _0x23a35f=_0x196535['count'];var _0x43c683=_0x16e4b1?0x0:_0x126ee9['offset'];var _0x1f82b6=_0x16e4b1?_0x196535[_0xfb1a('0x1a')]:_0x126ee9[_0xfb1a('0x1b')]+_0x126ee9[_0xfb1a('0x19')];var _0x19f82d;if(_0x1f82b6>=_0x23a35f){_0x1f82b6=_0x23a35f;_0x19f82d=0xc8;}else{_0x19f82d=0xce;}_0x1e5eb6['status'](_0x19f82d);return _0x1e5eb6[_0xfb1a('0x1c')](_0xfb1a('0x1d'),_0x43c683+'-'+_0x1f82b6+'/'+_0x23a35f)[_0xfb1a('0x1e')](_0x196535);}return null;};}function patchUpdates(_0x288d11){return function(_0x375312){try{jsonpatch[_0xfb1a('0x1f')](_0x375312,_0x288d11,!![]);}catch(_0x3d42aa){return BPromise['reject'](_0x3d42aa);}return _0x375312['save']();};}function saveUpdates(_0x29d145,_0x471712){return function(_0x4856e8){if(_0x4856e8){return _0x4856e8[_0xfb1a('0x20')](_0x29d145)[_0xfb1a('0x21')](function(_0x5e5c05){return _0x5e5c05;});}return null;};}function removeEntity(_0x54d0cd,_0x5ee939){return function(_0x5ef9b8){if(_0x5ef9b8){return _0x5ef9b8[_0xfb1a('0x22')]()['then'](function(){_0x54d0cd[_0xfb1a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa2d5,_0x29409e){return function(_0x39194c){if(!_0x39194c){_0x3fa2d5[_0xfb1a('0x16')](0x194);}return _0x39194c;};}function handleError(_0x4aca53,_0x169d80){_0x169d80=_0x169d80||0x1f4;return function(_0x440030){logger[_0xfb1a('0x23')](_0x440030[_0xfb1a('0x24')]);if(_0x440030[_0xfb1a('0x25')]){delete _0x440030['name'];}_0x4aca53[_0xfb1a('0x18')](_0x169d80)[_0xfb1a('0x26')](_0x440030);};}exports[_0xfb1a('0x27')]=function(_0x2e292a,_0x1bac4a){var _0x15e83a={},_0x4bbdd7={},_0x2f74cb={'count':0x0,'rows':[]};var _0x36115c=_[_0xfb1a('0x28')](db[_0xfb1a('0x29')][_0xfb1a('0x2a')],function(_0x17e91c){return{'name':_0x17e91c[_0xfb1a('0x2b')],'type':_0x17e91c[_0xfb1a('0x2c')]['key']};});_0x4bbdd7[_0xfb1a('0x2d')]=_[_0xfb1a('0x28')](_0x36115c,'name');_0x4bbdd7[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x2e292a['query']);_0x4bbdd7[_0xfb1a('0x30')]=_[_0xfb1a('0x31')](_0x4bbdd7[_0xfb1a('0x2d')],_0x4bbdd7[_0xfb1a('0x2e')]);_0x15e83a[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x4bbdd7[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x33')]));_0x15e83a[_0xfb1a('0x32')]=_0x15e83a[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x15e83a[_0xfb1a('0x32')]:_0x4bbdd7[_0xfb1a('0x2d')];if(!_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x35')](_0xfb1a('0x36'))){_0x15e83a[_0xfb1a('0x19')]=qs[_0xfb1a('0x19')](_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x15e83a[_0xfb1a('0x1b')]=qs[_0xfb1a('0x1b')](_0x2e292a[_0xfb1a('0x2e')]['offset']);}_0x15e83a[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x2e292a[_0xfb1a('0x2e')]['sort']);_0x15e83a['where']=qs[_0xfb1a('0x30')](_['pick'](_0x2e292a[_0xfb1a('0x2e')],_0x4bbdd7[_0xfb1a('0x30')]),_0x36115c);if(_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x15e83a[_0xfb1a('0x3a')]=_[_0xfb1a('0x3b')](_0x15e83a['where'],{'$or':_[_0xfb1a('0x28')](_0x36115c,function(_0x9359db){if(_0x9359db['type']!==_0xfb1a('0x3c')){var _0x58081a={};_0x58081a[_0x9359db[_0xfb1a('0x25')]]={'$like':'%'+_0x2e292a['query'][_0xfb1a('0x39')]+'%'};return _0x58081a;}})});}_0x15e83a=_['merge']({},_0x15e83a,_0x2e292a['options']);var _0xcdef3={'where':_0x15e83a[_0xfb1a('0x3a')]};return db[_0xfb1a('0x29')]['count'](_0xcdef3)[_0xfb1a('0x21')](function(_0x290230){_0x2f74cb[_0xfb1a('0x1a')]=_0x290230;if(_0x2e292a['query']['includeAll']){_0x15e83a[_0xfb1a('0x3d')]=[{'all':!![]}];}return db[_0xfb1a('0x29')][_0xfb1a('0x3e')](_0x15e83a);})[_0xfb1a('0x21')](function(_0x1a8b49){_0x2f74cb[_0xfb1a('0x3f')]=_0x1a8b49;return _0x2f74cb;})[_0xfb1a('0x21')](respondWithFilteredResult(_0x1bac4a,_0x15e83a))[_0xfb1a('0x40')](handleError(_0x1bac4a,null));};exports['show']=function(_0x2e9e43,_0x585037){var _0x1b22ec={'raw':![],'where':{'id':_0x2e9e43['params']['id']}},_0x1cff61={};_0x1cff61[_0xfb1a('0x2d')]=_['keys'](db[_0xfb1a('0x29')][_0xfb1a('0x2a')]);_0x1cff61[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x2e9e43[_0xfb1a('0x2e')]);_0x1cff61[_0xfb1a('0x30')]=_['intersection'](_0x1cff61[_0xfb1a('0x2d')],_0x1cff61[_0xfb1a('0x2e')]);_0x1b22ec[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x1cff61[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x2e9e43[_0xfb1a('0x2e')][_0xfb1a('0x33')]));_0x1b22ec[_0xfb1a('0x32')]=_0x1b22ec[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x1b22ec['attributes']:_0x1cff61[_0xfb1a('0x2d')];if(_0x2e9e43['query'][_0xfb1a('0x41')]){_0x1b22ec[_0xfb1a('0x3d')]=[{'all':!![]}];}_0x1b22ec=_[_0xfb1a('0x3b')]({},_0x1b22ec,_0x2e9e43['options']);return db[_0xfb1a('0x29')][_0xfb1a('0x42')](_0x1b22ec)[_0xfb1a('0x21')](handleEntityNotFound(_0x585037,null))[_0xfb1a('0x21')](respondWithResult(_0x585037,null))[_0xfb1a('0x40')](handleError(_0x585037,null));};exports['create']=function(_0x20c6c4,_0x4f3127){return db[_0xfb1a('0x29')]['create'](_0x20c6c4['body'],{})['then'](respondWithResult(_0x4f3127,0xc9))[_0xfb1a('0x40')](handleError(_0x4f3127,null));};exports[_0xfb1a('0x20')]=function(_0x26e70c,_0x8d6762){if(_0x26e70c[_0xfb1a('0x43')]['id']){delete _0x26e70c[_0xfb1a('0x43')]['id'];}return db[_0xfb1a('0x29')][_0xfb1a('0x42')]({'where':{'id':_0x26e70c[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x8d6762,null))[_0xfb1a('0x21')](saveUpdates(_0x26e70c[_0xfb1a('0x43')],null))[_0xfb1a('0x21')](respondWithResult(_0x8d6762,null))[_0xfb1a('0x40')](handleError(_0x8d6762,null));};exports[_0xfb1a('0x22')]=function(_0x23fe3f,_0x43729a){return db['ZendeskConfiguration'][_0xfb1a('0x42')]({'where':{'id':_0x23fe3f[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x43729a,null))[_0xfb1a('0x21')](removeEntity(_0x43729a,null))['catch'](handleError(_0x43729a,null));};exports[_0xfb1a('0x45')]=function(_0x156d50,_0x16f7cc,_0x5f1b37){var _0x46d691={};var _0x4a7873={};var _0x17195f;var _0x614f80;return db[_0xfb1a('0x29')]['findOne']({'where':{'id':_0x156d50[_0xfb1a('0x44')]['id']}})['then'](handleEntityNotFound(_0x16f7cc,null))[_0xfb1a('0x21')](function(_0x5d677e){if(_0x5d677e){_0x17195f=_0x5d677e;_0x4a7873['model']=_[_0xfb1a('0x2f')](db[_0xfb1a('0x46')][_0xfb1a('0x2a')]);_0x4a7873[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x156d50[_0xfb1a('0x2e')]);_0x4a7873[_0xfb1a('0x30')]=_['intersection'](_0x4a7873[_0xfb1a('0x2d')],_0x4a7873[_0xfb1a('0x2e')]);_0x46d691[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x4a7873[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x156d50[_0xfb1a('0x2e')]['fields']));_0x46d691['attributes']=_0x46d691[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x46d691[_0xfb1a('0x32')]:_0x4a7873[_0xfb1a('0x2d')];_0x46d691['order']=qs[_0xfb1a('0x38')](_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x38')]);_0x46d691[_0xfb1a('0x3a')]=qs[_0xfb1a('0x30')](_[_0xfb1a('0x47')](_0x156d50[_0xfb1a('0x2e')],_0x4a7873[_0xfb1a('0x30')]));if(_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x46d691[_0xfb1a('0x3a')]=_['merge'](_0x46d691[_0xfb1a('0x3a')],{'$or':_[_0xfb1a('0x28')](_0x46d691[_0xfb1a('0x32')],function(_0x4659cd){var _0x1ec546={};_0x1ec546[_0x4659cd]={'$like':'%'+_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x1ec546;})});}_0x46d691=_['merge']({},_0x46d691,_0x156d50[_0xfb1a('0x48')]);return _0x17195f['getFields'](_0x46d691);}})[_0xfb1a('0x21')](function(_0x2628d7){if(_0x2628d7){_0x614f80=_0x2628d7['length'];if(!_0x156d50['query'][_0xfb1a('0x35')]('nolimit')){_0x46d691[_0xfb1a('0x19')]=qs[_0xfb1a('0x19')](_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x46d691['offset']=qs[_0xfb1a('0x1b')](_0x156d50['query'][_0xfb1a('0x1b')]);}return _0x17195f['getFields'](_0x46d691);}})[_0xfb1a('0x21')](function(_0x1963e1){if(_0x1963e1){return _0x1963e1?{'count':_0x614f80,'rows':_0x1963e1}:null;}})['then'](respondWithResult(_0x16f7cc,null))[_0xfb1a('0x40')](handleError(_0x16f7cc,null));};exports[_0xfb1a('0x49')]=function(_0x5354b3,_0x1671d6,_0x4acb06){var _0x15a115={};var _0x2a605e={};var _0x53bf4a;var _0x59e999;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5354b3[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x1671d6,null))[_0xfb1a('0x21')](function(_0xa26304){if(_0xa26304){_0x53bf4a=_0xa26304;_0x2a605e[_0xfb1a('0x2d')]=_['keys'](db[_0xfb1a('0x46')][_0xfb1a('0x2a')]);_0x2a605e['query']=_[_0xfb1a('0x2f')](_0x5354b3['query']);_0x2a605e[_0xfb1a('0x30')]=_[_0xfb1a('0x31')](_0x2a605e[_0xfb1a('0x2d')],_0x2a605e[_0xfb1a('0x2e')]);_0x15a115[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x2a605e['model'],qs[_0xfb1a('0x33')](_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x33')]));_0x15a115['attributes']=_0x15a115[_0xfb1a('0x32')]['length']?_0x15a115['attributes']:_0x2a605e[_0xfb1a('0x2d')];_0x15a115[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x38')]);_0x15a115[_0xfb1a('0x3a')]=qs[_0xfb1a('0x30')](_[_0xfb1a('0x47')](_0x5354b3[_0xfb1a('0x2e')],_0x2a605e[_0xfb1a('0x30')]));if(_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x15a115['where']=_['merge'](_0x15a115[_0xfb1a('0x3a')],{'$or':_['map'](_0x15a115[_0xfb1a('0x32')],function(_0x404508){var _0x44b0ec={};_0x44b0ec[_0x404508]={'$like':'%'+_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x44b0ec;})});}_0x15a115=_[_0xfb1a('0x3b')]({},_0x15a115,_0x5354b3[_0xfb1a('0x48')]);return _0x53bf4a['getSubjects'](_0x15a115);}})[_0xfb1a('0x21')](function(_0x477312){if(_0x477312){_0x59e999=_0x477312[_0xfb1a('0x34')];if(!_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x35')](_0xfb1a('0x36'))){_0x15a115['limit']=qs[_0xfb1a('0x19')](_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x15a115[_0xfb1a('0x1b')]=qs[_0xfb1a('0x1b')](_0x5354b3[_0xfb1a('0x2e')]['offset']);}return _0x53bf4a['getSubjects'](_0x15a115);}})[_0xfb1a('0x21')](function(_0x24ecce){if(_0x24ecce){return _0x24ecce?{'count':_0x59e999,'rows':_0x24ecce}:null;}})['then'](respondWithResult(_0x1671d6,null))[_0xfb1a('0x40')](handleError(_0x1671d6,null));};exports[_0xfb1a('0x4a')]=function(_0x484fb9,_0x38dedd,_0x1d3097){var _0x18649e={};var _0x3f47eb={};var _0x5653b0;var _0xaf7a62;return db[_0xfb1a('0x29')]['findOne']({'where':{'id':_0x484fb9[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x38dedd,null))[_0xfb1a('0x21')](function(_0x5617e1){if(_0x5617e1){_0x5653b0=_0x5617e1;_0x3f47eb[_0xfb1a('0x2d')]=_[_0xfb1a('0x2f')](db[_0xfb1a('0x46')][_0xfb1a('0x2a')]);_0x3f47eb[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x484fb9[_0xfb1a('0x2e')]);_0x3f47eb['filters']=_[_0xfb1a('0x31')](_0x3f47eb['model'],_0x3f47eb[_0xfb1a('0x2e')]);_0x18649e[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x3f47eb[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x484fb9['query'][_0xfb1a('0x33')]));_0x18649e[_0xfb1a('0x32')]=_0x18649e[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x18649e[_0xfb1a('0x32')]:_0x3f47eb[_0xfb1a('0x2d')];_0x18649e[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x484fb9[_0xfb1a('0x2e')]['sort']);_0x18649e[_0xfb1a('0x3a')]=qs[_0xfb1a('0x30')](_[_0xfb1a('0x47')](_0x484fb9['query'],_0x3f47eb['filters']));if(_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x18649e[_0xfb1a('0x3a')]=_[_0xfb1a('0x3b')](_0x18649e[_0xfb1a('0x3a')],{'$or':_[_0xfb1a('0x28')](_0x18649e[_0xfb1a('0x32')],function(_0x32d10e){var _0x3ecdd4={};_0x3ecdd4[_0x32d10e]={'$like':'%'+_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x3ecdd4;})});}_0x18649e=_[_0xfb1a('0x3b')]({},_0x18649e,_0x484fb9[_0xfb1a('0x48')]);return _0x5653b0['getDescriptions'](_0x18649e);}})[_0xfb1a('0x21')](function(_0x498c92){if(_0x498c92){_0xaf7a62=_0x498c92[_0xfb1a('0x34')];if(!_0x484fb9[_0xfb1a('0x2e')]['hasOwnProperty'](_0xfb1a('0x36'))){_0x18649e[_0xfb1a('0x19')]=qs[_0xfb1a('0x19')](_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x18649e[_0xfb1a('0x1b')]=qs['offset'](_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x1b')]);}return _0x5653b0[_0xfb1a('0x4a')](_0x18649e);}})[_0xfb1a('0x21')](function(_0x252cec){if(_0x252cec){return _0x252cec?{'count':_0xaf7a62,'rows':_0x252cec}:null;}})[_0xfb1a('0x21')](respondWithResult(_0x38dedd,null))[_0xfb1a('0x40')](handleError(_0x38dedd,null));};exports[_0xfb1a('0x4b')]=function(_0x44440b,_0x52a114,_0x15f965){var _0x37b290={};var _0x476895={};var _0x9c50fc;var _0x322d7b;return db[_0xfb1a('0x29')][_0xfb1a('0x4c')]({'where':{'id':_0x44440b[_0xfb1a('0x44')]['id']}})['then'](handleEntityNotFound(_0x52a114,null))[_0xfb1a('0x21')](function(_0x31b05e){if(_0x31b05e){_0x9c50fc=_0x31b05e;_0x476895[_0xfb1a('0x2d')]=_[_0xfb1a('0x2f')](db[_0xfb1a('0x4d')][_0xfb1a('0x2a')]);_0x476895[_0xfb1a('0x2e')]=_['keys'](_0x44440b[_0xfb1a('0x2e')]);_0x476895['filters']=_['intersection'](_0x476895[_0xfb1a('0x2d')],_0x476895[_0xfb1a('0x2e')]);_0x37b290['attributes']=_['intersection'](_0x476895['model'],qs[_0xfb1a('0x33')](_0x44440b[_0xfb1a('0x2e')]['fields']));_0x37b290[_0xfb1a('0x32')]=_0x37b290[_0xfb1a('0x32')]['length']?_0x37b290[_0xfb1a('0x32')]:_0x476895[_0xfb1a('0x2d')];_0x37b290[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x38')]);_0x37b290['where']=qs['filters'](_[_0xfb1a('0x47')](_0x44440b['query'],_0x476895['filters']));if(_0x44440b['query'][_0xfb1a('0x39')]){_0x37b290['where']=_[_0xfb1a('0x3b')](_0x37b290['where'],{'$or':_['map'](_0x37b290[_0xfb1a('0x32')],function(_0x5b699a){var _0x59b4ab={};_0x59b4ab[_0x5b699a]={'$like':'%'+_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x59b4ab;})});}_0x37b290=_['merge']({},_0x37b290,_0x44440b['options']);return _0x9c50fc['getTags'](_0x37b290);}})[_0xfb1a('0x21')](function(_0x1efe9c){if(_0x1efe9c){_0x322d7b=_0x1efe9c['length'];if(!_0x44440b[_0xfb1a('0x2e')]['hasOwnProperty'](_0xfb1a('0x36'))){_0x37b290['limit']=qs[_0xfb1a('0x19')](_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x37b290[_0xfb1a('0x1b')]=qs[_0xfb1a('0x1b')](_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x1b')]);}return _0x9c50fc[_0xfb1a('0x4b')](_0x37b290);}})[_0xfb1a('0x21')](function(_0x5956f4){if(_0x5956f4){return _0x5956f4?{'count':_0x322d7b,'rows':_0x5956f4}:null;}})[_0xfb1a('0x21')](respondWithResult(_0x52a114,null))[_0xfb1a('0x40')](handleError(_0x52a114,null));};exports[_0xfb1a('0x4e')]=function(_0x46f86f,_0x2cec9f,_0x377973){if(_0x46f86f[_0xfb1a('0x43')]['id']){delete _0x46f86f[_0xfb1a('0x43')]['id'];}return db[_0xfb1a('0x29')][_0xfb1a('0x4c')]({'where':{'id':_0x46f86f[_0xfb1a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cec9f,null))['then'](function(_0x289cfa){if(_0x289cfa){return _0x289cfa[_0xfb1a('0x4e')](_0x46f86f[_0xfb1a('0x43')][_0xfb1a('0x4f')]||[]);}return null;})[_0xfb1a('0x21')](respondWithResult(_0x2cec9f,null))[_0xfb1a('0x40')](handleError(_0x2cec9f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8ce1c28..cad1268 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 _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 +var _0xc900=['api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','../../config/logger'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xc900,0xb3));var _0x0c90=function(_0x12da49,_0x17842a){_0x12da49=_0x12da49-0x0;var _0x378ad0=_0xc900[_0x12da49];return _0x378ad0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0c90('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 316f039..d714956 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 _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 +var _0xa7db=['error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x477819,_0x71340f){var _0x464868=function(_0x1a178d){while(--_0x1a178d){_0x477819['push'](_0x477819['shift']());}};_0x464868(++_0x71340f);}(_0xa7db,0xf1));var _0xba7d=function(_0x41464b,_0x80f89c){_0x41464b=_0x41464b-0x0;var _0x5187e0=_0xa7db[_0x41464b];return _0x5187e0;};'use strict';var _=require('lodash');var util=require(_0xba7d('0x0'));var moment=require('moment');var BPromise=require(_0xba7d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba7d('0x2'));var db=require(_0xba7d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xba7d('0x4'))(_0xba7d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xba7d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x722c76,_0x57774f,_0x22c028){return new BPromise(function(_0x331b86,_0x597826){return client[_0xba7d('0x7')](_0x722c76,_0x22c028)[_0xba7d('0x8')](function(_0x264793){logger[_0xba7d('0x9')](_0xba7d('0xa'),_0x57774f,'request\x20sent');logger[_0xba7d('0xb')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x57774f,_0xba7d('0xc'),JSON[_0xba7d('0xd')](_0x264793));if(_0x264793[_0xba7d('0xe')]){if(_0x264793['error']['code']===0x1f4){logger[_0xba7d('0xe')](_0xba7d('0xa'),_0x57774f,_0x264793[_0xba7d('0xe')][_0xba7d('0xf')]);return _0x597826(_0x264793[_0xba7d('0xe')]['message']);}logger[_0xba7d('0xe')](_0xba7d('0xa'),_0x57774f,_0x264793[_0xba7d('0xe')][_0xba7d('0xf')]);return _0x331b86(_0x264793[_0xba7d('0xe')][_0xba7d('0xf')]);}else{logger['info'](_0xba7d('0xa'),_0x57774f,_0xba7d('0xc'));_0x331b86(_0x264793['result'][_0xba7d('0xf')]);}})[_0xba7d('0x10')](function(_0x4eace4){logger[_0xba7d('0xe')](_0xba7d('0xa'),_0x57774f,_0x4eace4);_0x597826(_0x4eace4);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6713fd4..ee43e7f 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 _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 +var _0x2dc6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x19e16f,_0x4a9324){var _0x242c29=function(_0x3c6694){while(--_0x3c6694){_0x19e16f['push'](_0x19e16f['shift']());}};_0x242c29(++_0x4a9324);}(_0x2dc6,0x1c4));var _0x62dc=function(_0x3759d2,_0x50258e){_0x3759d2=_0x3759d2-0x0;var _0x3499f5=_0x2dc6[_0x3759d2];return _0x3499f5;};'use strict';var multer=require('multer');var util=require(_0x62dc('0x0'));var path=require(_0x62dc('0x1'));var timeout=require(_0x62dc('0x2'));var express=require(_0x62dc('0x3'));var router=express['Router']();var fs_extra=require(_0x62dc('0x4'));var auth=require(_0x62dc('0x5'));var interaction=require(_0x62dc('0x6'));var config=require(_0x62dc('0x7'));var controller=require(_0x62dc('0x8'));router[_0x62dc('0x9')]('/',auth[_0x62dc('0xa')](),controller['index']);router[_0x62dc('0x9')](_0x62dc('0xb'),auth[_0x62dc('0xa')](),controller[_0x62dc('0xc')]);router[_0x62dc('0xd')]('/',auth['isAuthenticated'](),controller[_0x62dc('0xe')]);router[_0x62dc('0xf')](_0x62dc('0xb'),auth['isAuthenticated'](),controller[_0x62dc('0x10')]);router[_0x62dc('0x11')](_0x62dc('0xb'),auth[_0x62dc('0xa')](),controller['destroy']);module[_0x62dc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index b14da6f..16d18ce 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 _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 +var _0x64f5=['keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x64f5,0x10a));var _0x564f=function(_0x2cd9e2,_0x3b1331){_0x2cd9e2=_0x2cd9e2-0x0;var _0x5b4de0=_0x64f5[_0x2cd9e2];return _0x5b4de0;};'use strict';var Sequelize=require(_0x564f('0x0'));module[_0x564f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x564f('0x2'),'variable',_0x564f('0x3'),_0x564f('0x4'),_0x564f('0x5')),'defaultValue':_0x564f('0x2')},'content':{'type':Sequelize[_0x564f('0x6')]},'key':{'type':Sequelize[_0x564f('0x6')]},'keyType':{'type':Sequelize[_0x564f('0x7')](_0x564f('0x2'),_0x564f('0x8'),_0x564f('0x3'))},'keyContent':{'type':Sequelize[_0x564f('0x6')]},'idField':{'type':Sequelize[_0x564f('0x6')]},'nameField':{'type':Sequelize[_0x564f('0x6')]},'customField':{'type':Sequelize[_0x564f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x564f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 5fa523d..c09770f 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 _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 +var _0xc288=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','update','then','destroy','error','stack','name','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','catch','keys','fields','includeAll','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto'];(function(_0x2cf8d3,_0x545a19){var _0x17a79d=function(_0x33f9fd){while(--_0x33f9fd){_0x2cf8d3['push'](_0x2cf8d3['shift']());}};_0x17a79d(++_0x545a19);}(_0xc288,0x18b));var _0x8c28=function(_0x1d063d,_0x25eaeb){_0x1d063d=_0x1d063d-0x0;var _0x10943a=_0xc288[_0x1d063d];return _0x10943a;};'use strict';var emlformat=require(_0x8c28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c28('0x1'));var jsonpatch=require(_0x8c28('0x2'));var rp=require(_0x8c28('0x3'));var moment=require(_0x8c28('0x4'));var BPromise=require(_0x8c28('0x5'));var Mustache=require(_0x8c28('0x6'));var util=require(_0x8c28('0x7'));var path=require(_0x8c28('0x8'));var sox=require(_0x8c28('0x9'));var csv=require(_0x8c28('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c28('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8c28('0xc'));var jsforce=require(_0x8c28('0xd'));var deskjs=require(_0x8c28('0xe'));var toCsv=require(_0x8c28('0xa'));var querystring=require(_0x8c28('0xf'));var Papa=require(_0x8c28('0x10'));var Redis=require('ioredis');var authService=require(_0x8c28('0x11'));var qs=require(_0x8c28('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8c28('0x13'));var utils=require(_0x8c28('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8c28('0x15'))['db'];function respondWithStatusCode(_0x55a7eb,_0x467a54){_0x467a54=_0x467a54||0xcc;return function(_0x450e14){if(_0x450e14){return _0x55a7eb[_0x8c28('0x16')](_0x467a54);}return _0x55a7eb['status'](_0x467a54)[_0x8c28('0x17')]();};}function respondWithResult(_0x47e1fe,_0x164671){_0x164671=_0x164671||0xc8;return function(_0x1b135c){if(_0x1b135c){return _0x47e1fe[_0x8c28('0x18')](_0x164671)[_0x8c28('0x19')](_0x1b135c);}};}function respondWithFilteredResult(_0xc61c8d,_0x324ebd){return function(_0x41f4c6){if(_0x41f4c6){var _0x3443cd=typeof _0x324ebd[_0x8c28('0x1a')]===_0x8c28('0x1b')&&typeof _0x324ebd[_0x8c28('0x1c')]==='undefined';var _0x58d0f7=_0x41f4c6['count'];var _0x4ab4ba=_0x3443cd?0x0:_0x324ebd[_0x8c28('0x1a')];var _0x3e8a0b=_0x3443cd?_0x41f4c6['count']:_0x324ebd['offset']+_0x324ebd[_0x8c28('0x1c')];var _0x20417a;if(_0x3e8a0b>=_0x58d0f7){_0x3e8a0b=_0x58d0f7;_0x20417a=0xc8;}else{_0x20417a=0xce;}_0xc61c8d[_0x8c28('0x18')](_0x20417a);return _0xc61c8d['set'](_0x8c28('0x1d'),_0x4ab4ba+'-'+_0x3e8a0b+'/'+_0x58d0f7)[_0x8c28('0x19')](_0x41f4c6);}return null;};}function patchUpdates(_0x2f78c7){return function(_0xcebaa9){try{jsonpatch['apply'](_0xcebaa9,_0x2f78c7,!![]);}catch(_0x70953e){return BPromise['reject'](_0x70953e);}return _0xcebaa9['save']();};}function saveUpdates(_0x526211,_0x21105d){return function(_0x515fe0){if(_0x515fe0){return _0x515fe0[_0x8c28('0x1e')](_0x526211)[_0x8c28('0x1f')](function(_0x3d37c7){return _0x3d37c7;});}return null;};}function removeEntity(_0x1ec10f,_0x40589f){return function(_0x5d0e91){if(_0x5d0e91){return _0x5d0e91[_0x8c28('0x20')]()[_0x8c28('0x1f')](function(){_0x1ec10f[_0x8c28('0x18')](0xcc)[_0x8c28('0x17')]();});}};}function handleEntityNotFound(_0x3c593d,_0x1f4382){return function(_0x59e116){if(!_0x59e116){_0x3c593d[_0x8c28('0x16')](0x194);}return _0x59e116;};}function handleError(_0x2318a1,_0x406d39){_0x406d39=_0x406d39||0x1f4;return function(_0x423e35){logger[_0x8c28('0x21')](_0x423e35[_0x8c28('0x22')]);if(_0x423e35[_0x8c28('0x23')]){delete _0x423e35[_0x8c28('0x23')];}_0x2318a1['status'](_0x406d39)['send'](_0x423e35);};}exports['index']=function(_0x18f9d8,_0x97d19c){var _0x1aba05={},_0x80b4={},_0x4de045={'count':0x0,'rows':[]};var _0x21592a=_[_0x8c28('0x24')](db[_0x8c28('0x25')][_0x8c28('0x26')],function(_0x3bdc6d){return{'name':_0x3bdc6d[_0x8c28('0x27')],'type':_0x3bdc6d[_0x8c28('0x28')][_0x8c28('0x29')]};});_0x80b4[_0x8c28('0x2a')]=_[_0x8c28('0x24')](_0x21592a,_0x8c28('0x23'));_0x80b4[_0x8c28('0x2b')]=_['keys'](_0x18f9d8[_0x8c28('0x2b')]);_0x80b4['filters']=_[_0x8c28('0x2c')](_0x80b4[_0x8c28('0x2a')],_0x80b4[_0x8c28('0x2b')]);_0x1aba05[_0x8c28('0x2d')]=_['intersection'](_0x80b4[_0x8c28('0x2a')],qs['fields'](_0x18f9d8[_0x8c28('0x2b')]['fields']));_0x1aba05[_0x8c28('0x2d')]=_0x1aba05[_0x8c28('0x2d')][_0x8c28('0x2e')]?_0x1aba05['attributes']:_0x80b4['model'];if(!_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x2f')](_0x8c28('0x30'))){_0x1aba05['limit']=qs[_0x8c28('0x1c')](_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x1c')]);_0x1aba05[_0x8c28('0x1a')]=qs[_0x8c28('0x1a')](_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x1a')]);}_0x1aba05['order']=qs[_0x8c28('0x31')](_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x31')]);_0x1aba05[_0x8c28('0x32')]=qs[_0x8c28('0x33')](_[_0x8c28('0x34')](_0x18f9d8[_0x8c28('0x2b')],_0x80b4[_0x8c28('0x33')]),_0x21592a);if(_0x18f9d8[_0x8c28('0x2b')]['filter']){_0x1aba05[_0x8c28('0x32')]=_[_0x8c28('0x35')](_0x1aba05[_0x8c28('0x32')],{'$or':_[_0x8c28('0x24')](_0x21592a,function(_0x2c8d0e){if(_0x2c8d0e['type']!==_0x8c28('0x36')){var _0x3dd583={};_0x3dd583[_0x2c8d0e[_0x8c28('0x23')]]={'$like':'%'+_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x37')]+'%'};return _0x3dd583;}})});}_0x1aba05=_[_0x8c28('0x35')]({},_0x1aba05,_0x18f9d8[_0x8c28('0x38')]);var _0x47add8={'where':_0x1aba05['where']};return db[_0x8c28('0x25')][_0x8c28('0x39')](_0x47add8)[_0x8c28('0x1f')](function(_0x539c0d){_0x4de045[_0x8c28('0x39')]=_0x539c0d;if(_0x18f9d8[_0x8c28('0x2b')]['includeAll']){_0x1aba05[_0x8c28('0x3a')]=[{'all':!![]}];}return db[_0x8c28('0x25')][_0x8c28('0x3b')](_0x1aba05);})[_0x8c28('0x1f')](function(_0x3fba8a){_0x4de045['rows']=_0x3fba8a;return _0x4de045;})['then'](respondWithFilteredResult(_0x97d19c,_0x1aba05))[_0x8c28('0x3c')](handleError(_0x97d19c,null));};exports['show']=function(_0x34d170,_0x56e1a2){var _0x27013d={'raw':!![],'where':{'id':_0x34d170['params']['id']}},_0x753b52={};_0x753b52[_0x8c28('0x2a')]=_[_0x8c28('0x3d')](db[_0x8c28('0x25')][_0x8c28('0x26')]);_0x753b52[_0x8c28('0x2b')]=_[_0x8c28('0x3d')](_0x34d170[_0x8c28('0x2b')]);_0x753b52[_0x8c28('0x33')]=_['intersection'](_0x753b52[_0x8c28('0x2a')],_0x753b52[_0x8c28('0x2b')]);_0x27013d['attributes']=_['intersection'](_0x753b52['model'],qs[_0x8c28('0x3e')](_0x34d170['query'][_0x8c28('0x3e')]));_0x27013d[_0x8c28('0x2d')]=_0x27013d[_0x8c28('0x2d')][_0x8c28('0x2e')]?_0x27013d['attributes']:_0x753b52['model'];if(_0x34d170[_0x8c28('0x2b')][_0x8c28('0x3f')]){_0x27013d[_0x8c28('0x3a')]=[{'all':!![]}];}_0x27013d=_['merge']({},_0x27013d,_0x34d170[_0x8c28('0x38')]);return db[_0x8c28('0x25')]['find'](_0x27013d)[_0x8c28('0x1f')](handleEntityNotFound(_0x56e1a2,null))['then'](respondWithResult(_0x56e1a2,null))['catch'](handleError(_0x56e1a2,null));};exports[_0x8c28('0x40')]=function(_0x3c43f5,_0x3506a0){return db[_0x8c28('0x25')][_0x8c28('0x40')](_0x3c43f5[_0x8c28('0x41')],{})[_0x8c28('0x1f')](respondWithResult(_0x3506a0,0xc9))['catch'](handleError(_0x3506a0,null));};exports[_0x8c28('0x1e')]=function(_0x50af4e,_0x40ea4d){if(_0x50af4e[_0x8c28('0x41')]['id']){delete _0x50af4e[_0x8c28('0x41')]['id'];}return db[_0x8c28('0x25')][_0x8c28('0x42')]({'where':{'id':_0x50af4e[_0x8c28('0x43')]['id']}})[_0x8c28('0x1f')](handleEntityNotFound(_0x40ea4d,null))[_0x8c28('0x1f')](saveUpdates(_0x50af4e['body'],null))[_0x8c28('0x1f')](respondWithResult(_0x40ea4d,null))[_0x8c28('0x3c')](handleError(_0x40ea4d,null));};exports[_0x8c28('0x20')]=function(_0x31073e,_0x5a6105){return db[_0x8c28('0x25')]['find']({'where':{'id':_0x31073e['params']['id']}})[_0x8c28('0x1f')](handleEntityNotFound(_0x5a6105,null))[_0x8c28('0x1f')](removeEntity(_0x5a6105,null))[_0x8c28('0x3c')](handleError(_0x5a6105,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 706bbe9..e1b5d38 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 _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 +var _0xea2a=['request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','idField','util','../../config/logger','moment','bluebird'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0xea2a,0x1b6));var _0xaea2=function(_0x3ff58e,_0xc9ca44){_0x3ff58e=_0x3ff58e-0x0;var _0x23f36f=_0xea2a[_0x3ff58e];return _0x23f36f;};'use strict';var _=require('lodash');var util=require(_0xaea2('0x0'));var logger=require(_0xaea2('0x1'))('api');var moment=require(_0xaea2('0x2'));var BPromise=require(_0xaea2('0x3'));var rp=require(_0xaea2('0x4'));var fs=require('fs');var path=require(_0xaea2('0x5'));var rimraf=require(_0xaea2('0x6'));var config=require(_0xaea2('0x7'));var attributes=require(_0xaea2('0x8'));module['exports']=function(_0x2ac852,_0x2e2f19){return _0x2ac852[_0xaea2('0x9')]('ZendeskField',attributes,{'tableName':_0xaea2('0xa'),'paranoid':![],'indexes':[{'name':_0xaea2('0xb'),'fields':[_0xaea2('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index a19a2f4..6b3a46c 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 _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 +var _0x9a83=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x5ebdd2,_0x3193c5){var _0x2dbf57=function(_0x5a1181){while(--_0x5a1181){_0x5ebdd2['push'](_0x5ebdd2['shift']());}};_0x2dbf57(++_0x3193c5);}(_0x9a83,0x1a6));var _0x39a8=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x9a83[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0x39a8('0x0'));var util=require(_0x39a8('0x1'));var moment=require(_0x39a8('0x2'));var BPromise=require(_0x39a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39a8('0x4'))['db'];var utils=require(_0x39a8('0x5'));var logger=require(_0x39a8('0x6'))('rpc');var config=require(_0x39a8('0x7'));var jayson=require(_0x39a8('0x8'));var client=jayson[_0x39a8('0x9')][_0x39a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf1621d,_0xd5fc54,_0x7704f5){return new BPromise(function(_0x23987a,_0x130e47){return client[_0x39a8('0xb')](_0xf1621d,_0x7704f5)[_0x39a8('0xc')](function(_0x24219b){logger[_0x39a8('0xd')](_0x39a8('0xe'),_0xd5fc54,_0x39a8('0xf'));logger[_0x39a8('0x10')](_0x39a8('0x11'),_0xd5fc54,_0x39a8('0xf'),JSON[_0x39a8('0x12')](_0x24219b));if(_0x24219b[_0x39a8('0x13')]){if(_0x24219b[_0x39a8('0x13')]['code']===0x1f4){logger[_0x39a8('0x13')](_0x39a8('0xe'),_0xd5fc54,_0x24219b['error'][_0x39a8('0x14')]);return _0x130e47(_0x24219b['error'][_0x39a8('0x14')]);}logger['error'](_0x39a8('0xe'),_0xd5fc54,_0x24219b['error'][_0x39a8('0x14')]);return _0x23987a(_0x24219b[_0x39a8('0x13')][_0x39a8('0x14')]);}else{logger[_0x39a8('0xd')](_0x39a8('0xe'),_0xd5fc54,_0x39a8('0xf'));_0x23987a(_0x24219b[_0x39a8('0x15')][_0x39a8('0x14')]);}})[_0x39a8('0x16')](function(_0x39c947){logger['error'](_0x39a8('0xe'),_0xd5fc54,_0x39c947);_0x130e47(_0x39c947);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 84650a8..2acc30f 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 _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 +var _0xfc75=['post','/:id/configurations','isAuthenticated','put','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xfc75,0x8b));var _0x5fc7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfc75[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5fc7('0x0'));var util=require(_0x5fc7('0x1'));var path=require('path');var timeout=require(_0x5fc7('0x2'));var express=require('express');var router=express[_0x5fc7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5fc7('0x4'));var config=require('../../config/environment');var controller=require(_0x5fc7('0x5'));router[_0x5fc7('0x6')]('/',auth['isAuthenticated'](),controller[_0x5fc7('0x7')]);router[_0x5fc7('0x6')](_0x5fc7('0x8'),auth['isAuthenticated'](),controller[_0x5fc7('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5fc7('0xa')]);router[_0x5fc7('0x6')](_0x5fc7('0xb'),auth['isAuthenticated'](),controller[_0x5fc7('0xc')]);router[_0x5fc7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5fc7('0xd')](_0x5fc7('0xe'),auth[_0x5fc7('0xf')](),controller['addConfiguration']);router[_0x5fc7('0x10')](_0x5fc7('0x8'),auth[_0x5fc7('0xf')](),controller['update']);router[_0x5fc7('0x11')](_0x5fc7('0x8'),auth[_0x5fc7('0xf')](),controller[_0x5fc7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e6e5294..4a335c3 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 _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 +var _0xbec5=['STRING','sequelize','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xbec5,0xe5));var _0x5bec=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0xbec5[_0x299784];return _0x5ab008;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a953d45..2feefd9 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 _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 +var _0x67e1=['refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','status','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','AccountId','Subjects','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x67e1,0xa8));var _0x167e=function(_0x2a2a80,_0x59debe){_0x2a2a80=_0x2a2a80-0x0;var _0x296163=_0x67e1[_0x2a2a80];return _0x296163;};'use strict';var emlformat=require(_0x167e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x167e('0x1'));var rp=require(_0x167e('0x2'));var moment=require(_0x167e('0x3'));var BPromise=require(_0x167e('0x4'));var Mustache=require(_0x167e('0x5'));var util=require('util');var path=require(_0x167e('0x6'));var sox=require('sox');var csv=require(_0x167e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x167e('0x8'));var _=require(_0x167e('0x9'));var squel=require(_0x167e('0xa'));var crypto=require(_0x167e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x167e('0xc'));var Papa=require(_0x167e('0xd'));var Redis=require(_0x167e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x167e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x167e('0x10'));var logger=require(_0x167e('0x11'))(_0x167e('0x12'));var utils=require(_0x167e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x167e('0x14'));var db=require(_0x167e('0x15'))['db'];var integrations=require(_0x167e('0x16'));function respondWithStatusCode(_0x57b93a,_0x2598d1){_0x2598d1=_0x2598d1||0xcc;return function(_0x174295){if(_0x174295){return _0x57b93a[_0x167e('0x17')](_0x2598d1);}return _0x57b93a['status'](_0x2598d1)[_0x167e('0x18')]();};}function respondWithResult(_0x3092b7,_0x3dffe7){_0x3dffe7=_0x3dffe7||0xc8;return function(_0x5f0e4c){if(_0x5f0e4c){return _0x3092b7['status'](_0x3dffe7)[_0x167e('0x19')](_0x5f0e4c);}};}function respondWithFilteredResult(_0x51640e,_0x5c074a){return function(_0x528032){if(_0x528032){var _0x14f1b6=typeof _0x5c074a[_0x167e('0x1a')]===_0x167e('0x1b')&&typeof _0x5c074a['limit']===_0x167e('0x1b');var _0x5040b6=_0x528032[_0x167e('0x1c')];var _0xce088c=_0x14f1b6?0x0:_0x5c074a[_0x167e('0x1a')];var _0x57ec92=_0x14f1b6?_0x528032[_0x167e('0x1c')]:_0x5c074a[_0x167e('0x1a')]+_0x5c074a['limit'];var _0x309b2e;if(_0x57ec92>=_0x5040b6){_0x57ec92=_0x5040b6;_0x309b2e=0xc8;}else{_0x309b2e=0xce;}_0x51640e['status'](_0x309b2e);return _0x51640e[_0x167e('0x1d')](_0x167e('0x1e'),_0xce088c+'-'+_0x57ec92+'/'+_0x5040b6)[_0x167e('0x19')](_0x528032);}return null;};}function patchUpdates(_0x1a4ea7){return function(_0x3d5803){try{jsonpatch[_0x167e('0x1f')](_0x3d5803,_0x1a4ea7,!![]);}catch(_0x429998){return BPromise[_0x167e('0x20')](_0x429998);}return _0x3d5803[_0x167e('0x21')]();};}function saveUpdates(_0x5a5479,_0x4244b9){return function(_0x16953b){if(_0x16953b){return _0x16953b[_0x167e('0x22')](_0x5a5479)[_0x167e('0x23')](function(_0x2803ce){return _0x2803ce;});}return null;};}function removeEntity(_0x34093e,_0x2629d8){return function(_0x49fe64){if(_0x49fe64){return _0x49fe64[_0x167e('0x24')]()['then'](function(){_0x34093e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb29f61,_0x5976de){return function(_0x292786){if(!_0x292786){_0xb29f61[_0x167e('0x17')](0x194);}return _0x292786;};}function handleError(_0x2bc8db,_0x71c26){_0x71c26=_0x71c26||0x1f4;return function(_0x6debf7){logger[_0x167e('0x25')](_0x6debf7['stack']);if(_0x6debf7[_0x167e('0x26')]){delete _0x6debf7[_0x167e('0x26')];}_0x2bc8db['status'](_0x71c26)[_0x167e('0x27')](_0x6debf7);};}exports['index']=function(_0x235572,_0x59b253){var _0x39a5a6={},_0x5be67b={},_0x4763c6={'count':0x0,'rows':[]};var _0x90191d=_[_0x167e('0x28')](db[_0x167e('0x29')][_0x167e('0x2a')],function(_0x3d8d71){return{'name':_0x3d8d71[_0x167e('0x2b')],'type':_0x3d8d71[_0x167e('0x2c')][_0x167e('0x2d')]};});_0x5be67b[_0x167e('0x2e')]=_['map'](_0x90191d,_0x167e('0x26'));_0x5be67b[_0x167e('0x2f')]=_[_0x167e('0x30')](_0x235572[_0x167e('0x2f')]);_0x5be67b[_0x167e('0x31')]=_['intersection'](_0x5be67b[_0x167e('0x2e')],_0x5be67b[_0x167e('0x2f')]);_0x39a5a6[_0x167e('0x32')]=_['intersection'](_0x5be67b[_0x167e('0x2e')],qs['fields'](_0x235572['query'][_0x167e('0x33')]));_0x39a5a6[_0x167e('0x32')]=_0x39a5a6[_0x167e('0x32')][_0x167e('0x34')]?_0x39a5a6[_0x167e('0x32')]:_0x5be67b['model'];if(!_0x235572[_0x167e('0x2f')]['hasOwnProperty'](_0x167e('0x35'))){_0x39a5a6[_0x167e('0x36')]=qs[_0x167e('0x36')](_0x235572[_0x167e('0x2f')]['limit']);_0x39a5a6['offset']=qs['offset'](_0x235572[_0x167e('0x2f')]['offset']);}_0x39a5a6[_0x167e('0x37')]=qs[_0x167e('0x38')](_0x235572[_0x167e('0x2f')]['sort']);_0x39a5a6[_0x167e('0x39')]=qs['filters'](_['pick'](_0x235572['query'],_0x5be67b[_0x167e('0x31')]),_0x90191d);if(_0x235572[_0x167e('0x2f')][_0x167e('0x3a')]){_0x39a5a6[_0x167e('0x39')]=_['merge'](_0x39a5a6[_0x167e('0x39')],{'$or':_[_0x167e('0x28')](_0x90191d,function(_0x4fdfd8){if(_0x4fdfd8[_0x167e('0x2c')]!==_0x167e('0x3b')){var _0x55b0c6={};_0x55b0c6[_0x4fdfd8[_0x167e('0x26')]]={'$like':'%'+_0x235572['query'][_0x167e('0x3a')]+'%'};return _0x55b0c6;}})});}_0x39a5a6=_[_0x167e('0x3c')]({},_0x39a5a6,_0x235572[_0x167e('0x3d')]);var _0x46cbce={'where':_0x39a5a6[_0x167e('0x39')]};return db[_0x167e('0x29')]['count'](_0x46cbce)['then'](function(_0x382876){_0x4763c6[_0x167e('0x1c')]=_0x382876;if(_0x235572[_0x167e('0x2f')][_0x167e('0x3e')]){_0x39a5a6[_0x167e('0x3f')]=[{'all':!![]}];}return db[_0x167e('0x29')][_0x167e('0x40')](_0x39a5a6);})[_0x167e('0x23')](function(_0x46322c){_0x4763c6[_0x167e('0x41')]=_0x46322c;return _0x4763c6;})[_0x167e('0x23')](respondWithFilteredResult(_0x59b253,_0x39a5a6))[_0x167e('0x42')](handleError(_0x59b253,null));};exports['show']=function(_0x866c0d,_0x2fe440){var _0xb31c6f={'raw':![],'where':{'id':_0x866c0d[_0x167e('0x43')]['id']}},_0x23865a={};_0x23865a[_0x167e('0x2e')]=_[_0x167e('0x30')](db[_0x167e('0x29')][_0x167e('0x2a')]);_0x23865a[_0x167e('0x2f')]=_[_0x167e('0x30')](_0x866c0d[_0x167e('0x2f')]);_0x23865a['filters']=_[_0x167e('0x44')](_0x23865a['model'],_0x23865a[_0x167e('0x2f')]);_0xb31c6f[_0x167e('0x32')]=_[_0x167e('0x44')](_0x23865a['model'],qs['fields'](_0x866c0d[_0x167e('0x2f')][_0x167e('0x33')]));_0xb31c6f[_0x167e('0x32')]=_0xb31c6f['attributes'][_0x167e('0x34')]?_0xb31c6f[_0x167e('0x32')]:_0x23865a[_0x167e('0x2e')];if(_0x866c0d[_0x167e('0x2f')]['includeAll']){_0xb31c6f[_0x167e('0x3f')]=[{'all':!![]}];}_0xb31c6f=_[_0x167e('0x3c')]({},_0xb31c6f,_0x866c0d[_0x167e('0x3d')]);return db[_0x167e('0x29')][_0x167e('0x45')](_0xb31c6f)[_0x167e('0x23')](handleEntityNotFound(_0x2fe440,null))[_0x167e('0x23')](respondWithResult(_0x2fe440,null))[_0x167e('0x42')](handleError(_0x2fe440,null));};exports[_0x167e('0x46')]=function(_0x2a4571,_0x1c1cf7){return db['ZohoAccount'][_0x167e('0x46')](_0x2a4571[_0x167e('0x47')],{})[_0x167e('0x23')](respondWithResult(_0x1c1cf7,0xc9))[_0x167e('0x42')](handleError(_0x1c1cf7,null));};exports[_0x167e('0x22')]=function(_0x52a168,_0xcf5a35){if(_0x52a168[_0x167e('0x47')]['id']){delete _0x52a168[_0x167e('0x47')]['id'];}return db[_0x167e('0x29')][_0x167e('0x45')]({'where':{'id':_0x52a168[_0x167e('0x43')]['id']}})['then'](handleEntityNotFound(_0xcf5a35,null))[_0x167e('0x23')](saveUpdates(_0x52a168['body'],null))[_0x167e('0x23')](respondWithResult(_0xcf5a35,null))[_0x167e('0x42')](handleError(_0xcf5a35,null));};exports[_0x167e('0x24')]=function(_0x8244bb,_0x238eaf){return db[_0x167e('0x29')][_0x167e('0x45')]({'where':{'id':_0x8244bb[_0x167e('0x43')]['id']}})[_0x167e('0x23')](handleEntityNotFound(_0x238eaf,null))[_0x167e('0x23')](removeEntity(_0x238eaf,null))['catch'](handleError(_0x238eaf,null));};exports[_0x167e('0x48')]=function(_0x450c92,_0x5c6162,_0x1db3d8){var _0x1f3158={};var _0x3d20a6={};var _0x5f4a2a;var _0x39f755;return db[_0x167e('0x29')][_0x167e('0x49')]({'where':{'id':_0x450c92[_0x167e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c6162,null))[_0x167e('0x23')](function(_0x58ac20){if(_0x58ac20){_0x5f4a2a=_0x58ac20;_0x3d20a6[_0x167e('0x2e')]=_[_0x167e('0x30')](db[_0x167e('0x4a')][_0x167e('0x2a')]);_0x3d20a6[_0x167e('0x2f')]=_['keys'](_0x450c92[_0x167e('0x2f')]);_0x3d20a6['filters']=_[_0x167e('0x44')](_0x3d20a6[_0x167e('0x2e')],_0x3d20a6['query']);_0x1f3158[_0x167e('0x32')]=_['intersection'](_0x3d20a6[_0x167e('0x2e')],qs[_0x167e('0x33')](_0x450c92[_0x167e('0x2f')][_0x167e('0x33')]));_0x1f3158[_0x167e('0x32')]=_0x1f3158['attributes'][_0x167e('0x34')]?_0x1f3158['attributes']:_0x3d20a6[_0x167e('0x2e')];_0x1f3158[_0x167e('0x37')]=qs['sort'](_0x450c92[_0x167e('0x2f')][_0x167e('0x38')]);_0x1f3158[_0x167e('0x39')]=qs[_0x167e('0x31')](_[_0x167e('0x4b')](_0x450c92[_0x167e('0x2f')],_0x3d20a6['filters']));if(_0x450c92[_0x167e('0x2f')][_0x167e('0x3a')]){_0x1f3158['where']=_[_0x167e('0x3c')](_0x1f3158[_0x167e('0x39')],{'$or':_[_0x167e('0x28')](_0x1f3158[_0x167e('0x32')],function(_0x221515){var _0x63c236={};_0x63c236[_0x221515]={'$like':'%'+_0x450c92[_0x167e('0x2f')]['filter']+'%'};return _0x63c236;})});}_0x1f3158=_[_0x167e('0x3c')]({},_0x1f3158,_0x450c92[_0x167e('0x3d')]);return _0x5f4a2a['getConfigurations'](_0x1f3158);}})[_0x167e('0x23')](function(_0x828b5e){if(_0x828b5e){_0x39f755=_0x828b5e[_0x167e('0x34')];if(!_0x450c92[_0x167e('0x2f')]['hasOwnProperty'](_0x167e('0x35'))){_0x1f3158[_0x167e('0x36')]=qs[_0x167e('0x36')](_0x450c92['query'][_0x167e('0x36')]);_0x1f3158['offset']=qs[_0x167e('0x1a')](_0x450c92['query']['offset']);}return _0x5f4a2a[_0x167e('0x48')](_0x1f3158);}})[_0x167e('0x23')](function(_0x3859f6){if(_0x3859f6){return _0x3859f6?{'count':_0x39f755,'rows':_0x3859f6}:null;}})[_0x167e('0x23')](respondWithResult(_0x5c6162,null))[_0x167e('0x42')](handleError(_0x5c6162,null));};exports[_0x167e('0x4c')]=function(_0x2fc620,_0xcabb78,_0x32207b){if(_0x2fc620[_0x167e('0x47')]['id']){delete _0x2fc620[_0x167e('0x47')]['id'];}return db[_0x167e('0x29')][_0x167e('0x49')]({'where':{'id':_0x2fc620[_0x167e('0x43')]['id']}})[_0x167e('0x23')](handleEntityNotFound(_0xcabb78,null))['then'](function(_0x2d9fec){if(_0x2d9fec){_0x2fc620[_0x167e('0x47')][_0x167e('0x4d')]=_0x2d9fec['id'];_0x2fc620[_0x167e('0x47')][_0x167e('0x4e')]=integrations['getSubjects'](_0x2fc620[_0x167e('0x47')]['channel'],_0x2fc620[_0x167e('0x47')]['type']);_0x2fc620[_0x167e('0x47')]['Descriptions']=integrations[_0x167e('0x4f')](_0x2fc620[_0x167e('0x47')][_0x167e('0x50')],_0x2fc620['body'][_0x167e('0x2c')]);return db[_0x167e('0x4a')][_0x167e('0x46')](_0x2fc620['body'],{'include':[{'model':db[_0x167e('0x51')],'as':_0x167e('0x4e')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xcabb78,null))['catch'](handleError(_0xcabb78,null));};function getAccessToken(_0x4a2156){return new Promise(function(_0x3e1a44,_0x15d1f1){var _0x5da9b5;switch(_0x4a2156[_0x167e('0x52')]){case'US':_0x5da9b5=_0x167e('0x53');break;case'AU':_0x5da9b5=_0x167e('0x54');break;case'EU':_0x5da9b5=_0x167e('0x55');break;case'IN':_0x5da9b5=_0x167e('0x56');break;case'CN':_0x5da9b5=_0x167e('0x57');break;default:_0x5da9b5=_0x167e('0x55');break;}var _0x2f3b74={'method':_0x167e('0x58'),'uri':_0x5da9b5+_0x167e('0x59'),'qs':{'refresh_token':_0x4a2156['refreshToken'],'client_id':_0x4a2156[_0x167e('0x5a')],'client_secret':_0x4a2156[_0x167e('0x5b')],'grant_type':_0x167e('0x5c')},'json':!![]};return rp(_0x2f3b74)[_0x167e('0x23')](function(_0x9bf40f){if(_0x9bf40f['access_token']){_0x3e1a44(_0x9bf40f[_0x167e('0x5d')]);}else{_0x15d1f1(_0x167e('0x5e'));}})[_0x167e('0x42')](function(_0x2f88a1){_0x15d1f1(_0x2f88a1);});});}exports[_0x167e('0x5f')]=function(_0x22b1b9,_0x1213f7,_0x587b71){var _0x46c9e9,_0x29e633,_0x50cc15,_0x4ba43e,_0x2eb94b;return db[_0x167e('0x29')][_0x167e('0x49')]({'where':{'id':_0x22b1b9['params']['id']},'attributes':['id',_0x167e('0x60'),_0x167e('0x52'),_0x167e('0x5a'),_0x167e('0x5b'),_0x167e('0x61'),_0x167e('0x62'),'refreshToken']})[_0x167e('0x23')](handleEntityNotFound(_0x1213f7,null))[_0x167e('0x23')](function(_0x3137eb){_0x2eb94b=_0x3137eb;_0x46c9e9=_0x2eb94b[_0x167e('0x60')];_0x29e633=_0x46c9e9===_0x167e('0x63')?'eu':_0x167e('0x64');_0x50cc15=_0x2eb94b[_0x167e('0x61')];var _0x2d3067=_0x50cc15[_0x167e('0x65')](-0x1);if(_0x2d3067==='/'||_0x2d3067==='\x5c'||_0x2d3067===':'){_0x50cc15=_0x50cc15[_0x167e('0x66')](0x0,_0x50cc15['lastIndexOf'](_0x2d3067));}if(!_0x2eb94b['refreshToken']){throw new Error(_0x167e('0x67'));}return getAccessToken(_0x2eb94b);})['then'](function(_0x4a0c42){if(_0x4a0c42){return rp({'method':_0x167e('0x68'),'uri':util[_0x167e('0x69')](_0x167e('0x6a'),_0x29e633),'qs':{'module':_0x167e('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4a0c42},'json':!![]});}})['then'](function(_0x555190){if(_0x555190){if(_0x555190['response']&&_0x555190[_0x167e('0x6c')][_0x167e('0x25')]){throw new Error(_0x555190['response']['error']['message']);}var _0x32cfa0=[];var _0x42d91c=[];var _0x2dd5f0=[_0x167e('0x6d'),_0x167e('0x6e'),_0x167e('0x6f'),_0x167e('0x70'),_0x167e('0x71'),_0x167e('0x72'),_0x167e('0x73'),_0x167e('0x74')];_0x42d91c=_[_0x167e('0x75')](_0x555190[_0x167e('0x33')],function(_0x2c6698){return _0x2dd5f0[_0x167e('0x76')](_0x2c6698[_0x167e('0x77')]);});for(var _0x1061bc=0x0;_0x1061bc<_0x42d91c[_0x167e('0x34')];_0x1061bc++){if(_0x42d91c[_0x1061bc]['system_mandatory']===![]){_0x32cfa0[_0x167e('0x78')]({'id':_0x42d91c[_0x1061bc]['id'],'name':_0x42d91c[_0x1061bc][_0x167e('0x79')],'custom':_0x42d91c[_0x1061bc][_0x167e('0x7a')],'options':_0x42d91c[_0x1061bc]['data_type']===_0x167e('0x7b')&&_0x42d91c[_0x1061bc][_0x167e('0x7c')][_0x167e('0x34')]>-0x1?_[_0x167e('0x28')](_0x42d91c[_0x1061bc][_0x167e('0x7c')],function(_0x2e16af){return{'name':_0x2e16af,'value':_0x2e16af};}):[]});}}return{'count':_0x32cfa0['length'],'rows':_0x32cfa0};}else{return{'count':0x0,'rows':[]};}})[_0x167e('0x23')](respondWithResult(_0x1213f7,null))[_0x167e('0x42')](function(_0x3786cd){var _0x5a1925=_0x22b1b9['query'][_0x167e('0x7d')]?0x1f4:_0x3786cd['statusCode']||0x1f4;logger[_0x167e('0x25')](_0x167e('0x7e'),'getFields',_0x5a1925,JSON['stringify'](_0x3786cd));delete _0x3786cd[_0x167e('0x26')];if(_0x5a1925===0x191){_0x5a1925=0x190;}_0x1213f7[_0x167e('0x7f')](_0x5a1925)[_0x167e('0x27')](_0x22b1b9[_0x167e('0x2f')][_0x167e('0x7d')]?{'message':_0x167e('0x80'),'statusCode':_0x3786cd[_0x167e('0x81')]}:_0x3786cd);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 77ac17a..c6e5f65 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 _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 +var _0x408b=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','https://accounts.zoho.com.au','refreshToken','catch','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x4d9df9,_0x2cedef){var _0x726884=function(_0x4d8876){while(--_0x4d8876){_0x4d9df9['push'](_0x4d9df9['shift']());}};_0x726884(++_0x2cedef);}(_0x408b,0x1ca));var _0xb408=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x408b[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xb408('0x0'));var util=require('util');var logger=require(_0xb408('0x1'))(_0xb408('0x2'));var moment=require(_0xb408('0x3'));var BPromise=require(_0xb408('0x4'));var rp=require(_0xb408('0x5'));var fs=require('fs');var path=require(_0xb408('0x6'));var rimraf=require('rimraf');var config=require(_0xb408('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xb408('0x8'));module[_0xb408('0x9')]=function(_0x4ddfd3,_0x18edb2){return _0x4ddfd3['define'](_0xb408('0xa'),attributes,{'tableName':_0xb408('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d383f,_0xd5da81,_0x2069c0){if(_0x3d383f[_0xb408('0xc')]('zone')||_0x3d383f['changed'](_0xb408('0xd'))||_0x3d383f[_0xb408('0xc')](_0xb408('0xe'))||_0x3d383f[_0xb408('0xc')](_0xb408('0xf'))||_0x3d383f[_0xb408('0xc')](_0xb408('0x10'))||_0x3d383f[_0xb408('0xc')](_0xb408('0x11'))){var _0x3a5615,_0x156e1c;_0x3a5615=_0x3d383f[_0xb408('0xd')];var _0x2b5250=_0x3a5615[_0xb408('0x12')](-0x1);if(_0x2b5250==='/'||_0x2b5250==='\x5c'||_0x2b5250===':'){_0x3a5615=_0x3a5615[_0xb408('0x13')](0x0,_0x3a5615[_0xb408('0x14')](_0x2b5250));}switch(_0x3d383f[_0xb408('0x15')]){case'US':_0x156e1c='https://accounts.zoho.com';break;case'AU':_0x156e1c='https://accounts.zoho.com.au';break;case'IN':_0x156e1c=_0xb408('0x16');break;case'CN':_0x156e1c=_0xb408('0x17');break;default:_0x156e1c=_0xb408('0x18');break;}var _0x4d7232={'method':'POST','uri':_0x156e1c+_0xb408('0x19'),'form':{'grant_type':_0xb408('0x1a'),'client_id':_0x3d383f[_0xb408('0xe')],'client_secret':_0x3d383f[_0xb408('0xf')],'redirect_uri':_0x3d383f[_0xb408('0xd')],'code':_0x3d383f[_0xb408('0x10')]},'headers':{'Content-Type':_0xb408('0x1b')}};return rp(_0x4d7232)[_0xb408('0x1c')](function(_0x5a2096){var _0x2becf4=JSON[_0xb408('0x1d')](_0x5a2096);if(_0x2becf4['refresh_token']){_0x3d383f['refreshToken']=_0x2becf4[_0xb408('0x1e')];logger[_0xb408('0x1f')](util[_0xb408('0x20')](_0xb408('0x21'),_0x3d383f['name'],_0x3d383f['id']));}else{logger[_0xb408('0x22')](util[_0xb408('0x20')](_0xb408('0x23'),_0x3d383f[_0xb408('0x24')],_0x3d383f['id']),util[_0xb408('0x25')](_0x2becf4,{'showHidden':![],'depth':null}));}return _0x2069c0(null,_0xd5da81);})['catch'](function(_0x4936bd){logger[_0xb408('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3d383f[_0xb408('0x24')],_0x3d383f['id']),util[_0xb408('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2069c0(_0x4936bd);});}else{return _0x2069c0(null,_0xd5da81);}},'beforeUpdate':function(_0xd1eb06,_0xcfa8a4,_0x3ae18d){if(_0xd1eb06[_0xb408('0xc')](_0xb408('0x15'))||_0xd1eb06[_0xb408('0xc')](_0xb408('0xd'))||_0xd1eb06[_0xb408('0xc')](_0xb408('0xe'))||_0xd1eb06['changed'](_0xb408('0xf'))||_0xd1eb06[_0xb408('0xc')](_0xb408('0x10'))||_0xd1eb06['changed'](_0xb408('0x11'))){var _0x146a98,_0x3d4dc8;_0x146a98=_0xd1eb06[_0xb408('0xd')];var _0x4c9f63=_0x146a98[_0xb408('0x12')](-0x1);if(_0x4c9f63==='/'||_0x4c9f63==='\x5c'||_0x4c9f63===':'){_0x146a98=_0x146a98[_0xb408('0x13')](0x0,_0x146a98[_0xb408('0x14')](_0x4c9f63));}switch(_0xd1eb06[_0xb408('0x15')]){case'US':_0x3d4dc8='https://accounts.zoho.com';break;case'AU':_0x3d4dc8=_0xb408('0x26');break;case'IN':_0x3d4dc8='https://accounts.zoho.in';break;case'CN':_0x3d4dc8=_0xb408('0x17');break;default:_0x3d4dc8=_0xb408('0x18');break;}var _0x29abf5={'method':'POST','uri':_0x3d4dc8+_0xb408('0x19'),'form':{'grant_type':_0xb408('0x1a'),'client_id':_0xd1eb06[_0xb408('0xe')],'client_secret':_0xd1eb06[_0xb408('0xf')],'redirect_uri':_0xd1eb06['serverUrl'],'code':_0xd1eb06[_0xb408('0x10')]},'headers':{'Content-Type':_0xb408('0x1b')}};return rp(_0x29abf5)[_0xb408('0x1c')](function(_0x4635f6){var _0x2debeb=JSON['parse'](_0x4635f6);if(_0x2debeb[_0xb408('0x1e')]){_0xd1eb06[_0xb408('0x27')]=_0x2debeb[_0xb408('0x1e')];logger['info'](util[_0xb408('0x20')](_0xb408('0x21'),_0xd1eb06[_0xb408('0x24')],_0xd1eb06['id']));}else{logger[_0xb408('0x22')](util['format'](_0xb408('0x23'),_0xd1eb06[_0xb408('0x24')],_0xd1eb06['id']),util['inspect'](_0x2debeb,{'showHidden':![],'depth':null}));}return _0x3ae18d(null,_0xcfa8a4);})[_0xb408('0x28')](function(_0x5f27ed){logger[_0xb408('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xd1eb06[_0xb408('0x24')],_0xd1eb06['id']),util[_0xb408('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ae18d(_0x5f27ed);});}else{return _0x3ae18d(null,_0xcfa8a4);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index da0f00d..fd0d196 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 _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 +var _0x4253=['client','http','request','then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','GetZohoAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowZohoAccount','ZohoAccount','find','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x46b392,_0x4f1ad0){var _0x41aca2=function(_0x1d8ca0){while(--_0x1d8ca0){_0x46b392['push'](_0x46b392['shift']());}};_0x41aca2(++_0x4f1ad0);}(_0x4253,0x14c));var _0x3425=function(_0x54e547,_0x4bbf7c){_0x54e547=_0x54e547-0x0;var _0x209dd5=_0x4253[_0x54e547];return _0x209dd5;};'use strict';var _=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var moment=require('moment');var BPromise=require(_0x3425('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3425('0x3'));var db=require(_0x3425('0x4'))['db'];var utils=require(_0x3425('0x5'));var logger=require(_0x3425('0x6'))(_0x3425('0x7'));var config=require(_0x3425('0x8'));var jayson=require(_0x3425('0x9'));var client=jayson[_0x3425('0xa')][_0x3425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53cc1f,_0x1bb3ca,_0x1994b1){return new BPromise(function(_0x33cbc7,_0x4ce62b){return client[_0x3425('0xc')](_0x53cc1f,_0x1994b1)[_0x3425('0xd')](function(_0x5a2bc6){logger[_0x3425('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1bb3ca,'request\x20sent');logger['debug'](_0x3425('0xf'),_0x1bb3ca,_0x3425('0x10'),JSON[_0x3425('0x11')](_0x5a2bc6));if(_0x5a2bc6['error']){if(_0x5a2bc6[_0x3425('0x12')][_0x3425('0x13')]===0x1f4){logger[_0x3425('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x1bb3ca,_0x5a2bc6[_0x3425('0x12')][_0x3425('0x14')]);return _0x4ce62b(_0x5a2bc6[_0x3425('0x12')][_0x3425('0x14')]);}logger[_0x3425('0x12')](_0x3425('0x15'),_0x1bb3ca,_0x5a2bc6[_0x3425('0x12')]['message']);return _0x33cbc7(_0x5a2bc6[_0x3425('0x12')]['message']);}else{logger[_0x3425('0xe')](_0x3425('0x15'),_0x1bb3ca,'request\x20sent');_0x33cbc7(_0x5a2bc6[_0x3425('0x16')][_0x3425('0x14')]);}})['catch'](function(_0x13aabd){logger['error'](_0x3425('0x15'),_0x1bb3ca,_0x13aabd);_0x4ce62b(_0x13aabd);});});}exports[_0x3425('0x17')]=function(_0x1565c8){var _0x2156c4=this;return new Promise(function(_0x4d5933,_0xb9b412){return db['ZohoAccount'][_0x3425('0x18')]({'raw':_0x1565c8[_0x3425('0x19')]?_0x1565c8[_0x3425('0x19')][_0x3425('0x1a')]===undefined?!![]:![]:!![],'where':_0x1565c8[_0x3425('0x19')]?_0x1565c8[_0x3425('0x19')][_0x3425('0x1b')]||null:null,'attributes':_0x1565c8[_0x3425('0x19')]?_0x1565c8['options']['attributes']||null:null,'limit':_0x1565c8[_0x3425('0x19')]?_0x1565c8['options'][_0x3425('0x1c')]||null:null,'include':_0x1565c8[_0x3425('0x19')]?_0x1565c8[_0x3425('0x19')][_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x1565c8[_0x3425('0x19')]['include'],function(_0x38b577){return{'model':db[_0x38b577[_0x3425('0x1f')]],'as':_0x38b577['as'],'attributes':_0x38b577[_0x3425('0x20')],'include':_0x38b577[_0x3425('0x1d')]?_['map'](_0x38b577[_0x3425('0x1d')],function(_0x31d4d5){return{'model':db[_0x31d4d5[_0x3425('0x1f')]],'as':_0x31d4d5['as'],'attributes':_0x31d4d5[_0x3425('0x20')],'include':_0x31d4d5[_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x31d4d5[_0x3425('0x1d')],function(_0x2638b5){return{'model':db[_0x2638b5[_0x3425('0x1f')]],'as':_0x2638b5['as'],'attributes':_0x2638b5[_0x3425('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3425('0xd')](function(_0x16c50a){logger[_0x3425('0xe')](_0x3425('0x17'),_0x1565c8);logger['debug'](_0x3425('0x17'),_0x1565c8,JSON[_0x3425('0x11')](_0x16c50a));_0x4d5933(_0x16c50a);})[_0x3425('0x21')](function(_0x27f416){logger[_0x3425('0x12')](_0x3425('0x17'),_0x27f416[_0x3425('0x14')],_0x1565c8);_0xb9b412(_0x2156c4[_0x3425('0x12')](0x1f4,_0x27f416[_0x3425('0x14')]));});});};exports[_0x3425('0x22')]=function(_0x24b353){var _0xf4111=this;return new Promise(function(_0x256a64,_0x425753){return db[_0x3425('0x23')][_0x3425('0x24')]({'raw':_0x24b353[_0x3425('0x19')]?_0x24b353[_0x3425('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x24b353[_0x3425('0x19')]?_0x24b353[_0x3425('0x19')][_0x3425('0x1b')]||null:null,'attributes':_0x24b353['options']?_0x24b353[_0x3425('0x19')][_0x3425('0x20')]||null:null,'include':_0x24b353[_0x3425('0x19')]?_0x24b353[_0x3425('0x19')][_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x24b353[_0x3425('0x19')][_0x3425('0x1d')],function(_0x7b658c){return{'model':db[_0x7b658c[_0x3425('0x1f')]],'as':_0x7b658c['as'],'attributes':_0x7b658c[_0x3425('0x20')],'include':_0x7b658c[_0x3425('0x1d')]?_['map'](_0x7b658c[_0x3425('0x1d')],function(_0x3efee9){return{'model':db[_0x3efee9[_0x3425('0x1f')]],'as':_0x3efee9['as'],'attributes':_0x3efee9[_0x3425('0x20')],'include':_0x3efee9[_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x3efee9[_0x3425('0x1d')],function(_0x22ef8e){return{'model':db[_0x22ef8e[_0x3425('0x1f')]],'as':_0x22ef8e['as'],'attributes':_0x22ef8e[_0x3425('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3425('0xd')](function(_0xda59ce){logger['info'](_0x3425('0x22'),_0x24b353);logger[_0x3425('0x25')](_0x3425('0x22'),_0x24b353,JSON[_0x3425('0x11')](_0xda59ce));_0x256a64(_0xda59ce);})[_0x3425('0x21')](function(_0x21e67e){logger[_0x3425('0x12')](_0x3425('0x22'),_0x21e67e[_0x3425('0x14')],_0x24b353);_0x425753(_0xf4111[_0x3425('0x12')](0x1f4,_0x21e67e[_0x3425('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d416cb9..ad09718 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 _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 +var _0x54a2=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x398ffc,_0x5357d8){var _0x546554=function(_0x2ec7b7){while(--_0x2ec7b7){_0x398ffc['push'](_0x398ffc['shift']());}};_0x546554(++_0x5357d8);}(_0x54a2,0x154));var _0x254a=function(_0x14e1cb,_0xd3465e){_0x14e1cb=_0x14e1cb-0x0;var _0x18a337=_0x54a2[_0x14e1cb];return _0x18a337;};'use strict';var multer=require(_0x254a('0x0'));var util=require(_0x254a('0x1'));var path=require('path');var timeout=require(_0x254a('0x2'));var express=require(_0x254a('0x3'));var router=express[_0x254a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x254a('0x5'));var interaction=require(_0x254a('0x6'));var config=require('../../config/environment');var controller=require(_0x254a('0x7'));router[_0x254a('0x8')]('/',auth['isAuthenticated'](),controller[_0x254a('0x9')]);router['get'](_0x254a('0xa'),auth[_0x254a('0xb')](),controller['show']);router['get'](_0x254a('0xc'),auth[_0x254a('0xb')](),controller[_0x254a('0xd')]);router[_0x254a('0x8')](_0x254a('0xe'),auth['isAuthenticated'](),controller[_0x254a('0xf')]);router[_0x254a('0x8')](_0x254a('0x10'),auth['isAuthenticated'](),controller[_0x254a('0x11')]);router['post']('/',auth[_0x254a('0xb')](),controller[_0x254a('0x12')]);router[_0x254a('0x13')](_0x254a('0xa'),auth['isAuthenticated'](),controller[_0x254a('0x14')]);router[_0x254a('0x15')](_0x254a('0xa'),auth[_0x254a('0xb')](),controller[_0x254a('0x16')]);module[_0x254a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 874bd35..e038897 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 _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 +var _0xca56=['contact_lead','contact','sequelize','STRING','ENUM','lead'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xca56,0xd4));var _0x6ca5=function(_0x4c9429,_0x2ae577){_0x4c9429=_0x4c9429-0x0;var _0x4cddb0=_0xca56[_0x4c9429];return _0x4cddb0;};'use strict';var Sequelize=require(_0x6ca5('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ca5('0x1')]},'moduleCreate':{'type':Sequelize[_0x6ca5('0x2')](_0x6ca5('0x3'),'contact','nothing'),'defaultValue':_0x6ca5('0x3')},'moduleSearch':{'type':Sequelize[_0x6ca5('0x2')](_0x6ca5('0x4'),_0x6ca5('0x5'),_0x6ca5('0x3')),'defaultValue':_0x6ca5('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b5492e3..13ddcf0 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 _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 +var _0xc20a=['ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','stack','rawAttributes','fieldName','type','model','name','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','ZohoConfiguration','includeAll','include','catch','show','params','keys','intersection','fields','options','find','create','body','update','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x5f42da,_0x3b5e13){var _0x2438ed=function(_0x3d21c4){while(--_0x3d21c4){_0x5f42da['push'](_0x5f42da['shift']());}};_0x2438ed(++_0x3b5e13);}(_0xc20a,0x176));var _0xac20=function(_0x30e399,_0x349c3f){_0x30e399=_0x30e399-0x0;var _0x12b5eb=_0xc20a[_0x30e399];return _0x12b5eb;};'use strict';var emlformat=require(_0xac20('0x0'));var rimraf=require(_0xac20('0x1'));var zipdir=require(_0xac20('0x2'));var jsonpatch=require(_0xac20('0x3'));var rp=require(_0xac20('0x4'));var moment=require(_0xac20('0x5'));var BPromise=require(_0xac20('0x6'));var Mustache=require(_0xac20('0x7'));var util=require('util');var path=require(_0xac20('0x8'));var sox=require(_0xac20('0x9'));var csv=require(_0xac20('0xa'));var ejs=require(_0xac20('0xb'));var fs=require('fs');var fs_extra=require(_0xac20('0xc'));var _=require(_0xac20('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac20('0xe'));var deskjs=require(_0xac20('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac20('0x10'));var Redis=require('ioredis');var authService=require(_0xac20('0x11'));var qs=require(_0xac20('0x12'));var as=require(_0xac20('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac20('0x14'));var utils=require(_0xac20('0x15'));var config=require(_0xac20('0x16'));var licenseUtil=require(_0xac20('0x17'));var db=require(_0xac20('0x18'))['db'];function respondWithStatusCode(_0x1a9548,_0x58e2fa){_0x58e2fa=_0x58e2fa||0xcc;return function(_0xda655b){if(_0xda655b){return _0x1a9548[_0xac20('0x19')](_0x58e2fa);}return _0x1a9548[_0xac20('0x1a')](_0x58e2fa)[_0xac20('0x1b')]();};}function respondWithResult(_0x8b879c,_0x2e2208){_0x2e2208=_0x2e2208||0xc8;return function(_0x2914b7){if(_0x2914b7){return _0x8b879c[_0xac20('0x1a')](_0x2e2208)[_0xac20('0x1c')](_0x2914b7);}};}function respondWithFilteredResult(_0x5d6817,_0x2824b7){return function(_0x4fdf6e){if(_0x4fdf6e){var _0x304524=typeof _0x2824b7[_0xac20('0x1d')]===_0xac20('0x1e')&&typeof _0x2824b7[_0xac20('0x1f')]==='undefined';var _0x3601c5=_0x4fdf6e[_0xac20('0x20')];var _0x550735=_0x304524?0x0:_0x2824b7[_0xac20('0x1d')];var _0x3b9623=_0x304524?_0x4fdf6e[_0xac20('0x20')]:_0x2824b7['offset']+_0x2824b7[_0xac20('0x1f')];var _0xd48b77;if(_0x3b9623>=_0x3601c5){_0x3b9623=_0x3601c5;_0xd48b77=0xc8;}else{_0xd48b77=0xce;}_0x5d6817['status'](_0xd48b77);return _0x5d6817[_0xac20('0x21')]('Content-Range',_0x550735+'-'+_0x3b9623+'/'+_0x3601c5)[_0xac20('0x1c')](_0x4fdf6e);}return null;};}function patchUpdates(_0x2ffa6e){return function(_0x5ab890){try{jsonpatch['apply'](_0x5ab890,_0x2ffa6e,!![]);}catch(_0x159db9){return BPromise[_0xac20('0x22')](_0x159db9);}return _0x5ab890[_0xac20('0x23')]();};}function saveUpdates(_0x356721,_0x5598d8){return function(_0x45f8fc){if(_0x45f8fc){return _0x45f8fc['update'](_0x356721)[_0xac20('0x24')](function(_0x3f553b){return _0x3f553b;});}return null;};}function removeEntity(_0x5c3807,_0x328fb1){return function(_0x53042f){if(_0x53042f){return _0x53042f[_0xac20('0x25')]()[_0xac20('0x24')](function(){_0x5c3807['status'](0xcc)[_0xac20('0x1b')]();});}};}function handleEntityNotFound(_0x5392f8,_0x4c67b4){return function(_0x48f209){if(!_0x48f209){_0x5392f8['sendStatus'](0x194);}return _0x48f209;};}function handleError(_0x4b3c92,_0xefb166){_0xefb166=_0xefb166||0x1f4;return function(_0x14f94c){logger['error'](_0x14f94c[_0xac20('0x26')]);if(_0x14f94c['name']){delete _0x14f94c['name'];}_0x4b3c92[_0xac20('0x1a')](_0xefb166)['send'](_0x14f94c);};}exports['index']=function(_0x2a62f1,_0x58f55a){var _0x1c7c2f={},_0x540eb2={},_0x3b60df={'count':0x0,'rows':[]};var _0x5cd2bd=_['map'](db['ZohoConfiguration'][_0xac20('0x27')],function(_0x35b63e){return{'name':_0x35b63e[_0xac20('0x28')],'type':_0x35b63e[_0xac20('0x29')]['key']};});_0x540eb2[_0xac20('0x2a')]=_['map'](_0x5cd2bd,_0xac20('0x2b'));_0x540eb2['query']=_['keys'](_0x2a62f1[_0xac20('0x2c')]);_0x540eb2[_0xac20('0x2d')]=_['intersection'](_0x540eb2[_0xac20('0x2a')],_0x540eb2[_0xac20('0x2c')]);_0x1c7c2f[_0xac20('0x2e')]=_['intersection'](_0x540eb2['model'],qs['fields'](_0x2a62f1['query']['fields']));_0x1c7c2f[_0xac20('0x2e')]=_0x1c7c2f[_0xac20('0x2e')][_0xac20('0x2f')]?_0x1c7c2f[_0xac20('0x2e')]:_0x540eb2[_0xac20('0x2a')];if(!_0x2a62f1['query'][_0xac20('0x30')](_0xac20('0x31'))){_0x1c7c2f[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x2a62f1[_0xac20('0x2c')][_0xac20('0x1f')]);_0x1c7c2f['offset']=qs[_0xac20('0x1d')](_0x2a62f1['query'][_0xac20('0x1d')]);}_0x1c7c2f[_0xac20('0x32')]=qs[_0xac20('0x33')](_0x2a62f1['query'][_0xac20('0x33')]);_0x1c7c2f['where']=qs[_0xac20('0x2d')](_[_0xac20('0x34')](_0x2a62f1[_0xac20('0x2c')],_0x540eb2[_0xac20('0x2d')]),_0x5cd2bd);if(_0x2a62f1['query'][_0xac20('0x35')]){_0x1c7c2f[_0xac20('0x36')]=_[_0xac20('0x37')](_0x1c7c2f[_0xac20('0x36')],{'$or':_[_0xac20('0x38')](_0x5cd2bd,function(_0x301ff1){if(_0x301ff1[_0xac20('0x29')]!==_0xac20('0x39')){var _0x327fbb={};_0x327fbb[_0x301ff1[_0xac20('0x2b')]]={'$like':'%'+_0x2a62f1[_0xac20('0x2c')][_0xac20('0x35')]+'%'};return _0x327fbb;}})});}_0x1c7c2f=_[_0xac20('0x37')]({},_0x1c7c2f,_0x2a62f1['options']);var _0xaa4965={'where':_0x1c7c2f[_0xac20('0x36')]};return db[_0xac20('0x3a')]['count'](_0xaa4965)[_0xac20('0x24')](function(_0x466ace){_0x3b60df['count']=_0x466ace;if(_0x2a62f1[_0xac20('0x2c')][_0xac20('0x3b')]){_0x1c7c2f[_0xac20('0x3c')]=[{'all':!![]}];}return db[_0xac20('0x3a')]['findAll'](_0x1c7c2f);})['then'](function(_0x4c267f){_0x3b60df['rows']=_0x4c267f;return _0x3b60df;})[_0xac20('0x24')](respondWithFilteredResult(_0x58f55a,_0x1c7c2f))[_0xac20('0x3d')](handleError(_0x58f55a,null));};exports[_0xac20('0x3e')]=function(_0x2c49a8,_0x25edaf){var _0xe83883={'raw':![],'where':{'id':_0x2c49a8[_0xac20('0x3f')]['id']}},_0x2dfcff={};_0x2dfcff[_0xac20('0x2a')]=_[_0xac20('0x40')](db[_0xac20('0x3a')][_0xac20('0x27')]);_0x2dfcff[_0xac20('0x2c')]=_['keys'](_0x2c49a8[_0xac20('0x2c')]);_0x2dfcff['filters']=_[_0xac20('0x41')](_0x2dfcff[_0xac20('0x2a')],_0x2dfcff[_0xac20('0x2c')]);_0xe83883[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x2dfcff[_0xac20('0x2a')],qs[_0xac20('0x42')](_0x2c49a8[_0xac20('0x2c')][_0xac20('0x42')]));_0xe83883[_0xac20('0x2e')]=_0xe83883['attributes']['length']?_0xe83883[_0xac20('0x2e')]:_0x2dfcff[_0xac20('0x2a')];if(_0x2c49a8[_0xac20('0x2c')]['includeAll']){_0xe83883[_0xac20('0x3c')]=[{'all':!![]}];}_0xe83883=_[_0xac20('0x37')]({},_0xe83883,_0x2c49a8[_0xac20('0x43')]);return db[_0xac20('0x3a')][_0xac20('0x44')](_0xe83883)[_0xac20('0x24')](handleEntityNotFound(_0x25edaf,null))[_0xac20('0x24')](respondWithResult(_0x25edaf,null))['catch'](handleError(_0x25edaf,null));};exports[_0xac20('0x45')]=function(_0x259d0f,_0x18fad8){return db[_0xac20('0x3a')]['create'](_0x259d0f[_0xac20('0x46')],{})[_0xac20('0x24')](respondWithResult(_0x18fad8,0xc9))[_0xac20('0x3d')](handleError(_0x18fad8,null));};exports[_0xac20('0x47')]=function(_0x53f3cd,_0x5f4b77){if(_0x53f3cd['body']['id']){delete _0x53f3cd[_0xac20('0x46')]['id'];}return db[_0xac20('0x3a')][_0xac20('0x44')]({'where':{'id':_0x53f3cd[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x5f4b77,null))[_0xac20('0x24')](saveUpdates(_0x53f3cd[_0xac20('0x46')],null))['then'](respondWithResult(_0x5f4b77,null))['catch'](handleError(_0x5f4b77,null));};exports[_0xac20('0x25')]=function(_0x5be6d3,_0x7a61b9){return db['ZohoConfiguration']['find']({'where':{'id':_0x5be6d3[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x7a61b9,null))['then'](removeEntity(_0x7a61b9,null))[_0xac20('0x3d')](handleError(_0x7a61b9,null));};exports[_0xac20('0x48')]=function(_0x3f6e77,_0x4bd61e,_0x114fdf){var _0x5b2c97={};var _0x4a9ef1={};var _0x1e7003;var _0x3126ba;return db['ZohoConfiguration'][_0xac20('0x49')]({'where':{'id':_0x3f6e77[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x4bd61e,null))['then'](function(_0xd1d969){if(_0xd1d969){_0x1e7003=_0xd1d969;_0x4a9ef1[_0xac20('0x2a')]=_['keys'](db[_0xac20('0x4a')][_0xac20('0x27')]);_0x4a9ef1[_0xac20('0x2c')]=_[_0xac20('0x40')](_0x3f6e77['query']);_0x4a9ef1[_0xac20('0x2d')]=_['intersection'](_0x4a9ef1[_0xac20('0x2a')],_0x4a9ef1[_0xac20('0x2c')]);_0x5b2c97[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x4a9ef1['model'],qs['fields'](_0x3f6e77['query'][_0xac20('0x42')]));_0x5b2c97['attributes']=_0x5b2c97[_0xac20('0x2e')][_0xac20('0x2f')]?_0x5b2c97[_0xac20('0x2e')]:_0x4a9ef1[_0xac20('0x2a')];_0x5b2c97[_0xac20('0x32')]=qs['sort'](_0x3f6e77[_0xac20('0x2c')]['sort']);_0x5b2c97[_0xac20('0x36')]=qs[_0xac20('0x2d')](_['pick'](_0x3f6e77['query'],_0x4a9ef1[_0xac20('0x2d')]));if(_0x3f6e77[_0xac20('0x2c')][_0xac20('0x35')]){_0x5b2c97[_0xac20('0x36')]=_[_0xac20('0x37')](_0x5b2c97[_0xac20('0x36')],{'$or':_['map'](_0x5b2c97['attributes'],function(_0x52241f){var _0x1a66c9={};_0x1a66c9[_0x52241f]={'$like':'%'+_0x3f6e77[_0xac20('0x2c')][_0xac20('0x35')]+'%'};return _0x1a66c9;})});}_0x5b2c97=_[_0xac20('0x37')]({},_0x5b2c97,_0x3f6e77['options']);return _0x1e7003[_0xac20('0x48')](_0x5b2c97);}})[_0xac20('0x24')](function(_0x3f1b9b){if(_0x3f1b9b){_0x3126ba=_0x3f1b9b[_0xac20('0x2f')];if(!_0x3f6e77[_0xac20('0x2c')]['hasOwnProperty'](_0xac20('0x31'))){_0x5b2c97[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x3f6e77[_0xac20('0x2c')][_0xac20('0x1f')]);_0x5b2c97['offset']=qs[_0xac20('0x1d')](_0x3f6e77[_0xac20('0x2c')][_0xac20('0x1d')]);}return _0x1e7003[_0xac20('0x48')](_0x5b2c97);}})[_0xac20('0x24')](function(_0x13d068){if(_0x13d068){return _0x13d068?{'count':_0x3126ba,'rows':_0x13d068}:null;}})[_0xac20('0x24')](respondWithResult(_0x4bd61e,null))['catch'](handleError(_0x4bd61e,null));};exports['getSubjects']=function(_0x41888d,_0x43aa49,_0x37d532){var _0x5dbaa2={};var _0x3029c4={};var _0x1ae03f;var _0x59ccb6;return db['ZohoConfiguration'][_0xac20('0x49')]({'where':{'id':_0x41888d['params']['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x43aa49,null))[_0xac20('0x24')](function(_0x2e057f){if(_0x2e057f){_0x1ae03f=_0x2e057f;_0x3029c4[_0xac20('0x2a')]=_['keys'](db[_0xac20('0x4a')][_0xac20('0x27')]);_0x3029c4[_0xac20('0x2c')]=_[_0xac20('0x40')](_0x41888d[_0xac20('0x2c')]);_0x3029c4['filters']=_[_0xac20('0x41')](_0x3029c4[_0xac20('0x2a')],_0x3029c4[_0xac20('0x2c')]);_0x5dbaa2[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x3029c4[_0xac20('0x2a')],qs['fields'](_0x41888d['query'][_0xac20('0x42')]));_0x5dbaa2[_0xac20('0x2e')]=_0x5dbaa2['attributes'][_0xac20('0x2f')]?_0x5dbaa2[_0xac20('0x2e')]:_0x3029c4[_0xac20('0x2a')];_0x5dbaa2['order']=qs[_0xac20('0x33')](_0x41888d[_0xac20('0x2c')][_0xac20('0x33')]);_0x5dbaa2[_0xac20('0x36')]=qs[_0xac20('0x2d')](_[_0xac20('0x34')](_0x41888d[_0xac20('0x2c')],_0x3029c4[_0xac20('0x2d')]));if(_0x41888d[_0xac20('0x2c')][_0xac20('0x35')]){_0x5dbaa2[_0xac20('0x36')]=_[_0xac20('0x37')](_0x5dbaa2[_0xac20('0x36')],{'$or':_['map'](_0x5dbaa2['attributes'],function(_0x16d612){var _0x5e1f6a={};_0x5e1f6a[_0x16d612]={'$like':'%'+_0x41888d[_0xac20('0x2c')][_0xac20('0x35')]+'%'};return _0x5e1f6a;})});}_0x5dbaa2=_[_0xac20('0x37')]({},_0x5dbaa2,_0x41888d[_0xac20('0x43')]);return _0x1ae03f['getSubjects'](_0x5dbaa2);}})['then'](function(_0xa4cc6e){if(_0xa4cc6e){_0x59ccb6=_0xa4cc6e[_0xac20('0x2f')];if(!_0x41888d[_0xac20('0x2c')][_0xac20('0x30')](_0xac20('0x31'))){_0x5dbaa2[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x41888d[_0xac20('0x2c')][_0xac20('0x1f')]);_0x5dbaa2[_0xac20('0x1d')]=qs[_0xac20('0x1d')](_0x41888d[_0xac20('0x2c')]['offset']);}return _0x1ae03f[_0xac20('0x4b')](_0x5dbaa2);}})['then'](function(_0x3bcd66){if(_0x3bcd66){return _0x3bcd66?{'count':_0x59ccb6,'rows':_0x3bcd66}:null;}})[_0xac20('0x24')](respondWithResult(_0x43aa49,null))[_0xac20('0x3d')](handleError(_0x43aa49,null));};exports['getDescriptions']=function(_0x4668f0,_0x2040ca,_0x3f8f89){var _0x1c3d2e={};var _0x2f2618={};var _0x159546;var _0x5c755a;return db[_0xac20('0x3a')][_0xac20('0x49')]({'where':{'id':_0x4668f0[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x2040ca,null))[_0xac20('0x24')](function(_0x3347fd){if(_0x3347fd){_0x159546=_0x3347fd;_0x2f2618[_0xac20('0x2a')]=_[_0xac20('0x40')](db[_0xac20('0x4a')][_0xac20('0x27')]);_0x2f2618[_0xac20('0x2c')]=_[_0xac20('0x40')](_0x4668f0[_0xac20('0x2c')]);_0x2f2618['filters']=_[_0xac20('0x41')](_0x2f2618[_0xac20('0x2a')],_0x2f2618[_0xac20('0x2c')]);_0x1c3d2e[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x2f2618['model'],qs['fields'](_0x4668f0[_0xac20('0x2c')][_0xac20('0x42')]));_0x1c3d2e[_0xac20('0x2e')]=_0x1c3d2e['attributes'][_0xac20('0x2f')]?_0x1c3d2e['attributes']:_0x2f2618[_0xac20('0x2a')];_0x1c3d2e['order']=qs[_0xac20('0x33')](_0x4668f0[_0xac20('0x2c')][_0xac20('0x33')]);_0x1c3d2e[_0xac20('0x36')]=qs[_0xac20('0x2d')](_[_0xac20('0x34')](_0x4668f0[_0xac20('0x2c')],_0x2f2618[_0xac20('0x2d')]));if(_0x4668f0[_0xac20('0x2c')]['filter']){_0x1c3d2e[_0xac20('0x36')]=_[_0xac20('0x37')](_0x1c3d2e[_0xac20('0x36')],{'$or':_['map'](_0x1c3d2e[_0xac20('0x2e')],function(_0x3905ad){var _0x3da77a={};_0x3da77a[_0x3905ad]={'$like':'%'+_0x4668f0['query'][_0xac20('0x35')]+'%'};return _0x3da77a;})});}_0x1c3d2e=_[_0xac20('0x37')]({},_0x1c3d2e,_0x4668f0[_0xac20('0x43')]);return _0x159546[_0xac20('0x4c')](_0x1c3d2e);}})['then'](function(_0x42f68b){if(_0x42f68b){_0x5c755a=_0x42f68b[_0xac20('0x2f')];if(!_0x4668f0[_0xac20('0x2c')][_0xac20('0x30')](_0xac20('0x31'))){_0x1c3d2e[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x4668f0[_0xac20('0x2c')][_0xac20('0x1f')]);_0x1c3d2e[_0xac20('0x1d')]=qs['offset'](_0x4668f0['query'][_0xac20('0x1d')]);}return _0x159546[_0xac20('0x4c')](_0x1c3d2e);}})['then'](function(_0x12ac0c){if(_0x12ac0c){return _0x12ac0c?{'count':_0x5c755a,'rows':_0x12ac0c}:null;}})['then'](respondWithResult(_0x2040ca,null))['catch'](handleError(_0x2040ca,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index cb7ae49..dd6133e 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 _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 +var _0x6bd5=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','bluebird'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0x6bd5,0xbc));var _0x56bd=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x6bd5[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x56bd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x56bd('0x1'));var rp=require(_0x56bd('0x2'));var fs=require('fs');var path=require(_0x56bd('0x3'));var rimraf=require(_0x56bd('0x4'));var config=require(_0x56bd('0x5'));var attributes=require(_0x56bd('0x6'));module[_0x56bd('0x7')]=function(_0x77078f,_0x301d42){return _0x77078f[_0x56bd('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x56bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 4593b75..7c29521 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 _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 +var _0xcb4c=['code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0xcb4c,0x131));var _0xccb4=function(_0x4868f1,_0x161563){_0x4868f1=_0x4868f1-0x0;var _0x41e532=_0xcb4c[_0x4868f1];return _0x41e532;};'use strict';var _=require(_0xccb4('0x0'));var util=require(_0xccb4('0x1'));var moment=require('moment');var BPromise=require(_0xccb4('0x2'));var rs=require(_0xccb4('0x3'));var fs=require('fs');var Redis=require(_0xccb4('0x4'));var db=require(_0xccb4('0x5'))['db'];var utils=require(_0xccb4('0x6'));var logger=require(_0xccb4('0x7'))(_0xccb4('0x8'));var config=require(_0xccb4('0x9'));var jayson=require(_0xccb4('0xa'));var client=jayson[_0xccb4('0xb')][_0xccb4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d540f,_0x23e001,_0x425ede){return new BPromise(function(_0x544a90,_0x58a1c2){return client[_0xccb4('0xd')](_0x2d540f,_0x425ede)[_0xccb4('0xe')](function(_0x43f5d9){logger[_0xccb4('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x23e001,'request\x20sent');logger[_0xccb4('0x10')](_0xccb4('0x11'),_0x23e001,_0xccb4('0x12'),JSON['stringify'](_0x43f5d9));if(_0x43f5d9[_0xccb4('0x13')]){if(_0x43f5d9['error'][_0xccb4('0x14')]===0x1f4){logger[_0xccb4('0x13')](_0xccb4('0x15'),_0x23e001,_0x43f5d9[_0xccb4('0x13')][_0xccb4('0x16')]);return _0x58a1c2(_0x43f5d9['error'][_0xccb4('0x16')]);}logger[_0xccb4('0x13')](_0xccb4('0x15'),_0x23e001,_0x43f5d9['error'][_0xccb4('0x16')]);return _0x544a90(_0x43f5d9[_0xccb4('0x13')]['message']);}else{logger[_0xccb4('0xf')](_0xccb4('0x15'),_0x23e001,_0xccb4('0x12'));_0x544a90(_0x43f5d9[_0xccb4('0x17')][_0xccb4('0x16')]);}})[_0xccb4('0x18')](function(_0x5887f3){logger['error'](_0xccb4('0x15'),_0x23e001,_0x5887f3);_0x58a1c2(_0x5887f3);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c37ef84..9e93ee5 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 _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 +var _0xb806=['connect-timeout','express','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3e9041,_0x5971f6){var _0x3519be=function(_0x1153d1){while(--_0x1153d1){_0x3e9041['push'](_0x3e9041['shift']());}};_0x3519be(++_0x5971f6);}(_0xb806,0x95));var _0x6b80=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xb806[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x6b80('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b80('0x1'));var express=require(_0x6b80('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6b80('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b80('0x4'));router[_0x6b80('0x5')]('/',auth[_0x6b80('0x6')](),controller['index']);router[_0x6b80('0x5')](_0x6b80('0x7'),auth[_0x6b80('0x6')](),controller['show']);router[_0x6b80('0x8')]('/',auth[_0x6b80('0x6')](),controller[_0x6b80('0x9')]);router[_0x6b80('0xa')](_0x6b80('0x7'),auth[_0x6b80('0x6')](),controller[_0x6b80('0xb')]);router[_0x6b80('0xc')](_0x6b80('0x7'),auth[_0x6b80('0x6')](),controller[_0x6b80('0xd')]);module[_0x6b80('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 05c1c1d..7d18bd7 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 _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 +var _0xa622=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x23dcd1,_0x2bf33d){var _0x14287e=function(_0x14e3d2){while(--_0x14e3d2){_0x23dcd1['push'](_0x23dcd1['shift']());}};_0x14287e(++_0x2bf33d);}(_0xa622,0x1cf));var _0x2a62=function(_0x35cddc,_0x43dbbb){_0x35cddc=_0x35cddc-0x0;var _0x30886a=_0xa622[_0x35cddc];return _0x30886a;};'use strict';var Sequelize=require(_0x2a62('0x0'));module[_0x2a62('0x1')]={'type':{'type':Sequelize[_0x2a62('0x2')]('string',_0x2a62('0x3'),_0x2a62('0x4'),'keyValue',_0x2a62('0x5')),'defaultValue':_0x2a62('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2a62('0x7')]},'keyType':{'type':Sequelize[_0x2a62('0x2')]('string','variable',_0x2a62('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2a62('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2a62('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a62('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 5a87788..463b1c2 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 _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 +var _0x278a=['keys','rawAttributes','include','find','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ZohoField','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show'];(function(_0x104853,_0x2fa75a){var _0x200369=function(_0x240b84){while(--_0x240b84){_0x104853['push'](_0x104853['shift']());}};_0x200369(++_0x2fa75a);}(_0x278a,0x127));var _0xa278=function(_0x5729bf,_0x16f5dd){_0x5729bf=_0x5729bf-0x0;var _0x297d5c=_0x278a[_0x5729bf];return _0x297d5c;};'use strict';var emlformat=require(_0xa278('0x0'));var rimraf=require(_0xa278('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa278('0x2'));var rp=require('request-promise');var moment=require(_0xa278('0x3'));var BPromise=require(_0xa278('0x4'));var Mustache=require('mustache');var util=require(_0xa278('0x5'));var path=require(_0xa278('0x6'));var sox=require('sox');var csv=require(_0xa278('0x7'));var ejs=require(_0xa278('0x8'));var fs=require('fs');var fs_extra=require(_0xa278('0x9'));var _=require(_0xa278('0xa'));var squel=require(_0xa278('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa278('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa278('0xd'));var Papa=require('papaparse');var Redis=require(_0xa278('0xe'));var authService=require(_0xa278('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa278('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa278('0x11'))(_0xa278('0x12'));var utils=require(_0xa278('0x13'));var config=require(_0xa278('0x14'));var licenseUtil=require(_0xa278('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x333bfc,_0x39a54e){_0x39a54e=_0x39a54e||0xcc;return function(_0x26ac80){if(_0x26ac80){return _0x333bfc[_0xa278('0x16')](_0x39a54e);}return _0x333bfc[_0xa278('0x17')](_0x39a54e)[_0xa278('0x18')]();};}function respondWithResult(_0x1a7e30,_0x15c9c3){_0x15c9c3=_0x15c9c3||0xc8;return function(_0x55e417){if(_0x55e417){return _0x1a7e30[_0xa278('0x17')](_0x15c9c3)[_0xa278('0x19')](_0x55e417);}};}function respondWithFilteredResult(_0xb0b97c,_0x22fa72){return function(_0x2171ff){if(_0x2171ff){var _0x570d70=typeof _0x22fa72[_0xa278('0x1a')]===_0xa278('0x1b')&&typeof _0x22fa72[_0xa278('0x1c')]===_0xa278('0x1b');var _0x97d7d8=_0x2171ff[_0xa278('0x1d')];var _0xcb55c2=_0x570d70?0x0:_0x22fa72[_0xa278('0x1a')];var _0x1ba914=_0x570d70?_0x2171ff[_0xa278('0x1d')]:_0x22fa72['offset']+_0x22fa72[_0xa278('0x1c')];var _0x4dccb0;if(_0x1ba914>=_0x97d7d8){_0x1ba914=_0x97d7d8;_0x4dccb0=0xc8;}else{_0x4dccb0=0xce;}_0xb0b97c[_0xa278('0x17')](_0x4dccb0);return _0xb0b97c[_0xa278('0x1e')](_0xa278('0x1f'),_0xcb55c2+'-'+_0x1ba914+'/'+_0x97d7d8)[_0xa278('0x19')](_0x2171ff);}return null;};}function patchUpdates(_0x4c0246){return function(_0x486b21){try{jsonpatch[_0xa278('0x20')](_0x486b21,_0x4c0246,!![]);}catch(_0x165188){return BPromise[_0xa278('0x21')](_0x165188);}return _0x486b21['save']();};}function saveUpdates(_0x33d726,_0x509b20){return function(_0x2d3281){if(_0x2d3281){return _0x2d3281[_0xa278('0x22')](_0x33d726)[_0xa278('0x23')](function(_0x516d52){return _0x516d52;});}return null;};}function removeEntity(_0x1bff88,_0xc673d2){return function(_0x5db041){if(_0x5db041){return _0x5db041[_0xa278('0x24')]()[_0xa278('0x23')](function(){_0x1bff88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3db3,_0x596069){return function(_0x446921){if(!_0x446921){_0x1f3db3[_0xa278('0x16')](0x194);}return _0x446921;};}function handleError(_0x258fc4,_0x4cdb65){_0x4cdb65=_0x4cdb65||0x1f4;return function(_0x386dc2){logger[_0xa278('0x25')](_0x386dc2['stack']);if(_0x386dc2['name']){delete _0x386dc2[_0xa278('0x26')];}_0x258fc4[_0xa278('0x17')](_0x4cdb65)[_0xa278('0x27')](_0x386dc2);};}exports[_0xa278('0x28')]=function(_0x340552,_0x3616fb){var _0x47d76d={},_0x56816b={},_0x20784c={'count':0x0,'rows':[]};var _0x5ea9b1=_[_0xa278('0x29')](db[_0xa278('0x2a')]['rawAttributes'],function(_0x257fde){return{'name':_0x257fde[_0xa278('0x2b')],'type':_0x257fde[_0xa278('0x2c')]['key']};});_0x56816b[_0xa278('0x2d')]=_[_0xa278('0x29')](_0x5ea9b1,_0xa278('0x26'));_0x56816b['query']=_['keys'](_0x340552[_0xa278('0x2e')]);_0x56816b[_0xa278('0x2f')]=_[_0xa278('0x30')](_0x56816b[_0xa278('0x2d')],_0x56816b['query']);_0x47d76d[_0xa278('0x31')]=_[_0xa278('0x30')](_0x56816b[_0xa278('0x2d')],qs[_0xa278('0x32')](_0x340552[_0xa278('0x2e')][_0xa278('0x32')]));_0x47d76d[_0xa278('0x31')]=_0x47d76d[_0xa278('0x31')][_0xa278('0x33')]?_0x47d76d[_0xa278('0x31')]:_0x56816b[_0xa278('0x2d')];if(!_0x340552[_0xa278('0x2e')][_0xa278('0x34')](_0xa278('0x35'))){_0x47d76d[_0xa278('0x1c')]=qs['limit'](_0x340552['query']['limit']);_0x47d76d[_0xa278('0x1a')]=qs['offset'](_0x340552[_0xa278('0x2e')][_0xa278('0x1a')]);}_0x47d76d['order']=qs[_0xa278('0x36')](_0x340552[_0xa278('0x2e')][_0xa278('0x36')]);_0x47d76d[_0xa278('0x37')]=qs[_0xa278('0x2f')](_[_0xa278('0x38')](_0x340552[_0xa278('0x2e')],_0x56816b[_0xa278('0x2f')]),_0x5ea9b1);if(_0x340552[_0xa278('0x2e')][_0xa278('0x39')]){_0x47d76d['where']=_[_0xa278('0x3a')](_0x47d76d[_0xa278('0x37')],{'$or':_[_0xa278('0x29')](_0x5ea9b1,function(_0x153811){if(_0x153811[_0xa278('0x2c')]!=='VIRTUAL'){var _0x24ca26={};_0x24ca26[_0x153811[_0xa278('0x26')]]={'$like':'%'+_0x340552[_0xa278('0x2e')][_0xa278('0x39')]+'%'};return _0x24ca26;}})});}_0x47d76d=_[_0xa278('0x3a')]({},_0x47d76d,_0x340552[_0xa278('0x3b')]);var _0x4f4519={'where':_0x47d76d[_0xa278('0x37')]};return db['ZohoField'][_0xa278('0x1d')](_0x4f4519)[_0xa278('0x23')](function(_0x49371b){_0x20784c[_0xa278('0x1d')]=_0x49371b;if(_0x340552[_0xa278('0x2e')][_0xa278('0x3c')]){_0x47d76d['include']=[{'all':!![]}];}return db[_0xa278('0x2a')][_0xa278('0x3d')](_0x47d76d);})['then'](function(_0x16dec5){_0x20784c[_0xa278('0x3e')]=_0x16dec5;return _0x20784c;})['then'](respondWithFilteredResult(_0x3616fb,_0x47d76d))[_0xa278('0x3f')](handleError(_0x3616fb,null));};exports[_0xa278('0x40')]=function(_0x29d867,_0x15a624){var _0xeb5851={'raw':!![],'where':{'id':_0x29d867['params']['id']}},_0x180c68={};_0x180c68['model']=_[_0xa278('0x41')](db[_0xa278('0x2a')][_0xa278('0x42')]);_0x180c68[_0xa278('0x2e')]=_[_0xa278('0x41')](_0x29d867[_0xa278('0x2e')]);_0x180c68[_0xa278('0x2f')]=_['intersection'](_0x180c68[_0xa278('0x2d')],_0x180c68[_0xa278('0x2e')]);_0xeb5851[_0xa278('0x31')]=_[_0xa278('0x30')](_0x180c68['model'],qs['fields'](_0x29d867[_0xa278('0x2e')][_0xa278('0x32')]));_0xeb5851['attributes']=_0xeb5851[_0xa278('0x31')]['length']?_0xeb5851[_0xa278('0x31')]:_0x180c68[_0xa278('0x2d')];if(_0x29d867[_0xa278('0x2e')]['includeAll']){_0xeb5851[_0xa278('0x43')]=[{'all':!![]}];}_0xeb5851=_['merge']({},_0xeb5851,_0x29d867['options']);return db[_0xa278('0x2a')][_0xa278('0x44')](_0xeb5851)[_0xa278('0x23')](handleEntityNotFound(_0x15a624,null))[_0xa278('0x23')](respondWithResult(_0x15a624,null))[_0xa278('0x3f')](handleError(_0x15a624,null));};exports['create']=function(_0x57ee92,_0x1e38db){return db[_0xa278('0x2a')][_0xa278('0x45')](_0x57ee92[_0xa278('0x46')],{})['then'](respondWithResult(_0x1e38db,0xc9))[_0xa278('0x3f')](handleError(_0x1e38db,null));};exports[_0xa278('0x22')]=function(_0x1c77d7,_0x142d78){if(_0x1c77d7[_0xa278('0x46')]['id']){delete _0x1c77d7[_0xa278('0x46')]['id'];}return db[_0xa278('0x2a')]['find']({'where':{'id':_0x1c77d7[_0xa278('0x47')]['id']}})[_0xa278('0x23')](handleEntityNotFound(_0x142d78,null))[_0xa278('0x23')](saveUpdates(_0x1c77d7[_0xa278('0x46')],null))[_0xa278('0x23')](respondWithResult(_0x142d78,null))[_0xa278('0x3f')](handleError(_0x142d78,null));};exports[_0xa278('0x24')]=function(_0x252f42,_0x559a6b){return db[_0xa278('0x2a')][_0xa278('0x44')]({'where':{'id':_0x252f42['params']['id']}})[_0xa278('0x23')](handleEntityNotFound(_0x559a6b,null))[_0xa278('0x23')](removeEntity(_0x559a6b,null))[_0xa278('0x3f')](handleError(_0x559a6b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0d7fd1b..a53d1a0 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 _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 +var _0x0adf=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x40f53b,_0x2dadbd){var _0x368e4c=function(_0x229103){while(--_0x229103){_0x40f53b['push'](_0x40f53b['shift']());}};_0x368e4c(++_0x2dadbd);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x87dde3,_0x369dfe){_0x87dde3=_0x87dde3-0x0;var _0x57dbb0=_0x0adf[_0x87dde3];return _0x57dbb0;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ad('0xd'),'fields':[_0xf0ad('0xe'),_0xf0ad('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9eca682..17eadda 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 _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 +var _0x0b55=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','ZohoField,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x537f7f,_0x274b24){var _0x344f3d=function(_0x559fbd){while(--_0x559fbd){_0x537f7f['push'](_0x537f7f['shift']());}};_0x344f3d(++_0x274b24);}(_0x0b55,0x1e1));var _0x50b5=function(_0x22caf3,_0x508855){_0x22caf3=_0x22caf3-0x0;var _0x4cccc2=_0x0b55[_0x22caf3];return _0x4cccc2;};'use strict';var _=require('lodash');var util=require(_0x50b5('0x0'));var moment=require(_0x50b5('0x1'));var BPromise=require(_0x50b5('0x2'));var rs=require(_0x50b5('0x3'));var fs=require('fs');var Redis=require(_0x50b5('0x4'));var db=require(_0x50b5('0x5'))['db'];var utils=require(_0x50b5('0x6'));var logger=require(_0x50b5('0x7'))(_0x50b5('0x8'));var config=require(_0x50b5('0x9'));var jayson=require(_0x50b5('0xa'));var client=jayson[_0x50b5('0xb')][_0x50b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1492f4,_0x5782e2,_0x27cd08){return new BPromise(function(_0x56599f,_0x6b1cef){return client[_0x50b5('0xd')](_0x1492f4,_0x27cd08)['then'](function(_0x5b91b8){logger[_0x50b5('0xe')]('ZohoField,\x20%s,\x20%s',_0x5782e2,_0x50b5('0xf'));logger[_0x50b5('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x5782e2,_0x50b5('0xf'),JSON[_0x50b5('0x11')](_0x5b91b8));if(_0x5b91b8[_0x50b5('0x12')]){if(_0x5b91b8['error'][_0x50b5('0x13')]===0x1f4){logger[_0x50b5('0x12')](_0x50b5('0x14'),_0x5782e2,_0x5b91b8[_0x50b5('0x12')]['message']);return _0x6b1cef(_0x5b91b8[_0x50b5('0x12')][_0x50b5('0x15')]);}logger['error'](_0x50b5('0x14'),_0x5782e2,_0x5b91b8[_0x50b5('0x12')][_0x50b5('0x15')]);return _0x56599f(_0x5b91b8[_0x50b5('0x12')]['message']);}else{logger[_0x50b5('0xe')](_0x50b5('0x14'),_0x5782e2,_0x50b5('0xf'));_0x56599f(_0x5b91b8['result'][_0x50b5('0x15')]);}})[_0x50b5('0x16')](function(_0x4acc15){logger[_0x50b5('0x12')](_0x50b5('0x14'),_0x5782e2,_0x4acc15);_0x6b1cef(_0x4acc15);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6032f3c..ae350f2 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x37cca8,_0x14827c){var _0x594b79=function(_0x113551){while(--_0x113551){_0x37cca8['push'](_0x37cca8['shift']());}};_0x594b79(++_0x14827c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 23a7c92..0847f71 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 _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 +var _0x682f=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x682f,0x1eb));var _0xf682=function(_0x5969b6,_0x2c983b){_0x5969b6=_0x5969b6-0x0;var _0x4155aa=_0x682f[_0x5969b6];return _0x4155aa;};'use strict';var Sequelize=require(_0xf682('0x0'));module[_0xf682('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf682('0x2')],'allowNull':![],'unique':_0xf682('0x3')},'main':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x4')},'filename':{'type':Sequelize[_0xf682('0x2')]},'path':{'type':Sequelize[_0xf682('0x2')]},'type':{'type':Sequelize[_0xf682('0x2')]},'size':{'type':Sequelize[_0xf682('0x5')]},'active':{'type':Sequelize[_0xf682('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xf682('0x2')]},'state':{'type':Sequelize[_0xf682('0x2')],'unique':_0xf682('0x7')},'description':{'type':Sequelize[_0xf682('0x2')]},'title':{'type':Sequelize[_0xf682('0x2')]},'remoteUri':{'type':Sequelize[_0xf682('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 986d00b..e074133 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 _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 +var _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1261,0x144));var _0x1126=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x1261[_0x817d9b];return _0x2752e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6787489..3f560fd 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 _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 +var _0x5669=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations','lodash','util'];(function(_0x542f45,_0x37468a){var _0x38c609=function(_0x44259b){while(--_0x44259b){_0x542f45['push'](_0x542f45['shift']());}};_0x38c609(++_0x37468a);}(_0x5669,0x194));var _0x9566=function(_0xa2ac9,_0xf07f28){_0xa2ac9=_0xa2ac9-0x0;var _0x690e9b=_0x5669[_0xa2ac9];return _0x690e9b;};'use strict';var _=require(_0x9566('0x0'));var util=require(_0x9566('0x1'));var logger=require(_0x9566('0x2'))(_0x9566('0x3'));var moment=require(_0x9566('0x4'));var BPromise=require(_0x9566('0x5'));var rp=require(_0x9566('0x6'));var fs=require('fs');var path=require(_0x9566('0x7'));var rimraf=require(_0x9566('0x8'));var config=require(_0x9566('0x9'));var attributes=require(_0x9566('0xa'));module[_0x9566('0xb')]=function(_0x2e34ba,_0x12b950){return _0x2e34ba[_0x9566('0xc')]('Integration',attributes,{'tableName':_0x9566('0xd'),'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 0a4b593..44384af 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 _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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5a9aa7,_0x55b38f){var _0x298adf=function(_0x2643d4){while(--_0x2643d4){_0x5a9aa7['push'](_0x5a9aa7['shift']());}};_0x298adf(++_0x55b38f);}(_0xadb5,0xad));var _0x5adb=function(_0x2a46fb,_0x52799d){_0x2a46fb=_0x2a46fb-0x0;var _0x424af6=_0xadb5[_0x2a46fb];return _0x424af6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 52b0b36..c46a110 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(_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 +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 33ae0bb..1fe3d45 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 _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 +var _0x57d6=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x57d6,0x167));var _0x657d=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0x57d6[_0x58b6a8];return _0xc566dc;};'use strict';var Sequelize=require(_0x657d('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x657d('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x657d('0x1')]},'integrationId':{'type':Sequelize[_0x657d('0x2')]},'contacts':{'type':Sequelize[_0x657d('0x1')]},'uniqueid':{'type':Sequelize[_0x657d('0x1')]},'calleridnum':{'type':Sequelize[_0x657d('0x1')]},'calleridname':{'type':Sequelize[_0x657d('0x1')]},'queue':{'type':Sequelize[_0x657d('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x657d('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x657d('0x2')]},'agentcomplete':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x657d('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x657d('0x2')]},'reason':{'type':Sequelize[_0x657d('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x657d('0x3')]},'agentdump':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x657d('0x3')]},'lastevent':{'type':Sequelize[_0x657d('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x657d('0x1')]},'connectedlinenum':{'type':Sequelize[_0x657d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x657d('0x1')]},'accountcode':{'type':Sequelize[_0x657d('0x1')]},'context':{'type':Sequelize[_0x657d('0x1')]},'exten':{'type':Sequelize[_0x657d('0x1')]},'priority':{'type':Sequelize[_0x657d('0x1')]},'destchannel':{'type':Sequelize[_0x657d('0x1')]},'destchannelstate':{'type':Sequelize[_0x657d('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x657d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x657d('0x1')]},'destcalleridname':{'type':Sequelize[_0x657d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x657d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x657d('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x657d('0x1')]},'destexten':{'type':Sequelize[_0x657d('0x1')]},'destpriority':{'type':Sequelize[_0x657d('0x1')]},'destuniqueid':{'type':Sequelize[_0x657d('0x1')]},'messageId':{'type':Sequelize[_0x657d('0x1')]},'inReplyTo':{'type':Sequelize[_0x657d('0x1')]},'subject':{'type':Sequelize[_0x657d('0x1')]},'from':{'type':Sequelize[_0x657d('0x1')]},'to':{'type':Sequelize[_0x657d('0x1')]},'cc':{'type':Sequelize[_0x657d('0x1')]},'attachment':{'type':Sequelize[_0x657d('0x5')]},'html':{'type':Sequelize[_0x657d('0x5')]},'text':{'type':Sequelize[_0x657d('0x5')]},'status':{'type':Sequelize[_0x657d('0x6')](_0x657d('0x7'),_0x657d('0x8'),_0x657d('0x9'),'FAILED')},'url':{'type':Sequelize[_0x657d('0x1')]},'app':{'type':Sequelize[_0x657d('0x1')]},'appdata':{'type':Sequelize[_0x657d('0x1')]},'projectId':{'type':Sequelize[_0x657d('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8257485..fb8e39e 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 _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 +var _0x30c0=['describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','error','stack','name','IntegrationReport','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','length','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update'];(function(_0x5c05ba,_0x2233ad){var _0x45b6de=function(_0x1cf854){while(--_0x1cf854){_0x5c05ba['push'](_0x5c05ba['shift']());}};_0x45b6de(++_0x2233ad);}(_0x30c0,0xca));var _0x030c=function(_0x1917c8,_0x12f95f){_0x1917c8=_0x1917c8-0x0;var _0x51948d=_0x30c0[_0x1917c8];return _0x51948d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x030c('0x0'));var zipdir=require(_0x030c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x030c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x030c('0x3'));var util=require(_0x030c('0x4'));var path=require(_0x030c('0x5'));var sox=require(_0x030c('0x6'));var csv=require('to-csv');var ejs=require(_0x030c('0x7'));var fs=require('fs');var fs_extra=require(_0x030c('0x8'));var _=require(_0x030c('0x9'));var squel=require('squel');var crypto=require(_0x030c('0xa'));var jsforce=require(_0x030c('0xb'));var deskjs=require(_0x030c('0xc'));var toCsv=require(_0x030c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x030c('0xe'));var authService=require(_0x030c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x030c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x030c('0x11'))('api');var utils=require(_0x030c('0x12'));var config=require(_0x030c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x030c('0x14'))['db'];function respondWithStatusCode(_0x4afdc9,_0x16e417){_0x16e417=_0x16e417||0xcc;return function(_0x3ceb7b){if(_0x3ceb7b){return _0x4afdc9[_0x030c('0x15')](_0x16e417);}return _0x4afdc9['status'](_0x16e417)[_0x030c('0x16')]();};}function respondWithResult(_0x36a359,_0x4f7ab0){_0x4f7ab0=_0x4f7ab0||0xc8;return function(_0x49c103){if(_0x49c103){return _0x36a359['status'](_0x4f7ab0)[_0x030c('0x17')](_0x49c103);}};}function respondWithFilteredResult(_0x3a374d,_0x558c70){return function(_0x3cbe4c){if(_0x3cbe4c){var _0x54e232=typeof _0x558c70[_0x030c('0x18')]===_0x030c('0x19')&&typeof _0x558c70[_0x030c('0x1a')]===_0x030c('0x19');var _0x2bfa02=_0x3cbe4c[_0x030c('0x1b')];var _0x2535b2=_0x54e232?0x0:_0x558c70[_0x030c('0x18')];var _0x204d72=_0x54e232?_0x3cbe4c[_0x030c('0x1b')]:_0x558c70[_0x030c('0x18')]+_0x558c70[_0x030c('0x1a')];var _0x5cc1a5;if(_0x204d72>=_0x2bfa02){_0x204d72=_0x2bfa02;_0x5cc1a5=0xc8;}else{_0x5cc1a5=0xce;}_0x3a374d[_0x030c('0x1c')](_0x5cc1a5);return _0x3a374d[_0x030c('0x1d')]('Content-Range',_0x2535b2+'-'+_0x204d72+'/'+_0x2bfa02)[_0x030c('0x17')](_0x3cbe4c);}return null;};}function patchUpdates(_0x18dbd0){return function(_0x395b51){try{jsonpatch['apply'](_0x395b51,_0x18dbd0,!![]);}catch(_0x131030){return BPromise[_0x030c('0x1e')](_0x131030);}return _0x395b51[_0x030c('0x1f')]();};}function saveUpdates(_0x19c683,_0x285eab){return function(_0x87956e){if(_0x87956e){return _0x87956e['update'](_0x19c683)[_0x030c('0x20')](function(_0x563067){return _0x563067;});}return null;};}function removeEntity(_0x58e96e,_0x6618d0){return function(_0x401631){if(_0x401631){return _0x401631['destroy']()[_0x030c('0x20')](function(){_0x58e96e[_0x030c('0x1c')](0xcc)[_0x030c('0x16')]();});}};}function handleEntityNotFound(_0x1a3126,_0xed6c1d){return function(_0x2686aa){if(!_0x2686aa){_0x1a3126[_0x030c('0x15')](0x194);}return _0x2686aa;};}function handleError(_0x14b2c2,_0x65b903){_0x65b903=_0x65b903||0x1f4;return function(_0x37eba4){logger[_0x030c('0x21')](_0x37eba4[_0x030c('0x22')]);if(_0x37eba4[_0x030c('0x23')]){delete _0x37eba4[_0x030c('0x23')];}_0x14b2c2[_0x030c('0x1c')](_0x65b903)['send'](_0x37eba4);};}exports['index']=function(_0x5e2a68,_0x4090aa){var _0x38ccb5={},_0x4d6017={},_0x2a3c0d={'count':0x0,'rows':[]};var _0x1dd768=_['map'](db[_0x030c('0x24')][_0x030c('0x25')],function(_0x2555bd){return{'name':_0x2555bd['fieldName'],'type':_0x2555bd['type'][_0x030c('0x26')]};});_0x4d6017[_0x030c('0x27')]=_[_0x030c('0x28')](_0x1dd768,'name');_0x4d6017[_0x030c('0x29')]=_[_0x030c('0x2a')](_0x5e2a68[_0x030c('0x29')]);_0x4d6017['filters']=_['intersection'](_0x4d6017['model'],_0x4d6017[_0x030c('0x29')]);_0x38ccb5[_0x030c('0x2b')]=_[_0x030c('0x2c')](_0x4d6017[_0x030c('0x27')],qs['fields'](_0x5e2a68[_0x030c('0x29')][_0x030c('0x2d')]));_0x38ccb5[_0x030c('0x2b')]=_0x38ccb5['attributes'][_0x030c('0x2e')]?_0x38ccb5[_0x030c('0x2b')]:_0x4d6017['model'];if(!_0x5e2a68[_0x030c('0x29')]['hasOwnProperty']('nolimit')){_0x38ccb5[_0x030c('0x1a')]=qs[_0x030c('0x1a')](_0x5e2a68[_0x030c('0x29')]['limit']);_0x38ccb5['offset']=qs[_0x030c('0x18')](_0x5e2a68[_0x030c('0x29')][_0x030c('0x18')]);}_0x38ccb5['order']=qs[_0x030c('0x2f')](_0x5e2a68[_0x030c('0x29')][_0x030c('0x2f')]);_0x38ccb5[_0x030c('0x30')]=qs[_0x030c('0x31')](_[_0x030c('0x32')](_0x5e2a68[_0x030c('0x29')],_0x4d6017['filters']),_0x1dd768);if(_0x5e2a68[_0x030c('0x29')][_0x030c('0x33')]){_0x38ccb5[_0x030c('0x30')]=_[_0x030c('0x34')](_0x38ccb5[_0x030c('0x30')],{'$or':_['map'](_0x1dd768,function(_0x26c6d3){if(_0x26c6d3[_0x030c('0x35')]!==_0x030c('0x36')){var _0x573487={};_0x573487[_0x26c6d3[_0x030c('0x23')]]={'$like':'%'+_0x5e2a68[_0x030c('0x29')][_0x030c('0x33')]+'%'};return _0x573487;}})});}_0x38ccb5=_[_0x030c('0x34')]({},_0x38ccb5,_0x5e2a68[_0x030c('0x37')]);var _0x21348c={'where':_0x38ccb5[_0x030c('0x30')]};return db[_0x030c('0x24')]['count'](_0x21348c)[_0x030c('0x20')](function(_0x309ba3){_0x2a3c0d[_0x030c('0x1b')]=_0x309ba3;if(_0x5e2a68['query'][_0x030c('0x38')]){_0x38ccb5[_0x030c('0x39')]=[{'all':!![]}];}return db[_0x030c('0x24')]['findAll'](_0x38ccb5);})[_0x030c('0x20')](function(_0x2ea7ee){_0x2a3c0d[_0x030c('0x3a')]=_0x2ea7ee;return _0x2a3c0d;})[_0x030c('0x20')](respondWithFilteredResult(_0x4090aa,_0x38ccb5))[_0x030c('0x3b')](handleError(_0x4090aa,null));};exports[_0x030c('0x3c')]=function(_0x59c01e,_0x47a904){var _0x7bd321={'raw':![],'where':{'id':_0x59c01e[_0x030c('0x3d')]['id']}},_0x43c2f7={};_0x43c2f7[_0x030c('0x27')]=_[_0x030c('0x2a')](db[_0x030c('0x24')][_0x030c('0x25')]);_0x43c2f7[_0x030c('0x29')]=_[_0x030c('0x2a')](_0x59c01e[_0x030c('0x29')]);_0x43c2f7[_0x030c('0x31')]=_[_0x030c('0x2c')](_0x43c2f7['model'],_0x43c2f7['query']);_0x7bd321['attributes']=_['intersection'](_0x43c2f7[_0x030c('0x27')],qs[_0x030c('0x2d')](_0x59c01e[_0x030c('0x29')][_0x030c('0x2d')]));_0x7bd321[_0x030c('0x2b')]=_0x7bd321['attributes'][_0x030c('0x2e')]?_0x7bd321[_0x030c('0x2b')]:_0x43c2f7['model'];if(_0x59c01e[_0x030c('0x29')][_0x030c('0x38')]){_0x7bd321[_0x030c('0x39')]=[{'all':!![]}];}_0x7bd321=_[_0x030c('0x34')]({},_0x7bd321,_0x59c01e[_0x030c('0x37')]);return db[_0x030c('0x24')][_0x030c('0x3e')](_0x7bd321)[_0x030c('0x20')](handleEntityNotFound(_0x47a904,null))[_0x030c('0x20')](respondWithResult(_0x47a904,null))[_0x030c('0x3b')](handleError(_0x47a904,null));};exports[_0x030c('0x3f')]=function(_0x59cc47,_0x5e7c8a){return db['IntegrationReport'][_0x030c('0x3f')](_0x59cc47[_0x030c('0x40')],{})[_0x030c('0x20')](respondWithResult(_0x5e7c8a,0xc9))[_0x030c('0x3b')](handleError(_0x5e7c8a,null));};exports[_0x030c('0x41')]=function(_0x2d26ab,_0x454725){if(_0x2d26ab[_0x030c('0x40')]['id']){delete _0x2d26ab['body']['id'];}return db[_0x030c('0x24')][_0x030c('0x3e')]({'where':{'id':_0x2d26ab['params']['id']}})['then'](handleEntityNotFound(_0x454725,null))[_0x030c('0x20')](saveUpdates(_0x2d26ab[_0x030c('0x40')],null))['then'](respondWithResult(_0x454725,null))[_0x030c('0x3b')](handleError(_0x454725,null));};exports['destroy']=function(_0x1edb39,_0x3b635f){return db[_0x030c('0x24')]['find']({'where':{'id':_0x1edb39[_0x030c('0x3d')]['id']}})[_0x030c('0x20')](handleEntityNotFound(_0x3b635f,null))[_0x030c('0x20')](removeEntity(_0x3b635f,null))['catch'](handleError(_0x3b635f,null));};exports['describe']=function(_0x41f348,_0x56f329){return db[_0x030c('0x24')][_0x030c('0x42')]()[_0x030c('0x20')](respondWithResult(_0x56f329,null))[_0x030c('0x3b')](handleError(_0x56f329,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index eb10f43..5da9e60 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 _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 +var _0xac0a=['moment','bluebird','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','lodash','util','../../config/logger','api'];(function(_0x1e1dd3,_0x15fdcd){var _0x2360f8=function(_0x49f176){while(--_0x49f176){_0x1e1dd3['push'](_0x1e1dd3['shift']());}};_0x2360f8(++_0x15fdcd);}(_0xac0a,0xe2));var _0xaac0=function(_0x2e29b4,_0x57262d){_0x2e29b4=_0x2e29b4-0x0;var _0x4ec6a6=_0xac0a[_0x2e29b4];return _0x4ec6a6;};'use strict';var _=require(_0xaac0('0x0'));var util=require(_0xaac0('0x1'));var logger=require(_0xaac0('0x2'))(_0xaac0('0x3'));var moment=require(_0xaac0('0x4'));var BPromise=require(_0xaac0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac0('0x6'));var config=require(_0xaac0('0x7'));var attributes=require(_0xaac0('0x8'));module['exports']=function(_0x578f5d,_0x2a8a88){return _0x578f5d['define'](_0xaac0('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 870bba7..fde4cc8 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 _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 +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3b7d72,_0x1e5c45){_0x3b7d72=_0x3b7d72-0x0;var _0x426cf1=_0xc2c7[_0x3b7d72];return _0x426cf1;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4f81f61..00c557f 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 _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 +var _0x05f1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','get','isAuthenticated','show','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','exports','multer','util','path'];(function(_0x291af9,_0x2c11bb){var _0x5a0883=function(_0x976959){while(--_0x976959){_0x291af9['push'](_0x291af9['shift']());}};_0x5a0883(++_0x2c11bb);}(_0x05f1,0xfa));var _0x105f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x05f1[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x105f('0x0'));var util=require(_0x105f('0x1'));var path=require(_0x105f('0x2'));var timeout=require(_0x105f('0x3'));var express=require(_0x105f('0x4'));var router=express[_0x105f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x105f('0x6'));var interaction=require(_0x105f('0x7'));var config=require(_0x105f('0x8'));var controller=require(_0x105f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x105f('0xa')]);router[_0x105f('0xb')]('/:id',auth[_0x105f('0xc')](),controller[_0x105f('0xd')]);router[_0x105f('0xb')]('/:id/sub_intervals',auth[_0x105f('0xc')](),controller['getIntervals']);router[_0x105f('0xe')]('/',auth[_0x105f('0xc')](),controller[_0x105f('0xf')]);router[_0x105f('0xe')](_0x105f('0x10'),auth[_0x105f('0xc')](),controller[_0x105f('0x11')]);router[_0x105f('0xe')](_0x105f('0x12'),auth[_0x105f('0xc')](),controller[_0x105f('0x13')]);router['put'](_0x105f('0x14'),auth[_0x105f('0xc')](),controller['update']);router[_0x105f('0x15')](_0x105f('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x105f('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f6b20ad..e83de7c 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 _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 +var _0xf7ca=['sequelize','STRING'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xf7ca,0x80));var _0xaf7c=function(_0x5b5846,_0x3939bb){_0x5b5846=_0x5b5846-0x0;var _0x2be879=_0xf7ca[_0x5b5846];return _0x2be879;};'use strict';var Sequelize=require(_0xaf7c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaf7c('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index a3feea9..1850521 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 _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 +var _0x052d=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','IntervalId','findOne','order','pick','getIntervals','addIntervals','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','Interval','include','findAll','catch','show','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x052d,0x68));var _0xd052=function(_0x5304a3,_0x22f556){_0x5304a3=_0x5304a3-0x0;var _0x1d591a=_0x052d[_0x5304a3];return _0x1d591a;};'use strict';var emlformat=require(_0xd052('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd052('0x1'));var jsonpatch=require(_0xd052('0x2'));var rp=require(_0xd052('0x3'));var moment=require(_0xd052('0x4'));var BPromise=require(_0xd052('0x5'));var Mustache=require(_0xd052('0x6'));var util=require('util');var path=require(_0xd052('0x7'));var sox=require(_0xd052('0x8'));var csv=require('to-csv');var ejs=require(_0xd052('0x9'));var fs=require('fs');var fs_extra=require(_0xd052('0xa'));var _=require(_0xd052('0xb'));var squel=require(_0xd052('0xc'));var crypto=require('crypto');var jsforce=require(_0xd052('0xd'));var deskjs=require(_0xd052('0xe'));var toCsv=require(_0xd052('0xf'));var querystring=require(_0xd052('0x10'));var Papa=require(_0xd052('0x11'));var Redis=require(_0xd052('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd052('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd052('0x14'));var logger=require(_0xd052('0x15'))(_0xd052('0x16'));var utils=require(_0xd052('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd052('0x18'));var db=require(_0xd052('0x19'))['db'];var extensions=require(_0xd052('0x1a'));function respondWithStatusCode(_0x51d3b0,_0x33977d){_0x33977d=_0x33977d||0xcc;return function(_0x4fed91){if(_0x4fed91){return _0x51d3b0[_0xd052('0x1b')](_0x33977d);}return _0x51d3b0[_0xd052('0x1c')](_0x33977d)[_0xd052('0x1d')]();};}function respondWithResult(_0x51d816,_0x4cc173){_0x4cc173=_0x4cc173||0xc8;return function(_0x44c0a3){if(_0x44c0a3){return _0x51d816[_0xd052('0x1c')](_0x4cc173)[_0xd052('0x1e')](_0x44c0a3);}};}function respondWithFilteredResult(_0x12b419,_0x4a7280){return function(_0x4dde2e){if(_0x4dde2e){var _0x3589b7=typeof _0x4a7280['offset']===_0xd052('0x1f')&&typeof _0x4a7280['limit']===_0xd052('0x1f');var _0x1c14dd=_0x4dde2e[_0xd052('0x20')];var _0x45e823=_0x3589b7?0x0:_0x4a7280[_0xd052('0x21')];var _0x1a9838=_0x3589b7?_0x4dde2e[_0xd052('0x20')]:_0x4a7280['offset']+_0x4a7280[_0xd052('0x22')];var _0x13a312;if(_0x1a9838>=_0x1c14dd){_0x1a9838=_0x1c14dd;_0x13a312=0xc8;}else{_0x13a312=0xce;}_0x12b419[_0xd052('0x1c')](_0x13a312);return _0x12b419['set'](_0xd052('0x23'),_0x45e823+'-'+_0x1a9838+'/'+_0x1c14dd)[_0xd052('0x1e')](_0x4dde2e);}return null;};}function patchUpdates(_0x2a04d6){return function(_0x592e49){try{jsonpatch[_0xd052('0x24')](_0x592e49,_0x2a04d6,!![]);}catch(_0xaf1ac5){return BPromise[_0xd052('0x25')](_0xaf1ac5);}return _0x592e49[_0xd052('0x26')]();};}function saveUpdates(_0x24cc8e,_0x1929c9){return function(_0x55a809){if(_0x55a809){return _0x55a809['update'](_0x24cc8e)[_0xd052('0x27')](function(_0x14a1d5){return _0x14a1d5;});}return null;};}function removeEntity(_0x150faa,_0x375211){return function(_0x5f47dd){if(_0x5f47dd){return _0x5f47dd[_0xd052('0x28')]()[_0xd052('0x27')](function(){var _0x3bc811=_0x5f47dd['get']({'plain':!![]});var _0x2b4d50='Intervals';return db[_0xd052('0x29')]['destroy']({'where':{'type':_0x2b4d50,'resourceId':_0x3bc811['id']}})['then'](function(){return _0x5f47dd;});})[_0xd052('0x27')](function(){_0x150faa[_0xd052('0x1c')](0xcc)[_0xd052('0x1d')]();});}};}function handleEntityNotFound(_0x32d8ad,_0x5f0ab8){return function(_0x5230bc){if(!_0x5230bc){_0x32d8ad[_0xd052('0x1b')](0x194);}return _0x5230bc;};}function handleError(_0x4cf0bd,_0x1efed3){_0x1efed3=_0x1efed3||0x1f4;return function(_0x36c650){logger[_0xd052('0x2a')](_0x36c650[_0xd052('0x2b')]);if(_0x36c650['name']){delete _0x36c650[_0xd052('0x2c')];}_0x4cf0bd[_0xd052('0x1c')](_0x1efed3)['send'](_0x36c650);};}exports[_0xd052('0x2d')]=function(_0x151c22,_0x4be405){var _0x1d95c7={},_0xd8224c={},_0x1dba09={'count':0x0,'rows':[]};var _0xf2f66e=_[_0xd052('0x2e')](db['Interval'][_0xd052('0x2f')],function(_0x3b4ee2){return{'name':_0x3b4ee2['fieldName'],'type':_0x3b4ee2[_0xd052('0x30')]['key']};});_0xd8224c[_0xd052('0x31')]=_['map'](_0xf2f66e,_0xd052('0x2c'));_0xd8224c['query']=_[_0xd052('0x32')](_0x151c22[_0xd052('0x33')]);_0xd8224c[_0xd052('0x34')]=_[_0xd052('0x35')](_0xd8224c[_0xd052('0x31')],_0xd8224c[_0xd052('0x33')]);_0x1d95c7[_0xd052('0x36')]=_[_0xd052('0x35')](_0xd8224c[_0xd052('0x31')],qs[_0xd052('0x37')](_0x151c22[_0xd052('0x33')][_0xd052('0x37')]));_0x1d95c7['attributes']=_0x1d95c7[_0xd052('0x36')][_0xd052('0x38')]?_0x1d95c7[_0xd052('0x36')]:_0xd8224c[_0xd052('0x31')];if(!_0x151c22[_0xd052('0x33')]['hasOwnProperty'](_0xd052('0x39'))){_0x1d95c7[_0xd052('0x22')]=qs[_0xd052('0x22')](_0x151c22[_0xd052('0x33')][_0xd052('0x22')]);_0x1d95c7['offset']=qs[_0xd052('0x21')](_0x151c22[_0xd052('0x33')][_0xd052('0x21')]);}_0x1d95c7['order']=qs[_0xd052('0x3a')](_0x151c22['query']['sort']);_0x1d95c7[_0xd052('0x3b')]=qs[_0xd052('0x34')](_['pick'](_0x151c22['query'],_0xd8224c[_0xd052('0x34')]),_0xf2f66e);if(_0x151c22[_0xd052('0x33')][_0xd052('0x3c')]){_0x1d95c7[_0xd052('0x3b')]=_[_0xd052('0x3d')](_0x1d95c7[_0xd052('0x3b')],{'$or':_['map'](_0xf2f66e,function(_0x5770ef){if(_0x5770ef['type']!=='VIRTUAL'){var _0xda7fc={};_0xda7fc[_0x5770ef[_0xd052('0x2c')]]={'$like':'%'+_0x151c22['query'][_0xd052('0x3c')]+'%'};return _0xda7fc;}})});}_0x1d95c7=_['merge']({},_0x1d95c7,_0x151c22[_0xd052('0x3e')]);var _0xfa831b={'where':_0x1d95c7[_0xd052('0x3b')]};return db[_0xd052('0x3f')][_0xd052('0x20')](_0xfa831b)[_0xd052('0x27')](function(_0x559fe1){_0x1dba09[_0xd052('0x20')]=_0x559fe1;if(_0x151c22['query']['includeAll']){_0x1d95c7[_0xd052('0x40')]=[{'all':!![]}];}return db[_0xd052('0x3f')][_0xd052('0x41')](_0x1d95c7);})['then'](function(_0x5e3105){_0x1dba09['rows']=_0x5e3105;return _0x1dba09;})[_0xd052('0x27')](respondWithFilteredResult(_0x4be405,_0x1d95c7))[_0xd052('0x42')](handleError(_0x4be405,null));};exports[_0xd052('0x43')]=function(_0x656bcf,_0x30086d){var _0x5211a4={'raw':!![],'where':{'id':_0x656bcf[_0xd052('0x44')]['id']}},_0x3576d8={};_0x3576d8[_0xd052('0x31')]=_['keys'](db[_0xd052('0x3f')][_0xd052('0x2f')]);_0x3576d8[_0xd052('0x33')]=_[_0xd052('0x32')](_0x656bcf['query']);_0x3576d8[_0xd052('0x34')]=_[_0xd052('0x35')](_0x3576d8[_0xd052('0x31')],_0x3576d8[_0xd052('0x33')]);_0x5211a4['attributes']=_[_0xd052('0x35')](_0x3576d8[_0xd052('0x31')],qs[_0xd052('0x37')](_0x656bcf[_0xd052('0x33')][_0xd052('0x37')]));_0x5211a4[_0xd052('0x36')]=_0x5211a4['attributes'][_0xd052('0x38')]?_0x5211a4[_0xd052('0x36')]:_0x3576d8[_0xd052('0x31')];if(_0x656bcf['query'][_0xd052('0x45')]){_0x5211a4[_0xd052('0x40')]=[{'all':!![]}];}_0x5211a4=_[_0xd052('0x3d')]({},_0x5211a4,_0x656bcf[_0xd052('0x3e')]);return db['Interval'][_0xd052('0x46')](_0x5211a4)[_0xd052('0x27')](handleEntityNotFound(_0x30086d,null))['then'](respondWithResult(_0x30086d,null))[_0xd052('0x42')](handleError(_0x30086d,null));};exports[_0xd052('0x47')]=function(_0x2bfc7b,_0x5a29da){return db['Interval'][_0xd052('0x47')](_0x2bfc7b['body'],{})[_0xd052('0x27')](function(_0x44f923){var _0x231174=_0x2bfc7b[_0xd052('0x48')][_0xd052('0x49')]({'plain':!![]});if(!_0x231174)throw new Error(_0xd052('0x4a'));if(_0x231174[_0xd052('0x4b')]===_0xd052('0x48')){var _0x250da8=_0x44f923[_0xd052('0x49')]({'plain':!![]});var _0x2ac695=_0xd052('0x4c');return db[_0xd052('0x4d')][_0xd052('0x46')]({'where':{'name':_0x2ac695,'userProfileId':_0x231174[_0xd052('0x4e')]},'raw':!![]})[_0xd052('0x27')](function(_0x389648){if(_0x389648&&_0x389648[_0xd052('0x4f')]===0x0){return db[_0xd052('0x29')][_0xd052('0x47')]({'name':_0x250da8[_0xd052('0x2c')],'resourceId':_0x250da8['id'],'type':_0x389648[_0xd052('0x2c')],'sectionId':_0x389648['id']},{})[_0xd052('0x27')](function(){return _0x44f923;});}else{return _0x44f923;}})[_0xd052('0x42')](function(_0x342454){logger['error'](_0xd052('0x50'),_0x342454);throw _0x342454;});}return _0x44f923;})[_0xd052('0x27')](respondWithResult(_0x5a29da,0xc9))[_0xd052('0x42')](handleError(_0x5a29da,null));};exports[_0xd052('0x51')]=function(_0x1dc331,_0x2930af){if(_0x1dc331[_0xd052('0x52')]['id']){delete _0x1dc331[_0xd052('0x52')]['id'];}return db[_0xd052('0x3f')][_0xd052('0x46')]({'where':{'id':_0x1dc331[_0xd052('0x44')]['id']}})['then'](handleEntityNotFound(_0x2930af,null))[_0xd052('0x27')](saveUpdates(_0x1dc331[_0xd052('0x52')],null))['then'](respondWithResult(_0x2930af,null))['catch'](handleError(_0x2930af,null));};exports[_0xd052('0x28')]=function(_0x174545,_0x3365d2){return db['Interval']['find']({'where':{'id':_0x174545[_0xd052('0x44')]['id']}})[_0xd052('0x27')](handleEntityNotFound(_0x3365d2,null))[_0xd052('0x27')](removeEntity(_0x3365d2,null))[_0xd052('0x42')](handleError(_0x3365d2,null));};exports['addInterval']=function(_0x4bea3a,_0x1d72d2,_0x4d5073){if(_0x4bea3a[_0xd052('0x52')]['id']){delete _0x4bea3a[_0xd052('0x52')]['id'];}return db[_0xd052('0x3f')][_0xd052('0x46')]({'where':{'id':_0x4bea3a[_0xd052('0x44')]['id']}})[_0xd052('0x27')](handleEntityNotFound(_0x1d72d2,null))[_0xd052('0x27')](function(_0x16b987){if(_0x16b987){_0x4bea3a[_0xd052('0x52')][_0xd052('0x53')]=_0x16b987['id'];return db[_0xd052('0x3f')][_0xd052('0x47')](_0x4bea3a[_0xd052('0x52')]);}})[_0xd052('0x27')](respondWithResult(_0x1d72d2,null))[_0xd052('0x42')](handleError(_0x1d72d2,null));};exports['getIntervals']=function(_0x2daa9f,_0x4181ce,_0x1d0f12){var _0x5b3ebe={};var _0x240b2a={};var _0x13d06e;var _0x3b2271;return db[_0xd052('0x3f')][_0xd052('0x54')]({'where':{'id':_0x2daa9f['params']['id']}})['then'](handleEntityNotFound(_0x4181ce,null))[_0xd052('0x27')](function(_0x592828){if(_0x592828){_0x13d06e=_0x592828;_0x240b2a[_0xd052('0x31')]=_[_0xd052('0x32')](db['Interval'][_0xd052('0x2f')]);_0x240b2a['query']=_['keys'](_0x2daa9f['query']);_0x240b2a[_0xd052('0x34')]=_[_0xd052('0x35')](_0x240b2a[_0xd052('0x31')],_0x240b2a['query']);_0x5b3ebe[_0xd052('0x36')]=_[_0xd052('0x35')](_0x240b2a['model'],qs[_0xd052('0x37')](_0x2daa9f[_0xd052('0x33')]['fields']));_0x5b3ebe[_0xd052('0x36')]=_0x5b3ebe['attributes'][_0xd052('0x38')]?_0x5b3ebe['attributes']:_0x240b2a['model'];_0x5b3ebe[_0xd052('0x55')]=qs[_0xd052('0x3a')](_0x2daa9f[_0xd052('0x33')][_0xd052('0x3a')]);_0x5b3ebe[_0xd052('0x3b')]=qs[_0xd052('0x34')](_[_0xd052('0x56')](_0x2daa9f[_0xd052('0x33')],_0x240b2a[_0xd052('0x34')]));if(_0x2daa9f[_0xd052('0x33')][_0xd052('0x3c')]){_0x5b3ebe[_0xd052('0x3b')]=_[_0xd052('0x3d')](_0x5b3ebe[_0xd052('0x3b')],{'$or':_['map'](_0x5b3ebe['attributes'],function(_0x18eb1b){var _0x144f95={};_0x144f95[_0x18eb1b]={'$like':'%'+_0x2daa9f[_0xd052('0x33')][_0xd052('0x3c')]+'%'};return _0x144f95;})});}_0x5b3ebe=_['merge']({},_0x5b3ebe,_0x2daa9f[_0xd052('0x3e')]);return _0x13d06e[_0xd052('0x57')](_0x5b3ebe);}})[_0xd052('0x27')](function(_0x3d1518){if(_0x3d1518){_0x3b2271=_0x3d1518['length'];if(!_0x2daa9f[_0xd052('0x33')]['hasOwnProperty'](_0xd052('0x39'))){_0x5b3ebe[_0xd052('0x22')]=qs['limit'](_0x2daa9f[_0xd052('0x33')]['limit']);_0x5b3ebe[_0xd052('0x21')]=qs[_0xd052('0x21')](_0x2daa9f['query'][_0xd052('0x21')]);}return _0x13d06e[_0xd052('0x57')](_0x5b3ebe);}})['then'](function(_0x34b1ef){if(_0x34b1ef){return _0x34b1ef?{'count':_0x3b2271,'rows':_0x34b1ef}:null;}})[_0xd052('0x27')](respondWithResult(_0x4181ce,null))['catch'](handleError(_0x4181ce,null));};exports[_0xd052('0x58')]=function(_0x3ec354,_0x3e0f88,_0x51e09a){return db[_0xd052('0x3f')][_0xd052('0x54')]({'where':{'id':_0x3ec354['params']['id']}})['then'](handleEntityNotFound(_0x3e0f88,null))[_0xd052('0x27')](function(_0x36d7a0){if(_0x36d7a0){return db['sequelize'][_0xd052('0x59')](function(_0x5a8884){return db[_0xd052('0x3f')][_0xd052('0x28')]({'where':{'IntervalId':_0x3ec354[_0xd052('0x44')]['id']},'transaction':_0x5a8884})[_0xd052('0x27')](function(_0xecfb5f){var _0x3b9a7f=_[_0xd052('0x2e')](_0x3ec354[_0xd052('0x52')],function(_0x5c374c){delete _0x5c374c['id'];_0x5c374c[_0xd052('0x53')]=_0x3ec354[_0xd052('0x44')]['id'];return _0x5c374c;});return db[_0xd052('0x3f')][_0xd052('0x5a')](_0x3b9a7f,{'transaction':_0x5a8884});});})[_0xd052('0x27')](function(){return db[_0xd052('0x3f')][_0xd052('0x41')]({'where':{'IntervalId':_0x3ec354[_0xd052('0x44')]['id']}});});}})[_0xd052('0x27')](respondWithResult(_0x3e0f88,null))['catch'](handleError(_0x3e0f88,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7e4ba9f..0d0f817 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 _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 +var _0xfa44=['define','Interval','tools_intervals','rewrite','interval','then','all','map','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports'];(function(_0x1da72c,_0x15d2e9){var _0x58d9e7=function(_0x1487e3){while(--_0x1487e3){_0x1da72c['push'](_0x1da72c['shift']());}};_0x58d9e7(++_0x15d2e9);}(_0xfa44,0x1a9));var _0x4fa4=function(_0x158a01,_0x50bcb8){_0x158a01=_0x158a01-0x0;var _0x94b215=_0xfa44[_0x158a01];return _0x94b215;};'use strict';var attributes=require(_0x4fa4('0x0'));var extensions=require(_0x4fa4('0x1'));var iftime=require(_0x4fa4('0x2'))['iftime'];module[_0x4fa4('0x3')]=function(_0x9a08b4){return _0x9a08b4[_0x4fa4('0x4')](_0x4fa4('0x5'),attributes,{'tableName':_0x4fa4('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31cc9e){extensions['rewrite'](_0x9a08b4,_0x31cc9e);},'afterBulkCreate':function(_0x44f771,_0x382a3e,_0x1792a6){_0x1792a6();extensions[_0x4fa4('0x7')](_0x9a08b4,_0x44f771[0x0]);},'afterUpdate':function(_0x2e6c4b){extensions[_0x4fa4('0x7')](_0x9a08b4,_0x2e6c4b);},'afterDestroy':function(_0x388841){extensions['rewrite'](_0x9a08b4,_0x388841);}},'instanceMethods':{'ifTime':function(_0x6ce8d9=undefined,_0x4f9dc4=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x4fa4('0x8')],_0x6ce8d9,_0x4f9dc4);}else{return this['getIntervals']()[_0x4fa4('0x9')](function(_0x5cf307){return Promise[_0x4fa4('0xa')](_0x5cf307[_0x4fa4('0xb')](function(_0x2718a2){return _0x2718a2['ifTime'](_0x6ce8d9,_0x4f9dc4);}));})[_0x4fa4('0x9')](function(_0x240737){return _0x240737[_0x4fa4('0xc')](function(_0x5213ac,_0x1222ce){return _0x5213ac||_0x1222ce;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 21447f3..675485e 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 _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 +var _0xd99a=['isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','reduce','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','GetInterval','stringify','catch','error','message','ShowInterval','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds'];(function(_0x294270,_0x55251e){var _0x9f8843=function(_0x324508){while(--_0x324508){_0x294270['push'](_0x294270['shift']());}};_0x9f8843(++_0x55251e);}(_0xd99a,0x64));var _0xad99=function(_0x4e6e0d,_0xa877e3){_0x4e6e0d=_0x4e6e0d-0x0;var _0x78a90=_0xd99a[_0x4e6e0d];return _0x78a90;};'use strict';var _=require('lodash');var util=require(_0xad99('0x0'));var db=require(_0xad99('0x1'))['db'];var iftime=require(_0xad99('0x2'))[_0xad99('0x3')];var logger=require(_0xad99('0x4'))(_0xad99('0x5'));exports['GetInterval']=function(_0x57a7ee){var _0x54b988=this;return new Promise(function(_0x17c701,_0x3bc9b0){return db[_0xad99('0x6')][_0xad99('0x7')]({'raw':_0x57a7ee[_0xad99('0x8')]?_0x57a7ee[_0xad99('0x8')][_0xad99('0x9')]===undefined?!![]:![]:!![],'where':_0x57a7ee[_0xad99('0x8')]?_0x57a7ee['options'][_0xad99('0xa')]||null:null,'attributes':_0x57a7ee['options']?_0x57a7ee[_0xad99('0x8')]['attributes']||null:null,'limit':_0x57a7ee['options']?_0x57a7ee[_0xad99('0x8')][_0xad99('0xb')]||null:null,'include':_0x57a7ee[_0xad99('0x8')]?_0x57a7ee[_0xad99('0x8')][_0xad99('0xc')]?_[_0xad99('0xd')](_0x57a7ee[_0xad99('0x8')]['include'],function(_0x39824a){return{'model':db[_0x39824a[_0xad99('0xe')]],'as':_0x39824a['as'],'attributes':_0x39824a[_0xad99('0xf')],'include':_0x39824a[_0xad99('0xc')]?_[_0xad99('0xd')](_0x39824a[_0xad99('0xc')],function(_0x1191a7){return{'model':db[_0x1191a7[_0xad99('0xe')]],'as':_0x1191a7['as'],'attributes':_0x1191a7[_0xad99('0xf')],'include':_0x1191a7[_0xad99('0xc')]?_[_0xad99('0xd')](_0x1191a7['include'],function(_0x3d9843){return{'model':db[_0x3d9843[_0xad99('0xe')]],'as':_0x3d9843['as'],'attributes':_0x3d9843[_0xad99('0xf')]};}):[]};}):[]};}):[]:[]})[_0xad99('0x10')](function(_0x9cccb8){logger[_0xad99('0x11')]('GetInterval',_0x57a7ee);logger[_0xad99('0x12')](_0xad99('0x13'),_0x57a7ee,JSON[_0xad99('0x14')](_0x9cccb8));_0x17c701(_0x9cccb8);})[_0xad99('0x15')](function(_0x2ad005){logger[_0xad99('0x16')](_0xad99('0x13'),_0x2ad005[_0xad99('0x17')],_0x57a7ee);_0x3bc9b0(_0x54b988['error'](0x1f4,_0x2ad005[_0xad99('0x17')]));});});};exports[_0xad99('0x18')]=function(_0x54139b){var _0x2189d5=this;return new Promise(function(_0x4cff3a,_0x504789){return db[_0xad99('0x6')]['find']({'raw':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')][_0xad99('0x9')]===undefined?!![]:![]:!![],'where':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')]['where']||null:null,'attributes':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')][_0xad99('0xf')]||null:null,'include':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')]['include']?_[_0xad99('0xd')](_0x54139b[_0xad99('0x8')][_0xad99('0xc')],function(_0x26c51c){return{'model':db[_0x26c51c[_0xad99('0xe')]],'as':_0x26c51c['as'],'attributes':_0x26c51c[_0xad99('0xf')],'include':_0x26c51c[_0xad99('0xc')]?_['map'](_0x26c51c[_0xad99('0xc')],function(_0x43d796){return{'model':db[_0x43d796[_0xad99('0xe')]],'as':_0x43d796['as'],'attributes':_0x43d796[_0xad99('0xf')],'include':_0x43d796['include']?_[_0xad99('0xd')](_0x43d796[_0xad99('0xc')],function(_0x57a8e2){return{'model':db[_0x57a8e2[_0xad99('0xe')]],'as':_0x57a8e2['as'],'attributes':_0x57a8e2['attributes']};}):[]};}):[]};}):[]:[]})[_0xad99('0x10')](function(_0x465370){logger[_0xad99('0x11')](_0xad99('0x18'),_0x54139b);logger[_0xad99('0x12')](_0xad99('0x18'),_0x54139b,JSON[_0xad99('0x14')](_0x465370));_0x4cff3a(_0x465370);})[_0xad99('0x15')](function(_0x42d389){logger['error'](_0xad99('0x18'),_0x42d389[_0xad99('0x17')],_0x54139b);_0x504789(_0x2189d5[_0xad99('0x16')](0x1f4,_0x42d389['message']));});});};function checkArrayOfIntervals(_0x193eca,_0x3ee0ad){var _0x41756a=[];return db[_0xad99('0x6')]['findAll']({'where':{'id':_0x193eca}})[_0xad99('0x10')](function(_0x50c129){_0x41756a=_0x50c129;return Promise[_0xad99('0x19')](_0x41756a[_0xad99('0xd')](function(_0x3c7906){return _0x3c7906[_0xad99('0x1a')](_0x3ee0ad);}));})['then'](function(_0x1b8939){var _0x5dc0c0=_0x1b8939['reduce'](function(_0x2af7ae,_0xd1546d){return _0x2af7ae||_0xd1546d;},![]);logger[_0xad99('0x11')](util[_0xad99('0x1b')](_0xad99('0x1c'),_0x41756a[_0xad99('0xd')](function(_0x10d2c8){return _0x10d2c8[_0xad99('0x1d')];})['join'](',\x20'),_0x41756a[_0xad99('0xd')](function(_0x3f532a){return _0x3f532a['id'];})[_0xad99('0x1e')](',\x20')));return _0x5dc0c0;});}function checkSingleInterval(_0xd53820,_0x44c105){return db[_0xad99('0x6')][_0xad99('0x1f')](_0xd53820)['then'](function(_0x329563){if(_0x329563){logger[_0xad99('0x11')](util[_0xad99('0x1b')](_0xad99('0x20'),_0x329563[_0xad99('0x1d')],_0x329563['id']));return _0x329563['ifTime'](_0x44c105);}});}exports[_0xad99('0x21')]=function(_0x51e223){var _0x19f57d=_0x51e223[_0xad99('0x22')];var _0x4c8954=Array[_0xad99('0x23')](_0x51e223[_0xad99('0x24')])?_0x51e223[_0xad99('0x24')]:typeof _0x51e223['intervals']===_0xad99('0x25')?[_0x51e223[_0xad99('0x24')]]:[];var _0x42426d=_0x51e223[_0xad99('0x26')]||undefined;var _0x23d7ea=![];if(_0x4c8954[_0xad99('0x27')]){logger['info'](util[_0xad99('0x1b')](_0xad99('0x28'),_0x4c8954[_0xad99('0x1e')](';\x20')));}if(_0x42426d){logger[_0xad99('0x11')](util[_0xad99('0x1b')](_0xad99('0x29'),_0x42426d));}logger[_0xad99('0x12')](_0xad99('0x2a'),_0x23d7ea);logger['silly'](_0xad99('0x21'),_0x51e223);return Promise[_0xad99('0x2b')]()['then'](function(){if(Array['isArray'](_0x19f57d)){return checkArrayOfIntervals(_0x19f57d,_0x42426d);}else if(_0x19f57d){return checkSingleInterval(_0x19f57d,_0x42426d);}})[_0xad99('0x10')](function(_0x4eff8c){var _0x253cc9=_0x4c8954[_0xad99('0x2c')](function(_0x42f493,_0x29f571){return _0x42f493||iftime(_0x29f571,_0x42426d);},![]);_0x23d7ea=_0x4eff8c||_0x253cc9;return _0x23d7ea;})[_0xad99('0x15')](function(_0x41d8ca){logger[_0xad99('0x16')](_0xad99('0x21'),_0x51e223,_0x41d8ca);throw this[_0xad99('0x16')](0x1f4,_0x41d8ca[_0xad99('0x17')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 56bc1bd..8e2f000 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_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 +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0xfaa3d1,_0x4f2889){var _0x556a2e=function(_0x24b29f){while(--_0x24b29f){_0xfaa3d1['push'](_0xfaa3d1['shift']());}};_0x556a2e(++_0x4f2889);}(_0x2032,0xd9));var _0x2203=function(_0xf5a5b7,_0x197446){_0xf5a5b7=_0xf5a5b7-0x0;var _0x44d6c2=_0x2032[_0xf5a5b7];return _0x44d6c2;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 24ff08d..ce97825 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 _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 +var _0x4f92=['key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','connection','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4f92,0x17a));var _0x24f9=function(_0x5edbc8,_0x3cba86){_0x5edbc8=_0x5edbc8-0x0;var _0x1381ac=_0x4f92[_0x5edbc8];return _0x1381ac;};'use strict';var BPromise=require(_0x24f9('0x0'));var https=require(_0x24f9('0x1'));var logger=require(_0x24f9('0x2'))(_0x24f9('0x3'));var USERNAME=_0x24f9('0x4');var PASSWORD=_0x24f9('0x5');function openIssue(_0x2c9058,_0x57f217){var _0x53f372={'fields':{'project':{'key':_0x2c9058[_0x24f9('0x6')]||_0x24f9('0x7')},'summary':(_0x2c9058[_0x24f9('0x8')]||'Report')+_0x24f9('0x9')+_0x2c9058['ip'],'description':_0x2c9058[_0x24f9('0xa')]||JSON[_0x24f9('0xb')](_0x2c9058),'issuetype':{'name':_0x2c9058[_0x24f9('0xc')]||'Bug'}}};_0x53f372[_0x24f9('0xd')][_0x24f9('0xe')]=_0x2c9058[_0x24f9('0xf')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x10')]=_0x2c9058[_0x24f9('0x11')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x12')]=_0x2c9058['newToken'];_0x53f372[_0x24f9('0xd')][_0x24f9('0x13')]=_0x2c9058[_0x24f9('0x14')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x15')]=_0x2c9058[_0x24f9('0x16')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x17')]=_0x2c9058['ip'];var _0x593594={'host':_0x24f9('0x18'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x24f9('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x24f9('0x1a'),'Authorization':_0x24f9('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x24f9('0x1c')]('base64')}};var _0x2202a7=JSON[_0x24f9('0xb')](_0x53f372);var _0x49bdb8=https[_0x24f9('0x1d')](_0x593594,function(_0x22880a){_0x22880a[_0x24f9('0x1e')](_0x24f9('0x1f'));var _0x28a622='';_0x22880a['on'](_0x24f9('0x20'),function(_0x1a9b34){_0x28a622+=_0x1a9b34;});_0x22880a['on'](_0x24f9('0x21'),function(){if(_0x57f217){return _0x57f217[_0x24f9('0x22')](_0x22880a[_0x24f9('0x23')])[_0x24f9('0x24')](JSON[_0x24f9('0x25')](_0x28a622));}});});_0x49bdb8['on'](_0x24f9('0x26'),function(_0x1cf5bb){if(_0x57f217){return _0x57f217[_0x24f9('0x22')](0x1f4)[_0x24f9('0x24')]({'errors':[{'message':_0x24f9('0x27'),'type':_0x24f9('0x28')}]});}});_0x49bdb8[_0x24f9('0x29')](_0x2202a7);_0x49bdb8[_0x24f9('0x21')]();}exports[_0x24f9('0x2a')]=openIssue;exports[_0x24f9('0x2b')]=function(_0x39fd31,_0x3142ca){_0x39fd31['body']['ip']=_0x39fd31[_0x24f9('0x2c')]['x-forwarded-for']||_0x39fd31[_0x24f9('0x2d')]['remoteAddress']||_0x39fd31['socket']['remoteAddress']||_0x39fd31['connection'][_0x24f9('0x2e')]['remoteAddress'];return openIssue(_0x39fd31[_0x24f9('0x2f')],_0x3142ca);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 71ce9a1..e6f4be8 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 _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 +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x398cc2,_0x1d1f2b){var _0x57bf1e=function(_0x2f75d4){while(--_0x2f75d4){_0x398cc2['push'](_0x398cc2['shift']());}};_0x57bf1e(++_0x1d1f2b);}(_0xedd9,0xfc));var _0x9edd=function(_0x526f38,_0x584c8f){_0x526f38=_0x526f38-0x0;var _0x42f8cf=_0xedd9[_0x526f38];return _0x42f8cf;};'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');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('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 06731fb..16993cc 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(_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 +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9eae,_0x577f87){_0x3f9eae=_0x3f9eae-0x0;var _0x1aeb0f=_0x7a54[_0x3f9eae];return _0x1aeb0f;};'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 87da364..3028c8f 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 _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 +var _0x044a=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','count','offset','set','apply','reject','update','then','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','create','body','params','destroy'];(function(_0x195f43,_0x2f27d8){var _0x402a67=function(_0x55c502){while(--_0x55c502){_0x195f43['push'](_0x195f43['shift']());}};_0x402a67(++_0x2f27d8);}(_0x044a,0x173));var _0xa044=function(_0x37e6f3,_0x4ee128){_0x37e6f3=_0x37e6f3-0x0;var _0x2f2b7b=_0x044a[_0x37e6f3];return _0x2f2b7b;};'use strict';var emlformat=require(_0xa044('0x0'));var rimraf=require(_0xa044('0x1'));var zipdir=require(_0xa044('0x2'));var jsonpatch=require(_0xa044('0x3'));var rp=require(_0xa044('0x4'));var moment=require(_0xa044('0x5'));var BPromise=require(_0xa044('0x6'));var Mustache=require(_0xa044('0x7'));var util=require(_0xa044('0x8'));var path=require(_0xa044('0x9'));var sox=require('sox');var csv=require(_0xa044('0xa'));var ejs=require(_0xa044('0xb'));var fs=require('fs');var fs_extra=require(_0xa044('0xc'));var _=require(_0xa044('0xd'));var squel=require('squel');var crypto=require(_0xa044('0xe'));var jsforce=require(_0xa044('0xf'));var deskjs=require(_0xa044('0x10'));var toCsv=require(_0xa044('0xa'));var querystring=require('querystring');var Papa=require(_0xa044('0x11'));var Redis=require(_0xa044('0x12'));var authService=require(_0xa044('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa044('0x14'));var hardwareService=require(_0xa044('0x15'));var logger=require(_0xa044('0x16'))(_0xa044('0x17'));var utils=require('../../config/utils');var config=require(_0xa044('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee43,_0x3e05cf){_0x3e05cf=_0x3e05cf||0xcc;return function(_0x2b73a1){if(_0x2b73a1){return _0x1ee43[_0xa044('0x19')](_0x3e05cf);}return _0x1ee43[_0xa044('0x1a')](_0x3e05cf)[_0xa044('0x1b')]();};}function respondWithResult(_0xe9a838,_0x4bec52){_0x4bec52=_0x4bec52||0xc8;return function(_0x31c5ae){if(_0x31c5ae){return _0xe9a838['status'](_0x4bec52)[_0xa044('0x1c')](_0x31c5ae);}};}function respondWithFilteredResult(_0x44c658,_0x141d1a){return function(_0x3bc2c9){if(_0x3bc2c9){var _0xeb7e4e=typeof _0x141d1a['offset']==='undefined'&&typeof _0x141d1a[_0xa044('0x1d')]==='undefined';var _0x3ca144=_0x3bc2c9[_0xa044('0x1e')];var _0x1b43c1=_0xeb7e4e?0x0:_0x141d1a[_0xa044('0x1f')];var _0x3ccbd3=_0xeb7e4e?_0x3bc2c9['count']:_0x141d1a['offset']+_0x141d1a['limit'];var _0x39422b;if(_0x3ccbd3>=_0x3ca144){_0x3ccbd3=_0x3ca144;_0x39422b=0xc8;}else{_0x39422b=0xce;}_0x44c658[_0xa044('0x1a')](_0x39422b);return _0x44c658[_0xa044('0x20')]('Content-Range',_0x1b43c1+'-'+_0x3ccbd3+'/'+_0x3ca144)[_0xa044('0x1c')](_0x3bc2c9);}return null;};}function patchUpdates(_0x19854d){return function(_0x4e0202){try{jsonpatch[_0xa044('0x21')](_0x4e0202,_0x19854d,!![]);}catch(_0x40999a){return BPromise[_0xa044('0x22')](_0x40999a);}return _0x4e0202['save']();};}function saveUpdates(_0x2e3468,_0x966548){return function(_0x26747b){if(_0x26747b){return _0x26747b[_0xa044('0x23')](_0x2e3468)[_0xa044('0x24')](function(_0x3f4d03){return _0x3f4d03;});}return null;};}function removeEntity(_0x18af4c,_0x46f14c){return function(_0x36c237){if(_0x36c237){return _0x36c237['destroy']()['then'](function(){_0x18af4c[_0xa044('0x1a')](0xcc)[_0xa044('0x1b')]();});}};}function handleEntityNotFound(_0x228d5e,_0x4c3d4b){return function(_0x418756){if(!_0x418756){_0x228d5e[_0xa044('0x19')](0x194);}return _0x418756;};}function handleError(_0x4e9357,_0x38bdd7){_0x38bdd7=_0x38bdd7||0x1f4;return function(_0x6746e8){logger['error'](_0x6746e8[_0xa044('0x25')]);if(_0x6746e8[_0xa044('0x26')]){delete _0x6746e8['name'];}_0x4e9357['status'](_0x38bdd7)['send'](_0x6746e8);};}exports[_0xa044('0x27')]=function(_0x159519,_0x1362ef){var _0x4c72f3={},_0x267512={},_0x300b6e={'count':0x0,'rows':[]};var _0x485212=_[_0xa044('0x28')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x1cb1be){return{'name':_0x1cb1be['fieldName'],'type':_0x1cb1be[_0xa044('0x29')][_0xa044('0x2a')]};});_0x267512[_0xa044('0x2b')]=_[_0xa044('0x28')](_0x485212,_0xa044('0x26'));_0x267512[_0xa044('0x2c')]=_['keys'](_0x159519[_0xa044('0x2c')]);_0x267512[_0xa044('0x2d')]=_[_0xa044('0x2e')](_0x267512[_0xa044('0x2b')],_0x267512['query']);_0x4c72f3[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x267512['model'],qs['fields'](_0x159519[_0xa044('0x2c')][_0xa044('0x30')]));_0x4c72f3['attributes']=_0x4c72f3[_0xa044('0x2f')][_0xa044('0x31')]?_0x4c72f3[_0xa044('0x2f')]:_0x267512['model'];if(!_0x159519[_0xa044('0x2c')][_0xa044('0x32')](_0xa044('0x33'))){_0x4c72f3[_0xa044('0x1d')]=qs[_0xa044('0x1d')](_0x159519['query'][_0xa044('0x1d')]);_0x4c72f3[_0xa044('0x1f')]=qs[_0xa044('0x1f')](_0x159519['query'][_0xa044('0x1f')]);}_0x4c72f3[_0xa044('0x34')]=qs['sort'](_0x159519[_0xa044('0x2c')][_0xa044('0x35')]);_0x4c72f3[_0xa044('0x36')]=qs[_0xa044('0x2d')](_[_0xa044('0x37')](_0x159519[_0xa044('0x2c')],_0x267512[_0xa044('0x2d')]),_0x485212);if(_0x159519[_0xa044('0x2c')]['filter']){_0x4c72f3[_0xa044('0x36')]=_[_0xa044('0x38')](_0x4c72f3[_0xa044('0x36')],{'$or':_[_0xa044('0x28')](_0x485212,function(_0x20509c){if(_0x20509c['type']!==_0xa044('0x39')){var _0x529be2={};_0x529be2[_0x20509c[_0xa044('0x26')]]={'$like':'%'+_0x159519[_0xa044('0x2c')]['filter']+'%'};return _0x529be2;}})});}_0x4c72f3=_['merge']({},_0x4c72f3,_0x159519['options']);var _0x22386d={'where':_0x4c72f3[_0xa044('0x36')]};return db[_0xa044('0x3a')][_0xa044('0x1e')](_0x22386d)[_0xa044('0x24')](function(_0x73aa8b){_0x300b6e[_0xa044('0x1e')]=_0x73aa8b;if(_0x159519[_0xa044('0x2c')][_0xa044('0x3b')]){_0x4c72f3[_0xa044('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa044('0x3d')](_0x4c72f3);})[_0xa044('0x24')](function(_0x1e84c1){_0x300b6e[_0xa044('0x3e')]=_0x1e84c1;return _0x300b6e;})[_0xa044('0x24')](respondWithFilteredResult(_0x1362ef,_0x4c72f3))[_0xa044('0x3f')](handleError(_0x1362ef,null));};exports[_0xa044('0x40')]=function(_0xc9246f,_0x2863a5){var _0x1f1c35={'raw':!![],'where':{'id':_0xc9246f['params']['id']}},_0x4b9cf6={};_0x4b9cf6[_0xa044('0x2b')]=_['keys'](db[_0xa044('0x3a')][_0xa044('0x41')]);_0x4b9cf6[_0xa044('0x2c')]=_[_0xa044('0x42')](_0xc9246f[_0xa044('0x2c')]);_0x4b9cf6[_0xa044('0x2d')]=_['intersection'](_0x4b9cf6[_0xa044('0x2b')],_0x4b9cf6['query']);_0x1f1c35[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x4b9cf6[_0xa044('0x2b')],qs['fields'](_0xc9246f['query'][_0xa044('0x30')]));_0x1f1c35[_0xa044('0x2f')]=_0x1f1c35[_0xa044('0x2f')][_0xa044('0x31')]?_0x1f1c35[_0xa044('0x2f')]:_0x4b9cf6[_0xa044('0x2b')];if(_0xc9246f['query'][_0xa044('0x3b')]){_0x1f1c35[_0xa044('0x3c')]=[{'all':!![]}];}_0x1f1c35=_[_0xa044('0x38')]({},_0x1f1c35,_0xc9246f[_0xa044('0x43')]);return db[_0xa044('0x3a')][_0xa044('0x44')](_0x1f1c35)[_0xa044('0x24')](handleEntityNotFound(_0x2863a5,null))[_0xa044('0x24')](respondWithResult(_0x2863a5,null))[_0xa044('0x3f')](handleError(_0x2863a5,null));};exports[_0xa044('0x45')]=function(_0x13e4e3,_0x3d303a){return db[_0xa044('0x3a')]['create'](_0x13e4e3[_0xa044('0x46')],{})[_0xa044('0x24')](respondWithResult(_0x3d303a,0xc9))[_0xa044('0x3f')](handleError(_0x3d303a,null));};exports[_0xa044('0x23')]=function(_0x6bf8a0,_0x230ecf){if(_0x6bf8a0[_0xa044('0x46')]['id']){delete _0x6bf8a0['body']['id'];}return db['JscriptyAnswerReport'][_0xa044('0x44')]({'where':{'id':_0x6bf8a0[_0xa044('0x47')]['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x230ecf,null))[_0xa044('0x24')](saveUpdates(_0x6bf8a0['body'],null))[_0xa044('0x24')](respondWithResult(_0x230ecf,null))[_0xa044('0x3f')](handleError(_0x230ecf,null));};exports[_0xa044('0x48')]=function(_0x390d24,_0x1b7877){return db[_0xa044('0x3a')]['find']({'where':{'id':_0x390d24[_0xa044('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b7877,null))['then'](removeEntity(_0x1b7877,null))[_0xa044('0x3f')](handleError(_0x1b7877,null));};exports[_0xa044('0x49')]=function(_0x3ea870,_0x187ebd){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x187ebd,null))[_0xa044('0x3f')](handleError(_0x187ebd,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 2dbb674..7656fa5 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 _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 +var _0x9456=['path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','lodash','../../config/logger','api','request-promise'];(function(_0x3a8740,_0x54a287){var _0xd16778=function(_0x13b331){while(--_0x13b331){_0x3a8740['push'](_0x3a8740['shift']());}};_0xd16778(++_0x54a287);}(_0x9456,0x71));var _0x6945=function(_0x134764,_0x1f51d4){_0x134764=_0x134764-0x0;var _0xc38e8=_0x9456[_0x134764];return _0xc38e8;};'use strict';var _=require(_0x6945('0x0'));var util=require('util');var logger=require(_0x6945('0x1'))(_0x6945('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6945('0x3'));var fs=require('fs');var path=require(_0x6945('0x4'));var rimraf=require('rimraf');var config=require(_0x6945('0x5'));var attributes=require(_0x6945('0x6'));module[_0x6945('0x7')]=function(_0x1b18b3,_0x51d2de){return _0x1b18b3[_0x6945('0x8')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','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 cbcc5a8..2a576db 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 _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 +var _0xae1c=['stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug'];(function(_0x2bd8f6,_0x362aa7){var _0x1a6654=function(_0x2af856){while(--_0x2af856){_0x2bd8f6['push'](_0x2bd8f6['shift']());}};_0x1a6654(++_0x362aa7);}(_0xae1c,0x15b));var _0xcae1=function(_0x232bd0,_0x459c63){_0x232bd0=_0x232bd0-0x0;var _0x160224=_0xae1c[_0x232bd0];return _0x160224;};'use strict';var _=require('lodash');var util=require(_0xcae1('0x0'));var moment=require(_0xcae1('0x1'));var BPromise=require('bluebird');var rs=require(_0xcae1('0x2'));var fs=require('fs');var Redis=require(_0xcae1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcae1('0x4'));var logger=require(_0xcae1('0x5'))(_0xcae1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcae1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c7c0,_0x376fa0,_0xe7df22){return new BPromise(function(_0x1dd857,_0x4008e9){return client[_0xcae1('0x8')](_0x6c7c0,_0xe7df22)[_0xcae1('0x9')](function(_0xa88241){logger[_0xcae1('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x376fa0,_0xcae1('0xb'));logger[_0xcae1('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x376fa0,_0xcae1('0xb'),JSON[_0xcae1('0xd')](_0xa88241));if(_0xa88241['error']){if(_0xa88241[_0xcae1('0xe')]['code']===0x1f4){logger[_0xcae1('0xe')](_0xcae1('0xf'),_0x376fa0,_0xa88241['error'][_0xcae1('0x10')]);return _0x4008e9(_0xa88241['error'][_0xcae1('0x10')]);}logger[_0xcae1('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x376fa0,_0xa88241[_0xcae1('0xe')][_0xcae1('0x10')]);return _0x1dd857(_0xa88241['error'][_0xcae1('0x10')]);}else{logger[_0xcae1('0xa')](_0xcae1('0xf'),_0x376fa0,_0xcae1('0xb'));_0x1dd857(_0xa88241[_0xcae1('0x11')][_0xcae1('0x10')]);}})['catch'](function(_0x5a49d5){logger[_0xcae1('0xe')](_0xcae1('0xf'),_0x376fa0,_0x5a49d5);_0x4008e9(_0x5a49d5);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e930fdf..c1d5d07 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 _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 +var _0x0ce1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x114281,_0x23c3f2){var _0x866964=function(_0x43c0f3){while(--_0x43c0f3){_0x114281['push'](_0x114281['shift']());}};_0x866964(++_0x23c3f2);}(_0x0ce1,0x1f3));var _0x10ce=function(_0x4ac5bd,_0x593752){_0x4ac5bd=_0x4ac5bd-0x0;var _0x4256ae=_0x0ce1[_0x4ac5bd];return _0x4256ae;};'use strict';var multer=require(_0x10ce('0x0'));var util=require(_0x10ce('0x1'));var path=require(_0x10ce('0x2'));var timeout=require(_0x10ce('0x3'));var express=require(_0x10ce('0x4'));var router=express[_0x10ce('0x5')]();var fs_extra=require(_0x10ce('0x6'));var auth=require(_0x10ce('0x7'));var interaction=require(_0x10ce('0x8'));var config=require(_0x10ce('0x9'));var controller=require(_0x10ce('0xa'));router[_0x10ce('0xb')]('/',auth['isAuthenticated'](),controller[_0x10ce('0xc')]);router['get'](_0x10ce('0xd'),auth[_0x10ce('0xe')](),controller['show']);router[_0x10ce('0xb')]('/:id/sessions',auth[_0x10ce('0xe')](),controller[_0x10ce('0xf')]);router[_0x10ce('0xb')](_0x10ce('0x10'),auth[_0x10ce('0xe')](),controller[_0x10ce('0x11')]);router[_0x10ce('0xb')]('/:id/summary',auth[_0x10ce('0xe')](),timeout(_0x10ce('0x12')),controller[_0x10ce('0x13')]);router[_0x10ce('0x14')]('/',auth[_0x10ce('0xe')](),controller[_0x10ce('0x15')]);router[_0x10ce('0x14')](_0x10ce('0x16'),auth[_0x10ce('0xe')](),controller[_0x10ce('0x17')]);router[_0x10ce('0x18')](_0x10ce('0xd'),auth[_0x10ce('0xe')](),controller[_0x10ce('0x19')]);router[_0x10ce('0x1a')](_0x10ce('0xd'),auth['isAuthenticated'](),controller[_0x10ce('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 729bae6..2b940c2 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 _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 +var _0x62e7=['exports','name','TEXT','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x3c2084,_0x4d5c7a){var _0x39798c=function(_0x281487){while(--_0x281487){_0x3c2084['push'](_0x3c2084['shift']());}};_0x39798c(++_0x4d5c7a);}(_0x62e7,0xb3));var _0x762e=function(_0x2b2ca2,_0x432095){_0x2b2ca2=_0x2b2ca2-0x0;var _0x1a3f1f=_0x62e7[_0x2b2ca2];return _0x1a3f1f;};'use strict';var Sequelize=require(_0x762e('0x0'));var _=require(_0x762e('0x1'));var util=require(_0x762e('0x2'));module[_0x762e('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x762e('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x762e('0x5')]('long'),'set':function(_0x12ede2){if(_[_0x762e('0x6')](_0x12ede2)){this[_0x762e('0x7')](_0x762e('0x8'),JSON['stringify'](_0x12ede2));}else if(_['isString'](_0x12ede2)){this['setDataValue'](_0x762e('0x8'),_0x12ede2);}else{this['setDataValue'](_0x762e('0x8'),util['format'](_0x762e('0x9'),this['getDataValue']('name')||'',this[_0x762e('0xa')](_0x762e('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x762e('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index b4d025b..a7ec816 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 _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 +var _0x6132=['isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Projects','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','JscriptyProject','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','updatedAt','createdAt','create','getSessions','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push'];(function(_0x275999,_0x142005){var _0x46eec0=function(_0x35b7f1){while(--_0x35b7f1){_0x275999['push'](_0x275999['shift']());}};_0x46eec0(++_0x142005);}(_0x6132,0xf3));var _0x2613=function(_0x349984,_0x5cb1fc){_0x349984=_0x349984-0x0;var _0x2a6bd5=_0x6132[_0x349984];return _0x2a6bd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2613('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2613('0x1'));var rp=require(_0x2613('0x2'));var moment=require(_0x2613('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2613('0x4'));var path=require('path');var sox=require(_0x2613('0x5'));var csv=require('to-csv');var ejs=require(_0x2613('0x6'));var fs=require('fs');var fs_extra=require(_0x2613('0x7'));var _=require(_0x2613('0x8'));var squel=require('squel');var crypto=require(_0x2613('0x9'));var jsforce=require(_0x2613('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2613('0xb'));var Papa=require('papaparse');var Redis=require(_0x2613('0xc'));var authService=require(_0x2613('0xd'));var qs=require(_0x2613('0xe'));var as=require(_0x2613('0xf'));var hardwareService=require(_0x2613('0x10'));var logger=require(_0x2613('0x11'))('api');var utils=require(_0x2613('0x12'));var config=require(_0x2613('0x13'));var licenseUtil=require(_0x2613('0x14'));var db=require(_0x2613('0x15'))['db'];function respondWithStatusCode(_0x5db104,_0x457b23){_0x457b23=_0x457b23||0xcc;return function(_0x1f46c7){if(_0x1f46c7){return _0x5db104[_0x2613('0x16')](_0x457b23);}return _0x5db104[_0x2613('0x17')](_0x457b23)[_0x2613('0x18')]();};}function respondWithResult(_0x18acee,_0x2d7b11){_0x2d7b11=_0x2d7b11||0xc8;return function(_0x2b3e5e){if(_0x2b3e5e){return _0x18acee[_0x2613('0x17')](_0x2d7b11)[_0x2613('0x19')](_0x2b3e5e);}};}function respondWithFilteredResult(_0x23a629,_0x34e96e){return function(_0x20d8a5){if(_0x20d8a5){var _0x441c1e=typeof _0x34e96e[_0x2613('0x1a')]===_0x2613('0x1b')&&typeof _0x34e96e[_0x2613('0x1c')]===_0x2613('0x1b');var _0x405ae3=_0x20d8a5[_0x2613('0x1d')];var _0x32e426=_0x441c1e?0x0:_0x34e96e[_0x2613('0x1a')];var _0x5072e5=_0x441c1e?_0x20d8a5[_0x2613('0x1d')]:_0x34e96e[_0x2613('0x1a')]+_0x34e96e[_0x2613('0x1c')];var _0x283a88;if(_0x5072e5>=_0x405ae3){_0x5072e5=_0x405ae3;_0x283a88=0xc8;}else{_0x283a88=0xce;}_0x23a629[_0x2613('0x17')](_0x283a88);return _0x23a629[_0x2613('0x1e')](_0x2613('0x1f'),_0x32e426+'-'+_0x5072e5+'/'+_0x405ae3)[_0x2613('0x19')](_0x20d8a5);}return null;};}function patchUpdates(_0x41f86d){return function(_0x335bf5){try{jsonpatch[_0x2613('0x20')](_0x335bf5,_0x41f86d,!![]);}catch(_0x48811a){return BPromise[_0x2613('0x21')](_0x48811a);}return _0x335bf5[_0x2613('0x22')]();};}function saveUpdates(_0x112732,_0x55d5c2){return function(_0x1f4368){if(_0x1f4368){return _0x1f4368['update'](_0x112732)[_0x2613('0x23')](function(_0x324697){return _0x324697;});}return null;};}function removeEntity(_0x4654cd,_0x1a84db){return function(_0x1e7e26){if(_0x1e7e26){return _0x1e7e26[_0x2613('0x24')]()[_0x2613('0x23')](function(){var _0x279fcc=_0x1e7e26[_0x2613('0x25')]({'plain':!![]});var _0x1c76dd=_0x2613('0x26');return db['UserProfileResource'][_0x2613('0x24')]({'where':{'type':_0x1c76dd,'resourceId':_0x279fcc['id']}})[_0x2613('0x23')](function(){return _0x1e7e26;});})['then'](function(){_0x4654cd[_0x2613('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x431e45,_0x1359a3){return function(_0x59c751){if(!_0x59c751){_0x431e45[_0x2613('0x16')](0x194);}return _0x59c751;};}function handleError(_0xf92eb9,_0x4da3f5){_0x4da3f5=_0x4da3f5||0x1f4;return function(_0x4dfef6){logger['error'](_0x4dfef6[_0x2613('0x27')]);if(_0x4dfef6['name']){delete _0x4dfef6[_0x2613('0x28')];}_0xf92eb9[_0x2613('0x17')](_0x4da3f5)[_0x2613('0x29')](_0x4dfef6);};}exports[_0x2613('0x2a')]=function(_0x4a6008,_0x124d27){var _0x38519={},_0x217269={},_0x4ea63f={'count':0x0,'rows':[]};var _0x1b9ddd=_[_0x2613('0x2b')](db['JscriptyProject'][_0x2613('0x2c')],function(_0x4c4ecf){return{'name':_0x4c4ecf[_0x2613('0x2d')],'type':_0x4c4ecf['type'][_0x2613('0x2e')]};});_0x217269[_0x2613('0x2f')]=_[_0x2613('0x2b')](_0x1b9ddd,_0x2613('0x28'));_0x217269[_0x2613('0x30')]=_[_0x2613('0x31')](_0x4a6008[_0x2613('0x30')]);_0x217269[_0x2613('0x32')]=_[_0x2613('0x33')](_0x217269[_0x2613('0x2f')],_0x217269[_0x2613('0x30')]);_0x38519['attributes']=_['intersection'](_0x217269[_0x2613('0x2f')],qs['fields'](_0x4a6008['query'][_0x2613('0x34')]));_0x38519[_0x2613('0x35')]=_0x38519[_0x2613('0x35')]['length']?_0x38519['attributes']:_0x217269['model'];if(!_0x4a6008[_0x2613('0x30')][_0x2613('0x36')](_0x2613('0x37'))){_0x38519[_0x2613('0x1c')]=qs[_0x2613('0x1c')](_0x4a6008[_0x2613('0x30')][_0x2613('0x1c')]);_0x38519[_0x2613('0x1a')]=qs[_0x2613('0x1a')](_0x4a6008[_0x2613('0x30')][_0x2613('0x1a')]);}_0x38519[_0x2613('0x38')]=qs[_0x2613('0x39')](_0x4a6008[_0x2613('0x30')][_0x2613('0x39')]);_0x38519[_0x2613('0x3a')]=qs[_0x2613('0x32')](_[_0x2613('0x3b')](_0x4a6008['query'],_0x217269['filters']),_0x1b9ddd);if(_0x4a6008['query']['filter']){_0x38519[_0x2613('0x3a')]=_[_0x2613('0x3c')](_0x38519['where'],{'$or':_['map'](_0x1b9ddd,function(_0x19af11){if(_0x19af11['type']!==_0x2613('0x3d')){var _0x43ff91={};_0x43ff91[_0x19af11[_0x2613('0x28')]]={'$like':'%'+_0x4a6008['query'][_0x2613('0x3e')]+'%'};return _0x43ff91;}})});}_0x38519=_[_0x2613('0x3c')]({},_0x38519,_0x4a6008[_0x2613('0x3f')]);var _0x1e8319={'where':_0x38519[_0x2613('0x3a')]};return db['JscriptyProject']['count'](_0x1e8319)[_0x2613('0x23')](function(_0x1999f1){_0x4ea63f['count']=_0x1999f1;if(_0x4a6008[_0x2613('0x30')][_0x2613('0x40')]){_0x38519[_0x2613('0x41')]=[{'all':!![]}];}return db['JscriptyProject'][_0x2613('0x42')](_0x38519);})[_0x2613('0x23')](function(_0x118dcd){_0x4ea63f[_0x2613('0x43')]=_0x118dcd;return _0x4ea63f;})['then'](respondWithFilteredResult(_0x124d27,_0x38519))['catch'](handleError(_0x124d27,null));};exports[_0x2613('0x44')]=function(_0x5aa59b,_0x444176){var _0x13ae88={'raw':![],'where':{'id':_0x5aa59b[_0x2613('0x45')]['id']}},_0x3f7758={};_0x3f7758[_0x2613('0x2f')]=_[_0x2613('0x31')](db['JscriptyProject'][_0x2613('0x2c')]);_0x3f7758[_0x2613('0x30')]=_['keys'](_0x5aa59b[_0x2613('0x30')]);_0x3f7758[_0x2613('0x32')]=_[_0x2613('0x33')](_0x3f7758[_0x2613('0x2f')],_0x3f7758['query']);_0x13ae88['attributes']=_[_0x2613('0x33')](_0x3f7758[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x5aa59b[_0x2613('0x30')]['fields']));_0x13ae88[_0x2613('0x35')]=_0x13ae88['attributes']['length']?_0x13ae88[_0x2613('0x35')]:_0x3f7758[_0x2613('0x2f')];if(_0x5aa59b[_0x2613('0x30')][_0x2613('0x40')]){_0x13ae88['include']=[{'all':!![]}];}_0x13ae88=_[_0x2613('0x3c')]({},_0x13ae88,_0x5aa59b[_0x2613('0x3f')]);return db[_0x2613('0x46')][_0x2613('0x47')](_0x13ae88)['then'](handleEntityNotFound(_0x444176,null))[_0x2613('0x23')](respondWithResult(_0x444176,null))[_0x2613('0x48')](handleError(_0x444176,null));};exports['create']=function(_0x2a01de,_0x16f6d0){return db[_0x2613('0x46')]['create'](_0x2a01de[_0x2613('0x49')],{})['then'](function(_0xbbec13){var _0x3bb99f=_0x2a01de[_0x2613('0x4a')][_0x2613('0x25')]({'plain':!![]});if(!_0x3bb99f)throw new Error(_0x2613('0x4b'));if(_0x3bb99f[_0x2613('0x4c')]==='user'){var _0x359672=_0xbbec13[_0x2613('0x25')]({'plain':!![]});var _0x13d023=_0x2613('0x26');return db[_0x2613('0x4d')]['find']({'where':{'name':_0x13d023,'userProfileId':_0x3bb99f[_0x2613('0x4e')]},'raw':!![]})[_0x2613('0x23')](function(_0x31e3dd){if(_0x31e3dd&&_0x31e3dd[_0x2613('0x4f')]===0x0){return db[_0x2613('0x50')]['create']({'name':_0x359672[_0x2613('0x28')],'resourceId':_0x359672['id'],'type':_0x31e3dd[_0x2613('0x28')],'sectionId':_0x31e3dd['id']},{})[_0x2613('0x23')](function(){return _0xbbec13;});}else{return _0xbbec13;}})[_0x2613('0x48')](function(_0x3a78fe){logger['error'](_0x2613('0x51'),_0x3a78fe);throw _0x3a78fe;});}return _0xbbec13;})[_0x2613('0x23')](respondWithResult(_0x16f6d0,0xc9))['catch'](handleError(_0x16f6d0,null));};exports[_0x2613('0x52')]=function(_0x1cc06e,_0x50560f){var _0x194907={'where':{'id':_0x1cc06e[_0x2613('0x45')]['id']}},_0x32a661={};_0x32a661['model']=_[_0x2613('0x31')](db[_0x2613('0x46')][_0x2613('0x2c')]);_0x194907[_0x2613('0x35')]=_[_0x2613('0x33')](_0x32a661[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x1cc06e[_0x2613('0x30')][_0x2613('0x34')]));_0x194907['attributes']=_0x194907['attributes'][_0x2613('0x53')]?_0x194907[_0x2613('0x35')]:_0x32a661[_0x2613('0x2f')];if(_0x1cc06e['query'][_0x2613('0x40')]){_0x194907[_0x2613('0x41')]=[{'all':!![]}];}_0x194907=_['merge']({},_0x194907,_0x1cc06e[_0x2613('0x3f')]);return db[_0x2613('0x46')][_0x2613('0x47')](_0x194907)[_0x2613('0x23')](handleEntityNotFound(_0x50560f,null))[_0x2613('0x23')](function(_0x30b6bb){if(_0x30b6bb){var _0x2bc548=_0x30b6bb['get']({'plain':!![]});_0x2bc548=qs[_0x2613('0x54')](_0x2bc548,['id','createdAt',_0x2613('0x55')]);_0x1cc06e['body']=_[_0x2613('0x54')](_0x1cc06e['body'],['id',_0x2613('0x56'),_0x2613('0x55')]);return db[_0x2613('0x46')][_0x2613('0x57')](_[_0x2613('0x3c')](_0x2bc548,_0x1cc06e['body']),{'include':_0x1cc06e[_0x2613('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x2613('0x23')](function(_0xb700af){var _0x1e3248=_0x1cc06e['user'][_0x2613('0x25')]({'plain':!![]});if(!_0x1e3248)throw new Error(_0x2613('0x4b'));if(_0x1e3248[_0x2613('0x4c')]===_0x2613('0x4a')){var _0x312c16=_0xb700af[_0x2613('0x25')]({'plain':!![]});var _0x538024='Projects';return db['UserProfileSection'][_0x2613('0x47')]({'where':{'name':_0x538024,'userProfileId':_0x1e3248['userProfileId']},'raw':!![]})['then'](function(_0x3ab911){if(_0x3ab911&&_0x3ab911[_0x2613('0x4f')]===0x0){return db[_0x2613('0x50')][_0x2613('0x57')]({'name':_0x312c16[_0x2613('0x28')],'resourceId':_0x312c16['id'],'type':_0x3ab911[_0x2613('0x28')],'sectionId':_0x3ab911['id']},{})['then'](function(){return _0xb700af;});}else{return _0xb700af;}})['catch'](function(_0x2df5cc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2df5cc);throw _0x2df5cc;});}return _0xb700af;});}})[_0x2613('0x23')](respondWithResult(_0x50560f,0xc9))[_0x2613('0x48')](handleError(_0x50560f,null));};exports['update']=function(_0x2f1f8a,_0x1090eb){if(_0x2f1f8a[_0x2613('0x49')]['id']){delete _0x2f1f8a[_0x2613('0x49')]['id'];}return db[_0x2613('0x46')][_0x2613('0x47')]({'where':{'id':_0x2f1f8a[_0x2613('0x45')]['id']}})['then'](handleEntityNotFound(_0x1090eb,null))[_0x2613('0x23')](saveUpdates(_0x2f1f8a[_0x2613('0x49')],null))['then'](respondWithResult(_0x1090eb,null))[_0x2613('0x48')](handleError(_0x1090eb,null));};exports[_0x2613('0x24')]=function(_0x9affdb,_0x142578){return db[_0x2613('0x46')]['find']({'where':{'id':_0x9affdb[_0x2613('0x45')]['id']}})[_0x2613('0x23')](handleEntityNotFound(_0x142578,null))[_0x2613('0x23')](removeEntity(_0x142578,null))[_0x2613('0x48')](handleError(_0x142578,null));};exports[_0x2613('0x58')]=function(_0x5467bd,_0x5c1e9d,_0x83b8fb){var _0x156edb={'raw':!![],'where':{}};var _0xe99b44={};var _0x1b5f8f={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5467bd['params']['id']}})[_0x2613('0x23')](handleEntityNotFound(_0x5c1e9d,null))['then'](function(_0x2dcc84){if(_0x2dcc84){_0xe99b44[_0x2613('0x2f')]=_[_0x2613('0x31')](db['JscriptySessionReport']['rawAttributes']);_0xe99b44[_0x2613('0x30')]=_[_0x2613('0x31')](_0x5467bd['query']);_0xe99b44[_0x2613('0x32')]=_[_0x2613('0x33')](_0xe99b44[_0x2613('0x2f')],_0xe99b44[_0x2613('0x30')]);_0x156edb[_0x2613('0x35')]=_[_0x2613('0x33')](_0xe99b44[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x5467bd['query'][_0x2613('0x34')]));_0x156edb[_0x2613('0x35')]=_0x156edb[_0x2613('0x35')][_0x2613('0x53')]?_0x156edb[_0x2613('0x35')]:_0xe99b44[_0x2613('0x2f')];if(!_0x5467bd[_0x2613('0x30')][_0x2613('0x36')](_0x2613('0x37'))){_0x156edb[_0x2613('0x1c')]=qs[_0x2613('0x1c')](_0x5467bd['query'][_0x2613('0x1c')]);_0x156edb[_0x2613('0x1a')]=qs['offset'](_0x5467bd[_0x2613('0x30')][_0x2613('0x1a')]);}_0x156edb['order']=qs['sort'](_0x5467bd[_0x2613('0x30')][_0x2613('0x39')]);_0x156edb[_0x2613('0x3a')]=qs[_0x2613('0x32')](_['pick'](_0x5467bd[_0x2613('0x30')],_0xe99b44[_0x2613('0x32')]));_0x156edb[_0x2613('0x3a')][_0x2613('0x59')]=_0x2dcc84['id'];if(_0x5467bd[_0x2613('0x30')][_0x2613('0x3e')]){_0x156edb[_0x2613('0x3a')]=_['merge'](_0x156edb[_0x2613('0x3a')],{'$or':_[_0x2613('0x2b')](_0x156edb['attributes'],function(_0x3c9930){var _0xb4981d={};_0xb4981d[_0x3c9930]={'$like':'%'+_0x5467bd[_0x2613('0x30')][_0x2613('0x3e')]+'%'};return _0xb4981d;})});}_0x156edb=_[_0x2613('0x3c')]({},_0x156edb,_0x5467bd[_0x2613('0x3f')]);return db[_0x2613('0x5a')][_0x2613('0x1d')]({'where':_0x156edb['where']})[_0x2613('0x23')](function(_0x12af1c){_0x1b5f8f[_0x2613('0x1d')]=_0x12af1c;if(_0x5467bd[_0x2613('0x30')][_0x2613('0x40')]){_0x156edb['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2613('0x42')](_0x156edb);})[_0x2613('0x23')](function(_0x3e8023){_0x1b5f8f[_0x2613('0x43')]=_0x3e8023;return _0x1b5f8f;});}})[_0x2613('0x23')](respondWithFilteredResult(_0x5c1e9d,_0x156edb))[_0x2613('0x48')](handleError(_0x5c1e9d,null));};exports[_0x2613('0x5b')]=function(_0x57512d,_0x3e79fb,_0x1a5445){var _0x5db85a={'raw':!![],'where':{}};var _0x2b2899={};var _0x4212c5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2613('0x5c')]({'where':{'id':_0x57512d['params']['id']}})['then'](handleEntityNotFound(_0x3e79fb,null))[_0x2613('0x23')](function(_0x1ccd90){if(_0x1ccd90){_0x2b2899['model']=_['keys'](db['JscriptyAnswerReport'][_0x2613('0x2c')]);_0x2b2899[_0x2613('0x30')]=_[_0x2613('0x31')](_0x57512d[_0x2613('0x30')]);_0x2b2899[_0x2613('0x32')]=_[_0x2613('0x33')](_0x2b2899['model'],_0x2b2899['query']);_0x5db85a['attributes']=_[_0x2613('0x33')](_0x2b2899[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x57512d[_0x2613('0x30')][_0x2613('0x34')]));_0x5db85a[_0x2613('0x35')]=_0x5db85a[_0x2613('0x35')]['length']?_0x5db85a[_0x2613('0x35')]:_0x2b2899[_0x2613('0x2f')];if(!_0x57512d[_0x2613('0x30')][_0x2613('0x36')](_0x2613('0x37'))){_0x5db85a[_0x2613('0x1c')]=qs[_0x2613('0x1c')](_0x57512d[_0x2613('0x30')][_0x2613('0x1c')]);_0x5db85a[_0x2613('0x1a')]=qs[_0x2613('0x1a')](_0x57512d[_0x2613('0x30')]['offset']);}_0x5db85a['order']=qs[_0x2613('0x39')](_0x57512d[_0x2613('0x30')][_0x2613('0x39')]);_0x5db85a['where']=qs[_0x2613('0x32')](_[_0x2613('0x3b')](_0x57512d[_0x2613('0x30')],_0x2b2899[_0x2613('0x32')]));_0x5db85a[_0x2613('0x3a')][_0x2613('0x59')]=_0x1ccd90['id'];if(_0x57512d[_0x2613('0x30')][_0x2613('0x3e')]){_0x5db85a[_0x2613('0x3a')]=_[_0x2613('0x3c')](_0x5db85a['where'],{'$or':_[_0x2613('0x2b')](_0x5db85a[_0x2613('0x35')],function(_0x2f2ace){var _0x3e2c30={};_0x3e2c30[_0x2f2ace]={'$like':'%'+_0x57512d[_0x2613('0x30')][_0x2613('0x3e')]+'%'};return _0x3e2c30;})});}_0x5db85a=_[_0x2613('0x3c')]({},_0x5db85a,_0x57512d[_0x2613('0x3f')]);return db[_0x2613('0x5d')][_0x2613('0x1d')]({'where':_0x5db85a[_0x2613('0x3a')]})['then'](function(_0x5b22ea){_0x4212c5['count']=_0x5b22ea;if(_0x57512d[_0x2613('0x30')][_0x2613('0x40')]){_0x5db85a[_0x2613('0x41')]=[{'all':!![]}];}return db[_0x2613('0x5d')][_0x2613('0x42')](_0x5db85a);})[_0x2613('0x23')](function(_0x529461){_0x4212c5[_0x2613('0x43')]=_0x529461;return _0x4212c5;});}})['then'](respondWithFilteredResult(_0x3e79fb,_0x5db85a))[_0x2613('0x48')](handleError(_0x3e79fb,null));};function char(_0x3b86da){return'number'===typeof _0x3b86da?String[_0x2613('0x5e')][_0x2613('0x20')](null,arguments):_0x3b86da;}function needsEncapsulation(_0x12f120){return!!_0x12f120&&(_0x12f120[_0x2613('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x12f120[_0x2613('0x5f')]()[_0x2613('0x60')](char(0xa))>=0x0||_0x12f120['toString']()[_0x2613('0x60')](char(0x2c))>=0x0||_0x12f120[_0x2613('0x5f')]()[_0x2613('0x60')](char(0x22))>=0x0);}function encapsulate(_0x1b4e81){var _0x2cdb36=char(0x22),_0x1e9bf1='\x5c'+char(0x22),_0x46dffe=_0x1b4e81[_0x2613('0x5f')]()[_0x2613('0x61')](new RegExp(_0x2cdb36,'g'),_0x1e9bf1);return _0x2cdb36+_0x46dffe+_0x2cdb36;}exports[_0x2613('0x62')]=function(_0xe07026,_0x5411b3,_0x2b2774){var _0x1fdfed,_0x54bab2;var _0x33f5aa={'where':{'ProjectId':_0xe07026['params']['id']}};if(_0xe07026[_0x2613('0x30')][_0x2613('0x63')]){_0x33f5aa['where'][_0x2613('0x64')]=JSON[_0x2613('0x65')](_0xe07026[_0x2613('0x30')][_0x2613('0x63')]);}return db[_0x2613('0x5a')][_0x2613('0x42')](_0x33f5aa)['then'](handleEntityNotFound(_0x5411b3,null))[_0x2613('0x23')](function(_0x2ebf94){if(_0x2ebf94){_0x1fdfed=_0x2ebf94;return db[_0x2613('0x66')][_0x2613('0x42')]({'where':{'SessionId':{'$in':_['map'](_0x1fdfed,'id')},'ProjectId':_0xe07026['params']['id']},'order':'-createdAt'});}})[_0x2613('0x23')](handleEntityNotFound(_0x5411b3,null))[_0x2613('0x23')](function(_0x2c0ebf){if(_0x2c0ebf){_0x54bab2=_0x2c0ebf;var _0xba19c={};for(var _0xb8cbc3=0x0,_0xe5e633=_0x54bab2['length'];_0xb8cbc3<_0xe5e633;_0xb8cbc3++){if(!_0xba19c[_0x2613('0x36')](_0x54bab2[_0xb8cbc3][_0x2613('0x67')])){_0xba19c[_0x54bab2[_0xb8cbc3][_0x2613('0x67')]]=needsEncapsulation(_0x54bab2[_0xb8cbc3]['question'])?encapsulate(_0x54bab2[_0xb8cbc3][_0x2613('0x68')]):_0x54bab2[_0xb8cbc3][_0x2613('0x68')];}}var _0xf046ad=[],_0x550134={};for(var _0x459a62=0x0,_0x35a439=_0x1fdfed[_0x2613('0x53')];_0x459a62<_0x35a439;_0x459a62++){_0x550134={'ProjectId':_0xe07026[_0x2613('0x45')]['id'],'SessionId':_0x1fdfed[_0x459a62]['id'],'StartTime':moment(_0x1fdfed[_0x459a62][_0x2613('0x64')])[_0x2613('0x69')](_0x2613('0x6a'))};for(var _0x5f5163=0x0,_0x557bba=_0x54bab2[_0x2613('0x53')];_0x5f5163<_0x557bba;_0x5f5163++){if(_0x54bab2[_0x5f5163]['SessionId']==_0x1fdfed[_0x459a62]['id']&&_0xba19c[_0x2613('0x36')](_0x54bab2[_0x5f5163]['questionId'])){_0x550134[_0xba19c[_0x54bab2[_0x5f5163][_0x2613('0x67')]]]=_0x54bab2[_0x5f5163]['answer'];}}for(var _0x12336c in _0xba19c){if(!_0x550134[_0x2613('0x36')](_0xba19c[_0x12336c])){_0x550134[_0xba19c[_0x12336c]]=null;}}_0xf046ad[_0x2613('0x6b')](_0x550134);}return _0xf046ad;}})['then'](function(_0x84fda0){if(!_[_0x2613('0x6c')](_0x84fda0)){var _0x1c3f7c=toCsv(_0x84fda0);var _0x20c9d6=Date['now']();fs['writeFileSync'](util[_0x2613('0x69')](_0x2613('0x6d'),_0xe07026[_0x2613('0x45')]['id'],_0x20c9d6),_0x1c3f7c);_0x5411b3[_0x2613('0x6e')](_0x2613('0x6f'),_0x2613('0x70')+util[_0x2613('0x69')](_0x2613('0x71'),_0xe07026[_0x2613('0x45')]['id'],_0x20c9d6));_0x5411b3['setHeader'](_0x2613('0x72'),_0x2613('0x73'));return _0x5411b3[_0x2613('0x74')](util[_0x2613('0x69')](_0x2613('0x6d'),_0xe07026[_0x2613('0x45')]['id'],_0x20c9d6));}else{return _0x5411b3[_0x2613('0x16')](0xcc);}})[_0x2613('0x48')](handleError(_0x5411b3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 60e8dd1..2f94252 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 _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 +var _0xb3ea=['../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x3cfa3c,_0xd29827){var _0x49ee56=function(_0x5850b9){while(--_0x5850b9){_0x3cfa3c['push'](_0x3cfa3c['shift']());}};_0x49ee56(++_0xd29827);}(_0xb3ea,0x10d));var _0xab3e=function(_0x29a345,_0x5bac6d){_0x29a345=_0x29a345-0x0;var _0x38e8be=_0xb3ea[_0x29a345];return _0x38e8be;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var logger=require(_0xab3e('0x2'))('api');var moment=require(_0xab3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xab3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var attributes=require(_0xab3e('0x7'));module[_0xab3e('0x8')]=function(_0x135941,_0x570744){return _0x135941[_0xab3e('0x9')]('JscriptyProject',attributes,{'tableName':_0xab3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index ba089c0..eebf0cd 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 _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 +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x15ce4c,_0x5c4106){var _0xab2819=function(_0x405ff6){while(--_0x405ff6){_0x15ce4c['push'](_0x15ce4c['shift']());}};_0xab2819(++_0x5c4106);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e948807..f419d16 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 _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 +var _0x3949=['get','isAuthenticated','index','describe','/:id','show','create','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3949,0x77));var _0x9394=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0x3949[_0x2fa457];return _0x4f250a;};'use strict';var multer=require(_0x9394('0x0'));var util=require(_0x9394('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9394('0x2'));var router=express[_0x9394('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9394('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9394('0x5'));var controller=require(_0x9394('0x6'));router[_0x9394('0x7')]('/',auth[_0x9394('0x8')](),controller[_0x9394('0x9')]);router[_0x9394('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9394('0xa')]);router[_0x9394('0x7')](_0x9394('0xb'),auth[_0x9394('0x8')](),controller[_0x9394('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9394('0xd')]);router[_0x9394('0xe')](_0x9394('0xb'),auth[_0x9394('0x8')](),controller['update']);router[_0x9394('0xf')](_0x9394('0xb'),auth[_0x9394('0x8')](),controller[_0x9394('0x10')]);module[_0x9394('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index bb6cde3..7c06c3d 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(_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 +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(_0x19f325,_0x1693d3){_0x19f325=_0x19f325-0x0;var _0x9f6e34=_0x7a54[_0x19f325];return _0x9f6e34;};'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 60d1441..6f7d752 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 _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 +var _0xcbf6=['reject','then','error','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','apply'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbf6,0x104));var _0x6cbf=function(_0x4f84c3,_0x6d094d){_0x4f84c3=_0x4f84c3-0x0;var _0x460f9f=_0xcbf6[_0x4f84c3];return _0x460f9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cbf('0x0'));var zipdir=require(_0x6cbf('0x1'));var jsonpatch=require(_0x6cbf('0x2'));var rp=require(_0x6cbf('0x3'));var moment=require(_0x6cbf('0x4'));var BPromise=require(_0x6cbf('0x5'));var Mustache=require('mustache');var util=require(_0x6cbf('0x6'));var path=require(_0x6cbf('0x7'));var sox=require(_0x6cbf('0x8'));var csv=require(_0x6cbf('0x9'));var ejs=require(_0x6cbf('0xa'));var fs=require('fs');var fs_extra=require(_0x6cbf('0xb'));var _=require(_0x6cbf('0xc'));var squel=require('squel');var crypto=require(_0x6cbf('0xd'));var jsforce=require(_0x6cbf('0xe'));var deskjs=require(_0x6cbf('0xf'));var toCsv=require(_0x6cbf('0x9'));var querystring=require(_0x6cbf('0x10'));var Papa=require('papaparse');var Redis=require(_0x6cbf('0x11'));var authService=require(_0x6cbf('0x12'));var qs=require(_0x6cbf('0x13'));var as=require(_0x6cbf('0x14'));var hardwareService=require(_0x6cbf('0x15'));var logger=require(_0x6cbf('0x16'))(_0x6cbf('0x17'));var utils=require(_0x6cbf('0x18'));var config=require(_0x6cbf('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361134,_0x385ed8){_0x385ed8=_0x385ed8||0xcc;return function(_0x36ee0d){if(_0x36ee0d){return _0x361134[_0x6cbf('0x1a')](_0x385ed8);}return _0x361134['status'](_0x385ed8)[_0x6cbf('0x1b')]();};}function respondWithResult(_0x341050,_0x214df7){_0x214df7=_0x214df7||0xc8;return function(_0x5dfbc0){if(_0x5dfbc0){return _0x341050[_0x6cbf('0x1c')](_0x214df7)[_0x6cbf('0x1d')](_0x5dfbc0);}};}function respondWithFilteredResult(_0x40149e,_0x2a73cc){return function(_0x694a1f){if(_0x694a1f){var _0x515bb2=typeof _0x2a73cc[_0x6cbf('0x1e')]==='undefined'&&typeof _0x2a73cc[_0x6cbf('0x1f')]===_0x6cbf('0x20');var _0x527b41=_0x694a1f[_0x6cbf('0x21')];var _0x25dc6a=_0x515bb2?0x0:_0x2a73cc['offset'];var _0x1bc269=_0x515bb2?_0x694a1f[_0x6cbf('0x21')]:_0x2a73cc[_0x6cbf('0x1e')]+_0x2a73cc[_0x6cbf('0x1f')];var _0x177739;if(_0x1bc269>=_0x527b41){_0x1bc269=_0x527b41;_0x177739=0xc8;}else{_0x177739=0xce;}_0x40149e['status'](_0x177739);return _0x40149e[_0x6cbf('0x22')]('Content-Range',_0x25dc6a+'-'+_0x1bc269+'/'+_0x527b41)[_0x6cbf('0x1d')](_0x694a1f);}return null;};}function patchUpdates(_0x242f90){return function(_0x4b37ab){try{jsonpatch[_0x6cbf('0x23')](_0x4b37ab,_0x242f90,!![]);}catch(_0x1e2f93){return BPromise[_0x6cbf('0x24')](_0x1e2f93);}return _0x4b37ab['save']();};}function saveUpdates(_0x182bc2,_0x162256){return function(_0x18a89b){if(_0x18a89b){return _0x18a89b['update'](_0x182bc2)[_0x6cbf('0x25')](function(_0x4b8cee){return _0x4b8cee;});}return null;};}function removeEntity(_0x48d5e5,_0x4cce87){return function(_0x137a08){if(_0x137a08){return _0x137a08['destroy']()[_0x6cbf('0x25')](function(){_0x48d5e5[_0x6cbf('0x1c')](0xcc)[_0x6cbf('0x1b')]();});}};}function handleEntityNotFound(_0x27f1f9,_0x54f227){return function(_0x489bb7){if(!_0x489bb7){_0x27f1f9[_0x6cbf('0x1a')](0x194);}return _0x489bb7;};}function handleError(_0x50e180,_0x482073){_0x482073=_0x482073||0x1f4;return function(_0x3c2c21){logger[_0x6cbf('0x26')](_0x3c2c21['stack']);if(_0x3c2c21[_0x6cbf('0x27')]){delete _0x3c2c21[_0x6cbf('0x27')];}_0x50e180[_0x6cbf('0x1c')](_0x482073)[_0x6cbf('0x28')](_0x3c2c21);};}exports[_0x6cbf('0x29')]=function(_0x18d05a,_0x43e936){var _0x534c03={},_0x5b30cd={},_0x19c9cb={'count':0x0,'rows':[]};var _0x298eb1=_[_0x6cbf('0x2a')](db[_0x6cbf('0x2b')]['rawAttributes'],function(_0x18f6f3){return{'name':_0x18f6f3[_0x6cbf('0x2c')],'type':_0x18f6f3[_0x6cbf('0x2d')][_0x6cbf('0x2e')]};});_0x5b30cd[_0x6cbf('0x2f')]=_[_0x6cbf('0x2a')](_0x298eb1,_0x6cbf('0x27'));_0x5b30cd[_0x6cbf('0x30')]=_[_0x6cbf('0x31')](_0x18d05a[_0x6cbf('0x30')]);_0x5b30cd[_0x6cbf('0x32')]=_[_0x6cbf('0x33')](_0x5b30cd[_0x6cbf('0x2f')],_0x5b30cd[_0x6cbf('0x30')]);_0x534c03['attributes']=_[_0x6cbf('0x33')](_0x5b30cd[_0x6cbf('0x2f')],qs[_0x6cbf('0x34')](_0x18d05a[_0x6cbf('0x30')]['fields']));_0x534c03[_0x6cbf('0x35')]=_0x534c03['attributes']['length']?_0x534c03[_0x6cbf('0x35')]:_0x5b30cd['model'];if(!_0x18d05a['query'][_0x6cbf('0x36')]('nolimit')){_0x534c03[_0x6cbf('0x1f')]=qs[_0x6cbf('0x1f')](_0x18d05a['query']['limit']);_0x534c03[_0x6cbf('0x1e')]=qs[_0x6cbf('0x1e')](_0x18d05a[_0x6cbf('0x30')]['offset']);}_0x534c03['order']=qs[_0x6cbf('0x37')](_0x18d05a[_0x6cbf('0x30')][_0x6cbf('0x37')]);_0x534c03[_0x6cbf('0x38')]=qs[_0x6cbf('0x32')](_['pick'](_0x18d05a[_0x6cbf('0x30')],_0x5b30cd[_0x6cbf('0x32')]),_0x298eb1);if(_0x18d05a[_0x6cbf('0x30')]['filter']){_0x534c03[_0x6cbf('0x38')]=_[_0x6cbf('0x39')](_0x534c03['where'],{'$or':_[_0x6cbf('0x2a')](_0x298eb1,function(_0x3ea33b){if(_0x3ea33b['type']!==_0x6cbf('0x3a')){var _0x34fa8b={};_0x34fa8b[_0x3ea33b[_0x6cbf('0x27')]]={'$like':'%'+_0x18d05a['query'][_0x6cbf('0x3b')]+'%'};return _0x34fa8b;}})});}_0x534c03=_['merge']({},_0x534c03,_0x18d05a[_0x6cbf('0x3c')]);var _0x130aa4={'where':_0x534c03[_0x6cbf('0x38')]};return db[_0x6cbf('0x2b')][_0x6cbf('0x21')](_0x130aa4)[_0x6cbf('0x25')](function(_0x427778){_0x19c9cb[_0x6cbf('0x21')]=_0x427778;if(_0x18d05a['query'][_0x6cbf('0x3d')]){_0x534c03[_0x6cbf('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6cbf('0x3f')](_0x534c03);})[_0x6cbf('0x25')](function(_0x27ef06){_0x19c9cb[_0x6cbf('0x40')]=_0x27ef06;return _0x19c9cb;})[_0x6cbf('0x25')](respondWithFilteredResult(_0x43e936,_0x534c03))[_0x6cbf('0x41')](handleError(_0x43e936,null));};exports[_0x6cbf('0x42')]=function(_0x38442e,_0xbce9aa){var _0x1b0e34={'raw':!![],'where':{'id':_0x38442e[_0x6cbf('0x43')]['id']}},_0x484988={};_0x484988[_0x6cbf('0x2f')]=_[_0x6cbf('0x31')](db[_0x6cbf('0x2b')][_0x6cbf('0x44')]);_0x484988['query']=_['keys'](_0x38442e[_0x6cbf('0x30')]);_0x484988[_0x6cbf('0x32')]=_[_0x6cbf('0x33')](_0x484988['model'],_0x484988['query']);_0x1b0e34[_0x6cbf('0x35')]=_['intersection'](_0x484988[_0x6cbf('0x2f')],qs[_0x6cbf('0x34')](_0x38442e[_0x6cbf('0x30')][_0x6cbf('0x34')]));_0x1b0e34['attributes']=_0x1b0e34[_0x6cbf('0x35')]['length']?_0x1b0e34['attributes']:_0x484988[_0x6cbf('0x2f')];if(_0x38442e[_0x6cbf('0x30')]['includeAll']){_0x1b0e34[_0x6cbf('0x3e')]=[{'all':!![]}];}_0x1b0e34=_[_0x6cbf('0x39')]({},_0x1b0e34,_0x38442e[_0x6cbf('0x3c')]);return db[_0x6cbf('0x2b')][_0x6cbf('0x45')](_0x1b0e34)[_0x6cbf('0x25')](handleEntityNotFound(_0xbce9aa,null))[_0x6cbf('0x25')](respondWithResult(_0xbce9aa,null))[_0x6cbf('0x41')](handleError(_0xbce9aa,null));};exports['create']=function(_0xbfce89,_0x5c5c2c){return db[_0x6cbf('0x2b')][_0x6cbf('0x46')](_0xbfce89[_0x6cbf('0x47')],{})[_0x6cbf('0x25')](respondWithResult(_0x5c5c2c,0xc9))['catch'](handleError(_0x5c5c2c,null));};exports['update']=function(_0x1026ec,_0x1a7674){if(_0x1026ec[_0x6cbf('0x47')]['id']){delete _0x1026ec['body']['id'];}return db[_0x6cbf('0x2b')][_0x6cbf('0x45')]({'where':{'id':_0x1026ec[_0x6cbf('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a7674,null))['then'](saveUpdates(_0x1026ec[_0x6cbf('0x47')],null))[_0x6cbf('0x25')](respondWithResult(_0x1a7674,null))[_0x6cbf('0x41')](handleError(_0x1a7674,null));};exports[_0x6cbf('0x48')]=function(_0x1878ec,_0x222599){return db[_0x6cbf('0x2b')][_0x6cbf('0x45')]({'where':{'id':_0x1878ec[_0x6cbf('0x43')]['id']}})[_0x6cbf('0x25')](handleEntityNotFound(_0x222599,null))[_0x6cbf('0x25')](removeEntity(_0x222599,null))[_0x6cbf('0x41')](handleError(_0x222599,null));};exports[_0x6cbf('0x49')]=function(_0x5f5907,_0x31717b){return db[_0x6cbf('0x2b')][_0x6cbf('0x49')]()['then'](respondWithResult(_0x31717b,null))[_0x6cbf('0x41')](handleError(_0x31717b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 052c33a..e3a1fdd 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 _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 +var _0x9222=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','../../config/logger','moment'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x9222,0x17d));var _0x2922=function(_0xee05c6,_0x2a794f){_0xee05c6=_0xee05c6-0x0;var _0x4539c7=_0x9222[_0xee05c6];return _0x4539c7;};'use strict';var _=require(_0x2922('0x0'));var util=require(_0x2922('0x1'));var logger=require(_0x2922('0x2'))('api');var moment=require(_0x2922('0x3'));var BPromise=require('bluebird');var rp=require(_0x2922('0x4'));var fs=require('fs');var path=require(_0x2922('0x5'));var rimraf=require(_0x2922('0x6'));var config=require(_0x2922('0x7'));var attributes=require(_0x2922('0x8'));module['exports']=function(_0x40e8d3,_0x26265b){return _0x40e8d3[_0x2922('0x9')](_0x2922('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 61725e4..7efdea9 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 _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 +var _0xc3c3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x53a01c,_0x1405b9){var _0x3ce181=function(_0x591532){while(--_0x591532){_0x53a01c['push'](_0x53a01c['shift']());}};_0x3ce181(++_0x1405b9);}(_0xc3c3,0x11a));var _0x3c3c=function(_0x58d7f7,_0x5247fb){_0x58d7f7=_0x58d7f7-0x0;var _0x140760=_0xc3c3[_0x58d7f7];return _0x140760;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require('moment');var BPromise=require(_0x3c3c('0x2'));var rs=require(_0x3c3c('0x3'));var fs=require('fs');var Redis=require(_0x3c3c('0x4'));var db=require(_0x3c3c('0x5'))['db'];var utils=require(_0x3c3c('0x6'));var logger=require(_0x3c3c('0x7'))('rpc');var config=require(_0x3c3c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c3c('0x9')][_0x3c3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa2445f,_0x4fd993,_0x14581f){return new BPromise(function(_0x5309c7,_0x24f294){return client[_0x3c3c('0xb')](_0xa2445f,_0x14581f)[_0x3c3c('0xc')](function(_0x2fd7ce){logger[_0x3c3c('0xd')](_0x3c3c('0xe'),_0x4fd993,_0x3c3c('0xf'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4fd993,_0x3c3c('0xf'),JSON[_0x3c3c('0x10')](_0x2fd7ce));if(_0x2fd7ce['error']){if(_0x2fd7ce[_0x3c3c('0x11')][_0x3c3c('0x12')]===0x1f4){logger[_0x3c3c('0x11')](_0x3c3c('0xe'),_0x4fd993,_0x2fd7ce['error'][_0x3c3c('0x13')]);return _0x24f294(_0x2fd7ce['error'][_0x3c3c('0x13')]);}logger[_0x3c3c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fd993,_0x2fd7ce[_0x3c3c('0x11')][_0x3c3c('0x13')]);return _0x5309c7(_0x2fd7ce[_0x3c3c('0x11')][_0x3c3c('0x13')]);}else{logger[_0x3c3c('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fd993,'request\x20sent');_0x5309c7(_0x2fd7ce[_0x3c3c('0x14')][_0x3c3c('0x13')]);}})[_0x3c3c('0x15')](function(_0x264ed2){logger[_0x3c3c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fd993,_0x264ed2);_0x24f294(_0x264ed2);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c0c7e72..c2daab1 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 _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 +var _0x64d9=['delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','update'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x64d9,0xba));var _0x964d=function(_0x3df9e0,_0x2ade61){_0x3df9e0=_0x3df9e0-0x0;var _0x4bbfc6=_0x64d9[_0x3df9e0];return _0x4bbfc6;};'use strict';var multer=require(_0x964d('0x0'));var util=require(_0x964d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x964d('0x2'));var router=express[_0x964d('0x3')]();var fs_extra=require(_0x964d('0x4'));var auth=require(_0x964d('0x5'));var interaction=require(_0x964d('0x6'));var config=require(_0x964d('0x7'));var controller=require(_0x964d('0x8'));router[_0x964d('0x9')]('/',auth[_0x964d('0xa')](),controller[_0x964d('0xb')]);router['get'](_0x964d('0xc'),auth[_0x964d('0xa')](),controller[_0x964d('0xd')]);router['get'](_0x964d('0xe'),auth['isAuthenticated'](),controller[_0x964d('0xf')]);router[_0x964d('0x9')](_0x964d('0x10'),auth[_0x964d('0xa')](),controller[_0x964d('0x11')]);router[_0x964d('0x12')]('/',auth[_0x964d('0xa')](),controller[_0x964d('0x13')]);router['put'](_0x964d('0xe'),auth['isAuthenticated'](),controller[_0x964d('0x14')]);router[_0x964d('0x15')](_0x964d('0xe'),auth[_0x964d('0xa')](),controller['destroy']);module[_0x964d('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 6632493..a100314 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 _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 +var _0xb118=['YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x517ebd,_0x4ddf11){var _0x5f0b5c=function(_0x40f97d){while(--_0x40f97d){_0x517ebd['push'](_0x517ebd['shift']());}};_0x5f0b5c(++_0x4ddf11);}(_0xb118,0x1e8));var _0x8b11=function(_0x4da6e8,_0x463393){_0x4da6e8=_0x4da6e8-0x0;var _0x357569=_0xb118[_0x4da6e8];return _0x357569;};'use strict';var moment=require('moment');var Sequelize=require(_0x8b11('0x0'));module[_0x8b11('0x1')]={'starttime':{'type':Sequelize[_0x8b11('0x2')],'set':function(_0x5ed857){this[_0x8b11('0x3')](_0x8b11('0x4'),_0x5ed857);this[_0x8b11('0x3')](_0x8b11('0x5'),moment()[_0x8b11('0x6')](_0x8b11('0x7')));}},'endtime':{'type':Sequelize[_0x8b11('0x2')]},'membername':{'type':Sequelize[_0x8b11('0x8')]},'projectname':{'type':Sequelize[_0x8b11('0x8')]},'queue':{'type':Sequelize[_0x8b11('0x8')]},'uniqueid':{'type':Sequelize[_0x8b11('0x8')]},'calleridname':{'type':Sequelize[_0x8b11('0x8')]},'calleridnum':{'type':Sequelize[_0x8b11('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9302ce1..8c6481f 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 _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 +var _0xcefe=['describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','order','pick','SessionId','rimraf','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','save','update','then','error','name','index','map','JscriptySessionReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','destroy','find'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xcefe,0xea));var _0xecef=function(_0x5ea952,_0xc78c71){_0x5ea952=_0x5ea952-0x0;var _0x45d14e=_0xcefe[_0x5ea952];return _0x45d14e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecef('0x1'));var rp=require(_0xecef('0x2'));var moment=require('moment');var BPromise=require(_0xecef('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xecef('0x4'));var csv=require('to-csv');var ejs=require(_0xecef('0x5'));var fs=require('fs');var fs_extra=require(_0xecef('0x6'));var _=require('lodash');var squel=require(_0xecef('0x7'));var crypto=require(_0xecef('0x8'));var jsforce=require(_0xecef('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xecef('0xa'));var Papa=require(_0xecef('0xb'));var Redis=require(_0xecef('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xecef('0xd'));var as=require(_0xecef('0xe'));var hardwareService=require(_0xecef('0xf'));var logger=require('../../config/logger')(_0xecef('0x10'));var utils=require(_0xecef('0x11'));var config=require(_0xecef('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xecef('0x13'))['db'];function respondWithStatusCode(_0x5cfc30,_0x42e4b3){_0x42e4b3=_0x42e4b3||0xcc;return function(_0xd853e){if(_0xd853e){return _0x5cfc30[_0xecef('0x14')](_0x42e4b3);}return _0x5cfc30['status'](_0x42e4b3)[_0xecef('0x15')]();};}function respondWithResult(_0x4bd4fa,_0x2eee2f){_0x2eee2f=_0x2eee2f||0xc8;return function(_0x405df2){if(_0x405df2){return _0x4bd4fa[_0xecef('0x16')](_0x2eee2f)[_0xecef('0x17')](_0x405df2);}};}function respondWithFilteredResult(_0x31d007,_0x4d7e54){return function(_0xff2348){if(_0xff2348){var _0x159c5a=typeof _0x4d7e54['offset']===_0xecef('0x18')&&typeof _0x4d7e54[_0xecef('0x19')]==='undefined';var _0xa14551=_0xff2348['count'];var _0x861ad6=_0x159c5a?0x0:_0x4d7e54[_0xecef('0x1a')];var _0x2a7fa9=_0x159c5a?_0xff2348[_0xecef('0x1b')]:_0x4d7e54[_0xecef('0x1a')]+_0x4d7e54[_0xecef('0x19')];var _0x1cdda6;if(_0x2a7fa9>=_0xa14551){_0x2a7fa9=_0xa14551;_0x1cdda6=0xc8;}else{_0x1cdda6=0xce;}_0x31d007[_0xecef('0x16')](_0x1cdda6);return _0x31d007[_0xecef('0x1c')]('Content-Range',_0x861ad6+'-'+_0x2a7fa9+'/'+_0xa14551)['json'](_0xff2348);}return null;};}function patchUpdates(_0x50c97e){return function(_0x3c9c09){try{jsonpatch[_0xecef('0x1d')](_0x3c9c09,_0x50c97e,!![]);}catch(_0x14ed11){return BPromise['reject'](_0x14ed11);}return _0x3c9c09[_0xecef('0x1e')]();};}function saveUpdates(_0x505e76,_0x9a193){return function(_0xcf3f14){if(_0xcf3f14){return _0xcf3f14[_0xecef('0x1f')](_0x505e76)[_0xecef('0x20')](function(_0x2679b3){return _0x2679b3;});}return null;};}function removeEntity(_0x53cc48,_0x52161f){return function(_0x49043a){if(_0x49043a){return _0x49043a['destroy']()['then'](function(){_0x53cc48[_0xecef('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e51ca,_0x13d4e1){return function(_0x5816e5){if(!_0x5816e5){_0x5e51ca[_0xecef('0x14')](0x194);}return _0x5816e5;};}function handleError(_0xe2a17b,_0xf81d58){_0xf81d58=_0xf81d58||0x1f4;return function(_0x1a30cd){logger[_0xecef('0x21')](_0x1a30cd['stack']);if(_0x1a30cd['name']){delete _0x1a30cd[_0xecef('0x22')];}_0xe2a17b[_0xecef('0x16')](_0xf81d58)['send'](_0x1a30cd);};}exports[_0xecef('0x23')]=function(_0x33c616,_0x302af1){var _0x5d1c1d={},_0xe4892a={},_0x2a67c4={'count':0x0,'rows':[]};var _0x4820e8=_[_0xecef('0x24')](db[_0xecef('0x25')][_0xecef('0x26')],function(_0x3f16dc){return{'name':_0x3f16dc['fieldName'],'type':_0x3f16dc['type'][_0xecef('0x27')]};});_0xe4892a['model']=_['map'](_0x4820e8,_0xecef('0x22'));_0xe4892a[_0xecef('0x28')]=_[_0xecef('0x29')](_0x33c616['query']);_0xe4892a[_0xecef('0x2a')]=_[_0xecef('0x2b')](_0xe4892a[_0xecef('0x2c')],_0xe4892a[_0xecef('0x28')]);_0x5d1c1d[_0xecef('0x2d')]=_['intersection'](_0xe4892a[_0xecef('0x2c')],qs[_0xecef('0x2e')](_0x33c616[_0xecef('0x28')][_0xecef('0x2e')]));_0x5d1c1d[_0xecef('0x2d')]=_0x5d1c1d['attributes']['length']?_0x5d1c1d[_0xecef('0x2d')]:_0xe4892a[_0xecef('0x2c')];if(!_0x33c616[_0xecef('0x28')]['hasOwnProperty']('nolimit')){_0x5d1c1d[_0xecef('0x19')]=qs[_0xecef('0x19')](_0x33c616['query'][_0xecef('0x19')]);_0x5d1c1d[_0xecef('0x1a')]=qs['offset'](_0x33c616[_0xecef('0x28')]['offset']);}_0x5d1c1d['order']=qs[_0xecef('0x2f')](_0x33c616[_0xecef('0x28')][_0xecef('0x2f')]);_0x5d1c1d[_0xecef('0x30')]=qs[_0xecef('0x2a')](_['pick'](_0x33c616['query'],_0xe4892a[_0xecef('0x2a')]),_0x4820e8);if(_0x33c616['query'][_0xecef('0x31')]){_0x5d1c1d[_0xecef('0x30')]=_[_0xecef('0x32')](_0x5d1c1d[_0xecef('0x30')],{'$or':_[_0xecef('0x24')](_0x4820e8,function(_0x17fc7d){if(_0x17fc7d[_0xecef('0x33')]!==_0xecef('0x34')){var _0x22c434={};_0x22c434[_0x17fc7d[_0xecef('0x22')]]={'$like':'%'+_0x33c616[_0xecef('0x28')][_0xecef('0x31')]+'%'};return _0x22c434;}})});}_0x5d1c1d=_[_0xecef('0x32')]({},_0x5d1c1d,_0x33c616[_0xecef('0x35')]);var _0x39511f={'where':_0x5d1c1d[_0xecef('0x30')]};return db['JscriptySessionReport']['count'](_0x39511f)[_0xecef('0x20')](function(_0xdaebac){_0x2a67c4[_0xecef('0x1b')]=_0xdaebac;if(_0x33c616[_0xecef('0x28')][_0xecef('0x36')]){_0x5d1c1d[_0xecef('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xecef('0x38')](_0x5d1c1d);})[_0xecef('0x20')](function(_0x3243ba){_0x2a67c4[_0xecef('0x39')]=_0x3243ba;return _0x2a67c4;})[_0xecef('0x20')](respondWithFilteredResult(_0x302af1,_0x5d1c1d))[_0xecef('0x3a')](handleError(_0x302af1,null));};exports[_0xecef('0x3b')]=function(_0x27a8a3,_0x2d0f20){var _0x2658c5={'raw':!![],'where':{'id':_0x27a8a3[_0xecef('0x3c')]['id']}},_0x5c6b5b={};_0x5c6b5b[_0xecef('0x2c')]=_['keys'](db[_0xecef('0x25')][_0xecef('0x26')]);_0x5c6b5b['query']=_[_0xecef('0x29')](_0x27a8a3[_0xecef('0x28')]);_0x5c6b5b['filters']=_[_0xecef('0x2b')](_0x5c6b5b[_0xecef('0x2c')],_0x5c6b5b[_0xecef('0x28')]);_0x2658c5[_0xecef('0x2d')]=_[_0xecef('0x2b')](_0x5c6b5b[_0xecef('0x2c')],qs[_0xecef('0x2e')](_0x27a8a3['query'][_0xecef('0x2e')]));_0x2658c5[_0xecef('0x2d')]=_0x2658c5[_0xecef('0x2d')][_0xecef('0x3d')]?_0x2658c5['attributes']:_0x5c6b5b[_0xecef('0x2c')];if(_0x27a8a3['query'][_0xecef('0x36')]){_0x2658c5[_0xecef('0x37')]=[{'all':!![]}];}_0x2658c5=_[_0xecef('0x32')]({},_0x2658c5,_0x27a8a3[_0xecef('0x35')]);return db[_0xecef('0x25')]['find'](_0x2658c5)['then'](handleEntityNotFound(_0x2d0f20,null))[_0xecef('0x20')](respondWithResult(_0x2d0f20,null))[_0xecef('0x3a')](handleError(_0x2d0f20,null));};exports[_0xecef('0x3e')]=function(_0x327d71,_0x4fa7e3){return db[_0xecef('0x25')]['create'](_0x327d71[_0xecef('0x3f')],{})[_0xecef('0x20')](respondWithResult(_0x4fa7e3,0xc9))[_0xecef('0x3a')](handleError(_0x4fa7e3,null));};exports[_0xecef('0x1f')]=function(_0x1255a6,_0x418155){if(_0x1255a6[_0xecef('0x3f')]['id']){delete _0x1255a6[_0xecef('0x3f')]['id'];}return db[_0xecef('0x25')]['find']({'where':{'id':_0x1255a6[_0xecef('0x3c')]['id']}})[_0xecef('0x20')](handleEntityNotFound(_0x418155,null))[_0xecef('0x20')](saveUpdates(_0x1255a6[_0xecef('0x3f')],null))['then'](respondWithResult(_0x418155,null))[_0xecef('0x3a')](handleError(_0x418155,null));};exports[_0xecef('0x40')]=function(_0x4913f0,_0x4c8a0b){return db[_0xecef('0x25')][_0xecef('0x41')]({'where':{'id':_0x4913f0[_0xecef('0x3c')]['id']}})[_0xecef('0x20')](handleEntityNotFound(_0x4c8a0b,null))[_0xecef('0x20')](removeEntity(_0x4c8a0b,null))[_0xecef('0x3a')](handleError(_0x4c8a0b,null));};exports[_0xecef('0x42')]=function(_0x31551f,_0x15964b){return db[_0xecef('0x25')][_0xecef('0x42')]()[_0xecef('0x20')](respondWithResult(_0x15964b,null))[_0xecef('0x3a')](handleError(_0x15964b,null));};exports[_0xecef('0x43')]=function(_0x5269b2,_0x3cd466,_0x259485){var _0x426150={'raw':!![],'where':{}};var _0x1dc739={};var _0x3495e6={'count':0x0,'rows':[]};return db[_0xecef('0x25')][_0xecef('0x44')]({'where':{'id':_0x5269b2[_0xecef('0x3c')]['id']}})[_0xecef('0x20')](handleEntityNotFound(_0x3cd466,null))[_0xecef('0x20')](function(_0x550e75){if(_0x550e75){_0x1dc739[_0xecef('0x2c')]=_[_0xecef('0x29')](db[_0xecef('0x45')][_0xecef('0x26')]);_0x1dc739['query']=_[_0xecef('0x29')](_0x5269b2[_0xecef('0x28')]);_0x1dc739[_0xecef('0x2a')]=_[_0xecef('0x2b')](_0x1dc739[_0xecef('0x2c')],_0x1dc739[_0xecef('0x28')]);_0x426150[_0xecef('0x2d')]=_['intersection'](_0x1dc739['model'],qs['fields'](_0x5269b2[_0xecef('0x28')]['fields']));_0x426150[_0xecef('0x2d')]=_0x426150['attributes']['length']?_0x426150[_0xecef('0x2d')]:_0x1dc739[_0xecef('0x2c')];if(!_0x5269b2[_0xecef('0x28')][_0xecef('0x46')](_0xecef('0x47'))){_0x426150['limit']=qs[_0xecef('0x19')](_0x5269b2['query'][_0xecef('0x19')]);_0x426150[_0xecef('0x1a')]=qs[_0xecef('0x1a')](_0x5269b2[_0xecef('0x28')][_0xecef('0x1a')]);}_0x426150[_0xecef('0x48')]=qs['sort'](_0x5269b2[_0xecef('0x28')][_0xecef('0x2f')]);_0x426150['where']=qs[_0xecef('0x2a')](_[_0xecef('0x49')](_0x5269b2[_0xecef('0x28')],_0x1dc739[_0xecef('0x2a')]));_0x426150[_0xecef('0x30')][_0xecef('0x4a')]=_0x550e75['id'];if(_0x5269b2['query'][_0xecef('0x31')]){_0x426150['where']=_[_0xecef('0x32')](_0x426150['where'],{'$or':_[_0xecef('0x24')](_0x426150[_0xecef('0x2d')],function(_0x49c07b){var _0x12f28f={};_0x12f28f[_0x49c07b]={'$like':'%'+_0x5269b2['query']['filter']+'%'};return _0x12f28f;})});}_0x426150=_['merge']({},_0x426150,_0x5269b2['options']);return db['JscriptyQuestionReport'][_0xecef('0x1b')]({'where':_0x426150[_0xecef('0x30')]})[_0xecef('0x20')](function(_0xf34eb9){_0x3495e6[_0xecef('0x1b')]=_0xf34eb9;if(_0x5269b2[_0xecef('0x28')][_0xecef('0x36')]){_0x426150[_0xecef('0x37')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xecef('0x38')](_0x426150);})[_0xecef('0x20')](function(_0x189486){_0x3495e6[_0xecef('0x39')]=_0x189486;return _0x3495e6;});}})['then'](respondWithFilteredResult(_0x3cd466,_0x426150))['catch'](handleError(_0x3cd466,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 812e8eb..098964b 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 _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 +var _0x81c6=['JscriptySessionReport','util','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x416fc9,_0x17b241){var _0xf399c9=function(_0x2bd383){while(--_0x2bd383){_0x416fc9['push'](_0x416fc9['shift']());}};_0xf399c9(++_0x17b241);}(_0x81c6,0x1d5));var _0x681c=function(_0x479c68,_0x4f2415){_0x479c68=_0x479c68-0x0;var _0x5215b1=_0x81c6[_0x479c68];return _0x5215b1;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 2306b97..205380b 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 _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 +var _0x1967=['then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x1967,0x173));var _0x7196=function(_0x8ddf76,_0x2bb7d3){_0x8ddf76=_0x8ddf76-0x0;var _0x31f249=_0x1967[_0x8ddf76];return _0x31f249;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index be914b0..3ec1a8a 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 _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 +var _0xcc59=['index','put','/:id','isAuthenticated','update','/download_log_file','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0xcc59,0x115));var _0x9cc5=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xcc59[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x9cc5('0x0'));var util=require(_0x9cc5('0x1'));var path=require(_0x9cc5('0x2'));var timeout=require(_0x9cc5('0x3'));var express=require('express');var router=express[_0x9cc5('0x4')]();var fs_extra=require(_0x9cc5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9cc5('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x9cc5('0x7')]('/',controller[_0x9cc5('0x8')]);router[_0x9cc5('0x9')](_0x9cc5('0xa'),auth[_0x9cc5('0xb')](),controller[_0x9cc5('0xc')]);router[_0x9cc5('0x7')](_0x9cc5('0xd'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x9cc5('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 04cd72f..a425c6a 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 _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 +var _0x24f7=['INTEGER','STRING'];(function(_0x47fba3,_0x4449dd){var _0x1d2a14=function(_0x4f4c1a){while(--_0x4f4c1a){_0x47fba3['push'](_0x47fba3['shift']());}};_0x1d2a14(++_0x4449dd);}(_0x24f7,0x157));var _0x724f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x24f7[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x724f('0x0')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x724f('0x1')],'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 d5d7205..30bd144 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 _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 +var _0x3c5f=['intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','params','get','key','demo','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','destroy','then','sendStatus','error','stack','send','index','model','keys','License','rawAttributes','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c5f,0xec));var _0xf3c5=function(_0x4f5f0a,_0x35e9fd){_0x4f5f0a=_0x4f5f0a-0x0;var _0x52ec65=_0x3c5f[_0x4f5f0a];return _0x52ec65;};'use strict';var emlformat=require(_0xf3c5('0x0'));var rimraf=require(_0xf3c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3c5('0x2'));var rp=require(_0xf3c5('0x3'));var moment=require(_0xf3c5('0x4'));var BPromise=require(_0xf3c5('0x5'));var Mustache=require('mustache');var util=require(_0xf3c5('0x6'));var path=require(_0xf3c5('0x7'));var sox=require(_0xf3c5('0x8'));var csv=require(_0xf3c5('0x9'));var ejs=require(_0xf3c5('0xa'));var fs=require('fs');var fs_extra=require(_0xf3c5('0xb'));var _=require('lodash');var squel=require(_0xf3c5('0xc'));var crypto=require(_0xf3c5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf3c5('0xe'));var toCsv=require(_0xf3c5('0x9'));var querystring=require(_0xf3c5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf3c5('0x10'));var qs=require(_0xf3c5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3c5('0x12'));var logger=require(_0xf3c5('0x13'))(_0xf3c5('0x14'));var utils=require(_0xf3c5('0x15'));var config=require(_0xf3c5('0x16'));var licenseUtil=require(_0xf3c5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5ff6,_0x4d2aa5){_0x4d2aa5=_0x4d2aa5||0xcc;return function(_0x4fdf00){if(_0x4fdf00){return _0x1e5ff6['sendStatus'](_0x4d2aa5);}return _0x1e5ff6[_0xf3c5('0x18')](_0x4d2aa5)[_0xf3c5('0x19')]();};}function respondWithResult(_0x2c8e97,_0x426dbb){_0x426dbb=_0x426dbb||0xc8;return function(_0xd8670){if(_0xd8670){return _0x2c8e97[_0xf3c5('0x18')](_0x426dbb)['json'](_0xd8670);}};}function respondWithFilteredResult(_0x17a404,_0x5534d0){return function(_0x29a493){if(_0x29a493){var _0x491372=typeof _0x5534d0['offset']===_0xf3c5('0x1a')&&typeof _0x5534d0[_0xf3c5('0x1b')]===_0xf3c5('0x1a');var _0x150afc=_0x29a493[_0xf3c5('0x1c')];var _0x1a67ca=_0x491372?0x0:_0x5534d0['offset'];var _0x6f3df3=_0x491372?_0x29a493[_0xf3c5('0x1c')]:_0x5534d0[_0xf3c5('0x1d')]+_0x5534d0[_0xf3c5('0x1b')];var _0x1a0bbc;if(_0x6f3df3>=_0x150afc){_0x6f3df3=_0x150afc;_0x1a0bbc=0xc8;}else{_0x1a0bbc=0xce;}_0x17a404[_0xf3c5('0x18')](_0x1a0bbc);return _0x17a404[_0xf3c5('0x1e')](_0xf3c5('0x1f'),_0x1a67ca+'-'+_0x6f3df3+'/'+_0x150afc)[_0xf3c5('0x20')](_0x29a493);}return null;};}function patchUpdates(_0x5c62fa){return function(_0x52a6ab){try{jsonpatch['apply'](_0x52a6ab,_0x5c62fa,!![]);}catch(_0x4f9ee8){return BPromise[_0xf3c5('0x21')](_0x4f9ee8);}return _0x52a6ab[_0xf3c5('0x22')]();};}function saveUpdates(_0x4283d6,_0x507fc0){return function(_0x1c1060){if(_0x1c1060){return _0x1c1060['update'](_0x4283d6)['then'](function(_0xa536a5){return _0xa536a5;});}return null;};}function removeEntity(_0x225176,_0x5a3f91){return function(_0x5683ca){if(_0x5683ca){return _0x5683ca[_0xf3c5('0x23')]()[_0xf3c5('0x24')](function(){_0x225176[_0xf3c5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x562ec4,_0x2ec710){return function(_0x4644ff){if(!_0x4644ff){_0x562ec4[_0xf3c5('0x25')](0x194);}return _0x4644ff;};}function handleError(_0x51a73a,_0x425981){_0x425981=_0x425981||0x1f4;return function(_0x3e30a5){logger[_0xf3c5('0x26')](_0x3e30a5[_0xf3c5('0x27')]);if(_0x3e30a5['name']){delete _0x3e30a5['name'];}_0x51a73a[_0xf3c5('0x18')](_0x425981)[_0xf3c5('0x28')](_0x3e30a5);};}var utilLicense=require(_0xf3c5('0x17'));exports[_0xf3c5('0x29')]=function(_0x54cf67,_0x3c0dab){var _0x415135={'raw':!![],'where':{'id':0x1}},_0x360043={};_0x360043[_0xf3c5('0x2a')]=_[_0xf3c5('0x2b')](db[_0xf3c5('0x2c')][_0xf3c5('0x2d')]);_0x360043[_0xf3c5('0x2e')]=_['keys'](_0x54cf67[_0xf3c5('0x2e')]);_0x360043[_0xf3c5('0x2f')]=_[_0xf3c5('0x30')](_0x360043[_0xf3c5('0x2a')],_0x360043['query']);_0x415135[_0xf3c5('0x31')]=_[_0xf3c5('0x30')](_0x360043[_0xf3c5('0x2a')],qs[_0xf3c5('0x32')](_0x54cf67[_0xf3c5('0x2e')][_0xf3c5('0x32')]));_0x415135['attributes']=_0x415135[_0xf3c5('0x31')][_0xf3c5('0x33')]?_0x415135['attributes']:_0x360043[_0xf3c5('0x2a')];_0x415135=_[_0xf3c5('0x34')]({},_0x415135,_0x54cf67[_0xf3c5('0x35')]);return utilLicense[_0xf3c5('0x36')](_0x415135)[_0xf3c5('0x24')](respondWithResult(_0x3c0dab,null))[_0xf3c5('0x37')](handleError(_0x3c0dab,null));};exports[_0xf3c5('0x38')]=function(_0x296f5c,_0x351ace){if(_0x296f5c['body']['id']){delete _0x296f5c[_0xf3c5('0x39')]['id'];}return db[_0xf3c5('0x2c')]['find']({'where':{'id':_0x296f5c[_0xf3c5('0x3a')]['id']}})[_0xf3c5('0x24')](handleEntityNotFound(_0x351ace,null))[_0xf3c5('0x24')](function(_0x39a991){var _0x510de4=_0x39a991[_0xf3c5('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x510de4,_0x296f5c[_0xf3c5('0x39')][_0xf3c5('0x3c')]);})[_0xf3c5('0x24')](function(_0x2e8470){if(!_0x2e8470[_0xf3c5('0x3d')]){return saveUpdates(_0x296f5c[_0xf3c5('0x39')],null);}return _0x2e8470;})[_0xf3c5('0x24')](respondWithResult(_0x351ace,null))[_0xf3c5('0x37')](handleError(_0x351ace,null));};exports['downloadLogFile']=function(_0x238e27,_0x408864){var _0x287efa=_0xf3c5('0x3e');var _0x32e9e5=path[_0xf3c5('0x3f')](_0xf3c5('0x40'),_0xf3c5('0x41'),'xcally',_0x287efa);_0x408864[_0xf3c5('0x42')]('Content-disposition',_0xf3c5('0x43')+_0x287efa);_0x408864['set'](_0xf3c5('0x44'),_0xf3c5('0x45'));_0x408864[_0xf3c5('0x46')](_0x32e9e5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 47c5c87..6a11272 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 _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 +var _0x557c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','util'];(function(_0x3fb9a7,_0x3b14f9){var _0x2d10c6=function(_0x3d6b71){while(--_0x3d6b71){_0x3fb9a7['push'](_0x3fb9a7['shift']());}};_0x2d10c6(++_0x3b14f9);}(_0x557c,0x1df));var _0xc557=function(_0x51426b,_0x56069c){_0x51426b=_0x51426b-0x0;var _0xb53cc3=_0x557c[_0x51426b];return _0xb53cc3;};'use strict';var _=require('lodash');var util=require(_0xc557('0x0'));var logger=require(_0xc557('0x1'))(_0xc557('0x2'));var moment=require(_0xc557('0x3'));var BPromise=require(_0xc557('0x4'));var rp=require(_0xc557('0x5'));var fs=require('fs');var path=require(_0xc557('0x6'));var rimraf=require(_0xc557('0x7'));var config=require(_0xc557('0x8'));var attributes=require(_0xc557('0x9'));module['exports']=function(_0xd41faa,_0xa40d8b){return _0xd41faa[_0xc557('0xa')](_0xc557('0xb'),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 bf2831b..090f3e0 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 _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 +var _0xa7e9=['jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5434dd,_0x5b6caa){var _0x5d55de=function(_0x5515fe){while(--_0x5515fe){_0x5434dd['push'](_0x5434dd['shift']());}};_0x5d55de(++_0x5b6caa);}(_0xa7e9,0x14c));var _0x9a7e=function(_0x1700c1,_0xeba2e9){_0x1700c1=_0x1700c1-0x0;var _0x4bf44b=_0xa7e9[_0x1700c1];return _0x4bf44b;};'use strict';var _=require(_0x9a7e('0x0'));var util=require(_0x9a7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a7e('0x2'));var fs=require('fs');var Redis=require(_0x9a7e('0x3'));var db=require(_0x9a7e('0x4'))['db'];var utils=require(_0x9a7e('0x5'));var logger=require(_0x9a7e('0x6'))(_0x9a7e('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a7e('0x8'));var client=jayson[_0x9a7e('0x9')][_0x9a7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c805e,_0x456d8d,_0x13ad18){return new BPromise(function(_0x15d692,_0x1ecbc8){return client[_0x9a7e('0xb')](_0x2c805e,_0x13ad18)['then'](function(_0x2085e9){logger[_0x9a7e('0xc')](_0x9a7e('0xd'),_0x456d8d,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x456d8d,_0x9a7e('0xe'),JSON['stringify'](_0x2085e9));if(_0x2085e9[_0x9a7e('0xf')]){if(_0x2085e9['error'][_0x9a7e('0x10')]===0x1f4){logger[_0x9a7e('0xf')](_0x9a7e('0xd'),_0x456d8d,_0x2085e9[_0x9a7e('0xf')]['message']);return _0x1ecbc8(_0x2085e9[_0x9a7e('0xf')]['message']);}logger[_0x9a7e('0xf')]('License,\x20%s,\x20%s',_0x456d8d,_0x2085e9[_0x9a7e('0xf')][_0x9a7e('0x11')]);return _0x15d692(_0x2085e9[_0x9a7e('0xf')][_0x9a7e('0x11')]);}else{logger['info'](_0x9a7e('0xd'),_0x456d8d,'request\x20sent');_0x15d692(_0x2085e9[_0x9a7e('0x12')][_0x9a7e('0x11')]);}})[_0x9a7e('0x13')](function(_0x5cee3c){logger[_0x9a7e('0xf')](_0x9a7e('0xd'),_0x456d8d,_0x5cee3c);_0x1ecbc8(_0x5cee3c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ffec56c..bb80f31 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 _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 +var _0xfbd5=['addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','addDisposition','post','addAnswer','create','addImap'];(function(_0x1a387c,_0x3a66cc){var _0x2b8089=function(_0x3c3b89){while(--_0x3c3b89){_0x1a387c['push'](_0x1a387c['shift']());}};_0x2b8089(++_0x3a66cc);}(_0xfbd5,0x158));var _0x5fbd=function(_0x2f54f0,_0x211640){_0x2f54f0=_0x2f54f0-0x0;var _0x5d4f27=_0xfbd5[_0x2f54f0];return _0x5d4f27;};'use strict';var multer=require('multer');var util=require(_0x5fbd('0x0'));var path=require(_0x5fbd('0x1'));var timeout=require(_0x5fbd('0x2'));var express=require(_0x5fbd('0x3'));var router=express[_0x5fbd('0x4')]();var fs_extra=require(_0x5fbd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5fbd('0x6'));var controller=require(_0x5fbd('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5fbd('0x8')](_0x5fbd('0x9'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0xb')]);router['get'](_0x5fbd('0xc'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0xd')]);router['get'](_0x5fbd('0xe'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0xf')]);router[_0x5fbd('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x5fbd('0x10'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x11')]);router['get'](_0x5fbd('0x12'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x13')]);router[_0x5fbd('0x8')]('/:id/interactions',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x14')]);router[_0x5fbd('0x8')](_0x5fbd('0x15'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x16')]);router['get'](_0x5fbd('0x17'),auth['isAuthenticated'](),controller[_0x5fbd('0x18')]);router[_0x5fbd('0x8')](_0x5fbd('0x19'),auth[_0x5fbd('0xa')](),controller['verifySmtp']);router[_0x5fbd('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x5fbd('0x1a')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5fbd('0x1b')]);router[_0x5fbd('0x1c')]('/:id/canned_answers',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x1d')]);router[_0x5fbd('0x1c')]('/',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x1e')]);router[_0x5fbd('0x1c')](_0x5fbd('0x10'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x1f')]);router[_0x5fbd('0x1c')](_0x5fbd('0x12'),auth['isAuthenticated'](),controller[_0x5fbd('0x20')]);router['post']('/:id/interactions',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x21')]);router[_0x5fbd('0x1c')]('/:id/applications',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x22')]);router[_0x5fbd('0x1c')]('/:id/send',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x23')]);router['post'](_0x5fbd('0x24'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x25')]);router['put'](_0x5fbd('0xc'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x26')]);router[_0x5fbd('0x27')](_0x5fbd('0xe'),auth['isAuthenticated'](),controller[_0x5fbd('0x28')]);router['delete'](_0x5fbd('0x29'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2a')]);router['delete'](_0x5fbd('0x10'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2b')]);router[_0x5fbd('0x27')]('/:id/out_servers',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2c')]);router[_0x5fbd('0x27')](_0x5fbd('0xc'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2d')]);router[_0x5fbd('0x27')](_0x5fbd('0x24'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ab23b69..ac2a18c 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 _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 +var _0x5dc4=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','ENUM','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x5dc4,0x11c));var _0x45dc=function(_0x45d71d,_0x383f29){_0x45d71d=_0x45d71d-0x0;var _0x467901=_0x5dc4[_0x45d71d];return _0x467901;};'use strict';var Sequelize=require(_0x45dc('0x0'));module[_0x45dc('0x1')]={'description':{'type':Sequelize[_0x45dc('0x2')]},'name':{'type':Sequelize[_0x45dc('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x45dc('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x45dc('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x45dc('0x4')]},'markAsUnread':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x45dc('0x2')],'allowNull':![],'defaultValue':_0x45dc('0x5')},'fontSize':{'type':Sequelize[_0x45dc('0x6')](0x2)[_0x45dc('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x45dc('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x45dc('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![],'comment':_0x45dc('0x9'),'set':function(_0x2874a0){if(!_0x2874a0)this['setDataValue'](_0x45dc('0xa'),null);this[_0x45dc('0xb')]('mandatoryDisposition',_0x2874a0);}},'provider':{'type':Sequelize[_0x45dc('0xc')]('gmail','hotmail',_0x45dc('0xd'),_0x45dc('0xe')),'defaultValue':null,'get':function(){var _0x3460a0=this[_0x45dc('0xf')](_0x45dc('0x10'));return _0x3460a0||_0x45dc('0x11');},'set':function(_0x1eb81c){if(_0x1eb81c==='custom'){_0x1eb81c=null;}return this[_0x45dc('0xb')](_0x45dc('0x10'),_0x1eb81c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 42d2b75..2d2327d 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 _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 +var _0x804a=['./mailAccount.socket','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','custom','provider','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','findOne','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','key','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','email','attachments','join','root','basename','getSmtpOptions','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults'];(function(_0x1f82e8,_0x13094d){var _0x4c4e3a=function(_0x4ef4a9){while(--_0x4ef4a9){_0x1f82e8['push'](_0x1f82e8['shift']());}};_0x4c4e3a(++_0x13094d);}(_0x804a,0x184));var _0xa804=function(_0x531390,_0xfb0b58){_0x531390=_0x531390-0x0;var _0x1c5c69=_0x804a[_0x531390];return _0x1c5c69;};'use strict';var moment=require('moment');var BPromise=require(_0xa804('0x0'));var util=require(_0xa804('0x1'));var path=require(_0xa804('0x2'));var _=require(_0xa804('0x3'));var juice=require(_0xa804('0x4'));var Redis=require(_0xa804('0x5'));var qs=require(_0xa804('0x6'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xa804('0x7'))['db'];config[_0xa804('0x8')]=_[_0xa804('0x9')](config[_0xa804('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa804('0xa'))['register'](socket);var jayson=require(_0xa804('0xb'));var client=jayson[_0xa804('0xc')][_0xa804('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x527fa3,_0x4c1bd6,_0x167892,_0x58d82e){return new BPromise(function(_0x38589f,_0x23d6b3){var _0x3ac894=_0x58d82e||client;return _0x3ac894[_0xa804('0xe')](_0x527fa3,_0x167892)['then'](function(_0x591fc1){logger[_0xa804('0xf')](_0xa804('0x10'),_0x4c1bd6,_0xa804('0x11'));logger[_0xa804('0x12')](_0xa804('0x13'),_0x4c1bd6,_0xa804('0x11'),JSON[_0xa804('0x14')](_0x591fc1));if(_0x591fc1[_0xa804('0x15')]){if(_0x591fc1[_0xa804('0x15')][_0xa804('0x16')]===0x1f4){logger[_0xa804('0x15')](_0xa804('0x10'),_0x4c1bd6,_0x591fc1[_0xa804('0x15')][_0xa804('0x17')]);return _0x23d6b3(_0x591fc1[_0xa804('0x15')]['message']);}logger[_0xa804('0x15')](_0xa804('0x10'),_0x4c1bd6,_0x591fc1['error'][_0xa804('0x17')]);return _0x38589f(_0x591fc1[_0xa804('0x15')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x4c1bd6,'request\x20sent');_0x38589f(_0x591fc1[_0xa804('0x18')][_0xa804('0x17')]);}})['catch'](function(_0x5b1cda){logger[_0xa804('0x15')](_0xa804('0x10'),_0x4c1bd6,_0x5b1cda);_0x23d6b3(_0x5b1cda);});});}function respondWithStatusCode(_0x59fc65,_0x10b486){_0x10b486=_0x10b486||0xcc;return function(_0x2603ea){if(_0x2603ea){return _0x59fc65[_0xa804('0x19')](_0x10b486);}return _0x59fc65[_0xa804('0x1a')](_0x10b486)[_0xa804('0x1b')]();};}function respondWithResult(_0x4803c1,_0x5d152d){_0x5d152d=_0x5d152d||0xc8;return function(_0x29c930){if(_0x29c930){return _0x4803c1['status'](_0x5d152d)[_0xa804('0x1c')](_0x29c930);}};}function respondWithFilteredResult(_0x5ac34a,_0x35c95c){return function(_0x4e22bf){if(_0x4e22bf){var _0x5190d9=typeof _0x35c95c[_0xa804('0x1d')]===_0xa804('0x1e')&&typeof _0x35c95c[_0xa804('0x1f')]===_0xa804('0x1e');var _0x1a2a1e=_0x4e22bf[_0xa804('0x20')];var _0xe78aac=_0x5190d9?0x0:_0x35c95c[_0xa804('0x1d')];var _0x1a444b=_0x5190d9?_0x4e22bf[_0xa804('0x20')]:_0x35c95c['offset']+_0x35c95c[_0xa804('0x1f')];var _0x467a61;if(_0x1a444b>=_0x1a2a1e){_0x1a444b=_0x1a2a1e;_0x467a61=0xc8;}else{_0x467a61=0xce;}_0x5ac34a['status'](_0x467a61);return _0x5ac34a[_0xa804('0x21')](_0xa804('0x22'),_0xe78aac+'-'+_0x1a444b+'/'+_0x1a2a1e)[_0xa804('0x1c')](_0x4e22bf);}return null;};}function saveUpdates(_0x525492){return function(_0x1bc4a2){if(_0x1bc4a2){return _0x1bc4a2[_0xa804('0x23')](_0x525492)[_0xa804('0x24')](function(_0x4c8ac0){return _0x4c8ac0;});}return null;};}function removeEntity(_0x25a3d3){return function(_0x35d1ac){if(_0x35d1ac){return _0x35d1ac[_0xa804('0x25')]()[_0xa804('0x24')](function(){var _0x492c63=_0x35d1ac[_0xa804('0x26')]({'plain':!![]});var _0x37e574='MailAccounts';return db[_0xa804('0x27')][_0xa804('0x25')]({'where':{'type':_0x37e574,'resourceId':_0x492c63['id']}})[_0xa804('0x24')](function(){return _0x35d1ac;});})[_0xa804('0x24')](function(){_0x25a3d3[_0xa804('0x1a')](0xcc)[_0xa804('0x1b')]();});}};}function handleEntityNotFound(_0x57317b){return function(_0x6c0b22){if(!_0x6c0b22){_0x57317b['sendStatus'](0x194);}return _0x6c0b22;};}function handleError(_0x54b356,_0x195ec3){_0x195ec3=_0x195ec3||0x1f4;return function(_0x4d8424){logger[_0xa804('0x15')](_0x4d8424[_0xa804('0x28')]);if(_0x4d8424[_0xa804('0x29')]){delete _0x4d8424[_0xa804('0x29')];}_0x54b356[_0xa804('0x1a')](_0x195ec3)[_0xa804('0x2a')](_0x4d8424);};}function getImapHost(_0x4be84e){switch(_0x4be84e){case _0xa804('0x2b'):return _0xa804('0x2c');case _0xa804('0x2d'):return _0xa804('0x2e');case _0xa804('0x2f'):return _0xa804('0x30');case _0xa804('0x31'):return _0xa804('0x32');}throw new Error(_0xa804('0x33'),_0x4be84e);}function getSmtpHost(_0x4029b2){switch(_0x4029b2){case _0xa804('0x2b'):return _0xa804('0x34');case _0xa804('0x2d'):return _0xa804('0x35');case _0xa804('0x2f'):return _0xa804('0x36');case _0xa804('0x31'):return _0xa804('0x37');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4029b2);}function getAuthenticationOptions(_0x9149d,_0x56ae98){var _0x31b6f0={};var _0xe2e44e={};if(_0x9149d){_0x31b6f0[_0xa804('0x38')]=_0xe2e44e['user']=_0x56ae98['username'];_0x31b6f0['password']=_0xe2e44e[_0xa804('0x39')]=_0x56ae98[_0xa804('0x3a')];if(_0x56ae98[_0xa804('0x3b')]){_0x31b6f0[_0xa804('0x3b')]=_0xe2e44e[_0xa804('0x3b')]=!![];_0x31b6f0[_0xa804('0x3c')]=_0xe2e44e[_0xa804('0x3c')]=_0x56ae98[_0xa804('0x3c')];_0x31b6f0[_0xa804('0x3a')]=_0xe2e44e[_0xa804('0x39')]=null;}else{_0x31b6f0[_0xa804('0x3c')]=_0xe2e44e[_0xa804('0x3c')]=null;}_0x31b6f0[_0xa804('0x3d')]=getImapHost(_0x9149d);_0x31b6f0[_0xa804('0x3e')]=0x3e1;_0xe2e44e[_0xa804('0x3d')]=getSmtpHost(_0x9149d);_0xe2e44e[_0xa804('0x3e')]=0x24b;_0xe2e44e[_0xa804('0x3f')]=![];_0x31b6f0[_0xa804('0x40')]=_0xe2e44e['service']=null;}else{if(_0x56ae98[_0xa804('0x41')]){_0x31b6f0[_0xa804('0x38')]=_0xe2e44e[_0xa804('0x38')]=_0x56ae98[_0xa804('0x42')];_0x31b6f0[_0xa804('0x3a')]=_0xe2e44e[_0xa804('0x39')]=_0x56ae98[_0xa804('0x3a')];}else{_0x31b6f0[_0xa804('0x41')]=_0xe2e44e[_0xa804('0x41')]=![];_0x31b6f0['user']=_0xe2e44e['user']=null;_0x31b6f0['password']=_0xe2e44e[_0xa804('0x39')]=null;}_0x31b6f0[_0xa804('0x3d')]=_0x56ae98[_0xa804('0x43')][_0xa804('0x3d')];_0x31b6f0[_0xa804('0x3e')]=_0x56ae98[_0xa804('0x43')][_0xa804('0x3e')];_0xe2e44e[_0xa804('0x3d')]=_0x56ae98[_0xa804('0x44')]['host'];_0xe2e44e[_0xa804('0x3e')]=_0x56ae98['Smtp']['port'];}return{'Imap':_0x31b6f0,'Smtp':_0xe2e44e};}exports[_0xa804('0x45')]=function(_0x3b28bc,_0x15676f){var _0x4340d2={'include':[{'model':db[_0xa804('0x46')],'as':_0xa804('0x43')},{'model':db[_0xa804('0x47')],'as':_0xa804('0x44')},{'model':db[_0xa804('0x48')],'as':'mandatoryDispositionPause'}]},_0x5dd8e7={},_0xb5b6be={'count':0x0,'rows':[]};var _0x348fb9=_[_0xa804('0x49')](db[_0xa804('0x4a')][_0xa804('0x4b')],function(_0x1a0463){return{'name':_0x1a0463[_0xa804('0x4c')],'type':_0x1a0463[_0xa804('0x4d')]['key']};});_0x5dd8e7[_0xa804('0x4e')]=_[_0xa804('0x49')](_0x348fb9,'name');_0x5dd8e7[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x3b28bc['query']);_0x5dd8e7[_0xa804('0x51')]=_['intersection'](_0x5dd8e7['model'],_0x5dd8e7[_0xa804('0x4f')]);_0x4340d2[_0xa804('0x52')]=_[_0xa804('0x53')](_0x5dd8e7[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x3b28bc[_0xa804('0x4f')][_0xa804('0x54')]));_0x4340d2[_0xa804('0x52')]=_0x4340d2[_0xa804('0x52')][_0xa804('0x55')]?_0x4340d2[_0xa804('0x52')]:_0x5dd8e7[_0xa804('0x4e')];if(!_0x3b28bc[_0xa804('0x4f')][_0xa804('0x56')](_0xa804('0x57'))){_0x4340d2[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x3b28bc[_0xa804('0x4f')][_0xa804('0x1f')]);_0x4340d2[_0xa804('0x1d')]=qs[_0xa804('0x1d')](_0x3b28bc[_0xa804('0x4f')]['offset']);}_0x4340d2['order']=qs[_0xa804('0x58')](_0x3b28bc[_0xa804('0x4f')][_0xa804('0x58')]);_0x4340d2[_0xa804('0x59')]=qs[_0xa804('0x51')](_['pick'](_0x3b28bc[_0xa804('0x4f')],_0x5dd8e7[_0xa804('0x51')]),_0x348fb9);if(_0x3b28bc[_0xa804('0x4f')][_0xa804('0x5a')]){_0x4340d2['where']=_[_0xa804('0x5b')](_0x4340d2[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x348fb9,function(_0x2a74ec){if(_0x2a74ec['type']!=='VIRTUAL'){var _0x51e0af={};_0x51e0af[_0x2a74ec[_0xa804('0x29')]]={'$like':'%'+_0x3b28bc[_0xa804('0x4f')][_0xa804('0x5a')]+'%'};return _0x51e0af;}})});}_0x4340d2=_[_0xa804('0x5b')]({},_0x4340d2,_0x3b28bc[_0xa804('0x5c')]);var _0x525027={'where':_0x4340d2[_0xa804('0x59')]};return db[_0xa804('0x4a')][_0xa804('0x20')](_0x525027)[_0xa804('0x24')](function(_0x46f706){_0xb5b6be[_0xa804('0x20')]=_0x46f706;if(_0x3b28bc[_0xa804('0x4f')][_0xa804('0x5d')]){_0x4340d2[_0xa804('0x5e')]=[{'all':!![]}];}return db[_0xa804('0x4a')][_0xa804('0x5f')](_0x4340d2);})['then'](function(_0x303c9f){_0xb5b6be['rows']=_0x303c9f;return _0xb5b6be;})[_0xa804('0x24')](respondWithFilteredResult(_0x15676f,_0x4340d2))[_0xa804('0x60')](handleError(_0x15676f,null));};exports[_0xa804('0x61')]=function(_0x5c57bf,_0x835092){var _0x275b7f={'raw':![],'where':{'id':_0x5c57bf[_0xa804('0x62')]['id']},'include':[{'model':db[_0xa804('0x46')],'as':_0xa804('0x43')},{'model':db[_0xa804('0x47')],'as':_0xa804('0x44')},{'model':db[_0xa804('0x48')],'as':'mandatoryDispositionPause'}]},_0x20d49b={};_0x20d49b[_0xa804('0x4e')]=_['keys'](db[_0xa804('0x4a')]['rawAttributes']);_0x20d49b['query']=_['keys'](_0x5c57bf['query']);_0x20d49b[_0xa804('0x51')]=_[_0xa804('0x53')](_0x20d49b[_0xa804('0x4e')],_0x20d49b['query']);_0x275b7f[_0xa804('0x52')]=_['intersection'](_0x20d49b[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x5c57bf[_0xa804('0x4f')][_0xa804('0x54')]));_0x275b7f[_0xa804('0x52')]=_0x275b7f[_0xa804('0x52')][_0xa804('0x55')]?_0x275b7f['attributes']:_0x20d49b[_0xa804('0x4e')];if(_0x5c57bf['query']['includeAll']){_0x275b7f[_0xa804('0x5e')]=[{'all':!![]}];}_0x275b7f=_[_0xa804('0x5b')]({},_0x275b7f,_0x5c57bf[_0xa804('0x5c')]);return db['MailAccount'][_0xa804('0x63')](_0x275b7f)[_0xa804('0x24')](handleEntityNotFound(_0x835092,null))[_0xa804('0x24')](respondWithResult(_0x835092,null))[_0xa804('0x60')](handleError(_0x835092,null));};exports[_0xa804('0x23')]=function(_0x2e25ee,_0x105e5f){if(_0x2e25ee[_0xa804('0x64')]['id']){delete _0x2e25ee[_0xa804('0x64')]['id'];}var _0x544b31=_0x2e25ee[_0xa804('0x64')]['provider']===_0xa804('0x65')?null:_0x2e25ee[_0xa804('0x64')][_0xa804('0x66')];var _0x4e1148=_0x2e25ee[_0xa804('0x64')][_0xa804('0x43')]||{};var _0x2bbf75=_0x2e25ee['body']['Smtp']||{};if(_0x544b31){_0x4e1148[_0xa804('0x3d')]=getImapHost(_0x544b31);_0x4e1148['port']=0x3e1;_0x2bbf75['host']=getSmtpHost(_0x544b31);_0x2bbf75[_0xa804('0x3e')]=0x24b;_0x2bbf75['secure']=![];}if(_0x2bbf75[_0xa804('0x3b')]){_0x2bbf75['secure']=![];}else{_0x2bbf75[_0xa804('0x3c')]=null;}if(!_0x4e1148[_0xa804('0x3b')])_0x4e1148['CloudProviderId']=null;_0x2e25ee[_0xa804('0x64')][_0xa804('0x43')]=_0x4e1148;_0x2e25ee[_0xa804('0x64')][_0xa804('0x44')]=_0x2bbf75;return db[_0xa804('0x4a')]['find']({'where':{'id':_0x2e25ee[_0xa804('0x62')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xa804('0x43')},{'model':db['MailServerOut'],'as':_0xa804('0x44')},{'model':db[_0xa804('0x48')],'as':_0xa804('0x67')}]})[_0xa804('0x24')](handleEntityNotFound(_0x105e5f,null))[_0xa804('0x24')](function(_0x55c1e6){if(!_0x55c1e6)throw new Error(_0xa804('0x68'));if(_0x55c1e6[_0xa804('0x40')])delete _0x2e25ee['body'][_0xa804('0x43')];return _0x55c1e6;})[_0xa804('0x24')](saveUpdates(_0x2e25ee[_0xa804('0x64')],null))[_0xa804('0x24')](function(_0x10eb9e){if(!_0x2e25ee['body'][_0xa804('0x43')])return _0x10eb9e;return db[_0xa804('0x46')][_0xa804('0x23')](_0x2e25ee[_0xa804('0x64')][_0xa804('0x43')],{'where':{'MailAccountId':_0x10eb9e['id']}})[_0xa804('0x24')](function(){return _0x10eb9e;});})['then'](function(_0x115e13){if(!_0x2e25ee[_0xa804('0x64')][_0xa804('0x44')])return _0x115e13;return db[_0xa804('0x47')][_0xa804('0x23')](_0x2e25ee[_0xa804('0x64')][_0xa804('0x44')],{'where':{'MailAccountId':_0x115e13['id']}})['then'](function(){return _0x115e13;});})['then'](respondWithResult(_0x105e5f,null))['catch'](handleError(_0x105e5f,null));};exports[_0xa804('0x69')]=function(_0x12f049,_0x11afa8){return db[_0xa804('0x4a')][_0xa804('0x69')]()[_0xa804('0x24')](respondWithResult(_0x11afa8,null))[_0xa804('0x60')](handleError(_0x11afa8,null));};exports[_0xa804('0x6a')]=function(_0x3bba5f,_0x1fbe37){if(_0x3bba5f[_0xa804('0x64')]['id']){delete _0x3bba5f['body']['id'];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x3bba5f['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x1fbe37,null))[_0xa804('0x24')](function(_0x4e13ad){if(_0x4e13ad){_0x3bba5f['body'][_0xa804('0x6b')]=_0x4e13ad['id'];return db[_0xa804('0x6c')]['create'](_0x3bba5f[_0xa804('0x64')]);}})[_0xa804('0x24')](respondWithResult(_0x1fbe37,null))[_0xa804('0x60')](handleError(_0x1fbe37,null));};exports['getDispositions']=function(_0x4ecca3,_0xe4e1be){var _0x318bf9={'raw':![],'where':{}};var _0x23e31e={};var _0x14cdf8={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x4ecca3[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0xe4e1be,null))[_0xa804('0x24')](function(_0x5d2f7c){if(_0x5d2f7c){_0x23e31e[_0xa804('0x4e')]=_[_0xa804('0x50')](db[_0xa804('0x6c')][_0xa804('0x4b')]);_0x23e31e[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4ecca3[_0xa804('0x4f')]);_0x23e31e[_0xa804('0x51')]=_['intersection'](_0x23e31e['model'],_0x23e31e['query']);_0x318bf9['attributes']=_[_0xa804('0x53')](_0x23e31e[_0xa804('0x4e')],qs['fields'](_0x4ecca3[_0xa804('0x4f')][_0xa804('0x54')]));_0x318bf9['attributes']=_0x318bf9['attributes']['length']?_0x318bf9[_0xa804('0x52')]:_0x23e31e['model'];if(!_0x4ecca3[_0xa804('0x4f')]['hasOwnProperty'](_0xa804('0x57'))){_0x318bf9[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x4ecca3['query']['limit']);_0x318bf9['offset']=qs[_0xa804('0x1d')](_0x4ecca3[_0xa804('0x4f')][_0xa804('0x1d')]);}_0x318bf9[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x4ecca3[_0xa804('0x4f')]['sort']);_0x318bf9[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4ecca3['query'],_0x23e31e[_0xa804('0x51')]));_0x318bf9['where'][_0xa804('0x6b')]=_0x5d2f7c['id'];if(_0x4ecca3[_0xa804('0x4f')][_0xa804('0x5a')]){_0x318bf9['where']=_[_0xa804('0x5b')](_0x318bf9[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x318bf9[_0xa804('0x52')],function(_0x5ecae0){var _0x1c3d14={};_0x1c3d14[_0x5ecae0]={'$like':'%'+_0x4ecca3[_0xa804('0x4f')][_0xa804('0x5a')]+'%'};return _0x1c3d14;})});}_0x318bf9=_[_0xa804('0x5b')]({},_0x318bf9,_0x4ecca3[_0xa804('0x5c')]);return db['Disposition']['count']({'where':_0x318bf9[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x24d6e6){_0x14cdf8['count']=_0x24d6e6;if(_0x4ecca3[_0xa804('0x4f')]['includeAll']){_0x318bf9[_0xa804('0x5e')]=[{'all':!![]}];}return db[_0xa804('0x6c')]['findAll'](_0x318bf9);})[_0xa804('0x24')](function(_0x12c58d){_0x14cdf8[_0xa804('0x70')]=_0x12c58d;return _0x14cdf8;});}})[_0xa804('0x24')](respondWithFilteredResult(_0xe4e1be,_0x318bf9))[_0xa804('0x60')](handleError(_0xe4e1be,null));};exports[_0xa804('0x71')]=function(_0x4682aa,_0x19bca3){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4682aa[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x19bca3,null))[_0xa804('0x24')](function(_0x4f3cfb){if(_0x4f3cfb){return _0x4f3cfb['removeDispositions'](_0x4682aa[_0xa804('0x4f')][_0xa804('0x72')]);}})['then'](respondWithStatusCode(_0x19bca3,null))[_0xa804('0x60')](handleError(_0x19bca3,null));};exports[_0xa804('0x73')]=function(_0x54a124,_0x1170ec){if(_0x54a124[_0xa804('0x64')]['id']){delete _0x54a124['body']['id'];}return db['MailAccount'][_0xa804('0x63')]({'where':{'id':_0x54a124[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x1170ec,null))[_0xa804('0x24')](function(_0x147606){if(_0x147606){_0x54a124['body'][_0xa804('0x6b')]=_0x147606['id'];return db[_0xa804('0x74')][_0xa804('0x75')](_0x54a124[_0xa804('0x64')]);}})[_0xa804('0x24')](respondWithResult(_0x1170ec,null))['catch'](handleError(_0x1170ec,null));};exports[_0xa804('0x76')]=function(_0x4d755a,_0x3a5d70){var _0x2284f1={'raw':![],'where':{}};var _0x46652a={};var _0xb5e14f={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x4d755a[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x3a5d70,null))['then'](function(_0x31a4f2){if(_0x31a4f2){_0x46652a[_0xa804('0x4e')]=_['keys'](db[_0xa804('0x74')]['rawAttributes']);_0x46652a[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4d755a[_0xa804('0x4f')]);_0x46652a[_0xa804('0x51')]=_[_0xa804('0x53')](_0x46652a['model'],_0x46652a[_0xa804('0x4f')]);_0x2284f1[_0xa804('0x52')]=_['intersection'](_0x46652a['model'],qs[_0xa804('0x54')](_0x4d755a[_0xa804('0x4f')][_0xa804('0x54')]));_0x2284f1[_0xa804('0x52')]=_0x2284f1[_0xa804('0x52')]['length']?_0x2284f1[_0xa804('0x52')]:_0x46652a['model'];if(!_0x4d755a[_0xa804('0x4f')][_0xa804('0x56')]('nolimit')){_0x2284f1[_0xa804('0x1f')]=qs['limit'](_0x4d755a['query']['limit']);_0x2284f1['offset']=qs[_0xa804('0x1d')](_0x4d755a[_0xa804('0x4f')][_0xa804('0x1d')]);}_0x2284f1[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x4d755a[_0xa804('0x4f')]['sort']);_0x2284f1[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4d755a['query'],_0x46652a[_0xa804('0x51')]));_0x2284f1[_0xa804('0x59')][_0xa804('0x6b')]=_0x31a4f2['id'];if(_0x4d755a[_0xa804('0x4f')][_0xa804('0x5a')]){_0x2284f1[_0xa804('0x59')]=_['merge'](_0x2284f1['where'],{'$or':_[_0xa804('0x49')](_0x2284f1[_0xa804('0x52')],function(_0x33056b){var _0x389a91={};_0x389a91[_0x33056b]={'$like':'%'+_0x4d755a['query'][_0xa804('0x5a')]+'%'};return _0x389a91;})});}_0x2284f1=_[_0xa804('0x5b')]({},_0x2284f1,_0x4d755a[_0xa804('0x5c')]);return db['CannedAnswer'][_0xa804('0x20')]({'where':_0x2284f1[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x533043){_0xb5e14f['count']=_0x533043;if(_0x4d755a[_0xa804('0x4f')][_0xa804('0x5d')]){_0x2284f1[_0xa804('0x5e')]=[{'all':!![]}];}return db[_0xa804('0x74')][_0xa804('0x5f')](_0x2284f1);})[_0xa804('0x24')](function(_0x5073fd){_0xb5e14f[_0xa804('0x70')]=_0x5073fd;return _0xb5e14f;});}})[_0xa804('0x24')](respondWithFilteredResult(_0x3a5d70,_0x2284f1))[_0xa804('0x60')](handleError(_0x3a5d70,null));};exports[_0xa804('0x77')]=function(_0x5611a,_0x6438a){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x5611a[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x6438a,null))[_0xa804('0x24')](function(_0xe2a2ff){if(_0xe2a2ff){return _0xe2a2ff[_0xa804('0x77')](_0x5611a[_0xa804('0x4f')][_0xa804('0x72')]);}})[_0xa804('0x24')](respondWithStatusCode(_0x6438a,null))[_0xa804('0x60')](handleError(_0x6438a,null));};exports[_0xa804('0x75')]=function(_0x2a700d,_0x3acd0f){var _0x5e95db={'name':_0x2a700d[_0xa804('0x64')][_0xa804('0x29')],'key':_0x2a700d['body'][_0xa804('0x78')],'provider':_0x2a700d[_0xa804('0x64')][_0xa804('0x66')]===_0xa804('0x65')?null:_0x2a700d[_0xa804('0x64')][_0xa804('0x66')],'email':_0x2a700d[_0xa804('0x64')]['email'],'ListId':_0x2a700d[_0xa804('0x64')][_0xa804('0x79')],'active':!_[_0xa804('0x7a')](_0x2a700d[_0xa804('0x64')][_0xa804('0x7b')])?_0x2a700d[_0xa804('0x64')][_0xa804('0x7b')]:!![],'description':_0x2a700d[_0xa804('0x64')][_0xa804('0x7c')]||null};var _0xbd3b08=getAuthenticationOptions(_0x5e95db[_0xa804('0x66')],_0x2a700d[_0xa804('0x64')]);_0x5e95db[_0xa804('0x43')]=_0xbd3b08[_0xa804('0x43')];_0x5e95db[_0xa804('0x44')]=_0xbd3b08[_0xa804('0x44')];return db['MailAccount'][_0xa804('0x75')](_0x5e95db,{'include':[{'model':db[_0xa804('0x47')],'as':_0xa804('0x44')},{'model':db[_0xa804('0x46')],'as':_0xa804('0x43')}]})['then'](function(_0x2c81cd){var _0x641614=_0x2a700d['user']['get']({'plain':!![]});if(!_0x641614)throw new Error(_0xa804('0x7d'));if(_0x641614[_0xa804('0x7e')]===_0xa804('0x38')){var _0x399ce0=_0x2c81cd['get']({'plain':!![]});return db[_0xa804('0x7f')][_0xa804('0x63')]({'where':{'name':_0xa804('0x80'),'userProfileId':_0x641614[_0xa804('0x81')]},'raw':!![]})[_0xa804('0x24')](function(_0xef7333){if(_0xef7333&&_0xef7333[_0xa804('0x82')]===0x0){return db['UserProfileResource'][_0xa804('0x75')]({'name':_0x399ce0['name'],'resourceId':_0x399ce0['id'],'type':_0xef7333[_0xa804('0x29')],'sectionId':_0xef7333['id']},{})['then'](function(){return _0x2c81cd;});}else{return _0x2c81cd;}})[_0xa804('0x60')](function(_0x1143a8){logger[_0xa804('0x15')](_0xa804('0x83'),_0x1143a8);throw _0x1143a8;});}return _0x2c81cd;})[_0xa804('0x24')](respondWithResult(_0x3acd0f,0xc9))[_0xa804('0x60')](handleError(_0x3acd0f,null));};exports[_0xa804('0x84')]=function(_0x2964ef,_0x400665){return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x2964ef[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x400665,null))[_0xa804('0x24')](function(_0x3ff3a4){if(_0x3ff3a4){return _0x3ff3a4[_0xa804('0x84')]();}return null;})[_0xa804('0x24')](respondWithResult(_0x400665,null))[_0xa804('0x60')](handleError(_0x400665,null));};exports[_0xa804('0x85')]=function(_0x4e90da,_0x3774d2){if(_0x4e90da[_0xa804('0x64')]['id']){delete _0x4e90da[_0xa804('0x64')]['id'];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4e90da[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x3774d2,null))['then'](function(_0x1f9a43){if(_0x1f9a43){_0x4e90da[_0xa804('0x64')][_0xa804('0x6b')]=_0x1f9a43['id'];return db[_0xa804('0x46')]['create'](_0x4e90da[_0xa804('0x64')]);}})[_0xa804('0x24')](respondWithResult(_0x3774d2,null))[_0xa804('0x60')](handleError(_0x3774d2,null));};exports['removeImap']=function(_0x2221f9,_0x405c6e){return db[_0xa804('0x4a')]['findOne']({'where':{'id':_0x2221f9[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x405c6e,null))[_0xa804('0x24')](function(_0x1fcd0f){if(_0x1fcd0f){return _0x1fcd0f[_0xa804('0x86')](null);}return null;})[_0xa804('0x24')](respondWithStatusCode(_0x405c6e,null))[_0xa804('0x60')](handleError(_0x405c6e,null));};exports[_0xa804('0x87')]=function(_0x4b9344,_0x131e2a){return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x4b9344[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x131e2a,null))[_0xa804('0x24')](function(_0x2a4646){if(_0x2a4646){return _0x2a4646[_0xa804('0x87')]();}return null;})[_0xa804('0x24')](respondWithResult(_0x131e2a,null))[_0xa804('0x60')](handleError(_0x131e2a,null));};exports[_0xa804('0x88')]=function(_0x4e7cc5,_0x54fac5){if(_0x4e7cc5[_0xa804('0x64')]['id']){delete _0x4e7cc5[_0xa804('0x64')]['id'];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4e7cc5['params']['id']}})['then'](handleEntityNotFound(_0x54fac5,null))['then'](function(_0x51f136){if(_0x51f136){_0x4e7cc5[_0xa804('0x64')]['MailAccountId']=_0x51f136['id'];return db[_0xa804('0x47')][_0xa804('0x75')](_0x4e7cc5[_0xa804('0x64')]);}})['then'](respondWithResult(_0x54fac5,null))[_0xa804('0x60')](handleError(_0x54fac5,null));};exports[_0xa804('0x89')]=function(_0x48d0f9,_0x187d1d){return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x48d0f9[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x187d1d,null))['then'](function(_0x2a0062){if(_0x2a0062){return _0x2a0062[_0xa804('0x8a')](null);}return null;})[_0xa804('0x24')](respondWithStatusCode(_0x187d1d,null))[_0xa804('0x60')](handleError(_0x187d1d,null));};exports[_0xa804('0x8b')]=function(_0xb49440,_0x30e1d1){return db[_0xa804('0x8c')][_0xa804('0x63')]({'where':{'id':_0xb49440[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x30e1d1,null))[_0xa804('0x24')](function(_0x49d51a){if(_0x49d51a){return _0x49d51a['addInteraction'](_0xb49440[_0xa804('0x64')]['ids'],_['omit'](_0xb49440['body'],[_0xa804('0x72'),'id'])||{});}})[_0xa804('0x24')](respondWithResult(_0x30e1d1,null))[_0xa804('0x60')](handleError(_0x30e1d1,null));};exports[_0xa804('0x8d')]=function(_0x4fe676,_0x4ee135){var _0x4a1fe7={'raw':![],'where':{}};var _0x3e338c={};var _0x3c4c92={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x4fe676['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x4ee135,null))[_0xa804('0x24')](function(_0x447131){if(_0x447131){_0x3e338c[_0xa804('0x4e')]=_[_0xa804('0x50')](db['MailInteraction']['rawAttributes']);_0x3e338c[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4fe676[_0xa804('0x4f')]);_0x3e338c[_0xa804('0x51')]=_[_0xa804('0x53')](_0x3e338c['model'],_0x3e338c[_0xa804('0x4f')]);_0x4a1fe7[_0xa804('0x52')]=_[_0xa804('0x53')](_0x3e338c[_0xa804('0x4e')],qs['fields'](_0x4fe676[_0xa804('0x4f')]['fields']));_0x4a1fe7[_0xa804('0x52')]=_0x4a1fe7[_0xa804('0x52')][_0xa804('0x55')]?_0x4a1fe7[_0xa804('0x52')]:_0x3e338c[_0xa804('0x4e')];if(!_0x4fe676[_0xa804('0x4f')][_0xa804('0x56')](_0xa804('0x57'))){_0x4a1fe7['limit']=qs['limit'](_0x4fe676[_0xa804('0x4f')][_0xa804('0x1f')]);_0x4a1fe7[_0xa804('0x1d')]=qs['offset'](_0x4fe676[_0xa804('0x4f')][_0xa804('0x1d')]);}_0x4a1fe7['order']=qs['sort'](_0x4fe676[_0xa804('0x4f')][_0xa804('0x58')]);_0x4a1fe7['where']=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4fe676[_0xa804('0x4f')],_0x3e338c[_0xa804('0x51')]));_0x4a1fe7['where'][_0xa804('0x6b')]=_0x447131['id'];if(_0x4fe676[_0xa804('0x4f')][_0xa804('0x5a')]){_0x4a1fe7[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x4a1fe7[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x4a1fe7['attributes'],function(_0x48c8e8){var _0x41e04d={};_0x41e04d[_0x48c8e8]={'$like':'%'+_0x4fe676['query'][_0xa804('0x5a')]+'%'};return _0x41e04d;})});}_0x4a1fe7=_[_0xa804('0x5b')]({},_0x4a1fe7,_0x4fe676[_0xa804('0x5c')]);return db[_0xa804('0x8c')]['count']({'where':_0x4a1fe7[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x431ed0){_0x3c4c92[_0xa804('0x20')]=_0x431ed0;if(_0x4fe676[_0xa804('0x4f')]['includeAll']){_0x4a1fe7['include']=[{'model':db[_0xa804('0x8e')],'as':'Contact','required':![]},{'model':db[_0xa804('0x8f')],'as':'Owner','attributes':[_0xa804('0x29'),_0xa804('0x90'),'internal'],'required':![]},{'model':db[_0xa804('0x91')],'as':_0xa804('0x92'),'attributes':['id',_0xa804('0x29'),_0xa804('0x93')],'where':_0x4fe676[_0xa804('0x4f')][_0xa804('0x94')]?{'id':_0x4fe676[_0xa804('0x4f')][_0xa804('0x94')]}:undefined,'required':_0x4fe676[_0xa804('0x4f')][_0xa804('0x94')]?!![]:![]}];}return db['MailInteraction'][_0xa804('0x5f')](_0x4a1fe7);})['then'](function(_0x5302ef){_0x3c4c92['rows']=_0x5302ef;return _0x3c4c92;});}})[_0xa804('0x24')](respondWithFilteredResult(_0x4ee135,_0x4a1fe7))[_0xa804('0x60')](handleError(_0x4ee135,null));};exports[_0xa804('0x95')]=function addApplications(_0x883196,_0x38b00a){var _0x12bcb8=_0x883196['params']['id'];var _0x54ba22=_0x883196[_0xa804('0x64')];var _0x2b286e=0xc8;var _0x38142c=null;return db[_0xa804('0x96')]['transaction']({'isolationLevel':db[_0xa804('0x96')]['Transaction'][_0xa804('0x97')][_0xa804('0x98')]},function(_0x326e73){return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x12bcb8},'transaction':_0x326e73})[_0xa804('0x24')](function(_0x23e8d1){if(_0x23e8d1){return db[_0xa804('0x99')][_0xa804('0x25')]({'where':{'MailAccountId':_0x12bcb8},'transaction':_0x326e73})[_0xa804('0x24')](function(){var _0xa151b0=_['map'](_0x54ba22,function(_0x2d30e5){_0x2d30e5[_0xa804('0x6b')]=_0x12bcb8;return _0x2d30e5;});return db[_0xa804('0x99')][_0xa804('0x9a')](_0xa151b0,{'transaction':_0x326e73});});}else{_0x2b286e=0x194;_0x38142c=[];}});})[_0xa804('0x24')](function(){if(_0x2b286e!==0x194){return db[_0xa804('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0x12bcb8},'order':'priority'})['then'](function(_0x207567){_0x38142c=_0x207567;});}})[_0xa804('0x60')](function(_0x51cb26){_0x2b286e=0x1f4;logger[_0xa804('0x15')](_0x51cb26[_0xa804('0x28')]);if(_0x51cb26['name']){delete _0x51cb26[_0xa804('0x29')];}_0x38142c=_0x51cb26;})[_0xa804('0x9b')](function(){if(_0x38142c===null){_0x38b00a[_0xa804('0x19')](_0x2b286e);}else{if(_0x2b286e===0x1f4){_0x38b00a['status'](_0x2b286e)[_0xa804('0x2a')](_0x38142c);}else{_0x38b00a[_0xa804('0x1a')](_0x2b286e)['json'](_0x38142c);}}});};exports[_0xa804('0x9c')]=function(_0x27c5ab,_0x5006ac){var _0x5dca47={};var _0x56ad1e={};var _0x354ac4;var _0x416bb3;return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x27c5ab[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x5006ac,null))[_0xa804('0x24')](function(_0x176087){if(_0x176087){_0x354ac4=_0x176087;_0x56ad1e[_0xa804('0x4e')]=_[_0xa804('0x50')](db[_0xa804('0x99')][_0xa804('0x4b')]);_0x56ad1e[_0xa804('0x4f')]=_['keys'](_0x27c5ab[_0xa804('0x4f')]);_0x56ad1e['filters']=_[_0xa804('0x53')](_0x56ad1e[_0xa804('0x4e')],_0x56ad1e[_0xa804('0x4f')]);_0x5dca47['attributes']=_['intersection'](_0x56ad1e['model'],qs[_0xa804('0x54')](_0x27c5ab[_0xa804('0x4f')][_0xa804('0x54')]));_0x5dca47['attributes']=_0x5dca47[_0xa804('0x52')][_0xa804('0x55')]?_0x5dca47[_0xa804('0x52')]:_0x56ad1e[_0xa804('0x4e')];_0x5dca47[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x27c5ab[_0xa804('0x4f')][_0xa804('0x58')]);_0x5dca47['where']=qs[_0xa804('0x51')](_['pick'](_0x27c5ab[_0xa804('0x4f')],_0x56ad1e[_0xa804('0x51')]));if(_0x27c5ab[_0xa804('0x4f')][_0xa804('0x5a')]){_0x5dca47[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x5dca47['where'],{'$or':_[_0xa804('0x49')](_0x5dca47['attributes'],function(_0x11f777){var _0x54f39f={};_0x54f39f[_0x11f777]={'$like':'%'+_0x27c5ab['query']['filter']+'%'};return _0x54f39f;})});}_0x5dca47=_['merge']({},_0x5dca47,_0x27c5ab[_0xa804('0x5c')]);return _0x354ac4[_0xa804('0x9c')](_0x5dca47);}})['then'](function(_0x194f01){if(_0x194f01){_0x416bb3=_0x194f01[_0xa804('0x55')];if(!_0x27c5ab[_0xa804('0x4f')]['hasOwnProperty'](_0xa804('0x57'))){_0x5dca47[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x27c5ab[_0xa804('0x4f')][_0xa804('0x1f')]);_0x5dca47[_0xa804('0x1d')]=qs[_0xa804('0x1d')](_0x27c5ab['query']['offset']);}return _0x354ac4[_0xa804('0x9c')](_0x5dca47);}})[_0xa804('0x24')](function(_0x162f08){if(_0x162f08){return _0x162f08?{'count':_0x416bb3,'rows':_0x162f08}:null;}})['then'](respondWithResult(_0x5006ac,null))[_0xa804('0x60')](handleError(_0x5006ac,null));};exports[_0xa804('0x9d')]=function(_0x419bcc,_0x13218d){var _0x3f24dd={'raw':!![],'where':{}};var _0x25a367={};var _0x53189c={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x419bcc[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x13218d,null))[_0xa804('0x24')](function(_0x5868a7){if(_0x5868a7){_0x25a367[_0xa804('0x4e')]=_[_0xa804('0x50')](db[_0xa804('0x9e')][_0xa804('0x4b')]);_0x25a367['query']=_[_0xa804('0x50')](_0x419bcc[_0xa804('0x4f')]);_0x25a367[_0xa804('0x51')]=_[_0xa804('0x53')](_0x25a367['model'],_0x25a367[_0xa804('0x4f')]);_0x3f24dd[_0xa804('0x52')]=_[_0xa804('0x53')](_0x25a367[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x419bcc[_0xa804('0x4f')][_0xa804('0x54')]));_0x3f24dd[_0xa804('0x52')]=_0x3f24dd[_0xa804('0x52')][_0xa804('0x55')]?_0x3f24dd[_0xa804('0x52')]:_0x25a367[_0xa804('0x4e')];if(!_0x419bcc['query'][_0xa804('0x56')](_0xa804('0x57'))){_0x3f24dd[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x419bcc[_0xa804('0x4f')][_0xa804('0x1f')]);_0x3f24dd[_0xa804('0x1d')]=qs[_0xa804('0x1d')](_0x419bcc['query']['offset']);}_0x3f24dd[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x419bcc['query']['sort']);_0x3f24dd[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x419bcc['query'],_0x25a367[_0xa804('0x51')]));_0x3f24dd[_0xa804('0x59')]['MailAccountId']=_0x5868a7['id'];if(_0x419bcc[_0xa804('0x4f')][_0xa804('0x5a')]){_0x3f24dd[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x3f24dd[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x3f24dd[_0xa804('0x52')],function(_0x4189cc){var _0xa85223={};_0xa85223[_0x4189cc]={'$like':'%'+_0x419bcc['query'][_0xa804('0x5a')]+'%'};return _0xa85223;})});}if(_0x419bcc[_0xa804('0x4f')][_0xa804('0x9f')]){var _0x999f2=_0x419bcc[_0xa804('0x4f')][_0xa804('0x9f')][_0xa804('0xa0')](',');var _0x2261de={};_0x2261de[_0x999f2[0x0]]={'$gte':moment(_0x999f2[0x1])['format'](_0xa804('0xa1'))};_0x3f24dd[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x3f24dd['where'],_0x2261de);}_0x3f24dd=_[_0xa804('0x5b')]({},_0x3f24dd,_0x419bcc['options']);return db['MailMessage']['count']({'where':_0x3f24dd[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x284531){_0x53189c[_0xa804('0x20')]=_0x284531;if(_0x419bcc[_0xa804('0x4f')][_0xa804('0x5d')]){_0x3f24dd[_0xa804('0x5e')]=[{'all':!![]}];}return db['MailMessage'][_0xa804('0x5f')](_0x3f24dd);})[_0xa804('0x24')](function(_0x3bdb97){if(_0x419bcc[_0xa804('0x4f')][_0xa804('0xa2')]===_0xa804('0xa3')){for(var _0x2784e5=0x0;_0x2784e5<_0x3bdb97[_0xa804('0x55')];_0x2784e5++){_0x3bdb97[_0x2784e5][_0xa804('0x64')]=juice(_0x3bdb97[_0x2784e5]['body']);}}_0x53189c['rows']=_0x3bdb97;return _0x53189c;});}})['then'](respondWithFilteredResult(_0x13218d,_0x3f24dd))[_0xa804('0x60')](handleError(_0x13218d,null));};exports[_0xa804('0x2a')]=function(_0x4bc49d,_0x1e568d){var _0x66ceb6,_0x981ecf={},_0x459ae8;if(_0x4bc49d[_0xa804('0x64')]['to']){_0x459ae8=_0x4bc49d[_0xa804('0x64')]['to'][_0xa804('0xa0')](',')[0x0];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4bc49d['params']['id']},'include':[{'model':db[_0xa804('0xa4')],'as':_0xa804('0xa5'),'include':[{'model':db[_0xa804('0x8e')],'as':_0xa804('0xa6'),'where':{'email':_0x459ae8},'limit':0x1,'order':[[_0xa804('0xa7'),_0xa804('0xa8')]]}]},{'model':db[_0xa804('0x47')],'as':_0xa804('0x44'),'raw':!![],'include':[{'model':db[_0xa804('0xa9')],'as':_0xa804('0xa9'),'raw':!![]}]}]})[_0xa804('0x24')](handleEntityNotFound(_0x1e568d,null))[_0xa804('0x24')](function(_0x1d510c){if(!_0x1d510c)return;_0x66ceb6=_0x1d510c;if(!_0x1d510c[_0xa804('0x44')])throw new Error(_0xa804('0xaa'));if(_[_0xa804('0x7a')](_0x4bc49d['body'][_0xa804('0xab')])){_0x4bc49d[_0xa804('0x64')]['from']=util[_0xa804('0xac')]('%s\x20<%s>',_0x1d510c[_0xa804('0x29')],_0x1d510c[_0xa804('0xad')]||_0x1d510c['Smtp'][_0xa804('0x38')]);}if(_0x4bc49d[_0xa804('0x64')]['attachments']&&_0x4bc49d['body'][_0xa804('0xae')][_0xa804('0x55')]){for(var _0x2c0944=0x0;_0x2c0944<_0x4bc49d[_0xa804('0x64')]['attachments'][_0xa804('0x55')];_0x2c0944+=0x1){_0x4bc49d[_0xa804('0x64')][_0xa804('0xae')][_0x2c0944]={'filename':_0x4bc49d['body'][_0xa804('0xae')][_0x2c0944][_0xa804('0x29')],'path':path[_0xa804('0xaf')](config[_0xa804('0xb0')],'server/files/attachments',_0x4bc49d[_0xa804('0x64')][_0xa804('0xae')][_0x2c0944][_0xa804('0xb1')])};}}var _0x339e8e=_0x1d510c[_0xa804('0xb2')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x339e8e,'message':_0x4bc49d['body']});})['then'](function(_0x1aeec5){if(!_0x1aeec5)return;_0x981ecf=_0x1aeec5;if(!_0x66ceb6[_0xa804('0xa5')])throw new Error(_0xa804('0xb3'));if(_0x66ceb6[_0xa804('0xa5')][_0xa804('0xa6')][_0xa804('0x55')])return _0x66ceb6[_0xa804('0xa5')]['Contacts'][0x0];return db[_0xa804('0x8e')][_0xa804('0x75')](_['defaults'](_0x4bc49d['body'],{'firstName':_0x4bc49d[_0xa804('0x64')]['to'],'email':_0x4bc49d['body']['to'],'phone':_0x4bc49d[_0xa804('0x64')]['to'],'ListId':_0x66ceb6['ListId']}));})[_0xa804('0x24')](function(_0x20543b){if(!_0x20543b)return;var _0x4dfcca={'UserId':_0x4bc49d[_0xa804('0x38')]['id'],'ContactId':_0x20543b['id'],'MailAccountId':_0x66ceb6['id'],'inReplyTo':_0x981ecf[_0xa804('0xb4')],'to':_0x4bc49d[_0xa804('0x64')][_0xa804('0xab')],'cc':_0x4bc49d['body']['cc'],'subject':_0x4bc49d[_0xa804('0x64')]['subject'],'attach':_0x4bc49d[_0xa804('0x64')][_0xa804('0xb5')],'firstMsgDirection':_0xa804('0xb6'),'lastMsgAt':moment()[_0xa804('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xa804('0xb6'),'Messages':[_[_0xa804('0x5b')](_0x4bc49d[_0xa804('0x64')],{'messageId':_0x981ecf['messageId'],'sentAt':moment()[_0xa804('0xac')](_0xa804('0xa1')),'read':!![],'MailAccountId':_0x66ceb6['id'],'UserId':_0x4bc49d[_0xa804('0x38')]['id'],'ContactId':_0x20543b['id']})]};if(_0x4bc49d[_0xa804('0x64')][_0xa804('0xb7')]){_0x4dfcca=_[_0xa804('0x5b')](_0x4dfcca,_0x4bc49d[_0xa804('0x64')][_0xa804('0xb7')]);}return db[_0xa804('0x8c')][_0xa804('0x75')](_0x4dfcca,{'include':[{'model':db[_0xa804('0x9e')],'as':_0xa804('0xb8')}]});})[_0xa804('0x24')](respondWithResult(_0x1e568d,null))['catch'](handleError(_0x1e568d,null));};exports[_0xa804('0xb9')]=function(_0x10407b,_0x3da43e){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x10407b[_0xa804('0x62')]['id']},'include':[{'model':db[_0xa804('0x47')],'as':_0xa804('0x44'),'raw':!![],'include':[{'model':db[_0xa804('0xa9')],'as':_0xa804('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3da43e,null))[_0xa804('0x24')](function(_0x387529){if(!_0x387529[_0xa804('0x44')])return;var _0x26ffd5=_0x387529[_0xa804('0xb2')]();return respondWithRpcPromise(_0xa804('0xba'),_0xa804('0xb9'),{'account':_0x26ffd5});})[_0xa804('0x24')](respondWithResult(_0x3da43e,null))['catch'](handleError(_0x3da43e,null));};exports['destroy']=function(_0x73dbd6,_0x3b5906){return db['MailAccount']['find']({'where':{'id':_0x73dbd6['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x3b5906,null))[_0xa804('0x24')](function(_0x9aa953){if(_0x9aa953&&_0x9aa953[_0xa804('0x40')]){throw new db[(_0xa804('0xbb'))][(_0xa804('0xbc'))](_0xa804('0xbd'));}return _0x9aa953;})[_0xa804('0x24')](removeEntity(_0x3b5906,null))['catch'](handleError(_0x3b5906,null));};exports['addAgents']=function(_0x4131c9,_0x2f3813){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4131c9['params']['id']}})['then'](handleEntityNotFound(_0x2f3813,null))[_0xa804('0x24')](function(_0x44b29b){if(_0x44b29b){return _0x44b29b[_0xa804('0xbe')](_0x4131c9[_0xa804('0x64')][_0xa804('0x72')],_[_0xa804('0xbf')](_0x4131c9['body'],[_0xa804('0x72'),'id'])||{})[_0xa804('0xc0')](function(_0x21251b){for(var _0x1c3d1e=0x0;_0x1c3d1e<_0x4131c9['body'][_0xa804('0x72')][_0xa804('0x55')];_0x1c3d1e+=0x1){socket[_0xa804('0xc1')](_0xa804('0xc2'),{'UserId':Number(_0x4131c9[_0xa804('0x64')][_0xa804('0x72')][_0x1c3d1e]),'MailAccountId':Number(_0x4131c9[_0xa804('0x62')]['id'])});}return _0x21251b;});}})[_0xa804('0x24')](respondWithResult(_0x2f3813,null))[_0xa804('0x60')](handleError(_0x2f3813,null));};exports[_0xa804('0xc3')]=function(_0x5e210b,_0x21e88b){return db[_0xa804('0x4a')]['find']({'where':{'id':_0x5e210b[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x21e88b,null))[_0xa804('0x24')](function(_0xf738af){if(_0xf738af){return _0xf738af[_0xa804('0xc3')](_0x5e210b[_0xa804('0x4f')]['ids'])[_0xa804('0x24')](function(){if(_[_0xa804('0xc4')](_0x5e210b['query']['ids'])){for(var _0x362bdb=0x0;_0x362bdb<_0x5e210b['query'][_0xa804('0x72')][_0xa804('0x55')];_0x362bdb+=0x1){socket[_0xa804('0xc1')](_0xa804('0xc5'),{'UserId':Number(_0x5e210b[_0xa804('0x4f')][_0xa804('0x72')][_0x362bdb]),'MailAccountId':Number(_0x5e210b[_0xa804('0x62')]['id'])});}}else{socket[_0xa804('0xc1')](_0xa804('0xc5'),{'UserId':Number(_0x5e210b[_0xa804('0x4f')][_0xa804('0x72')]),'MailAccountId':Number(_0x5e210b['params']['id'])});}});}})[_0xa804('0x24')](respondWithStatusCode(_0x21e88b,null))[_0xa804('0x60')](handleError(_0x21e88b,null));};exports[_0xa804('0xc6')]=function(_0x4d6c3e,_0x2af9e2){var _0x43e402={};var _0x2e70bb={};var _0x1bccaf;var _0x23bb58;return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x4d6c3e['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x2af9e2,null))[_0xa804('0x24')](function(_0x2dc66e){if(_0x2dc66e){_0x1bccaf=_0x2dc66e;_0x2e70bb['model']=_[_0xa804('0x50')](db[_0xa804('0x8f')]['rawAttributes']);_0x2e70bb[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4d6c3e['query']);_0x2e70bb[_0xa804('0x51')]=_[_0xa804('0x53')](_0x2e70bb[_0xa804('0x4e')],_0x2e70bb[_0xa804('0x4f')]);_0x43e402[_0xa804('0x52')]=_[_0xa804('0x53')](_0x2e70bb[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x4d6c3e[_0xa804('0x4f')][_0xa804('0x54')]));_0x43e402['attributes']=_0x43e402[_0xa804('0x52')]['length']?_0x43e402[_0xa804('0x52')]:_0x2e70bb['model'];_0x43e402[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x4d6c3e[_0xa804('0x4f')][_0xa804('0x58')]);_0x43e402[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4d6c3e[_0xa804('0x4f')],_0x2e70bb[_0xa804('0x51')]));if(_0x4d6c3e['query'][_0xa804('0x5a')]){_0x43e402[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x43e402[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x43e402[_0xa804('0x52')],function(_0x410e7b){var _0x3bde06={};_0x3bde06[_0x410e7b]={'$like':'%'+_0x4d6c3e[_0xa804('0x4f')][_0xa804('0x5a')]+'%'};return _0x3bde06;})});}_0x43e402=_['merge']({},_0x43e402,_0x4d6c3e[_0xa804('0x5c')]);return _0x1bccaf[_0xa804('0xc6')](_0x43e402);}})[_0xa804('0x24')](function(_0x6356a7){if(_0x6356a7){_0x23bb58=_0x6356a7[_0xa804('0x55')];if(!_0x4d6c3e[_0xa804('0x4f')]['hasOwnProperty']('nolimit')){_0x43e402[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x4d6c3e[_0xa804('0x4f')]['limit']);_0x43e402['offset']=qs['offset'](_0x4d6c3e['query'][_0xa804('0x1d')]);}return _0x1bccaf['getAgents'](_0x43e402);}})[_0xa804('0x24')](function(_0x4c6529){if(_0x4c6529){return _0x4c6529?{'count':_0x23bb58,'rows':_0x4c6529}:null;}})[_0xa804('0x24')](respondWithResult(_0x2af9e2,null))['catch'](handleError(_0x2af9e2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index bea124a..e74539a 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 _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 +var _0x0b36=['MailAccount','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x2a90b5,_0x3e29f6){var _0x5c6728=function(_0x25e0bf){while(--_0x25e0bf){_0x2a90b5['push'](_0x2a90b5['shift']());}};_0x5c6728(++_0x3e29f6);}(_0x0b36,0x10c));var _0x60b3=function(_0x5d3956,_0x697661){_0x5d3956=_0x5d3956-0x0;var _0x17325f=_0x0b36[_0x5d3956];return _0x17325f;};'use strict';var EventEmitter=require(_0x60b3('0x0'));var MailAccount=require(_0x60b3('0x1'))['db'][_0x60b3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x60b3('0x3')};function emitEvent(_0x530d5b){return function(_0xa0e029,_0x19dbae,_0x3afbc7){MailAccountEvents[_0x60b3('0x4')](_0x530d5b+':'+_0xa0e029['id'],_0xa0e029);MailAccountEvents[_0x60b3('0x4')](_0x530d5b,_0xa0e029);_0x3afbc7(null);};}for(var e in events){if(events[_0x60b3('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2b06947..ff63346 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 _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 +var _0x8f0f=['port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','auth','define','MailAccount','custom','Smtp','host'];(function(_0x465da7,_0x495254){var _0x3bcb75=function(_0x17da61){while(--_0x17da61){_0x465da7['push'](_0x465da7['shift']());}};_0x3bcb75(++_0x495254);}(_0x8f0f,0x79));var _0xf8f0=function(_0xe858c0,_0x124a9a){_0xe858c0=_0xe858c0-0x0;var _0x23043d=_0x8f0f[_0xe858c0];return _0x23043d;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x2d70cb){return _0x2d70cb[_0xf8f0('0x0')](_0xf8f0('0x1'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1bb821=this;var _0x1cab7c={'id':_0x1bb821['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1bb821['provider']!==_0xf8f0('0x2')){_0x1cab7c['service']=_0x1bb821['provider'];}else{_0x1cab7c['host']=_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x4')];_0x1cab7c[_0xf8f0('0x5')]=_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x5')];_0x1cab7c[_0xf8f0('0x6')]=_0x1bb821['Smtp']['secure'];}if(_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x7')]){if(_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x8')]){if(!_0x1bb821['Smtp'][_0xf8f0('0x9')])throw new Error(_0xf8f0('0xa'));_0x1cab7c['auth']={'type':_0xf8f0('0xb'),'user':_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0xc')],'accessToken':_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x9')]['data5']};}else{_0x1cab7c[_0xf8f0('0xd')]={'user':_0x1bb821['Smtp'][_0xf8f0('0xc')],'pass':_0x1bb821[_0xf8f0('0x3')]['pass']};}}return _0x1cab7c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a7bfa9c..cc2b7b9 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 _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 +var _0x236d=['created','MailMessage','originTo','bcc','ChatWebsiteId','originChannel','Attachment','Attachments','User','UserId','unshift','name','waitForTheAssignedAgent','queueId','MailQueue','waitForTheAssignedQueue','startRouting','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','GetMailAccount','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','List','applications','list','orderBy','asc','autoclose','push','close','*,*,*,*','length','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','spread','update','format','interaction'];(function(_0x56740d,_0x1e9994){var _0x4718d8=function(_0x84d815){while(--_0x84d815){_0x56740d['push'](_0x56740d['shift']());}};_0x4718d8(++_0x1e9994);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd236('0x0'));var moment=require(_0xd236('0x1'));var BPromise=require('bluebird');var rs=require(_0xd236('0x2'));var Redis=require('ioredis');var db=require(_0xd236('0x3'))['db'];var logger=require(_0xd236('0x4'))(_0xd236('0x5'));var config=require(_0xd236('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd236('0x7')]({'port':0x232c});config[_0xd236('0x8')]=_[_0xd236('0x9')](config[_0xd236('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd236('0x8')]));require(_0xd236('0xa'))['register'](socket);function respondWithRpcPromise(_0x186a0b,_0x110545,_0x5a3447){return new BPromise(function(_0x3d11c7,_0x29ba1d){return client[_0xd236('0xb')](_0x186a0b,_0x5a3447)['then'](function(_0x470524){logger[_0xd236('0xc')](_0xd236('0xd'),_0x110545,'request\x20sent');logger[_0xd236('0xe')](_0xd236('0xf'),_0x110545,_0xd236('0x10'),JSON[_0xd236('0x11')](_0x470524));if(_0x470524[_0xd236('0x12')]){if(_0x470524[_0xd236('0x12')][_0xd236('0x13')]===0x1f4){logger[_0xd236('0x12')](_0xd236('0xd'),_0x110545,_0x470524[_0xd236('0x12')][_0xd236('0x14')]);return _0x29ba1d(_0x470524[_0xd236('0x12')][_0xd236('0x14')]);}logger[_0xd236('0x12')](_0xd236('0xd'),_0x110545,_0x470524[_0xd236('0x12')][_0xd236('0x14')]);return _0x3d11c7(_0x470524[_0xd236('0x12')][_0xd236('0x14')]);}else{logger[_0xd236('0xc')]('MailAccount,\x20%s,\x20%s',_0x110545,'request\x20sent');_0x3d11c7(_0x470524[_0xd236('0x15')][_0xd236('0x14')]);}})['catch'](function(_0x11c6ec){logger[_0xd236('0x12')](_0xd236('0xd'),_0x110545,_0x11c6ec);_0x29ba1d(_0x11c6ec);});});}exports['GetMailAccount']=function(_0x355b65){var _0x1b6aaa=this;return new Promise(function(_0x31f0bb,_0x551b53){return db[_0xd236('0x16')][_0xd236('0x17')]({'raw':_0x355b65[_0xd236('0x18')]?_0x355b65[_0xd236('0x18')][_0xd236('0x19')]===undefined?!![]:![]:!![],'where':_0x355b65['options']?_0x355b65[_0xd236('0x18')][_0xd236('0x1a')]||null:null,'attributes':_0x355b65[_0xd236('0x18')]?_0x355b65[_0xd236('0x18')][_0xd236('0x1b')]||null:null,'limit':_0x355b65['options']?_0x355b65['options'][_0xd236('0x1c')]||null:null,'include':_0x355b65['options']?_0x355b65[_0xd236('0x18')]['include']?_[_0xd236('0x1d')](_0x355b65[_0xd236('0x18')][_0xd236('0x1e')],function(_0x49d822){return{'model':db[_0x49d822[_0xd236('0x1f')]],'as':_0x49d822['as'],'attributes':_0x49d822[_0xd236('0x1b')],'include':_0x49d822[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x49d822[_0xd236('0x1e')],function(_0x17f927){return{'model':db[_0x17f927[_0xd236('0x1f')]],'as':_0x17f927['as'],'attributes':_0x17f927[_0xd236('0x1b')],'include':_0x17f927[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x17f927[_0xd236('0x1e')],function(_0x2af382){return{'model':db[_0x2af382[_0xd236('0x1f')]],'as':_0x2af382['as'],'attributes':_0x2af382[_0xd236('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd236('0x20')](function(_0x28175d){logger[_0xd236('0xc')](_0xd236('0x21'),_0x355b65);logger[_0xd236('0xe')](_0xd236('0x21'),_0x355b65,JSON[_0xd236('0x11')](_0x28175d));_0x31f0bb(_0x28175d);})[_0xd236('0x22')](function(_0x3c1617){logger[_0xd236('0x12')](_0xd236('0x21'),_0x3c1617[_0xd236('0x14')],_0x355b65);_0x551b53(_0x1b6aaa[_0xd236('0x12')](0x1f4,_0x3c1617[_0xd236('0x14')]));});});};exports[_0xd236('0x23')]=function(_0x52a556){var _0xf50f02=this;return new Promise(function(_0x4ece4b,_0x2168a1){return db[_0xd236('0x16')][_0xd236('0x24')]({'raw':_0x52a556['options']?_0x52a556[_0xd236('0x18')][_0xd236('0x19')]===undefined?!![]:![]:!![],'where':_0x52a556[_0xd236('0x18')]?_0x52a556[_0xd236('0x18')][_0xd236('0x1a')]||null:null,'attributes':_0x52a556[_0xd236('0x18')]?_0x52a556[_0xd236('0x18')]['attributes']||null:null,'include':_0x52a556[_0xd236('0x18')]?_0x52a556['options'][_0xd236('0x1e')]?_['map'](_0x52a556[_0xd236('0x18')][_0xd236('0x1e')],function(_0x366128){return{'model':db[_0x366128[_0xd236('0x1f')]],'as':_0x366128['as'],'attributes':_0x366128[_0xd236('0x1b')],'include':_0x366128[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x366128[_0xd236('0x1e')],function(_0x450217){return{'model':db[_0x450217[_0xd236('0x1f')]],'as':_0x450217['as'],'attributes':_0x450217[_0xd236('0x1b')],'include':_0x450217[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x450217['include'],function(_0x414f55){return{'model':db[_0x414f55[_0xd236('0x1f')]],'as':_0x414f55['as'],'attributes':_0x414f55[_0xd236('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cb19a){if(_0x52a556[_0xd236('0x18')][_0xd236('0x25')]===!![])_0x2cb19a[_0xd236('0x26')](_0xd236('0x27'),_0x2cb19a[_0xd236('0x28')]());logger['info'](_0xd236('0x23'),_0x52a556);logger[_0xd236('0xe')](_0xd236('0x23'),_0x52a556,JSON[_0xd236('0x11')](_0x2cb19a));_0x4ece4b(_0x2cb19a);})[_0xd236('0x22')](function(_0x222495){logger['error'](_0xd236('0x23'),_0x222495[_0xd236('0x14')],_0x52a556);_0x2168a1(_0xf50f02[_0xd236('0x12')](0x1f4,_0x222495['message']));});});};exports[_0xd236('0x29')]=function(_0x5a8b18){var _0x442c6f=this;return new Promise(function(_0x5793bf,_0x55c4d9){var _0x29268e={'body':_0x5a8b18[_0xd236('0x2a')],'channel':_0xd236('0x2b')};var _0x276f11=_[_0xd236('0x2c')](_['keys'](db['CmContact'][_0xd236('0x2d')]),[_0xd236('0x2e'),'updatedAt',_0xd236('0x2f'),_0xd236('0x30')]);var _0x2d815b=![];if(_0x5a8b18['body']['id']){delete _0x5a8b18['body']['id'];}if(_['isNil'](_0x5a8b18[_0xd236('0x2a')]['from'])){return _0x55c4d9(_0x442c6f['error'](0x1f4,_0xd236('0x31')));}if(_[_0xd236('0x32')](_0x5a8b18[_0xd236('0x2a')][_0xd236('0x2a')])||_0x5a8b18[_0xd236('0x2a')]['body']===''){return _0x55c4d9(_0x442c6f['error'](0x1f4,_0xd236('0x33')));}if(_[_0xd236('0x32')](_0x5a8b18[_0xd236('0x2a')][_0xd236('0x34')])){return _0x55c4d9(_0x442c6f[_0xd236('0x12')](0x1f4,_0xd236('0x35')+_0x276f11));}if(!_['includes'](_0x276f11,_0x5a8b18[_0xd236('0x2a')]['mapKey'])){return _0x55c4d9(_0x442c6f[_0xd236('0x12')](0x1f4,_0xd236('0x36')+_0x276f11));}var _0x57c0cf={};_0x57c0cf[_0x5a8b18['body']['mapKey']]=_0x5a8b18['body'][_0xd236('0x37')];return db[_0xd236('0x16')][_0xd236('0x24')]({'where':{'id':_0x5a8b18[_0xd236('0x38')]['id']},'include':[{'model':db[_0xd236('0x39')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd236('0x3a'),'where':_0x57c0cf,'limit':0x1,'order':[[_0xd236('0x3b'),_0xd236('0x3c')]]}]},{'model':db[_0xd236('0x3d')],'as':_0xd236('0x3e')},{'model':db[_0xd236('0x3f')],'as':'Smtp','include':[{'model':db[_0xd236('0x40')],'as':'CloudProvider'}]}]})[_0xd236('0x20')](function(_0x2c8861){if(_0x2c8861&&_0x2c8861['List']){var _0x22cb72=_0x2c8861[_0xd236('0x41')]({'plain':!![]});_0x29268e['account']=_['omit'](_0x22cb72,[_0xd236('0x3e'),_0xd236('0x42')]);_0x29268e[_0xd236('0x38')][_0xd236('0x27')]=_0x2c8861['getSmtpOptions']();_0x29268e[_0xd236('0x43')]=_0x22cb72[_0xd236('0x3e')];_0x29268e[_0xd236('0x44')]=_0x22cb72[_0xd236('0x42')];_0x29268e[_0xd236('0x43')]=_[_0xd236('0x45')](_0x29268e['applications'],['priority'],[_0xd236('0x46')]);if(_0x29268e['account']&&_0x29268e[_0xd236('0x38')][_0xd236('0x47')]){_0x29268e['applications'][_0xd236('0x48')]({'id':0x0,'priority':_0x29268e[_0xd236('0x43')]['length']+0x1,'app':_0xd236('0x49'),'appdata':_0xd236('0x47'),'interval':_0xd236('0x4a')});}if(_0x29268e[_0xd236('0x38')]['Applications']){delete _0x29268e['account'][_0xd236('0x3e')];}if(_0x29268e[_0xd236('0x38')]['List']){delete _0x29268e[_0xd236('0x38')][_0xd236('0x42')];}if(_0x22cb72[_0xd236('0x42')][_0xd236('0x3a')][_0xd236('0x4b')]){return _0x22cb72['List'][_0xd236('0x3a')][0x0];}var _0x45a2c1=_[_0xd236('0x9')](_0x5a8b18['body'],{'firstName':_0x5a8b18[_0xd236('0x2a')]['from'],'ListId':_0x22cb72['ListId']});_0x45a2c1[_0x5a8b18[_0xd236('0x2a')][_0xd236('0x34')]]=_0x5a8b18[_0xd236('0x2a')][_0xd236('0x37')];return db[_0xd236('0x4c')][_0xd236('0x4d')](_0x45a2c1);}else{throw new Error(_0xd236('0x4e'));}})['then'](function(_0x4291a1){_0x29268e[_0xd236('0x4f')]=_0x4291a1;if(_0x4291a1){if(!_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')][_0xd236('0x50')]){_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x50')]=rs[_0xd236('0x51')]()+'\x20'+_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x37')];}var _0x6f83a2={'ContactId':_0x4291a1['id'],'MailAccountId':_0x5a8b18[_0xd236('0x38')]['id'],'inReplyTo':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x50')],'to':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['from'],'cc':_0x5a8b18[_0xd236('0x2a')]['message']['cc'],'subject':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x52')],'attach':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x53')],'lastMsgAt':moment()['format'](_0xd236('0x54')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd236('0x24')]({'where':{'closed':![],'MailAccountId':_0x5a8b18[_0xd236('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':_0xd236('0x55'),'attributes':[_0xd236('0x50')],'where':{'messageId':_0x5a8b18['body']['message'][_0xd236('0x56')]}}]})[_0xd236('0x20')](function(_0x4c5527){if(_0x4c5527){return[_0x4c5527,![]];}return db[_0xd236('0x57')]['create'](_0x6f83a2)[_0xd236('0x20')](function(_0x13bb7a){return[_0x13bb7a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd236('0x58')](function(_0x3d3954,_0x275f2b){if(_0x3d3954){_0x2d815b=_0x275f2b;if(!_0x275f2b){return _0x3d3954[_0xd236('0x59')]({'inReplyTo':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x50')],'to':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x37')],'cc':_0x5a8b18['body'][_0xd236('0x14')]['cc'],'subject':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['subject'],'attach':_0x3d3954[_0xd236('0x53')]?_0x3d3954[_0xd236('0x53')]:_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['attach'],'substatus':null,'substatusAt':moment()[_0xd236('0x5a')](_0xd236('0x54')),'lastMsgAt':moment()[_0xd236('0x5a')](_0xd236('0x54')),'lastMsgDirection':'in'});}else{return _0x3d3954;}}})['then'](function(_0x48e465){_0x29268e[_0xd236('0x5b')]=_0x48e465['get']({'plain':!![]});_0x29268e['interaction'][_0xd236('0x5c')]=_0x2d815b;return db[_0xd236('0x5d')][_0xd236('0x4d')]({'body':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x2a')],'MailAccountId':_0x5a8b18[_0xd236('0x38')]['id'],'MailInteractionId':_0x48e465['id'],'direction':'in','ContactId':_0x29268e[_0xd236('0x4f')]['id'],'messageId':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x50')],'from':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x37')],'to':_0x5a8b18[_0xd236('0x2a')]['message']['to'],'cc':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['cc'],'subject':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x52')],'attach':_0x5a8b18[_0xd236('0x2a')]['message']['attach'],'Attachments':_0x5a8b18['body'][_0xd236('0x14')]['attachments'],'originTo':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x5e')],'originCc':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['originCc'],'bcc':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')][_0xd236('0x5f')],'ChatWebsiteId':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x60')]||null,'originChannel':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')][_0xd236('0x61')]||'Email','ChatOfflineMessageId':_0x5a8b18['body'][_0xd236('0x14')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xd236('0x62')],'as':_0xd236('0x63')}]});})[_0xd236('0x20')](function(_0x4d22e9){_0x29268e[_0xd236('0x14')]=_0x4d22e9;if(!_0x29268e[_0xd236('0x5b')]['UserId']){return;}return db[_0xd236('0x64')][_0xd236('0x24')]({'attributes':['id','name'],'where':{'id':_0x29268e[_0xd236('0x5b')][_0xd236('0x65')]}});})['then'](function(_0x47e7b2){if(_0x47e7b2){_0x29268e[_0xd236('0x43')][_0xd236('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x47e7b2[_0xd236('0x67')]+','+(_0x29268e['account'][_0xd236('0x68')]||0xa),'interval':_0xd236('0x4a')});}if(!_0x29268e['interaction'][_0xd236('0x69')]){return;}return db[_0xd236('0x6a')]['find']({'attributes':['id',_0xd236('0x67')],'where':{'id':_0x29268e['interaction'][_0xd236('0x69')]}});})[_0xd236('0x20')](function(_0x21543c){if(_0x21543c){_0x29268e[_0xd236('0x43')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x21543c[_0xd236('0x67')]+','+(_0x29268e['account'][_0xd236('0x6b')]||0x12c),'interval':_0xd236('0x4a')});}return respondWithRpcPromise('Start',_0xd236('0x6c'),_0x29268e);})[_0xd236('0x20')](function(_0x4f02e7){_0x5793bf(_0x4f02e7);})[_0xd236('0x22')](function(_0x3b4e4c){_0x55c4d9(_0x442c6f[_0xd236('0x12')](0x1f4,_0x3b4e4c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 41571ab..1b9d7fc 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 _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 +var _0x0135=['./mailAccount.events','save','remove','update','emit','register','mailAccount:'];(function(_0x566909,_0x5af4c6){var _0x104652=function(_0x51df5b){while(--_0x51df5b){_0x566909['push'](_0x566909['shift']());}};_0x104652(++_0x5af4c6);}(_0x0135,0x188));var _0x5013=function(_0x283093,_0x103dc4){_0x283093=_0x283093-0x0;var _0x37d60c=_0x0135[_0x283093];return _0x37d60c;};'use strict';var MailAccountEvents=require(_0x5013('0x0'));var events=[_0x5013('0x1'),_0x5013('0x2'),_0x5013('0x3')];function createListener(_0x5d17da,_0x535319){return function(_0x51204c){_0x535319[_0x5013('0x4')](_0x5d17da,_0x51204c);};}function removeListener(_0x4e3d33,_0x23ff8b){return function(){MailAccountEvents['removeListener'](_0x4e3d33,_0x23ff8b);};}exports[_0x5013('0x5')]=function(_0x18e91b){for(var _0x5046c8=0x0,_0x524c20=events['length'];_0x5046c8<_0x524c20;_0x5046c8++){var _0x4a75fd=events[_0x5046c8];var _0x45c147=createListener(_0x5013('0x6')+_0x4a75fd,_0x18e91b);MailAccountEvents['on'](_0x4a75fd,_0x45c147);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1a02beb..729867d 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 _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 +var _0x3024=['../../config/environment','get','/:id','isAuthenticated','show','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc1e28d,_0x3b1460){var _0x25fdf9=function(_0x9fdee5){while(--_0x9fdee5){_0xc1e28d['push'](_0xc1e28d['shift']());}};_0x25fdf9(++_0x3b1460);}(_0x3024,0x180));var _0x4302=function(_0x43b141,_0x14e681){_0x43b141=_0x43b141-0x0;var _0x1f0d6a=_0x3024[_0x43b141];return _0x1f0d6a;};'use strict';var multer=require(_0x4302('0x0'));var util=require('util');var path=require(_0x4302('0x1'));var timeout=require('connect-timeout');var express=require(_0x4302('0x2'));var router=express[_0x4302('0x3')]();var fs_extra=require(_0x4302('0x4'));var auth=require(_0x4302('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4302('0x6'));var controller=require('./mailApplication.controller');router[_0x4302('0x7')](_0x4302('0x8'),auth[_0x4302('0x9')](),controller[_0x4302('0xa')]);router['put'](_0x4302('0x8'),auth[_0x4302('0x9')](),controller[_0x4302('0xb')]);router['delete'](_0x4302('0x8'),auth[_0x4302('0x9')](),controller['destroy']);module[_0x4302('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 63b0a5c..026650d 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 _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 +var _0xe583=['STRING','*,*,*,*','sequelize','exports','noop','TEXT'];(function(_0x1dbc55,_0x2e0bb0){var _0x498980=function(_0x26a1d0){while(--_0x26a1d0){_0x1dbc55['push'](_0x1dbc55['shift']());}};_0x498980(++_0x2e0bb0);}(_0xe583,0x194));var _0x3e58=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe583[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0x3e58('0x0'));module[_0x3e58('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3e58('0x2')},'appdata':{'type':Sequelize[_0x3e58('0x3')]()},'description':{'type':Sequelize[_0x3e58('0x4')]},'interval':{'type':Sequelize[_0x3e58('0x4')],'defaultValue':_0x3e58('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7600576..79be95d 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 _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 +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(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x9bde,0xe1));var _0xe9bd=function(_0x23266c,_0x45bfd9){_0x23266c=_0x23266c-0x0;var _0x5a0da5=_0x9bde[_0x23266c];return _0x5a0da5;};'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 diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f7cd61e..8f873da 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 _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 +var _0x853d=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x853d,0xa9));var _0xd853=function(_0x580027,_0x5fa2dd){_0x580027=_0x580027-0x0;var _0x2f4af0=_0x853d[_0x580027];return _0x2f4af0;};'use strict';var _=require(_0xd853('0x0'));var util=require('util');var logger=require(_0xd853('0x1'))(_0xd853('0x2'));var moment=require('moment');var BPromise=require(_0xd853('0x3'));var rp=require(_0xd853('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd853('0x5'));var attributes=require(_0xd853('0x6'));module['exports']=function(_0x47ccbb,_0x2b7d61){return _0x47ccbb[_0xd853('0x7')](_0xd853('0x8'),attributes,{'tableName':_0xd853('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd853('0xa'),'collate':_0xd853('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e4e5792..dfaa261 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 _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 +var _0x6e15=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','MailApplication','body','options','raw','where','attributes','limit','UpdateMailApplication','stringify','catch','lodash','util','bluebird','ioredis'];(function(_0x592cd8,_0x515308){var _0x46959d=function(_0x584132){while(--_0x584132){_0x592cd8['push'](_0x592cd8['shift']());}};_0x46959d(++_0x515308);}(_0x6e15,0xf8));var _0x56e1=function(_0x297a9a,_0x3f317b){_0x297a9a=_0x297a9a-0x0;var _0x20e58e=_0x6e15[_0x297a9a];return _0x20e58e;};'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('../../config/utils');var logger=require(_0x56e1('0x5'))(_0x56e1('0x6'));var config=require(_0x56e1('0x7'));var jayson=require(_0x56e1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5398e4,_0xfdd1ee,_0x1a5443){return new BPromise(function(_0x547965,_0x2f9afa){return client['request'](_0x5398e4,_0x1a5443)[_0x56e1('0x9')](function(_0x4244a9){logger[_0x56e1('0xa')](_0x56e1('0xb'),_0xfdd1ee,'request\x20sent');logger[_0x56e1('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0xfdd1ee,_0x56e1('0xd'),JSON['stringify'](_0x4244a9));if(_0x4244a9[_0x56e1('0xe')]){if(_0x4244a9[_0x56e1('0xe')][_0x56e1('0xf')]===0x1f4){logger['error'](_0x56e1('0xb'),_0xfdd1ee,_0x4244a9[_0x56e1('0xe')]['message']);return _0x2f9afa(_0x4244a9[_0x56e1('0xe')][_0x56e1('0x10')]);}logger[_0x56e1('0xe')](_0x56e1('0xb'),_0xfdd1ee,_0x4244a9[_0x56e1('0xe')][_0x56e1('0x10')]);return _0x547965(_0x4244a9[_0x56e1('0xe')]['message']);}else{logger[_0x56e1('0xa')]('MailApplication,\x20%s,\x20%s',_0xfdd1ee,'request\x20sent');_0x547965(_0x4244a9[_0x56e1('0x11')][_0x56e1('0x10')]);}})['catch'](function(_0x1a8c8f){logger['error']('MailApplication,\x20%s,\x20%s',_0xfdd1ee,_0x1a8c8f);_0x2f9afa(_0x1a8c8f);});});}exports['UpdateMailApplication']=function(_0x52dc76){var _0x423509=this;return new Promise(function(_0x2307d7,_0x3f8543){return db[_0x56e1('0x12')]['update'](_0x52dc76[_0x56e1('0x13')],{'raw':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x16')]||null:null,'attributes':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x17')]||null:null,'limit':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x18')]||null:null})['then'](function(_0x2117e3){logger[_0x56e1('0xa')](_0x56e1('0x19'),_0x52dc76);logger[_0x56e1('0xc')](_0x56e1('0x19'),_0x52dc76,JSON[_0x56e1('0x1a')](_0x2117e3));_0x2307d7(_0x2117e3);})[_0x56e1('0x1b')](function(_0x44ba40){logger['error'](_0x56e1('0x19'),_0x44ba40[_0x56e1('0x10')],_0x52dc76);_0x3f8543(_0x423509[_0x56e1('0xe')](0x1f4,_0x44ba40['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e03acd4..1fc0dfc 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 _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 +var _0xc794=['/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download','download','create','tracked','mailinteraction:addtags','put','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x16d045,_0x24faf3){var _0x5649cd=function(_0x3d2c01){while(--_0x3d2c01){_0x16d045['push'](_0x16d045['shift']());}};_0x5649cd(++_0x24faf3);}(_0xc794,0x10f));var _0x4c79=function(_0x48db69,_0x455a6a){_0x48db69=_0x48db69-0x0;var _0x3e1c3d=_0xc794[_0x48db69];return _0x3e1c3d;};'use strict';var express=require('express');var router=express[_0x4c79('0x0')]();var auth=require(_0x4c79('0x1'));var interaction=require(_0x4c79('0x2'));var controller=require('./mailInteraction.controller');router[_0x4c79('0x3')]('/',auth['isAuthenticated'](),controller[_0x4c79('0x4')]);router[_0x4c79('0x3')](_0x4c79('0x5'),auth['isAuthenticated'](),controller[_0x4c79('0x6')]);router[_0x4c79('0x3')](_0x4c79('0x7'),auth[_0x4c79('0x8')](),controller['show']);router['get'](_0x4c79('0x9'),auth[_0x4c79('0x8')](),controller[_0x4c79('0xa')]);router['get'](_0x4c79('0xb'),auth['isAuthenticated'](),controller[_0x4c79('0xc')]);router['post']('/',auth[_0x4c79('0x8')](),controller[_0x4c79('0xd')]);router['post'](_0x4c79('0x9'),auth[_0x4c79('0x8')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x4c79('0x8')](),interaction[_0x4c79('0xe')]('mail',_0x4c79('0xf')),controller['addTags']);router[_0x4c79('0x10')]('/:id',auth['isAuthenticated'](),interaction[_0x4c79('0xe')](_0x4c79('0x11'),_0x4c79('0x12')),controller['update']);router[_0x4c79('0x13')](_0x4c79('0x7'),auth[_0x4c79('0x8')](),interaction[_0x4c79('0xe')](_0x4c79('0x11'),_0x4c79('0x14')),controller[_0x4c79('0x15')]);router['delete']('/:id/tags',auth[_0x4c79('0x8')](),controller[_0x4c79('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 021cb12..27cc0b0 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 _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 +var _0x7071=['TEXT','BOOLEAN','DATE','ENUM','out','INTEGER','iconv','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7071,0xcc));var _0x1707=function(_0x348ff2,_0x5e0e1d){_0x348ff2=_0x348ff2-0x0;var _0x454cee=_0x7071[_0x348ff2];return _0x454cee;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x1707('0x0'));module[_0x1707('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1707('0x2')]},'secondDisposition':{'type':Sequelize[_0x1707('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1707('0x2')]},'note':{'type':Sequelize[_0x1707('0x2')]},'inReplyTo':{'type':Sequelize[_0x1707('0x2')](0x1fe)},'to':{'type':Sequelize[_0x1707('0x2')]},'cc':{'type':Sequelize[_0x1707('0x3')]('long')},'subject':{'type':Sequelize[_0x1707('0x3')]()},'attach':{'type':Sequelize[_0x1707('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1707('0x5')]},'substatus':{'type':Sequelize[_0x1707('0x2')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1707('0x6')]('in',_0x1707('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1707('0x6')]('in',_0x1707('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1707('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1707('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index f8b5420..1afbf1f 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 _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 +var _0x31c5=['ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','findAll','query','user','catch','show','params','model','keys','intersection','attributes','fields','merge','find','create','body','update','describe','addMessage','MailMessage','ids','omit','getMessages','length','hasOwnProperty','sort','where','filters','pick','MailInteractionId','filter','map','$gte','split','format','includeAll','include','inlineCss','rows','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x31c5,0x7b));var _0x531c=function(_0x1baa57,_0x1d28da){_0x1baa57=_0x1baa57-0x0;var _0x2bba51=_0x31c5[_0x1baa57];return _0x2bba51;};'use strict';var emlformat=require(_0x531c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x531c('0x1'));var moment=require(_0x531c('0x2'));var BPromise=require(_0x531c('0x3'));var util=require('util');var path=require(_0x531c('0x4'));var fs=require('fs');var _=require('lodash');var juice=require(_0x531c('0x5'));var Redis=require(_0x531c('0x6'));var interaction=require(_0x531c('0x7'));var qs=require(_0x531c('0x8'));var logger=require(_0x531c('0x9'))(_0x531c('0xa'));var config=require('../../config/environment');var db=require(_0x531c('0xb'))['db'];var htmlEntities=require(_0x531c('0xc'));config[_0x531c('0xd')]=_[_0x531c('0xe')](config[_0x531c('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x531c('0xd')]));require(_0x531c('0xf'))[_0x531c('0x10')](socket);function respondWithStatusCode(_0x31d779,_0x33d3b0){_0x33d3b0=_0x33d3b0||0xcc;return function(_0xc4e9c3){if(_0xc4e9c3){return _0x31d779['sendStatus'](_0x33d3b0);}return _0x31d779[_0x531c('0x11')](_0x33d3b0)['end']();};}function respondWithResult(_0x38abf2,_0x4ef1c6){_0x4ef1c6=_0x4ef1c6||0xc8;return function(_0x13d034){if(_0x13d034){return _0x38abf2[_0x531c('0x11')](_0x4ef1c6)[_0x531c('0x12')](_0x13d034);}};}function respondWithFilteredResult(_0x388aed,_0x1047fa){return function(_0x17027d){if(_0x17027d){var _0x5cd22f=typeof _0x1047fa[_0x531c('0x13')]===_0x531c('0x14')&&typeof _0x1047fa[_0x531c('0x15')]===_0x531c('0x14');var _0x58fb98=_0x17027d[_0x531c('0x16')];var _0x1b1ab3=_0x5cd22f?0x0:_0x1047fa[_0x531c('0x13')];var _0x4bdbe3=_0x5cd22f?_0x17027d[_0x531c('0x16')]:_0x1047fa[_0x531c('0x13')]+_0x1047fa['limit'];var _0x5e23ca;if(_0x4bdbe3>=_0x58fb98){_0x4bdbe3=_0x58fb98;_0x5e23ca=0xc8;}else{_0x5e23ca=0xce;}_0x388aed[_0x531c('0x11')](_0x5e23ca);return _0x388aed[_0x531c('0x17')](_0x531c('0x18'),_0x1b1ab3+'-'+_0x4bdbe3+'/'+_0x58fb98)[_0x531c('0x12')](_0x17027d);}return null;};}function saveUpdates(_0x465cde){return function(_0x517ffe){if(_0x517ffe){return _0x517ffe['update'](_0x465cde)[_0x531c('0x19')](function(_0x93a271){return _0x93a271;});}return null;};}function removeEntity(_0x453606){return function(_0x2727d0){if(_0x2727d0){return _0x2727d0[_0x531c('0x1a')]()[_0x531c('0x19')](function(){_0x453606[_0x531c('0x11')](0xcc)[_0x531c('0x1b')]();});}};}function handleEntityNotFound(_0x3879fa){return function(_0x11f5fb){if(!_0x11f5fb){_0x3879fa[_0x531c('0x1c')](0x194);}return _0x11f5fb;};}function handleError(_0x250ebf,_0x617ca2){_0x617ca2=_0x617ca2||0x1f4;return function(_0x353da8){logger['error'](_0x353da8[_0x531c('0x1d')]);if(_0x353da8[_0x531c('0x1e')]){delete _0x353da8[_0x531c('0x1e')];}_0x250ebf[_0x531c('0x11')](_0x617ca2)[_0x531c('0x1f')](_0x353da8);};}exports[_0x531c('0x20')]=function(_0x5a2f93,_0x1164d0){var _0x38aaf6={};var _0x634212=_['map'](db[_0x531c('0x21')][_0x531c('0x22')],function(_0x357e42){return{'name':_0x357e42[_0x531c('0x23')],'type':_0x357e42[_0x531c('0x24')][_0x531c('0x25')]};});_0x38aaf6=qs['getOptions'](_0x634212,_0x5a2f93);return interaction[_0x531c('0x26')]('mail',_0x5a2f93[_0x531c('0x27')],_0x5a2f93[_0x531c('0x28')],_0x38aaf6,_0x634212)[_0x531c('0x19')](respondWithFilteredResult(_0x1164d0,_0x38aaf6))[_0x531c('0x29')](handleError(_0x1164d0,null));};exports[_0x531c('0x2a')]=function(_0x4eb811,_0x2b92c7){var _0x430d7a={'raw':![],'where':{'id':_0x4eb811[_0x531c('0x2b')]['id']}},_0xa31b1b={};_0xa31b1b[_0x531c('0x2c')]=_['keys'](db[_0x531c('0x21')][_0x531c('0x22')]);_0xa31b1b[_0x531c('0x27')]=_[_0x531c('0x2d')](_0x4eb811[_0x531c('0x27')]);_0xa31b1b['filters']=_[_0x531c('0x2e')](_0xa31b1b[_0x531c('0x2c')],_0xa31b1b['query']);_0x430d7a[_0x531c('0x2f')]=_['intersection'](_0xa31b1b['model'],qs[_0x531c('0x30')](_0x4eb811[_0x531c('0x27')]['fields']));_0x430d7a[_0x531c('0x2f')]=_0x430d7a['attributes']['length']?_0x430d7a['attributes']:_0xa31b1b[_0x531c('0x2c')];if(_0x4eb811['query']['includeAll']){_0x430d7a['include']=[{'all':!![]}];}_0x430d7a=_[_0x531c('0x31')]({},_0x430d7a,_0x4eb811['options']);return db[_0x531c('0x21')][_0x531c('0x32')](_0x430d7a)['then'](handleEntityNotFound(_0x2b92c7,null))[_0x531c('0x19')](respondWithResult(_0x2b92c7,null))['catch'](handleError(_0x2b92c7,null));};exports['create']=function(_0x342663,_0x38b7dd){return db['MailInteraction'][_0x531c('0x33')](_0x342663[_0x531c('0x34')],{})[_0x531c('0x19')](respondWithResult(_0x38b7dd,0xc9))[_0x531c('0x29')](handleError(_0x38b7dd,null));};exports[_0x531c('0x35')]=function(_0x19ef97,_0x312c44){if(_0x19ef97[_0x531c('0x34')]['id']){delete _0x19ef97[_0x531c('0x34')]['id'];}return db['MailInteraction'][_0x531c('0x32')]({'where':{'id':_0x19ef97[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x312c44,null))[_0x531c('0x19')](saveUpdates(_0x19ef97[_0x531c('0x34')],null))[_0x531c('0x19')](respondWithResult(_0x312c44,null))[_0x531c('0x29')](handleError(_0x312c44,null));};exports['destroy']=function(_0x2d76cf,_0x2eed95){return db['MailInteraction'][_0x531c('0x32')]({'where':{'id':_0x2d76cf['params']['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x2eed95,null))[_0x531c('0x19')](removeEntity(_0x2eed95,null))[_0x531c('0x29')](handleError(_0x2eed95,null));};exports[_0x531c('0x36')]=function(_0x4f0e06,_0x2d844a){return db[_0x531c('0x21')][_0x531c('0x36')]()['then'](respondWithResult(_0x2d844a,null))[_0x531c('0x29')](handleError(_0x2d844a,null));};exports[_0x531c('0x37')]=function(_0x1d5b6b,_0xcd5442){return db[_0x531c('0x38')][_0x531c('0x32')]({'where':{'id':_0x1d5b6b[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0xcd5442,null))[_0x531c('0x19')](function(_0x8c6efd){if(_0x8c6efd){return _0x8c6efd[_0x531c('0x37')](_0x1d5b6b['body'][_0x531c('0x39')],_[_0x531c('0x3a')](_0x1d5b6b['body'],[_0x531c('0x39'),'id'])||{});}})['then'](respondWithResult(_0xcd5442,null))[_0x531c('0x29')](handleError(_0xcd5442,null));};exports[_0x531c('0x3b')]=function(_0x4c64e8,_0xe69e5f){var _0x1c4bd8={'raw':![],'where':{}};var _0x57b4ab={};var _0x377291={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x4c64e8[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0xe69e5f,null))[_0x531c('0x19')](function(_0x4d5460){if(_0x4d5460){_0x57b4ab['model']=_[_0x531c('0x2d')](db[_0x531c('0x38')][_0x531c('0x22')]);_0x57b4ab[_0x531c('0x27')]=_['keys'](_0x4c64e8[_0x531c('0x27')]);_0x57b4ab['filters']=_[_0x531c('0x2e')](_0x57b4ab['model'],_0x57b4ab[_0x531c('0x27')]);_0x1c4bd8[_0x531c('0x2f')]=_[_0x531c('0x2e')](_0x57b4ab['model'],qs[_0x531c('0x30')](_0x4c64e8[_0x531c('0x27')][_0x531c('0x30')]));_0x1c4bd8[_0x531c('0x2f')]=_0x1c4bd8[_0x531c('0x2f')][_0x531c('0x3c')]?_0x1c4bd8[_0x531c('0x2f')]:_0x57b4ab[_0x531c('0x2c')];if(!_0x4c64e8[_0x531c('0x27')][_0x531c('0x3d')]('nolimit')){_0x1c4bd8[_0x531c('0x15')]=qs[_0x531c('0x15')](_0x4c64e8['query'][_0x531c('0x15')]);_0x1c4bd8[_0x531c('0x13')]=qs['offset'](_0x4c64e8[_0x531c('0x27')][_0x531c('0x13')]);}_0x1c4bd8['order']=qs[_0x531c('0x3e')](_0x4c64e8[_0x531c('0x27')]['sort']);_0x1c4bd8[_0x531c('0x3f')]=qs[_0x531c('0x40')](_[_0x531c('0x41')](_0x4c64e8[_0x531c('0x27')],_0x57b4ab[_0x531c('0x40')]));_0x1c4bd8[_0x531c('0x3f')][_0x531c('0x42')]=_0x4d5460['id'];if(_0x4c64e8['query'][_0x531c('0x43')]){_0x1c4bd8[_0x531c('0x3f')]=_['merge'](_0x1c4bd8[_0x531c('0x3f')],{'$or':_[_0x531c('0x44')](_0x1c4bd8[_0x531c('0x2f')],function(_0x36eb9a){var _0x5a3780={};_0x5a3780[_0x36eb9a]={'$like':'%'+_0x4c64e8[_0x531c('0x27')]['filter']+'%'};return _0x5a3780;})});}if(_0x4c64e8[_0x531c('0x27')][_0x531c('0x45')]){var _0x4f36c6=_0x4c64e8[_0x531c('0x27')][_0x531c('0x45')][_0x531c('0x46')](',');var _0x1b8551={};_0x1b8551[_0x4f36c6[0x0]]={'$gte':moment(_0x4f36c6[0x1])[_0x531c('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1c4bd8['where']=_[_0x531c('0x31')](_0x1c4bd8[_0x531c('0x3f')],_0x1b8551);}_0x1c4bd8=_[_0x531c('0x31')]({},_0x1c4bd8,_0x4c64e8['options']);return db[_0x531c('0x38')]['count']({'where':_0x1c4bd8[_0x531c('0x3f')]})[_0x531c('0x19')](function(_0x48a80d){_0x377291[_0x531c('0x16')]=_0x48a80d;if(_0x4c64e8[_0x531c('0x27')][_0x531c('0x48')]){_0x1c4bd8[_0x531c('0x49')]=[{'all':!![]}];}return db[_0x531c('0x38')][_0x531c('0x26')](_0x1c4bd8);})[_0x531c('0x19')](function(_0x3795d2){if(_0x4c64e8['query'][_0x531c('0x4a')]==='true'){for(var _0x1cfd5d=0x0;_0x1cfd5d<_0x3795d2[_0x531c('0x3c')];_0x1cfd5d++){_0x3795d2[_0x1cfd5d][_0x531c('0x34')]=juice(_0x3795d2[_0x1cfd5d][_0x531c('0x34')]);}}_0x377291[_0x531c('0x4b')]=_0x3795d2;return _0x377291;});}})[_0x531c('0x19')](respondWithFilteredResult(_0xe69e5f,_0x1c4bd8))[_0x531c('0x29')](handleError(_0xe69e5f,null));};exports['addTags']=function(_0x1dab33,_0x3d2a2a){return db['MailInteraction']['find']({'where':{'id':_0x1dab33['params']['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x3d2a2a,null))[_0x531c('0x19')](function(_0x52738b){if(_0x52738b){return _0x52738b['setTags'](_0x1dab33[_0x531c('0x34')]['ids'],_[_0x531c('0x3a')](_0x1dab33[_0x531c('0x34')],[_0x531c('0x39'),'id'])||{})['spread'](function(){return db[_0x531c('0x4c')][_0x531c('0x26')]({'attributes':['id','name',_0x531c('0x4d')],'where':{'id':_0x1dab33[_0x531c('0x34')][_0x531c('0x39')]}});})['then'](function(_0x3cfedf){socket[_0x531c('0x4e')](_0x531c('0x4f'),{'id':Number(_0x1dab33[_0x531c('0x2b')]['id']),'tags':_0x3cfedf||[]});return{'id':Number(_0x1dab33[_0x531c('0x2b')]['id']),'tags':_0x3cfedf||[]};});}})[_0x531c('0x19')](respondWithResult(_0x3d2a2a,null))[_0x531c('0x29')](handleError(_0x3d2a2a,null));};exports[_0x531c('0x50')]=function(_0x5a2123,_0x1d5561){return db[_0x531c('0x21')][_0x531c('0x32')]({'where':{'id':_0x5a2123[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x1d5561,null))['then'](function(_0x3b5671){if(_0x3b5671){return _0x3b5671['removeTags'](_0x5a2123['query'][_0x531c('0x39')]);}})[_0x531c('0x19')](respondWithStatusCode(_0x1d5561,null))[_0x531c('0x29')](handleError(_0x1d5561,null));};exports[_0x531c('0x51')]=function(_0x4280bc,_0x12d2f3){var _0x3cbc29=moment()[_0x531c('0x52')]()[_0x531c('0x53')]();var _0x1619d6=path[_0x531c('0x54')](config[_0x531c('0x55')],_0x531c('0x56'),_0x531c('0x57'),_0x531c('0x58'));var _0x33abc8=path[_0x531c('0x54')](config[_0x531c('0x55')],_0x531c('0x56'),_0x531c('0x57'),'attachments');var _0x13cd57=path[_0x531c('0x54')](_0x1619d6,_0x3cbc29);var _0x35831a=util[_0x531c('0x47')](_0x531c('0x59'),_0x4280bc[_0x531c('0x2b')]['id'],_0x3cbc29);var _0x22de14=path[_0x531c('0x54')](_0x1619d6,_0x35831a);var _0x58bdeb=[];if(_0x4280bc[_0x531c('0x27')][_0x531c('0x5a')]){_0x58bdeb[_0x531c('0x5b')]({'model':db[_0x531c('0x5c')],'as':_0x531c('0x5d'),'raw':!![]});}var _0x2433d4=[{'model':db[_0x531c('0x38')],'as':_0x531c('0x5e'),'attributes':['id','body',_0x531c('0x5f'),'to','cc','bcc',_0x531c('0x60'),_0x531c('0x61')],'where':{'secret':![]},'order':qs[_0x531c('0x3e')]('id'),'include':_0x58bdeb}];return db['MailInteraction'][_0x531c('0x32')]({'where':{'id':_0x4280bc[_0x531c('0x2b')]['id']},'include':_0x2433d4})[_0x531c('0x19')](handleEntityNotFound(_0x12d2f3,null))[_0x531c('0x19')](function(_0x3288ef){if(_0x3288ef&&_0x3288ef[_0x531c('0x5e')]){var _0x49f2b7=_0x3288ef[_0x531c('0x62')]({'plain':!![]});fs[_0x531c('0x63')](_0x13cd57);return BPromise[_0x531c('0x64')](_0x49f2b7['Messages'],function(_0x4e86c6,_0x42b258){var _0x5786a4={'from':_0x4e86c6['from'],'to':_0x4e86c6['to']||_0x531c('0x65'),'subject':_0x4e86c6['subject'],'html':htmlEntities[_0x531c('0x66')](_0x4e86c6[_0x531c('0x34')]),'headers':{'Date':moment(_0x4e86c6[_0x531c('0x61')])[_0x531c('0x47')](_0x531c('0x67'))},'attachments':[]};if(_0x4e86c6['cc']){_0x5786a4[_0x531c('0x68')]['Cc']=_0x4e86c6['cc'];}if(_0x4e86c6[_0x531c('0x69')]){_0x5786a4[_0x531c('0x68')][_0x531c('0x6a')]=_0x4e86c6['bcc'];}return new BPromise(function(_0x59e18e,_0xe27e4f){if(_0x4e86c6[_0x531c('0x5d')]){for(var _0x4510dc=0x0;_0x4510dc<_0x4e86c6[_0x531c('0x5d')][_0x531c('0x3c')];_0x4510dc++){var _0x26beb8=_0x4e86c6[_0x531c('0x5d')][_0x4510dc];var _0x5f47b0=path[_0x531c('0x54')](_0x33abc8,_0x26beb8[_0x531c('0x6b')]);if(fs[_0x531c('0x6c')](_0x5f47b0)){_0x5786a4['attachments'][_0x531c('0x5b')]({'name':_0x26beb8[_0x531c('0x1e')],'contentType':_0x26beb8[_0x531c('0x24')],'data':fs['readFileSync'](_0x5f47b0)});}}}emlformat[_0x531c('0x6d')](_0x5786a4,function(_0x5762b4,_0x267739){if(_0x5762b4)return _0xe27e4f(_0x5762b4);fs[_0x531c('0x6e')](path[_0x531c('0x54')](_0x13cd57,util[_0x531c('0x47')](_0x531c('0x6f'),_0x42b258)),_0x267739);return _0x59e18e(_0x267739);});});})[_0x531c('0x19')](function(){return new BPromise(function(_0x4d53c8,_0x57c834){zipdir(_0x13cd57,{'saveTo':_0x22de14},function(_0x1e9240,_0x1f5335){if(_0x1e9240)return _0x57c834(_0x1e9240);return _0x4d53c8(_0x1f5335);});})['then'](function(){return new BPromise(function(_0xa29207,_0x315ea6){rimraf(_0x13cd57,function(_0x20d454){if(_0x20d454)_0x315ea6(_0x20d454);return _0xa29207();});});})[_0x531c('0x19')](function(){return _0x12d2f3[_0x531c('0x51')](_0x22de14,_0x35831a,function(_0x15c21a){if(!_0x15c21a)fs[_0x531c('0x70')](_0x22de14);});});});}else{return _0x12d2f3[_0x531c('0x1c')](0xc8);}})['catch'](handleError(_0x12d2f3,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d3f361a..f535905 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 _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 +var _0xbeef=['catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','save','update','remove','then','setDataValue','findAll','unreadMessages','length','emit'];(function(_0x488b49,_0x34d2e2){var _0x241e56=function(_0x47d0f3){while(--_0x47d0f3){_0x488b49['push'](_0x488b49['shift']());}};_0x241e56(++_0x34d2e2);}(_0xbeef,0x1e4));var _0xfbee=function(_0xa2f4e8,_0x97c0){_0xa2f4e8=_0xa2f4e8-0x0;var _0x521c24=_0xbeef[_0xa2f4e8];return _0x521c24;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xfbee('0x0'))['db'][_0xfbee('0x1')];var MailMessage=require(_0xfbee('0x0'))['db'][_0xfbee('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfbee('0x3'),'afterUpdate':_0xfbee('0x4'),'afterDestroy':_0xfbee('0x5')};function emitEvent(_0x1ae96d){return function(_0x529710,_0x1f9837,_0x21da01){_0x529710['getUsers']({'attributes':['id'],'raw':!![]})[_0xfbee('0x6')](function(_0x134b45){_0x529710[_0xfbee('0x7')]('Users',_0x134b45['map'](function(_0x533d13){return{'id':_0x533d13['id']};}));return MailMessage[_0xfbee('0x8')]({'where':{'MailInteractionId':_0x529710['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfbee('0x6')](function(_0xbb972e){_0x529710[_0xfbee('0x7')](_0xfbee('0x9'),_0xbb972e[_0xfbee('0xa')]);MailInteractionEvents[_0xfbee('0xb')](_0x1ae96d+':'+_0x529710['id'],_0x529710);MailInteractionEvents['emit'](_0x1ae96d,_0x529710);_0x21da01(null);})[_0xfbee('0xc')](_0x21da01(null));};}for(var e in events){if(events[_0xfbee('0xd')](e)){var event=events[e];MailInteraction[_0xfbee('0xe')](e,emitEvent(event));}}module[_0xfbee('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 91ba00b..9851832 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 _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 +var _0x713c=['YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format'];(function(_0x2c727b,_0x3aa202){var _0x27180a=function(_0x846789){while(--_0x846789){_0x2c727b['push'](_0x2c727b['shift']());}};_0x27180a(++_0x3aa202);}(_0x713c,0x6a));var _0xc713=function(_0x1ae087,_0x1e1b68){_0x1ae087=_0x1ae087-0x0;var _0xf9d37e=_0x713c[_0x1ae087];return _0xf9d37e;};'use strict';var _=require(_0xc713('0x0'));var util=require(_0xc713('0x1'));var logger=require(_0xc713('0x2'))('api');var moment=require(_0xc713('0x3'));var BPromise=require(_0xc713('0x4'));var rp=require(_0xc713('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc713('0x6'));var config=require(_0xc713('0x7'));var attributes=require(_0xc713('0x8'));module[_0xc713('0x9')]=function(_0x28693e,_0x1bc191){return _0x28693e[_0xc713('0xa')](_0xc713('0xb'),attributes,{'tableName':_0xc713('0xc'),'paranoid':![],'indexes':[{'name':_0xc713('0xd'),'fields':[_0xc713('0xe'),'to'],'type':_0xc713('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15a7e5,_0x157387,_0x109085){if(_0x15a7e5['substatus']){_0x15a7e5[_0xc713('0x10')]=moment()[_0xc713('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x15a7e5['closed']){_0x15a7e5['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x109085(null,_0x157387);},'beforeUpdate':function(_0x12b85a,_0x4d64b2,_0x44f2ee){if(_0x12b85a['changed']('substatus')){_0x12b85a[_0xc713('0x10')]=_0x12b85a['substatus']?moment()['format'](_0xc713('0x12')):null;}if(_0x12b85a[_0xc713('0x13')](_0xc713('0x14'))){_0x12b85a[_0xc713('0x15')]=moment()[_0xc713('0x11')](_0xc713('0x12'));_0x12b85a[_0xc713('0x16')]=null;_0x12b85a[_0xc713('0x10')]=null;}_0x44f2ee(null,_0x12b85a);},'afterUpdate':function(_0x214fe2,_0x3c932e,_0x2216b7){var _0x2f8395=_0x28693e[_0xc713('0x17')];var _0x1955ec=_0x214fe2[_0xc713('0x18')]({'plain':!![]});if(_0x1955ec['closed']){return _0x2f8395[_0xc713('0x19')][_0xc713('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x1955ec['id']}})[_0xc713('0x1b')](function(){_0x2216b7();})[_0xc713('0x1c')](function(_0x16e8e0){_0x2216b7(_0x16e8e0);});}else{_0x2216b7();}}},'charset':_0xc713('0x1d'),'collate':_0xc713('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index c77745d..f0bc2c9 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 _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 +var _0x57f0=['where','attributes','UpdateMailInteraction','stringify','ids','omit','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','update','body','options','raw'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x57f0,0x9f));var _0x057f=function(_0x37dac2,_0xdb5e75){_0x37dac2=_0x37dac2-0x0;var _0x351e15=_0x57f0[_0x37dac2];return _0x351e15;};'use strict';var _=require('lodash');var util=require(_0x057f('0x0'));var moment=require(_0x057f('0x1'));var BPromise=require(_0x057f('0x2'));var rs=require(_0x057f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x057f('0x4'))['db'];var utils=require(_0x057f('0x5'));var logger=require(_0x057f('0x6'))('rpc');var config=require(_0x057f('0x7'));var jayson=require(_0x057f('0x8'));var client=jayson[_0x057f('0x9')][_0x057f('0xa')]({'port':0x232a});config['redis']=_[_0x057f('0xb')](config[_0x057f('0xc')],{'host':_0x057f('0xd'),'port':0x18eb});var socket=require(_0x057f('0xe'))(new Redis(config[_0x057f('0xc')]));require(_0x057f('0xf'))[_0x057f('0x10')](socket);function respondWithRpcPromise(_0x1b209b,_0x28dbfe,_0x3b433d){return new BPromise(function(_0x21e411,_0xeb40de){return client['request'](_0x1b209b,_0x3b433d)[_0x057f('0x11')](function(_0x444d32){logger[_0x057f('0x12')](_0x057f('0x13'),_0x28dbfe,_0x057f('0x14'));logger[_0x057f('0x15')](_0x057f('0x16'),_0x28dbfe,_0x057f('0x14'),JSON['stringify'](_0x444d32));if(_0x444d32[_0x057f('0x17')]){if(_0x444d32[_0x057f('0x17')][_0x057f('0x18')]===0x1f4){logger[_0x057f('0x17')](_0x057f('0x13'),_0x28dbfe,_0x444d32[_0x057f('0x17')][_0x057f('0x19')]);return _0xeb40de(_0x444d32[_0x057f('0x17')][_0x057f('0x19')]);}logger[_0x057f('0x17')]('MailInteraction,\x20%s,\x20%s',_0x28dbfe,_0x444d32['error']['message']);return _0x21e411(_0x444d32['error']['message']);}else{logger[_0x057f('0x12')](_0x057f('0x13'),_0x28dbfe,_0x057f('0x14'));_0x21e411(_0x444d32['result']['message']);}})[_0x057f('0x1a')](function(_0x59a5ef){logger[_0x057f('0x17')]('MailInteraction,\x20%s,\x20%s',_0x28dbfe,_0x59a5ef);_0xeb40de(_0x59a5ef);});});}exports['UpdateMailInteraction']=function(_0x33d777){var _0xc7299a=this;return new Promise(function(_0x36a506,_0x550f65){return db['MailInteraction'][_0x057f('0x1b')](_0x33d777[_0x057f('0x1c')],{'raw':_0x33d777[_0x057f('0x1d')]?_0x33d777[_0x057f('0x1d')][_0x057f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d777['options']?_0x33d777[_0x057f('0x1d')][_0x057f('0x1f')]||null:null,'attributes':_0x33d777[_0x057f('0x1d')]?_0x33d777[_0x057f('0x1d')][_0x057f('0x20')]||null:null,'limit':_0x33d777[_0x057f('0x1d')]?_0x33d777[_0x057f('0x1d')]['limit']||null:null})[_0x057f('0x11')](function(_0x38b608){logger[_0x057f('0x12')](_0x057f('0x21'),_0x33d777);logger['debug']('UpdateMailInteraction',_0x33d777,JSON[_0x057f('0x22')](_0x38b608));_0x36a506(_0x38b608);})[_0x057f('0x1a')](function(_0x431f4b){logger[_0x057f('0x17')]('UpdateMailInteraction',_0x431f4b[_0x057f('0x19')],_0x33d777);_0x550f65(_0xc7299a[_0x057f('0x17')](0x1f4,_0x431f4b[_0x057f('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x2834b3){return new Promise(function(_0x98241a,_0xcd712c){return db['MailInteraction']['find']({'where':_0x2834b3['options']?_0x2834b3[_0x057f('0x1d')][_0x057f('0x1f')]||null:null})[_0x057f('0x11')](function(_0x4f387d){if(_0x4f387d){return _0x4f387d['addTags'](_0x2834b3['body'][_0x057f('0x23')],_[_0x057f('0x24')](_0x2834b3[_0x057f('0x1c')],['ids','id'])||{});}})['spread'](function(_0xd88729){logger[_0x057f('0x12')](_0x057f('0x25'),_0x2834b3);logger['debug']('AddTags',_0x2834b3,JSON[_0x057f('0x22')](_0xd88729));_0x98241a(_0xd88729);})[_0x057f('0x1a')](function(_0x73a9f2){logger[_0x057f('0x17')](_0x057f('0x25'),_0x73a9f2[_0x057f('0x19')],_0x2834b3);_0xcd712c(_this[_0x057f('0x17')](0x1f4,_0x73a9f2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 45d7c06..6ef6cf0 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 _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 +var _0x67b2=['./mailInteraction.events','update','emit','length','mailInteraction:'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x67b2,0xa5));var _0x267b=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x67b2[_0x34eb31];return _0x254994;};'use strict';var MailInteractionEvents=require(_0x267b('0x0'));var events=['save','remove',_0x267b('0x1')];function createListener(_0x3805df,_0x46e897){return function(_0x36192b){_0x46e897[_0x267b('0x2')](_0x3805df,_0x36192b);};}function removeListener(_0x62319e,_0x5bbb12){return function(){MailInteractionEvents['removeListener'](_0x62319e,_0x5bbb12);};}exports['register']=function(_0x2aa199){for(var _0x538673=0x0,_0x130f06=events[_0x267b('0x3')];_0x538673<_0x130f06;_0x538673++){var _0x5a6328=events[_0x538673];var _0x1178f4=createListener(_0x267b('0x4')+_0x5a6328,_0x2aa199);MailInteractionEvents['on'](_0x5a6328,_0x1178f4);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index f29c616..8bedd20 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 _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 +var _0x7181=['isAuthenticated','describe','exports','express','Router','/describe'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x7181,0x1ef));var _0x1718=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0x7181[_0x3cf387];return _0x24425f;};'use strict';var express=require(_0x1718('0x0'));var router=express[_0x1718('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router['get'](_0x1718('0x2'),auth[_0x1718('0x3')](),controller[_0x1718('0x4')]);module[_0x1718('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index fa2dbb3..135e2a9 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(_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 +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x315476,_0x2eba41){var _0x30ed85=function(_0x17e9aa){while(--_0x17e9aa){_0x315476['push'](_0x315476['shift']());}};_0x30ed85(++_0x2eba41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 1250c9e..b0e3eb4 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 _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 +var _0xa7c1=['sequelize','exports','INTEGER'];(function(_0x1293fa,_0x446d6b){var _0x1dd054=function(_0x1b2d93){while(--_0x1b2d93){_0x1293fa['push'](_0x1293fa['shift']());}};_0x1dd054(++_0x446d6b);}(_0xa7c1,0x144));var _0x1a7c=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa7c1[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0x1a7c('0x0'));module[_0x1a7c('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x1a7c('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 6817b02..5223e0e 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 _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 +var _0xc16a=['./mailInteractionHasTag','exports','define','MailInteractionHasTag','mail_interaction_has_tags'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc16a,0x136));var _0xac16=function(_0x3a5cf4,_0x773b69){_0x3a5cf4=_0x3a5cf4-0x0;var _0x488364=_0xc16a[_0x3a5cf4];return _0x488364;};'use strict';var attributes=require(_0xac16('0x0'));module[_0xac16('0x1')]=function(_0x48cdb6){return _0x48cdb6[_0xac16('0x2')](_0xac16('0x3'),attributes,{'tableName':_0xac16('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9fd9225..fb32212 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 _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 +var _0x136c=['tracked','mail','put','update','accept','/:id/reject','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post'];(function(_0x134901,_0x5145a5){var _0x165c06=function(_0x521e33){while(--_0x521e33){_0x134901['push'](_0x134901['shift']());}};_0x165c06(++_0x5145a5);}(_0x136c,0x1d2));var _0xc136=function(_0x2c2a98,_0x1b0613){_0x2c2a98=_0x2c2a98-0x0;var _0x5170ba=_0x136c[_0x2c2a98];return _0x5170ba;};'use strict';var multer=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var path=require('path');var timeout=require(_0xc136('0x2'));var express=require(_0xc136('0x3'));var router=express[_0xc136('0x4')]();var fs_extra=require(_0xc136('0x5'));var auth=require(_0xc136('0x6'));var interaction=require(_0xc136('0x7'));var config=require(_0xc136('0x8'));var controller=require(_0xc136('0x9'));router[_0xc136('0xa')]('/',auth['isAuthenticated'](),controller[_0xc136('0xb')]);router['get'](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0xe')]);router['get'](_0xc136('0xf'),auth['isAuthenticated'](),controller[_0xc136('0x10')]);router[_0xc136('0xa')](_0xc136('0x11'),auth[_0xc136('0xd')](),controller[_0xc136('0x12')]);router[_0xc136('0x13')]('/',auth[_0xc136('0xd')](),interaction[_0xc136('0x14')](_0xc136('0x15'),'mailmessage:create'),controller['create']);router[_0xc136('0x16')]('/:id',auth[_0xc136('0xd')](),controller[_0xc136('0x17')]);router[_0xc136('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc136('0x18')]);router[_0xc136('0x16')](_0xc136('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0xc136('0x1a')](_0xc136('0xf'),auth['isAuthenticated'](),controller['destroy']);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 3c99948..94a0932 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 _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 +var _0x043a=['BOOLEAN','ENUM','out','STRING','long','DATE','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x043a,0x17c));var _0xa043=function(_0x359284,_0x4950d6){_0x359284=_0x359284-0x0;var _0x5298a4=_0x043a[_0x359284];return _0x5298a4;};'use strict';var Sequelize=require(_0xa043('0x0'));var _=require(_0xa043('0x1'));module[_0xa043('0x2')]={'body':{'type':Sequelize[_0xa043('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa043('0x3')]('medium')},'read':{'type':Sequelize[_0xa043('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa043('0x5')]('in',_0xa043('0x6')),'defaultValue':_0xa043('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa043('0x7')](0x1fe)},'from':{'type':Sequelize[_0xa043('0x7')]},'to':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'cc':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'bcc':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa043('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa043('0x9')]},'originTo':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'originCc':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'originChannel':{'type':Sequelize[_0xa043('0x5')](_0xa043('0xa'),_0xa043('0xb')),'defaultValue':_0xa043('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b89adae..fbfb672 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 _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 +var _0xd218=['../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','json','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','show','length','includeAll','MailMessage','find','update','body','params','describe','create','direction','secret','split','findOne','List','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','UserId','user','agent','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','reject','fromString','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','decode','headers','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','mail-interactions'];(function(_0xc46cfe,_0x538ade){var _0x1d4574=function(_0x2373fe){while(--_0x2373fe){_0xc46cfe['push'](_0xc46cfe['shift']());}};_0x1d4574(++_0x538ade);}(_0xd218,0x1b4));var _0x8d21=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xd218[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0x8d21('0x0'));var moment=require(_0x8d21('0x1'));var util=require(_0x8d21('0x2'));var path=require(_0x8d21('0x3'));var fs=require('fs');var _=require(_0x8d21('0x4'));var Redis=require(_0x8d21('0x5'));var htmlToText=require(_0x8d21('0x6'));var interactionService=require(_0x8d21('0x7'));var qs=require(_0x8d21('0x8'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x8d21('0x9'))(_0x8d21('0xa'));var config=require(_0x8d21('0xb'));var db=require('../../mysqldb')['db'];config[_0x8d21('0xc')]=_[_0x8d21('0xd')](config[_0x8d21('0xc')],{'host':_0x8d21('0xe'),'port':0x18eb});var socket=require(_0x8d21('0xf'))(new Redis(config[_0x8d21('0xc')]));var htmlEntities=require(_0x8d21('0x10'));require('./mailMessage.socket')[_0x8d21('0x11')](socket);var jayson=require(_0x8d21('0x12'));var client=jayson[_0x8d21('0x13')][_0x8d21('0x14')]({'port':0x232c});var client9003=jayson['client'][_0x8d21('0x14')]({'port':0x232b});var client9002=jayson[_0x8d21('0x13')][_0x8d21('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x449c7b,_0xbcef4a,_0x1b2736,_0x3e6aaf){return new Promise(function(_0x35828c,_0x3a6081){var _0x528c58=_0x3e6aaf||client;return _0x528c58[_0x8d21('0x15')](_0x449c7b,_0x1b2736)['then'](function(_0x1062ba){logger[_0x8d21('0x16')](_0x8d21('0x17'),_0xbcef4a,_0x8d21('0x18'));logger[_0x8d21('0x19')](_0x8d21('0x1a'),_0xbcef4a,_0x8d21('0x18'),JSON[_0x8d21('0x1b')](_0x1062ba));if(_0x1062ba[_0x8d21('0x1c')]){if(_0x1062ba['error'][_0x8d21('0x1d')]===0x1f4){logger[_0x8d21('0x1c')]('MailMessage,\x20%s,\x20%s',_0xbcef4a,_0x1062ba[_0x8d21('0x1c')][_0x8d21('0x1e')]);return _0x3a6081(_0x1062ba[_0x8d21('0x1c')][_0x8d21('0x1e')]);}logger['error'](_0x8d21('0x17'),_0xbcef4a,_0x1062ba['error'][_0x8d21('0x1e')]);return _0x35828c(_0x1062ba[_0x8d21('0x1c')][_0x8d21('0x1e')]);}else{logger[_0x8d21('0x16')]('MailMessage,\x20%s,\x20%s',_0xbcef4a,_0x8d21('0x18'));_0x35828c(_0x1062ba[_0x8d21('0x1f')][_0x8d21('0x1e')]);}})[_0x8d21('0x20')](function(_0x4dd57c){logger[_0x8d21('0x1c')](_0x8d21('0x17'),_0xbcef4a,_0x4dd57c);_0x3a6081(_0x4dd57c);});});}function respondWithResult(_0x1cd857,_0x32c444){_0x32c444=_0x32c444||0xc8;return function(_0x3d9cf1){if(_0x3d9cf1){return _0x1cd857[_0x8d21('0x21')](_0x32c444)['json'](_0x3d9cf1);}};}function respondWithFilteredResult(_0x25059a,_0x4b42ca){return function(_0x1c2ea9){if(_0x1c2ea9){var _0x58b73c=typeof _0x4b42ca[_0x8d21('0x22')]===_0x8d21('0x23')&&typeof _0x4b42ca[_0x8d21('0x24')]===_0x8d21('0x23');var _0x45310b=_0x1c2ea9[_0x8d21('0x25')];var _0x2ebba2=_0x58b73c?0x0:_0x4b42ca[_0x8d21('0x22')];var _0x249aaa=_0x58b73c?_0x1c2ea9[_0x8d21('0x25')]:_0x4b42ca['offset']+_0x4b42ca[_0x8d21('0x24')];var _0x5c6b99;if(_0x249aaa>=_0x45310b){_0x249aaa=_0x45310b;_0x5c6b99=0xc8;}else{_0x5c6b99=0xce;}_0x25059a[_0x8d21('0x21')](_0x5c6b99);return _0x25059a[_0x8d21('0x26')]('Content-Range',_0x2ebba2+'-'+_0x249aaa+'/'+_0x45310b)[_0x8d21('0x27')](_0x1c2ea9);}return null;};}function saveUpdates(_0x57b205){return function(_0x231766){if(_0x231766){return _0x231766['update'](_0x57b205)[_0x8d21('0x28')](function(_0x322767){return _0x322767;});}return null;};}function removeEntity(_0x40e32f){return function(_0x23083f){if(_0x23083f){return _0x23083f['destroy']()[_0x8d21('0x28')](function(){_0x40e32f[_0x8d21('0x21')](0xcc)[_0x8d21('0x29')]();});}};}function handleEntityNotFound(_0x2f1e8a){return function(_0x38d186){if(!_0x38d186){_0x2f1e8a['sendStatus'](0x194);}return _0x38d186;};}function handleError(_0x4f65ff,_0x3421c5){_0x3421c5=_0x3421c5||0x1f4;return function(_0x1a7f0c){logger[_0x8d21('0x1c')](_0x1a7f0c[_0x8d21('0x2a')]);if(_0x1a7f0c[_0x8d21('0x2b')]){delete _0x1a7f0c[_0x8d21('0x2b')];}_0x4f65ff['status'](_0x3421c5)[_0x8d21('0x2c')](_0x1a7f0c);};}exports[_0x8d21('0x2d')]=function(_0x54f777,_0x5298aa){var _0x5956a8={},_0x5518b={},_0x3768ae={'count':0x0,'rows':[]};var _0x67ec07=_[_0x8d21('0x2e')](db['MailMessage'][_0x8d21('0x2f')],function(_0x1f3ba9){return{'name':_0x1f3ba9[_0x8d21('0x30')],'type':_0x1f3ba9[_0x8d21('0x31')]['key']};});_0x5518b[_0x8d21('0x32')]=_[_0x8d21('0x2e')](_0x67ec07,'name');_0x5518b[_0x8d21('0x33')]=_[_0x8d21('0x34')](_0x54f777[_0x8d21('0x33')]);_0x5518b['filters']=_['intersection'](_0x5518b[_0x8d21('0x32')],_0x5518b[_0x8d21('0x33')]);_0x5956a8[_0x8d21('0x35')]=_[_0x8d21('0x36')](_0x5518b[_0x8d21('0x32')],qs[_0x8d21('0x37')](_0x54f777[_0x8d21('0x33')]['fields']));_0x5956a8[_0x8d21('0x35')]=_0x5956a8[_0x8d21('0x35')]['length']?_0x5956a8[_0x8d21('0x35')]:_0x5518b[_0x8d21('0x32')];if(!_0x54f777[_0x8d21('0x33')][_0x8d21('0x38')]('nolimit')){_0x5956a8[_0x8d21('0x24')]=qs['limit'](_0x54f777[_0x8d21('0x33')][_0x8d21('0x24')]);_0x5956a8['offset']=qs[_0x8d21('0x22')](_0x54f777['query']['offset']);}_0x5956a8[_0x8d21('0x39')]=qs[_0x8d21('0x3a')](_0x54f777[_0x8d21('0x33')][_0x8d21('0x3a')]);_0x5956a8[_0x8d21('0x3b')]=qs[_0x8d21('0x3c')](_['pick'](_0x54f777[_0x8d21('0x33')],_0x5518b['filters']),_0x67ec07);if(_0x54f777[_0x8d21('0x33')][_0x8d21('0x3d')]){_0x5956a8[_0x8d21('0x3b')]=_[_0x8d21('0x3e')](_0x5956a8['where'],{'$or':_['map'](_0x67ec07,function(_0x32cccf){if(_0x32cccf['type']!==_0x8d21('0x3f')){var _0x4f6781={};_0x4f6781[_0x32cccf[_0x8d21('0x2b')]]={'$like':'%'+_0x54f777[_0x8d21('0x33')][_0x8d21('0x3d')]+'%'};return _0x4f6781;}})});}_0x5956a8=_['merge']({},_0x5956a8,_0x54f777[_0x8d21('0x40')]);var _0x38448e={'where':_0x5956a8['where']};return db['MailMessage'][_0x8d21('0x25')](_0x38448e)[_0x8d21('0x28')](function(_0x2aca6d){_0x3768ae[_0x8d21('0x25')]=_0x2aca6d;if(_0x54f777[_0x8d21('0x33')]['includeAll']){_0x5956a8['include']=[{'all':!![]}];}return db['MailMessage'][_0x8d21('0x41')](_0x5956a8);})[_0x8d21('0x28')](function(_0x135998){_0x3768ae[_0x8d21('0x42')]=_0x135998;return _0x3768ae;})['then'](respondWithFilteredResult(_0x5298aa,_0x5956a8))['catch'](handleError(_0x5298aa,null));};exports[_0x8d21('0x43')]=function(_0x57c588,_0x561650){var _0x5576dd={'raw':!![],'where':{'id':_0x57c588['params']['id']}},_0x50094b={};_0x50094b['model']=_[_0x8d21('0x34')](db['MailMessage'][_0x8d21('0x2f')]);_0x50094b['query']=_[_0x8d21('0x34')](_0x57c588['query']);_0x50094b[_0x8d21('0x3c')]=_['intersection'](_0x50094b[_0x8d21('0x32')],_0x50094b[_0x8d21('0x33')]);_0x5576dd[_0x8d21('0x35')]=_[_0x8d21('0x36')](_0x50094b['model'],qs[_0x8d21('0x37')](_0x57c588[_0x8d21('0x33')][_0x8d21('0x37')]));_0x5576dd[_0x8d21('0x35')]=_0x5576dd[_0x8d21('0x35')][_0x8d21('0x44')]?_0x5576dd[_0x8d21('0x35')]:_0x50094b[_0x8d21('0x32')];if(_0x57c588[_0x8d21('0x33')][_0x8d21('0x45')]){_0x5576dd['include']=[{'all':!![]}];}_0x5576dd=_[_0x8d21('0x3e')]({},_0x5576dd,_0x57c588[_0x8d21('0x40')]);return db[_0x8d21('0x46')][_0x8d21('0x47')](_0x5576dd)[_0x8d21('0x28')](handleEntityNotFound(_0x561650,null))[_0x8d21('0x28')](respondWithResult(_0x561650,null))[_0x8d21('0x20')](handleError(_0x561650,null));};exports[_0x8d21('0x48')]=function(_0x4bb8d0,_0x2882a5){if(_0x4bb8d0[_0x8d21('0x49')]['id']){delete _0x4bb8d0[_0x8d21('0x49')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4bb8d0[_0x8d21('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2882a5,null))[_0x8d21('0x28')](saveUpdates(_0x4bb8d0[_0x8d21('0x49')],null))[_0x8d21('0x28')](respondWithResult(_0x2882a5,null))[_0x8d21('0x20')](handleError(_0x2882a5,null));};exports['destroy']=function(_0xdad9d9,_0x2aed30){return db[_0x8d21('0x46')][_0x8d21('0x47')]({'where':{'id':_0xdad9d9[_0x8d21('0x4a')]['id']}})[_0x8d21('0x28')](handleEntityNotFound(_0x2aed30,null))[_0x8d21('0x28')](removeEntity(_0x2aed30,null))['catch'](handleError(_0x2aed30,null));};exports[_0x8d21('0x4b')]=function(_0x52b6a5,_0x3dbe96){return db['MailMessage'][_0x8d21('0x4b')]()[_0x8d21('0x28')](respondWithResult(_0x3dbe96,null))['catch'](handleError(_0x3dbe96,null));};exports[_0x8d21('0x4c')]=function(_0x175ccc,_0x83245){return db['MailMessage'][_0x8d21('0x4c')](_0x175ccc[_0x8d21('0x49')])[_0x8d21('0x28')](function(_0x4db14c){if(_0x4db14c){if(_0x4db14c[_0x8d21('0x4d')]==='out'&&!_0x4db14c[_0x8d21('0x4e')]){var _0x4aacbf,_0x550b3f,_0x81914b;if(_0x175ccc['body']['to']){_0x550b3f=_0x175ccc[_0x8d21('0x49')]['to'][_0x8d21('0x4f')](',')[0x0];}return db['MailAccount'][_0x8d21('0x50')]({'where':{'id':_0x4db14c['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x8d21('0x51'),'include':[{'model':db[_0x8d21('0x52')],'as':_0x8d21('0x53'),'where':{'email':_0x550b3f},'limit':0x1,'order':[[_0x8d21('0x54'),_0x8d21('0x55')]]}]},{'model':db['MailServerOut'],'as':_0x8d21('0x56'),'raw':!![],'include':[{'model':db[_0x8d21('0x57')],'as':_0x8d21('0x57'),'raw':!![]}]}]})[_0x8d21('0x28')](function(_0x2e59a9){_0x4aacbf=_0x2e59a9;if(!_0x4aacbf||!_0x4aacbf[_0x8d21('0x56')])return;var _0x48b0ad=_0x4aacbf['getSmtpOptions']();if(_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')]&&_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')][_0x8d21('0x44')]){for(var _0xa83e32=0x0;_0xa83e32<_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')]['length'];_0xa83e32+=0x1){_0x175ccc[_0x8d21('0x49')]['attachments'][_0xa83e32]={'filename':_0x175ccc['body'][_0x8d21('0x58')][_0xa83e32][_0x8d21('0x2b')],'path':path[_0x8d21('0x59')](config[_0x8d21('0x5a')],_0x8d21('0x5b'),_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')][_0xa83e32][_0x8d21('0x5c')])};}}_0x81914b={'account':_0x48b0ad,'message':_0x175ccc[_0x8d21('0x49')]};return;})[_0x8d21('0x28')](function(){if(_0x4aacbf['List']){if(_0x4aacbf[_0x8d21('0x51')]['Contacts'][_0x8d21('0x44')]){return _0x4aacbf[_0x8d21('0x51')][_0x8d21('0x53')][0x0];}else{return db[_0x8d21('0x52')][_0x8d21('0x4c')](_[_0x8d21('0xd')](_0x175ccc[_0x8d21('0x49')],{'firstName':_0x175ccc['body']['to'],'email':_0x175ccc[_0x8d21('0x49')]['to'],'phone':_0x175ccc[_0x8d21('0x49')]['to'],'ListId':_0x4aacbf['ListId']}));}}else{throw new Error(_0x8d21('0x5d'));}})['then'](function(){if(_0x81914b){return respondWithRpcPromise(_0x8d21('0x5e'),_0x8d21('0x5f'),_0x81914b,client9003)['then'](function(_0x2fa5d2){return _0x4db14c[_0x8d21('0x48')]({'read':!![],'messageId':_0x2fa5d2['messageId'],'sentAt':moment()[_0x8d21('0x60')](_0x8d21('0x61'))});})[_0x8d21('0x20')](function(_0x36232f){logger[_0x8d21('0x1c')]('%s',JSON[_0x8d21('0x1b')](_0x36232f));return _0x4db14c;});}return _0x4db14c;});}return _0x4db14c;}})['then'](respondWithResult(_0x83245,0xc9))[_0x8d21('0x20')](handleError(_0x83245,null));};exports[_0x8d21('0x62')]=function(_0x12af71,_0x587c13){var _0x38239e=_0x8d21('0x63');return interactionService[_0x8d21('0x64')](_0x12af71,_0x38239e)[_0x8d21('0x28')](respondWithResult(_0x587c13,null))[_0x8d21('0x20')](handleError(_0x587c13,null));};exports['reject']=function(_0x26fa47,_0x21f12d){var _0x7e0c70={'agent':{},'channel':_0x8d21('0x63')};if(_0x26fa47['body']['id']){delete _0x26fa47[_0x8d21('0x49')]['id'];}_0x26fa47['body'][_0x8d21('0x65')]=_0x26fa47[_0x8d21('0x49')][_0x8d21('0x65')]||_0x26fa47[_0x8d21('0x66')]['id'];_0x7e0c70[_0x8d21('0x67')]['id']=_0x26fa47[_0x8d21('0x49')][_0x8d21('0x65')];return db[_0x8d21('0x46')]['find']({'where':{'id':_0x26fa47[_0x8d21('0x4a')]['id'],'UserId':null}})[_0x8d21('0x28')](handleEntityNotFound(_0x21f12d,null))[_0x8d21('0x28')](function(_0x3beb2c){if(_0x3beb2c){_0x7e0c70[_0x8d21('0x1e')]=_0x3beb2c[_0x8d21('0x68')]({'plain':!![]});return db['MailInteraction'][_0x8d21('0x47')]({'where':{'id':_0x3beb2c[_0x8d21('0x69')]}});}return null;})[_0x8d21('0x28')](handleEntityNotFound(_0x21f12d,null))[_0x8d21('0x28')](function(_0x13540c){if(_0x13540c){_0x7e0c70['interaction']=_0x13540c[_0x8d21('0x68')]({'plain':!![]});interaction_log[_0x8d21('0x16')](_0x8d21('0x6a'),_0x26fa47[_0x8d21('0x66')]['id'],_0x26fa47[_0x8d21('0x66')]['name'],_0x26fa47[_0x8d21('0x66')][_0x8d21('0x6b')],_0x7e0c70[_0x8d21('0x6c')]['id'],_0x26fa47[_0x8d21('0x49')]?JSON[_0x8d21('0x1b')](_0x26fa47[_0x8d21('0x49')]):_0x8d21('0x6d'));return respondWithRpcPromise(_0x8d21('0x6e'),_0x8d21('0x6f'),_0x7e0c70);}return null;})[_0x8d21('0x28')](function(_0x5115d2){var _0x4b0c34=_0x8d21('0x70')+_0x5115d2[_0x8d21('0x1e')][_0x8d21('0x71')];return db[_0x8d21('0x72')][_0x8d21('0x33')](_0x4b0c34,{'type':db[_0x8d21('0x73')]['QueryTypes'][_0x8d21('0x74')],'raw':!![]})[_0x8d21('0x28')](function(_0x1c8bd9){return _0x1c8bd9;});})[_0x8d21('0x28')](function(_0x5dc403){if(_0x5dc403){_0x7e0c70[_0x8d21('0x1e')][_0x8d21('0x75')]=_0x5dc403[0x0];if(!_0x26fa47[_0x8d21('0x49')][_0x8d21('0x65')])return;return db[_0x8d21('0x76')][_0x8d21('0x47')]({'where':{'id':_0x26fa47['body'][_0x8d21('0x65')],'role':_0x8d21('0x67')},'attributes':['id','name',_0x8d21('0x77'),_0x8d21('0x78'),_0x8d21('0x79')],'raw':!![]});}return null;})[_0x8d21('0x28')](function(_0x4e6a42){if(!_0x4e6a42)return null;_0x7e0c70[_0x8d21('0x1e')][_0x8d21('0x67')]=_0x4e6a42;return _0x7e0c70;})[_0x8d21('0x28')](function(_0x272694){if(_0x272694){_0x272694['message'][_0x8d21('0x7a')]=util['format'](_0x8d21('0x7b'),_0x26fa47[_0x8d21('0x66')]['name']);_0x272694['message'][_0x8d21('0x7c')]=_0x7e0c70[_0x8d21('0x7c')];_0x272694[_0x8d21('0x1e')][_0x8d21('0x7d')]=_0x7e0c70[_0x8d21('0x7c')];_0x272694[_0x8d21('0x1e')][_0x8d21('0x7e')]=_0x8d21('0x7f');_0x272694[_0x8d21('0x1e')][_0x8d21('0x49')]=htmlToText[_0x8d21('0x80')](_0x7e0c70[_0x8d21('0x1e')][_0x8d21('0x49')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x8d21('0x81'),'message':_0x272694[_0x8d21('0x1e')]},client9002);return _0x7e0c70;}return null;})[_0x8d21('0x28')](respondWithResult(_0x21f12d,null))[_0x8d21('0x20')](handleError(_0x21f12d,null));};exports[_0x8d21('0x82')]=function(_0x2c7b95,_0x525935){var _0x2db078=moment()[_0x8d21('0x83')]()[_0x8d21('0x84')]();var _0x240b9b=path[_0x8d21('0x59')](config[_0x8d21('0x5a')],_0x8d21('0x85'),_0x8d21('0x86'),_0x8d21('0x87'));var _0x165866=path[_0x8d21('0x59')](config['root'],_0x8d21('0x85'),_0x8d21('0x86'),_0x8d21('0x58'));var _0x50fa8e=util[_0x8d21('0x60')]('message-%s.eml',_0x2db078);return db[_0x8d21('0x46')][_0x8d21('0x47')]({'where':{'id':_0x2c7b95[_0x8d21('0x4a')]['id']},'attributes':['id',_0x8d21('0x49'),_0x8d21('0x88'),'to','cc',_0x8d21('0x89'),_0x8d21('0x8a'),_0x8d21('0x8b')],'include':_0x2c7b95[_0x8d21('0x33')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x525935,null))[_0x8d21('0x28')](function(_0x3a1dc4){if(_0x3a1dc4){var _0x1fc9cf=_0x3a1dc4;var _0x5d958f={'from':_0x1fc9cf[_0x8d21('0x88')],'to':_0x1fc9cf['to'],'subject':_0x1fc9cf['subject'],'html':htmlEntities[_0x8d21('0x8c')](_0x1fc9cf[_0x8d21('0x49')]),'headers':{'Date':moment(_0x1fc9cf[_0x8d21('0x8b')])[_0x8d21('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3a1dc4['cc']){_0x5d958f[_0x8d21('0x8d')]['Cc']=_0x3a1dc4['cc'];}if(_0x3a1dc4[_0x8d21('0x89')]){_0x5d958f[_0x8d21('0x8d')][_0x8d21('0x8e')]=_0x3a1dc4[_0x8d21('0x89')];}return new Promise(function(_0xe8b6b8,_0x25d2de){if(_0x3a1dc4[_0x8d21('0x8f')]){for(var _0x14afb8=0x0;_0x14afb8<_0x3a1dc4[_0x8d21('0x8f')][_0x8d21('0x44')];_0x14afb8++){var _0x4d04fd=_0x3a1dc4[_0x8d21('0x8f')][_0x14afb8];var _0x5d2bdc=path['join'](_0x165866,_0x4d04fd[_0x8d21('0x5c')]);if(fs[_0x8d21('0x90')](_0x5d2bdc)){_0x5d958f[_0x8d21('0x58')]['push']({'name':_0x4d04fd['name'],'contentType':_0x4d04fd[_0x8d21('0x31')],'data':fs[_0x8d21('0x91')](_0x5d2bdc)});}}}emlformat[_0x8d21('0x92')](_0x5d958f,function(_0x23166c,_0x1a1d54){if(_0x23166c)return _0x25d2de(_0x23166c);fs[_0x8d21('0x93')](path[_0x8d21('0x59')](_0x240b9b,_0x50fa8e),_0x1a1d54);return _0xe8b6b8(_0x1a1d54);});});}})[_0x8d21('0x28')](function(_0x5684d0){if(_0x5684d0){return _0x525935[_0x8d21('0x82')](path['join'](_0x240b9b,_0x50fa8e),_0x50fa8e,function(_0x79f886){if(!_0x79f886)fs[_0x8d21('0x94')](path[_0x8d21('0x59')](_0x240b9b,_0x50fa8e));});}})['catch'](handleError(_0x525935,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 2ce2619..b737578 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 _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 +var _0x84dc=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','MailMessage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x84dc,0x116));var _0xc84d=function(_0x5b2835,_0x582cdf){_0x5b2835=_0x5b2835-0x0;var _0x15694a=_0x84dc[_0x5b2835];return _0x15694a;};'use strict';var EventEmitter=require(_0xc84d('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc84d('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc84d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc84d('0x3'),'afterDestroy':_0xc84d('0x4')};function emitEvent(_0x508d51){return function(_0x300888,_0x234bd5,_0x313491){MailMessageEvents[_0xc84d('0x5')](_0x508d51+':'+_0x300888['id'],_0x300888);MailMessageEvents[_0xc84d('0x5')](_0x508d51,_0x300888);_0x313491(null);};}for(var e in events){if(events[_0xc84d('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc84d('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e0735b9..a646792 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 _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 +var _0x364d=['rimraf','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x33ed32,_0x1b50ff){var _0x55c3b8=function(_0x566f07){while(--_0x566f07){_0x33ed32['push'](_0x33ed32['shift']());}};_0x55c3b8(++_0x1b50ff);}(_0x364d,0xd3));var _0xd364=function(_0x4644da,_0x2c6a27){_0x4644da=_0x4644da-0x0;var _0x1226dc=_0x364d[_0x4644da];return _0x1226dc;};'use strict';var _=require('lodash');var util=require(_0xd364('0x0'));var logger=require(_0xd364('0x1'))(_0xd364('0x2'));var moment=require(_0xd364('0x3'));var BPromise=require(_0xd364('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xd364('0x5'));var rimraf=require(_0xd364('0x6'));var config=require('../../config/environment');var attributes=require(_0xd364('0x7'));module[_0xd364('0x8')]=function(_0x2213c4,_0x5c6580){return _0x2213c4[_0xd364('0x9')]('MailMessage',attributes,{'tableName':_0xd364('0xa'),'paranoid':![],'indexes':[{'name':_0xd364('0xb'),'fields':['messageId']},{'name':_0xd364('0xc'),'fields':['plainBody','subject'],'type':_0xd364('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x312b12,_0x4f7ae3,_0x431e51){if(_0x312b12[_0xd364('0xe')]){_0x312b12[_0xd364('0xf')]=htmlToText[_0xd364('0x10')](_0x312b12['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x431e51(null,_0x4f7ae3);},'afterCreate':function(_0x23bdfb,_0x53506a,_0x1c8e97){var _0x51d35b=_0x2213c4['models'];var _0x31674b=_0x23bdfb[_0xd364('0x11')]({'plain':!![]});if(_0x31674b[_0xd364('0x12')][_0xd364('0x13')]()==='in'||_0x31674b['direction'][_0xd364('0x13')]()===_0xd364('0x14')&&!_0x31674b[_0xd364('0x15')]&&!_['isNil'](_0x31674b[_0xd364('0x16')])){_0x51d35b[_0xd364('0x17')][_0xd364('0x18')]({'where':{'id':_0x31674b['MailInteractionId']}})['then'](function(_0x51c81d){if(_0x51c81d){_0x51c81d[_0xd364('0x19')]({'lastMsgAt':_0x31674b[_0xd364('0x1a')],'lastMsgDirection':_0x31674b[_0xd364('0x12')][_0xd364('0x13')]()});}})[_0xd364('0x1b')](function(_0x575f81){console[_0xd364('0x1c')](_0x575f81);});}_0x1c8e97();}},'charset':_0xd364('0x1d'),'collate':_0xd364('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2a87683..25e384e 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 _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 +var _0x0120=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0120,0x6f));var _0x0012=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0120[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0012('0xc')](config[_0x0012('0xd')],{'host':_0x0012('0xe'),'port':0x18eb});var socket=require(_0x0012('0xf'))(new Redis(config[_0x0012('0xd')]));require('./mailMessage.socket')[_0x0012('0x10')](socket);function respondWithRpcPromise(_0x2d484c,_0x1dc1b2,_0x323282){return new BPromise(function(_0x520171,_0x2d4674){return client['request'](_0x2d484c,_0x323282)[_0x0012('0x11')](function(_0x1d1c02){logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));logger['debug'](_0x0012('0x15'),_0x1dc1b2,'request\x20sent',JSON['stringify'](_0x1d1c02));if(_0x1d1c02['error']){if(_0x1d1c02['error'][_0x0012('0x16')]===0x1f4){logger['error'](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02[_0x0012('0x17')]['message']);return _0x2d4674(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02['error']['message']);return _0x520171(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}else{logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));_0x520171(_0x1d1c02[_0x0012('0x19')][_0x0012('0x18')]);}})[_0x0012('0x1a')](function(_0x5b236f){logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x5b236f);_0x2d4674(_0x5b236f);});});}exports['CreateMailMessage']=function(_0x45d00b){var _0x1f54fc=this;return new Promise(function(_0xa2e623,_0x2c837e){return db['MailMessage']['create'](_0x45d00b[_0x0012('0x1b')],{'raw':_0x45d00b[_0x0012('0x1c')]?_0x45d00b[_0x0012('0x1c')][_0x0012('0x1d')]===undefined?!![]:![]:!![]})[_0x0012('0x11')](function(_0x2e6a2c){logger[_0x0012('0x12')](_0x0012('0x1e'),_0x45d00b);logger['debug'](_0x0012('0x1e'),_0x45d00b,JSON[_0x0012('0x1f')](_0x2e6a2c));_0xa2e623(_0x2e6a2c);})['catch'](function(_0x36cf42){logger[_0x0012('0x17')](_0x0012('0x1e'),_0x36cf42[_0x0012('0x18')],_0x45d00b);_0x2c837e(_0x1f54fc[_0x0012('0x17')](0x1f4,_0x36cf42['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d9512b4..1e8f76a 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 _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 +var _0xa3b4=['register','length','mailMessage:','save','remove','update','removeListener'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xa3b4,0x130));var _0x4a3b=function(_0x774d4e,_0x328adf){_0x774d4e=_0x774d4e-0x0;var _0x13e542=_0xa3b4[_0x774d4e];return _0x13e542;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4a3b('0x0'),_0x4a3b('0x1'),_0x4a3b('0x2')];function createListener(_0x2fb16b,_0x132420){return function(_0x256bbf){_0x132420['emit'](_0x2fb16b,_0x256bbf);};}function removeListener(_0x541d47,_0x209fe7){return function(){MailMessageEvents[_0x4a3b('0x3')](_0x541d47,_0x209fe7);};}exports[_0x4a3b('0x4')]=function(_0x3acfed){for(var _0x4b6b77=0x0,_0x249afb=events[_0x4a3b('0x5')];_0x4b6b77<_0x249afb;_0x4b6b77++){var _0x3599b0=events[_0x4b6b77];var _0x36e55a=createListener(_0x4a3b('0x6')+_0x3599b0,_0x3acfed);MailMessageEvents['on'](_0x3599b0,_0x36e55a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 730ae81..b8c091a 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 _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 +var _0x52ce=['create','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x52ce,0x170));var _0xe52c=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x52ce[_0x36c6eb];return _0x30675b;};'use strict';var multer=require(_0xe52c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe52c('0x1'));var express=require(_0xe52c('0x2'));var router=express[_0xe52c('0x3')]();var fs_extra=require(_0xe52c('0x4'));var auth=require(_0xe52c('0x5'));var interaction=require(_0xe52c('0x6'));var config=require(_0xe52c('0x7'));var controller=require(_0xe52c('0x8'));router[_0xe52c('0x9')]('/',auth[_0xe52c('0xa')](),controller[_0xe52c('0xb')]);router[_0xe52c('0x9')](_0xe52c('0xc'),auth['isAuthenticated'](),controller[_0xe52c('0xd')]);router[_0xe52c('0x9')](_0xe52c('0xe'),auth[_0xe52c('0xa')](),controller['show']);router[_0xe52c('0x9')](_0xe52c('0xf'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x10')]);router['get'](_0xe52c('0x11'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x12')]);router[_0xe52c('0x9')](_0xe52c('0x13'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x14')]);router[_0xe52c('0x15')]('/',auth[_0xe52c('0xa')](),controller[_0xe52c('0x16')]);router[_0xe52c('0x15')](_0xe52c('0x11'),auth[_0xe52c('0xa')](),controller['addTeams']);router['post']('/:id/users',auth[_0xe52c('0xa')](),controller['addAgents']);router[_0xe52c('0x17')](_0xe52c('0xe'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x18')]);router[_0xe52c('0x19')](_0xe52c('0xe'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x1a')]);router[_0xe52c('0x19')](_0xe52c('0x11'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x1b')]);router['delete'](_0xe52c('0x13'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x1c')]);module[_0xe52c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1628fde..ef51058 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 _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 +var _0x3c33=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3c33,0x67));var _0x33c3=function(_0x5bce6d,_0x3d3b72){_0x5bce6d=_0x5bce6d-0x0;var _0x4ee73c=_0x3c33[_0x5bce6d];return _0x4ee73c;};'use strict';var Sequelize=require('sequelize');module[_0x33c3('0x0')]={'name':{'type':Sequelize[_0x33c3('0x1')],'unique':_0x33c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x33c3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x33c3('0x4'),_0x33c3('0x5'),_0x33c3('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7e245b9..1bca525 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 _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 +var _0x21c7=['tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','sequelize','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','pick','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','include','query','MailQueue','rows','catch','params','keys','intersection','model','attributes','fields','includeAll','merge','options','find','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserMailQueue','filters','length','hasOwnProperty','nolimit','order','sort','filter','findAll','User','UserId','agent','mailPause','createdAt','format','SIP','updatedAt','getTeams','findOne','addTeams','ids','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','Team','select','field'];(function(_0x15a64c,_0x180366){var _0x1ee0ef=function(_0x5cf9bd){while(--_0x5cf9bd){_0x15a64c['push'](_0x15a64c['shift']());}};_0x1ee0ef(++_0x180366);}(_0x21c7,0x183));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x721c('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x721c('0x1'));var Redis=require(_0x721c('0x2'));var qs=require(_0x721c('0x3'));var logger=require(_0x721c('0x4'))(_0x721c('0x5'));var config=require(_0x721c('0x6'));var db=require('../../mysqldb')['db'];config[_0x721c('0x7')]=_[_0x721c('0x8')](config[_0x721c('0x7')],{'host':_0x721c('0x9'),'port':0x18eb});var socket=require(_0x721c('0xa'))(new Redis(config[_0x721c('0x7')]));require('./mailQueue.socket')[_0x721c('0xb')](socket);function respondWithStatusCode(_0x4b7f4d,_0x3fa36a){_0x3fa36a=_0x3fa36a||0xcc;return function(_0x4f643a){if(_0x4f643a){return _0x4b7f4d[_0x721c('0xc')](_0x3fa36a);}return _0x4b7f4d[_0x721c('0xd')](_0x3fa36a)[_0x721c('0xe')]();};}function respondWithResult(_0x2eaaf9,_0x5b9362){_0x5b9362=_0x5b9362||0xc8;return function(_0x52686c){if(_0x52686c){return _0x2eaaf9[_0x721c('0xd')](_0x5b9362)[_0x721c('0xf')](_0x52686c);}};}function respondWithFilteredResult(_0x386053,_0x108fc9){return function(_0xfb71dc){if(_0xfb71dc){var _0x2ba4ce=typeof _0x108fc9[_0x721c('0x10')]===_0x721c('0x11')&&typeof _0x108fc9[_0x721c('0x12')]===_0x721c('0x11');var _0x593fa2=_0xfb71dc[_0x721c('0x13')];var _0x5061aa=_0x2ba4ce?0x0:_0x108fc9[_0x721c('0x10')];var _0x113a8f=_0x2ba4ce?_0xfb71dc['count']:_0x108fc9['offset']+_0x108fc9[_0x721c('0x12')];var _0xe13815;if(_0x113a8f>=_0x593fa2){_0x113a8f=_0x593fa2;_0xe13815=0xc8;}else{_0xe13815=0xce;}_0x386053[_0x721c('0xd')](_0xe13815);return _0x386053[_0x721c('0x14')]('Content-Range',_0x5061aa+'-'+_0x113a8f+'/'+_0x593fa2)['json'](_0xfb71dc);}return null;};}function saveUpdates(_0xe99bd5){return function(_0x41d51d){if(_0x41d51d){return _0x41d51d[_0x721c('0x15')](_0xe99bd5)['then'](function(_0x9e04c8){return _0x9e04c8;});}return null;};}function removeEntity(_0x1ccc6e){return function(_0x31043e){if(_0x31043e){return _0x31043e[_0x721c('0x16')]()[_0x721c('0x17')](function(){var _0x201c64=_0x31043e[_0x721c('0x18')]({'plain':!![]});var _0x491a20='MailQueues';return db['UserProfileResource'][_0x721c('0x16')]({'where':{'type':_0x491a20,'resourceId':_0x201c64['id']}})[_0x721c('0x17')](function(){return _0x31043e;});})[_0x721c('0x17')](function(){_0x1ccc6e['status'](0xcc)[_0x721c('0xe')]();});}};}function handleEntityNotFound(_0x4b1316){return function(_0x340820){if(!_0x340820){_0x4b1316[_0x721c('0xc')](0x194);}return _0x340820;};}function handleError(_0x3bc7f7,_0x4a6755){_0x4a6755=_0x4a6755||0x1f4;return function(_0x3f832e){logger[_0x721c('0x19')](_0x3f832e[_0x721c('0x1a')]);if(_0x3f832e[_0x721c('0x1b')]){delete _0x3f832e[_0x721c('0x1b')];}_0x3bc7f7[_0x721c('0xd')](_0x4a6755)[_0x721c('0x1c')](_0x3f832e);};}exports[_0x721c('0x1d')]=function(_0xa7935f,_0x3af67d){var _0x38e868={};var _0x3012dd={'count':0x0,'rows':[]};var _0xe02e33=_[_0x721c('0x1e')](db['MailQueue'][_0x721c('0x1f')],function(_0x39b7b9){return{'name':_0x39b7b9[_0x721c('0x20')],'type':_0x39b7b9[_0x721c('0x21')][_0x721c('0x22')]};});_0x38e868=qs['getOptions'](_0xe02e33,_0xa7935f);var _0x58a16d={'where':_0x38e868[_0x721c('0x23')]};return db['MailQueue'][_0x721c('0x13')](_0x58a16d)[_0x721c('0x17')](function(_0x52bfc3){_0x3012dd[_0x721c('0x13')]=_0x52bfc3;_0x38e868['include']=qs[_0x721c('0x24')](_0xa7935f[_0x721c('0x25')]);return db[_0x721c('0x26')]['findAll'](_0x38e868);})[_0x721c('0x17')](function(_0x40d6f4){_0x3012dd[_0x721c('0x27')]=_0x40d6f4;return _0x3012dd;})[_0x721c('0x17')](respondWithFilteredResult(_0x3af67d,_0x38e868))[_0x721c('0x28')](handleError(_0x3af67d,null));};exports['show']=function(_0x541438,_0x7e0b73){var _0x156e96={'raw':!![],'where':{'id':_0x541438[_0x721c('0x29')]['id']}},_0x8834a4={};_0x8834a4['model']=_[_0x721c('0x2a')](db['MailQueue'][_0x721c('0x1f')]);_0x8834a4[_0x721c('0x25')]=_[_0x721c('0x2a')](_0x541438[_0x721c('0x25')]);_0x8834a4['filters']=_[_0x721c('0x2b')](_0x8834a4[_0x721c('0x2c')],_0x8834a4['query']);_0x156e96[_0x721c('0x2d')]=_['intersection'](_0x8834a4[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x541438[_0x721c('0x25')]['fields']));_0x156e96['attributes']=_0x156e96[_0x721c('0x2d')]['length']?_0x156e96['attributes']:_0x8834a4[_0x721c('0x2c')];if(_0x541438['query'][_0x721c('0x2f')]){_0x156e96['include']=[{'all':!![]}];}_0x156e96=_[_0x721c('0x30')]({},_0x156e96,_0x541438[_0x721c('0x31')]);return db[_0x721c('0x26')][_0x721c('0x32')](_0x156e96)[_0x721c('0x17')](handleEntityNotFound(_0x7e0b73,null))[_0x721c('0x17')](respondWithResult(_0x7e0b73,null))[_0x721c('0x28')](handleError(_0x7e0b73,null));};exports['create']=function(_0x24b430,_0x423b09){return db[_0x721c('0x26')][_0x721c('0x33')](_0x24b430['body'],{})[_0x721c('0x17')](function(_0x1003bd){var _0x18f99d=_0x24b430['user'][_0x721c('0x18')]({'plain':!![]});if(!_0x18f99d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f99d[_0x721c('0x34')]===_0x721c('0x35')){var _0x12c223=_0x1003bd['get']({'plain':!![]});var _0x15e988='MailQueues';return db[_0x721c('0x36')][_0x721c('0x32')]({'where':{'name':_0x15e988,'userProfileId':_0x18f99d[_0x721c('0x37')]},'raw':!![]})['then'](function(_0x5b230e){if(_0x5b230e&&_0x5b230e['autoAssociation']===0x0){return db['UserProfileResource'][_0x721c('0x33')]({'name':_0x12c223[_0x721c('0x1b')],'resourceId':_0x12c223['id'],'type':_0x5b230e[_0x721c('0x1b')],'sectionId':_0x5b230e['id']},{})[_0x721c('0x17')](function(){return _0x1003bd;});}else{return _0x1003bd;}})[_0x721c('0x28')](function(_0x17384b){logger['error'](_0x721c('0x38'),_0x17384b);throw _0x17384b;});}return _0x1003bd;})[_0x721c('0x17')](respondWithResult(_0x423b09,0xc9))['catch'](handleError(_0x423b09,null));};exports[_0x721c('0x15')]=function(_0x202ffc,_0x48dd31){if(_0x202ffc[_0x721c('0x39')]['id']){delete _0x202ffc[_0x721c('0x39')]['id'];}return db[_0x721c('0x26')][_0x721c('0x32')]({'where':{'id':_0x202ffc[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x48dd31,null))['then'](saveUpdates(_0x202ffc[_0x721c('0x39')],null))[_0x721c('0x17')](respondWithResult(_0x48dd31,null))['catch'](handleError(_0x48dd31,null));};exports[_0x721c('0x16')]=function(_0x1cb0cc,_0x298a5d){return db['MailQueue'][_0x721c('0x32')]({'where':{'id':_0x1cb0cc[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x298a5d,null))[_0x721c('0x17')](removeEntity(_0x298a5d,null))[_0x721c('0x28')](handleError(_0x298a5d,null));};exports[_0x721c('0x3a')]=function(_0x59d7ca,_0x11c1f4){return db[_0x721c('0x26')]['describe']()['then'](respondWithResult(_0x11c1f4,null))[_0x721c('0x28')](handleError(_0x11c1f4,null));};exports['getMembers']=function(_0x147392,_0x4d11ef){var _0x5a44a7={'raw':!![],'where':{}},_0x29b631={},_0x1027f3;return db['MailQueue']['findOne']({'where':{'id':_0x147392[_0x721c('0x29')]['id']}})['then'](handleEntityNotFound(_0x4d11ef,null))[_0x721c('0x17')](function(_0x52f2cf){if(_0x52f2cf){_0x1027f3=_0x52f2cf[_0x721c('0x18')]({'plain':!![]});_0x29b631[_0x721c('0x2c')]=_[_0x721c('0x2a')](db[_0x721c('0x3b')]['rawAttributes']);_0x29b631['query']=_['keys'](_0x147392[_0x721c('0x25')]);_0x29b631[_0x721c('0x3c')]=_[_0x721c('0x2b')](_0x29b631['model'],_0x29b631[_0x721c('0x25')]);_0x5a44a7[_0x721c('0x2d')]=_[_0x721c('0x2b')](_0x29b631[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x147392[_0x721c('0x25')]['fields']));_0x5a44a7[_0x721c('0x2d')]=_0x5a44a7['attributes'][_0x721c('0x3d')]?_0x5a44a7[_0x721c('0x2d')]:_0x29b631['model'];if(!_0x147392[_0x721c('0x25')][_0x721c('0x3e')](_0x721c('0x3f'))){_0x5a44a7['limit']=qs[_0x721c('0x12')](_0x147392[_0x721c('0x25')][_0x721c('0x12')]);_0x5a44a7[_0x721c('0x10')]=qs[_0x721c('0x10')](_0x147392[_0x721c('0x25')][_0x721c('0x10')]);}_0x5a44a7[_0x721c('0x40')]=qs[_0x721c('0x41')](_0x147392[_0x721c('0x25')][_0x721c('0x41')]);_0x5a44a7[_0x721c('0x23')]=qs[_0x721c('0x3c')](_['pick'](_0x147392[_0x721c('0x25')],_0x29b631[_0x721c('0x3c')]));_0x5a44a7[_0x721c('0x23')]['MailQueueId']=_0x52f2cf['id'];if(_0x147392['query'][_0x721c('0x42')]){_0x5a44a7['where']=_[_0x721c('0x30')](_0x5a44a7[_0x721c('0x23')],{'$or':_['map'](_0x5a44a7[_0x721c('0x2d')],function(_0x2cb426){var _0x446348={};_0x446348[_0x2cb426]={'$like':'%'+_0x147392[_0x721c('0x25')][_0x721c('0x42')]+'%'};return _0x446348;})});}_0x5a44a7=_[_0x721c('0x30')]({},_0x5a44a7,_0x147392[_0x721c('0x31')]);return db[_0x721c('0x3b')][_0x721c('0x43')](_0x5a44a7);}})[_0x721c('0x17')](function(_0x3d0601){if(_0x3d0601){return db[_0x721c('0x44')]['findAndCountAll']({'where':{'id':_['map'](_0x3d0601,_0x721c('0x45')),'role':_0x721c('0x46')},'attributes':['id','name',_0x721c('0x47'),'updatedAt',_0x721c('0x48')]});}})[_0x721c('0x17')](function(_0x5592eb){if(_0x5592eb){return{'count':_0x5592eb[_0x721c('0x13')],'rows':_['map'](_0x5592eb[_0x721c('0x27')],function(_0x4718b0){return{'membername':_0x4718b0['name'],'UserId':_0x4718b0['id'],'queue_name':_0x1027f3[_0x721c('0x1b')],'MailQueueId':_0x1027f3['id'],'interface':util[_0x721c('0x49')]('%s/%s',_0x721c('0x4a'),_0x4718b0[_0x721c('0x1b')]),'penalty':0x0,'paused':_0x4718b0['mailPause'],'createdAt':_0x4718b0['createdAt'],'updatedAt':_0x4718b0[_0x721c('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x721c('0x17')](respondWithFilteredResult(_0x4d11ef,_0x5a44a7))[_0x721c('0x28')](handleError(_0x4d11ef,null));};exports[_0x721c('0x4c')]=function(_0x30a11d,_0x5b27c0){var _0x388e9a={};var _0x49286b={};var _0x3cca5c;var _0x1f372f;return db[_0x721c('0x26')][_0x721c('0x4d')]({'where':{'id':_0x30a11d[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x5b27c0,null))['then'](function(_0x38f631){if(_0x38f631){_0x3cca5c=_0x38f631;_0x49286b['model']=_[_0x721c('0x2a')](db['Team']['rawAttributes']);_0x49286b[_0x721c('0x25')]=_[_0x721c('0x2a')](_0x30a11d['query']);_0x49286b[_0x721c('0x3c')]=_[_0x721c('0x2b')](_0x49286b[_0x721c('0x2c')],_0x49286b[_0x721c('0x25')]);_0x388e9a['attributes']=_[_0x721c('0x2b')](_0x49286b[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x30a11d[_0x721c('0x25')][_0x721c('0x2e')]));_0x388e9a[_0x721c('0x2d')]=_0x388e9a[_0x721c('0x2d')]['length']?_0x388e9a[_0x721c('0x2d')]:_0x49286b[_0x721c('0x2c')];_0x388e9a[_0x721c('0x40')]=qs[_0x721c('0x41')](_0x30a11d[_0x721c('0x25')]['sort']);_0x388e9a[_0x721c('0x23')]=qs[_0x721c('0x3c')](_['pick'](_0x30a11d[_0x721c('0x25')],_0x49286b[_0x721c('0x3c')]));if(_0x30a11d[_0x721c('0x25')]['filter']){_0x388e9a['where']=_[_0x721c('0x30')](_0x388e9a[_0x721c('0x23')],{'$or':_[_0x721c('0x1e')](_0x388e9a[_0x721c('0x2d')],function(_0x31ceac){var _0x453722={};_0x453722[_0x31ceac]={'$like':'%'+_0x30a11d[_0x721c('0x25')][_0x721c('0x42')]+'%'};return _0x453722;})});}_0x388e9a=_[_0x721c('0x30')]({},_0x388e9a,_0x30a11d[_0x721c('0x31')]);return _0x3cca5c[_0x721c('0x4c')](_0x388e9a);}})[_0x721c('0x17')](function(_0x2ab965){if(_0x2ab965){_0x1f372f=_0x2ab965[_0x721c('0x3d')];if(!_0x30a11d[_0x721c('0x25')][_0x721c('0x3e')](_0x721c('0x3f'))){_0x388e9a[_0x721c('0x12')]=qs[_0x721c('0x12')](_0x30a11d[_0x721c('0x25')][_0x721c('0x12')]);_0x388e9a[_0x721c('0x10')]=qs[_0x721c('0x10')](_0x30a11d['query'][_0x721c('0x10')]);}return _0x3cca5c[_0x721c('0x4c')](_0x388e9a);}})[_0x721c('0x17')](function(_0x2273bd){if(_0x2273bd){return _0x2273bd?{'count':_0x1f372f,'rows':_0x2273bd}:null;}})[_0x721c('0x17')](respondWithResult(_0x5b27c0,null))[_0x721c('0x28')](handleError(_0x5b27c0,null));};exports[_0x721c('0x4e')]=function(_0x3fb458,_0x3a985f){var _0x95bdad=_0x3fb458['body'][_0x721c('0x4f')];return db['Team'][_0x721c('0x43')]({'where':{'id':_0x95bdad},'attributes':['id'],'include':[{'model':db[_0x721c('0x44')],'as':'Agents','attributes':['id',_0x721c('0x1b'),_0x721c('0x50'),_0x721c('0x51'),'interface'],'raw':!![]}]})[_0x721c('0x17')](function(_0x19e069){if(_0x19e069){var _0x84a589=_[_0x721c('0x52')](_0x19e069,function(_0x486f3b){var _0x282c9a=_0x486f3b['get']({'plain':!![]});return _0x282c9a[_0x721c('0x53')];});return db[_0x721c('0x26')]['find']({'where':{'id':_0x3fb458[_0x721c('0x29')]['id']}})[_0x721c('0x17')](function(_0x2baebf){return db['sequelize'][_0x721c('0x54')](function(_0x3c9220){return _0x2baebf[_0x721c('0x4e')](_0x95bdad,{'transaction':_0x3c9220})[_0x721c('0x17')](function(){return BPromise[_0x721c('0x55')](_0x84a589,function(_0x4cf1a2){return db[_0x721c('0x3b')][_0x721c('0x56')]({'where':{'UserId':_0x4cf1a2['id'],'MailQueueId':_0x3fb458[_0x721c('0x29')]['id']},'transaction':_0x3c9220});});})['then'](function(){_0x84a589['forEach'](function(_0x2fc7a8){socket[_0x721c('0x57')](_0x721c('0x58'),{'UserId':_0x2fc7a8['id'],'MailQueueId':_0x2baebf['id']});});});});});}})[_0x721c('0x17')](respondWithStatusCode(_0x3a985f,null))[_0x721c('0x28')](handleError(_0x3a985f,null));};exports[_0x721c('0x59')]=function(_0x208f93,_0x3ece00){return db[_0x721c('0x5a')]['findAll']({'where':{'id':_0x208f93[_0x721c('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x721c('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3ece00,null))[_0x721c('0x17')](function(_0x25c777){var _0xce7c0a=_['map'](_0x25c777,'id');var _0x1c7108=[];var _0x113261=[];var _0x11a891=squel[_0x721c('0x5b')]();_0x11a891[_0x721c('0x5c')](_0x721c('0x5d'))[_0x721c('0x5e')]('team_has_mail_queues','tq')[_0x721c('0x5f')](_0x721c('0x60'),'ut',_0x721c('0x61'))[_0x721c('0x23')](_0x721c('0x62'),_0x208f93[_0x721c('0x29')]['id']);for(var _0x2cf833=0x0;_0x2cf833<_0x25c777[_0x721c('0x3d')];_0x2cf833+=0x1){let _0x42d423=_0x25c777[_0x2cf833];for(var _0x340b6e=0x0;_0x340b6e<_0x42d423[_0x721c('0x53')][_0x721c('0x3d')];_0x340b6e+=0x1){let _0x31b19b=_0x42d423[_0x721c('0x53')][_0x340b6e];var _0x24c582=_0x11a891[_0x721c('0x63')]();_0x24c582['where'](_0x721c('0x64'),_0x31b19b['id']);_0x113261['push'](db['sequelize'][_0x721c('0x25')](_0x24c582[_0x721c('0x65')](),{'type':db['sequelize'][_0x721c('0x66')][_0x721c('0x67')]})[_0x721c('0x17')](function(_0x111821){if(_0x111821[_0x721c('0x3d')]===0x1){return _0x31b19b['id'];}else{var _0x13f3ae=_[_0x721c('0x68')](_[_0x721c('0x1e')](_0x111821,_0x721c('0x69')),function(_0x5d573a){return _[_0x721c('0x6a')](_0xce7c0a,_0x5d573a);});if(_0x13f3ae){return _0x31b19b['id'];}}}));}}return BPromise[_0x721c('0x6b')](_0x113261)['then'](function(_0x1b44f4){_0x1c7108=_(_0x1c7108)['union'](_0x1b44f4)[_0x721c('0x6c')]()[_0x721c('0x6d')]();return db[_0x721c('0x26')][_0x721c('0x32')]({'where':{'id':_0x208f93[_0x721c('0x29')]['id']}})[_0x721c('0x17')](function(_0x2207bb){return db[_0x721c('0x6e')]['transaction'](function(_0x1a11cd){return _0x2207bb['removeTeams'](_0x208f93[_0x721c('0x25')][_0x721c('0x4f')],{'transaction':_0x1a11cd})[_0x721c('0x17')](function(){if(!_[_0x721c('0x6f')](_0x1c7108)){return _0x2207bb[_0x721c('0x70')](_0x1c7108,{'transaction':_0x1a11cd});}})[_0x721c('0x17')](function(){_0x1c7108[_0x721c('0x71')](function(_0x21522a){socket['emit'](_0x721c('0x72'),{'UserId':_0x21522a,'MailQueueId':_0x2207bb['id']});});});});});});})[_0x721c('0x17')](respondWithStatusCode(_0x3ece00,null))[_0x721c('0x28')](handleError(_0x3ece00,null));};exports[_0x721c('0x73')]=function(_0x45579d,_0x14e434){return db['MailQueue'][_0x721c('0x32')]({'where':{'id':_0x45579d[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x14e434,null))[_0x721c('0x17')](function(_0x25f064){if(_0x25f064){return _0x25f064['addAgents'](_0x45579d['body'][_0x721c('0x4f')],_[_0x721c('0x74')](_0x45579d['body'],[_0x721c('0x4f'),'id'])||{})[_0x721c('0x75')](function(_0x1b5d20){for(var _0x491555=0x0;_0x491555<_0x45579d[_0x721c('0x39')][_0x721c('0x4f')]['length'];_0x491555+=0x1){socket[_0x721c('0x57')](_0x721c('0x58'),{'UserId':Number(_0x45579d[_0x721c('0x39')][_0x721c('0x4f')][_0x491555]),'MailQueueId':Number(_0x45579d['params']['id'])});}return _0x1b5d20;});}})['then'](respondWithResult(_0x14e434,null))['catch'](handleError(_0x14e434,null));};exports[_0x721c('0x70')]=function(_0x30c7a1,_0x561df4){return db[_0x721c('0x26')][_0x721c('0x32')]({'where':{'id':_0x30c7a1[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x561df4,null))['then'](function(_0x46414f){if(_0x46414f){return _0x46414f[_0x721c('0x70')](_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')])[_0x721c('0x17')](function(){if(_['isArray'](_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')])){for(var _0x1c42cd=0x0;_0x1c42cd<_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')][_0x721c('0x3d')];_0x1c42cd+=0x1){socket['emit'](_0x721c('0x72'),{'UserId':Number(_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')][_0x1c42cd]),'MailQueueId':Number(_0x30c7a1[_0x721c('0x29')]['id'])});}}else{socket[_0x721c('0x57')](_0x721c('0x72'),{'UserId':Number(_0x30c7a1['query']['ids']),'MailQueueId':Number(_0x30c7a1['params']['id'])});}});}})[_0x721c('0x17')](respondWithStatusCode(_0x561df4,null))['catch'](handleError(_0x561df4,null));};exports['getAgents']=function(_0x29a551,_0xb28bed){var _0x2d7731={};var _0x54f2db={};var _0x3f36a1;var _0x556310;return db[_0x721c('0x26')]['findOne']({'where':{'id':_0x29a551[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0xb28bed,null))[_0x721c('0x17')](function(_0x374cde){if(_0x374cde){_0x3f36a1=_0x374cde;_0x54f2db[_0x721c('0x2c')]=_['keys'](db[_0x721c('0x44')][_0x721c('0x1f')]);_0x54f2db[_0x721c('0x25')]=_[_0x721c('0x2a')](_0x29a551[_0x721c('0x25')]);_0x54f2db[_0x721c('0x3c')]=_[_0x721c('0x2b')](_0x54f2db[_0x721c('0x2c')],_0x54f2db[_0x721c('0x25')]);_0x2d7731['attributes']=_[_0x721c('0x2b')](_0x54f2db[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x29a551[_0x721c('0x25')]['fields']));_0x2d7731['attributes']=_0x2d7731['attributes'][_0x721c('0x3d')]?_0x2d7731[_0x721c('0x2d')]:_0x54f2db['model'];_0x2d7731[_0x721c('0x40')]=qs['sort'](_0x29a551[_0x721c('0x25')][_0x721c('0x41')]);_0x2d7731[_0x721c('0x23')]=qs[_0x721c('0x3c')](_[_0x721c('0x76')](_0x29a551[_0x721c('0x25')],_0x54f2db[_0x721c('0x3c')]));if(_0x29a551[_0x721c('0x25')][_0x721c('0x42')]){_0x2d7731[_0x721c('0x23')]=_[_0x721c('0x30')](_0x2d7731[_0x721c('0x23')],{'$or':_[_0x721c('0x1e')](_0x2d7731[_0x721c('0x2d')],function(_0x2a9d89){var _0x565295={};_0x565295[_0x2a9d89]={'$like':'%'+_0x29a551[_0x721c('0x25')][_0x721c('0x42')]+'%'};return _0x565295;})});}_0x2d7731=_[_0x721c('0x30')]({},_0x2d7731,_0x29a551['options']);return _0x3f36a1[_0x721c('0x77')](_0x2d7731);}})[_0x721c('0x17')](function(_0x19dc45){if(_0x19dc45){_0x556310=_0x19dc45[_0x721c('0x3d')];if(!_0x29a551[_0x721c('0x25')][_0x721c('0x3e')](_0x721c('0x3f'))){_0x2d7731['limit']=qs['limit'](_0x29a551[_0x721c('0x25')][_0x721c('0x12')]);_0x2d7731[_0x721c('0x10')]=qs['offset'](_0x29a551[_0x721c('0x25')][_0x721c('0x10')]);}return _0x3f36a1[_0x721c('0x77')](_0x2d7731);}})['then'](function(_0x4e7821){if(_0x4e7821){return _0x4e7821?{'count':_0x556310,'rows':_0x4e7821}:null;}})['then'](respondWithResult(_0xb28bed,null))['catch'](handleError(_0xb28bed,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 94759e0..7d49e64 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 _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 +var _0x649f=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4c7594,_0x270c9c){var _0x2f0614=function(_0x5cb540){while(--_0x5cb540){_0x4c7594['push'](_0x4c7594['shift']());}};_0x2f0614(++_0x270c9c);}(_0x649f,0x1ae));var _0xf649=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x649f[_0xbf8ebe];return _0x1e25e8;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf649('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf649('0x1')](0x0);var events={'afterCreate':_0xf649('0x2'),'afterUpdate':'update','afterDestroy':_0xf649('0x3')};function emitEvent(_0x3feebf){return function(_0x5f1297,_0x558770,_0x26fe55){MailQueueEvents[_0xf649('0x4')](_0x3feebf+':'+_0x5f1297['id'],_0x5f1297);MailQueueEvents[_0xf649('0x4')](_0x3feebf,_0x5f1297);_0x26fe55(null);};}for(var e in events){if(events[_0xf649('0x5')](e)){var event=events[e];MailQueue[_0xf649('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 706d127..b0c3dc0 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 _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 +var _0xa256=['request-promise','path','rimraf','exports','define','MailQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1a9cd3,_0x16882e){var _0x3f5026=function(_0x17fc09){while(--_0x17fc09){_0x1a9cd3['push'](_0x1a9cd3['shift']());}};_0x3f5026(++_0x16882e);}(_0xa256,0x1a8));var _0x6a25=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xa256[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x6a25('0x0'));var util=require(_0x6a25('0x1'));var logger=require(_0x6a25('0x2'))('api');var moment=require(_0x6a25('0x3'));var BPromise=require(_0x6a25('0x4'));var rp=require(_0x6a25('0x5'));var fs=require('fs');var path=require(_0x6a25('0x6'));var rimraf=require(_0x6a25('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x6a25('0x8')]=function(_0x1a94a9,_0x59c104){return _0x1a94a9[_0x6a25('0x9')](_0x6a25('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index b703b1d..867b6bc 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 _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 +var _0xa227=['result','GetMailQueue','MailQueue','options','raw','attributes','limit','include','map','model','debug','catch','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19caba,_0x2078d7){var _0x441070=function(_0x20bf38){while(--_0x20bf38){_0x19caba['push'](_0x19caba['shift']());}};_0x441070(++_0x2078d7);}(_0xa227,0x18b));var _0x7a22=function(_0x143089,_0x3ff842){_0x143089=_0x143089-0x0;var _0x3196fc=_0xa227[_0x143089];return _0x3196fc;};'use strict';var _=require(_0x7a22('0x0'));var util=require(_0x7a22('0x1'));var moment=require(_0x7a22('0x2'));var BPromise=require(_0x7a22('0x3'));var rs=require(_0x7a22('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a22('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a22('0x6'))('rpc');var config=require(_0x7a22('0x7'));var jayson=require(_0x7a22('0x8'));var client=jayson['client'][_0x7a22('0x9')]({'port':0x232a});config[_0x7a22('0xa')]=_[_0x7a22('0xb')](config[_0x7a22('0xa')],{'host':_0x7a22('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x7a22('0xd')](socket);function respondWithRpcPromise(_0x3a2d6d,_0x38de7e,_0x5a18d0){return new BPromise(function(_0x337735,_0x2254ff){return client['request'](_0x3a2d6d,_0x5a18d0)[_0x7a22('0xe')](function(_0x426a99){logger[_0x7a22('0xf')](_0x7a22('0x10'),_0x38de7e,_0x7a22('0x11'));logger['debug'](_0x7a22('0x12'),_0x38de7e,_0x7a22('0x11'),JSON[_0x7a22('0x13')](_0x426a99));if(_0x426a99[_0x7a22('0x14')]){if(_0x426a99[_0x7a22('0x14')][_0x7a22('0x15')]===0x1f4){logger[_0x7a22('0x14')](_0x7a22('0x10'),_0x38de7e,_0x426a99[_0x7a22('0x14')][_0x7a22('0x16')]);return _0x2254ff(_0x426a99[_0x7a22('0x14')]['message']);}logger[_0x7a22('0x14')](_0x7a22('0x10'),_0x38de7e,_0x426a99[_0x7a22('0x14')][_0x7a22('0x16')]);return _0x337735(_0x426a99['error'][_0x7a22('0x16')]);}else{logger[_0x7a22('0xf')](_0x7a22('0x10'),_0x38de7e,_0x7a22('0x11'));_0x337735(_0x426a99[_0x7a22('0x17')][_0x7a22('0x16')]);}})['catch'](function(_0x796273){logger[_0x7a22('0x14')](_0x7a22('0x10'),_0x38de7e,_0x796273);_0x2254ff(_0x796273);});});}exports[_0x7a22('0x18')]=function(_0x23fe70){var _0x4c7a83=this;return new Promise(function(_0x5b3995,_0x173e8b){return db[_0x7a22('0x19')]['findAll']({'raw':_0x23fe70['options']?_0x23fe70[_0x7a22('0x1a')][_0x7a22('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fe70['options']?_0x23fe70[_0x7a22('0x1a')]['where']||null:null,'attributes':_0x23fe70['options']?_0x23fe70[_0x7a22('0x1a')][_0x7a22('0x1c')]||null:null,'limit':_0x23fe70[_0x7a22('0x1a')]?_0x23fe70['options'][_0x7a22('0x1d')]||null:null,'include':_0x23fe70[_0x7a22('0x1a')]?_0x23fe70[_0x7a22('0x1a')][_0x7a22('0x1e')]?_['map'](_0x23fe70['options'][_0x7a22('0x1e')],function(_0x254247){return{'model':db[_0x254247['model']],'as':_0x254247['as'],'attributes':_0x254247[_0x7a22('0x1c')],'include':_0x254247[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0x254247['include'],function(_0xdff368){return{'model':db[_0xdff368[_0x7a22('0x20')]],'as':_0xdff368['as'],'attributes':_0xdff368[_0x7a22('0x1c')],'include':_0xdff368[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0xdff368[_0x7a22('0x1e')],function(_0x336dff){return{'model':db[_0x336dff['model']],'as':_0x336dff['as'],'attributes':_0x336dff[_0x7a22('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a22('0xe')](function(_0x50140c){logger[_0x7a22('0xf')](_0x7a22('0x18'),_0x23fe70);logger[_0x7a22('0x21')]('GetMailQueue',_0x23fe70,JSON[_0x7a22('0x13')](_0x50140c));_0x5b3995(_0x50140c);})[_0x7a22('0x22')](function(_0x11f67d){logger[_0x7a22('0x14')](_0x7a22('0x18'),_0x11f67d[_0x7a22('0x16')],_0x23fe70);_0x173e8b(_0x4c7a83['error'](0x1f4,_0x11f67d[_0x7a22('0x16')]));});});};exports[_0x7a22('0x23')]=function(_0x15a84f){var _0x3ab16b=this;return new Promise(function(_0x1b3f76,_0x45545d){return db[_0x7a22('0x19')][_0x7a22('0x24')]({'raw':_0x15a84f['options']?_0x15a84f[_0x7a22('0x1a')][_0x7a22('0x1b')]===undefined?!![]:![]:!![],'where':_0x15a84f[_0x7a22('0x1a')]?_0x15a84f[_0x7a22('0x1a')][_0x7a22('0x25')]||null:null,'attributes':_0x15a84f[_0x7a22('0x1a')]?_0x15a84f['options'][_0x7a22('0x1c')]||null:null,'include':_0x15a84f['options']?_0x15a84f[_0x7a22('0x1a')][_0x7a22('0x1e')]?_['map'](_0x15a84f[_0x7a22('0x1a')]['include'],function(_0x1406df){return{'model':db[_0x1406df[_0x7a22('0x20')]],'as':_0x1406df['as'],'attributes':_0x1406df[_0x7a22('0x1c')],'include':_0x1406df[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0x1406df[_0x7a22('0x1e')],function(_0x14d056){return{'model':db[_0x14d056['model']],'as':_0x14d056['as'],'attributes':_0x14d056['attributes'],'include':_0x14d056[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0x14d056[_0x7a22('0x1e')],function(_0x2f784e){return{'model':db[_0x2f784e[_0x7a22('0x20')]],'as':_0x2f784e['as'],'attributes':_0x2f784e[_0x7a22('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a22('0xe')](function(_0x56b169){logger[_0x7a22('0xf')](_0x7a22('0x23'),_0x15a84f);logger[_0x7a22('0x21')](_0x7a22('0x23'),_0x15a84f,JSON[_0x7a22('0x13')](_0x56b169));_0x1b3f76(_0x56b169);})[_0x7a22('0x22')](function(_0x599966){logger[_0x7a22('0x14')](_0x7a22('0x23'),_0x599966['message'],_0x15a84f);_0x45545d(_0x3ab16b[_0x7a22('0x14')](0x1f4,_0x599966[_0x7a22('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4ae4eab..70a7011 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 _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 +var _0x758c=['length','mailQueue:','./mailQueue.events','save','remove','emit','removeListener','register'];(function(_0x4c8573,_0x46396c){var _0x4e1794=function(_0x4cdba1){while(--_0x4cdba1){_0x4c8573['push'](_0x4c8573['shift']());}};_0x4e1794(++_0x46396c);}(_0x758c,0xd2));var _0xc758=function(_0x5aa2f4,_0x27f5fe){_0x5aa2f4=_0x5aa2f4-0x0;var _0x3ae835=_0x758c[_0x5aa2f4];return _0x3ae835;};'use strict';var MailQueueEvents=require(_0xc758('0x0'));var events=[_0xc758('0x1'),_0xc758('0x2'),'update'];function createListener(_0x5f505a,_0x1b0ff8){return function(_0x4fcbd0){_0x1b0ff8[_0xc758('0x3')](_0x5f505a,_0x4fcbd0);};}function removeListener(_0x4c60d0,_0x3a6b3a){return function(){MailQueueEvents[_0xc758('0x4')](_0x4c60d0,_0x3a6b3a);};}exports[_0xc758('0x5')]=function(_0x520eda){for(var _0x23ba21=0x0,_0x258c8f=events[_0xc758('0x6')];_0x23ba21<_0x258c8f;_0x23ba21++){var _0x4181e5=events[_0x23ba21];var _0xeaf672=createListener(_0xc758('0x7')+_0x4181e5,_0x520eda);MailQueueEvents['on'](_0x4181e5,_0xeaf672);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 97520fa..ba3281c 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 _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 +var _0x729a=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','put','update','delete'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x729a,0x10b));var _0xa729=function(_0x54b766,_0x313856){_0x54b766=_0x54b766-0x0;var _0x1ddc75=_0x729a[_0x54b766];return _0x1ddc75;};'use strict';var multer=require(_0xa729('0x0'));var util=require(_0xa729('0x1'));var path=require(_0xa729('0x2'));var timeout=require('connect-timeout');var express=require(_0xa729('0x3'));var router=express[_0xa729('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa729('0x5'));var interaction=require(_0xa729('0x6'));var config=require('../../config/environment');var controller=require(_0xa729('0x7'));router['get']('/',auth[_0xa729('0x8')](),controller[_0xa729('0x9')]);router['get'](_0xa729('0xa'),auth[_0xa729('0x8')](),controller[_0xa729('0xb')]);router[_0xa729('0xc')](_0xa729('0xd'),auth[_0xa729('0x8')](),controller[_0xa729('0xe')]);router['post']('/',auth[_0xa729('0x8')](),controller['create']);router[_0xa729('0xf')](_0xa729('0xd'),auth['isAuthenticated'](),controller[_0xa729('0x10')]);router[_0xa729('0x11')]('/:id',auth[_0xa729('0x8')](),controller[_0xa729('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a41f7cb..596db41 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 _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 +var _0x7953=['STRING','DATE','moment','sequelize','exports'];(function(_0x180b01,_0x16cd10){var _0x51fe8f=function(_0x3590b8){while(--_0x3590b8){_0x180b01['push'](_0x180b01['shift']());}};_0x51fe8f(++_0x16cd10);}(_0x7953,0x1c4));var _0x3795=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0x7953[_0x572637];return _0xb6748;};'use strict';var moment=require(_0x3795('0x0'));var Sequelize=require(_0x3795('0x1'));module[_0x3795('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3795('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3795('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3795('0x4')]},'reason':{'type':Sequelize[_0x3795('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c831662..f1b2b39 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 _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 +var _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','MailQueueReport','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x4a155f,_0xb73f2){var _0x518b24=function(_0x1e5578){while(--_0x1e5578){_0x4a155f['push'](_0x4a155f['shift']());}};_0x518b24(++_0xb73f2);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['MailQueueReport']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['MailQueueReport']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d00f7cd..0c1310d 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 _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 +var _0x0298=['bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4e7240,_0x2353cd){var _0x40c8d7=function(_0x68231a){while(--_0x68231a){_0x4e7240['push'](_0x4e7240['shift']());}};_0x40c8d7(++_0x2353cd);}(_0x0298,0x1bb));var _0x8029=function(_0x3520c1,_0x1257ad){_0x3520c1=_0x3520c1-0x0;var _0x24e55c=_0x0298[_0x3520c1];return _0x24e55c;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var logger=require(_0x8029('0x2'))(_0x8029('0x3'));var moment=require(_0x8029('0x4'));var BPromise=require(_0x8029('0x5'));var rp=require(_0x8029('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var attributes=require(_0x8029('0x9'));module[_0x8029('0xa')]=function(_0x4aad74,_0x280ee6){return _0x4aad74[_0x8029('0xb')](_0x8029('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x8029('0xd'),'fields':[_0x8029('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0146d5a..58ea875 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 _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 +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0xf49856,_0x56509c){var _0x3b6bfb=function(_0x185d84){while(--_0x185d84){_0xf49856['push'](_0xf49856['shift']());}};_0x3b6bfb(++_0x56509c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 78c6400..9ff2098 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb40f40,_0x41708a){var _0x55c108=function(_0x5c4f7b){while(--_0x5c4f7b){_0xb40f40['push'](_0xb40f40['shift']());}};_0x55c108(++_0x41708a);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 0995b57..50eda42 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 _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 +var _0x1771=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x1ac053,_0x39267a){var _0x2d209a=function(_0x5106d2){while(--_0x5106d2){_0x1ac053['push'](_0x1ac053['shift']());}};_0x2d209a(++_0x39267a);}(_0x1771,0x152));var _0x1177=function(_0x1b3f65,_0x48aa09){_0x1b3f65=_0x1b3f65-0x0;var _0x10d936=_0x1771[_0x1b3f65];return _0x10d936;};'use strict';var Sequelize=require(_0x1177('0x0'));module[_0x1177('0x1')]={'description':{'type':Sequelize[_0x1177('0x2')]},'host':{'type':Sequelize[_0x1177('0x2')]},'authentication':{'type':Sequelize[_0x1177('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1177('0x4')]},'tls':{'type':Sequelize[_0x1177('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1177('0x2')],'defaultValue':_0x1177('0x5')},'connTimeout':{'type':Sequelize[_0x1177('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x1177('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1cc2a7f..d06c2bf 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 _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 +var _0x71d7=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4f7037,_0x4feea9){var _0x49a0e3=function(_0x4460e8){while(--_0x4460e8){_0x4f7037['push'](_0x4f7037['shift']());}};_0x49a0e3(++_0x4feea9);}(_0x71d7,0x1ad));var _0x771d=function(_0x5554e1,_0x85e73a){_0x5554e1=_0x5554e1-0x0;var _0x3e85a8=_0x71d7[_0x5554e1];return _0x3e85a8;};'use strict';var _=require(_0x771d('0x0'));var util=require(_0x771d('0x1'));var logger=require(_0x771d('0x2'))('api');var moment=require(_0x771d('0x3'));var BPromise=require(_0x771d('0x4'));var rp=require(_0x771d('0x5'));var fs=require('fs');var path=require(_0x771d('0x6'));var rimraf=require(_0x771d('0x7'));var config=require(_0x771d('0x8'));var attributes=require(_0x771d('0x9'));module[_0x771d('0xa')]=function(_0x4ba2d9,_0x7b8d8e){return _0x4ba2d9[_0x771d('0xb')](_0x771d('0xc'),attributes,{'tableName':_0x771d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5e38208..1e0b6a6 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 _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 +var _0xac0b=['GetMailServerIn','MailServerIn','options','where','attributes','include','map','model','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x273885,_0x29c348){var _0x4cf035=function(_0x243fad){while(--_0x243fad){_0x273885['push'](_0x273885['shift']());}};_0x4cf035(++_0x29c348);}(_0xac0b,0x164));var _0xbac0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xac0b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var moment=require(_0xbac0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbac0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac0('0x4'));var logger=require(_0xbac0('0x5'))(_0xbac0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbac0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3dbf70,_0x2f1d61,_0x3592de){return new BPromise(function(_0x25167c,_0x268346){return client[_0xbac0('0x8')](_0x3dbf70,_0x3592de)[_0xbac0('0x9')](function(_0x114d2e){logger[_0xbac0('0xa')](_0xbac0('0xb'),_0x2f1d61,'request\x20sent');logger[_0xbac0('0xc')](_0xbac0('0xd'),_0x2f1d61,_0xbac0('0xe'),JSON[_0xbac0('0xf')](_0x114d2e));if(_0x114d2e[_0xbac0('0x10')]){if(_0x114d2e[_0xbac0('0x10')][_0xbac0('0x11')]===0x1f4){logger[_0xbac0('0x10')](_0xbac0('0xb'),_0x2f1d61,_0x114d2e[_0xbac0('0x10')]['message']);return _0x268346(_0x114d2e[_0xbac0('0x10')][_0xbac0('0x12')]);}logger[_0xbac0('0x10')](_0xbac0('0xb'),_0x2f1d61,_0x114d2e['error'][_0xbac0('0x12')]);return _0x25167c(_0x114d2e[_0xbac0('0x10')][_0xbac0('0x12')]);}else{logger[_0xbac0('0xa')]('MailServerIn,\x20%s,\x20%s',_0x2f1d61,_0xbac0('0xe'));_0x25167c(_0x114d2e[_0xbac0('0x13')][_0xbac0('0x12')]);}})[_0xbac0('0x14')](function(_0x13c623){logger[_0xbac0('0x10')](_0xbac0('0xb'),_0x2f1d61,_0x13c623);_0x268346(_0x13c623);});});}exports[_0xbac0('0x15')]=function(_0x271597){var _0x5956b5=this;return new Promise(function(_0x5bd87c,_0x107e44){return db[_0xbac0('0x16')]['findAll']({'raw':_0x271597['options']?_0x271597['options']['raw']===undefined?!![]:![]:!![],'where':_0x271597[_0xbac0('0x17')]?_0x271597[_0xbac0('0x17')][_0xbac0('0x18')]||null:null,'attributes':_0x271597['options']?_0x271597[_0xbac0('0x17')][_0xbac0('0x19')]||null:null,'limit':_0x271597[_0xbac0('0x17')]?_0x271597[_0xbac0('0x17')]['limit']||null:null,'include':_0x271597[_0xbac0('0x17')]?_0x271597[_0xbac0('0x17')][_0xbac0('0x1a')]?_[_0xbac0('0x1b')](_0x271597['options'][_0xbac0('0x1a')],function(_0x535b4d){return{'model':db[_0x535b4d['model']],'as':_0x535b4d['as'],'attributes':_0x535b4d[_0xbac0('0x19')],'include':_0x535b4d[_0xbac0('0x1a')]?_['map'](_0x535b4d[_0xbac0('0x1a')],function(_0x1bb298){return{'model':db[_0x1bb298[_0xbac0('0x1c')]],'as':_0x1bb298['as'],'attributes':_0x1bb298['attributes'],'include':_0x1bb298[_0xbac0('0x1a')]?_['map'](_0x1bb298[_0xbac0('0x1a')],function(_0xa98ec5){return{'model':db[_0xa98ec5[_0xbac0('0x1c')]],'as':_0xa98ec5['as'],'attributes':_0xa98ec5[_0xbac0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbac0('0x9')](function(_0x442395){logger[_0xbac0('0xa')](_0xbac0('0x15'),_0x271597);logger[_0xbac0('0xc')](_0xbac0('0x15'),_0x271597,JSON[_0xbac0('0xf')](_0x442395));_0x5bd87c(_0x442395);})['catch'](function(_0x162d09){logger['error']('GetMailServerIn',_0x162d09[_0xbac0('0x12')],_0x271597);_0x107e44(_0x5956b5['error'](0x1f4,_0x162d09[_0xbac0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0452192..80d6e55 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(_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 +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(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7a54,0x106));var _0x47a5=function(_0x9d4c6c,_0x45f8ae){_0x9d4c6c=_0x9d4c6c-0x0;var _0x2a1833=_0x7a54[_0x9d4c6c];return _0x2a1833;};'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 8b8f588..f1f4cfb 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 _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 +var _0xf7b4=['STRING','BOOLEAN','sequelize'];(function(_0x54dee4,_0x5bdb9f){var _0x2fa406=function(_0x41d0ea){while(--_0x41d0ea){_0x54dee4['push'](_0x54dee4['shift']());}};_0x2fa406(++_0x5bdb9f);}(_0xf7b4,0x152));var _0x4f7b=function(_0x375676,_0x59d59f){_0x375676=_0x375676-0x0;var _0x31b3b7=_0xf7b4[_0x375676];return _0x31b3b7;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4f7b('0x1')]},'user':{'type':Sequelize[_0x4f7b('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x4f7b('0x1')]},'authentication':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4f7b('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 653411e..798b96a 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 _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 +var _0xf033=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','MailServerOut','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','status','end'];(function(_0xe81bfd,_0x29f01d){var _0x448377=function(_0x509d24){while(--_0x509d24){_0xe81bfd['push'](_0xe81bfd['shift']());}};_0x448377(++_0x29f01d);}(_0xf033,0x82));var _0x3f03=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0xf033[_0x2dd22e];return _0x257b01;};'use strict';var emlformat=require(_0x3f03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f03('0x1'));var jsonpatch=require(_0x3f03('0x2'));var rp=require(_0x3f03('0x3'));var moment=require(_0x3f03('0x4'));var BPromise=require(_0x3f03('0x5'));var Mustache=require(_0x3f03('0x6'));var util=require(_0x3f03('0x7'));var path=require(_0x3f03('0x8'));var sox=require(_0x3f03('0x9'));var csv=require(_0x3f03('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f03('0xb'));var _=require(_0x3f03('0xc'));var squel=require(_0x3f03('0xd'));var crypto=require(_0x3f03('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3f03('0xf'));var toCsv=require(_0x3f03('0xa'));var querystring=require(_0x3f03('0x10'));var Papa=require(_0x3f03('0x11'));var Redis=require(_0x3f03('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3f03('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f03('0x14'));var utils=require(_0x3f03('0x15'));var config=require(_0x3f03('0x16'));var licenseUtil=require(_0x3f03('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d1903,_0x15a501){_0x15a501=_0x15a501||0xcc;return function(_0x14aa0d){if(_0x14aa0d){return _0x4d1903['sendStatus'](_0x15a501);}return _0x4d1903[_0x3f03('0x18')](_0x15a501)[_0x3f03('0x19')]();};}function respondWithResult(_0x49621b,_0x7616fb){_0x7616fb=_0x7616fb||0xc8;return function(_0xe3668f){if(_0xe3668f){return _0x49621b['status'](_0x7616fb)['json'](_0xe3668f);}};}function respondWithFilteredResult(_0x1f8db8,_0x4a129d){return function(_0x45ef3c){if(_0x45ef3c){var _0x455990=typeof _0x4a129d[_0x3f03('0x1a')]===_0x3f03('0x1b')&&typeof _0x4a129d[_0x3f03('0x1c')]===_0x3f03('0x1b');var _0x1644c8=_0x45ef3c[_0x3f03('0x1d')];var _0xd9442=_0x455990?0x0:_0x4a129d[_0x3f03('0x1a')];var _0x587bb0=_0x455990?_0x45ef3c[_0x3f03('0x1d')]:_0x4a129d[_0x3f03('0x1a')]+_0x4a129d[_0x3f03('0x1c')];var _0x6a27f3;if(_0x587bb0>=_0x1644c8){_0x587bb0=_0x1644c8;_0x6a27f3=0xc8;}else{_0x6a27f3=0xce;}_0x1f8db8[_0x3f03('0x18')](_0x6a27f3);return _0x1f8db8[_0x3f03('0x1e')](_0x3f03('0x1f'),_0xd9442+'-'+_0x587bb0+'/'+_0x1644c8)[_0x3f03('0x20')](_0x45ef3c);}return null;};}function patchUpdates(_0xf0720e){return function(_0x5cc614){try{jsonpatch[_0x3f03('0x21')](_0x5cc614,_0xf0720e,!![]);}catch(_0x533a03){return BPromise[_0x3f03('0x22')](_0x533a03);}return _0x5cc614[_0x3f03('0x23')]();};}function saveUpdates(_0xa94c4b,_0x217654){return function(_0x4f4928){if(_0x4f4928){return _0x4f4928[_0x3f03('0x24')](_0xa94c4b)['then'](function(_0x535dce){return _0x535dce;});}return null;};}function removeEntity(_0x48e18c,_0x5a2628){return function(_0x18e6f2){if(_0x18e6f2){return _0x18e6f2[_0x3f03('0x25')]()[_0x3f03('0x26')](function(){_0x48e18c[_0x3f03('0x18')](0xcc)[_0x3f03('0x19')]();});}};}function handleEntityNotFound(_0x5a7749,_0x3cd66e){return function(_0x47df25){if(!_0x47df25){_0x5a7749[_0x3f03('0x27')](0x194);}return _0x47df25;};}function handleError(_0x424db9,_0x3a131c){_0x3a131c=_0x3a131c||0x1f4;return function(_0xcc9350){logger[_0x3f03('0x28')](_0xcc9350[_0x3f03('0x29')]);if(_0xcc9350[_0x3f03('0x2a')]){delete _0xcc9350[_0x3f03('0x2a')];}_0x424db9[_0x3f03('0x18')](_0x3a131c)[_0x3f03('0x2b')](_0xcc9350);};}exports[_0x3f03('0x2c')]=function(_0x14b971,_0x4cfca6){var _0xf723fd={},_0x1b86ea={},_0xc71328={'count':0x0,'rows':[]};var _0x26bdbd=_[_0x3f03('0x2d')](db[_0x3f03('0x2e')]['rawAttributes'],function(_0x4f6f49){return{'name':_0x4f6f49[_0x3f03('0x2f')],'type':_0x4f6f49['type'][_0x3f03('0x30')]};});_0x1b86ea[_0x3f03('0x31')]=_[_0x3f03('0x2d')](_0x26bdbd,_0x3f03('0x2a'));_0x1b86ea[_0x3f03('0x32')]=_['keys'](_0x14b971['query']);_0x1b86ea[_0x3f03('0x33')]=_[_0x3f03('0x34')](_0x1b86ea[_0x3f03('0x31')],_0x1b86ea[_0x3f03('0x32')]);_0xf723fd['attributes']=_['intersection'](_0x1b86ea['model'],qs[_0x3f03('0x35')](_0x14b971[_0x3f03('0x32')][_0x3f03('0x35')]));_0xf723fd[_0x3f03('0x36')]=_0xf723fd['attributes']['length']?_0xf723fd['attributes']:_0x1b86ea[_0x3f03('0x31')];if(!_0x14b971['query'][_0x3f03('0x37')](_0x3f03('0x38'))){_0xf723fd[_0x3f03('0x1c')]=qs[_0x3f03('0x1c')](_0x14b971[_0x3f03('0x32')][_0x3f03('0x1c')]);_0xf723fd['offset']=qs[_0x3f03('0x1a')](_0x14b971[_0x3f03('0x32')][_0x3f03('0x1a')]);}_0xf723fd[_0x3f03('0x39')]=qs['sort'](_0x14b971['query'][_0x3f03('0x3a')]);_0xf723fd[_0x3f03('0x3b')]=qs['filters'](_[_0x3f03('0x3c')](_0x14b971[_0x3f03('0x32')],_0x1b86ea[_0x3f03('0x33')]),_0x26bdbd);if(_0x14b971[_0x3f03('0x32')][_0x3f03('0x3d')]){_0xf723fd['where']=_[_0x3f03('0x3e')](_0xf723fd[_0x3f03('0x3b')],{'$or':_[_0x3f03('0x2d')](_0x26bdbd,function(_0x1f9198){if(_0x1f9198[_0x3f03('0x3f')]!==_0x3f03('0x40')){var _0xdc8b13={};_0xdc8b13[_0x1f9198[_0x3f03('0x2a')]]={'$like':'%'+_0x14b971['query'][_0x3f03('0x3d')]+'%'};return _0xdc8b13;}})});}_0xf723fd=_[_0x3f03('0x3e')]({},_0xf723fd,_0x14b971[_0x3f03('0x41')]);var _0x31c39c={'where':_0xf723fd['where']};return db[_0x3f03('0x2e')][_0x3f03('0x1d')](_0x31c39c)[_0x3f03('0x26')](function(_0x5ee6a6){_0xc71328[_0x3f03('0x1d')]=_0x5ee6a6;if(_0x14b971[_0x3f03('0x32')]['includeAll']){_0xf723fd[_0x3f03('0x42')]=[{'all':!![]}];}return db[_0x3f03('0x2e')][_0x3f03('0x43')](_0xf723fd);})[_0x3f03('0x26')](function(_0x348c42){_0xc71328[_0x3f03('0x44')]=_0x348c42;return _0xc71328;})[_0x3f03('0x26')](respondWithFilteredResult(_0x4cfca6,_0xf723fd))[_0x3f03('0x45')](handleError(_0x4cfca6,null));};exports[_0x3f03('0x46')]=function(_0xb51369,_0x4b2a61){var _0x4a56c5={'raw':!![],'where':{'id':_0xb51369['params']['id']}},_0x443797={};_0x443797['model']=_[_0x3f03('0x47')](db[_0x3f03('0x2e')]['rawAttributes']);_0x443797[_0x3f03('0x32')]=_[_0x3f03('0x47')](_0xb51369['query']);_0x443797[_0x3f03('0x33')]=_[_0x3f03('0x34')](_0x443797[_0x3f03('0x31')],_0x443797['query']);_0x4a56c5[_0x3f03('0x36')]=_[_0x3f03('0x34')](_0x443797[_0x3f03('0x31')],qs[_0x3f03('0x35')](_0xb51369[_0x3f03('0x32')][_0x3f03('0x35')]));_0x4a56c5['attributes']=_0x4a56c5[_0x3f03('0x36')][_0x3f03('0x48')]?_0x4a56c5[_0x3f03('0x36')]:_0x443797[_0x3f03('0x31')];if(_0xb51369[_0x3f03('0x32')][_0x3f03('0x49')]){_0x4a56c5[_0x3f03('0x42')]=[{'all':!![]}];}_0x4a56c5=_[_0x3f03('0x3e')]({},_0x4a56c5,_0xb51369[_0x3f03('0x41')]);return db[_0x3f03('0x2e')][_0x3f03('0x4a')](_0x4a56c5)[_0x3f03('0x26')](handleEntityNotFound(_0x4b2a61,null))[_0x3f03('0x26')](respondWithResult(_0x4b2a61,null))['catch'](handleError(_0x4b2a61,null));};exports[_0x3f03('0x4b')]=function(_0x527464,_0x18a281){return db[_0x3f03('0x2e')][_0x3f03('0x4b')](_0x527464[_0x3f03('0x4c')],{})[_0x3f03('0x26')](respondWithResult(_0x18a281,0xc9))[_0x3f03('0x45')](handleError(_0x18a281,null));};exports[_0x3f03('0x24')]=function(_0x317fdd,_0x354a2f){if(_0x317fdd[_0x3f03('0x4c')]['id']){delete _0x317fdd['body']['id'];}return db[_0x3f03('0x2e')][_0x3f03('0x4a')]({'where':{'id':_0x317fdd[_0x3f03('0x4d')]['id']}})['then'](handleEntityNotFound(_0x354a2f,null))['then'](saveUpdates(_0x317fdd[_0x3f03('0x4c')],null))['then'](respondWithResult(_0x354a2f,null))[_0x3f03('0x45')](handleError(_0x354a2f,null));};exports[_0x3f03('0x25')]=function(_0x509535,_0x3755c9){return db['MailServerOut']['find']({'where':{'id':_0x509535[_0x3f03('0x4d')]['id']}})[_0x3f03('0x26')](handleEntityNotFound(_0x3755c9,null))['then'](removeEntity(_0x3755c9,null))[_0x3f03('0x45')](handleError(_0x3755c9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9443f79..fff5fba 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 _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 +var _0x5676=['mail_servers_out','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','exports','MailServerOut'];(function(_0x5034b7,_0x53bcf8){var _0x47d466=function(_0x224ef3){while(--_0x224ef3){_0x5034b7['push'](_0x5034b7['shift']());}};_0x47d466(++_0x53bcf8);}(_0x5676,0x1e1));var _0x6567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5676[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6567('0x0'));var logger=require(_0x6567('0x1'))('api');var moment=require(_0x6567('0x2'));var BPromise=require(_0x6567('0x3'));var rp=require(_0x6567('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6567('0x5'));var attributes=require(_0x6567('0x6'));module[_0x6567('0x7')]=function(_0x20f2ec,_0x3a5598){return _0x20f2ec['define'](_0x6567('0x8'),attributes,{'tableName':_0x6567('0x9'),'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 2ec9009..2e19001 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(_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 +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x5ebe82,_0x26b338){var _0x44e192=function(_0x4e37fa){while(--_0x4e37fa){_0x5ebe82['push'](_0x5ebe82['shift']());}};_0x44e192(++_0x26b338);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e57d59b..ce76b4d 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 _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 +var _0xc31f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc31f,0xd0));var _0xfc31=function(_0x31d7c3,_0x2f88c3){_0x31d7c3=_0x31d7c3-0x0;var _0x257c99=_0xc31f[_0x31d7c3];return _0x257c99;};'use strict';var multer=require(_0xfc31('0x0'));var util=require(_0xfc31('0x1'));var path=require('path');var timeout=require(_0xfc31('0x2'));var express=require('express');var router=express[_0xfc31('0x3')]();var fs_extra=require(_0xfc31('0x4'));var auth=require(_0xfc31('0x5'));var interaction=require(_0xfc31('0x6'));var config=require(_0xfc31('0x7'));var controller=require('./mailSubstatus.controller');router[_0xfc31('0x8')]('/',auth[_0xfc31('0x9')](),controller['index']);router[_0xfc31('0x8')](_0xfc31('0xa'),auth['isAuthenticated'](),controller[_0xfc31('0xb')]);router[_0xfc31('0x8')](_0xfc31('0xc'),auth[_0xfc31('0x9')](),controller[_0xfc31('0xd')]);router[_0xfc31('0xe')]('/',auth[_0xfc31('0x9')](),controller[_0xfc31('0xf')]);router[_0xfc31('0x10')](_0xfc31('0xc'),auth['isAuthenticated'](),controller[_0xfc31('0x11')]);router[_0xfc31('0x12')](_0xfc31('0xc'),auth[_0xfc31('0x9')](),controller[_0xfc31('0x13')]);module[_0xfc31('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 30ffb9e..cc6a008 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 _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 +var _0xf072=['STRING','sequelize','exports'];(function(_0x5f53c3,_0x5f40b0){var _0x5d4be5=function(_0x365e48){while(--_0x365e48){_0x5f53c3['push'](_0x5f53c3['shift']());}};_0x5d4be5(++_0x5f40b0);}(_0xf072,0x1cf));var _0x2f07=function(_0x467f4d,_0x1606a0){_0x467f4d=_0x467f4d-0x0;var _0x2738f4=_0xf072[_0x467f4d];return _0x2738f4;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2f07('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b761e2c..aff0fdb 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 _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 +var _0x7c9f=['send','index','map','MailSubstatus','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name'];(function(_0x5ec698,_0x499134){var _0x2cdeb0=function(_0x23d034){while(--_0x23d034){_0x5ec698['push'](_0x5ec698['shift']());}};_0x2cdeb0(++_0x499134);}(_0x7c9f,0x1eb));var _0xf7c9=function(_0x174d7b,_0x50f7ab){_0x174d7b=_0x174d7b-0x0;var _0x506f7a=_0x7c9f[_0x174d7b];return _0x506f7a;};'use strict';var emlformat=require(_0xf7c9('0x0'));var rimraf=require(_0xf7c9('0x1'));var zipdir=require(_0xf7c9('0x2'));var jsonpatch=require(_0xf7c9('0x3'));var rp=require(_0xf7c9('0x4'));var moment=require(_0xf7c9('0x5'));var BPromise=require(_0xf7c9('0x6'));var Mustache=require(_0xf7c9('0x7'));var util=require(_0xf7c9('0x8'));var path=require(_0xf7c9('0x9'));var sox=require('sox');var csv=require(_0xf7c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7c9('0xb'));var _=require(_0xf7c9('0xc'));var squel=require('squel');var crypto=require(_0xf7c9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf7c9('0xe'));var toCsv=require(_0xf7c9('0xa'));var querystring=require(_0xf7c9('0xf'));var Papa=require(_0xf7c9('0x10'));var Redis=require(_0xf7c9('0x11'));var authService=require(_0xf7c9('0x12'));var qs=require(_0xf7c9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7c9('0x14'));var logger=require('../../config/logger')(_0xf7c9('0x15'));var utils=require(_0xf7c9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf7c9('0x17'));var db=require(_0xf7c9('0x18'))['db'];function respondWithStatusCode(_0x2f696d,_0x165fcd){_0x165fcd=_0x165fcd||0xcc;return function(_0x2f6e2d){if(_0x2f6e2d){return _0x2f696d['sendStatus'](_0x165fcd);}return _0x2f696d[_0xf7c9('0x19')](_0x165fcd)[_0xf7c9('0x1a')]();};}function respondWithResult(_0x2555a4,_0x82d12b){_0x82d12b=_0x82d12b||0xc8;return function(_0x4485d3){if(_0x4485d3){return _0x2555a4[_0xf7c9('0x19')](_0x82d12b)[_0xf7c9('0x1b')](_0x4485d3);}};}function respondWithFilteredResult(_0x23d4f9,_0x1f8725){return function(_0xf8c4f3){if(_0xf8c4f3){var _0x1b818e=typeof _0x1f8725[_0xf7c9('0x1c')]===_0xf7c9('0x1d')&&typeof _0x1f8725[_0xf7c9('0x1e')]===_0xf7c9('0x1d');var _0x4aa6dc=_0xf8c4f3[_0xf7c9('0x1f')];var _0x3d93ef=_0x1b818e?0x0:_0x1f8725[_0xf7c9('0x1c')];var _0x1616d9=_0x1b818e?_0xf8c4f3['count']:_0x1f8725['offset']+_0x1f8725[_0xf7c9('0x1e')];var _0x117468;if(_0x1616d9>=_0x4aa6dc){_0x1616d9=_0x4aa6dc;_0x117468=0xc8;}else{_0x117468=0xce;}_0x23d4f9[_0xf7c9('0x19')](_0x117468);return _0x23d4f9['set'](_0xf7c9('0x20'),_0x3d93ef+'-'+_0x1616d9+'/'+_0x4aa6dc)[_0xf7c9('0x1b')](_0xf8c4f3);}return null;};}function patchUpdates(_0x11c180){return function(_0x162442){try{jsonpatch[_0xf7c9('0x21')](_0x162442,_0x11c180,!![]);}catch(_0x25aa2d){return BPromise[_0xf7c9('0x22')](_0x25aa2d);}return _0x162442['save']();};}function saveUpdates(_0x3d84d2,_0x18cd8e){return function(_0x3ff1f5){if(_0x3ff1f5){return _0x3ff1f5['update'](_0x3d84d2)[_0xf7c9('0x23')](function(_0x1ff018){return _0x1ff018;});}return null;};}function removeEntity(_0x2874a2,_0x11f7b9){return function(_0x22d7c3){if(_0x22d7c3){return _0x22d7c3[_0xf7c9('0x24')]()[_0xf7c9('0x23')](function(){_0x2874a2[_0xf7c9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9c61,_0x1aa39e){return function(_0x52043d){if(!_0x52043d){_0x2e9c61[_0xf7c9('0x25')](0x194);}return _0x52043d;};}function handleError(_0xf0984a,_0x404521){_0x404521=_0x404521||0x1f4;return function(_0x1ae59d){logger[_0xf7c9('0x26')](_0x1ae59d[_0xf7c9('0x27')]);if(_0x1ae59d[_0xf7c9('0x28')]){delete _0x1ae59d[_0xf7c9('0x28')];}_0xf0984a['status'](_0x404521)[_0xf7c9('0x29')](_0x1ae59d);};}exports[_0xf7c9('0x2a')]=function(_0x29c5fc,_0x4dc983){var _0x338bbe={},_0x401a43={},_0x12dd17={'count':0x0,'rows':[]};var _0x11931c=_[_0xf7c9('0x2b')](db[_0xf7c9('0x2c')]['rawAttributes'],function(_0x8df962){return{'name':_0x8df962['fieldName'],'type':_0x8df962[_0xf7c9('0x2d')][_0xf7c9('0x2e')]};});_0x401a43[_0xf7c9('0x2f')]=_['map'](_0x11931c,_0xf7c9('0x28'));_0x401a43[_0xf7c9('0x30')]=_[_0xf7c9('0x31')](_0x29c5fc[_0xf7c9('0x30')]);_0x401a43['filters']=_[_0xf7c9('0x32')](_0x401a43['model'],_0x401a43[_0xf7c9('0x30')]);_0x338bbe['attributes']=_[_0xf7c9('0x32')](_0x401a43[_0xf7c9('0x2f')],qs[_0xf7c9('0x33')](_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x33')]));_0x338bbe[_0xf7c9('0x34')]=_0x338bbe[_0xf7c9('0x34')][_0xf7c9('0x35')]?_0x338bbe['attributes']:_0x401a43[_0xf7c9('0x2f')];if(!_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x36')](_0xf7c9('0x37'))){_0x338bbe[_0xf7c9('0x1e')]=qs[_0xf7c9('0x1e')](_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x1e')]);_0x338bbe[_0xf7c9('0x1c')]=qs[_0xf7c9('0x1c')](_0x29c5fc[_0xf7c9('0x30')]['offset']);}_0x338bbe['order']=qs[_0xf7c9('0x38')](_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x38')]);_0x338bbe[_0xf7c9('0x39')]=qs[_0xf7c9('0x3a')](_[_0xf7c9('0x3b')](_0x29c5fc[_0xf7c9('0x30')],_0x401a43['filters']),_0x11931c);if(_0x29c5fc['query'][_0xf7c9('0x3c')]){_0x338bbe[_0xf7c9('0x39')]=_[_0xf7c9('0x3d')](_0x338bbe['where'],{'$or':_[_0xf7c9('0x2b')](_0x11931c,function(_0x5af31a){if(_0x5af31a['type']!==_0xf7c9('0x3e')){var _0x4e778c={};_0x4e778c[_0x5af31a[_0xf7c9('0x28')]]={'$like':'%'+_0x29c5fc['query'][_0xf7c9('0x3c')]+'%'};return _0x4e778c;}})});}_0x338bbe=_[_0xf7c9('0x3d')]({},_0x338bbe,_0x29c5fc[_0xf7c9('0x3f')]);var _0x5510e8={'where':_0x338bbe[_0xf7c9('0x39')]};return db[_0xf7c9('0x2c')][_0xf7c9('0x1f')](_0x5510e8)[_0xf7c9('0x23')](function(_0x2a4863){_0x12dd17['count']=_0x2a4863;if(_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x40')]){_0x338bbe[_0xf7c9('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0xf7c9('0x42')](_0x338bbe);})[_0xf7c9('0x23')](function(_0x250475){_0x12dd17['rows']=_0x250475;return _0x12dd17;})[_0xf7c9('0x23')](respondWithFilteredResult(_0x4dc983,_0x338bbe))[_0xf7c9('0x43')](handleError(_0x4dc983,null));};exports[_0xf7c9('0x44')]=function(_0x191ea0,_0x3938f1){var _0x430411={'raw':!![],'where':{'id':_0x191ea0['params']['id']}},_0x1ac2c8={};_0x1ac2c8[_0xf7c9('0x2f')]=_['keys'](db[_0xf7c9('0x2c')][_0xf7c9('0x45')]);_0x1ac2c8['query']=_['keys'](_0x191ea0[_0xf7c9('0x30')]);_0x1ac2c8[_0xf7c9('0x3a')]=_['intersection'](_0x1ac2c8[_0xf7c9('0x2f')],_0x1ac2c8['query']);_0x430411[_0xf7c9('0x34')]=_[_0xf7c9('0x32')](_0x1ac2c8[_0xf7c9('0x2f')],qs[_0xf7c9('0x33')](_0x191ea0[_0xf7c9('0x30')][_0xf7c9('0x33')]));_0x430411[_0xf7c9('0x34')]=_0x430411[_0xf7c9('0x34')][_0xf7c9('0x35')]?_0x430411[_0xf7c9('0x34')]:_0x1ac2c8[_0xf7c9('0x2f')];if(_0x191ea0[_0xf7c9('0x30')][_0xf7c9('0x40')]){_0x430411[_0xf7c9('0x41')]=[{'all':!![]}];}_0x430411=_[_0xf7c9('0x3d')]({},_0x430411,_0x191ea0['options']);return db['MailSubstatus'][_0xf7c9('0x46')](_0x430411)[_0xf7c9('0x23')](handleEntityNotFound(_0x3938f1,null))[_0xf7c9('0x23')](respondWithResult(_0x3938f1,null))[_0xf7c9('0x43')](handleError(_0x3938f1,null));};exports[_0xf7c9('0x47')]=function(_0x547cc2,_0x2cbc19){return db['MailSubstatus'][_0xf7c9('0x47')](_0x547cc2['body'],{})[_0xf7c9('0x23')](respondWithResult(_0x2cbc19,0xc9))['catch'](handleError(_0x2cbc19,null));};exports[_0xf7c9('0x48')]=function(_0x296627,_0x2cad18){if(_0x296627[_0xf7c9('0x49')]['id']){delete _0x296627['body']['id'];}return db[_0xf7c9('0x2c')][_0xf7c9('0x46')]({'where':{'id':_0x296627[_0xf7c9('0x4a')]['id']}})[_0xf7c9('0x23')](handleEntityNotFound(_0x2cad18,null))[_0xf7c9('0x23')](saveUpdates(_0x296627[_0xf7c9('0x49')],null))[_0xf7c9('0x23')](respondWithResult(_0x2cad18,null))[_0xf7c9('0x43')](handleError(_0x2cad18,null));};exports[_0xf7c9('0x24')]=function(_0x4da3d6,_0x426208){return db[_0xf7c9('0x2c')][_0xf7c9('0x46')]({'where':{'id':_0x4da3d6[_0xf7c9('0x4a')]['id']}})[_0xf7c9('0x23')](handleEntityNotFound(_0x426208,null))[_0xf7c9('0x23')](removeEntity(_0x426208,null))[_0xf7c9('0x43')](handleError(_0x426208,null));};exports['describe']=function(_0x1ac42b,_0x2533f){return db[_0xf7c9('0x2c')][_0xf7c9('0x4b')]()[_0xf7c9('0x23')](respondWithResult(_0x2533f,null))[_0xf7c9('0x43')](handleError(_0x2533f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 8a989ea..3d1391e 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 _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 +var _0xdd9c=['hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','emit'];(function(_0x40e7f7,_0x5dc0d3){var _0x48605d=function(_0x37372c){while(--_0x37372c){_0x40e7f7['push'](_0x40e7f7['shift']());}};_0x48605d(++_0x5dc0d3);}(_0xdd9c,0x1df));var _0xcdd9=function(_0x1bd43e,_0x28fc4e){_0x1bd43e=_0x1bd43e-0x0;var _0x14a92e=_0xdd9c[_0x1bd43e];return _0x14a92e;};'use strict';var EventEmitter=require(_0xcdd9('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xcdd9('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xcdd9('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5905cb){return function(_0x1cf203,_0xe2de8a,_0x4889ed){MailSubstatusEvents[_0xcdd9('0x3')](_0x5905cb+':'+_0x1cf203['id'],_0x1cf203);MailSubstatusEvents[_0xcdd9('0x3')](_0x5905cb,_0x1cf203);_0x4889ed(null);};}for(var e in events){if(events[_0xcdd9('0x4')](e)){var event=events[e];MailSubstatus[_0xcdd9('0x5')](e,emitEvent(event));}}module[_0xcdd9('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5e4a011..cd3c9df 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 _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 +var _0x7ad3=['MailSubstatus','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0x4a790a,_0xd87322){var _0x1717e4=function(_0x11da2e){while(--_0x11da2e){_0x4a790a['push'](_0x4a790a['shift']());}};_0x1717e4(++_0xd87322);}(_0x7ad3,0x1b8));var _0x37ad=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x7ad3[_0x2074db];return _0x27324c;};'use strict';var attributes=require(_0x37ad('0x0'));module[_0x37ad('0x1')]=function(_0x33c9d9){var _0x87b7bf=_0x33c9d9[_0x37ad('0x2')];return _0x33c9d9[_0x37ad('0x3')](_0x37ad('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x192d5e,_0x1b69dc,_0x324eb2){return _0x87b7bf[_0x37ad('0x5')][_0x37ad('0x6')]({'value':_0x192d5e['name']},{'where':{'field':_0x37ad('0x7'),'value':_0x192d5e[_0x37ad('0x8')][_0x37ad('0x9')]}})[_0x37ad('0xa')](function(){_0x324eb2();})[_0x37ad('0xb')](function(_0x2d5508){_0x324eb2(_0x2d5508);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index bbc13ae..c953817 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 _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 +var _0xd704=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x2d7ca4,_0x2ade95){var _0x27f283=function(_0x4d1447){while(--_0x4d1447){_0x2d7ca4['push'](_0x2d7ca4['shift']());}};_0x27f283(++_0x2ade95);}(_0xd704,0xd0));var _0x4d70=function(_0x457840,_0x32a6c2){_0x457840=_0x457840-0x0;var _0x291996=_0xd704[_0x457840];return _0x291996;};'use strict';var _=require(_0x4d70('0x0'));var util=require('util');var moment=require(_0x4d70('0x1'));var BPromise=require(_0x4d70('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d70('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d70('0x4'));var logger=require(_0x4d70('0x5'))(_0x4d70('0x6'));var config=require(_0x4d70('0x7'));var jayson=require(_0x4d70('0x8'));var client=jayson[_0x4d70('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x503a5e,_0x9b09b7,_0x6bbf4f){return new BPromise(function(_0x3c61cd,_0x54909b){return client['request'](_0x503a5e,_0x6bbf4f)[_0x4d70('0xa')](function(_0x12609b){logger[_0x4d70('0xb')](_0x4d70('0xc'),_0x9b09b7,_0x4d70('0xd'));logger[_0x4d70('0xe')](_0x4d70('0xf'),_0x9b09b7,_0x4d70('0xd'),JSON[_0x4d70('0x10')](_0x12609b));if(_0x12609b[_0x4d70('0x11')]){if(_0x12609b[_0x4d70('0x11')][_0x4d70('0x12')]===0x1f4){logger[_0x4d70('0x11')](_0x4d70('0xc'),_0x9b09b7,_0x12609b[_0x4d70('0x11')]['message']);return _0x54909b(_0x12609b[_0x4d70('0x11')][_0x4d70('0x13')]);}logger[_0x4d70('0x11')](_0x4d70('0xc'),_0x9b09b7,_0x12609b['error'][_0x4d70('0x13')]);return _0x3c61cd(_0x12609b[_0x4d70('0x11')]['message']);}else{logger[_0x4d70('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x9b09b7,'request\x20sent');_0x3c61cd(_0x12609b['result'][_0x4d70('0x13')]);}})[_0x4d70('0x14')](function(_0x4102e5){logger[_0x4d70('0x11')](_0x4d70('0xc'),_0x9b09b7,_0x4102e5);_0x54909b(_0x4102e5);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 2168252..b3d9e73 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 _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 +var _0x5ed8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0xd4b0ea,_0x5d35b7){var _0x57c43e=function(_0x9e2480){while(--_0x9e2480){_0xd4b0ea['push'](_0xd4b0ea['shift']());}};_0x57c43e(++_0x5d35b7);}(_0x5ed8,0x150));var _0x85ed=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0x5ed8[_0x2e6e12];return _0x4bebf6;};'use strict';var multer=require(_0x85ed('0x0'));var util=require(_0x85ed('0x1'));var path=require(_0x85ed('0x2'));var timeout=require(_0x85ed('0x3'));var express=require('express');var router=express[_0x85ed('0x4')]();var fs_extra=require(_0x85ed('0x5'));var auth=require(_0x85ed('0x6'));var interaction=require(_0x85ed('0x7'));var config=require(_0x85ed('0x8'));var controller=require(_0x85ed('0x9'));router[_0x85ed('0xa')]('/',auth[_0x85ed('0xb')](),controller['index']);router[_0x85ed('0xa')]('/describe',auth[_0x85ed('0xb')](),controller[_0x85ed('0xc')]);router[_0x85ed('0xa')](_0x85ed('0xd'),auth[_0x85ed('0xb')](),controller[_0x85ed('0xe')]);router['post']('/',auth[_0x85ed('0xb')](),controller[_0x85ed('0xf')]);router[_0x85ed('0x10')](_0x85ed('0xd'),auth[_0x85ed('0xb')](),controller[_0x85ed('0x11')]);router[_0x85ed('0x12')](_0x85ed('0xd'),auth['isAuthenticated'](),controller[_0x85ed('0x13')]);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 9cc7cff..e4792cf 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 _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 +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x414ff1,_0xf0462b){var _0x29c53f=function(_0x1dab72){while(--_0x1dab72){_0x414ff1['push'](_0x414ff1['shift']());}};_0x29c53f(++_0xf0462b);}(_0x34e8,0x12c));var _0x834e=function(_0x679ab0,_0x5846be){_0x679ab0=_0x679ab0-0x0;var _0x641fde=_0x34e8[_0x679ab0];return _0x641fde;};'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 77c0bbb..951f97b 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 _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 +var _0x621d=['findAll','show','params','options','create','body','catch','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','MailTransferReport','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filters','where','merge','type','VIRTUAL','filter','includeAll','include'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x621d,0x135));var _0xd621=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x621d[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0xd621('0x0'));var rimraf=require(_0xd621('0x1'));var zipdir=require(_0xd621('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd621('0x3'));var moment=require(_0xd621('0x4'));var BPromise=require(_0xd621('0x5'));var Mustache=require(_0xd621('0x6'));var util=require('util');var path=require(_0xd621('0x7'));var sox=require(_0xd621('0x8'));var csv=require(_0xd621('0x9'));var ejs=require(_0xd621('0xa'));var fs=require('fs');var fs_extra=require(_0xd621('0xb'));var _=require(_0xd621('0xc'));var squel=require(_0xd621('0xd'));var crypto=require(_0xd621('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd621('0xf'));var toCsv=require(_0xd621('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd621('0x10'));var authService=require(_0xd621('0x11'));var qs=require(_0xd621('0x12'));var as=require(_0xd621('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd621('0x14'))(_0xd621('0x15'));var utils=require(_0xd621('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd621('0x17'));var db=require(_0xd621('0x18'))['db'];function respondWithStatusCode(_0x294037,_0xf64cba){_0xf64cba=_0xf64cba||0xcc;return function(_0x37f054){if(_0x37f054){return _0x294037[_0xd621('0x19')](_0xf64cba);}return _0x294037[_0xd621('0x1a')](_0xf64cba)[_0xd621('0x1b')]();};}function respondWithResult(_0x5f50f5,_0x1a3fce){_0x1a3fce=_0x1a3fce||0xc8;return function(_0x3ebcb0){if(_0x3ebcb0){return _0x5f50f5[_0xd621('0x1a')](_0x1a3fce)[_0xd621('0x1c')](_0x3ebcb0);}};}function respondWithFilteredResult(_0x454f30,_0x3a8853){return function(_0x418fbc){if(_0x418fbc){var _0x45faf1=typeof _0x3a8853['offset']===_0xd621('0x1d')&&typeof _0x3a8853[_0xd621('0x1e')]==='undefined';var _0x154c63=_0x418fbc['count'];var _0x4c7f50=_0x45faf1?0x0:_0x3a8853['offset'];var _0x1a8033=_0x45faf1?_0x418fbc[_0xd621('0x1f')]:_0x3a8853[_0xd621('0x20')]+_0x3a8853[_0xd621('0x1e')];var _0x117ebb;if(_0x1a8033>=_0x154c63){_0x1a8033=_0x154c63;_0x117ebb=0xc8;}else{_0x117ebb=0xce;}_0x454f30['status'](_0x117ebb);return _0x454f30[_0xd621('0x21')](_0xd621('0x22'),_0x4c7f50+'-'+_0x1a8033+'/'+_0x154c63)[_0xd621('0x1c')](_0x418fbc);}return null;};}function patchUpdates(_0x1e1ed7){return function(_0x571d2a){try{jsonpatch['apply'](_0x571d2a,_0x1e1ed7,!![]);}catch(_0x3ea8d6){return BPromise[_0xd621('0x23')](_0x3ea8d6);}return _0x571d2a[_0xd621('0x24')]();};}function saveUpdates(_0x314b8d,_0xa58e1d){return function(_0x8a0dd5){if(_0x8a0dd5){return _0x8a0dd5[_0xd621('0x25')](_0x314b8d)[_0xd621('0x26')](function(_0x8ba2c9){return _0x8ba2c9;});}return null;};}function removeEntity(_0x1aac2d,_0x404caf){return function(_0x503646){if(_0x503646){return _0x503646[_0xd621('0x27')]()[_0xd621('0x26')](function(){_0x1aac2d[_0xd621('0x1a')](0xcc)[_0xd621('0x1b')]();});}};}function handleEntityNotFound(_0x4cdc18,_0x491e36){return function(_0x52b08b){if(!_0x52b08b){_0x4cdc18[_0xd621('0x19')](0x194);}return _0x52b08b;};}function handleError(_0x4164f9,_0x27dadf){_0x27dadf=_0x27dadf||0x1f4;return function(_0x29034b){logger[_0xd621('0x28')](_0x29034b[_0xd621('0x29')]);if(_0x29034b[_0xd621('0x2a')]){delete _0x29034b['name'];}_0x4164f9[_0xd621('0x1a')](_0x27dadf)['send'](_0x29034b);};}exports['index']=function(_0x4ebda0,_0x42664b){var _0x19e0a6={},_0xe3fb46={},_0x34b398={'count':0x0,'rows':[]};var _0x1bda49=_[_0xd621('0x2b')](db[_0xd621('0x2c')][_0xd621('0x2d')],function(_0x3177ad){return{'name':_0x3177ad['fieldName'],'type':_0x3177ad['type'][_0xd621('0x2e')]};});_0xe3fb46[_0xd621('0x2f')]=_[_0xd621('0x2b')](_0x1bda49,_0xd621('0x2a'));_0xe3fb46[_0xd621('0x30')]=_[_0xd621('0x31')](_0x4ebda0[_0xd621('0x30')]);_0xe3fb46['filters']=_['intersection'](_0xe3fb46[_0xd621('0x2f')],_0xe3fb46[_0xd621('0x30')]);_0x19e0a6[_0xd621('0x32')]=_[_0xd621('0x33')](_0xe3fb46[_0xd621('0x2f')],qs[_0xd621('0x34')](_0x4ebda0[_0xd621('0x30')][_0xd621('0x34')]));_0x19e0a6['attributes']=_0x19e0a6[_0xd621('0x32')][_0xd621('0x35')]?_0x19e0a6[_0xd621('0x32')]:_0xe3fb46['model'];if(!_0x4ebda0[_0xd621('0x30')][_0xd621('0x36')]('nolimit')){_0x19e0a6[_0xd621('0x1e')]=qs[_0xd621('0x1e')](_0x4ebda0[_0xd621('0x30')][_0xd621('0x1e')]);_0x19e0a6[_0xd621('0x20')]=qs['offset'](_0x4ebda0[_0xd621('0x30')][_0xd621('0x20')]);}_0x19e0a6[_0xd621('0x37')]=qs[_0xd621('0x38')](_0x4ebda0[_0xd621('0x30')]['sort']);_0x19e0a6['where']=qs['filters'](_[_0xd621('0x39')](_0x4ebda0[_0xd621('0x30')],_0xe3fb46[_0xd621('0x3a')]),_0x1bda49);if(_0x4ebda0[_0xd621('0x30')]['filter']){_0x19e0a6[_0xd621('0x3b')]=_[_0xd621('0x3c')](_0x19e0a6[_0xd621('0x3b')],{'$or':_[_0xd621('0x2b')](_0x1bda49,function(_0x173b26){if(_0x173b26[_0xd621('0x3d')]!==_0xd621('0x3e')){var _0x5669fe={};_0x5669fe[_0x173b26[_0xd621('0x2a')]]={'$like':'%'+_0x4ebda0['query'][_0xd621('0x3f')]+'%'};return _0x5669fe;}})});}_0x19e0a6=_[_0xd621('0x3c')]({},_0x19e0a6,_0x4ebda0['options']);var _0x4264ea={'where':_0x19e0a6[_0xd621('0x3b')]};return db[_0xd621('0x2c')][_0xd621('0x1f')](_0x4264ea)[_0xd621('0x26')](function(_0x50c4f7){_0x34b398['count']=_0x50c4f7;if(_0x4ebda0[_0xd621('0x30')][_0xd621('0x40')]){_0x19e0a6[_0xd621('0x41')]=[{'all':!![]}];}return db[_0xd621('0x2c')][_0xd621('0x42')](_0x19e0a6);})[_0xd621('0x26')](function(_0x23c161){_0x34b398['rows']=_0x23c161;return _0x34b398;})[_0xd621('0x26')](respondWithFilteredResult(_0x42664b,_0x19e0a6))['catch'](handleError(_0x42664b,null));};exports[_0xd621('0x43')]=function(_0x37fc2b,_0x4d79aa){var _0x541b9f={'raw':!![],'where':{'id':_0x37fc2b[_0xd621('0x44')]['id']}},_0x4e3665={};_0x4e3665[_0xd621('0x2f')]=_['keys'](db['MailTransferReport'][_0xd621('0x2d')]);_0x4e3665[_0xd621('0x30')]=_[_0xd621('0x31')](_0x37fc2b[_0xd621('0x30')]);_0x4e3665['filters']=_[_0xd621('0x33')](_0x4e3665[_0xd621('0x2f')],_0x4e3665[_0xd621('0x30')]);_0x541b9f[_0xd621('0x32')]=_['intersection'](_0x4e3665[_0xd621('0x2f')],qs[_0xd621('0x34')](_0x37fc2b[_0xd621('0x30')]['fields']));_0x541b9f[_0xd621('0x32')]=_0x541b9f[_0xd621('0x32')][_0xd621('0x35')]?_0x541b9f['attributes']:_0x4e3665['model'];if(_0x37fc2b[_0xd621('0x30')][_0xd621('0x40')]){_0x541b9f[_0xd621('0x41')]=[{'all':!![]}];}_0x541b9f=_[_0xd621('0x3c')]({},_0x541b9f,_0x37fc2b[_0xd621('0x45')]);return db['MailTransferReport']['find'](_0x541b9f)[_0xd621('0x26')](handleEntityNotFound(_0x4d79aa,null))[_0xd621('0x26')](respondWithResult(_0x4d79aa,null))['catch'](handleError(_0x4d79aa,null));};exports[_0xd621('0x46')]=function(_0x3092c0,_0x7e3f50){return db['MailTransferReport']['create'](_0x3092c0[_0xd621('0x47')],{})[_0xd621('0x26')](respondWithResult(_0x7e3f50,0xc9))[_0xd621('0x48')](handleError(_0x7e3f50,null));};exports[_0xd621('0x25')]=function(_0x562f5f,_0x4737e0){if(_0x562f5f[_0xd621('0x47')]['id']){delete _0x562f5f[_0xd621('0x47')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x562f5f[_0xd621('0x44')]['id']}})['then'](handleEntityNotFound(_0x4737e0,null))['then'](saveUpdates(_0x562f5f[_0xd621('0x47')],null))[_0xd621('0x26')](respondWithResult(_0x4737e0,null))[_0xd621('0x48')](handleError(_0x4737e0,null));};exports['destroy']=function(_0x3b941b,_0x35746f){return db[_0xd621('0x2c')][_0xd621('0x49')]({'where':{'id':_0x3b941b[_0xd621('0x44')]['id']}})[_0xd621('0x26')](handleEntityNotFound(_0x35746f,null))[_0xd621('0x26')](removeEntity(_0x35746f,null))[_0xd621('0x48')](handleError(_0x35746f,null));};exports[_0xd621('0x4a')]=function(_0x1f77dc,_0x3d264a){return db[_0xd621('0x2c')][_0xd621('0x4a')]()[_0xd621('0x26')](respondWithResult(_0x3d264a,null))[_0xd621('0x48')](handleError(_0x3d264a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 62a6171..8700350 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 _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 +var _0xc746=['request-promise','../../config/environment','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x124695,_0x300019){var _0x298915=function(_0xfb952e){while(--_0xfb952e){_0x124695['push'](_0x124695['shift']());}};_0x298915(++_0x300019);}(_0xc746,0xc9));var _0x6c74=function(_0x536e1e,_0x23d7a4){_0x536e1e=_0x536e1e-0x0;var _0x4b7ca3=_0xc746[_0x536e1e];return _0x4b7ca3;};'use strict';var _=require(_0x6c74('0x0'));var util=require(_0x6c74('0x1'));var logger=require(_0x6c74('0x2'))(_0x6c74('0x3'));var moment=require(_0x6c74('0x4'));var BPromise=require(_0x6c74('0x5'));var rp=require(_0x6c74('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6c74('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x2fb882,_0x412f92){return _0x2fb882['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x6c74('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 1dc5dd2..53e2554 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 _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 +var _0x7ee2=['stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1f3908,_0x3c164d){var _0x3ecd70=function(_0x331797){while(--_0x331797){_0x1f3908['push'](_0x1f3908['shift']());}};_0x3ecd70(++_0x3c164d);}(_0x7ee2,0x74));var _0x27ee=function(_0x539dae,_0x1fcf2f){_0x539dae=_0x539dae-0x0;var _0x5f3b18=_0x7ee2[_0x539dae];return _0x5f3b18;};'use strict';var _=require(_0x27ee('0x0'));var util=require('util');var moment=require(_0x27ee('0x1'));var BPromise=require(_0x27ee('0x2'));var rs=require(_0x27ee('0x3'));var fs=require('fs');var Redis=require(_0x27ee('0x4'));var db=require(_0x27ee('0x5'))['db'];var utils=require(_0x27ee('0x6'));var logger=require(_0x27ee('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x27ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fc259,_0x21038a,_0x5aa18c){return new BPromise(function(_0x288175,_0x3fa415){return client[_0x27ee('0x9')](_0x3fc259,_0x5aa18c)[_0x27ee('0xa')](function(_0x40a684){logger[_0x27ee('0xb')](_0x27ee('0xc'),_0x21038a,_0x27ee('0xd'));logger[_0x27ee('0xe')](_0x27ee('0xf'),_0x21038a,_0x27ee('0xd'),JSON[_0x27ee('0x10')](_0x40a684));if(_0x40a684['error']){if(_0x40a684['error'][_0x27ee('0x11')]===0x1f4){logger[_0x27ee('0x12')](_0x27ee('0xc'),_0x21038a,_0x40a684['error'][_0x27ee('0x13')]);return _0x3fa415(_0x40a684[_0x27ee('0x12')][_0x27ee('0x13')]);}logger[_0x27ee('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x21038a,_0x40a684['error'][_0x27ee('0x13')]);return _0x288175(_0x40a684[_0x27ee('0x12')][_0x27ee('0x13')]);}else{logger[_0x27ee('0xb')](_0x27ee('0xc'),_0x21038a,'request\x20sent');_0x288175(_0x40a684[_0x27ee('0x14')][_0x27ee('0x13')]);}})[_0x27ee('0x15')](function(_0x393301){logger[_0x27ee('0x12')](_0x27ee('0xc'),_0x21038a,_0x393301);_0x3fa415(_0x393301);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 5908534..c0623f0 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 _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 +var _0x33b5=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','create','put','update'];(function(_0x24bb1d,_0x193893){var _0x30e6f7=function(_0x4102da){while(--_0x4102da){_0x24bb1d['push'](_0x24bb1d['shift']());}};_0x30e6f7(++_0x193893);}(_0x33b5,0x16a));var _0x533b=function(_0xfded01,_0x20fc6b){_0xfded01=_0xfded01-0x0;var _0x28312c=_0x33b5[_0xfded01];return _0x28312c;};'use strict';var multer=require(_0x533b('0x0'));var util=require(_0x533b('0x1'));var path=require(_0x533b('0x2'));var timeout=require('connect-timeout');var express=require(_0x533b('0x3'));var router=express[_0x533b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x533b('0x5'));var interaction=require(_0x533b('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x533b('0x7')]('/',auth[_0x533b('0x8')](),controller[_0x533b('0x9')]);router[_0x533b('0x7')](_0x533b('0xa'),auth[_0x533b('0x8')](),controller[_0x533b('0xb')]);router[_0x533b('0x7')](_0x533b('0xc'),auth[_0x533b('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x533b('0xd')]);router[_0x533b('0xe')]('/:id',auth[_0x533b('0x8')](),controller[_0x533b('0xf')]);router['delete'](_0x533b('0xc'),auth['isAuthenticated'](),controller[_0x533b('0x10')]);module[_0x533b('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 10b851d..3debda9 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 _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 +var _0x3e86=['DATE','getDataValue','seconds','setDataValue','exitAt','talk:[start]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x279eef,_0x2f56ce){var _0x44f487=function(_0xe6210c){while(--_0xe6210c){_0x279eef['push'](_0x279eef['shift']());}};_0x44f487(++_0x2f56ce);}(_0x3e86,0x159));var _0x63e8=function(_0x1781a3,_0x306745){_0x1781a3=_0x1781a3-0x0;var _0x14944e=_0x3e86[_0x1781a3];return _0x14944e;};'use strict';var Sequelize=require(_0x63e8('0x0'));var moment=require(_0x63e8('0x1'));module[_0x63e8('0x2')]={'channel':{'type':Sequelize[_0x63e8('0x3')]},'membername':{'type':Sequelize[_0x63e8('0x3')]},'interface':{'type':Sequelize[_0x63e8('0x3')]},'type':{'type':Sequelize[_0x63e8('0x3')],'defaultValue':_0x63e8('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x63e8('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x350727){var _0x5f3e38=moment(_0x350727);var _0x5628f6=moment(this[_0x63e8('0x6')]('enterAt'));var _0x52aabe=_0x5f3e38['diff'](_0x5628f6,_0x63e8('0x7'));this[_0x63e8('0x8')](_0x63e8('0x9'),_0x350727);this[_0x63e8('0x8')]('duration',_0x52aabe>=0x0?_0x52aabe:null);}},'data1':{'type':Sequelize[_0x63e8('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x63e8('0x3')],'comment':_0x63e8('0xa')},'data3':{'type':Sequelize[_0x63e8('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x63e8('0x3')],'comment':_0x63e8('0xb')},'data5':{'type':Sequelize[_0x63e8('0x3')],'comment':_0x63e8('0xc')},'role':{'type':Sequelize[_0x63e8('0x3')]},'internal':{'type':Sequelize[_0x63e8('0xd')]},'uniqueid':{'type':Sequelize[_0x63e8('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 789ff70..b5bca8c 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 _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 +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(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xedd9,0xfc));var _0x9edd=function(_0x2a570e,_0x1e042a){_0x2a570e=_0x2a570e-0x0;var _0x5a166c=_0xedd9[_0x2a570e];return _0x5a166c;};'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 dbaab00..75209e2 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 _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 +var _0x0348=['api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','util'];(function(_0xb59fcc,_0x693426){var _0x3c7e69=function(_0x48f4c8){while(--_0x48f4c8){_0xb59fcc['push'](_0xb59fcc['shift']());}};_0x3c7e69(++_0x693426);}(_0x0348,0x1e9));var _0x8034=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x0348[_0x2ff4bd];return _0x28edc6;};'use strict';var _=require('lodash');var util=require(_0x8034('0x0'));var logger=require('../../config/logger')(_0x8034('0x1'));var moment=require(_0x8034('0x2'));var BPromise=require('bluebird');var rp=require(_0x8034('0x3'));var fs=require('fs');var path=require(_0x8034('0x4'));var rimraf=require(_0x8034('0x5'));var config=require(_0x8034('0x6'));var attributes=require(_0x8034('0x7'));module[_0x8034('0x8')]=function(_0x32e7e6,_0x2e1798){return _0x32e7e6['define'](_0x8034('0x9'),attributes,{'tableName':_0x8034('0xa'),'paranoid':![],'indexes':[{'name':_0x8034('0xb'),'fields':[_0x8034('0xc'),_0x8034('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b72ec39..dba3dd6 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 _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 +var _0x885a=['body','stringify','UpdateMemberReport','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MemberReport','options','raw','where','attributes','include','map','model','then','GetMemberReport','CreateMemberReport','create'];(function(_0x6e2d64,_0x5bf0fc){var _0x36c4e6=function(_0x233431){while(--_0x233431){_0x6e2d64['push'](_0x6e2d64['shift']());}};_0x36c4e6(++_0x5bf0fc);}(_0x885a,0x180));var _0xa885=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x885a[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var moment=require(_0xa885('0x1'));var BPromise=require(_0xa885('0x2'));var rs=require(_0xa885('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa885('0x4'))['db'];var utils=require(_0xa885('0x5'));var logger=require(_0xa885('0x6'))(_0xa885('0x7'));var config=require(_0xa885('0x8'));var jayson=require(_0xa885('0x9'));var client=jayson['client'][_0xa885('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1200c7,_0x31fd77,_0x546175){return new BPromise(function(_0x6b26e2,_0x2b7916){return client[_0xa885('0xb')](_0x1200c7,_0x546175)['then'](function(_0x2305b1){logger[_0xa885('0xc')](_0xa885('0xd'),_0x31fd77,_0xa885('0xe'));logger[_0xa885('0xf')](_0xa885('0x10'),_0x31fd77,_0xa885('0xe'),JSON['stringify'](_0x2305b1));if(_0x2305b1[_0xa885('0x11')]){if(_0x2305b1[_0xa885('0x11')][_0xa885('0x12')]===0x1f4){logger[_0xa885('0x11')](_0xa885('0xd'),_0x31fd77,_0x2305b1[_0xa885('0x11')][_0xa885('0x13')]);return _0x2b7916(_0x2305b1['error'][_0xa885('0x13')]);}logger[_0xa885('0x11')](_0xa885('0xd'),_0x31fd77,_0x2305b1[_0xa885('0x11')][_0xa885('0x13')]);return _0x6b26e2(_0x2305b1['error'][_0xa885('0x13')]);}else{logger[_0xa885('0xc')]('MemberReport,\x20%s,\x20%s',_0x31fd77,_0xa885('0xe'));_0x6b26e2(_0x2305b1[_0xa885('0x14')]['message']);}})[_0xa885('0x15')](function(_0x41b3de){logger['error'](_0xa885('0xd'),_0x31fd77,_0x41b3de);_0x2b7916(_0x41b3de);});});}exports['GetMemberReport']=function(_0x2e9290){var _0x3960ea=this;return new Promise(function(_0x8c26c,_0x4e4d51){return db[_0xa885('0x16')]['findAll']({'raw':_0x2e9290[_0xa885('0x17')]?_0x2e9290[_0xa885('0x17')][_0xa885('0x18')]===undefined?!![]:![]:!![],'where':_0x2e9290['options']?_0x2e9290[_0xa885('0x17')][_0xa885('0x19')]||null:null,'attributes':_0x2e9290[_0xa885('0x17')]?_0x2e9290['options'][_0xa885('0x1a')]||null:null,'limit':_0x2e9290[_0xa885('0x17')]?_0x2e9290[_0xa885('0x17')]['limit']||null:null,'include':_0x2e9290[_0xa885('0x17')]?_0x2e9290['options'][_0xa885('0x1b')]?_[_0xa885('0x1c')](_0x2e9290['options'][_0xa885('0x1b')],function(_0x190a57){return{'model':db[_0x190a57[_0xa885('0x1d')]],'as':_0x190a57['as'],'attributes':_0x190a57['attributes'],'include':_0x190a57[_0xa885('0x1b')]?_[_0xa885('0x1c')](_0x190a57['include'],function(_0x39ae58){return{'model':db[_0x39ae58['model']],'as':_0x39ae58['as'],'attributes':_0x39ae58[_0xa885('0x1a')],'include':_0x39ae58['include']?_[_0xa885('0x1c')](_0x39ae58[_0xa885('0x1b')],function(_0x3e347e){return{'model':db[_0x3e347e[_0xa885('0x1d')]],'as':_0x3e347e['as'],'attributes':_0x3e347e[_0xa885('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa885('0x1e')](function(_0x1e13d5){logger[_0xa885('0xc')]('GetMemberReport',_0x2e9290);logger['debug']('GetMemberReport',_0x2e9290,JSON['stringify'](_0x1e13d5));_0x8c26c(_0x1e13d5);})[_0xa885('0x15')](function(_0x3e9e22){logger[_0xa885('0x11')](_0xa885('0x1f'),_0x3e9e22[_0xa885('0x13')],_0x2e9290);_0x4e4d51(_0x3960ea[_0xa885('0x11')](0x1f4,_0x3e9e22['message']));});});};exports[_0xa885('0x20')]=function(_0x47d01c){var _0x1318ef=this;return new Promise(function(_0x4a1e54,_0x39990f){return db['MemberReport'][_0xa885('0x21')](_0x47d01c[_0xa885('0x22')],{'raw':_0x47d01c[_0xa885('0x17')]?_0x47d01c['options'][_0xa885('0x18')]===undefined?!![]:![]:!![]})[_0xa885('0x1e')](function(_0x5ed672){logger[_0xa885('0xc')]('CreateMemberReport',_0x47d01c);logger[_0xa885('0xf')](_0xa885('0x20'),_0x47d01c,JSON[_0xa885('0x23')](_0x5ed672));_0x4a1e54(_0x5ed672);})['catch'](function(_0xf34189){logger[_0xa885('0x11')](_0xa885('0x20'),_0xf34189['message'],_0x47d01c);_0x39990f(_0x1318ef[_0xa885('0x11')](0x1f4,_0xf34189[_0xa885('0x13')]));});});};exports[_0xa885('0x24')]=function(_0xd7c964){var _0x3995f0=this;return new Promise(function(_0x209758,_0x2a00d4){return db[_0xa885('0x16')]['update'](_0xd7c964['body'],{'raw':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x19')]||null:null,'attributes':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x1a')]||null:null,'limit':_0xd7c964['options']?_0xd7c964['options'][_0xa885('0x25')]||null:null})['then'](function(_0x502a96){logger[_0xa885('0xc')]('UpdateMemberReport',_0xd7c964);logger[_0xa885('0xf')](_0xa885('0x24'),_0xd7c964,JSON[_0xa885('0x23')](_0x502a96));_0x209758(_0x502a96);})[_0xa885('0x15')](function(_0x2d433e){logger[_0xa885('0x11')](_0xa885('0x24'),_0x2d433e[_0xa885('0x13')],_0xd7c964);_0x2a00d4(_0x3995f0[_0xa885('0x11')](0x1f4,_0x2d433e[_0xa885('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 16165e2..0fff87f 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 _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 +var _0xd8f6=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','util','path'];(function(_0x2cda29,_0xbd9b12){var _0x37d2d5=function(_0x297c69){while(--_0x297c69){_0x2cda29['push'](_0x2cda29['shift']());}};_0x37d2d5(++_0xbd9b12);}(_0xd8f6,0xf0));var _0x6d8f=function(_0x3a9557,_0xb61dec){_0x3a9557=_0x3a9557-0x0;var _0xccd1e9=_0xd8f6[_0x3a9557];return _0xccd1e9;};'use strict';var multer=require('multer');var util=require(_0x6d8f('0x0'));var path=require(_0x6d8f('0x1'));var timeout=require(_0x6d8f('0x2'));var express=require(_0x6d8f('0x3'));var router=express['Router']();var fs_extra=require(_0x6d8f('0x4'));var auth=require(_0x6d8f('0x5'));var interaction=require(_0x6d8f('0x6'));var config=require('../../config/environment');var controller=require(_0x6d8f('0x7'));router[_0x6d8f('0x8')]('/',controller[_0x6d8f('0x9')]);module[_0x6d8f('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8546acb..89e8e5d 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 _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 +var _0x9767=['STRING','version','exports'];(function(_0xde1d00,_0x187948){var _0x54a79a=function(_0x378643){while(--_0x378643){_0xde1d00['push'](_0xde1d00['shift']());}};_0x54a79a(++_0x187948);}(_0x9767,0x191));var _0x7976=function(_0x5d9339,_0x29c424){_0x5d9339=_0x5d9339-0x0;var _0x579826=_0x9767[_0x5d9339];return _0x579826;};'use strict';var Sequelize=require('sequelize');module[_0x7976('0x0')]={'version':{'type':Sequelize[_0x7976('0x1')],'unique':_0x7976('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f54ef7f..4d65bd8 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 _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 +var _0x2491=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Migration','include','rows','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0xa0ac05,_0x4a7da8){var _0x6ea8b4=function(_0x501c8d){while(--_0x501c8d){_0xa0ac05['push'](_0xa0ac05['shift']());}};_0x6ea8b4(++_0x4a7da8);}(_0x2491,0x1ca));var _0x1249=function(_0x54086b,_0x4154a2){_0x54086b=_0x54086b-0x0;var _0x395694=_0x2491[_0x54086b];return _0x395694;};'use strict';var emlformat=require(_0x1249('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1249('0x1'));var rp=require(_0x1249('0x2'));var moment=require(_0x1249('0x3'));var BPromise=require(_0x1249('0x4'));var Mustache=require(_0x1249('0x5'));var util=require(_0x1249('0x6'));var path=require(_0x1249('0x7'));var sox=require(_0x1249('0x8'));var csv=require(_0x1249('0x9'));var ejs=require(_0x1249('0xa'));var fs=require('fs');var fs_extra=require(_0x1249('0xb'));var _=require('lodash');var squel=require(_0x1249('0xc'));var crypto=require(_0x1249('0xd'));var jsforce=require(_0x1249('0xe'));var deskjs=require(_0x1249('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1249('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1249('0x11'));var qs=require(_0x1249('0x12'));var as=require(_0x1249('0x13'));var hardwareService=require(_0x1249('0x14'));var logger=require(_0x1249('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1249('0x16'));var licenseUtil=require(_0x1249('0x17'));var db=require(_0x1249('0x18'))['db'];function respondWithStatusCode(_0x1bde2b,_0x56f3ca){_0x56f3ca=_0x56f3ca||0xcc;return function(_0x54c4b8){if(_0x54c4b8){return _0x1bde2b[_0x1249('0x19')](_0x56f3ca);}return _0x1bde2b[_0x1249('0x1a')](_0x56f3ca)[_0x1249('0x1b')]();};}function respondWithResult(_0x107e65,_0x2f2766){_0x2f2766=_0x2f2766||0xc8;return function(_0x194871){if(_0x194871){return _0x107e65[_0x1249('0x1a')](_0x2f2766)[_0x1249('0x1c')](_0x194871);}};}function respondWithFilteredResult(_0x1fa86b,_0x503dee){return function(_0x53cab3){if(_0x53cab3){var _0x400c40=typeof _0x503dee['offset']===_0x1249('0x1d')&&typeof _0x503dee[_0x1249('0x1e')]===_0x1249('0x1d');var _0xd49acd=_0x53cab3[_0x1249('0x1f')];var _0x5158d1=_0x400c40?0x0:_0x503dee[_0x1249('0x20')];var _0x3ff1aa=_0x400c40?_0x53cab3[_0x1249('0x1f')]:_0x503dee[_0x1249('0x20')]+_0x503dee[_0x1249('0x1e')];var _0x17605f;if(_0x3ff1aa>=_0xd49acd){_0x3ff1aa=_0xd49acd;_0x17605f=0xc8;}else{_0x17605f=0xce;}_0x1fa86b[_0x1249('0x1a')](_0x17605f);return _0x1fa86b['set'](_0x1249('0x21'),_0x5158d1+'-'+_0x3ff1aa+'/'+_0xd49acd)['json'](_0x53cab3);}return null;};}function patchUpdates(_0x6d5e05){return function(_0x4b5f72){try{jsonpatch[_0x1249('0x22')](_0x4b5f72,_0x6d5e05,!![]);}catch(_0x57885a){return BPromise['reject'](_0x57885a);}return _0x4b5f72['save']();};}function saveUpdates(_0x50c8fe,_0x65eb53){return function(_0x5b4b40){if(_0x5b4b40){return _0x5b4b40[_0x1249('0x23')](_0x50c8fe)['then'](function(_0x47f97c){return _0x47f97c;});}return null;};}function removeEntity(_0x544b24,_0x18aae9){return function(_0x4d51eb){if(_0x4d51eb){return _0x4d51eb[_0x1249('0x24')]()[_0x1249('0x25')](function(){_0x544b24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x502fa9,_0x30ffe8){return function(_0x46e1d4){if(!_0x46e1d4){_0x502fa9['sendStatus'](0x194);}return _0x46e1d4;};}function handleError(_0x35083b,_0x1b3f93){_0x1b3f93=_0x1b3f93||0x1f4;return function(_0x579cbc){logger[_0x1249('0x26')](_0x579cbc[_0x1249('0x27')]);if(_0x579cbc[_0x1249('0x28')]){delete _0x579cbc['name'];}_0x35083b[_0x1249('0x1a')](_0x1b3f93)['send'](_0x579cbc);};}exports[_0x1249('0x29')]=function(_0x254dcb,_0x3000da){var _0x48cfff={},_0x51e933={},_0x5ac0b4={'count':0x0,'rows':[]};var _0x3fda98=_[_0x1249('0x2a')](db['Migration'][_0x1249('0x2b')],function(_0xd9f2d0){return{'name':_0xd9f2d0[_0x1249('0x2c')],'type':_0xd9f2d0[_0x1249('0x2d')][_0x1249('0x2e')]};});_0x51e933[_0x1249('0x2f')]=_[_0x1249('0x2a')](_0x3fda98,_0x1249('0x28'));_0x51e933['query']=_[_0x1249('0x30')](_0x254dcb['query']);_0x51e933[_0x1249('0x31')]=_[_0x1249('0x32')](_0x51e933[_0x1249('0x2f')],_0x51e933[_0x1249('0x33')]);_0x48cfff[_0x1249('0x34')]=_['intersection'](_0x51e933[_0x1249('0x2f')],qs[_0x1249('0x35')](_0x254dcb[_0x1249('0x33')][_0x1249('0x35')]));_0x48cfff[_0x1249('0x34')]=_0x48cfff[_0x1249('0x34')][_0x1249('0x36')]?_0x48cfff[_0x1249('0x34')]:_0x51e933[_0x1249('0x2f')];if(!_0x254dcb[_0x1249('0x33')][_0x1249('0x37')](_0x1249('0x38'))){_0x48cfff[_0x1249('0x1e')]=qs[_0x1249('0x1e')](_0x254dcb[_0x1249('0x33')][_0x1249('0x1e')]);_0x48cfff[_0x1249('0x20')]=qs[_0x1249('0x20')](_0x254dcb[_0x1249('0x33')][_0x1249('0x20')]);}_0x48cfff[_0x1249('0x39')]=qs[_0x1249('0x3a')](_0x254dcb[_0x1249('0x33')][_0x1249('0x3a')]);_0x48cfff[_0x1249('0x3b')]=qs['filters'](_[_0x1249('0x3c')](_0x254dcb['query'],_0x51e933[_0x1249('0x31')]),_0x3fda98);if(_0x254dcb['query'][_0x1249('0x3d')]){_0x48cfff[_0x1249('0x3b')]=_[_0x1249('0x3e')](_0x48cfff[_0x1249('0x3b')],{'$or':_[_0x1249('0x2a')](_0x3fda98,function(_0x1b291d){if(_0x1b291d['type']!=='VIRTUAL'){var _0xfd50a6={};_0xfd50a6[_0x1b291d[_0x1249('0x28')]]={'$like':'%'+_0x254dcb[_0x1249('0x33')]['filter']+'%'};return _0xfd50a6;}})});}_0x48cfff=_[_0x1249('0x3e')]({},_0x48cfff,_0x254dcb[_0x1249('0x3f')]);var _0x11c173={'where':_0x48cfff[_0x1249('0x3b')]};return db[_0x1249('0x40')][_0x1249('0x1f')](_0x11c173)['then'](function(_0x1cfd3a){_0x5ac0b4['count']=_0x1cfd3a;if(_0x254dcb['query']['includeAll']){_0x48cfff[_0x1249('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x48cfff);})[_0x1249('0x25')](function(_0x2a7f67){_0x5ac0b4[_0x1249('0x42')]=_0x2a7f67;return _0x5ac0b4;})['then'](respondWithFilteredResult(_0x3000da,_0x48cfff))[_0x1249('0x43')](handleError(_0x3000da,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 60a1955..5b20726 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 _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 +var _0xa582=['define','Migration','migrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0x235c28,_0x2fbcf6){var _0x5caaa1=function(_0xa19e71){while(--_0xa19e71){_0x235c28['push'](_0x235c28['shift']());}};_0x5caaa1(++_0x2fbcf6);}(_0xa582,0x17c));var _0x2a58=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xa582[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x2a58('0x0'));var util=require(_0x2a58('0x1'));var logger=require(_0x2a58('0x2'))('api');var moment=require(_0x2a58('0x3'));var BPromise=require(_0x2a58('0x4'));var rp=require(_0x2a58('0x5'));var fs=require('fs');var path=require(_0x2a58('0x6'));var rimraf=require(_0x2a58('0x7'));var config=require('../../config/environment');var attributes=require(_0x2a58('0x8'));module[_0x2a58('0x9')]=function(_0x14e2d4,_0x33bcde){return _0x14e2d4[_0x2a58('0xa')](_0x2a58('0xb'),attributes,{'tableName':_0x2a58('0xc'),'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 ca9038d..3b3e968 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 _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 +var _0x2f68=['Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug'];(function(_0x2bfb3f,_0x16fe71){var _0x19fcf3=function(_0x9078f2){while(--_0x9078f2){_0x2bfb3f['push'](_0x2bfb3f['shift']());}};_0x19fcf3(++_0x16fe71);}(_0x2f68,0x9a));var _0x82f6=function(_0x2ac929,_0xdc2eec){_0x2ac929=_0x2ac929-0x0;var _0x2632ce=_0x2f68[_0x2ac929];return _0x2632ce;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6d93335..3e02cec 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 _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 +var _0xe797=['./network.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3307bd,_0x256dbf){var _0x2561be=function(_0x3ebf){while(--_0x3ebf){_0x3307bd['push'](_0x3307bd['shift']());}};_0x2561be(++_0x256dbf);}(_0xe797,0x12a));var _0x7e79=function(_0x4320b9,_0x3340df){_0x4320b9=_0x4320b9-0x0;var _0x193aa5=_0xe797[_0x4320b9];return _0x193aa5;};'use strict';var multer=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var path=require(_0x7e79('0x2'));var timeout=require(_0x7e79('0x3'));var express=require(_0x7e79('0x4'));var router=express[_0x7e79('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7e79('0x6'));var interaction=require(_0x7e79('0x7'));var config=require('../../config/environment');var controller=require(_0x7e79('0x8'));router[_0x7e79('0x9')]('/',auth[_0x7e79('0xa')](),controller['index']);router['get'](_0x7e79('0xb'),auth[_0x7e79('0xa')](),controller['show']);router['post']('/',auth[_0x7e79('0xa')](),controller[_0x7e79('0xc')]);router[_0x7e79('0xd')]('/:id',auth[_0x7e79('0xa')](),controller[_0x7e79('0xe')]);router[_0x7e79('0xf')](_0x7e79('0xb'),auth[_0x7e79('0xa')](),controller[_0x7e79('0x10')]);module[_0x7e79('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9f0c801..dff6aa8 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 _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 +var _0x517a=['STRING','sequelize','exports','ENUM','externip','stun','turn'];(function(_0x463a1d,_0x2ad8e2){var _0xfc76e=function(_0x28a54f){while(--_0x28a54f){_0x463a1d['push'](_0x463a1d['shift']());}};_0xfc76e(++_0x2ad8e2);}(_0x517a,0xd3));var _0xa517=function(_0x51d319,_0x2971a9){_0x51d319=_0x51d319-0x0;var _0x22c953=_0x517a[_0x51d319];return _0x22c953;};'use strict';var Sequelize=require(_0xa517('0x0'));module[_0xa517('0x1')]={'type':{'type':Sequelize[_0xa517('0x2')]('localnet',_0xa517('0x3'),_0xa517('0x4'),_0xa517('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa517('0x6')]},'password':{'type':Sequelize[_0xa517('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ee51195..678f146 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 _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 +var _0xa57c=['server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','update','format','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','name','send','map','rawAttributes','fieldName','type','key','model','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Network','includeAll','findAll','rows','catch','keys','include','find','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf'];(function(_0x40c9bc,_0x6eb340){var _0x3acedf=function(_0x1c8532){while(--_0x1c8532){_0x40c9bc['push'](_0x40c9bc['shift']());}};_0x3acedf(++_0x6eb340);}(_0xa57c,0x1ba));var _0xca57=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xa57c[_0x565ed7];return _0x183ad7;};'use strict';var util=require(_0xca57('0x0'));var path=require(_0xca57('0x1'));var ejs=require(_0xca57('0x2'));var fs=require('fs');var _=require(_0xca57('0x3'));var qs=require(_0xca57('0x4'));var logger=require(_0xca57('0x5'))(_0xca57('0x6'));var config=require(_0xca57('0x7'));var db=require(_0xca57('0x8'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xca57('0x9')][_0xca57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d7595,_0x28d557,_0x608584,_0x48b08b){return new Promise(function(_0xc3722a,_0x4e046b){var _0x163f09=_0x48b08b||client;return _0x163f09[_0xca57('0xb')](_0x5d7595,_0x608584)[_0xca57('0xc')](function(_0x3e8d78){logger[_0xca57('0xd')](_0xca57('0xe'),_0x28d557,'request\x20sent');logger[_0xca57('0xf')](_0xca57('0x10'),_0x28d557,'request\x20sent',JSON[_0xca57('0x11')](_0x3e8d78));if(_0x3e8d78['error']){if(_0x3e8d78['error'][_0xca57('0x12')]===0x1f4){logger[_0xca57('0x13')](_0xca57('0xe'),_0x28d557,_0x3e8d78[_0xca57('0x13')][_0xca57('0x14')]);return _0x4e046b(_0x3e8d78['error'][_0xca57('0x14')]);}logger[_0xca57('0x13')](_0xca57('0xe'),_0x28d557,_0x3e8d78[_0xca57('0x13')][_0xca57('0x14')]);return _0xc3722a(_0x3e8d78[_0xca57('0x13')][_0xca57('0x14')]);}else{logger[_0xca57('0xd')](_0xca57('0xe'),_0x28d557,_0xca57('0x15'));_0xc3722a(_0x3e8d78[_0xca57('0x16')][_0xca57('0x14')]);}})['catch'](function(_0x341d76){logger[_0xca57('0x13')](_0xca57('0xe'),_0x28d557,_0x341d76);_0x4e046b(_0x341d76);});});}function respondWithResult(_0x328878,_0x2cdc6c){_0x2cdc6c=_0x2cdc6c||0xc8;return function(_0x5122cd){if(_0x5122cd){return _0x328878[_0xca57('0x17')](_0x2cdc6c)[_0xca57('0x18')](_0x5122cd);}};}function respondWithFilteredResult(_0x2bc696,_0x5cb7c3){return function(_0x2721ca){if(_0x2721ca){var _0x30b26e=typeof _0x5cb7c3[_0xca57('0x19')]===_0xca57('0x1a')&&typeof _0x5cb7c3[_0xca57('0x1b')]===_0xca57('0x1a');var _0x24e927=_0x2721ca[_0xca57('0x1c')];var _0xd82ed3=_0x30b26e?0x0:_0x5cb7c3[_0xca57('0x19')];var _0x4c5393=_0x30b26e?_0x2721ca[_0xca57('0x1c')]:_0x5cb7c3[_0xca57('0x19')]+_0x5cb7c3[_0xca57('0x1b')];var _0x2a41c5;if(_0x4c5393>=_0x24e927){_0x4c5393=_0x24e927;_0x2a41c5=0xc8;}else{_0x2a41c5=0xce;}_0x2bc696[_0xca57('0x17')](_0x2a41c5);return _0x2bc696[_0xca57('0x1d')](_0xca57('0x1e'),_0xd82ed3+'-'+_0x4c5393+'/'+_0x24e927)[_0xca57('0x18')](_0x2721ca);}return null;};}function saveUpdates(_0x6d42dc){return function(_0xc656bb){if(_0xc656bb){return _0xc656bb['update'](_0x6d42dc)[_0xca57('0xc')](function(_0xa6f668){return _0xa6f668;});}return null;};}function removeEntity(_0x2ab8cf){return function(_0x597f27){if(_0x597f27){return _0x597f27[_0xca57('0x1f')]()[_0xca57('0xc')](function(){_0x2ab8cf[_0xca57('0x17')](0xcc)[_0xca57('0x20')]();});}};}function handleEntityNotFound(_0xde6f46){return function(_0x10f9f0){if(!_0x10f9f0){_0xde6f46['sendStatus'](0x194);}return _0x10f9f0;};}function handleError(_0x302ac4,_0x116f29){_0x116f29=_0x116f29||0x1f4;return function(_0x182534){logger[_0xca57('0x13')](_0x182534['stack']);if(_0x182534[_0xca57('0x21')]){delete _0x182534[_0xca57('0x21')];}_0x302ac4[_0xca57('0x17')](_0x116f29)[_0xca57('0x22')](_0x182534);};}exports['index']=function(_0x1de0cc,_0x2bcb66){var _0xdcded1={},_0x1d9e33={},_0x3d8239={'count':0x0,'rows':[]};var _0x25253e=_[_0xca57('0x23')](db['Network'][_0xca57('0x24')],function(_0x2cdedd){return{'name':_0x2cdedd[_0xca57('0x25')],'type':_0x2cdedd[_0xca57('0x26')][_0xca57('0x27')]};});_0x1d9e33[_0xca57('0x28')]=_['map'](_0x25253e,_0xca57('0x21'));_0x1d9e33['query']=_['keys'](_0x1de0cc['query']);_0x1d9e33[_0xca57('0x29')]=_[_0xca57('0x2a')](_0x1d9e33['model'],_0x1d9e33['query']);_0xdcded1['attributes']=_[_0xca57('0x2a')](_0x1d9e33[_0xca57('0x28')],qs[_0xca57('0x2b')](_0x1de0cc['query'][_0xca57('0x2b')]));_0xdcded1[_0xca57('0x2c')]=_0xdcded1[_0xca57('0x2c')][_0xca57('0x2d')]?_0xdcded1[_0xca57('0x2c')]:_0x1d9e33['model'];if(!_0x1de0cc[_0xca57('0x2e')][_0xca57('0x2f')](_0xca57('0x30'))){_0xdcded1['limit']=qs[_0xca57('0x1b')](_0x1de0cc[_0xca57('0x2e')][_0xca57('0x1b')]);_0xdcded1[_0xca57('0x19')]=qs['offset'](_0x1de0cc[_0xca57('0x2e')][_0xca57('0x19')]);}_0xdcded1['order']=qs[_0xca57('0x31')](_0x1de0cc[_0xca57('0x2e')][_0xca57('0x31')]);_0xdcded1[_0xca57('0x32')]=qs['filters'](_['pick'](_0x1de0cc[_0xca57('0x2e')],_0x1d9e33['filters']),_0x25253e);if(_0x1de0cc[_0xca57('0x2e')][_0xca57('0x33')]){_0xdcded1[_0xca57('0x32')]=_[_0xca57('0x34')](_0xdcded1['where'],{'$or':_[_0xca57('0x23')](_0x25253e,function(_0x5c90cf){if(_0x5c90cf['type']!==_0xca57('0x35')){var _0xa85013={};_0xa85013[_0x5c90cf[_0xca57('0x21')]]={'$like':'%'+_0x1de0cc['query'][_0xca57('0x33')]+'%'};return _0xa85013;}})});}_0xdcded1=_['merge']({},_0xdcded1,_0x1de0cc[_0xca57('0x36')]);var _0x2cd748={'where':_0xdcded1[_0xca57('0x32')]};return db[_0xca57('0x37')][_0xca57('0x1c')](_0x2cd748)[_0xca57('0xc')](function(_0x5b4441){_0x3d8239[_0xca57('0x1c')]=_0x5b4441;if(_0x1de0cc[_0xca57('0x2e')][_0xca57('0x38')]){_0xdcded1['include']=[{'all':!![]}];}return db['Network'][_0xca57('0x39')](_0xdcded1);})[_0xca57('0xc')](function(_0x3e0a11){_0x3d8239[_0xca57('0x3a')]=_0x3e0a11;return _0x3d8239;})[_0xca57('0xc')](respondWithFilteredResult(_0x2bcb66,_0xdcded1))[_0xca57('0x3b')](handleError(_0x2bcb66,null));};exports['show']=function(_0x4a9ec7,_0xde5d0a){var _0x27fc19={'raw':!![],'where':{'id':_0x4a9ec7['params']['id']}},_0x4ca6a9={};_0x4ca6a9[_0xca57('0x28')]=_[_0xca57('0x3c')](db[_0xca57('0x37')]['rawAttributes']);_0x4ca6a9[_0xca57('0x2e')]=_['keys'](_0x4a9ec7['query']);_0x4ca6a9[_0xca57('0x29')]=_['intersection'](_0x4ca6a9[_0xca57('0x28')],_0x4ca6a9[_0xca57('0x2e')]);_0x27fc19[_0xca57('0x2c')]=_[_0xca57('0x2a')](_0x4ca6a9['model'],qs[_0xca57('0x2b')](_0x4a9ec7[_0xca57('0x2e')][_0xca57('0x2b')]));_0x27fc19['attributes']=_0x27fc19[_0xca57('0x2c')][_0xca57('0x2d')]?_0x27fc19[_0xca57('0x2c')]:_0x4ca6a9['model'];if(_0x4a9ec7[_0xca57('0x2e')][_0xca57('0x38')]){_0x27fc19[_0xca57('0x3d')]=[{'all':!![]}];}_0x27fc19=_[_0xca57('0x34')]({},_0x27fc19,_0x4a9ec7[_0xca57('0x36')]);return db[_0xca57('0x37')][_0xca57('0x3e')](_0x27fc19)[_0xca57('0xc')](handleEntityNotFound(_0xde5d0a,null))[_0xca57('0xc')](respondWithResult(_0xde5d0a,null))[_0xca57('0x3b')](handleError(_0xde5d0a,null));};exports['create']=function(_0xbc161c,_0x361601){var _0x4a035b;return db[_0xca57('0x37')][_0xca57('0x3f')](_0xbc161c[_0xca57('0x40')],{'raw':!![]})[_0xca57('0xc')](function(_0x5f4253){_0x4a035b=_0x5f4253;return db['Network'][_0xca57('0x39')]({'where':{'type':_0xbc161c['body']['type']},'raw':!![]});})[_0xca57('0xc')](function(_0x3eeda2){if(_0x4a035b['type'][_0xca57('0x41')]()==_0xca57('0x42')){var _0x5a8d74=fs[_0xca57('0x43')](path[_0xca57('0x44')](config['root'],_0xca57('0x45')),'utf8');var _0x55dfb0=ejs[_0xca57('0x46')](_0x5a8d74,{'networks':_0x3eeda2||[]});fs[_0xca57('0x47')](_0xca57('0x48'),_0x55dfb0);return respondWithRpcPromise(_0xca57('0x49'),_0xca57('0x3f'),{'module':_0xca57('0x4a')});}else if(_0x4a035b[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x4b')){var _0x541a2a=fs['readFileSync'](path['join'](config[_0xca57('0x4c')],_0xca57('0x4d')),_0xca57('0x4e'));var _0x3fc398=ejs[_0xca57('0x46')](_0x541a2a,{'networks':_0x3eeda2||[]});fs[_0xca57('0x47')](_0xca57('0x4f'),_0x3fc398);return respondWithRpcPromise(_0xca57('0x49'),'create',{'module':'res_stun_monitor.so'});}else{var _0x183bd3=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x50')),_0xca57('0x4e'));var _0x30c782=ejs[_0xca57('0x46')](_0x183bd3,{'networks':_0x3eeda2||[]});fs[_0xca57('0x47')](util['format'](_0xca57('0x51'),_0xbc161c['body']['type'][_0xca57('0x52')]()),_0x30c782);return respondWithRpcPromise(_0xca57('0x49'),'create',{'module':_0xca57('0x53')});}})[_0xca57('0xc')](function(){return _0x4a035b;})[_0xca57('0xc')](respondWithResult(_0x361601,0xc9))['catch'](handleError(_0x361601,null));};exports['update']=function(_0x36b6c1,_0x3040c7){var _0x440518;return db[_0xca57('0x37')][_0xca57('0x3e')]({'where':{'id':_0x36b6c1[_0xca57('0x54')]['id']}})[_0xca57('0xc')](handleEntityNotFound(_0x3040c7,null))[_0xca57('0xc')](saveUpdates(_0x36b6c1[_0xca57('0x40')],null))['then'](function(_0x14d66c){if(_0x14d66c){_0x440518=_0x14d66c;return db[_0xca57('0x37')][_0xca57('0x39')]({'where':{'type':_0x440518['type']},'raw':!![]});}return null;})[_0xca57('0xc')](function(_0x47da72){if(_0x440518['type'][_0xca57('0x41')]()=='STUN'){var _0x4376c4=fs[_0xca57('0x43')](path[_0xca57('0x44')](config['root'],_0xca57('0x45')),_0xca57('0x4e'));var _0x3f745e=ejs['render'](_0x4376c4,{'networks':_0x47da72||[]});fs[_0xca57('0x47')](_0xca57('0x48'),_0x3f745e);return respondWithRpcPromise(_0xca57('0x49'),'update',{'module':'res_stun_monitor.so'});}else if(_0x440518[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x4b')){var _0x12ca92=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x4d')),'utf8');var _0x58eadd=ejs[_0xca57('0x46')](_0x12ca92,{'networks':_0x47da72||[]});fs[_0xca57('0x47')](_0xca57('0x4f'),_0x58eadd);return respondWithRpcPromise('Reload',_0xca57('0x55'),{'module':_0xca57('0x4a')});}else{var _0x44e356=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],'server/files/templates/network.ejs'),'utf8');var _0x4f1536=ejs['render'](_0x44e356,{'networks':_0x47da72||[]});fs[_0xca57('0x47')](util[_0xca57('0x56')]('/etc/asterisk/sip_xcally_%s.conf',_0x36b6c1[_0xca57('0x40')][_0xca57('0x26')][_0xca57('0x52')]()),_0x4f1536);return respondWithRpcPromise(_0xca57('0x49'),_0xca57('0x55'),{'module':_0xca57('0x53')});}})[_0xca57('0xc')](function(_0x159928){if(_0x159928){return _0x440518;}return null;})[_0xca57('0xc')](respondWithResult(_0x3040c7,null))[_0xca57('0x3b')](handleError(_0x3040c7,null));};exports[_0xca57('0x1f')]=function(_0x1eb481,_0x4d244d){var _0x51c96b;return db[_0xca57('0x37')]['find']({'where':{'id':_0x1eb481[_0xca57('0x54')]['id']}})[_0xca57('0xc')](function(_0x29942f){_0x51c96b=_0x29942f;return _0x29942f;})[_0xca57('0xc')](handleEntityNotFound(_0x4d244d,null))[_0xca57('0xc')](removeEntity(_0x4d244d,null))['then'](function(){if(_0x51c96b){return db[_0xca57('0x37')][_0xca57('0x39')]({'where':{'type':_0x51c96b[_0xca57('0x26')]},'raw':!![]});}})[_0xca57('0xc')](function(_0x44d213){if(_0x51c96b[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x42')){var _0x24f697=fs['readFileSync'](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x45')),'utf8');var _0x563dcd=ejs[_0xca57('0x46')](_0x24f697,{'networks':_0x44d213||[]});fs[_0xca57('0x47')](_0xca57('0x48'),_0x563dcd);return respondWithRpcPromise(_0xca57('0x49'),_0xca57('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x51c96b[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x4b')){var _0x1bf74d=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x4d')),_0xca57('0x4e'));var _0x23139c=ejs[_0xca57('0x46')](_0x1bf74d,{'networks':_0x44d213||[]});fs['writeFileSync'](_0xca57('0x4f'),_0x23139c);return respondWithRpcPromise(_0xca57('0x49'),'destroy',{'module':_0xca57('0x4a')});}else{var _0x373d47=fs['readFileSync'](path[_0xca57('0x44')](config[_0xca57('0x4c')],'server/files/templates/network.ejs'),'utf8');var _0x60615d=ejs[_0xca57('0x46')](_0x373d47,{'networks':_0x44d213||[]});fs[_0xca57('0x47')](util[_0xca57('0x56')](_0xca57('0x51'),_0x51c96b['type'][_0xca57('0x52')]()),_0x60615d);return respondWithRpcPromise('Reload',_0xca57('0x1f'),{'module':_0xca57('0x53')});}})[_0xca57('0x3b')](handleError(_0x4d244d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index aa1fa40..39e74c3 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 _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 +var _0xc3fe=['request-promise','rimraf','../../config/environment','./network.attributes','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x12dd87,_0x5929c7){var _0x5f2132=function(_0x199816){while(--_0x199816){_0x12dd87['push'](_0x12dd87['shift']());}};_0x5f2132(++_0x5929c7);}(_0xc3fe,0xff));var _0xec3f=function(_0xbbee20,_0x44e08f){_0xbbee20=_0xbbee20-0x0;var _0x505e14=_0xc3fe[_0xbbee20];return _0x505e14;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var logger=require(_0xec3f('0x2'))('api');var moment=require(_0xec3f('0x3'));var BPromise=require(_0xec3f('0x4'));var rp=require(_0xec3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec3f('0x6'));var config=require(_0xec3f('0x7'));var attributes=require(_0xec3f('0x8'));module['exports']=function(_0x4fb9aa,_0x2d5b29){return _0x4fb9aa[_0xec3f('0x9')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 74f4baf..beef1bd 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_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 +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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x21f574,_0x407f06){_0x21f574=_0x21f574-0x0;var _0x2279ae=_0x7a54[_0x21f574];return _0x2279ae;};'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 2fdb484..aa3b78e 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 _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 +var _0x5430=['/:id/interactions','getInteractions','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x6ec16,_0x2e8212){var _0x2b62ac=function(_0x3aa462){while(--_0x3aa462){_0x6ec16['push'](_0x6ec16['shift']());}};_0x2b62ac(++_0x2e8212);}(_0x5430,0x10c));var _0x0543=function(_0x37adb6,_0x301243){_0x37adb6=_0x37adb6-0x0;var _0x35723c=_0x5430[_0x37adb6];return _0x35723c;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0x7')]('/:id/dispositions',auth[_0x0543('0x8')](),controller[_0x0543('0xe')]);router['get'](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x10')]);router[_0x0543('0x7')](_0x0543('0x11'),auth[_0x0543('0x8')](),controller[_0x0543('0x12')]);router[_0x0543('0x7')](_0x0543('0x13'),auth[_0x0543('0x8')](),controller[_0x0543('0x14')]);router[_0x0543('0x7')]('/:id/users',auth[_0x0543('0x8')](),controller[_0x0543('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0543('0x16')]);router[_0x0543('0x17')](_0x0543('0x18'),auth[_0x0543('0x8')](),controller[_0x0543('0x19')]);router['post'](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x1a')]);router[_0x0543('0x17')](_0x0543('0x1b'),controller[_0x0543('0x1c')]);router[_0x0543('0x17')]('/:id/applications',auth[_0x0543('0x8')](),controller['addApplications']);router['post'](_0x0543('0x1d'),auth[_0x0543('0x8')](),controller[_0x0543('0x1e')]);router['post'](_0x0543('0x1f'),auth['isAuthenticated'](),controller[_0x0543('0x20')]);router[_0x0543('0x21')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0x22')]);router[_0x0543('0x23')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x24')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0543('0x25')]);router[_0x0543('0x23')](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x26')]);router[_0x0543('0x23')](_0x0543('0x1d'),auth[_0x0543('0x8')](),controller[_0x0543('0x27')]);module[_0x0543('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 863a4b1..4be434a 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 _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 +var _0x9919=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xe7dfa7,_0x3d17ee){var _0x1a9fbf=function(_0x2ef98a){while(--_0x2ef98a){_0xe7dfa7['push'](_0xe7dfa7['shift']());}};_0x1a9fbf(++_0x3d17ee);}(_0x9919,0x1b1));var _0x9991=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0x9919[_0x163977];return _0x28bf3a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9991('0x0'));module[_0x9991('0x1')]={'name':{'type':Sequelize[_0x9991('0x2')],'unique':_0x9991('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9991('0x2')]},'token':{'type':Sequelize[_0x9991('0x2')],'defaultValue':function(){return rs[_0x9991('0x4')]();}},'replyUri':{'type':Sequelize[_0x9991('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9991('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9991('0x5')],'defaultValue':function(){return _0x9991('0x6');}},'notificationSound':{'type':Sequelize[_0x9991('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9991('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9991('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9991('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9991('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9991('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x9991('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x9991('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43ea34){if(!_0x43ea34)this[_0x9991('0xa')](_0x9991('0xb'),null);this[_0x9991('0xa')](_0x9991('0xc'),_0x43ea34);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 39e5832..4c069cf 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 _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 +var _0xa23f=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','autoAssociation','addDisposition','Disposition','getDispositions','OpenchannelAccountId','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','openchannel','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','order','getInteractions','Contact','Owner','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./openchannelAccount.socket','register','jayson/promise','http','client','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xa23f,0x7c));var _0xfa23=function(_0x357a38,_0x304f09){_0x357a38=_0x357a38-0x0;var _0x819481=_0xa23f[_0x357a38];return _0x819481;};'use strict';var emlformat=require(_0xfa23('0x0'));var rimraf=require(_0xfa23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa23('0x2'));var moment=require(_0xfa23('0x3'));var BPromise=require(_0xfa23('0x4'));var Mustache=require(_0xfa23('0x5'));var util=require('util');var path=require(_0xfa23('0x6'));var sox=require('sox');var csv=require(_0xfa23('0x7'));var ejs=require(_0xfa23('0x8'));var fs=require('fs');var fs_extra=require(_0xfa23('0x9'));var _=require(_0xfa23('0xa'));var squel=require('squel');var crypto=require(_0xfa23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa23('0xc'));var toCsv=require(_0xfa23('0x7'));var querystring=require(_0xfa23('0xd'));var Papa=require(_0xfa23('0xe'));var Redis=require(_0xfa23('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa23('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa23('0x11'))('api');var utils=require(_0xfa23('0x12'));var config=require(_0xfa23('0x13'));var licenseUtil=require(_0xfa23('0x14'));var db=require('../../mysqldb')['db'];config[_0xfa23('0x15')]=_[_0xfa23('0x16')](config[_0xfa23('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa23('0x15')]));require(_0xfa23('0x17'))[_0xfa23('0x18')](socket);var jayson=require(_0xfa23('0x19'));var client=jayson['client'][_0xfa23('0x1a')]({'port':0x232c});var client9002=jayson[_0xfa23('0x1b')][_0xfa23('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x9611e0,_0x542d9a,_0x1c4882,_0x39729e){return new BPromise(function(_0x3ca6be,_0x375f5a){var _0x3fa5f6=_0x39729e||client;return _0x3fa5f6['request'](_0x9611e0,_0x1c4882)['then'](function(_0x5c3c6d){logger[_0xfa23('0x1c')](_0xfa23('0x1d'),_0x542d9a,'request\x20sent');logger[_0xfa23('0x1e')](_0xfa23('0x1f'),_0x542d9a,_0xfa23('0x20'),JSON['stringify'](_0x5c3c6d));if(_0x5c3c6d[_0xfa23('0x21')]){if(_0x5c3c6d[_0xfa23('0x21')]['code']===0x1f4){logger[_0xfa23('0x21')](_0xfa23('0x1d'),_0x542d9a,_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);return _0x375f5a(_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);}logger[_0xfa23('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x542d9a,_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);return _0x3ca6be(_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);}else{logger['info'](_0xfa23('0x1d'),_0x542d9a,'request\x20sent');_0x3ca6be(_0x5c3c6d[_0xfa23('0x23')][_0xfa23('0x22')]);}})[_0xfa23('0x24')](function(_0x26bdce){logger[_0xfa23('0x21')](_0xfa23('0x1d'),_0x542d9a,_0x26bdce);_0x375f5a(_0x26bdce);});});}function respondWithStatusCode(_0x21bbc0,_0x499407){_0x499407=_0x499407||0xcc;return function(_0x5e1780){if(_0x5e1780){return _0x21bbc0[_0xfa23('0x25')](_0x499407);}return _0x21bbc0['status'](_0x499407)[_0xfa23('0x26')]();};}function respondWithResult(_0x5de208,_0x4ea972){_0x4ea972=_0x4ea972||0xc8;return function(_0x35b493){if(_0x35b493){return _0x5de208[_0xfa23('0x27')](_0x4ea972)[_0xfa23('0x28')](_0x35b493);}};}function respondWithFilteredResult(_0x3b00a8,_0x374169){return function(_0x24da31){if(_0x24da31){var _0x3c9d9d=typeof _0x374169['offset']===_0xfa23('0x29')&&typeof _0x374169['limit']===_0xfa23('0x29');var _0x6bf719=_0x24da31['count'];var _0x1c83d0=_0x3c9d9d?0x0:_0x374169[_0xfa23('0x2a')];var _0xf9c420=_0x3c9d9d?_0x24da31[_0xfa23('0x2b')]:_0x374169[_0xfa23('0x2a')]+_0x374169[_0xfa23('0x2c')];var _0x2d3564;if(_0xf9c420>=_0x6bf719){_0xf9c420=_0x6bf719;_0x2d3564=0xc8;}else{_0x2d3564=0xce;}_0x3b00a8[_0xfa23('0x27')](_0x2d3564);return _0x3b00a8[_0xfa23('0x2d')]('Content-Range',_0x1c83d0+'-'+_0xf9c420+'/'+_0x6bf719)[_0xfa23('0x28')](_0x24da31);}return null;};}function patchUpdates(_0x59c393){return function(_0x9d0602){try{jsonpatch[_0xfa23('0x2e')](_0x9d0602,_0x59c393,!![]);}catch(_0x451e40){return BPromise[_0xfa23('0x2f')](_0x451e40);}return _0x9d0602[_0xfa23('0x30')]();};}function saveUpdates(_0x8ac724,_0x18f549){return function(_0x33aa43){if(_0x33aa43){return _0x33aa43[_0xfa23('0x31')](_0x8ac724)['then'](function(_0x1571f8){return _0x1571f8;});}return null;};}function removeEntity(_0x4e82a3,_0x2709f9){return function(_0x88a593){if(_0x88a593){return _0x88a593[_0xfa23('0x32')]()[_0xfa23('0x33')](function(){var _0x3fed37=_0x88a593[_0xfa23('0x34')]({'plain':!![]});var _0x304c56='OpenchannelAccounts';return db[_0xfa23('0x35')][_0xfa23('0x32')]({'where':{'type':_0x304c56,'resourceId':_0x3fed37['id']}})[_0xfa23('0x33')](function(){return _0x88a593;});})[_0xfa23('0x33')](function(){_0x4e82a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5179a3,_0x4528cb){return function(_0x3e004f){if(!_0x3e004f){_0x5179a3['sendStatus'](0x194);}return _0x3e004f;};}function handleError(_0x22fd83,_0x4492ea){_0x4492ea=_0x4492ea||0x1f4;return function(_0x9d0ca0){logger['error'](_0x9d0ca0[_0xfa23('0x36')]);if(_0x9d0ca0['name']){delete _0x9d0ca0[_0xfa23('0x37')];}_0x22fd83[_0xfa23('0x27')](_0x4492ea)[_0xfa23('0x38')](_0x9d0ca0);};}exports[_0xfa23('0x39')]=function(_0x1bc029,_0x80827f){var _0x58fc41={'include':[{'model':db[_0xfa23('0x3a')],'as':_0xfa23('0x3b')}]},_0xe546db={},_0x3c4743={'count':0x0,'rows':[]};var _0x48c3a4=_[_0xfa23('0x3c')](db[_0xfa23('0x3d')][_0xfa23('0x3e')],function(_0x41682e){return{'name':_0x41682e[_0xfa23('0x3f')],'type':_0x41682e[_0xfa23('0x40')]['key']};});_0xe546db[_0xfa23('0x41')]=_['map'](_0x48c3a4,'name');_0xe546db[_0xfa23('0x42')]=_[_0xfa23('0x43')](_0x1bc029['query']);_0xe546db[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0xe546db[_0xfa23('0x41')],_0xe546db['query']);_0x58fc41[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0xe546db[_0xfa23('0x41')],qs['fields'](_0x1bc029['query'][_0xfa23('0x47')]));_0x58fc41['attributes']=_0x58fc41[_0xfa23('0x46')][_0xfa23('0x48')]?_0x58fc41[_0xfa23('0x46')]:_0xe546db['model'];if(!_0x1bc029[_0xfa23('0x42')][_0xfa23('0x49')](_0xfa23('0x4a'))){_0x58fc41[_0xfa23('0x2c')]=qs['limit'](_0x1bc029[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x58fc41[_0xfa23('0x2a')]=qs['offset'](_0x1bc029['query'][_0xfa23('0x2a')]);}_0x58fc41['order']=qs[_0xfa23('0x4b')](_0x1bc029[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x58fc41[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0x1bc029['query'],_0xe546db[_0xfa23('0x44')]),_0x48c3a4);if(_0x1bc029[_0xfa23('0x42')][_0xfa23('0x4e')]){_0x58fc41[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x58fc41[_0xfa23('0x4c')],{'$or':_['map'](_0x48c3a4,function(_0x9e8cb6){if(_0x9e8cb6[_0xfa23('0x40')]!==_0xfa23('0x50')){var _0x2f6a37={};_0x2f6a37[_0x9e8cb6[_0xfa23('0x37')]]={'$like':'%'+_0x1bc029['query'][_0xfa23('0x4e')]+'%'};return _0x2f6a37;}})});}_0x58fc41=_[_0xfa23('0x4f')]({},_0x58fc41,_0x1bc029[_0xfa23('0x51')]);var _0x5e4633={'where':_0x58fc41[_0xfa23('0x4c')]};return db[_0xfa23('0x3d')][_0xfa23('0x2b')](_0x5e4633)[_0xfa23('0x33')](function(_0xfe2115){_0x3c4743[_0xfa23('0x2b')]=_0xfe2115;if(_0x1bc029[_0xfa23('0x42')]['includeAll']){_0x58fc41[_0xfa23('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xfa23('0x53')](_0x58fc41);})[_0xfa23('0x33')](function(_0x3824a9){_0x3c4743[_0xfa23('0x54')]=_0x3824a9;return _0x3c4743;})[_0xfa23('0x33')](respondWithFilteredResult(_0x80827f,_0x58fc41))[_0xfa23('0x24')](handleError(_0x80827f,null));};exports['show']=function(_0x2f355d,_0x2b7628){var _0x2ec20b={'raw':![],'where':{'id':_0x2f355d[_0xfa23('0x55')]['id']},'include':[{'model':db[_0xfa23('0x3a')],'as':_0xfa23('0x3b')}]},_0x47459e={};_0x47459e['model']=_[_0xfa23('0x43')](db[_0xfa23('0x3d')][_0xfa23('0x3e')]);_0x47459e[_0xfa23('0x42')]=_['keys'](_0x2f355d[_0xfa23('0x42')]);_0x47459e[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x47459e[_0xfa23('0x41')],_0x47459e[_0xfa23('0x42')]);_0x2ec20b[_0xfa23('0x46')]=_['intersection'](_0x47459e[_0xfa23('0x41')],qs['fields'](_0x2f355d[_0xfa23('0x42')][_0xfa23('0x47')]));_0x2ec20b['attributes']=_0x2ec20b[_0xfa23('0x46')][_0xfa23('0x48')]?_0x2ec20b['attributes']:_0x47459e[_0xfa23('0x41')];if(_0x2f355d[_0xfa23('0x42')]['includeAll']){_0x2ec20b[_0xfa23('0x52')]=[{'all':!![]}];}_0x2ec20b=_[_0xfa23('0x4f')]({},_0x2ec20b,_0x2f355d[_0xfa23('0x51')]);return db[_0xfa23('0x3d')]['find'](_0x2ec20b)[_0xfa23('0x33')](handleEntityNotFound(_0x2b7628,null))[_0xfa23('0x33')](respondWithResult(_0x2b7628,null))['catch'](handleError(_0x2b7628,null));};exports[_0xfa23('0x56')]=function(_0x2322a3,_0x20bba5){return db[_0xfa23('0x3d')][_0xfa23('0x56')](_0x2322a3[_0xfa23('0x57')],{})['then'](function(_0x1924c7){var _0x3a7fcb=_0x2322a3[_0xfa23('0x58')]['get']({'plain':!![]});if(!_0x3a7fcb)throw new Error(_0xfa23('0x59'));if(_0x3a7fcb[_0xfa23('0x5a')]===_0xfa23('0x58')){var _0x51910e=_0x1924c7[_0xfa23('0x34')]({'plain':!![]});var _0x1e0f67=_0xfa23('0x5b');return db[_0xfa23('0x5c')][_0xfa23('0x5d')]({'where':{'name':_0x1e0f67,'userProfileId':_0x3a7fcb['userProfileId']},'raw':!![]})['then'](function(_0x20cde3){if(_0x20cde3&&_0x20cde3[_0xfa23('0x5e')]===0x0){return db[_0xfa23('0x35')][_0xfa23('0x56')]({'name':_0x51910e['name'],'resourceId':_0x51910e['id'],'type':_0x20cde3['name'],'sectionId':_0x20cde3['id']},{})[_0xfa23('0x33')](function(){return _0x1924c7;});}else{return _0x1924c7;}})[_0xfa23('0x24')](function(_0x38a265){logger[_0xfa23('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a265);throw _0x38a265;});}return _0x1924c7;})[_0xfa23('0x33')](respondWithResult(_0x20bba5,0xc9))[_0xfa23('0x24')](handleError(_0x20bba5,null));};exports['update']=function(_0x16db28,_0x2f08be){if(_0x16db28['body']['id']){delete _0x16db28[_0xfa23('0x57')]['id'];}return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x16db28[_0xfa23('0x55')]['id']},'include':[{'model':db[_0xfa23('0x3a')],'as':_0xfa23('0x3b')}]})['then'](handleEntityNotFound(_0x2f08be,null))[_0xfa23('0x33')](saveUpdates(_0x16db28['body'],null))[_0xfa23('0x33')](respondWithResult(_0x2f08be,null))[_0xfa23('0x24')](handleError(_0x2f08be,null));};exports[_0xfa23('0x32')]=function(_0x1a8a80,_0x266c4a){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x1a8a80[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x266c4a,null))['then'](removeEntity(_0x266c4a,null))[_0xfa23('0x24')](handleError(_0x266c4a,null));};exports['describe']=function(_0x2e346d,_0xd14e5a){return db['OpenchannelAccount']['describe']()[_0xfa23('0x33')](respondWithResult(_0xd14e5a,null))['catch'](handleError(_0xd14e5a,null));};exports[_0xfa23('0x5f')]=function(_0x4fb4b5,_0x268494,_0x400fc9){if(_0x4fb4b5[_0xfa23('0x57')]['id']){delete _0x4fb4b5[_0xfa23('0x57')]['id'];}return db[_0xfa23('0x3d')]['find']({'where':{'id':_0x4fb4b5['params']['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x268494,null))[_0xfa23('0x33')](function(_0x83153f){if(_0x83153f){_0x4fb4b5[_0xfa23('0x57')]['OpenchannelAccountId']=_0x83153f['id'];return db[_0xfa23('0x60')]['create'](_0x4fb4b5[_0xfa23('0x57')]);}})[_0xfa23('0x33')](respondWithResult(_0x268494,null))[_0xfa23('0x24')](handleError(_0x268494,null));};exports[_0xfa23('0x61')]=function(_0x74a9aa,_0x3bf459,_0x19c67f){var _0x1b93f4={'raw':![],'where':{}};var _0x787989={};var _0x4130cf={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x74a9aa[_0xfa23('0x55')]['id']}})['then'](handleEntityNotFound(_0x3bf459,null))[_0xfa23('0x33')](function(_0x47e2ee){if(_0x47e2ee){_0x787989[_0xfa23('0x41')]=_[_0xfa23('0x43')](db['Disposition'][_0xfa23('0x3e')]);_0x787989['query']=_['keys'](_0x74a9aa[_0xfa23('0x42')]);_0x787989[_0xfa23('0x44')]=_['intersection'](_0x787989[_0xfa23('0x41')],_0x787989[_0xfa23('0x42')]);_0x1b93f4[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x787989[_0xfa23('0x41')],qs[_0xfa23('0x47')](_0x74a9aa[_0xfa23('0x42')]['fields']));_0x1b93f4[_0xfa23('0x46')]=_0x1b93f4[_0xfa23('0x46')][_0xfa23('0x48')]?_0x1b93f4[_0xfa23('0x46')]:_0x787989[_0xfa23('0x41')];if(!_0x74a9aa['query'][_0xfa23('0x49')]('nolimit')){_0x1b93f4['limit']=qs['limit'](_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x1b93f4[_0xfa23('0x2a')]=qs['offset'](_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x2a')]);}_0x1b93f4['order']=qs[_0xfa23('0x4b')](_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x1b93f4[_0xfa23('0x4c')]=qs['filters'](_['pick'](_0x74a9aa[_0xfa23('0x42')],_0x787989['filters']));_0x1b93f4[_0xfa23('0x4c')][_0xfa23('0x62')]=_0x47e2ee['id'];if(_0x74a9aa[_0xfa23('0x42')]['filter']){_0x1b93f4[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x1b93f4[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x1b93f4[_0xfa23('0x46')],function(_0x4f95cf){var _0x5034ba={};_0x5034ba[_0x4f95cf]={'$like':'%'+_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x4e')]+'%'};return _0x5034ba;})});}_0x1b93f4=_[_0xfa23('0x4f')]({},_0x1b93f4,_0x74a9aa[_0xfa23('0x51')]);return db[_0xfa23('0x60')][_0xfa23('0x2b')]({'where':_0x1b93f4['where']})[_0xfa23('0x33')](function(_0x360f6f){_0x4130cf['count']=_0x360f6f;if(_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x63')]){_0x1b93f4[_0xfa23('0x52')]=[{'all':!![]}];}return db[_0xfa23('0x60')][_0xfa23('0x53')](_0x1b93f4);})['then'](function(_0x231461){_0x4130cf['rows']=_0x231461;return _0x4130cf;});}})['then'](respondWithFilteredResult(_0x3bf459,_0x1b93f4))['catch'](handleError(_0x3bf459,null));};exports['removeDispositions']=function(_0x23349e,_0x50e6f5,_0x17cec3){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x23349e[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x50e6f5,null))[_0xfa23('0x33')](function(_0x23c6f4){if(_0x23c6f4){return _0x23c6f4[_0xfa23('0x64')](_0x23349e['query'][_0xfa23('0x65')]);}})['then'](respondWithStatusCode(_0x50e6f5,null))[_0xfa23('0x24')](handleError(_0x50e6f5,null));};exports[_0xfa23('0x66')]=function(_0x5ae0ab,_0x2c4684,_0x469be3){if(_0x5ae0ab['body']['id']){delete _0x5ae0ab[_0xfa23('0x57')]['id'];}return db['OpenchannelAccount'][_0xfa23('0x5d')]({'where':{'id':_0x5ae0ab['params']['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x2c4684,null))['then'](function(_0xea852){if(_0xea852){_0x5ae0ab[_0xfa23('0x57')]['OpenchannelAccountId']=_0xea852['id'];return db[_0xfa23('0x67')][_0xfa23('0x56')](_0x5ae0ab[_0xfa23('0x57')]);}})['then'](respondWithResult(_0x2c4684,null))[_0xfa23('0x24')](handleError(_0x2c4684,null));};exports['getAnswers']=function(_0xfee428,_0x1c5e30,_0x3c8176){var _0x1c6329={'raw':![],'where':{}};var _0x58f34e={};var _0x3e0a3e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfa23('0x68')]({'where':{'id':_0xfee428['params']['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x1c5e30,null))[_0xfa23('0x33')](function(_0x70ba0f){if(_0x70ba0f){_0x58f34e[_0xfa23('0x41')]=_[_0xfa23('0x43')](db['CannedAnswer'][_0xfa23('0x3e')]);_0x58f34e['query']=_['keys'](_0xfee428[_0xfa23('0x42')]);_0x58f34e[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x58f34e[_0xfa23('0x41')],_0x58f34e['query']);_0x1c6329[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x58f34e[_0xfa23('0x41')],qs[_0xfa23('0x47')](_0xfee428[_0xfa23('0x42')][_0xfa23('0x47')]));_0x1c6329[_0xfa23('0x46')]=_0x1c6329[_0xfa23('0x46')][_0xfa23('0x48')]?_0x1c6329[_0xfa23('0x46')]:_0x58f34e[_0xfa23('0x41')];if(!_0xfee428[_0xfa23('0x42')]['hasOwnProperty'](_0xfa23('0x4a'))){_0x1c6329[_0xfa23('0x2c')]=qs[_0xfa23('0x2c')](_0xfee428[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x1c6329[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0xfee428['query'][_0xfa23('0x2a')]);}_0x1c6329['order']=qs['sort'](_0xfee428['query']['sort']);_0x1c6329[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0xfee428['query'],_0x58f34e[_0xfa23('0x44')]));_0x1c6329[_0xfa23('0x4c')][_0xfa23('0x62')]=_0x70ba0f['id'];if(_0xfee428[_0xfa23('0x42')][_0xfa23('0x4e')]){_0x1c6329['where']=_[_0xfa23('0x4f')](_0x1c6329[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x1c6329[_0xfa23('0x46')],function(_0xcaf538){var _0x2152a1={};_0x2152a1[_0xcaf538]={'$like':'%'+_0xfee428['query']['filter']+'%'};return _0x2152a1;})});}_0x1c6329=_['merge']({},_0x1c6329,_0xfee428['options']);return db[_0xfa23('0x67')][_0xfa23('0x2b')]({'where':_0x1c6329[_0xfa23('0x4c')]})[_0xfa23('0x33')](function(_0xed12f2){_0x3e0a3e['count']=_0xed12f2;if(_0xfee428[_0xfa23('0x42')][_0xfa23('0x63')]){_0x1c6329[_0xfa23('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfa23('0x53')](_0x1c6329);})['then'](function(_0x478c77){_0x3e0a3e[_0xfa23('0x54')]=_0x478c77;return _0x3e0a3e;});}})[_0xfa23('0x33')](respondWithFilteredResult(_0x1c5e30,_0x1c6329))[_0xfa23('0x24')](handleError(_0x1c5e30,null));};exports[_0xfa23('0x69')]=function(_0x47c4fd,_0x6bdaf0,_0x370cd0){return db['OpenchannelAccount'][_0xfa23('0x5d')]({'where':{'id':_0x47c4fd[_0xfa23('0x55')]['id']}})['then'](handleEntityNotFound(_0x6bdaf0,null))['then'](function(_0x1ca59c){if(_0x1ca59c){return _0x1ca59c['removeAnswers'](_0x47c4fd[_0xfa23('0x42')][_0xfa23('0x65')]);}})[_0xfa23('0x33')](respondWithStatusCode(_0x6bdaf0,null))[_0xfa23('0x24')](handleError(_0x6bdaf0,null));};exports[_0xfa23('0x6a')]=function(_0x3d566f,_0x26ce87,_0x1235e5){var _0x3e42dc={'body':_0x3d566f[_0xfa23('0x57')],'channel':_0xfa23('0x6b')};var _0x4c0059=[];var _0x2e33d5=[];var _0x9fb7c8={};var _0x48a314=![];return db[_0xfa23('0x6c')][_0xfa23('0x6d')]()[_0xfa23('0x33')](function(_0x293db0){if(!_0x293db0){throw new db['Sequelize']['ValidationError'](_0xfa23('0x6e'));}_0x4c0059=_[_0xfa23('0x6f')](_[_0xfa23('0x43')](_0x293db0),[_0xfa23('0x70'),'updatedAt']);_0x2e33d5=_['difference'](_[_0xfa23('0x43')](_0x293db0),[_0xfa23('0x70'),_0xfa23('0x71'),'CompanyId',_0xfa23('0x72')]);if(_0x3d566f[_0xfa23('0x57')]['id']){delete _0x3d566f['body']['id'];}if(_[_0xfa23('0x73')](_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')])){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x77'));}if(_[_0xfa23('0x73')](_0x3d566f[_0xfa23('0x57')][_0xfa23('0x57')])||_0x3d566f['body']['body']===''){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x78'));}if(_['isNil'](_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')])){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x7a')+_0x2e33d5);}if(!_[_0xfa23('0x7b')](_0x2e33d5,_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')])){throw new db['Sequelize'][(_0xfa23('0x76'))](_0xfa23('0x7c')+_0x2e33d5);}_0x9fb7c8[_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')]]=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')];})['then'](function(){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x3d566f['params']['id']},'include':[{'model':db[_0xfa23('0x7d')],'as':_0xfa23('0x7e'),'include':[{'model':db[_0xfa23('0x6c')],'as':_0xfa23('0x7f'),'where':_0x9fb7c8,'limit':0x1,'order':[[_0xfa23('0x71'),_0xfa23('0x80')]]}]},{'model':db[_0xfa23('0x81')],'as':_0xfa23('0x82')}]});})[_0xfa23('0x33')](handleEntityNotFound(_0x26ce87,null))[_0xfa23('0x33')](function(_0x3c0c1a){if(_0x3c0c1a&&_0x3c0c1a[_0xfa23('0x7e')]){_0x3e42dc[_0xfa23('0x83')]=_0x3c0c1a;_0x3e42dc[_0xfa23('0x84')]=_0x3c0c1a[_0xfa23('0x82')];_0x3e42dc[_0xfa23('0x85')]=_0x3c0c1a[_0xfa23('0x7e')];_0x3e42dc[_0xfa23('0x84')]=_[_0xfa23('0x86')](_0x3e42dc[_0xfa23('0x84')],[_0xfa23('0x87')],['asc']);if(_0x3e42dc[_0xfa23('0x83')][_0xfa23('0x82')]){delete _0x3e42dc[_0xfa23('0x83')][_0xfa23('0x82')];}if(_0x3e42dc[_0xfa23('0x83')]['List']&&_0x3e42dc[_0xfa23('0x83')][_0xfa23('0x7e')]['Contacts'][_0xfa23('0x48')]){return _0x3e42dc[_0xfa23('0x83')][_0xfa23('0x7e')][_0xfa23('0x7f')][0x0];}var _0x157e42=_[_0xfa23('0x16')](_0x3d566f['body'],{'firstName':_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')],'ListId':_0x3c0c1a[_0xfa23('0x72')]});_0x157e42[_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')]]=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')];return db[_0xfa23('0x6c')][_0xfa23('0x56')](_0x157e42,{'fields':_0x4c0059,'raw':!![]});}})['then'](handleEntityNotFound(_0x26ce87,null))[_0xfa23('0x33')](function(_0x166783){_0x3e42dc[_0xfa23('0x88')]=_0x166783;if(_0x166783){var _0x49d5f3={'ContactId':_0x166783['id'],'OpenchannelAccountId':_0x3d566f[_0xfa23('0x55')]['id'],'from':(_0x166783[_0xfa23('0x89')]||'')+'\x20'+(_0x166783[_0xfa23('0x8a')]||'')};var _0x2a52ad={'OpenchannelAccountId':_0x3d566f[_0xfa23('0x55')]['id'],'closed':![]};if(_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')]){_0x2a52ad[_0xfa23('0x8b')]=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')];return db['OpenchannelInteraction'][_0xfa23('0x5d')]({'where':_0x2a52ad})[_0xfa23('0x33')](function(_0x5600de){if(_0x5600de){return[_0x5600de,![]];}_0x49d5f3['threadId']=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')];_0x49d5f3[_0xfa23('0x8c')]=_0x3d566f[_0xfa23('0x57')]['externalUrl'];return db[_0xfa23('0x8d')]['create'](_0x49d5f3)[_0xfa23('0x33')](function(_0x59ca8a){return[_0x59ca8a,!![]];});});}else{_0x2a52ad[_0xfa23('0x8b')]=null;}_0x2a52ad[_0xfa23('0x8e')]=_0x166783['id'];return db['OpenchannelInteraction'][_0xfa23('0x5d')]({'where':_0x2a52ad})[_0xfa23('0x33')](function(_0x46d1ca){if(_0x46d1ca){return[_0x46d1ca,![]];}return db[_0xfa23('0x8d')][_0xfa23('0x56')](_0x49d5f3)[_0xfa23('0x33')](function(_0x31ce88){return[_0x31ce88,!![]];});});}})[_0xfa23('0x8f')](function(_0x5ed24f,_0x4cf772){if(_0x5ed24f){_0x48a314=_0x4cf772;if(!_0x4cf772){var _0x38be7d={'from':(_0x3e42dc[_0xfa23('0x88')][_0xfa23('0x89')]||'')+'\x20'+(_0x3e42dc[_0xfa23('0x88')][_0xfa23('0x8a')]||'')};if(_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')]&&_0x3d566f[_0xfa23('0x57')][_0xfa23('0x90')]&&_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')]!=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x90')]){_0x38be7d[_0xfa23('0x8b')]=_0x3d566f[_0xfa23('0x57')]['messageId'];}return _0x5ed24f['update'](_0x38be7d);}else{return _0x5ed24f;}}})['then'](function(_0x113257){_0x3e42dc['interaction']=_0x113257[_0xfa23('0x34')]({'plain':!![]});_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x92')]=_0x48a314;if(_0x3e42dc[_0xfa23('0x91')]['created']){if(_0x3e42dc[_0xfa23('0x83')]['autoclose']){_0x3e42dc[_0xfa23('0x84')]['push']({'id':0x0,'priority':_0x3e42dc[_0xfa23('0x84')][_0xfa23('0x48')]+0x1,'app':_0xfa23('0x93'),'appdata':_0xfa23('0x94'),'interval':_0xfa23('0x95')});}}return db[_0xfa23('0x96')][_0xfa23('0x56')]({'body':_0x3d566f[_0xfa23('0x57')]['body'],'OpenchannelAccountId':_0x3d566f[_0xfa23('0x55')]['id'],'OpenchannelInteractionId':_0x113257['id'],'direction':'in','ContactId':_0x3e42dc[_0xfa23('0x88')]['id'],'AttachmentId':_0x3d566f[_0xfa23('0x57')][_0xfa23('0x97')]});})['then'](function(_0x149a15){_0x3e42dc[_0xfa23('0x22')]=_0x149a15;if(!_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x98')])return;return db[_0xfa23('0x99')][_0xfa23('0x5d')]({'attributes':['id',_0xfa23('0x37')],'where':{'id':_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x98')]}});})['then'](function(_0x22e4bf){if(_0x22e4bf){_0x3e42dc[_0xfa23('0x84')][_0xfa23('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x22e4bf['name']+','+(_0x3e42dc[_0xfa23('0x83')][_0xfa23('0x9b')]||0xa),'interval':_0xfa23('0x95')});}if(!_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x9c')])return;return db[_0xfa23('0x9d')]['find']({'attributes':['id',_0xfa23('0x37')],'where':{'id':_0x3e42dc[_0xfa23('0x91')]['queueId']}});})[_0xfa23('0x33')](function(_0x2fe73b){if(_0x2fe73b){_0x3e42dc[_0xfa23('0x84')][_0xfa23('0x9a')]({'id':0x0,'priority':0x1,'app':_0xfa23('0x9e'),'appdata':_0x2fe73b[_0xfa23('0x37')]+','+(_0x3e42dc[_0xfa23('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':_0xfa23('0x95')});}return respondWithRpcPromise(_0xfa23('0x9f'),_0xfa23('0xa0'),_0x3e42dc);})['then'](function(_0x34bc33){respondWithRpcPromise('EventManager',_0xfa23('0xa1'),{'event':_0xfa23('0x6a'),'message':_0x34bc33},client9002);return _0x34bc33;})[_0xfa23('0x33')](respondWithResult(_0x26ce87,null))[_0xfa23('0x24')](handleError(_0x26ce87,null));};exports[_0xfa23('0xa2')]=function(_0x5ee234,_0x34367a){var _0x17b3a7=_0x5ee234[_0xfa23('0x55')]['id'];var _0x47157d=_0x5ee234[_0xfa23('0x57')];var _0x1a93ba=0xc8;var _0x4f0051=null;return db[_0xfa23('0xa3')]['transaction']({'isolationLevel':db[_0xfa23('0xa3')]['Transaction'][_0xfa23('0xa4')][_0xfa23('0xa5')]},function(_0x1e8cae){return db[_0xfa23('0x3d')][_0xfa23('0x68')]({'where':{'id':_0x17b3a7},'transaction':_0x1e8cae})['then'](function(_0x316700){if(_0x316700){return db['OpenchannelApplication'][_0xfa23('0x32')]({'where':{'OpenchannelAccountId':_0x17b3a7},'transaction':_0x1e8cae})[_0xfa23('0x33')](function(){var _0x144a38=_[_0xfa23('0x3c')](_0x47157d,function(_0x1730c0){_0x1730c0[_0xfa23('0x62')]=_0x17b3a7;return _0x1730c0;});return db[_0xfa23('0x81')][_0xfa23('0xa6')](_0x144a38,{'transaction':_0x1e8cae});});}else{_0x1a93ba=0x194;_0x4f0051=[];}});})[_0xfa23('0x33')](function(){if(_0x1a93ba!==0x194){return db[_0xfa23('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x17b3a7},'order':_0xfa23('0x87')})[_0xfa23('0x33')](function(_0x1b0f19){_0x4f0051=_0x1b0f19;});}})[_0xfa23('0x24')](function(_0x117863){_0x1a93ba=0x1f4;logger['error'](_0x117863[_0xfa23('0x36')]);if(_0x117863[_0xfa23('0x37')]){delete _0x117863[_0xfa23('0x37')];}_0x4f0051=_0x117863;})[_0xfa23('0xa7')](function(){if(_0x4f0051===null){_0x34367a[_0xfa23('0x25')](_0x1a93ba);}else{if(_0x1a93ba===0x1f4){_0x34367a['status'](_0x1a93ba)[_0xfa23('0x38')](_0x4f0051);}else{_0x34367a[_0xfa23('0x27')](_0x1a93ba)[_0xfa23('0x28')](_0x4f0051);}}});};exports[_0xfa23('0xa8')]=function(_0x381290,_0x4afe81,_0x3fbb95){var _0x47b141={};var _0x55dc5f={};var _0x4d9d31;var _0x37ba1a;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x381290[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x4afe81,null))[_0xfa23('0x33')](function(_0xf39a18){if(_0xf39a18){_0x4d9d31=_0xf39a18;_0x55dc5f[_0xfa23('0x41')]=_[_0xfa23('0x43')](db[_0xfa23('0x81')][_0xfa23('0x3e')]);_0x55dc5f[_0xfa23('0x42')]=_[_0xfa23('0x43')](_0x381290[_0xfa23('0x42')]);_0x55dc5f[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x55dc5f[_0xfa23('0x41')],_0x55dc5f[_0xfa23('0x42')]);_0x47b141[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x55dc5f['model'],qs[_0xfa23('0x47')](_0x381290['query'][_0xfa23('0x47')]));_0x47b141[_0xfa23('0x46')]=_0x47b141['attributes'][_0xfa23('0x48')]?_0x47b141[_0xfa23('0x46')]:_0x55dc5f[_0xfa23('0x41')];_0x47b141[_0xfa23('0xa9')]=qs[_0xfa23('0x4b')](_0x381290[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x47b141[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0x381290[_0xfa23('0x42')],_0x55dc5f[_0xfa23('0x44')]));if(_0x381290[_0xfa23('0x42')]['filter']){_0x47b141[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x47b141[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x47b141[_0xfa23('0x46')],function(_0x2aa3a5){var _0x287132={};_0x287132[_0x2aa3a5]={'$like':'%'+_0x381290[_0xfa23('0x42')][_0xfa23('0x4e')]+'%'};return _0x287132;})});}_0x47b141=_[_0xfa23('0x4f')]({},_0x47b141,_0x381290['options']);return _0x4d9d31[_0xfa23('0xa8')](_0x47b141);}})['then'](function(_0x227587){if(_0x227587){_0x37ba1a=_0x227587[_0xfa23('0x48')];if(!_0x381290['query'][_0xfa23('0x49')](_0xfa23('0x4a'))){_0x47b141[_0xfa23('0x2c')]=qs['limit'](_0x381290[_0xfa23('0x42')]['limit']);_0x47b141[_0xfa23('0x2a')]=qs['offset'](_0x381290[_0xfa23('0x42')][_0xfa23('0x2a')]);}return _0x4d9d31[_0xfa23('0xa8')](_0x47b141);}})[_0xfa23('0x33')](function(_0x3c9c27){if(_0x3c9c27){return _0x3c9c27?{'count':_0x37ba1a,'rows':_0x3c9c27}:null;}})[_0xfa23('0x33')](respondWithResult(_0x4afe81,null))[_0xfa23('0x24')](handleError(_0x4afe81,null));};exports[_0xfa23('0xaa')]=function(_0xe2aa6c,_0xdf540f,_0x244672){var _0x5c038b={'raw':![],'where':{}};var _0x487203={};var _0x188ce1={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xe2aa6c[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0xdf540f,null))[_0xfa23('0x33')](function(_0x31f8af){if(_0x31f8af){_0x487203[_0xfa23('0x41')]=_['keys'](db['OpenchannelInteraction'][_0xfa23('0x3e')]);_0x487203[_0xfa23('0x42')]=_[_0xfa23('0x43')](_0xe2aa6c[_0xfa23('0x42')]);_0x487203['filters']=_['intersection'](_0x487203[_0xfa23('0x41')],_0x487203[_0xfa23('0x42')]);_0x5c038b['attributes']=_[_0xfa23('0x45')](_0x487203[_0xfa23('0x41')],qs[_0xfa23('0x47')](_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x47')]));_0x5c038b[_0xfa23('0x46')]=_0x5c038b[_0xfa23('0x46')][_0xfa23('0x48')]?_0x5c038b[_0xfa23('0x46')]:_0x487203[_0xfa23('0x41')];if(!_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x49')](_0xfa23('0x4a'))){_0x5c038b[_0xfa23('0x2c')]=qs['limit'](_0xe2aa6c['query'][_0xfa23('0x2c')]);_0x5c038b[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x2a')]);}_0x5c038b[_0xfa23('0xa9')]=qs['sort'](_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x5c038b[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0xe2aa6c[_0xfa23('0x42')],_0x487203[_0xfa23('0x44')]));_0x5c038b[_0xfa23('0x4c')][_0xfa23('0x62')]=_0x31f8af['id'];if(_0xe2aa6c[_0xfa23('0x42')]['filter']){_0x5c038b[_0xfa23('0x4c')]=_['merge'](_0x5c038b[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x5c038b[_0xfa23('0x46')],function(_0x50acd1){var _0x462ea8={};_0x462ea8[_0x50acd1]={'$like':'%'+_0xe2aa6c['query'][_0xfa23('0x4e')]+'%'};return _0x462ea8;})});}_0x5c038b=_['merge']({},_0x5c038b,_0xe2aa6c[_0xfa23('0x51')]);return db[_0xfa23('0x8d')][_0xfa23('0x2b')]({'where':_0x5c038b[_0xfa23('0x4c')]})[_0xfa23('0x33')](function(_0x97229d){_0x188ce1[_0xfa23('0x2b')]=_0x97229d;if(_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x63')]){_0x5c038b[_0xfa23('0x52')]=[{'model':db[_0xfa23('0x6c')],'as':_0xfa23('0xab'),'required':![]},{'model':db[_0xfa23('0x99')],'as':_0xfa23('0xac'),'attributes':[_0xfa23('0x37'),'fullname',_0xfa23('0xad')],'required':![]},{'model':db[_0xfa23('0xae')],'as':'Tags','attributes':['id','name',_0xfa23('0xaf')],'where':_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0xb0')]?{'id':_0xe2aa6c['query'][_0xfa23('0xb0')]}:undefined,'required':_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0xb0')]?!![]:![]}];}return db[_0xfa23('0x8d')]['findAll'](_0x5c038b);})[_0xfa23('0x33')](function(_0x3cdcdb){_0x188ce1[_0xfa23('0x54')]=_0x3cdcdb;return _0x188ce1;});}})[_0xfa23('0x33')](respondWithFilteredResult(_0xdf540f,_0x5c038b))[_0xfa23('0x24')](handleError(_0xdf540f,null));};exports[_0xfa23('0xb1')]=function(_0x2f04a1,_0x29a3f5,_0x22d3d7){return db[_0xfa23('0x3d')]['find']({'where':{'id':_0x2f04a1[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x29a3f5,null))[_0xfa23('0x33')](function(_0x4854ef){if(_0x4854ef){return _0x4854ef[_0xfa23('0xb1')](_0x2f04a1['body'][_0xfa23('0x65')],_[_0xfa23('0xb2')](_0x2f04a1[_0xfa23('0x57')],[_0xfa23('0x65'),'id'])||{})['spread'](function(_0x46d5a3){for(var _0x2b505a=0x0;_0x2b505a<_0x2f04a1[_0xfa23('0x57')][_0xfa23('0x65')][_0xfa23('0x48')];_0x2b505a+=0x1){socket[_0xfa23('0xb3')](_0xfa23('0xb4'),{'UserId':Number(_0x2f04a1[_0xfa23('0x57')]['ids'][_0x2b505a]),'OpenchannelAccountId':Number(_0x2f04a1[_0xfa23('0x55')]['id'])});}return _0x46d5a3;});}})[_0xfa23('0x33')](respondWithResult(_0x29a3f5,null))['catch'](handleError(_0x29a3f5,null));};exports['removeAgents']=function(_0x54128e,_0x5a99ea,_0x34c412){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x54128e[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x5a99ea,null))[_0xfa23('0x33')](function(_0xa1f3e7){if(_0xa1f3e7){return _0xa1f3e7[_0xfa23('0xb5')](_0x54128e[_0xfa23('0x42')][_0xfa23('0x65')])[_0xfa23('0x33')](function(){if(_[_0xfa23('0xb6')](_0x54128e[_0xfa23('0x42')]['ids'])){for(var _0x146f3f=0x0;_0x146f3f<_0x54128e[_0xfa23('0x42')]['ids'][_0xfa23('0x48')];_0x146f3f+=0x1){socket[_0xfa23('0xb3')](_0xfa23('0xb7'),{'UserId':Number(_0x54128e[_0xfa23('0x42')][_0xfa23('0x65')][_0x146f3f]),'OpenchannelAccountId':Number(_0x54128e[_0xfa23('0x55')]['id'])});}}else{socket['emit'](_0xfa23('0xb7'),{'UserId':Number(_0x54128e['query']['ids']),'OpenchannelAccountId':Number(_0x54128e[_0xfa23('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x5a99ea,null))['catch'](handleError(_0x5a99ea,null));};exports[_0xfa23('0xb8')]=function(_0x33e6bd,_0x2a1992,_0x225d51){var _0x53a8fa={};var _0x4e743a={};var _0x3024d8;var _0x3f3651;return db['OpenchannelAccount'][_0xfa23('0x68')]({'where':{'id':_0x33e6bd[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x2a1992,null))[_0xfa23('0x33')](function(_0x30b6a9){if(_0x30b6a9){_0x3024d8=_0x30b6a9;_0x4e743a[_0xfa23('0x41')]=_[_0xfa23('0x43')](db[_0xfa23('0x99')][_0xfa23('0x3e')]);_0x4e743a['query']=_[_0xfa23('0x43')](_0x33e6bd['query']);_0x4e743a[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x4e743a[_0xfa23('0x41')],_0x4e743a[_0xfa23('0x42')]);_0x53a8fa[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x4e743a['model'],qs[_0xfa23('0x47')](_0x33e6bd['query'][_0xfa23('0x47')]));_0x53a8fa['attributes']=_0x53a8fa[_0xfa23('0x46')][_0xfa23('0x48')]?_0x53a8fa[_0xfa23('0x46')]:_0x4e743a[_0xfa23('0x41')];_0x53a8fa[_0xfa23('0xa9')]=qs[_0xfa23('0x4b')](_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x53a8fa[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0x33e6bd[_0xfa23('0x42')],_0x4e743a['filters']));if(_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x4e')]){_0x53a8fa[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x53a8fa[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x53a8fa['attributes'],function(_0x3da733){var _0xeaddfe={};_0xeaddfe[_0x3da733]={'$like':'%'+_0x33e6bd[_0xfa23('0x42')]['filter']+'%'};return _0xeaddfe;})});}_0x53a8fa=_[_0xfa23('0x4f')]({},_0x53a8fa,_0x33e6bd[_0xfa23('0x51')]);return _0x3024d8[_0xfa23('0xb8')](_0x53a8fa);}})[_0xfa23('0x33')](function(_0x5b3a66){if(_0x5b3a66){_0x3f3651=_0x5b3a66[_0xfa23('0x48')];if(!_0x33e6bd[_0xfa23('0x42')]['hasOwnProperty'](_0xfa23('0x4a'))){_0x53a8fa[_0xfa23('0x2c')]=qs['limit'](_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x53a8fa[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x2a')]);}return _0x3024d8[_0xfa23('0xb8')](_0x53a8fa);}})['then'](function(_0x4e6de1){if(_0x4e6de1){return _0x4e6de1?{'count':_0x3f3651,'rows':_0x4e6de1}:null;}})['then'](respondWithResult(_0x2a1992,null))[_0xfa23('0x24')](handleError(_0x2a1992,null));};exports[_0xfa23('0x38')]=function(_0x5dabc8,_0x4ac5fd,_0x24318e){var _0x38a371,_0x1f66f6,_0x3cf3e8;if(_[_0xfa23('0x73')](_0x5dabc8[_0xfa23('0x57')]['body'])||_0x5dabc8[_0xfa23('0x57')][_0xfa23('0x57')]===''){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x78'));}if(_[_0xfa23('0x73')](_0x5dabc8[_0xfa23('0x57')]['to'])){}_0x38a371=_0x5dabc8[_0xfa23('0x57')]['to'];return db['OpenchannelAccount'][_0xfa23('0x68')]({'where':{'id':_0x5dabc8[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x4ac5fd,null))[_0xfa23('0x33')](function(_0x45bc08){if(_0x45bc08){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x45bc08['id']},'include':[{'model':db[_0xfa23('0x7d')],'as':'List','include':[{'model':db[_0xfa23('0x6c')],'as':_0xfa23('0x7f'),'where':{[_0x45bc08[_0xfa23('0x79')]]:_0x38a371},'limit':0x1,'order':[[_0xfa23('0x71'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x4ac5fd,null))[_0xfa23('0x33')](function(_0x5543f2){if(_0x5543f2&&_0x5543f2[_0xfa23('0x7e')]){_0x1f66f6=_0x5543f2['get']({'plain':!![]});if(_0x1f66f6[_0xfa23('0x7e')]&&_0x1f66f6[_0xfa23('0x7e')][_0xfa23('0x7f')][_0xfa23('0x48')]){return _0x1f66f6['List'][_0xfa23('0x7f')][0x0];}return db['CmContact'][_0xfa23('0x56')](_[_0xfa23('0x16')](_0x5dabc8[_0xfa23('0x57')],{'firstName':_0x38a371,[_0x5543f2['mapKey']]:_0x38a371,'phone':_0x38a371,'ListId':_0x1f66f6[_0xfa23('0x72')]}));}})[_0xfa23('0x33')](handleEntityNotFound(_0x4ac5fd,null))[_0xfa23('0x33')](function(_0x57ec7f){if(_0x57ec7f){_0x3cf3e8=_0x57ec7f;return db[_0xfa23('0x8d')]['find']({'where':{'ContactId':_0x3cf3e8['id'],'closed':![],'OpenchannelAccountId':_0x1f66f6['id']}})['then'](function(_0x8d8a1e){if(_0x8d8a1e){return[_0x8d8a1e,![]];}return db[_0xfa23('0x8d')][_0xfa23('0x56')]({'UserId':_0x5dabc8[_0xfa23('0x58')]['id'],'ContactId':_0x3cf3e8['id'],'OpenchannelAccountId':_0x1f66f6['id'],'lastMsgDirection':_0xfa23('0xb9'),'firstMsgDirection':_0xfa23('0xb9'),'Messages':[_[_0xfa23('0x4f')](_0x5dabc8[_0xfa23('0x57')],{'read':![],'body':_0x5dabc8[_0xfa23('0x57')][_0xfa23('0x57')],'OpenchannelAccountId':_0x1f66f6['id'],'UserId':_0x5dabc8[_0xfa23('0x58')]['id'],'ContactId':_0x3cf3e8['id']})]},{'include':[{'model':db[_0xfa23('0x96')],'as':_0xfa23('0xba')}]})[_0xfa23('0x33')](function(_0x439528){return[_0x439528,!![]];});});}})[_0xfa23('0x8f')](function(_0x3e6ec6,_0x3270a2){if(_0x3270a2){return _0x3e6ec6;}return db[_0xfa23('0x96')][_0xfa23('0x56')](_[_0xfa23('0x4f')](_0x5dabc8[_0xfa23('0x57')],{'read':![],'body':_0x5dabc8['body'][_0xfa23('0x57')],'OpenchannelAccountId':_0x1f66f6['id'],'OpenchannelInteractionId':_0x3e6ec6['id'],'UserId':_0x5dabc8[_0xfa23('0x58')]['id'],'ContactId':_0x3cf3e8['id']}))[_0xfa23('0x33')](function(_0x1e867e){_0x3e6ec6[_0xfa23('0xbb')][_0xfa23('0xba')]=[];_0x3e6ec6['dataValues'][_0xfa23('0xba')][_0xfa23('0xbc')](_0x1e867e[_0xfa23('0xbb')]);return _0x3e6ec6;});});}})[_0xfa23('0x33')](respondWithResult(_0x4ac5fd,null))['catch'](handleError(_0x4ac5fd,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8787c7b..cbe8cfe 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 _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 +var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x18dfbd,_0xdaf40e){var _0x433f71=function(_0x3073e3){while(--_0x3073e3){_0x18dfbd['push'](_0x18dfbd['shift']());}};_0x433f71(++_0xdaf40e);}(_0x878f,0x173));var _0xf878=function(_0x5be477,_0x1b7f4c){_0x5be477=_0x5be477-0x0;var _0x3711be=_0x878f[_0x5be477];return _0x3711be;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3d7ef88..4436263 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(_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 +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x363b40,_0x203c6c){var _0x534fd1=function(_0x1a66fa){while(--_0x1a66fa){_0x363b40['push'](_0x363b40['shift']());}};_0x534fd1(++_0x203c6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 dd20152..7ff45cc 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 _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 +var _0xcffe=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x426de2,_0x24acaf){var _0x1dbafc=function(_0x57e5d4){while(--_0x57e5d4){_0x426de2['push'](_0x426de2['shift']());}};_0x1dbafc(++_0x24acaf);}(_0xcffe,0x1a1));var _0xecff=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0xcffe[_0x3d73ba];return _0x47e406;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});config[_0xecff('0xc')]=_[_0xecff('0xd')](config[_0xecff('0xc')],{'host':_0xecff('0xe'),'port':0x18eb});var socket=require(_0xecff('0xf'))(new Redis(config['redis']));require(_0xecff('0x10'))[_0xecff('0x11')](socket);function respondWithRpcPromise(_0x195b15,_0x20ab4f,_0x698e40){return new BPromise(function(_0x4fa444,_0x425380){return client[_0xecff('0x12')](_0x195b15,_0x698e40)[_0xecff('0x13')](function(_0x3ed904){logger[_0xecff('0x14')](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));logger[_0xecff('0x17')](_0xecff('0x18'),_0x20ab4f,_0xecff('0x16'),JSON[_0xecff('0x19')](_0x3ed904));if(_0x3ed904[_0xecff('0x1a')]){if(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1b')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x20ab4f,_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);return _0x425380(_0x3ed904['error'][_0xecff('0x1c')]);}logger[_0xecff('0x1a')](_0xecff('0x15'),_0x20ab4f,_0x3ed904['error']['message']);return _0x4fa444(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);}else{logger['info'](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));_0x4fa444(_0x3ed904[_0xecff('0x1d')][_0xecff('0x1c')]);}})[_0xecff('0x1e')](function(_0x1682a2){logger['error'](_0xecff('0x15'),_0x20ab4f,_0x1682a2);_0x425380(_0x1682a2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 43bf923..acec013 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 _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 +var _0x8db0=['register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8db0,0x65));var _0x08db=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x8db0[_0x46428c];return _0x16a677;};'use strict';var OpenchannelAccountEvents=require(_0x08db('0x0'));var events=[_0x08db('0x1'),'remove',_0x08db('0x2')];function createListener(_0x2ac694,_0x17ccf3){return function(_0x5eb423){_0x17ccf3[_0x08db('0x3')](_0x2ac694,_0x5eb423);};}function removeListener(_0x55e572,_0x4f4614){return function(){OpenchannelAccountEvents['removeListener'](_0x55e572,_0x4f4614);};}exports[_0x08db('0x4')]=function(_0x55af6b){for(var _0x14b0e6=0x0,_0x528139=events[_0x08db('0x5')];_0x14b0e6<_0x528139;_0x14b0e6++){var _0x1ca3d1=events[_0x14b0e6];var _0x16bcc0=createListener(_0x08db('0x6')+_0x1ca3d1,_0x55af6b);OpenchannelAccountEvents['on'](_0x1ca3d1,_0x16bcc0);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 45a7a99..274bff6 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 _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 +var _0xd57f=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x1a6556,_0x1fd199){var _0x4c6148=function(_0xed9d82){while(--_0xed9d82){_0x1a6556['push'](_0x1a6556['shift']());}};_0x4c6148(++_0x1fd199);}(_0xd57f,0x137));var _0xfd57=function(_0x5478c9,_0x4a396f){_0x5478c9=_0x5478c9-0x0;var _0x2bd706=_0xd57f[_0x5478c9];return _0x2bd706;};'use strict';var multer=require(_0xfd57('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfd57('0x1'));var express=require('express');var router=express[_0xfd57('0x2')]();var fs_extra=require(_0xfd57('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfd57('0x4'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xfd57('0x5')]('/',auth[_0xfd57('0x6')](),controller[_0xfd57('0x7')]);router[_0xfd57('0x5')](_0xfd57('0x8'),auth[_0xfd57('0x6')](),controller[_0xfd57('0x9')]);router[_0xfd57('0xa')]('/',auth[_0xfd57('0x6')](),controller[_0xfd57('0xb')]);router[_0xfd57('0xc')](_0xfd57('0x8'),auth[_0xfd57('0x6')](),controller[_0xfd57('0xd')]);router['delete'](_0xfd57('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xfd57('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 6f3793c..32fd08f 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 _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 +var _0xa9d8=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x3f213e,_0x26eaee){var _0x181a85=function(_0x4fbc02){while(--_0x4fbc02){_0x3f213e['push'](_0x3f213e['shift']());}};_0x181a85(++_0x26eaee);}(_0xa9d8,0x84));var _0x8a9d=function(_0x3de0b8,_0x2dc6c1){_0x3de0b8=_0x3de0b8-0x0;var _0x19d5da=_0xa9d8[_0x3de0b8];return _0x19d5da;};'use strict';var Sequelize=require(_0x8a9d('0x0'));module[_0x8a9d('0x1')]={'priority':{'type':Sequelize[_0x8a9d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8a9d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8a9d('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8a9d('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index de7f2dc..611f45a 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 _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 +var _0x3c96=['catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x3583c8,_0x114e2c){var _0x29385b=function(_0x5edb24){while(--_0x5edb24){_0x3583c8['push'](_0x3583c8['shift']());}};_0x29385b(++_0x114e2c);}(_0x3c96,0xef));var _0x63c9=function(_0x5388bf,_0x4c5388){_0x5388bf=_0x5388bf-0x0;var _0x3dfcd1=_0x3c96[_0x5388bf];return _0x3dfcd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63c9('0x0'));var zipdir=require(_0x63c9('0x1'));var jsonpatch=require(_0x63c9('0x2'));var rp=require(_0x63c9('0x3'));var moment=require(_0x63c9('0x4'));var BPromise=require(_0x63c9('0x5'));var Mustache=require(_0x63c9('0x6'));var util=require(_0x63c9('0x7'));var path=require(_0x63c9('0x8'));var sox=require(_0x63c9('0x9'));var csv=require(_0x63c9('0xa'));var ejs=require(_0x63c9('0xb'));var fs=require('fs');var fs_extra=require(_0x63c9('0xc'));var _=require(_0x63c9('0xd'));var squel=require(_0x63c9('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x63c9('0xf'));var toCsv=require(_0x63c9('0xa'));var querystring=require(_0x63c9('0x10'));var Papa=require('papaparse');var Redis=require(_0x63c9('0x11'));var authService=require(_0x63c9('0x12'));var qs=require(_0x63c9('0x13'));var as=require(_0x63c9('0x14'));var hardwareService=require(_0x63c9('0x15'));var logger=require(_0x63c9('0x16'))(_0x63c9('0x17'));var utils=require(_0x63c9('0x18'));var config=require(_0x63c9('0x19'));var licenseUtil=require(_0x63c9('0x1a'));var db=require(_0x63c9('0x1b'))['db'];function respondWithStatusCode(_0x597a20,_0x537948){_0x537948=_0x537948||0xcc;return function(_0x41ce77){if(_0x41ce77){return _0x597a20[_0x63c9('0x1c')](_0x537948);}return _0x597a20[_0x63c9('0x1d')](_0x537948)[_0x63c9('0x1e')]();};}function respondWithResult(_0x64a591,_0x2d8106){_0x2d8106=_0x2d8106||0xc8;return function(_0x28d708){if(_0x28d708){return _0x64a591[_0x63c9('0x1d')](_0x2d8106)[_0x63c9('0x1f')](_0x28d708);}};}function respondWithFilteredResult(_0x53a26d,_0xeda03e){return function(_0x42050a){if(_0x42050a){var _0x201f3c=typeof _0xeda03e[_0x63c9('0x20')]===_0x63c9('0x21')&&typeof _0xeda03e['limit']===_0x63c9('0x21');var _0x57c63b=_0x42050a[_0x63c9('0x22')];var _0x40a1fe=_0x201f3c?0x0:_0xeda03e[_0x63c9('0x20')];var _0x4a4699=_0x201f3c?_0x42050a['count']:_0xeda03e[_0x63c9('0x20')]+_0xeda03e[_0x63c9('0x23')];var _0x939b71;if(_0x4a4699>=_0x57c63b){_0x4a4699=_0x57c63b;_0x939b71=0xc8;}else{_0x939b71=0xce;}_0x53a26d[_0x63c9('0x1d')](_0x939b71);return _0x53a26d[_0x63c9('0x24')](_0x63c9('0x25'),_0x40a1fe+'-'+_0x4a4699+'/'+_0x57c63b)[_0x63c9('0x1f')](_0x42050a);}return null;};}function patchUpdates(_0x5df26a){return function(_0x4c6010){try{jsonpatch[_0x63c9('0x26')](_0x4c6010,_0x5df26a,!![]);}catch(_0x25cdc9){return BPromise[_0x63c9('0x27')](_0x25cdc9);}return _0x4c6010[_0x63c9('0x28')]();};}function saveUpdates(_0x57886f,_0x2de996){return function(_0x435c79){if(_0x435c79){return _0x435c79[_0x63c9('0x29')](_0x57886f)['then'](function(_0x5b1965){return _0x5b1965;});}return null;};}function removeEntity(_0x416643,_0x4a3831){return function(_0x4bf325){if(_0x4bf325){return _0x4bf325[_0x63c9('0x2a')]()[_0x63c9('0x2b')](function(){_0x416643[_0x63c9('0x1d')](0xcc)[_0x63c9('0x1e')]();});}};}function handleEntityNotFound(_0xf6515e,_0x1986bf){return function(_0x5415e0){if(!_0x5415e0){_0xf6515e[_0x63c9('0x1c')](0x194);}return _0x5415e0;};}function handleError(_0x1a9ae1,_0x578cf6){_0x578cf6=_0x578cf6||0x1f4;return function(_0x106ff8){logger[_0x63c9('0x2c')](_0x106ff8[_0x63c9('0x2d')]);if(_0x106ff8[_0x63c9('0x2e')]){delete _0x106ff8[_0x63c9('0x2e')];}_0x1a9ae1['status'](_0x578cf6)['send'](_0x106ff8);};}exports[_0x63c9('0x2f')]=function(_0x53100b,_0x59e0f9){var _0x8eafcc={},_0x1cfc92={},_0xefc6c7={'count':0x0,'rows':[]};var _0x47fe29=_[_0x63c9('0x30')](db[_0x63c9('0x31')][_0x63c9('0x32')],function(_0x24a350){return{'name':_0x24a350['fieldName'],'type':_0x24a350[_0x63c9('0x33')][_0x63c9('0x34')]};});_0x1cfc92[_0x63c9('0x35')]=_[_0x63c9('0x30')](_0x47fe29,_0x63c9('0x2e'));_0x1cfc92['query']=_[_0x63c9('0x36')](_0x53100b[_0x63c9('0x37')]);_0x1cfc92[_0x63c9('0x38')]=_[_0x63c9('0x39')](_0x1cfc92['model'],_0x1cfc92[_0x63c9('0x37')]);_0x8eafcc[_0x63c9('0x3a')]=_[_0x63c9('0x39')](_0x1cfc92[_0x63c9('0x35')],qs[_0x63c9('0x3b')](_0x53100b[_0x63c9('0x37')]['fields']));_0x8eafcc[_0x63c9('0x3a')]=_0x8eafcc[_0x63c9('0x3a')][_0x63c9('0x3c')]?_0x8eafcc[_0x63c9('0x3a')]:_0x1cfc92['model'];if(!_0x53100b[_0x63c9('0x37')][_0x63c9('0x3d')]('nolimit')){_0x8eafcc['limit']=qs['limit'](_0x53100b[_0x63c9('0x37')][_0x63c9('0x23')]);_0x8eafcc[_0x63c9('0x20')]=qs['offset'](_0x53100b[_0x63c9('0x37')][_0x63c9('0x20')]);}_0x8eafcc[_0x63c9('0x3e')]=qs[_0x63c9('0x3f')](_0x53100b[_0x63c9('0x37')][_0x63c9('0x3f')]);_0x8eafcc[_0x63c9('0x40')]=qs[_0x63c9('0x38')](_[_0x63c9('0x41')](_0x53100b[_0x63c9('0x37')],_0x1cfc92[_0x63c9('0x38')]),_0x47fe29);if(_0x53100b[_0x63c9('0x37')][_0x63c9('0x42')]){_0x8eafcc[_0x63c9('0x40')]=_[_0x63c9('0x43')](_0x8eafcc[_0x63c9('0x40')],{'$or':_['map'](_0x47fe29,function(_0x35d5da){if(_0x35d5da[_0x63c9('0x33')]!==_0x63c9('0x44')){var _0x3668a3={};_0x3668a3[_0x35d5da[_0x63c9('0x2e')]]={'$like':'%'+_0x53100b[_0x63c9('0x37')]['filter']+'%'};return _0x3668a3;}})});}_0x8eafcc=_['merge']({},_0x8eafcc,_0x53100b[_0x63c9('0x45')]);var _0x53653f={'where':_0x8eafcc[_0x63c9('0x40')]};return db[_0x63c9('0x31')]['count'](_0x53653f)['then'](function(_0x3cb39a){_0xefc6c7['count']=_0x3cb39a;if(_0x53100b[_0x63c9('0x37')][_0x63c9('0x46')]){_0x8eafcc[_0x63c9('0x47')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x8eafcc);})[_0x63c9('0x2b')](function(_0xe1bac2){_0xefc6c7[_0x63c9('0x48')]=_0xe1bac2;return _0xefc6c7;})[_0x63c9('0x2b')](respondWithFilteredResult(_0x59e0f9,_0x8eafcc))[_0x63c9('0x49')](handleError(_0x59e0f9,null));};exports['show']=function(_0x54a85a,_0x5d73a8){var _0x31e005={'raw':!![],'where':{'id':_0x54a85a[_0x63c9('0x4a')]['id']}},_0x3d759c={};_0x3d759c['model']=_[_0x63c9('0x36')](db[_0x63c9('0x31')][_0x63c9('0x32')]);_0x3d759c[_0x63c9('0x37')]=_[_0x63c9('0x36')](_0x54a85a[_0x63c9('0x37')]);_0x3d759c[_0x63c9('0x38')]=_[_0x63c9('0x39')](_0x3d759c['model'],_0x3d759c['query']);_0x31e005[_0x63c9('0x3a')]=_['intersection'](_0x3d759c[_0x63c9('0x35')],qs['fields'](_0x54a85a[_0x63c9('0x37')][_0x63c9('0x3b')]));_0x31e005[_0x63c9('0x3a')]=_0x31e005[_0x63c9('0x3a')][_0x63c9('0x3c')]?_0x31e005[_0x63c9('0x3a')]:_0x3d759c[_0x63c9('0x35')];if(_0x54a85a[_0x63c9('0x37')]['includeAll']){_0x31e005[_0x63c9('0x47')]=[{'all':!![]}];}_0x31e005=_[_0x63c9('0x43')]({},_0x31e005,_0x54a85a['options']);return db[_0x63c9('0x31')][_0x63c9('0x4b')](_0x31e005)[_0x63c9('0x2b')](handleEntityNotFound(_0x5d73a8,null))[_0x63c9('0x2b')](respondWithResult(_0x5d73a8,null))[_0x63c9('0x49')](handleError(_0x5d73a8,null));};exports['create']=function(_0x541414,_0x132a9c){return db['OpenchannelApplication'][_0x63c9('0x4c')](_0x541414[_0x63c9('0x4d')],{})['then'](respondWithResult(_0x132a9c,0xc9))[_0x63c9('0x49')](handleError(_0x132a9c,null));};exports[_0x63c9('0x29')]=function(_0x111a5e,_0x479011){if(_0x111a5e[_0x63c9('0x4d')]['id']){delete _0x111a5e[_0x63c9('0x4d')]['id'];}return db[_0x63c9('0x31')]['find']({'where':{'id':_0x111a5e[_0x63c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x479011,null))[_0x63c9('0x2b')](saveUpdates(_0x111a5e['body'],null))[_0x63c9('0x2b')](respondWithResult(_0x479011,null))[_0x63c9('0x49')](handleError(_0x479011,null));};exports[_0x63c9('0x2a')]=function(_0x13b92c,_0x311bb5){return db[_0x63c9('0x31')][_0x63c9('0x4b')]({'where':{'id':_0x13b92c[_0x63c9('0x4a')]['id']}})[_0x63c9('0x2b')](handleEntityNotFound(_0x311bb5,null))['then'](removeEntity(_0x311bb5,null))[_0x63c9('0x49')](handleError(_0x311bb5,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 97a1c7e..108750c 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 _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 +var _0x885b=['../../config/environment','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1c7d3a,_0x526b24){var _0x42a22d=function(_0x137fd4){while(--_0x137fd4){_0x1c7d3a['push'](_0x1c7d3a['shift']());}};_0x42a22d(++_0x526b24);}(_0x885b,0x1f4));var _0xb885=function(_0x4dfcaf,_0x3be22a){_0x4dfcaf=_0x4dfcaf-0x0;var _0x494669=_0x885b[_0x4dfcaf];return _0x494669;};'use strict';var _=require(_0xb885('0x0'));var util=require(_0xb885('0x1'));var logger=require(_0xb885('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb885('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb885('0x4'));var rimraf=require(_0xb885('0x5'));var config=require(_0xb885('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x44e1ca,_0x321a0b){return _0x44e1ca[_0xb885('0x7')]('OpenchannelApplication',attributes,{'tableName':_0xb885('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb885('0x9'),'collate':_0xb885('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e6d36bb..f844948 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 _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 +var _0x248b=['body','options','raw','where','attributes','UpdateOpenchannelApplication','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelApplication'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x248b,0x92));var _0xb248=function(_0x8cac0c,_0x187d8a){_0x8cac0c=_0x8cac0c-0x0;var _0x39ae4f=_0x248b[_0x8cac0c];return _0x39ae4f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb248('0x0'));var BPromise=require(_0xb248('0x1'));var rs=require(_0xb248('0x2'));var fs=require('fs');var Redis=require(_0xb248('0x3'));var db=require(_0xb248('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb248('0x5'));var config=require(_0xb248('0x6'));var jayson=require(_0xb248('0x7'));var client=jayson[_0xb248('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d84cd,_0x147d74,_0x104dca){return new BPromise(function(_0x1d3de6,_0x31060e){return client[_0xb248('0x9')](_0x1d84cd,_0x104dca)[_0xb248('0xa')](function(_0x36c244){logger['info'](_0xb248('0xb'),_0x147d74,_0xb248('0xc'));logger[_0xb248('0xd')](_0xb248('0xe'),_0x147d74,_0xb248('0xc'),JSON[_0xb248('0xf')](_0x36c244));if(_0x36c244[_0xb248('0x10')]){if(_0x36c244[_0xb248('0x10')][_0xb248('0x11')]===0x1f4){logger[_0xb248('0x10')](_0xb248('0xb'),_0x147d74,_0x36c244[_0xb248('0x10')][_0xb248('0x12')]);return _0x31060e(_0x36c244[_0xb248('0x10')][_0xb248('0x12')]);}logger[_0xb248('0x10')](_0xb248('0xb'),_0x147d74,_0x36c244[_0xb248('0x10')][_0xb248('0x12')]);return _0x1d3de6(_0x36c244['error'][_0xb248('0x12')]);}else{logger[_0xb248('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x147d74,_0xb248('0xc'));_0x1d3de6(_0x36c244['result'][_0xb248('0x12')]);}})[_0xb248('0x14')](function(_0x1c88a8){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x147d74,_0x1c88a8);_0x31060e(_0x1c88a8);});});}exports['UpdateOpenchannelApplication']=function(_0x4dd5e9){var _0xa0f6a1=this;return new Promise(function(_0x1993fe,_0x3f369b){return db[_0xb248('0x15')]['update'](_0x4dd5e9[_0xb248('0x16')],{'raw':_0x4dd5e9['options']?_0x4dd5e9[_0xb248('0x17')][_0xb248('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dd5e9[_0xb248('0x17')]?_0x4dd5e9['options'][_0xb248('0x19')]||null:null,'attributes':_0x4dd5e9[_0xb248('0x17')]?_0x4dd5e9[_0xb248('0x17')][_0xb248('0x1a')]||null:null,'limit':_0x4dd5e9[_0xb248('0x17')]?_0x4dd5e9['options']['limit']||null:null})['then'](function(_0x28d283){logger[_0xb248('0x13')](_0xb248('0x1b'),_0x4dd5e9);logger[_0xb248('0xd')](_0xb248('0x1b'),_0x4dd5e9,JSON[_0xb248('0xf')](_0x28d283));_0x1993fe(_0x28d283);})['catch'](function(_0x2c1f7c){logger['error'](_0xb248('0x1b'),_0x2c1f7c[_0xb248('0x12')],_0x4dd5e9);_0x3f369b(_0xa0f6a1[_0xb248('0x10')](0x1f4,_0x2c1f7c[_0xb248('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 93af8b8..3c703de 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 _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 +var _0xd5ff=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util'];(function(_0x4944dd,_0x5a8677){var _0x58ebba=function(_0x450258){while(--_0x450258){_0x4944dd['push'](_0x4944dd['shift']());}};_0x58ebba(++_0x5a8677);}(_0xd5ff,0x106));var _0xfd5f=function(_0x5f4bde,_0xa25d11){_0x5f4bde=_0x5f4bde-0x0;var _0x1c12ec=_0xd5ff[_0x5f4bde];return _0x1c12ec;};'use strict';var multer=require(_0xfd5f('0x0'));var util=require(_0xfd5f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd5f('0x2'));var router=express[_0xfd5f('0x3')]();var fs_extra=require(_0xfd5f('0x4'));var auth=require(_0xfd5f('0x5'));var interaction=require(_0xfd5f('0x6'));var config=require(_0xfd5f('0x7'));var controller=require(_0xfd5f('0x8'));router[_0xfd5f('0x9')]('/',auth[_0xfd5f('0xa')](),controller[_0xfd5f('0xb')]);router[_0xfd5f('0x9')](_0xfd5f('0xc'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0xd')]);router[_0xfd5f('0x9')](_0xfd5f('0xe'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0xf')]);router[_0xfd5f('0x9')](_0xfd5f('0x10'),auth[_0xfd5f('0xa')](),controller['getMessages']);router[_0xfd5f('0x9')](_0xfd5f('0x11'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0x12')]);router['post']('/',auth[_0xfd5f('0xa')](),controller[_0xfd5f('0x13')]);router['post']('/:id/messages',auth[_0xfd5f('0xa')](),controller['addMessage']);router[_0xfd5f('0x14')](_0xfd5f('0x15'),auth[_0xfd5f('0xa')](),interaction[_0xfd5f('0x16')]('openchannel',_0xfd5f('0x17')),controller['addTags']);router[_0xfd5f('0x18')](_0xfd5f('0xe'),auth[_0xfd5f('0xa')](),interaction[_0xfd5f('0x16')](_0xfd5f('0x19'),_0xfd5f('0x1a')),controller[_0xfd5f('0x1b')]);router['delete'](_0xfd5f('0xe'),auth[_0xfd5f('0xa')](),interaction['tracked'](_0xfd5f('0x19'),_0xfd5f('0x1c')),controller[_0xfd5f('0x1d')]);router[_0xfd5f('0x1e')](_0xfd5f('0x15'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0x1f')]);module[_0xfd5f('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d10536e..ad1769e 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 _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 +var _0x5cbc=['BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x6c9dea,_0xcf03e5){var _0x448ab9=function(_0x75c520){while(--_0x75c520){_0x6c9dea['push'](_0x6c9dea['shift']());}};_0x448ab9(++_0xcf03e5);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x3c5924,_0x4d295f){_0x3c5924=_0x3c5924-0x0;var _0x576958=_0x5cbc[_0x3c5924];return _0x576958;};'use strict';var Sequelize=require(_0xc5cb('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc5cb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc5cb('0x2')]},'disposition':{'type':Sequelize[_0xc5cb('0x3')]},'secondDisposition':{'type':Sequelize[_0xc5cb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc5cb('0x3')]},'read1stAt':{'type':Sequelize[_0xc5cb('0x2')]},'threadId':{'type':Sequelize[_0xc5cb('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xc5cb('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc5cb('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xc5cb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc5cb('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc5cb('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7970791..42986e7 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 _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 +var _0xd6e6=['json','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','type','key','findAll','openchannel','query','catch','show','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','includeAll','merge','options','create','update','body','find','describe','addMessage','ids','getMessages','OpenchannelMessage','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','User','fullname','push','CmContact','firstName','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','lastName','renderFile','views','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','limit','undefined','count','offset','set','Content-Range'];(function(_0x1a1b1e,_0x48de13){var _0x567349=function(_0x11eb31){while(--_0x11eb31){_0x1a1b1e['push'](_0x1a1b1e['shift']());}};_0x567349(++_0x48de13);}(_0xd6e6,0x155));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var rimraf=require(_0x6d6e('0x0'));var zipdir=require('zip-dir');var moment=require(_0x6d6e('0x1'));var util=require(_0x6d6e('0x2'));var path=require(_0x6d6e('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x6d6e('0x4'));var interaction=require(_0x6d6e('0x5'));var qs=require(_0x6d6e('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x6d6e('0x7'))(_0x6d6e('0x8'));var config=require('../../config/environment');var db=require(_0x6d6e('0x9'))['db'];config[_0x6d6e('0xa')]=_[_0x6d6e('0xb')](config[_0x6d6e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d6e('0xc'))(new Redis(config[_0x6d6e('0xa')]));require('./openchannelInteraction.socket')[_0x6d6e('0xd')](socket);function respondWithStatusCode(_0x4f9def,_0x5b90b7){_0x5b90b7=_0x5b90b7||0xcc;return function(_0xfdf566){if(_0xfdf566){return _0x4f9def['sendStatus'](_0x5b90b7);}return _0x4f9def[_0x6d6e('0xe')](_0x5b90b7)[_0x6d6e('0xf')]();};}function respondWithResult(_0x8b1446,_0x4cf8ee){_0x4cf8ee=_0x4cf8ee||0xc8;return function(_0x116c33){if(_0x116c33){return _0x8b1446[_0x6d6e('0xe')](_0x4cf8ee)['json'](_0x116c33);}};}function respondWithFilteredResult(_0x5587a6,_0x256b7c){return function(_0x3c4b75){if(_0x3c4b75){var _0x24a445=typeof _0x256b7c['offset']==='undefined'&&typeof _0x256b7c[_0x6d6e('0x10')]===_0x6d6e('0x11');var _0x1bfaa6=_0x3c4b75[_0x6d6e('0x12')];var _0x19d75a=_0x24a445?0x0:_0x256b7c[_0x6d6e('0x13')];var _0x2961aa=_0x24a445?_0x3c4b75['count']:_0x256b7c[_0x6d6e('0x13')]+_0x256b7c[_0x6d6e('0x10')];var _0x58abc8;if(_0x2961aa>=_0x1bfaa6){_0x2961aa=_0x1bfaa6;_0x58abc8=0xc8;}else{_0x58abc8=0xce;}_0x5587a6[_0x6d6e('0xe')](_0x58abc8);return _0x5587a6[_0x6d6e('0x14')](_0x6d6e('0x15'),_0x19d75a+'-'+_0x2961aa+'/'+_0x1bfaa6)[_0x6d6e('0x16')](_0x3c4b75);}return null;};}function saveUpdates(_0x293f5e){return function(_0x27b273){if(_0x27b273){return _0x27b273['update'](_0x293f5e)[_0x6d6e('0x17')](function(_0x3eaa35){return _0x3eaa35;});}return null;};}function removeEntity(_0x5640be){return function(_0x1fee1d){if(_0x1fee1d){return _0x1fee1d[_0x6d6e('0x18')]()['then'](function(){_0x5640be[_0x6d6e('0xe')](0xcc)[_0x6d6e('0xf')]();});}};}function handleEntityNotFound(_0x3051b1){return function(_0x18d70d){if(!_0x18d70d){_0x3051b1[_0x6d6e('0x19')](0x194);}return _0x18d70d;};}function handleError(_0x689297,_0x312710){_0x312710=_0x312710||0x1f4;return function(_0xaf09a6){logger[_0x6d6e('0x1a')](_0xaf09a6[_0x6d6e('0x1b')]);if(_0xaf09a6[_0x6d6e('0x1c')]){delete _0xaf09a6[_0x6d6e('0x1c')];}_0x689297[_0x6d6e('0xe')](_0x312710)['send'](_0xaf09a6);};}exports[_0x6d6e('0x1d')]=function(_0x4692fb,_0x477afb){var _0x20c5f0={};var _0x558956=_[_0x6d6e('0x1e')](db['OpenchannelInteraction'][_0x6d6e('0x1f')],function(_0x3cc64a){return{'name':_0x3cc64a['fieldName'],'type':_0x3cc64a[_0x6d6e('0x20')][_0x6d6e('0x21')]};});_0x20c5f0=qs['getOptions'](_0x558956,_0x4692fb);return interaction[_0x6d6e('0x22')](_0x6d6e('0x23'),_0x4692fb[_0x6d6e('0x24')],_0x4692fb['user'],_0x20c5f0,_0x558956)[_0x6d6e('0x17')](respondWithFilteredResult(_0x477afb,_0x20c5f0))[_0x6d6e('0x25')](handleError(_0x477afb,null));};exports[_0x6d6e('0x26')]=function(_0x44311e,_0x58eece){var _0x437a04={};if(_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x20')]&&_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x20')]==='from'){_0x437a04['from']=_0x44311e[_0x6d6e('0x27')]['id'];}else{_0x437a04['id']=_0x44311e[_0x6d6e('0x27')]['id'];}var _0x12d630={'raw':![],'where':_0x437a04},_0x2ac20c={};_0x2ac20c[_0x6d6e('0x28')]=_[_0x6d6e('0x29')](db[_0x6d6e('0x2a')][_0x6d6e('0x1f')]);_0x2ac20c[_0x6d6e('0x24')]=_['keys'](_0x44311e['query']);_0x2ac20c[_0x6d6e('0x2b')]=_[_0x6d6e('0x2c')](_0x2ac20c[_0x6d6e('0x28')],_0x2ac20c[_0x6d6e('0x24')]);_0x12d630[_0x6d6e('0x2d')]=_[_0x6d6e('0x2c')](_0x2ac20c[_0x6d6e('0x28')],qs[_0x6d6e('0x2e')](_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x2e')]));_0x12d630[_0x6d6e('0x2d')]=_0x12d630['attributes']['length']?_0x12d630[_0x6d6e('0x2d')]:_0x2ac20c['model'];if(_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x2f')]){_0x12d630['include']=[{'all':!![]}];}_0x12d630=_[_0x6d6e('0x30')]({},_0x12d630,_0x44311e[_0x6d6e('0x31')]);return db['OpenchannelInteraction']['find'](_0x12d630)['then'](handleEntityNotFound(_0x58eece,null))[_0x6d6e('0x17')](respondWithResult(_0x58eece,null))[_0x6d6e('0x25')](handleError(_0x58eece,null));};exports['create']=function(_0x4c4054,_0x4b292a){return db['OpenchannelInteraction'][_0x6d6e('0x32')](_0x4c4054['body'],{})['then'](respondWithResult(_0x4b292a,0xc9))['catch'](handleError(_0x4b292a,null));};exports[_0x6d6e('0x33')]=function(_0x1b8ac5,_0x2283f2){if(_0x1b8ac5[_0x6d6e('0x34')]['id']){delete _0x1b8ac5[_0x6d6e('0x34')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x1b8ac5[_0x6d6e('0x27')]['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x2283f2,null))[_0x6d6e('0x17')](saveUpdates(_0x1b8ac5[_0x6d6e('0x34')],null))[_0x6d6e('0x17')](respondWithResult(_0x2283f2,null))[_0x6d6e('0x25')](handleError(_0x2283f2,null));};exports[_0x6d6e('0x18')]=function(_0x79ac5d,_0x2dd289){return db[_0x6d6e('0x2a')][_0x6d6e('0x35')]({'where':{'id':_0x79ac5d[_0x6d6e('0x27')]['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x2dd289,null))[_0x6d6e('0x17')](removeEntity(_0x2dd289,null))[_0x6d6e('0x25')](handleError(_0x2dd289,null));};exports[_0x6d6e('0x36')]=function(_0x434776,_0x8863e3){return db[_0x6d6e('0x2a')][_0x6d6e('0x36')]()[_0x6d6e('0x17')](respondWithResult(_0x8863e3,null))[_0x6d6e('0x25')](handleError(_0x8863e3,null));};exports[_0x6d6e('0x37')]=function(_0x361d02,_0x8716e8){return db['OpenchannelMessage'][_0x6d6e('0x35')]({'where':{'id':_0x361d02['params']['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x8716e8,null))[_0x6d6e('0x17')](function(_0xa1f615){if(_0xa1f615){return _0xa1f615[_0x6d6e('0x37')](_0x361d02[_0x6d6e('0x34')][_0x6d6e('0x38')],_['omit'](_0x361d02[_0x6d6e('0x34')],[_0x6d6e('0x38'),'id'])||{});}})[_0x6d6e('0x17')](respondWithResult(_0x8716e8,null))['catch'](handleError(_0x8716e8,null));};exports[_0x6d6e('0x39')]=function(_0x20429b,_0x5e0667){var _0x21baf1={'raw':![],'where':{}};var _0x432054={};var _0x5c2e22={'count':0x0,'rows':[]};return db[_0x6d6e('0x2a')]['findOne']({'where':{'id':_0x20429b[_0x6d6e('0x27')]['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x5e0667,null))[_0x6d6e('0x17')](function(_0x646643){if(_0x646643){_0x432054[_0x6d6e('0x28')]=_['keys'](db[_0x6d6e('0x3a')]['rawAttributes']);_0x432054['query']=_[_0x6d6e('0x29')](_0x20429b[_0x6d6e('0x24')]);_0x432054[_0x6d6e('0x2b')]=_[_0x6d6e('0x2c')](_0x432054[_0x6d6e('0x28')],_0x432054[_0x6d6e('0x24')]);_0x21baf1[_0x6d6e('0x2d')]=_[_0x6d6e('0x2c')](_0x432054[_0x6d6e('0x28')],qs[_0x6d6e('0x2e')](_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x2e')]));_0x21baf1[_0x6d6e('0x2d')]=_0x21baf1[_0x6d6e('0x2d')][_0x6d6e('0x3b')]?_0x21baf1[_0x6d6e('0x2d')]:_0x432054[_0x6d6e('0x28')];if(!_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x3c')](_0x6d6e('0x3d'))){_0x21baf1[_0x6d6e('0x10')]=qs[_0x6d6e('0x10')](_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x10')]);_0x21baf1[_0x6d6e('0x13')]=qs[_0x6d6e('0x13')](_0x20429b['query'][_0x6d6e('0x13')]);}_0x21baf1[_0x6d6e('0x3e')]=qs[_0x6d6e('0x3f')](_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x3f')]);_0x21baf1[_0x6d6e('0x40')]=qs[_0x6d6e('0x2b')](_[_0x6d6e('0x41')](_0x20429b['query'],_0x432054[_0x6d6e('0x2b')]));_0x21baf1[_0x6d6e('0x40')][_0x6d6e('0x42')]=_0x646643['id'];if(_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x43')]){_0x21baf1[_0x6d6e('0x40')]=_[_0x6d6e('0x30')](_0x21baf1['where'],{'$or':_[_0x6d6e('0x1e')](_0x21baf1[_0x6d6e('0x2d')],function(_0x25beba){var _0x294c6c={};_0x294c6c[_0x25beba]={'$like':'%'+_0x20429b[_0x6d6e('0x24')]['filter']+'%'};return _0x294c6c;})});}if(_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x44')]){var _0x546884=_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x44')]['split'](',');var _0x80886d={};_0x80886d[_0x546884[0x0]]={'$gte':moment(_0x546884[0x1])[_0x6d6e('0x45')](_0x6d6e('0x46'))};_0x21baf1[_0x6d6e('0x40')]=_[_0x6d6e('0x30')](_0x21baf1[_0x6d6e('0x40')],_0x80886d);}_0x21baf1=_['merge']({},_0x21baf1,_0x20429b['options']);return db[_0x6d6e('0x3a')]['count']({'where':_0x21baf1[_0x6d6e('0x40')]})[_0x6d6e('0x17')](function(_0x24ff74){_0x5c2e22[_0x6d6e('0x12')]=_0x24ff74;if(_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x2f')]){_0x21baf1['include']=[{'all':!![]}];}return db[_0x6d6e('0x3a')]['findAll'](_0x21baf1);})[_0x6d6e('0x17')](function(_0x4ba33d){_0x5c2e22[_0x6d6e('0x47')]=_0x4ba33d;return _0x5c2e22;});}})[_0x6d6e('0x17')](respondWithFilteredResult(_0x5e0667,_0x21baf1))[_0x6d6e('0x25')](handleError(_0x5e0667,null));};exports['addTags']=function(_0x382187,_0x4c9080){return db[_0x6d6e('0x2a')]['find']({'where':{'id':_0x382187['params']['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x4c9080,null))['then'](function(_0x555580){if(_0x555580){return _0x555580[_0x6d6e('0x48')](_0x382187[_0x6d6e('0x34')][_0x6d6e('0x38')],_['omit'](_0x382187[_0x6d6e('0x34')],[_0x6d6e('0x38'),'id'])||{})[_0x6d6e('0x49')](function(){return db[_0x6d6e('0x4a')][_0x6d6e('0x22')]({'attributes':['id',_0x6d6e('0x1c'),'color'],'where':{'id':_0x382187[_0x6d6e('0x34')][_0x6d6e('0x38')]}});})['then'](function(_0x5e2137){socket[_0x6d6e('0x4b')](_0x6d6e('0x4c'),{'id':Number(_0x382187['params']['id']),'tags':_0x5e2137||[]});return{'id':Number(_0x382187[_0x6d6e('0x27')]['id']),'tags':_0x5e2137||[]};});}})['then'](respondWithResult(_0x4c9080,null))['catch'](handleError(_0x4c9080,null));};exports[_0x6d6e('0x4d')]=function(_0x571406,_0x23afc7){return db[_0x6d6e('0x2a')]['find']({'where':{'id':_0x571406['params']['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x23afc7,null))[_0x6d6e('0x17')](function(_0xc52fed){if(_0xc52fed){return _0xc52fed[_0x6d6e('0x4d')](_0x571406['query']['ids']);}})[_0x6d6e('0x17')](respondWithStatusCode(_0x23afc7,null))[_0x6d6e('0x25')](handleError(_0x23afc7,null));};exports[_0x6d6e('0x4e')]=function(_0x5d6899,_0x3b2ac0){var _0x3086cf=moment()[_0x6d6e('0x4f')]()[_0x6d6e('0x50')]();var _0x264059=path[_0x6d6e('0x51')](config[_0x6d6e('0x52')],_0x6d6e('0x53'),_0x6d6e('0x54'),_0x6d6e('0x55'));var _0x1f4a26=path['join'](config[_0x6d6e('0x52')],_0x6d6e('0x53'),'files',_0x6d6e('0x56'));var _0x4371cb=path[_0x6d6e('0x51')](_0x264059,_0x3086cf);var _0x512cee=util[_0x6d6e('0x45')]('transcript-%d-%s.zip',_0x5d6899[_0x6d6e('0x27')]['id'],_0x3086cf);var _0x423583=path[_0x6d6e('0x51')](_0x264059,_0x512cee);var _0x3fb3a6=[];_0x3fb3a6['push']({'model':db[_0x6d6e('0x57')],'as':_0x6d6e('0x57'),'attributes':['id',_0x6d6e('0x58')],'raw':!![]});_0x3fb3a6[_0x6d6e('0x59')]({'model':db[_0x6d6e('0x5a')],'as':'Contact','attributes':['id',_0x6d6e('0x5b'),'lastName'],'raw':!![]});if(_0x5d6899[_0x6d6e('0x24')]['attachments']){_0x3fb3a6[_0x6d6e('0x59')]({'model':db[_0x6d6e('0x5c')],'as':_0x6d6e('0x5c'),'raw':!![]});}var _0x463172=[{'model':db[_0x6d6e('0x3a')],'as':'Messages','attributes':['id',_0x6d6e('0x34'),_0x6d6e('0x5d'),_0x6d6e('0x5e'),_0x6d6e('0x5f'),'read'],'include':_0x3fb3a6}];_0x463172['push']({'model':db[_0x6d6e('0x60')],'as':_0x6d6e('0x61'),'attributes':['id',_0x6d6e('0x1c')]});_0x463172[_0x6d6e('0x59')]({'model':db['User'],'as':_0x6d6e('0x62'),'attributes':['id','fullname']});return db[_0x6d6e('0x2a')][_0x6d6e('0x35')]({'where':{'id':_0x5d6899['params']['id']},'include':_0x463172})[_0x6d6e('0x17')](handleEntityNotFound(_0x3b2ac0,null))['then'](function(_0x310bdd){if(_0x310bdd){var _0x223e9f=_0x310bdd['get']({'plain':!![]});fs[_0x6d6e('0x63')](_0x4371cb);var _0x450a97={'channel':_0x6d6e('0x64'),'account':_0x223e9f[_0x6d6e('0x61')][_0x6d6e('0x1c')],'agent':_0x223e9f['Owner']?_0x223e9f[_0x6d6e('0x62')]['fullname']:_0x6d6e('0x65'),'createdAt':moment(_0x223e9f[_0x6d6e('0x5d')])[_0x6d6e('0x45')](_0x6d6e('0x46'))['toString'](),'closedAt':_0x223e9f[_0x6d6e('0x66')]?moment(_0x223e9f['closedAt'])['format'](_0x6d6e('0x46'))['toString']():'','disposition':_0x223e9f['disposition'],'visibility':_0x223e9f[_0x6d6e('0x67')]?_0x6d6e('0x68'):_0x6d6e('0x69'),'messages':_(_0x223e9f['Messages'])[_0x6d6e('0x43')]({'secret':![]})[_0x6d6e('0x1e')](function(_0x130904){if(_0x130904[_0x6d6e('0x5c')]){var _0x171b59=path['join'](_0x1f4a26,_0x130904['Attachment'][_0x6d6e('0x6a')]);if(fs[_0x6d6e('0x6b')](_0x171b59)){fs[_0x6d6e('0x6c')](_0x171b59)[_0x6d6e('0x6d')](fs[_0x6d6e('0x6e')](path[_0x6d6e('0x51')](_0x4371cb,_0x130904['Attachment'][_0x6d6e('0x6a')])));}}return{'date':moment(_0x130904[_0x6d6e('0x5d')])[_0x6d6e('0x45')](_0x6d6e('0x46'))[_0x6d6e('0x50')](),'sender':_0x130904[_0x6d6e('0x5e')]===_0x6d6e('0x6f')?_0x130904[_0x6d6e('0x57')]?_0x130904['User'][_0x6d6e('0x58')]:_0x6d6e('0x70'):_0x130904[_0x6d6e('0x71')][_0x6d6e('0x5b')]+(_0x130904[_0x6d6e('0x71')][_0x6d6e('0x72')]?'\x20'+_0x130904[_0x6d6e('0x71')]['lastName']:''),'body':_0x130904[_0x6d6e('0x5c')]?_0x130904[_0x6d6e('0x5c')]['basename']:_0x130904['body'],'direction':_0x130904[_0x6d6e('0x5e')]===_0x6d6e('0x6f')?'A':'C','secret':_0x130904['secret'],'read':_0x130904['read'],'attachment':_0x130904[_0x6d6e('0x5c')]};})['value']()};return ejs[_0x6d6e('0x73')](path[_0x6d6e('0x51')](config['root'],_0x6d6e('0x53'),_0x6d6e('0x74'),'downloadInteraction.ejs'),{'interaction':_0x450a97})['then'](function(_0x253014){var _0x4270b3=path[_0x6d6e('0x51')](_0x4371cb,'transcript-'+_0x223e9f['id']+'-'+_0x3086cf+_0x6d6e('0x75'));var _0x2c9dd8={'path':_0x4270b3,'channel':_0x6d6e('0x64'),'interactionId':_0x223e9f['id']};return pdf[_0x6d6e('0x76')](_0x253014,_0x2c9dd8);})[_0x6d6e('0x17')](function(){return new Promise(function(_0x3980b0,_0x37742c){zipdir(_0x4371cb,{'saveTo':_0x423583},function(_0x19a89e,_0x50109b){if(_0x19a89e)return _0x37742c(_0x19a89e);return _0x3980b0(_0x50109b);});})[_0x6d6e('0x17')](function(){return new Promise(function(_0x4ca912,_0xb316b8){rimraf(_0x4371cb,function(_0x55c0ef){if(_0x55c0ef)_0xb316b8(_0x55c0ef);return _0x4ca912();});});})[_0x6d6e('0x17')](function(){return _0x3b2ac0[_0x6d6e('0x4e')](_0x423583,_0x512cee,function(_0x2cf8e0){if(_0x2cf8e0){logger[_0x6d6e('0x1a')](_0x6d6e('0x77'),_0x2cf8e0);}else{fs[_0x6d6e('0x78')](_0x423583);}});});});}else{return _0x3b2ac0[_0x6d6e('0x19')](0xc8);}})[_0x6d6e('0x25')](handleError(_0x3b2ac0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 41132c5..51c4343 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 _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 +var _0x0a0a=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','getUsers','then'];(function(_0x145b54,_0x267c42){var _0x52007e=function(_0xfc9fdf){while(--_0xfc9fdf){_0x145b54['push'](_0x145b54['shift']());}};_0x52007e(++_0x267c42);}(_0x0a0a,0xbd));var _0xa0a0=function(_0x17cb3f,_0x1faa8f){_0x17cb3f=_0x17cb3f-0x0;var _0x235ba2=_0x0a0a[_0x17cb3f];return _0x235ba2;};'use strict';var EventEmitter=require(_0xa0a0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa0a0('0x1')];var OpenchannelMessage=require(_0xa0a0('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa0a0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0a0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x262cb0){return function(_0xd006b8,_0x592e24,_0xc7e8a7){_0xd006b8[_0xa0a0('0x5')]({'attributes':['id'],'raw':!![]})[_0xa0a0('0x6')](function(_0x1f52df){_0xd006b8[_0xa0a0('0x7')](_0xa0a0('0x8'),_0x1f52df[_0xa0a0('0x9')](function(_0x55607b){return{'id':_0x55607b['id']};}));return OpenchannelMessage[_0xa0a0('0xa')]({'where':{'OpenchannelInteractionId':_0xd006b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa0a0('0x6')](function(_0x2a33da){_0xd006b8['setDataValue'](_0xa0a0('0xb'),_0x2a33da['length']);OpenchannelInteractionEvents[_0xa0a0('0xc')](_0x262cb0+':'+_0xd006b8['id'],_0xd006b8);OpenchannelInteractionEvents[_0xa0a0('0xc')](_0x262cb0,_0xd006b8);_0xc7e8a7(null);})[_0xa0a0('0xd')](_0xc7e8a7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 90b39d0..493ccf9 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 _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 +var _0x2b87=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x5943ae,_0x35da2a){var _0x189dd9=function(_0x225b1e){while(--_0x225b1e){_0x5943ae['push'](_0x5943ae['shift']());}};_0x189dd9(++_0x35da2a);}(_0x2b87,0x72));var _0x72b8=function(_0x2cbbcb,_0x55ef2d){_0x2cbbcb=_0x2cbbcb-0x0;var _0x2e4d60=_0x2b87[_0x2cbbcb];return _0x2e4d60;};'use strict';var _=require(_0x72b8('0x0'));var util=require(_0x72b8('0x1'));var logger=require(_0x72b8('0x2'))(_0x72b8('0x3'));var moment=require('moment');var BPromise=require(_0x72b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x72b8('0x5'));var config=require(_0x72b8('0x6'));var attributes=require(_0x72b8('0x7'));module['exports']=function(_0x13e9d4,_0x366848){return _0x13e9d4[_0x72b8('0x8')](_0x72b8('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72b8('0xa'),'collate':_0x72b8('0xb'),'hooks':{'beforeUpdate':function(_0x1980d9,_0x4340f7,_0x5ffea0){if(_0x1980d9[_0x72b8('0xc')](_0x72b8('0xd'))){_0x1980d9['closedAt']=moment()[_0x72b8('0xe')](_0x72b8('0xf'));}_0x5ffea0(null,_0x1980d9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index cafc994..c91e5b4 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 _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 +var _0x0a08=['then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request'];(function(_0x4796ab,_0x4e78a4){var _0x8026b8=function(_0x43589d){while(--_0x43589d){_0x4796ab['push'](_0x4796ab['shift']());}};_0x8026b8(++_0x4e78a4);}(_0x0a08,0x6d));var _0x80a0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0a08[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x80a0('0x0'));var util=require(_0x80a0('0x1'));var moment=require(_0x80a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x80a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80a0('0x4'))['db'];var utils=require(_0x80a0('0x5'));var logger=require('../../config/logger')(_0x80a0('0x6'));var config=require(_0x80a0('0x7'));var jayson=require(_0x80a0('0x8'));var client=jayson[_0x80a0('0x9')][_0x80a0('0xa')]({'port':0x232a});config[_0x80a0('0xb')]=_['defaults'](config[_0x80a0('0xb')],{'host':_0x80a0('0xc'),'port':0x18eb});var socket=require(_0x80a0('0xd'))(new Redis(config[_0x80a0('0xb')]));require(_0x80a0('0xe'))[_0x80a0('0xf')](socket);function respondWithRpcPromise(_0x92f85e,_0x372e79,_0x53e365){return new BPromise(function(_0xba7789,_0x2eef15){return client[_0x80a0('0x10')](_0x92f85e,_0x53e365)[_0x80a0('0x11')](function(_0x5cb76c){logger[_0x80a0('0x12')](_0x80a0('0x13'),_0x372e79,'request\x20sent');logger[_0x80a0('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x372e79,_0x80a0('0x15'),JSON[_0x80a0('0x16')](_0x5cb76c));if(_0x5cb76c[_0x80a0('0x17')]){if(_0x5cb76c[_0x80a0('0x17')][_0x80a0('0x18')]===0x1f4){logger[_0x80a0('0x17')](_0x80a0('0x13'),_0x372e79,_0x5cb76c[_0x80a0('0x17')][_0x80a0('0x19')]);return _0x2eef15(_0x5cb76c['error'][_0x80a0('0x19')]);}logger[_0x80a0('0x17')](_0x80a0('0x13'),_0x372e79,_0x5cb76c['error'][_0x80a0('0x19')]);return _0xba7789(_0x5cb76c[_0x80a0('0x17')]['message']);}else{logger[_0x80a0('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x372e79,_0x80a0('0x15'));_0xba7789(_0x5cb76c[_0x80a0('0x1a')]['message']);}})[_0x80a0('0x1b')](function(_0x4d277a){logger[_0x80a0('0x17')](_0x80a0('0x13'),_0x372e79,_0x4d277a);_0x2eef15(_0x4d277a);});});}exports['UpdateOpenchannelInteraction']=function(_0x456b1a){var _0x382548=this;return new Promise(function(_0x398206,_0x2dcc01){return db[_0x80a0('0x1c')][_0x80a0('0x1d')](_0x456b1a[_0x80a0('0x1e')],{'raw':_0x456b1a['options']?_0x456b1a[_0x80a0('0x1f')][_0x80a0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456b1a[_0x80a0('0x1f')]?_0x456b1a[_0x80a0('0x1f')]['where']||null:null,'attributes':_0x456b1a[_0x80a0('0x1f')]?_0x456b1a['options'][_0x80a0('0x21')]||null:null,'limit':_0x456b1a['options']?_0x456b1a[_0x80a0('0x1f')][_0x80a0('0x22')]||null:null})[_0x80a0('0x11')](function(_0x3875a0){logger[_0x80a0('0x12')](_0x80a0('0x23'),_0x456b1a);logger[_0x80a0('0x14')]('UpdateOpenchannelInteraction',_0x456b1a,JSON['stringify'](_0x3875a0));_0x398206(_0x3875a0);})[_0x80a0('0x1b')](function(_0x44bae8){logger[_0x80a0('0x17')]('UpdateOpenchannelInteraction',_0x44bae8[_0x80a0('0x19')],_0x456b1a);_0x2dcc01(_0x382548['error'](0x1f4,_0x44bae8[_0x80a0('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x184551){return new Promise(function(_0x140576,_0x37e43d){return db[_0x80a0('0x1c')][_0x80a0('0x24')]({'where':_0x184551[_0x80a0('0x1f')]?_0x184551[_0x80a0('0x1f')][_0x80a0('0x25')]||null:null})['then'](function(_0x56bb2f){if(_0x56bb2f){return _0x56bb2f['addTags'](_0x184551[_0x80a0('0x1e')][_0x80a0('0x26')],_[_0x80a0('0x27')](_0x184551[_0x80a0('0x1e')],[_0x80a0('0x26'),'id'])||{});}})[_0x80a0('0x28')](function(_0x4eb112){logger[_0x80a0('0x12')](_0x80a0('0x29'),_0x184551);logger[_0x80a0('0x14')](_0x80a0('0x29'),_0x184551,JSON[_0x80a0('0x16')](_0x4eb112));_0x140576(_0x4eb112);})[_0x80a0('0x1b')](function(_0x6b046){logger[_0x80a0('0x17')](_0x80a0('0x29'),_0x6b046[_0x80a0('0x19')],_0x184551);_0x37e43d(_this[_0x80a0('0x17')](0x1f4,_0x6b046['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 96efe78..fc46e03 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 _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 +var _0xb6fb=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','update'];(function(_0x1a835a,_0x2a00a8){var _0x44e27b=function(_0x2d683c){while(--_0x2d683c){_0x1a835a['push'](_0x1a835a['shift']());}};_0x44e27b(++_0x2a00a8);}(_0xb6fb,0x17f));var _0xbb6f=function(_0x34d1e5,_0x209bed){_0x34d1e5=_0x34d1e5-0x0;var _0x3892a6=_0xb6fb[_0x34d1e5];return _0x3892a6;};'use strict';var OpenchannelInteractionEvents=require(_0xbb6f('0x0'));var events=['save','remove',_0xbb6f('0x1')];function createListener(_0x337def,_0xff8c6f){return function(_0xf71041){_0xff8c6f[_0xbb6f('0x2')](_0x337def,_0xf71041);};}function removeListener(_0x21de6d,_0x251503){return function(){OpenchannelInteractionEvents[_0xbb6f('0x3')](_0x21de6d,_0x251503);};}exports[_0xbb6f('0x4')]=function(_0x4ebf3c){for(var _0x330500=0x0,_0x31be2a=events[_0xbb6f('0x5')];_0x330500<_0x31be2a;_0x330500++){var _0x1933df=events[_0x330500];var _0x25f4cb=createListener(_0xbb6f('0x6')+_0x1933df,_0x4ebf3c);OpenchannelInteractionEvents['on'](_0x1933df,_0x25f4cb);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4bc5574..7432e70 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 _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 +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x3b8a26,_0x168cc4){var _0x31bafd=function(_0x3e8667){while(--_0x3e8667){_0x3b8a26['push'](_0x3b8a26['shift']());}};_0x31bafd(++_0x168cc4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0xcb91[_0x80f51a];return _0x327148;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a989679..9dcb467 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 _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 +var _0xaa5e=['DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x4e2ecb,_0x57ee22){var _0x1cada8=function(_0x1f7dd1){while(--_0x1f7dd1){_0x4e2ecb['push'](_0x4e2ecb['shift']());}};_0x1cada8(++_0x57ee22);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x2bd1f1,_0x191e68){_0x2bd1f1=_0x2bd1f1-0x0;var _0x2310da=_0xaa5e[_0x2bd1f1];return _0x2310da;};'use strict';var Sequelize=require(_0xeaa5('0x0'));module[_0xeaa5('0x1')]={'body':{'type':Sequelize['TEXT'](_0xeaa5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeaa5('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeaa5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeaa5('0x4')]('in',_0xeaa5('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xeaa5('0x6')]},'providerName':{'type':Sequelize[_0xeaa5('0x7')]},'providerResponse':{'type':Sequelize[_0xeaa5('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4292c6e..ce42810 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 _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 +var _0xab96=['model','query','attributes','fields','length','order','where','merge','VIRTUAL','filter','includeAll','include','rows','show','options','find','create','body','params','describe','accept','openchannel','acceptMessage','reject','UserId','user','get','OpenchannelInteraction','interaction','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','count','limit','set','Content-Range','update','destroy','status','end','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','map','keys','filters','intersection'];(function(_0xad70ab,_0x2461d2){var _0x4a7024=function(_0x9ebf55){while(--_0x9ebf55){_0xad70ab['push'](_0xad70ab['shift']());}};_0x4a7024(++_0x2461d2);}(_0xab96,0x95));var _0x6ab9=function(_0x1d3a4d,_0x7a4edb){_0x1d3a4d=_0x1d3a4d-0x0;var _0x122e3d=_0xab96[_0x1d3a4d];return _0x122e3d;};'use strict';var util=require(_0x6ab9('0x0'));var _=require(_0x6ab9('0x1'));var Redis=require('ioredis');var interactionService=require(_0x6ab9('0x2'));var qs=require(_0x6ab9('0x3'));var logger=require(_0x6ab9('0x4'))(_0x6ab9('0x5'));var config=require(_0x6ab9('0x6'));var db=require('../../mysqldb')['db'];config[_0x6ab9('0x7')]=_[_0x6ab9('0x8')](config[_0x6ab9('0x7')],{'host':_0x6ab9('0x9'),'port':0x18eb});var socket=require(_0x6ab9('0xa'))(new Redis(config[_0x6ab9('0x7')]));require(_0x6ab9('0xb'))[_0x6ab9('0xc')](socket);var jayson=require(_0x6ab9('0xd'));var client=jayson['client'][_0x6ab9('0xe')]({'port':0x232c});var client9002=jayson[_0x6ab9('0xf')]['http']({'port':0x232a});var interaction_log=require(_0x6ab9('0x4'))(_0x6ab9('0x10'));function respondWithRpcPromise(_0x30ebf0,_0x4231f6,_0x240179,_0x3eacca){return new Promise(function(_0x12c13a,_0x544ea8){var _0x5d75db=_0x3eacca||client;return _0x5d75db[_0x6ab9('0x11')](_0x30ebf0,_0x240179)[_0x6ab9('0x12')](function(_0x4a89c1){logger[_0x6ab9('0x13')](_0x6ab9('0x14'),_0x4231f6,_0x6ab9('0x15'));logger[_0x6ab9('0x16')](_0x6ab9('0x17'),_0x4231f6,_0x6ab9('0x15'),JSON[_0x6ab9('0x18')](_0x4a89c1));if(_0x4a89c1[_0x6ab9('0x19')]){if(_0x4a89c1['error'][_0x6ab9('0x1a')]===0x1f4){logger[_0x6ab9('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x4231f6,_0x4a89c1[_0x6ab9('0x19')]['message']);return _0x544ea8(_0x4a89c1[_0x6ab9('0x19')]['message']);}logger['error'](_0x6ab9('0x14'),_0x4231f6,_0x4a89c1['error'][_0x6ab9('0x1b')]);return _0x12c13a(_0x4a89c1['error'][_0x6ab9('0x1b')]);}else{logger[_0x6ab9('0x13')](_0x6ab9('0x14'),_0x4231f6,'request\x20sent');_0x12c13a(_0x4a89c1[_0x6ab9('0x1c')][_0x6ab9('0x1b')]);}})[_0x6ab9('0x1d')](function(_0x3e410a){logger['error'](_0x6ab9('0x14'),_0x4231f6,_0x3e410a);_0x544ea8(_0x3e410a);});});}function respondWithResult(_0x42b325,_0x43e323){_0x43e323=_0x43e323||0xc8;return function(_0x5bcb20){if(_0x5bcb20){return _0x42b325['status'](_0x43e323)[_0x6ab9('0x1e')](_0x5bcb20);}};}function respondWithFilteredResult(_0x162aa2,_0x3f539e){return function(_0x3ee982){if(_0x3ee982){var _0x552a45=typeof _0x3f539e[_0x6ab9('0x1f')]===_0x6ab9('0x20')&&typeof _0x3f539e['limit']===_0x6ab9('0x20');var _0x175a7a=_0x3ee982[_0x6ab9('0x21')];var _0x32f1c6=_0x552a45?0x0:_0x3f539e[_0x6ab9('0x1f')];var _0x739b70=_0x552a45?_0x3ee982['count']:_0x3f539e['offset']+_0x3f539e[_0x6ab9('0x22')];var _0xae0903;if(_0x739b70>=_0x175a7a){_0x739b70=_0x175a7a;_0xae0903=0xc8;}else{_0xae0903=0xce;}_0x162aa2['status'](_0xae0903);return _0x162aa2[_0x6ab9('0x23')](_0x6ab9('0x24'),_0x32f1c6+'-'+_0x739b70+'/'+_0x175a7a)['json'](_0x3ee982);}return null;};}function saveUpdates(_0x47470f){return function(_0x1594b4){if(_0x1594b4){return _0x1594b4[_0x6ab9('0x25')](_0x47470f)[_0x6ab9('0x12')](function(_0x520c8a){return _0x520c8a;});}return null;};}function removeEntity(_0x26dcc4){return function(_0x44388f){if(_0x44388f){return _0x44388f[_0x6ab9('0x26')]()['then'](function(){_0x26dcc4[_0x6ab9('0x27')](0xcc)[_0x6ab9('0x28')]();});}};}function handleEntityNotFound(_0x38fc4f){return function(_0x3a604c){if(!_0x3a604c){_0x38fc4f[_0x6ab9('0x29')](0x194);}return _0x3a604c;};}function handleError(_0x16b530,_0x52ed0a){_0x52ed0a=_0x52ed0a||0x1f4;return function(_0x9c52bf){logger['error'](_0x9c52bf[_0x6ab9('0x2a')]);if(_0x9c52bf[_0x6ab9('0x2b')]){delete _0x9c52bf[_0x6ab9('0x2b')];}_0x16b530[_0x6ab9('0x27')](_0x52ed0a)[_0x6ab9('0x2c')](_0x9c52bf);};}exports[_0x6ab9('0x2d')]=function(_0x69d534,_0x1182a0){var _0x2709d5={},_0x54ab23={},_0x515d0d={'count':0x0,'rows':[]};var _0x28cc74=_['map'](db[_0x6ab9('0x2e')][_0x6ab9('0x2f')],function(_0xd2b5dc){return{'name':_0xd2b5dc[_0x6ab9('0x30')],'type':_0xd2b5dc[_0x6ab9('0x31')][_0x6ab9('0x32')]};});_0x54ab23['model']=_[_0x6ab9('0x33')](_0x28cc74,_0x6ab9('0x2b'));_0x54ab23['query']=_[_0x6ab9('0x34')](_0x69d534['query']);_0x54ab23[_0x6ab9('0x35')]=_[_0x6ab9('0x36')](_0x54ab23[_0x6ab9('0x37')],_0x54ab23[_0x6ab9('0x38')]);_0x2709d5[_0x6ab9('0x39')]=_[_0x6ab9('0x36')](_0x54ab23[_0x6ab9('0x37')],qs[_0x6ab9('0x3a')](_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x3a')]));_0x2709d5[_0x6ab9('0x39')]=_0x2709d5[_0x6ab9('0x39')][_0x6ab9('0x3b')]?_0x2709d5[_0x6ab9('0x39')]:_0x54ab23[_0x6ab9('0x37')];if(!_0x69d534[_0x6ab9('0x38')]['hasOwnProperty']('nolimit')){_0x2709d5[_0x6ab9('0x22')]=qs[_0x6ab9('0x22')](_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x22')]);_0x2709d5[_0x6ab9('0x1f')]=qs[_0x6ab9('0x1f')](_0x69d534[_0x6ab9('0x38')]['offset']);}_0x2709d5[_0x6ab9('0x3c')]=qs['sort'](_0x69d534[_0x6ab9('0x38')]['sort']);_0x2709d5[_0x6ab9('0x3d')]=qs['filters'](_['pick'](_0x69d534[_0x6ab9('0x38')],_0x54ab23[_0x6ab9('0x35')]),_0x28cc74);if(_0x69d534[_0x6ab9('0x38')]['filter']){_0x2709d5['where']=_[_0x6ab9('0x3e')](_0x2709d5[_0x6ab9('0x3d')],{'$or':_[_0x6ab9('0x33')](_0x28cc74,function(_0x3627ab){if(_0x3627ab[_0x6ab9('0x31')]!==_0x6ab9('0x3f')){var _0xaf877e={};_0xaf877e[_0x3627ab[_0x6ab9('0x2b')]]={'$like':'%'+_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x40')]+'%'};return _0xaf877e;}})});}_0x2709d5=_[_0x6ab9('0x3e')]({},_0x2709d5,_0x69d534['options']);var _0x5d196e={'where':_0x2709d5['where']};return db[_0x6ab9('0x2e')][_0x6ab9('0x21')](_0x5d196e)['then'](function(_0x2c5173){_0x515d0d[_0x6ab9('0x21')]=_0x2c5173;if(_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x41')]){_0x2709d5[_0x6ab9('0x42')]=[{'all':!![]}];}return db[_0x6ab9('0x2e')]['findAll'](_0x2709d5);})[_0x6ab9('0x12')](function(_0x568e7d){_0x515d0d[_0x6ab9('0x43')]=_0x568e7d;return _0x515d0d;})['then'](respondWithFilteredResult(_0x1182a0,_0x2709d5))['catch'](handleError(_0x1182a0,null));};exports[_0x6ab9('0x44')]=function(_0x33bf58,_0xe12f65){var _0x18fbb5={'raw':!![],'where':{'id':_0x33bf58['params']['id']}},_0x46e4be={};_0x46e4be[_0x6ab9('0x37')]=_[_0x6ab9('0x34')](db[_0x6ab9('0x2e')][_0x6ab9('0x2f')]);_0x46e4be['query']=_[_0x6ab9('0x34')](_0x33bf58[_0x6ab9('0x38')]);_0x46e4be['filters']=_['intersection'](_0x46e4be['model'],_0x46e4be[_0x6ab9('0x38')]);_0x18fbb5[_0x6ab9('0x39')]=_[_0x6ab9('0x36')](_0x46e4be['model'],qs['fields'](_0x33bf58[_0x6ab9('0x38')][_0x6ab9('0x3a')]));_0x18fbb5[_0x6ab9('0x39')]=_0x18fbb5[_0x6ab9('0x39')][_0x6ab9('0x3b')]?_0x18fbb5[_0x6ab9('0x39')]:_0x46e4be[_0x6ab9('0x37')];if(_0x33bf58[_0x6ab9('0x38')][_0x6ab9('0x41')]){_0x18fbb5[_0x6ab9('0x42')]=[{'all':!![]}];}_0x18fbb5=_[_0x6ab9('0x3e')]({},_0x18fbb5,_0x33bf58[_0x6ab9('0x45')]);return db['OpenchannelMessage'][_0x6ab9('0x46')](_0x18fbb5)[_0x6ab9('0x12')](handleEntityNotFound(_0xe12f65,null))['then'](respondWithResult(_0xe12f65,null))[_0x6ab9('0x1d')](handleError(_0xe12f65,null));};exports[_0x6ab9('0x47')]=function(_0x2658de,_0x4e4122){return db['OpenchannelMessage'][_0x6ab9('0x47')](_0x2658de['body'],{})['then'](respondWithResult(_0x4e4122,0xc9))[_0x6ab9('0x1d')](handleError(_0x4e4122,null));};exports[_0x6ab9('0x25')]=function(_0x40109c,_0x112033){if(_0x40109c['body']['id']){delete _0x40109c[_0x6ab9('0x48')]['id'];}return db['OpenchannelMessage'][_0x6ab9('0x46')]({'where':{'id':_0x40109c[_0x6ab9('0x49')]['id']}})[_0x6ab9('0x12')](handleEntityNotFound(_0x112033,null))[_0x6ab9('0x12')](saveUpdates(_0x40109c[_0x6ab9('0x48')],null))[_0x6ab9('0x12')](respondWithResult(_0x112033,null))['catch'](handleError(_0x112033,null));};exports[_0x6ab9('0x26')]=function(_0x3df9ce,_0x310a7a){return db[_0x6ab9('0x2e')][_0x6ab9('0x46')]({'where':{'id':_0x3df9ce[_0x6ab9('0x49')]['id']}})['then'](handleEntityNotFound(_0x310a7a,null))[_0x6ab9('0x12')](removeEntity(_0x310a7a,null))[_0x6ab9('0x1d')](handleError(_0x310a7a,null));};exports['describe']=function(_0x53ee14,_0x5e351e){return db[_0x6ab9('0x2e')][_0x6ab9('0x4a')]()[_0x6ab9('0x12')](respondWithResult(_0x5e351e,null))[_0x6ab9('0x1d')](handleError(_0x5e351e,null));};exports[_0x6ab9('0x4b')]=function(_0x4abe82,_0x592112){var _0x3c3de1=_0x6ab9('0x4c');return interactionService[_0x6ab9('0x4d')](_0x4abe82,_0x3c3de1)[_0x6ab9('0x12')](respondWithResult(_0x592112,null))['catch'](handleError(_0x592112,null));};exports[_0x6ab9('0x4e')]=function(_0x22459e,_0x2fa64f){var _0x127c13={'agent':{},'channel':'openchannel'};if(_0x22459e[_0x6ab9('0x48')]['id']){delete _0x22459e['body']['id'];}_0x22459e[_0x6ab9('0x48')]['UserId']=_0x22459e[_0x6ab9('0x48')][_0x6ab9('0x4f')]||_0x22459e[_0x6ab9('0x50')]['id'];_0x127c13['agent']['id']=_0x22459e[_0x6ab9('0x48')]['UserId'];return db[_0x6ab9('0x2e')][_0x6ab9('0x46')]({'where':{'id':_0x22459e[_0x6ab9('0x49')]['id'],'UserId':null}})[_0x6ab9('0x12')](handleEntityNotFound(_0x2fa64f,null))[_0x6ab9('0x12')](function(_0x1ed483){if(_0x1ed483){_0x127c13['message']=_0x1ed483[_0x6ab9('0x51')]({'plain':!![]});return db[_0x6ab9('0x52')]['find']({'where':{'id':_0x1ed483['OpenchannelInteractionId']}});}return null;})[_0x6ab9('0x12')](handleEntityNotFound(_0x2fa64f,null))['then'](function(_0x591873){if(_0x591873){_0x127c13[_0x6ab9('0x53')]=_0x591873[_0x6ab9('0x51')]({'plain':!![]});interaction_log[_0x6ab9('0x13')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22459e[_0x6ab9('0x50')]['id'],_0x22459e[_0x6ab9('0x50')][_0x6ab9('0x2b')],_0x22459e[_0x6ab9('0x50')][_0x6ab9('0x54')],_0x127c13[_0x6ab9('0x53')]['id'],_0x22459e[_0x6ab9('0x48')]?JSON[_0x6ab9('0x18')](_0x22459e['body']):_0x6ab9('0x55'));return respondWithRpcPromise(_0x6ab9('0x56'),'rejectMessage',_0x127c13);}return null;})[_0x6ab9('0x12')](function(_0x373c17){var _0x530522=_0x6ab9('0x57')+_0x373c17[_0x6ab9('0x1b')][_0x6ab9('0x58')];return db[_0x6ab9('0x59')][_0x6ab9('0x38')](_0x530522,{'type':db['Sequelize'][_0x6ab9('0x5a')][_0x6ab9('0x5b')],'raw':!![]})['then'](function(_0x1c22f7){return _0x1c22f7;});})[_0x6ab9('0x12')](function(_0x2f2f31){if(_0x2f2f31){_0x127c13['message'][_0x6ab9('0x5c')]=_0x2f2f31[0x0];if(!_0x22459e[_0x6ab9('0x48')][_0x6ab9('0x4f')])return;return db[_0x6ab9('0x5d')][_0x6ab9('0x46')]({'where':{'id':_0x22459e[_0x6ab9('0x48')][_0x6ab9('0x4f')],'role':'agent'},'attributes':['id','name',_0x6ab9('0x5e'),_0x6ab9('0x5f'),_0x6ab9('0x60')],'raw':!![]});}return null;})[_0x6ab9('0x12')](function(_0x11fc96){if(!_0x11fc96)return null;_0x127c13[_0x6ab9('0x1b')]['agent']=_0x11fc96;return _0x127c13;})[_0x6ab9('0x12')](function(_0x371a45){if(_0x371a45){_0x371a45[_0x6ab9('0x1b')]['interface']=util['format'](_0x6ab9('0x61'),_0x22459e[_0x6ab9('0x50')]['name']);_0x371a45[_0x6ab9('0x1b')][_0x6ab9('0x62')]=_0x127c13[_0x6ab9('0x62')];_0x371a45[_0x6ab9('0x1b')][_0x6ab9('0x63')]=_0x127c13[_0x6ab9('0x62')];_0x371a45['message'][_0x6ab9('0x64')]=_0x6ab9('0x4e');respondWithRpcPromise(_0x6ab9('0x65'),'EventManager',{'event':'rejectmessage','message':_0x371a45[_0x6ab9('0x1b')]},client9002);return _0x127c13;}return null;})['then'](respondWithResult(_0x2fa64f,null))[_0x6ab9('0x1d')](handleError(_0x2fa64f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9d5a357..8b029cc 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 _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 +var _0xbf4a=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x56674a,_0x19b40a){var _0x364f52=function(_0x30f9b7){while(--_0x30f9b7){_0x56674a['push'](_0x56674a['shift']());}};_0x364f52(++_0x19b40a);}(_0xbf4a,0x125));var _0xabf4=function(_0x122da1,_0x158e84){_0x122da1=_0x122da1-0x0;var _0x273065=_0xbf4a[_0x122da1];return _0x273065;};'use strict';var EventEmitter=require(_0xabf4('0x0'));var OpenchannelMessage=require(_0xabf4('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xabf4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xabf4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18c603){return function(_0x5f764d,_0x1eb223,_0x3360c2){OpenchannelMessageEvents[_0xabf4('0x4')](_0x18c603+':'+_0x5f764d['id'],_0x5f764d);OpenchannelMessageEvents['emit'](_0x18c603,_0x5f764d);_0x3360c2(null);};}for(var e in events){if(events[_0xabf4('0x5')](e)){var event=events[e];OpenchannelMessage[_0xabf4('0x6')](e,emitEvent(event));}}module[_0xabf4('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8396a8f..5eab69e 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 _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 +var _0x5e8a=['isNil','UserId','OpenchannelInteraction','then','update','createdAt','CmContact','describe','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret'];(function(_0x48df17,_0x1f5087){var _0x207d77=function(_0x57ebd4){while(--_0x57ebd4){_0x48df17['push'](_0x48df17['shift']());}};_0x207d77(++_0x1f5087);}(_0x5e8a,0xb8));var _0xa5e8=function(_0x34eaf7,_0x1ff68a){_0x34eaf7=_0x34eaf7-0x0;var _0xb4694e=_0x5e8a[_0x34eaf7];return _0xb4694e;};'use strict';var _=require(_0xa5e8('0x0'));var util=require(_0xa5e8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa5e8('0x2'));var BPromise=require(_0xa5e8('0x3'));var rp=require(_0xa5e8('0x4'));var fs=require('fs');var path=require(_0xa5e8('0x5'));var rimraf=require(_0xa5e8('0x6'));var config=require(_0xa5e8('0x7'));var attributes=require(_0xa5e8('0x8'));module[_0xa5e8('0x9')]=function(_0x2e209a,_0x22f509){return _0x2e209a[_0xa5e8('0xa')](_0xa5e8('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xa5e8('0xc'),'fields':[_0xa5e8('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a9b95,_0x1d4662,_0x348c3e){var _0x56744d=_0x2e209a[_0xa5e8('0xe')];var _0x54036f=_0x3a9b95[_0xa5e8('0xf')]({'plain':!![]});if(_0x54036f[_0xa5e8('0x10')][_0xa5e8('0x11')]()==='in'||_0x54036f[_0xa5e8('0x10')]['toLowerCase']()===_0xa5e8('0x12')&&!_0x54036f[_0xa5e8('0x13')]&&!_[_0xa5e8('0x14')](_0x54036f[_0xa5e8('0x15')])){_0x56744d[_0xa5e8('0x16')]['findOne']({'where':{'id':_0x54036f['OpenchannelInteractionId']}})[_0xa5e8('0x17')](function(_0xcfb587){if(_0xcfb587){_0xcfb587[_0xa5e8('0x18')]({'lastMsgAt':_0x54036f[_0xa5e8('0x19')],'lastMsgDirection':_0x54036f['direction']['toLowerCase']()});}})['catch'](function(_0x18ad72){console['error'](_0x18ad72);});}if(_0x54036f[_0xa5e8('0x10')]==='out'&&!_0x54036f['secret']){var _0x139fe5;_0x56744d[_0xa5e8('0x1a')][_0xa5e8('0x1b')]()[_0xa5e8('0x17')](function(_0x1d1948){return _0x56744d[_0xa5e8('0x1c')][_0xa5e8('0x1d')]({'where':{'id':_0x54036f['OpenchannelAccountId']},'include':[{'model':_0x56744d[_0xa5e8('0x16')],'as':_0xa5e8('0x1e'),'where':{'id':_0x54036f[_0xa5e8('0x1f')]},'limit':0x1,'include':[{'model':_0x56744d[_0xa5e8('0x1a')],'as':_0xa5e8('0x20'),'attributes':_[_0xa5e8('0x21')](_0x1d1948)}]}]});})[_0xa5e8('0x17')](function(_0x24938a){_0x139fe5=_0x24938a[_0xa5e8('0xf')]({'plain':!![]});if(_0x139fe5&&_0x139fe5[_0xa5e8('0x22')]){logger[_0xa5e8('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xa5e8('0x24'),util[_0xa5e8('0x25')](_0xa5e8('0x26'),_0x54036f['id'],_0x139fe5[_0xa5e8('0x22')]));if(_0x139fe5[_0xa5e8('0x1e')]&&_0x139fe5[_0xa5e8('0x1e')][_0xa5e8('0x27')]){_0x54036f['Interaction']=_[_0xa5e8('0x28')](_0x139fe5[_0xa5e8('0x1e')][0x0],_0xa5e8('0x20'));_0x54036f[_0xa5e8('0x20')]=_0x139fe5[_0xa5e8('0x1e')][0x0][_0xa5e8('0x20')];}var _0x1d4662={'method':_0xa5e8('0x29'),'uri':encodeURI(_0x139fe5[_0xa5e8('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1d4662['method']){case _0xa5e8('0x2a'):_0x1d4662['qs']=_0x54036f;break;case _0xa5e8('0x29'):_0x1d4662['body']=_0x54036f;break;}return rp(_0x1d4662)[_0xa5e8('0x17')](function(_0x4ef0dd){logger['info'](_0xa5e8('0x2b'),_0xa5e8('0x24'),util['format'](_0xa5e8('0x2c'),_0x54036f['id'],_0x139fe5[_0xa5e8('0x22')]));if(_0x4ef0dd[_0xa5e8('0xd')][_0xa5e8('0x2d')]&&_0x4ef0dd['body']['threadId']!=_0x54036f[_0xa5e8('0x2e')][_0xa5e8('0x2d')]){return _0x56744d[_0xa5e8('0x16')]['update']({'threadId':_0x4ef0dd['body'][_0xa5e8('0x2d')]},{'where':{'id':_0x54036f[_0xa5e8('0x2e')]['id']}});}else{return;}})[_0xa5e8('0x17')](function(){return _0x3a9b95[_0xa5e8('0x18')]({'read':!![]});})[_0xa5e8('0x2f')](function(_0x472689){logger['error'](_0xa5e8('0x2b'),'afterCreate',util['inspect'](_0x472689,{'showHidden':![],'depth':null}));_0x348c3e();});}else{_0x348c3e();}})[_0xa5e8('0x30')](function(){_0x348c3e();});}else{_0x348c3e();}}},'charset':_0xa5e8('0x31'),'collate':_0xa5e8('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0ec242a..2aac989 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_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 +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x26ce19,_0x56cb79){var _0x3b923e=function(_0x54b832){while(--_0x54b832){_0x26ce19['push'](_0x26ce19['shift']());}};_0x3b923e(++_0x56cb79);}(_0xdb28,0x106));var _0x8db2=function(_0x3a19a2,_0x572699){_0x3a19a2=_0x3a19a2-0x0;var _0x433fec=_0xdb28[_0x3a19a2];return _0x433fec;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f185d19..d5d4ffd 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 _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 +var _0x477f=['register','openchannelMessage:','remove','update','emit','removeListener'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x477f,0x1dc));var _0xf477=function(_0x205135,_0x262f65){_0x205135=_0x205135-0x0;var _0x33090f=_0x477f[_0x205135];return _0x33090f;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0xf477('0x0'),_0xf477('0x1')];function createListener(_0x301f39,_0xed4ce9){return function(_0x32606e){_0xed4ce9[_0xf477('0x2')](_0x301f39,_0x32606e);};}function removeListener(_0x209f1b,_0x456382){return function(){OpenchannelMessageEvents[_0xf477('0x3')](_0x209f1b,_0x456382);};}exports[_0xf477('0x4')]=function(_0x124edc){for(var _0x4abc54=0x0,_0x345e47=events['length'];_0x4abc54<_0x345e47;_0x4abc54++){var _0x4d51ec=events[_0x4abc54];var _0x3948e0=createListener(_0xf477('0x5')+_0x4d51ec,_0x124edc);OpenchannelMessageEvents['on'](_0x4d51ec,_0x3948e0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 723726c..0c2bc24 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 _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 +var _0x9955=['destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','delete'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9955,0x72));var _0x5995=function(_0x31261f,_0x33b7c1){_0x31261f=_0x31261f-0x0;var _0x1fd785=_0x9955[_0x31261f];return _0x1fd785;};'use strict';var multer=require(_0x5995('0x0'));var util=require(_0x5995('0x1'));var path=require(_0x5995('0x2'));var timeout=require(_0x5995('0x3'));var express=require(_0x5995('0x4'));var router=express[_0x5995('0x5')]();var fs_extra=require(_0x5995('0x6'));var auth=require(_0x5995('0x7'));var interaction=require(_0x5995('0x8'));var config=require(_0x5995('0x9'));var controller=require(_0x5995('0xa'));router['get']('/',auth[_0x5995('0xb')](),controller[_0x5995('0xc')]);router[_0x5995('0xd')]('/describe',auth['isAuthenticated'](),controller[_0x5995('0xe')]);router[_0x5995('0xd')](_0x5995('0xf'),auth[_0x5995('0xb')](),controller['show']);router['get'](_0x5995('0x10'),auth[_0x5995('0xb')](),controller[_0x5995('0x11')]);router[_0x5995('0xd')](_0x5995('0x12'),auth[_0x5995('0xb')](),controller['getTeams']);router[_0x5995('0xd')](_0x5995('0x13'),auth['isAuthenticated'](),controller[_0x5995('0x14')]);router[_0x5995('0x15')]('/',auth[_0x5995('0xb')](),controller[_0x5995('0x16')]);router[_0x5995('0x15')](_0x5995('0x12'),auth['isAuthenticated'](),controller[_0x5995('0x17')]);router[_0x5995('0x15')](_0x5995('0x13'),auth[_0x5995('0xb')](),controller['addAgents']);router[_0x5995('0x18')]('/:id',auth[_0x5995('0xb')](),controller['update']);router[_0x5995('0x19')](_0x5995('0xf'),auth[_0x5995('0xb')](),controller[_0x5995('0x1a')]);router[_0x5995('0x19')]('/:id/teams',auth[_0x5995('0xb')](),controller[_0x5995('0x1b')]);router[_0x5995('0x19')](_0x5995('0x13'),auth[_0x5995('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ea34233..a13ccdc 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 _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 +var _0xa78e=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x22e34e,_0x598a1d){var _0x411e59=function(_0x63f722){while(--_0x63f722){_0x22e34e['push'](_0x22e34e['shift']());}};_0x411e59(++_0x598a1d);}(_0xa78e,0xa5));var _0xea78=function(_0x1a888d,_0x2a0331){_0x1a888d=_0x1a888d-0x0;var _0x2b445c=_0xa78e[_0x1a888d];return _0x2b445c;};'use strict';var Sequelize=require(_0xea78('0x0'));module[_0xea78('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea78('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea78('0x3')]},'timeout':{'type':Sequelize[_0xea78('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xea78('0x5'),_0xea78('0x6'),_0xea78('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9f0c77e..05ffe71 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 _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 +var _0xd3ed=['isArray','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','status','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','include','query','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','sort','where','pick','OpenchannelQueueId','filter','findAll','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','order','getTeams','hasOwnProperty','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save'];(function(_0x5f36fe,_0x2ddbd2){var _0x327468=function(_0xc061b6){while(--_0xc061b6){_0x5f36fe['push'](_0x5f36fe['shift']());}};_0x327468(++_0x2ddbd2);}(_0xd3ed,0xfd));var _0xdd3e=function(_0x12b8a2,_0x1feb50){_0x12b8a2=_0x12b8a2-0x0;var _0x31ffb2=_0xd3ed[_0x12b8a2];return _0x31ffb2;};'use strict';var BPromise=require(_0xdd3e('0x0'));var util=require(_0xdd3e('0x1'));var _=require(_0xdd3e('0x2'));var squel=require(_0xdd3e('0x3'));var Redis=require(_0xdd3e('0x4'));var qs=require(_0xdd3e('0x5'));var logger=require(_0xdd3e('0x6'))(_0xdd3e('0x7'));var config=require(_0xdd3e('0x8'));var db=require(_0xdd3e('0x9'))['db'];config['redis']=_[_0xdd3e('0xa')](config[_0xdd3e('0xb')],{'host':_0xdd3e('0xc'),'port':0x18eb});var socket=require(_0xdd3e('0xd'))(new Redis(config[_0xdd3e('0xb')]));require(_0xdd3e('0xe'))['register'](socket);function respondWithStatusCode(_0x4f7299,_0xdf5301){_0xdf5301=_0xdf5301||0xcc;return function(_0x5350fe){if(_0x5350fe){return _0x4f7299['sendStatus'](_0xdf5301);}return _0x4f7299['status'](_0xdf5301)[_0xdd3e('0xf')]();};}function respondWithResult(_0xd9dcab,_0x56efe0){_0x56efe0=_0x56efe0||0xc8;return function(_0x4d8ec3){if(_0x4d8ec3){return _0xd9dcab['status'](_0x56efe0)[_0xdd3e('0x10')](_0x4d8ec3);}};}function respondWithFilteredResult(_0x2fca1c,_0x45ec27){return function(_0x424ff0){if(_0x424ff0){var _0x186de2=typeof _0x45ec27[_0xdd3e('0x11')]===_0xdd3e('0x12')&&typeof _0x45ec27[_0xdd3e('0x13')]===_0xdd3e('0x12');var _0x39e2ff=_0x424ff0[_0xdd3e('0x14')];var _0x43f422=_0x186de2?0x0:_0x45ec27[_0xdd3e('0x11')];var _0x44a706=_0x186de2?_0x424ff0[_0xdd3e('0x14')]:_0x45ec27[_0xdd3e('0x11')]+_0x45ec27[_0xdd3e('0x13')];var _0x250180;if(_0x44a706>=_0x39e2ff){_0x44a706=_0x39e2ff;_0x250180=0xc8;}else{_0x250180=0xce;}_0x2fca1c['status'](_0x250180);return _0x2fca1c[_0xdd3e('0x15')](_0xdd3e('0x16'),_0x43f422+'-'+_0x44a706+'/'+_0x39e2ff)[_0xdd3e('0x10')](_0x424ff0);}return null;};}function saveUpdates(_0x15417f){return function(_0x27debc){if(_0x27debc){return _0x27debc[_0xdd3e('0x17')](_0x15417f)[_0xdd3e('0x18')](function(_0xca42ac){return _0xca42ac;});}return null;};}function removeEntity(_0x67ce5a){return function(_0x1448fd){if(_0x1448fd){return _0x1448fd[_0xdd3e('0x19')]()[_0xdd3e('0x18')](function(){var _0x3dc59f=_0x1448fd[_0xdd3e('0x1a')]({'plain':!![]});var _0x32195b='OpenchannelQueues';return db[_0xdd3e('0x1b')][_0xdd3e('0x19')]({'where':{'type':_0x32195b,'resourceId':_0x3dc59f['id']}})[_0xdd3e('0x18')](function(){return _0x1448fd;});})[_0xdd3e('0x18')](function(){_0x67ce5a[_0xdd3e('0x1c')](0xcc)[_0xdd3e('0xf')]();});}};}function handleEntityNotFound(_0x493fbd){return function(_0x13f7dd){if(!_0x13f7dd){_0x493fbd[_0xdd3e('0x1d')](0x194);}return _0x13f7dd;};}function handleError(_0x5b9286,_0x86e8d3){_0x86e8d3=_0x86e8d3||0x1f4;return function(_0x3eb17c){logger[_0xdd3e('0x1e')](_0x3eb17c[_0xdd3e('0x1f')]);if(_0x3eb17c[_0xdd3e('0x20')]){delete _0x3eb17c[_0xdd3e('0x20')];}_0x5b9286[_0xdd3e('0x1c')](_0x86e8d3)[_0xdd3e('0x21')](_0x3eb17c);};}exports[_0xdd3e('0x22')]=function(_0x3a9f42,_0x4844f9){var _0xb91f7d={};var _0x3ffbc3={'count':0x0,'rows':[]};var _0x4efa58=_[_0xdd3e('0x23')](db[_0xdd3e('0x24')][_0xdd3e('0x25')],function(_0x575299){return{'name':_0x575299[_0xdd3e('0x26')],'type':_0x575299[_0xdd3e('0x27')]['key']};});_0xb91f7d=qs[_0xdd3e('0x28')](_0x4efa58,_0x3a9f42);var _0x130365={'where':_0xb91f7d['where']};return db[_0xdd3e('0x24')][_0xdd3e('0x14')](_0x130365)['then'](function(_0xa3beec){_0x3ffbc3[_0xdd3e('0x14')]=_0xa3beec;_0xb91f7d[_0xdd3e('0x29')]=qs[_0xdd3e('0x29')](_0x3a9f42[_0xdd3e('0x2a')]);return db[_0xdd3e('0x24')]['findAll'](_0xb91f7d);})[_0xdd3e('0x18')](function(_0x102e5a){_0x3ffbc3['rows']=_0x102e5a;return _0x3ffbc3;})[_0xdd3e('0x18')](respondWithFilteredResult(_0x4844f9,_0xb91f7d))[_0xdd3e('0x2b')](handleError(_0x4844f9,null));};exports['show']=function(_0x2b5c2c,_0x242529){var _0x8374fb={'raw':!![],'where':{'id':_0x2b5c2c[_0xdd3e('0x2c')]['id']}},_0x28bcaf={};_0x28bcaf[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db['OpenchannelQueue'][_0xdd3e('0x25')]);_0x28bcaf[_0xdd3e('0x2a')]=_[_0xdd3e('0x2e')](_0x2b5c2c[_0xdd3e('0x2a')]);_0x28bcaf[_0xdd3e('0x2f')]=_[_0xdd3e('0x30')](_0x28bcaf[_0xdd3e('0x2d')],_0x28bcaf['query']);_0x8374fb[_0xdd3e('0x31')]=_[_0xdd3e('0x30')](_0x28bcaf['model'],qs[_0xdd3e('0x32')](_0x2b5c2c[_0xdd3e('0x2a')][_0xdd3e('0x32')]));_0x8374fb[_0xdd3e('0x31')]=_0x8374fb['attributes'][_0xdd3e('0x33')]?_0x8374fb[_0xdd3e('0x31')]:_0x28bcaf[_0xdd3e('0x2d')];if(_0x2b5c2c[_0xdd3e('0x2a')][_0xdd3e('0x34')]){_0x8374fb[_0xdd3e('0x29')]=[{'all':!![]}];}_0x8374fb=_[_0xdd3e('0x35')]({},_0x8374fb,_0x2b5c2c[_0xdd3e('0x36')]);return db[_0xdd3e('0x24')]['find'](_0x8374fb)['then'](handleEntityNotFound(_0x242529,null))['then'](respondWithResult(_0x242529,null))[_0xdd3e('0x2b')](handleError(_0x242529,null));};exports[_0xdd3e('0x37')]=function(_0x1c1acc,_0x5225db){return db['OpenchannelQueue'][_0xdd3e('0x37')](_0x1c1acc['body'],{})[_0xdd3e('0x18')](function(_0x5492eb){var _0x13c811=_0x1c1acc[_0xdd3e('0x38')][_0xdd3e('0x1a')]({'plain':!![]});if(!_0x13c811)throw new Error(_0xdd3e('0x39'));if(_0x13c811[_0xdd3e('0x3a')]===_0xdd3e('0x38')){var _0x14f413=_0x5492eb['get']({'plain':!![]});var _0x1f1ae1=_0xdd3e('0x3b');return db[_0xdd3e('0x3c')][_0xdd3e('0x3d')]({'where':{'name':_0x1f1ae1,'userProfileId':_0x13c811[_0xdd3e('0x3e')]},'raw':!![]})['then'](function(_0x144d91){if(_0x144d91&&_0x144d91[_0xdd3e('0x3f')]===0x0){return db[_0xdd3e('0x1b')][_0xdd3e('0x37')]({'name':_0x14f413['name'],'resourceId':_0x14f413['id'],'type':_0x144d91['name'],'sectionId':_0x144d91['id']},{})[_0xdd3e('0x18')](function(){return _0x5492eb;});}else{return _0x5492eb;}})[_0xdd3e('0x2b')](function(_0x34a4df){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34a4df);throw _0x34a4df;});}return _0x5492eb;})[_0xdd3e('0x18')](respondWithResult(_0x5225db,0xc9))[_0xdd3e('0x2b')](handleError(_0x5225db,null));};exports[_0xdd3e('0x17')]=function(_0x11ab77,_0x5a3f2e){if(_0x11ab77[_0xdd3e('0x40')]['id']){delete _0x11ab77[_0xdd3e('0x40')]['id'];}return db[_0xdd3e('0x24')][_0xdd3e('0x3d')]({'where':{'id':_0x11ab77[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x5a3f2e,null))[_0xdd3e('0x18')](saveUpdates(_0x11ab77[_0xdd3e('0x40')],null))['then'](respondWithResult(_0x5a3f2e,null))[_0xdd3e('0x2b')](handleError(_0x5a3f2e,null));};exports['destroy']=function(_0x3076bd,_0x41802e){return db[_0xdd3e('0x24')]['find']({'where':{'id':_0x3076bd['params']['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x41802e,null))[_0xdd3e('0x18')](removeEntity(_0x41802e,null))['catch'](handleError(_0x41802e,null));};exports['describe']=function(_0x3e1d99,_0x58a395){return db[_0xdd3e('0x24')][_0xdd3e('0x41')]()[_0xdd3e('0x18')](respondWithResult(_0x58a395,null))['catch'](handleError(_0x58a395,null));};exports[_0xdd3e('0x42')]=function(_0xfde8a6,_0x2642be){var _0x4c8243={'raw':!![],'where':{}},_0x1b097c={},_0x35694f;return db[_0xdd3e('0x24')][_0xdd3e('0x43')]({'where':{'id':_0xfde8a6['params']['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x2642be,null))[_0xdd3e('0x18')](function(_0x33f0c0){if(_0x33f0c0){_0x35694f=_0x33f0c0[_0xdd3e('0x1a')]({'plain':!![]});_0x1b097c[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db[_0xdd3e('0x44')][_0xdd3e('0x25')]);_0x1b097c[_0xdd3e('0x2a')]=_[_0xdd3e('0x2e')](_0xfde8a6['query']);_0x1b097c[_0xdd3e('0x2f')]=_[_0xdd3e('0x30')](_0x1b097c['model'],_0x1b097c[_0xdd3e('0x2a')]);_0x4c8243['attributes']=_[_0xdd3e('0x30')](_0x1b097c[_0xdd3e('0x2d')],qs[_0xdd3e('0x32')](_0xfde8a6[_0xdd3e('0x2a')]['fields']));_0x4c8243[_0xdd3e('0x31')]=_0x4c8243[_0xdd3e('0x31')][_0xdd3e('0x33')]?_0x4c8243[_0xdd3e('0x31')]:_0x1b097c['model'];if(!_0xfde8a6['query']['hasOwnProperty'](_0xdd3e('0x45'))){_0x4c8243[_0xdd3e('0x13')]=qs[_0xdd3e('0x13')](_0xfde8a6['query'][_0xdd3e('0x13')]);_0x4c8243[_0xdd3e('0x11')]=qs[_0xdd3e('0x11')](_0xfde8a6['query'][_0xdd3e('0x11')]);}_0x4c8243['order']=qs['sort'](_0xfde8a6['query'][_0xdd3e('0x46')]);_0x4c8243[_0xdd3e('0x47')]=qs['filters'](_[_0xdd3e('0x48')](_0xfde8a6[_0xdd3e('0x2a')],_0x1b097c[_0xdd3e('0x2f')]));_0x4c8243[_0xdd3e('0x47')][_0xdd3e('0x49')]=_0x33f0c0['id'];if(_0xfde8a6['query'][_0xdd3e('0x4a')]){_0x4c8243[_0xdd3e('0x47')]=_[_0xdd3e('0x35')](_0x4c8243['where'],{'$or':_[_0xdd3e('0x23')](_0x4c8243[_0xdd3e('0x31')],function(_0x3dd7e4){var _0x4cdd39={};_0x4cdd39[_0x3dd7e4]={'$like':'%'+_0xfde8a6['query']['filter']+'%'};return _0x4cdd39;})});}_0x4c8243=_[_0xdd3e('0x35')]({},_0x4c8243,_0xfde8a6[_0xdd3e('0x36')]);return db['UserOpenchannelQueue'][_0xdd3e('0x4b')](_0x4c8243);}})[_0xdd3e('0x18')](function(_0x3a6d2f){if(_0x3a6d2f){return db['User'][_0xdd3e('0x4c')]({'where':{'id':_['map'](_0x3a6d2f,'UserId'),'role':_0xdd3e('0x4d')},'attributes':['id',_0xdd3e('0x20'),_0xdd3e('0x4e'),_0xdd3e('0x4f'),_0xdd3e('0x50')]});}})[_0xdd3e('0x18')](function(_0x21ee3c){if(_0x21ee3c){return{'count':_0x21ee3c[_0xdd3e('0x14')],'rows':_[_0xdd3e('0x23')](_0x21ee3c[_0xdd3e('0x51')],function(_0x4e4624){return{'membername':_0x4e4624['name'],'UserId':_0x4e4624['id'],'queue_name':_0x35694f[_0xdd3e('0x20')],'OpenchannelQueueId':_0x35694f['id'],'interface':util[_0xdd3e('0x52')](_0xdd3e('0x53'),_0xdd3e('0x54'),_0x4e4624[_0xdd3e('0x20')]),'penalty':0x0,'paused':_0x4e4624[_0xdd3e('0x4e')],'createdAt':_0x4e4624[_0xdd3e('0x50')],'updatedAt':_0x4e4624[_0xdd3e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdd3e('0x18')](respondWithFilteredResult(_0x2642be,_0x4c8243))[_0xdd3e('0x2b')](handleError(_0x2642be,null));};exports['getTeams']=function(_0x1f10c7,_0x18ce4f){var _0x2620c6={};var _0x5b8177={};var _0x1e4169;var _0x37a0ef;return db[_0xdd3e('0x24')][_0xdd3e('0x43')]({'where':{'id':_0x1f10c7['params']['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x18ce4f,null))[_0xdd3e('0x18')](function(_0x1d0cdf){if(_0x1d0cdf){_0x1e4169=_0x1d0cdf;_0x5b8177[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db['Team'][_0xdd3e('0x25')]);_0x5b8177[_0xdd3e('0x2a')]=_['keys'](_0x1f10c7[_0xdd3e('0x2a')]);_0x5b8177[_0xdd3e('0x2f')]=_['intersection'](_0x5b8177[_0xdd3e('0x2d')],_0x5b8177[_0xdd3e('0x2a')]);_0x2620c6[_0xdd3e('0x31')]=_['intersection'](_0x5b8177[_0xdd3e('0x2d')],qs[_0xdd3e('0x32')](_0x1f10c7[_0xdd3e('0x2a')][_0xdd3e('0x32')]));_0x2620c6['attributes']=_0x2620c6[_0xdd3e('0x31')][_0xdd3e('0x33')]?_0x2620c6[_0xdd3e('0x31')]:_0x5b8177[_0xdd3e('0x2d')];_0x2620c6[_0xdd3e('0x55')]=qs[_0xdd3e('0x46')](_0x1f10c7[_0xdd3e('0x2a')]['sort']);_0x2620c6['where']=qs[_0xdd3e('0x2f')](_[_0xdd3e('0x48')](_0x1f10c7[_0xdd3e('0x2a')],_0x5b8177[_0xdd3e('0x2f')]));if(_0x1f10c7[_0xdd3e('0x2a')]['filter']){_0x2620c6[_0xdd3e('0x47')]=_[_0xdd3e('0x35')](_0x2620c6['where'],{'$or':_[_0xdd3e('0x23')](_0x2620c6[_0xdd3e('0x31')],function(_0x5f30c2){var _0x16738a={};_0x16738a[_0x5f30c2]={'$like':'%'+_0x1f10c7[_0xdd3e('0x2a')]['filter']+'%'};return _0x16738a;})});}_0x2620c6=_[_0xdd3e('0x35')]({},_0x2620c6,_0x1f10c7[_0xdd3e('0x36')]);return _0x1e4169[_0xdd3e('0x56')](_0x2620c6);}})['then'](function(_0x1bfb94){if(_0x1bfb94){_0x37a0ef=_0x1bfb94[_0xdd3e('0x33')];if(!_0x1f10c7[_0xdd3e('0x2a')][_0xdd3e('0x57')]('nolimit')){_0x2620c6['limit']=qs[_0xdd3e('0x13')](_0x1f10c7[_0xdd3e('0x2a')][_0xdd3e('0x13')]);_0x2620c6['offset']=qs['offset'](_0x1f10c7[_0xdd3e('0x2a')]['offset']);}return _0x1e4169['getTeams'](_0x2620c6);}})[_0xdd3e('0x18')](function(_0x225b6d){if(_0x225b6d){return _0x225b6d?{'count':_0x37a0ef,'rows':_0x225b6d}:null;}})[_0xdd3e('0x18')](respondWithResult(_0x18ce4f,null))[_0xdd3e('0x2b')](handleError(_0x18ce4f,null));};exports['addTeams']=function(_0x145c27,_0x4d3d95){var _0xec2403=_0x145c27[_0xdd3e('0x40')][_0xdd3e('0x58')];return db[_0xdd3e('0x59')][_0xdd3e('0x4b')]({'where':{'id':_0xec2403},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdd3e('0x5a'),'attributes':['id',_0xdd3e('0x20'),_0xdd3e('0x5b'),_0xdd3e('0x5c'),'interface'],'raw':!![]}]})[_0xdd3e('0x18')](function(_0x202a51){if(_0x202a51){var _0x32b41b=_[_0xdd3e('0x5d')](_0x202a51,function(_0x24d0dd){var _0x3c5e13=_0x24d0dd[_0xdd3e('0x1a')]({'plain':!![]});return _0x3c5e13['Agents'];});return db[_0xdd3e('0x24')][_0xdd3e('0x3d')]({'where':{'id':_0x145c27[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](function(_0x49732f){return db[_0xdd3e('0x5e')][_0xdd3e('0x5f')](function(_0x4ad368){return _0x49732f['addTeams'](_0xec2403,{'transaction':_0x4ad368})[_0xdd3e('0x18')](function(){return BPromise[_0xdd3e('0x60')](_0x32b41b,function(_0x348de3){return db[_0xdd3e('0x44')][_0xdd3e('0x61')]({'where':{'UserId':_0x348de3['id'],'OpenchannelQueueId':_0x145c27[_0xdd3e('0x2c')]['id']},'transaction':_0x4ad368});});})['then'](function(){_0x32b41b[_0xdd3e('0x62')](function(_0x537f24){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x537f24['id'],'OpenchannelQueueId':_0x49732f['id']});});});});});}})[_0xdd3e('0x18')](respondWithStatusCode(_0x4d3d95,null))[_0xdd3e('0x2b')](handleError(_0x4d3d95,null));};exports[_0xdd3e('0x63')]=function(_0x6ddf78,_0x16a349){return db['Team']['findAll']({'where':{'id':_0x6ddf78['query'][_0xdd3e('0x58')]},'attributes':['id'],'include':[{'model':db[_0xdd3e('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16a349,null))['then'](function(_0x917d46){var _0x3b93b6=_[_0xdd3e('0x23')](_0x917d46,'id');var _0x28636a=[];var _0x458d3e=[];var _0x16fec6=squel[_0xdd3e('0x65')]();_0x16fec6[_0xdd3e('0x66')](_0xdd3e('0x67'))['from'](_0xdd3e('0x68'),'tq')['join']('user_has_teams','ut',_0xdd3e('0x69'))[_0xdd3e('0x47')]('OpenchannelQueueId\x20=\x20?',_0x6ddf78[_0xdd3e('0x2c')]['id']);for(var _0x54dc3c=0x0;_0x54dc3c<_0x917d46['length'];_0x54dc3c+=0x1){let _0x1a7f5c=_0x917d46[_0x54dc3c];for(var _0xa66042=0x0;_0xa66042<_0x1a7f5c[_0xdd3e('0x5a')][_0xdd3e('0x33')];_0xa66042+=0x1){let _0x4e68e6=_0x1a7f5c[_0xdd3e('0x5a')][_0xa66042];var _0x5dc66c=_0x16fec6['clone']();_0x5dc66c['where']('ut.UserId\x20=\x20?',_0x4e68e6['id']);_0x458d3e[_0xdd3e('0x6a')](db[_0xdd3e('0x5e')][_0xdd3e('0x2a')](_0x5dc66c[_0xdd3e('0x6b')](),{'type':db[_0xdd3e('0x5e')][_0xdd3e('0x6c')][_0xdd3e('0x6d')]})[_0xdd3e('0x18')](function(_0x478665){if(_0x478665['length']===0x1){return _0x4e68e6['id'];}else{var _0x275905=_[_0xdd3e('0x6e')](_[_0xdd3e('0x23')](_0x478665,_0xdd3e('0x6f')),function(_0x4fbbf9){return _[_0xdd3e('0x70')](_0x3b93b6,_0x4fbbf9);});if(_0x275905){return _0x4e68e6['id'];}}}));}}return BPromise[_0xdd3e('0x71')](_0x458d3e)[_0xdd3e('0x18')](function(_0x1b6e0c){_0x28636a=_(_0x28636a)[_0xdd3e('0x72')](_0x1b6e0c)[_0xdd3e('0x73')]()[_0xdd3e('0x74')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x6ddf78[_0xdd3e('0x2c')]['id']}})['then'](function(_0x559f4d){return db[_0xdd3e('0x5e')][_0xdd3e('0x5f')](function(_0x3b5c55){return _0x559f4d[_0xdd3e('0x63')](_0x6ddf78[_0xdd3e('0x2a')][_0xdd3e('0x58')],{'transaction':_0x3b5c55})[_0xdd3e('0x18')](function(){if(!_[_0xdd3e('0x75')](_0x28636a)){return _0x559f4d[_0xdd3e('0x76')](_0x28636a,{'transaction':_0x3b5c55});}})[_0xdd3e('0x18')](function(){_0x28636a[_0xdd3e('0x62')](function(_0x5dd526){socket[_0xdd3e('0x77')](_0xdd3e('0x78'),{'UserId':_0x5dd526,'OpenchannelQueueId':_0x559f4d['id']});});});});});});})['then'](respondWithStatusCode(_0x16a349,null))['catch'](handleError(_0x16a349,null));};exports['addAgents']=function(_0x2ebd62,_0x165317){return db[_0xdd3e('0x24')][_0xdd3e('0x3d')]({'where':{'id':_0x2ebd62[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x165317,null))[_0xdd3e('0x18')](function(_0x575e18){if(_0x575e18){return _0x575e18[_0xdd3e('0x79')](_0x2ebd62[_0xdd3e('0x40')][_0xdd3e('0x58')],_[_0xdd3e('0x7a')](_0x2ebd62[_0xdd3e('0x40')],['ids','id'])||{})[_0xdd3e('0x7b')](function(_0x539208){for(var _0x22839b=0x0;_0x22839b<_0x2ebd62['body'][_0xdd3e('0x58')]['length'];_0x22839b+=0x1){socket[_0xdd3e('0x77')](_0xdd3e('0x7c'),{'UserId':Number(_0x2ebd62[_0xdd3e('0x40')][_0xdd3e('0x58')][_0x22839b]),'OpenchannelQueueId':Number(_0x2ebd62['params']['id'])});}return _0x539208;});}})[_0xdd3e('0x18')](respondWithResult(_0x165317,null))[_0xdd3e('0x2b')](handleError(_0x165317,null));};exports[_0xdd3e('0x76')]=function(_0x5bd357,_0x296cac){return db[_0xdd3e('0x24')]['find']({'where':{'id':_0x5bd357['params']['id']}})['then'](handleEntityNotFound(_0x296cac,null))[_0xdd3e('0x18')](function(_0x1e4937){if(_0x1e4937){return _0x1e4937[_0xdd3e('0x76')](_0x5bd357[_0xdd3e('0x2a')][_0xdd3e('0x58')])[_0xdd3e('0x18')](function(){if(_[_0xdd3e('0x7d')](_0x5bd357[_0xdd3e('0x2a')][_0xdd3e('0x58')])){for(var _0x37eb9a=0x0;_0x37eb9a<_0x5bd357['query'][_0xdd3e('0x58')][_0xdd3e('0x33')];_0x37eb9a+=0x1){socket[_0xdd3e('0x77')](_0xdd3e('0x78'),{'UserId':Number(_0x5bd357['query']['ids'][_0x37eb9a]),'OpenchannelQueueId':Number(_0x5bd357['params']['id'])});}}else{socket[_0xdd3e('0x77')](_0xdd3e('0x78'),{'UserId':Number(_0x5bd357[_0xdd3e('0x2a')][_0xdd3e('0x58')]),'OpenchannelQueueId':Number(_0x5bd357[_0xdd3e('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x296cac,null))['catch'](handleError(_0x296cac,null));};exports['getAgents']=function(_0x469a62,_0x312b7b){var _0x5b6af8={};var _0x4588c8={};var _0x11e695;var _0x13fe72;return db[_0xdd3e('0x24')][_0xdd3e('0x43')]({'where':{'id':_0x469a62[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x312b7b,null))['then'](function(_0x154968){if(_0x154968){_0x11e695=_0x154968;_0x4588c8[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db[_0xdd3e('0x64')][_0xdd3e('0x25')]);_0x4588c8[_0xdd3e('0x2a')]=_[_0xdd3e('0x2e')](_0x469a62[_0xdd3e('0x2a')]);_0x4588c8[_0xdd3e('0x2f')]=_[_0xdd3e('0x30')](_0x4588c8['model'],_0x4588c8[_0xdd3e('0x2a')]);_0x5b6af8[_0xdd3e('0x31')]=_['intersection'](_0x4588c8[_0xdd3e('0x2d')],qs[_0xdd3e('0x32')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x32')]));_0x5b6af8['attributes']=_0x5b6af8[_0xdd3e('0x31')]['length']?_0x5b6af8[_0xdd3e('0x31')]:_0x4588c8[_0xdd3e('0x2d')];_0x5b6af8[_0xdd3e('0x55')]=qs[_0xdd3e('0x46')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x46')]);_0x5b6af8[_0xdd3e('0x47')]=qs[_0xdd3e('0x2f')](_['pick'](_0x469a62[_0xdd3e('0x2a')],_0x4588c8['filters']));if(_0x469a62['query'][_0xdd3e('0x4a')]){_0x5b6af8[_0xdd3e('0x47')]=_[_0xdd3e('0x35')](_0x5b6af8[_0xdd3e('0x47')],{'$or':_[_0xdd3e('0x23')](_0x5b6af8['attributes'],function(_0x4fd1de){var _0x1838c4={};_0x1838c4[_0x4fd1de]={'$like':'%'+_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x4a')]+'%'};return _0x1838c4;})});}_0x5b6af8=_[_0xdd3e('0x35')]({},_0x5b6af8,_0x469a62[_0xdd3e('0x36')]);return _0x11e695['getAgents'](_0x5b6af8);}})['then'](function(_0x1ef895){if(_0x1ef895){_0x13fe72=_0x1ef895[_0xdd3e('0x33')];if(!_0x469a62[_0xdd3e('0x2a')]['hasOwnProperty'](_0xdd3e('0x45'))){_0x5b6af8[_0xdd3e('0x13')]=qs[_0xdd3e('0x13')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x13')]);_0x5b6af8['offset']=qs[_0xdd3e('0x11')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x11')]);}return _0x11e695['getAgents'](_0x5b6af8);}})['then'](function(_0x3ebbae){if(_0x3ebbae){return _0x3ebbae?{'count':_0x13fe72,'rows':_0x3ebbae}:null;}})['then'](respondWithResult(_0x312b7b,null))[_0xdd3e('0x2b')](handleError(_0x312b7b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 50f3b9c..233867a 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 _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 +var _0xedc0=['../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xedc0,0x13f));var _0x0edc=function(_0x46ab02,_0x46f430){_0x46ab02=_0x46ab02-0x0;var _0x39d9a4=_0xedc0[_0x46ab02];return _0x39d9a4;};'use strict';var EventEmitter=require(_0x0edc('0x0'));var OpenchannelQueue=require(_0x0edc('0x1'))['db'][_0x0edc('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0edc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0edc('0x4'),'afterDestroy':_0x0edc('0x5')};function emitEvent(_0x5b2a48){return function(_0x2ccbe5,_0x1486ca,_0x11c43e){OpenchannelQueueEvents[_0x0edc('0x6')](_0x5b2a48+':'+_0x2ccbe5['id'],_0x2ccbe5);OpenchannelQueueEvents[_0x0edc('0x6')](_0x5b2a48,_0x2ccbe5);_0x11c43e(null);};}for(var e in events){if(events[_0x0edc('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0edc('0x8')](e,emitEvent(event));}}module[_0x0edc('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f18dfc7..ce6b03e 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 _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 +var _0x975b=['util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x104f8f,_0x52ecc){var _0x49cd8c=function(_0x252fbb){while(--_0x252fbb){_0x104f8f['push'](_0x104f8f['shift']());}};_0x49cd8c(++_0x52ecc);}(_0x975b,0x154));var _0xb975=function(_0x10723e,_0x4147de){_0x10723e=_0x10723e-0x0;var _0x35439b=_0x975b[_0x10723e];return _0x35439b;};'use strict';var _=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var logger=require(_0xb975('0x2'))(_0xb975('0x3'));var moment=require(_0xb975('0x4'));var BPromise=require(_0xb975('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb975('0x6'));var attributes=require(_0xb975('0x7'));module[_0xb975('0x8')]=function(_0x5ba710,_0x5bd3c1){return _0x5ba710['define'](_0xb975('0x9'),attributes,{'tableName':_0xb975('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 4983548..d1dc754 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 _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 +var _0x2a20=['OpenchannelQueue','findAll','options','raw','attributes','include','map','model','find','where','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','debug','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','info','request\x20sent','catch','GetOpenchannelQueue'];(function(_0x2f67c3,_0x518e18){var _0x4a8e41=function(_0x334210){while(--_0x334210){_0x2f67c3['push'](_0x2f67c3['shift']());}};_0x4a8e41(++_0x518e18);}(_0x2a20,0x1bb));var _0x02a2=function(_0x3533b8,_0x259028){_0x3533b8=_0x3533b8-0x0;var _0x29785b=_0x2a20[_0x3533b8];return _0x29785b;};'use strict';var _=require(_0x02a2('0x0'));var util=require(_0x02a2('0x1'));var moment=require(_0x02a2('0x2'));var BPromise=require(_0x02a2('0x3'));var rs=require(_0x02a2('0x4'));var fs=require('fs');var Redis=require(_0x02a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x02a2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x02a2('0x7'));var client=jayson[_0x02a2('0x8')][_0x02a2('0x9')]({'port':0x232a});config[_0x02a2('0xa')]=_[_0x02a2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x02a2('0xc'))(new Redis(config[_0x02a2('0xa')]));require('./openchannelQueue.socket')[_0x02a2('0xd')](socket);function respondWithRpcPromise(_0x344a2a,_0x4fca11,_0x3ff0c7){return new BPromise(function(_0x5aeb74,_0x489588){return client[_0x02a2('0xe')](_0x344a2a,_0x3ff0c7)[_0x02a2('0xf')](function(_0x1f8ac5){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4fca11,'request\x20sent');logger[_0x02a2('0x10')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4fca11,'request\x20sent',JSON[_0x02a2('0x11')](_0x1f8ac5));if(_0x1f8ac5[_0x02a2('0x12')]){if(_0x1f8ac5[_0x02a2('0x12')]['code']===0x1f4){logger['error'](_0x02a2('0x13'),_0x4fca11,_0x1f8ac5[_0x02a2('0x12')]['message']);return _0x489588(_0x1f8ac5[_0x02a2('0x12')][_0x02a2('0x14')]);}logger['error'](_0x02a2('0x13'),_0x4fca11,_0x1f8ac5[_0x02a2('0x12')][_0x02a2('0x14')]);return _0x5aeb74(_0x1f8ac5['error'][_0x02a2('0x14')]);}else{logger[_0x02a2('0x15')](_0x02a2('0x13'),_0x4fca11,_0x02a2('0x16'));_0x5aeb74(_0x1f8ac5['result'][_0x02a2('0x14')]);}})[_0x02a2('0x17')](function(_0x4de932){logger[_0x02a2('0x12')](_0x02a2('0x13'),_0x4fca11,_0x4de932);_0x489588(_0x4de932);});});}exports[_0x02a2('0x18')]=function(_0x57c205){var _0x45db0a=this;return new Promise(function(_0x4fd675,_0x20a9f4){return db[_0x02a2('0x19')][_0x02a2('0x1a')]({'raw':_0x57c205['options']?_0x57c205[_0x02a2('0x1b')][_0x02a2('0x1c')]===undefined?!![]:![]:!![],'where':_0x57c205['options']?_0x57c205[_0x02a2('0x1b')]['where']||null:null,'attributes':_0x57c205[_0x02a2('0x1b')]?_0x57c205[_0x02a2('0x1b')][_0x02a2('0x1d')]||null:null,'limit':_0x57c205[_0x02a2('0x1b')]?_0x57c205[_0x02a2('0x1b')]['limit']||null:null,'include':_0x57c205[_0x02a2('0x1b')]?_0x57c205[_0x02a2('0x1b')][_0x02a2('0x1e')]?_[_0x02a2('0x1f')](_0x57c205[_0x02a2('0x1b')]['include'],function(_0x4e0ae6){return{'model':db[_0x4e0ae6[_0x02a2('0x20')]],'as':_0x4e0ae6['as'],'attributes':_0x4e0ae6[_0x02a2('0x1d')],'include':_0x4e0ae6[_0x02a2('0x1e')]?_[_0x02a2('0x1f')](_0x4e0ae6[_0x02a2('0x1e')],function(_0x399fdf){return{'model':db[_0x399fdf[_0x02a2('0x20')]],'as':_0x399fdf['as'],'attributes':_0x399fdf[_0x02a2('0x1d')],'include':_0x399fdf[_0x02a2('0x1e')]?_[_0x02a2('0x1f')](_0x399fdf[_0x02a2('0x1e')],function(_0x23d46c){return{'model':db[_0x23d46c[_0x02a2('0x20')]],'as':_0x23d46c['as'],'attributes':_0x23d46c[_0x02a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02a2('0xf')](function(_0x188af6){logger[_0x02a2('0x15')](_0x02a2('0x18'),_0x57c205);logger[_0x02a2('0x10')](_0x02a2('0x18'),_0x57c205,JSON[_0x02a2('0x11')](_0x188af6));_0x4fd675(_0x188af6);})[_0x02a2('0x17')](function(_0x42cac4){logger['error'](_0x02a2('0x18'),_0x42cac4[_0x02a2('0x14')],_0x57c205);_0x20a9f4(_0x45db0a['error'](0x1f4,_0x42cac4[_0x02a2('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0xf88d5b){var _0x4e970e=this;return new Promise(function(_0x235855,_0x4c9e5c){return db[_0x02a2('0x19')][_0x02a2('0x21')]({'raw':_0xf88d5b[_0x02a2('0x1b')]?_0xf88d5b[_0x02a2('0x1b')][_0x02a2('0x1c')]===undefined?!![]:![]:!![],'where':_0xf88d5b[_0x02a2('0x1b')]?_0xf88d5b['options'][_0x02a2('0x22')]||null:null,'attributes':_0xf88d5b[_0x02a2('0x1b')]?_0xf88d5b[_0x02a2('0x1b')][_0x02a2('0x1d')]||null:null,'include':_0xf88d5b['options']?_0xf88d5b[_0x02a2('0x1b')]['include']?_[_0x02a2('0x1f')](_0xf88d5b[_0x02a2('0x1b')]['include'],function(_0x372bd4){return{'model':db[_0x372bd4[_0x02a2('0x20')]],'as':_0x372bd4['as'],'attributes':_0x372bd4[_0x02a2('0x1d')],'include':_0x372bd4[_0x02a2('0x1e')]?_['map'](_0x372bd4[_0x02a2('0x1e')],function(_0x4f5803){return{'model':db[_0x4f5803[_0x02a2('0x20')]],'as':_0x4f5803['as'],'attributes':_0x4f5803[_0x02a2('0x1d')],'include':_0x4f5803['include']?_[_0x02a2('0x1f')](_0x4f5803['include'],function(_0x35b450){return{'model':db[_0x35b450['model']],'as':_0x35b450['as'],'attributes':_0x35b450['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f4d3e){logger['info']('ShowOpenchannelQueue',_0xf88d5b);logger[_0x02a2('0x10')](_0x02a2('0x23'),_0xf88d5b,JSON[_0x02a2('0x11')](_0x2f4d3e));_0x235855(_0x2f4d3e);})[_0x02a2('0x17')](function(_0x3b1fb4){logger[_0x02a2('0x12')]('ShowOpenchannelQueue',_0x3b1fb4['message'],_0xf88d5b);_0x4c9e5c(_0x4e970e['error'](0x1f4,_0x3b1fb4[_0x02a2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 20ea7a6..8d8bcad 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 _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 +var _0xbbd8=['emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x194fc6,_0x47bf1d){var _0xfdd5dc=function(_0x4b5d90){while(--_0x4b5d90){_0x194fc6['push'](_0x194fc6['shift']());}};_0xfdd5dc(++_0x47bf1d);}(_0xbbd8,0x17c));var _0x8bbd=function(_0x1be4af,_0x1d9164){_0x1be4af=_0x1be4af-0x0;var _0xa960c4=_0xbbd8[_0x1be4af];return _0xa960c4;};'use strict';var OpenchannelQueueEvents=require(_0x8bbd('0x0'));var events=[_0x8bbd('0x1'),_0x8bbd('0x2'),_0x8bbd('0x3')];function createListener(_0x77c805,_0x2a6cea){return function(_0x420bf7){_0x2a6cea[_0x8bbd('0x4')](_0x77c805,_0x420bf7);};}function removeListener(_0x4e62e6,_0x31e434){return function(){OpenchannelQueueEvents[_0x8bbd('0x5')](_0x4e62e6,_0x31e434);};}exports[_0x8bbd('0x6')]=function(_0x19a5b6){for(var _0x1833f6=0x0,_0x364958=events['length'];_0x1833f6<_0x364958;_0x1833f6++){var _0x228831=events[_0x1833f6];var _0x104963=createListener(_0x8bbd('0x7')+_0x228831,_0x19a5b6);OpenchannelQueueEvents['on'](_0x228831,_0x104963);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 107857a..c4cc155 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 _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 +var _0x60e9=['show','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x13b165,_0x16ef65){var _0x2caac2=function(_0x1d28ae){while(--_0x1d28ae){_0x13b165['push'](_0x13b165['shift']());}};_0x2caac2(++_0x16ef65);}(_0x60e9,0x1a3));var _0x960e=function(_0x17cc8d,_0x1465a1){_0x17cc8d=_0x17cc8d-0x0;var _0x2966c0=_0x60e9[_0x17cc8d];return _0x2966c0;};'use strict';var multer=require('multer');var util=require(_0x960e('0x0'));var path=require(_0x960e('0x1'));var timeout=require(_0x960e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x960e('0x3'));var interaction=require(_0x960e('0x4'));var config=require(_0x960e('0x5'));var controller=require(_0x960e('0x6'));router['get']('/',auth[_0x960e('0x7')](),controller[_0x960e('0x8')]);router[_0x960e('0x9')](_0x960e('0xa'),auth[_0x960e('0x7')](),controller[_0x960e('0xb')]);router['get'](_0x960e('0xc'),auth[_0x960e('0x7')](),controller[_0x960e('0xd')]);router['post']('/',auth[_0x960e('0x7')](),controller['create']);router['put'](_0x960e('0xc'),auth['isAuthenticated'](),controller[_0x960e('0xe')]);router[_0x960e('0xf')](_0x960e('0xc'),auth['isAuthenticated'](),controller[_0x960e('0x10')]);module[_0x960e('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ceefd54..1d61364 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 _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 +var _0xbcfe=['moment','exports','STRING','DATE'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbcfe,0x128));var _0xebcf=function(_0x346207,_0x2705aa){_0x346207=_0x346207-0x0;var _0x5e850b=_0xbcfe[_0x346207];return _0x5e850b;};'use strict';var moment=require(_0xebcf('0x0'));var Sequelize=require('sequelize');module[_0xebcf('0x1')]={'uniqueid':{'type':Sequelize[_0xebcf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xebcf('0x2')]},'joinAt':{'type':Sequelize[_0xebcf('0x3')]},'leaveAt':{'type':Sequelize[_0xebcf('0x3')]},'acceptAt':{'type':Sequelize[_0xebcf('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xebcf('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 40d9fb2..46ce466 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 _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 +var _0x1704=['map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','OpenchannelQueueReport','catch','show','keys','fields','includeAll','include','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1704,0xb5));var _0x4170=function(_0x3af8d3,_0x5ee12d){_0x3af8d3=_0x3af8d3-0x0;var _0x1f0654=_0x1704[_0x3af8d3];return _0x1f0654;};'use strict';var emlformat=require(_0x4170('0x0'));var rimraf=require(_0x4170('0x1'));var zipdir=require(_0x4170('0x2'));var jsonpatch=require(_0x4170('0x3'));var rp=require(_0x4170('0x4'));var moment=require(_0x4170('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4170('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4170('0x7'));var csv=require(_0x4170('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4170('0x9'));var _=require(_0x4170('0xa'));var squel=require(_0x4170('0xb'));var crypto=require(_0x4170('0xc'));var jsforce=require(_0x4170('0xd'));var deskjs=require(_0x4170('0xe'));var toCsv=require(_0x4170('0x8'));var querystring=require(_0x4170('0xf'));var Papa=require(_0x4170('0x10'));var Redis=require(_0x4170('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4170('0x12'));var logger=require(_0x4170('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4170('0x14'))['db'];function respondWithStatusCode(_0x5c042e,_0x5c26b0){_0x5c26b0=_0x5c26b0||0xcc;return function(_0x32426c){if(_0x32426c){return _0x5c042e[_0x4170('0x15')](_0x5c26b0);}return _0x5c042e[_0x4170('0x16')](_0x5c26b0)[_0x4170('0x17')]();};}function respondWithResult(_0xb6caf3,_0x3a3c8b){_0x3a3c8b=_0x3a3c8b||0xc8;return function(_0x124c5f){if(_0x124c5f){return _0xb6caf3[_0x4170('0x16')](_0x3a3c8b)['json'](_0x124c5f);}};}function respondWithFilteredResult(_0x1b9bd8,_0x47be5d){return function(_0x119085){if(_0x119085){var _0x53aed3=typeof _0x47be5d[_0x4170('0x18')]===_0x4170('0x19')&&typeof _0x47be5d['limit']===_0x4170('0x19');var _0x141ff0=_0x119085[_0x4170('0x1a')];var _0x3fc10e=_0x53aed3?0x0:_0x47be5d[_0x4170('0x18')];var _0x13ab15=_0x53aed3?_0x119085[_0x4170('0x1a')]:_0x47be5d[_0x4170('0x18')]+_0x47be5d['limit'];var _0x306e6c;if(_0x13ab15>=_0x141ff0){_0x13ab15=_0x141ff0;_0x306e6c=0xc8;}else{_0x306e6c=0xce;}_0x1b9bd8[_0x4170('0x16')](_0x306e6c);return _0x1b9bd8[_0x4170('0x1b')](_0x4170('0x1c'),_0x3fc10e+'-'+_0x13ab15+'/'+_0x141ff0)[_0x4170('0x1d')](_0x119085);}return null;};}function patchUpdates(_0x5b0df6){return function(_0x3bd121){try{jsonpatch[_0x4170('0x1e')](_0x3bd121,_0x5b0df6,!![]);}catch(_0x15fa79){return BPromise[_0x4170('0x1f')](_0x15fa79);}return _0x3bd121[_0x4170('0x20')]();};}function saveUpdates(_0x43b70e,_0x587ca3){return function(_0x3b8445){if(_0x3b8445){return _0x3b8445[_0x4170('0x21')](_0x43b70e)['then'](function(_0x3128c2){return _0x3128c2;});}return null;};}function removeEntity(_0x3fb0df,_0x120d03){return function(_0x2c84e1){if(_0x2c84e1){return _0x2c84e1[_0x4170('0x22')]()[_0x4170('0x23')](function(){_0x3fb0df[_0x4170('0x16')](0xcc)[_0x4170('0x17')]();});}};}function handleEntityNotFound(_0x4684bf,_0x3c8f88){return function(_0x34bb10){if(!_0x34bb10){_0x4684bf[_0x4170('0x15')](0x194);}return _0x34bb10;};}function handleError(_0x478171,_0x47a00f){_0x47a00f=_0x47a00f||0x1f4;return function(_0x47e780){logger[_0x4170('0x24')](_0x47e780[_0x4170('0x25')]);if(_0x47e780[_0x4170('0x26')]){delete _0x47e780[_0x4170('0x26')];}_0x478171[_0x4170('0x16')](_0x47a00f)[_0x4170('0x27')](_0x47e780);};}exports[_0x4170('0x28')]=function(_0x301ee7,_0x182753){var _0x59b18e={},_0x4cda1d={},_0xac5347={'count':0x0,'rows':[]};var _0x5dcb38=_[_0x4170('0x29')](db['OpenchannelQueueReport'][_0x4170('0x2a')],function(_0x1c8b4a){return{'name':_0x1c8b4a[_0x4170('0x2b')],'type':_0x1c8b4a[_0x4170('0x2c')][_0x4170('0x2d')]};});_0x4cda1d[_0x4170('0x2e')]=_[_0x4170('0x29')](_0x5dcb38,_0x4170('0x26'));_0x4cda1d[_0x4170('0x2f')]=_['keys'](_0x301ee7[_0x4170('0x2f')]);_0x4cda1d[_0x4170('0x30')]=_[_0x4170('0x31')](_0x4cda1d[_0x4170('0x2e')],_0x4cda1d['query']);_0x59b18e[_0x4170('0x32')]=_[_0x4170('0x31')](_0x4cda1d[_0x4170('0x2e')],qs['fields'](_0x301ee7[_0x4170('0x2f')]['fields']));_0x59b18e[_0x4170('0x32')]=_0x59b18e['attributes'][_0x4170('0x33')]?_0x59b18e[_0x4170('0x32')]:_0x4cda1d[_0x4170('0x2e')];if(!_0x301ee7[_0x4170('0x2f')][_0x4170('0x34')](_0x4170('0x35'))){_0x59b18e[_0x4170('0x36')]=qs['limit'](_0x301ee7[_0x4170('0x2f')][_0x4170('0x36')]);_0x59b18e[_0x4170('0x18')]=qs[_0x4170('0x18')](_0x301ee7[_0x4170('0x2f')][_0x4170('0x18')]);}_0x59b18e[_0x4170('0x37')]=qs[_0x4170('0x38')](_0x301ee7['query'][_0x4170('0x38')]);_0x59b18e[_0x4170('0x39')]=qs[_0x4170('0x30')](_['pick'](_0x301ee7[_0x4170('0x2f')],_0x4cda1d['filters']),_0x5dcb38);if(_0x301ee7['query'][_0x4170('0x3a')]){_0x59b18e[_0x4170('0x39')]=_['merge'](_0x59b18e[_0x4170('0x39')],{'$or':_[_0x4170('0x29')](_0x5dcb38,function(_0x14a679){if(_0x14a679[_0x4170('0x2c')]!==_0x4170('0x3b')){var _0x27968e={};_0x27968e[_0x14a679[_0x4170('0x26')]]={'$like':'%'+_0x301ee7[_0x4170('0x2f')][_0x4170('0x3a')]+'%'};return _0x27968e;}})});}_0x59b18e=_[_0x4170('0x3c')]({},_0x59b18e,_0x301ee7['options']);var _0x384308={'where':_0x59b18e[_0x4170('0x39')]};return db[_0x4170('0x3d')][_0x4170('0x1a')](_0x384308)[_0x4170('0x23')](function(_0x51b870){_0xac5347[_0x4170('0x1a')]=_0x51b870;if(_0x301ee7[_0x4170('0x2f')]['includeAll']){_0x59b18e['include']=[{'all':!![]}];}return db[_0x4170('0x3d')]['findAll'](_0x59b18e);})[_0x4170('0x23')](function(_0x278aaa){_0xac5347['rows']=_0x278aaa;return _0xac5347;})[_0x4170('0x23')](respondWithFilteredResult(_0x182753,_0x59b18e))[_0x4170('0x3e')](handleError(_0x182753,null));};exports[_0x4170('0x3f')]=function(_0x5d82a3,_0x2cb17a){var _0x400397={'raw':!![],'where':{'id':_0x5d82a3['params']['id']}},_0xa05374={};_0xa05374['model']=_[_0x4170('0x40')](db[_0x4170('0x3d')]['rawAttributes']);_0xa05374[_0x4170('0x2f')]=_[_0x4170('0x40')](_0x5d82a3[_0x4170('0x2f')]);_0xa05374[_0x4170('0x30')]=_[_0x4170('0x31')](_0xa05374[_0x4170('0x2e')],_0xa05374[_0x4170('0x2f')]);_0x400397[_0x4170('0x32')]=_[_0x4170('0x31')](_0xa05374[_0x4170('0x2e')],qs['fields'](_0x5d82a3[_0x4170('0x2f')][_0x4170('0x41')]));_0x400397[_0x4170('0x32')]=_0x400397[_0x4170('0x32')][_0x4170('0x33')]?_0x400397[_0x4170('0x32')]:_0xa05374[_0x4170('0x2e')];if(_0x5d82a3[_0x4170('0x2f')][_0x4170('0x42')]){_0x400397[_0x4170('0x43')]=[{'all':!![]}];}_0x400397=_[_0x4170('0x3c')]({},_0x400397,_0x5d82a3[_0x4170('0x44')]);return db[_0x4170('0x3d')]['find'](_0x400397)[_0x4170('0x23')](handleEntityNotFound(_0x2cb17a,null))[_0x4170('0x23')](respondWithResult(_0x2cb17a,null))[_0x4170('0x3e')](handleError(_0x2cb17a,null));};exports[_0x4170('0x45')]=function(_0x3378b0,_0x1ab37b){return db[_0x4170('0x3d')][_0x4170('0x45')](_0x3378b0['body'],{})[_0x4170('0x23')](respondWithResult(_0x1ab37b,0xc9))[_0x4170('0x3e')](handleError(_0x1ab37b,null));};exports['update']=function(_0x473aa4,_0x50857c){if(_0x473aa4[_0x4170('0x46')]['id']){delete _0x473aa4[_0x4170('0x46')]['id'];}return db[_0x4170('0x3d')][_0x4170('0x47')]({'where':{'id':_0x473aa4[_0x4170('0x48')]['id']}})[_0x4170('0x23')](handleEntityNotFound(_0x50857c,null))[_0x4170('0x23')](saveUpdates(_0x473aa4[_0x4170('0x46')],null))[_0x4170('0x23')](respondWithResult(_0x50857c,null))[_0x4170('0x3e')](handleError(_0x50857c,null));};exports['destroy']=function(_0x41ca7d,_0x5ade23){return db[_0x4170('0x3d')][_0x4170('0x47')]({'where':{'id':_0x41ca7d['params']['id']}})['then'](handleEntityNotFound(_0x5ade23,null))[_0x4170('0x23')](removeEntity(_0x5ade23,null))[_0x4170('0x3e')](handleError(_0x5ade23,null));};exports[_0x4170('0x49')]=function(_0x4edc20,_0x3e33c2){return db[_0x4170('0x3d')][_0x4170('0x49')]()[_0x4170('0x23')](respondWithResult(_0x3e33c2,null))[_0x4170('0x3e')](handleError(_0x3e33c2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6e679fe..ac207c4 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 _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 +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x443e26,_0x57bcb4){var _0x3ec90a=function(_0x402efa){while(--_0x402efa){_0x443e26['push'](_0x443e26['shift']());}};_0x3ec90a(++_0x57bcb4);}(_0x2ef3,0xba));var _0x32ef=function(_0xd206cc,_0x3842a3){_0xd206cc=_0xd206cc-0x0;var _0x549ca1=_0x2ef3[_0xd206cc];return _0x549ca1;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index f5ff11b..af97869 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 _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 +var _0x7d25=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x391f9b,_0x275a37){var _0x52cf58=function(_0xca13ce){while(--_0xca13ce){_0x391f9b['push'](_0x391f9b['shift']());}};_0x52cf58(++_0x275a37);}(_0x7d25,0x8a));var _0x57d2=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x7d25[_0x5627e1];return _0x2f013f;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')](_0x7d4cf1[_0x57d2('0x17')],{'raw':_0x7d4cf1[_0x57d2('0x18')]?_0x7d4cf1['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![]})[_0x57d2('0x1a')](function(_0x55191e){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x55191e));_0x4a94e3(_0x55191e);})[_0x57d2('0x13')](function(_0x803c25){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x803c25[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x803c25[_0x57d2('0x11')]));});});};exports[_0x57d2('0x1b')]=function(_0x12ff19){var _0x473df2=this;return new Promise(function(_0x5327ea,_0x424ddc){return db[_0x57d2('0x15')][_0x57d2('0x1c')](_0x12ff19[_0x57d2('0x17')],{'raw':_0x12ff19[_0x57d2('0x18')]?_0x12ff19['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1d')]||null:null,'attributes':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1e')]||null:null,'limit':_0x12ff19['options']?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1f')]||null:null})[_0x57d2('0x1a')](function(_0x1fe383){logger[_0x57d2('0x9')](_0x57d2('0x1b'),_0x12ff19);logger[_0x57d2('0xb')](_0x57d2('0x1b'),_0x12ff19,JSON[_0x57d2('0xe')](_0x1fe383));_0x5327ea(_0x1fe383);})[_0x57d2('0x13')](function(_0x574589){logger[_0x57d2('0xf')](_0x57d2('0x1b'),_0x574589[_0x57d2('0x11')],_0x12ff19);_0x424ddc(_0x473df2[_0x57d2('0xf')](0x1f4,_0x574589['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 2ff5551..1fd6a19 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 _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 +var _0xc144=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','path'];(function(_0x275a1e,_0x399674){var _0x367ee9=function(_0x89bca9){while(--_0x89bca9){_0x275a1e['push'](_0x275a1e['shift']());}};_0x367ee9(++_0x399674);}(_0xc144,0x15e));var _0x4c14=function(_0x3d226c,_0x5e6f89){_0x3d226c=_0x3d226c-0x0;var _0x28bebf=_0xc144[_0x3d226c];return _0x28bebf;};'use strict';var multer=require('multer');var util=require(_0x4c14('0x0'));var path=require(_0x4c14('0x1'));var timeout=require(_0x4c14('0x2'));var express=require(_0x4c14('0x3'));var router=express['Router']();var fs_extra=require(_0x4c14('0x4'));var auth=require(_0x4c14('0x5'));var interaction=require(_0x4c14('0x6'));var config=require(_0x4c14('0x7'));var controller=require(_0x4c14('0x8'));router['get']('/',auth[_0x4c14('0x9')](),controller[_0x4c14('0xa')]);router[_0x4c14('0xb')](_0x4c14('0xc'),auth['isAuthenticated'](),controller[_0x4c14('0xd')]);router['get'](_0x4c14('0xe'),auth['isAuthenticated'](),controller[_0x4c14('0xf')]);router[_0x4c14('0x10')]('/',auth[_0x4c14('0x9')](),controller['create']);router[_0x4c14('0x11')](_0x4c14('0xe'),auth[_0x4c14('0x9')](),controller[_0x4c14('0x12')]);router[_0x4c14('0x13')]('/:id',auth[_0x4c14('0x9')](),controller[_0x4c14('0x14')]);module[_0x4c14('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index eb05522..91fcf5a 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 _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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5538b3,_0x402023){var _0x43ddfe=function(_0x4e7870){while(--_0x4e7870){_0x5538b3['push'](_0x5538b3['shift']());}};_0x43ddfe(++_0x402023);}(_0x54ef,0x112));var _0xf54e=function(_0x3ca563,_0x44e561){_0x3ca563=_0x3ca563-0x0;var _0xdd2c70=_0x54ef[_0x3ca563];return _0xdd2c70;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 725faf8..8a4cb4f 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 _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 +var _0x3911=['find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','OpenchannelTransferReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','pick','filters','filter','merge','where','map','options','count','include','findAll','rows','catch','show','params','includeAll'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x3911,0x93));var _0x1391=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x3911[_0x1d3791];return _0x40fbf5;};'use strict';var emlformat=require(_0x1391('0x0'));var rimraf=require(_0x1391('0x1'));var zipdir=require(_0x1391('0x2'));var jsonpatch=require(_0x1391('0x3'));var rp=require(_0x1391('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1391('0x5'));var util=require(_0x1391('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1391('0x7'));var ejs=require(_0x1391('0x8'));var fs=require('fs');var fs_extra=require(_0x1391('0x9'));var _=require(_0x1391('0xa'));var squel=require(_0x1391('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1391('0xc'));var Redis=require('ioredis');var authService=require(_0x1391('0xd'));var qs=require(_0x1391('0xe'));var as=require(_0x1391('0xf'));var hardwareService=require(_0x1391('0x10'));var logger=require(_0x1391('0x11'))(_0x1391('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1391('0x13'))['db'];function respondWithStatusCode(_0xd7cd45,_0x2ea7fa){_0x2ea7fa=_0x2ea7fa||0xcc;return function(_0x2cdc0c){if(_0x2cdc0c){return _0xd7cd45[_0x1391('0x14')](_0x2ea7fa);}return _0xd7cd45['status'](_0x2ea7fa)[_0x1391('0x15')]();};}function respondWithResult(_0x3215f9,_0x529dd8){_0x529dd8=_0x529dd8||0xc8;return function(_0xa66cc5){if(_0xa66cc5){return _0x3215f9[_0x1391('0x16')](_0x529dd8)[_0x1391('0x17')](_0xa66cc5);}};}function respondWithFilteredResult(_0x312b4d,_0x1375a6){return function(_0x599e30){if(_0x599e30){var _0x3a1ab7=typeof _0x1375a6[_0x1391('0x18')]===_0x1391('0x19')&&typeof _0x1375a6[_0x1391('0x1a')]===_0x1391('0x19');var _0x557698=_0x599e30['count'];var _0xb7bdd=_0x3a1ab7?0x0:_0x1375a6[_0x1391('0x18')];var _0x1f486b=_0x3a1ab7?_0x599e30['count']:_0x1375a6[_0x1391('0x18')]+_0x1375a6[_0x1391('0x1a')];var _0x265faf;if(_0x1f486b>=_0x557698){_0x1f486b=_0x557698;_0x265faf=0xc8;}else{_0x265faf=0xce;}_0x312b4d[_0x1391('0x16')](_0x265faf);return _0x312b4d[_0x1391('0x1b')](_0x1391('0x1c'),_0xb7bdd+'-'+_0x1f486b+'/'+_0x557698)['json'](_0x599e30);}return null;};}function patchUpdates(_0x1b9f49){return function(_0x3b7c4f){try{jsonpatch[_0x1391('0x1d')](_0x3b7c4f,_0x1b9f49,!![]);}catch(_0x279d34){return BPromise[_0x1391('0x1e')](_0x279d34);}return _0x3b7c4f[_0x1391('0x1f')]();};}function saveUpdates(_0x5bf94b,_0x193cef){return function(_0x19dc53){if(_0x19dc53){return _0x19dc53[_0x1391('0x20')](_0x5bf94b)[_0x1391('0x21')](function(_0x4761b7){return _0x4761b7;});}return null;};}function removeEntity(_0x10e9db,_0x222006){return function(_0x476497){if(_0x476497){return _0x476497['destroy']()['then'](function(){_0x10e9db['status'](0xcc)[_0x1391('0x15')]();});}};}function handleEntityNotFound(_0x40bac0,_0x4f59b6){return function(_0x1adafd){if(!_0x1adafd){_0x40bac0[_0x1391('0x14')](0x194);}return _0x1adafd;};}function handleError(_0x3ed527,_0x1cfced){_0x1cfced=_0x1cfced||0x1f4;return function(_0x23cc3b){logger[_0x1391('0x22')](_0x23cc3b['stack']);if(_0x23cc3b[_0x1391('0x23')]){delete _0x23cc3b[_0x1391('0x23')];}_0x3ed527['status'](_0x1cfced)[_0x1391('0x24')](_0x23cc3b);};}exports[_0x1391('0x25')]=function(_0x2400f5,_0x4a8750){var _0x2d426f={},_0x5ec7fc={},_0x1762d1={'count':0x0,'rows':[]};var _0x113c51=_['map'](db[_0x1391('0x26')]['rawAttributes'],function(_0x4be3a0){return{'name':_0x4be3a0[_0x1391('0x27')],'type':_0x4be3a0[_0x1391('0x28')][_0x1391('0x29')]};});_0x5ec7fc[_0x1391('0x2a')]=_['map'](_0x113c51,_0x1391('0x23'));_0x5ec7fc[_0x1391('0x2b')]=_[_0x1391('0x2c')](_0x2400f5['query']);_0x5ec7fc['filters']=_['intersection'](_0x5ec7fc[_0x1391('0x2a')],_0x5ec7fc[_0x1391('0x2b')]);_0x2d426f[_0x1391('0x2d')]=_[_0x1391('0x2e')](_0x5ec7fc['model'],qs['fields'](_0x2400f5[_0x1391('0x2b')][_0x1391('0x2f')]));_0x2d426f[_0x1391('0x2d')]=_0x2d426f[_0x1391('0x2d')][_0x1391('0x30')]?_0x2d426f[_0x1391('0x2d')]:_0x5ec7fc[_0x1391('0x2a')];if(!_0x2400f5[_0x1391('0x2b')]['hasOwnProperty'](_0x1391('0x31'))){_0x2d426f[_0x1391('0x1a')]=qs[_0x1391('0x1a')](_0x2400f5[_0x1391('0x2b')][_0x1391('0x1a')]);_0x2d426f['offset']=qs[_0x1391('0x18')](_0x2400f5[_0x1391('0x2b')][_0x1391('0x18')]);}_0x2d426f['order']=qs[_0x1391('0x32')](_0x2400f5['query'][_0x1391('0x32')]);_0x2d426f['where']=qs['filters'](_[_0x1391('0x33')](_0x2400f5[_0x1391('0x2b')],_0x5ec7fc[_0x1391('0x34')]),_0x113c51);if(_0x2400f5[_0x1391('0x2b')][_0x1391('0x35')]){_0x2d426f['where']=_[_0x1391('0x36')](_0x2d426f[_0x1391('0x37')],{'$or':_[_0x1391('0x38')](_0x113c51,function(_0x5d3f75){if(_0x5d3f75[_0x1391('0x28')]!=='VIRTUAL'){var _0x4b8882={};_0x4b8882[_0x5d3f75['name']]={'$like':'%'+_0x2400f5['query'][_0x1391('0x35')]+'%'};return _0x4b8882;}})});}_0x2d426f=_[_0x1391('0x36')]({},_0x2d426f,_0x2400f5[_0x1391('0x39')]);var _0x700c25={'where':_0x2d426f[_0x1391('0x37')]};return db[_0x1391('0x26')][_0x1391('0x3a')](_0x700c25)['then'](function(_0x48b594){_0x1762d1['count']=_0x48b594;if(_0x2400f5['query']['includeAll']){_0x2d426f[_0x1391('0x3b')]=[{'all':!![]}];}return db[_0x1391('0x26')][_0x1391('0x3c')](_0x2d426f);})[_0x1391('0x21')](function(_0x2ad0a4){_0x1762d1[_0x1391('0x3d')]=_0x2ad0a4;return _0x1762d1;})['then'](respondWithFilteredResult(_0x4a8750,_0x2d426f))[_0x1391('0x3e')](handleError(_0x4a8750,null));};exports[_0x1391('0x3f')]=function(_0x387c87,_0x60a9ba){var _0x397d65={'raw':!![],'where':{'id':_0x387c87[_0x1391('0x40')]['id']}},_0x17b99f={};_0x17b99f['model']=_['keys'](db[_0x1391('0x26')]['rawAttributes']);_0x17b99f[_0x1391('0x2b')]=_['keys'](_0x387c87[_0x1391('0x2b')]);_0x17b99f[_0x1391('0x34')]=_[_0x1391('0x2e')](_0x17b99f[_0x1391('0x2a')],_0x17b99f[_0x1391('0x2b')]);_0x397d65['attributes']=_['intersection'](_0x17b99f[_0x1391('0x2a')],qs[_0x1391('0x2f')](_0x387c87['query'][_0x1391('0x2f')]));_0x397d65[_0x1391('0x2d')]=_0x397d65[_0x1391('0x2d')][_0x1391('0x30')]?_0x397d65['attributes']:_0x17b99f[_0x1391('0x2a')];if(_0x387c87[_0x1391('0x2b')][_0x1391('0x41')]){_0x397d65[_0x1391('0x3b')]=[{'all':!![]}];}_0x397d65=_['merge']({},_0x397d65,_0x387c87['options']);return db['OpenchannelTransferReport'][_0x1391('0x42')](_0x397d65)[_0x1391('0x21')](handleEntityNotFound(_0x60a9ba,null))['then'](respondWithResult(_0x60a9ba,null))[_0x1391('0x3e')](handleError(_0x60a9ba,null));};exports[_0x1391('0x43')]=function(_0x4f137c,_0x5216bb){return db['OpenchannelTransferReport'][_0x1391('0x43')](_0x4f137c[_0x1391('0x44')],{})[_0x1391('0x21')](respondWithResult(_0x5216bb,0xc9))[_0x1391('0x3e')](handleError(_0x5216bb,null));};exports[_0x1391('0x20')]=function(_0x38d3c4,_0x599bdd){if(_0x38d3c4['body']['id']){delete _0x38d3c4[_0x1391('0x44')]['id'];}return db[_0x1391('0x26')]['find']({'where':{'id':_0x38d3c4['params']['id']}})[_0x1391('0x21')](handleEntityNotFound(_0x599bdd,null))[_0x1391('0x21')](saveUpdates(_0x38d3c4['body'],null))[_0x1391('0x21')](respondWithResult(_0x599bdd,null))[_0x1391('0x3e')](handleError(_0x599bdd,null));};exports[_0x1391('0x45')]=function(_0x156edd,_0x4448e0){return db['OpenchannelTransferReport'][_0x1391('0x42')]({'where':{'id':_0x156edd[_0x1391('0x40')]['id']}})[_0x1391('0x21')](handleEntityNotFound(_0x4448e0,null))['then'](removeEntity(_0x4448e0,null))[_0x1391('0x3e')](handleError(_0x4448e0,null));};exports[_0x1391('0x46')]=function(_0x35fdef,_0xf20858){return db[_0x1391('0x26')]['describe']()[_0x1391('0x21')](respondWithResult(_0xf20858,null))[_0x1391('0x3e')](handleError(_0xf20858,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3a6d96e..d81091a 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 _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 +var _0xabce=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x4235b3,_0x4295b9){var _0x5a6cc9=function(_0x3cd80d){while(--_0x3cd80d){_0x4235b3['push'](_0x4235b3['shift']());}};_0x5a6cc9(++_0x4295b9);}(_0xabce,0x104));var _0xeabc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xabce[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xeabc('0x0'));var util=require('util');var logger=require(_0xeabc('0x1'))('api');var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require(_0xeabc('0x8'));module[_0xeabc('0x9')]=function(_0x103836,_0x4dfed9){return _0x103836[_0xeabc('0xa')](_0xeabc('0xb'),attributes,{'tableName':_0xeabc('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9529c4c..966c3b7 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 _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 +var _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x42c788,_0x5c6fd3){var _0xcf9ef5=function(_0x34ba44){while(--_0x34ba44){_0x42c788['push'](_0x42c788['shift']());}};_0xcf9ef5(++_0x5c6fd3);}(_0xee14,0x13a));var _0x4ee1=function(_0xb41b14,_0x2e14e8){_0xb41b14=_0xb41b14-0x0;var _0x17fd27=_0xee14[_0xb41b14];return _0x17fd27;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 7a86c35..d9f1ab5 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 _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 +var _0x9ca1=['create','put','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post'];(function(_0x13f710,_0x18a2a1){var _0x28afbe=function(_0x44ff2d){while(--_0x44ff2d){_0x13f710['push'](_0x13f710['shift']());}};_0x28afbe(++_0x18a2a1);}(_0x9ca1,0xf3));var _0x19ca=function(_0x4ab167,_0x5ce71c){_0x4ab167=_0x4ab167-0x0;var _0xef426d=_0x9ca1[_0x4ab167];return _0xef426d;};'use strict';var multer=require('multer');var util=require(_0x19ca('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x19ca('0x1'));var router=express[_0x19ca('0x2')]();var fs_extra=require(_0x19ca('0x3'));var auth=require(_0x19ca('0x4'));var interaction=require(_0x19ca('0x5'));var config=require(_0x19ca('0x6'));var controller=require(_0x19ca('0x7'));router[_0x19ca('0x8')]('/',auth[_0x19ca('0x9')](),controller[_0x19ca('0xa')]);router[_0x19ca('0x8')](_0x19ca('0xb'),auth[_0x19ca('0x9')](),controller['show']);router[_0x19ca('0xc')]('/',auth[_0x19ca('0x9')](),controller[_0x19ca('0xd')]);router[_0x19ca('0xe')]('/:id',auth[_0x19ca('0x9')](),controller['update']);router['delete']('/:id',auth[_0x19ca('0x9')](),controller['destroy']);module[_0x19ca('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 77d06a8..bfb2df4 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 _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 +var _0xc6a0=['STRING','sequelize','exports','name'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0xc6a0,0x95));var _0x0c6a=function(_0x31ebeb,_0x75cef9){_0x31ebeb=_0x31ebeb-0x0;var _0x52bdfd=_0xc6a0[_0x31ebeb];return _0x52bdfd;};'use strict';var Sequelize=require(_0x0c6a('0x0'));module[_0x0c6a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0c6a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x0c6a('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ef7a83f..f79e11f 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 _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 +var _0x5cd4=['ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','apply','reject','save','update','destroy','then','get','Pauses','error','name','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','create','user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','moment','bluebird','util','to-csv'];(function(_0x55275d,_0x1b2bd4){var _0x31fa28=function(_0xcb2110){while(--_0xcb2110){_0x55275d['push'](_0x55275d['shift']());}};_0x31fa28(++_0x1b2bd4);}(_0x5cd4,0x1b0));var _0x45cd=function(_0x3fa386,_0x2a03d0){_0x3fa386=_0x3fa386-0x0;var _0x118475=_0x5cd4[_0x3fa386];return _0x118475;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x45cd('0x0'));var jsonpatch=require(_0x45cd('0x1'));var rp=require('request-promise');var moment=require(_0x45cd('0x2'));var BPromise=require(_0x45cd('0x3'));var Mustache=require('mustache');var util=require(_0x45cd('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x45cd('0x5'));var ejs=require(_0x45cd('0x6'));var fs=require('fs');var fs_extra=require(_0x45cd('0x7'));var _=require(_0x45cd('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45cd('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x45cd('0xa'));var Papa=require(_0x45cd('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x45cd('0xc'));var as=require(_0x45cd('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45cd('0xe'))(_0x45cd('0xf'));var utils=require(_0x45cd('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x45cd('0x11'));var db=require(_0x45cd('0x12'))['db'];function respondWithStatusCode(_0xea87ad,_0x57c153){_0x57c153=_0x57c153||0xcc;return function(_0x467aa3){if(_0x467aa3){return _0xea87ad[_0x45cd('0x13')](_0x57c153);}return _0xea87ad[_0x45cd('0x14')](_0x57c153)['end']();};}function respondWithResult(_0x23d117,_0x3f93b3){_0x3f93b3=_0x3f93b3||0xc8;return function(_0x4e9c33){if(_0x4e9c33){return _0x23d117[_0x45cd('0x14')](_0x3f93b3)[_0x45cd('0x15')](_0x4e9c33);}};}function respondWithFilteredResult(_0x5151a6,_0x27ee54){return function(_0xe47f9c){if(_0xe47f9c){var _0x4ec7ad=typeof _0x27ee54['offset']==='undefined'&&typeof _0x27ee54[_0x45cd('0x16')]===_0x45cd('0x17');var _0xe12f32=_0xe47f9c[_0x45cd('0x18')];var _0x5b1646=_0x4ec7ad?0x0:_0x27ee54[_0x45cd('0x19')];var _0x127a53=_0x4ec7ad?_0xe47f9c[_0x45cd('0x18')]:_0x27ee54[_0x45cd('0x19')]+_0x27ee54[_0x45cd('0x16')];var _0x3e60cc;if(_0x127a53>=_0xe12f32){_0x127a53=_0xe12f32;_0x3e60cc=0xc8;}else{_0x3e60cc=0xce;}_0x5151a6[_0x45cd('0x14')](_0x3e60cc);return _0x5151a6['set']('Content-Range',_0x5b1646+'-'+_0x127a53+'/'+_0xe12f32)[_0x45cd('0x15')](_0xe47f9c);}return null;};}function patchUpdates(_0xaf863b){return function(_0x2f6ac8){try{jsonpatch[_0x45cd('0x1a')](_0x2f6ac8,_0xaf863b,!![]);}catch(_0x5279e9){return BPromise[_0x45cd('0x1b')](_0x5279e9);}return _0x2f6ac8[_0x45cd('0x1c')]();};}function saveUpdates(_0x5c05b6,_0x426c09){return function(_0x4bbae5){if(_0x4bbae5){return _0x4bbae5[_0x45cd('0x1d')](_0x5c05b6)['then'](function(_0x4c4b0b){return _0x4c4b0b;});}return null;};}function removeEntity(_0x2c357d,_0x4bff44){return function(_0x1e3625){if(_0x1e3625){return _0x1e3625[_0x45cd('0x1e')]()[_0x45cd('0x1f')](function(){var _0x4d0bc5=_0x1e3625[_0x45cd('0x20')]({'plain':!![]});var _0x514622=_0x45cd('0x21');return db['UserProfileResource'][_0x45cd('0x1e')]({'where':{'type':_0x514622,'resourceId':_0x4d0bc5['id']}})['then'](function(){return _0x1e3625;});})[_0x45cd('0x1f')](function(){_0x2c357d[_0x45cd('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16710e,_0x2ec040){return function(_0x23f508){if(!_0x23f508){_0x16710e[_0x45cd('0x13')](0x194);}return _0x23f508;};}function handleError(_0x131e4a,_0x32cf48){_0x32cf48=_0x32cf48||0x1f4;return function(_0x1cb24e){logger[_0x45cd('0x22')](_0x1cb24e['stack']);if(_0x1cb24e['name']){delete _0x1cb24e[_0x45cd('0x23')];}_0x131e4a['status'](_0x32cf48)['send'](_0x1cb24e);};}exports['index']=function(_0x1c1f03,_0x51b6f8){var _0x3812ce={},_0x4a0eab={},_0x3dfb76={'count':0x0,'rows':[]};var _0x42a873=_[_0x45cd('0x24')](db[_0x45cd('0x25')][_0x45cd('0x26')],function(_0x12283e){return{'name':_0x12283e[_0x45cd('0x27')],'type':_0x12283e[_0x45cd('0x28')][_0x45cd('0x29')]};});_0x4a0eab[_0x45cd('0x2a')]=_[_0x45cd('0x24')](_0x42a873,_0x45cd('0x23'));_0x4a0eab[_0x45cd('0x2b')]=_[_0x45cd('0x2c')](_0x1c1f03['query']);_0x4a0eab[_0x45cd('0x2d')]=_['intersection'](_0x4a0eab[_0x45cd('0x2a')],_0x4a0eab['query']);_0x3812ce[_0x45cd('0x2e')]=_[_0x45cd('0x2f')](_0x4a0eab[_0x45cd('0x2a')],qs[_0x45cd('0x30')](_0x1c1f03['query'][_0x45cd('0x30')]));_0x3812ce[_0x45cd('0x2e')]=_0x3812ce[_0x45cd('0x2e')][_0x45cd('0x31')]?_0x3812ce[_0x45cd('0x2e')]:_0x4a0eab[_0x45cd('0x2a')];if(!_0x1c1f03[_0x45cd('0x2b')][_0x45cd('0x32')]('nolimit')){_0x3812ce[_0x45cd('0x16')]=qs[_0x45cd('0x16')](_0x1c1f03[_0x45cd('0x2b')]['limit']);_0x3812ce['offset']=qs[_0x45cd('0x19')](_0x1c1f03[_0x45cd('0x2b')][_0x45cd('0x19')]);}_0x3812ce[_0x45cd('0x33')]=qs[_0x45cd('0x34')](_0x1c1f03['query'][_0x45cd('0x34')]);_0x3812ce['where']=qs[_0x45cd('0x2d')](_['pick'](_0x1c1f03[_0x45cd('0x2b')],_0x4a0eab[_0x45cd('0x2d')]),_0x42a873);if(_0x1c1f03['query']['filter']){_0x3812ce['where']=_[_0x45cd('0x35')](_0x3812ce[_0x45cd('0x36')],{'$or':_[_0x45cd('0x24')](_0x42a873,function(_0xe1591c){if(_0xe1591c[_0x45cd('0x28')]!==_0x45cd('0x37')){var _0x2bb0b2={};_0x2bb0b2[_0xe1591c[_0x45cd('0x23')]]={'$like':'%'+_0x1c1f03['query']['filter']+'%'};return _0x2bb0b2;}})});}_0x3812ce=_['merge']({},_0x3812ce,_0x1c1f03[_0x45cd('0x38')]);var _0x37e837={'where':_0x3812ce['where']};return db[_0x45cd('0x25')][_0x45cd('0x18')](_0x37e837)[_0x45cd('0x1f')](function(_0x2efb42){_0x3dfb76[_0x45cd('0x18')]=_0x2efb42;if(_0x1c1f03[_0x45cd('0x2b')]['includeAll']){_0x3812ce[_0x45cd('0x39')]=[{'all':!![]}];}return db[_0x45cd('0x25')][_0x45cd('0x3a')](_0x3812ce);})[_0x45cd('0x1f')](function(_0x4697c9){_0x3dfb76[_0x45cd('0x3b')]=_0x4697c9;return _0x3dfb76;})['then'](respondWithFilteredResult(_0x51b6f8,_0x3812ce))['catch'](handleError(_0x51b6f8,null));};exports[_0x45cd('0x3c')]=function(_0x3c22fc,_0x11b1c3){var _0x26d416={'raw':!![],'where':{'id':_0x3c22fc[_0x45cd('0x3d')]['id']}},_0x5a58eb={};_0x5a58eb[_0x45cd('0x2a')]=_['keys'](db[_0x45cd('0x25')][_0x45cd('0x26')]);_0x5a58eb[_0x45cd('0x2b')]=_[_0x45cd('0x2c')](_0x3c22fc[_0x45cd('0x2b')]);_0x5a58eb[_0x45cd('0x2d')]=_['intersection'](_0x5a58eb['model'],_0x5a58eb[_0x45cd('0x2b')]);_0x26d416[_0x45cd('0x2e')]=_[_0x45cd('0x2f')](_0x5a58eb[_0x45cd('0x2a')],qs[_0x45cd('0x30')](_0x3c22fc['query'][_0x45cd('0x30')]));_0x26d416[_0x45cd('0x2e')]=_0x26d416[_0x45cd('0x2e')][_0x45cd('0x31')]?_0x26d416[_0x45cd('0x2e')]:_0x5a58eb[_0x45cd('0x2a')];if(_0x3c22fc[_0x45cd('0x2b')][_0x45cd('0x3e')]){_0x26d416[_0x45cd('0x39')]=[{'all':!![]}];}_0x26d416=_[_0x45cd('0x35')]({},_0x26d416,_0x3c22fc[_0x45cd('0x38')]);return db[_0x45cd('0x25')]['find'](_0x26d416)[_0x45cd('0x1f')](handleEntityNotFound(_0x11b1c3,null))['then'](respondWithResult(_0x11b1c3,null))[_0x45cd('0x3f')](handleError(_0x11b1c3,null));};exports[_0x45cd('0x40')]=function(_0x3bf045,_0x10b05b){return db[_0x45cd('0x25')][_0x45cd('0x40')](_0x3bf045['body'],{})[_0x45cd('0x1f')](function(_0x1956d4){var _0x400ae7=_0x3bf045[_0x45cd('0x41')][_0x45cd('0x20')]({'plain':!![]});if(!_0x400ae7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x400ae7[_0x45cd('0x42')]===_0x45cd('0x41')){var _0x5ac61c=_0x1956d4[_0x45cd('0x20')]({'plain':!![]});var _0x32dc5b=_0x45cd('0x21');return db[_0x45cd('0x43')][_0x45cd('0x44')]({'where':{'name':_0x32dc5b,'userProfileId':_0x400ae7[_0x45cd('0x45')]},'raw':!![]})['then'](function(_0x5cef1b){if(_0x5cef1b&&_0x5cef1b['autoAssociation']===0x0){return db[_0x45cd('0x46')][_0x45cd('0x40')]({'name':_0x5ac61c[_0x45cd('0x23')],'resourceId':_0x5ac61c['id'],'type':_0x5cef1b['name'],'sectionId':_0x5cef1b['id']},{})[_0x45cd('0x1f')](function(){return _0x1956d4;});}else{return _0x1956d4;}})[_0x45cd('0x3f')](function(_0x430849){logger[_0x45cd('0x22')](_0x45cd('0x47'),_0x430849);throw _0x430849;});}return _0x1956d4;})[_0x45cd('0x1f')](respondWithResult(_0x10b05b,0xc9))[_0x45cd('0x3f')](handleError(_0x10b05b,null));};exports[_0x45cd('0x1d')]=function(_0x30ebd6,_0xfbe8a8){if(_0x30ebd6[_0x45cd('0x48')]['id']){delete _0x30ebd6['body']['id'];}return db['Pause'][_0x45cd('0x44')]({'where':{'id':_0x30ebd6['params']['id']}})['then'](handleEntityNotFound(_0xfbe8a8,null))[_0x45cd('0x1f')](saveUpdates(_0x30ebd6['body'],null))[_0x45cd('0x1f')](respondWithResult(_0xfbe8a8,null))['catch'](handleError(_0xfbe8a8,null));};exports[_0x45cd('0x1e')]=function(_0x3939f8,_0x442654){return db[_0x45cd('0x25')][_0x45cd('0x44')]({'where':{'id':_0x3939f8[_0x45cd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x442654,null))[_0x45cd('0x1f')](removeEntity(_0x442654,null))[_0x45cd('0x3f')](handleError(_0x442654,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 974267b..4e94aa5 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 _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 +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x250c78,_0x25b838){_0x250c78=_0x250c78-0x0;var _0x44f07a=_0x7fbe[_0x250c78];return _0x44f07a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),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 6d6d211..5c8a220 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_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 +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(_0x466c05,_0x60fbd9){var _0x55f66e=function(_0x55485b){while(--_0x55485b){_0x466c05['push'](_0x466c05['shift']());}};_0x55f66e(++_0x60fbd9);}(_0x7a54,0x106));var _0x47a5=function(_0x84fd53,_0x99a14){_0x84fd53=_0x84fd53-0x0;var _0x5c002d=_0x7a54[_0x84fd53];return _0x5c002d;};'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 8171969..0ac9bfb 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 _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 +var _0x207c=['file','upload','post','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/webhook','/:id','isAuthenticated','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','extname','now','single'];(function(_0x2b861e,_0x3d9404){var _0x5513b8=function(_0x56800c){while(--_0x56800c){_0x2b861e['push'](_0x2b861e['shift']());}};_0x5513b8(++_0x3d9404);}(_0x207c,0x1e8));var _0xc207=function(_0x5ecbe8,_0x42522f){_0x5ecbe8=_0x5ecbe8-0x0;var _0x1c6e21=_0x207c[_0x5ecbe8];return _0x1c6e21;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),controller['webhookGet']);router[_0xc207('0x9')](_0xc207('0xb'),auth[_0xc207('0xc')](),controller['show']);router[_0xc207('0x9')](_0xc207('0xd'),auth[_0xc207('0xc')](),controller[_0xc207('0xe')]);var upload=multer({'storage':multer[_0xc207('0xf')]({'destination':function(_0x347549,_0x487d95,_0x574425){_0x574425(null,path['join'](config[_0xc207('0x10')],'server/files/plugins'));},'filename':function(_0x2741f3,_0x2782ce,_0x59d401){_0x2782ce[_0xc207('0x11')]=_0x2782ce[_0xc207('0x11')][_0xc207('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59d401(null,util[_0xc207('0x13')](_0xc207('0x14'),path['basename'](_0x2782ce[_0xc207('0x11')],path[_0xc207('0x15')](_0x2782ce[_0xc207('0x11')])),Date[_0xc207('0x16')](),path['extname'](_0x2782ce['originalname'])));}})});router['post']('/',upload[_0xc207('0x17')](_0xc207('0x18')),controller[_0xc207('0x19')]);router[_0xc207('0x1a')]('/webhook',controller[_0xc207('0x1b')]);router[_0xc207('0x1c')](_0xc207('0xb'),auth['isAuthenticated'](),controller[_0xc207('0x1d')]);router['delete'](_0xc207('0xb'),auth[_0xc207('0xc')](),controller[_0xc207('0x1e')]);module[_0xc207('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5a8631e..f1f0966 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 _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 +var _0x6d8c=['TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script'];(function(_0x1350b0,_0x267231){var _0xeee748=function(_0x3af6ef){while(--_0x3af6ef){_0x1350b0['push'](_0x1350b0['shift']());}};_0xeee748(++_0x267231);}(_0x6d8c,0x127));var _0xc6d8=function(_0x2cb7b4,_0x204ca2){_0x2cb7b4=_0x2cb7b4-0x0;var _0x1bb99a=_0x6d8c[_0x2cb7b4];return _0x1bb99a;};'use strict';var Sequelize=require(_0xc6d8('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6d8('0x1')]},'type':{'type':Sequelize[_0xc6d8('0x2')](_0xc6d8('0x3'),_0xc6d8('0x4'))},'description':{'type':Sequelize[_0xc6d8('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xc6d8('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xc6d8('0x6')],'defaultValue':0x0,'comment':_0xc6d8('0x7')},'sidebar':{'type':Sequelize[_0xc6d8('0x2')]('adminOnly',_0xc6d8('0x8'),_0xc6d8('0x9'),_0xc6d8('0xa')),'defaultValue':'always','comment':_0xc6d8('0xb')},'icon':{'type':Sequelize[_0xc6d8('0x1')]},'adminUrl':{'type':Sequelize[_0xc6d8('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xc6d8('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e4d215c..f6ab282 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 _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 +var _0x2dd8=['../../config/utils','../../config/environment','defaults','redis','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','get','Plugins','destroy','then','error','name','index','Plugin','fieldName','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','path','join','root','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','views','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','userProfileId','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','statusCode','send','webhookPost','resolve','method','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x333a5b,_0x2fe2c3){var _0x24f0d4=function(_0x3be709){while(--_0x3be709){_0x333a5b['push'](_0x333a5b['shift']());}};_0x24f0d4(++_0x2fe2c3);}(_0x2dd8,0x91));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x82dd('0x0'));var rimraf=require(_0x82dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82dd('0x2'));var moment=require(_0x82dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x82dd('0x4'));var util=require(_0x82dd('0x5'));var path=require('path');var sox=require(_0x82dd('0x6'));var csv=require('to-csv');var ejs=require(_0x82dd('0x7'));var fs=require('fs');var fs_extra=require(_0x82dd('0x8'));var _=require(_0x82dd('0x9'));var squel=require(_0x82dd('0xa'));var crypto=require(_0x82dd('0xb'));var jsforce=require(_0x82dd('0xc'));var deskjs=require(_0x82dd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x82dd('0xe'));var Papa=require(_0x82dd('0xf'));var extract=require(_0x82dd('0x10'));var rimraf=require(_0x82dd('0x1'));var archiver=require(_0x82dd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82dd('0x12'));var as=require(_0x82dd('0x13'));var hardwareService=require(_0x82dd('0x14'));var logger=require(_0x82dd('0x15'))(_0x82dd('0x16'));var utils=require(_0x82dd('0x17'));var config=require(_0x82dd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x82dd('0x19')](config[_0x82dd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82dd('0x1a')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x26d617,_0x5b286d){_0x5b286d=_0x5b286d||0xcc;return function(_0x14a9c8){if(_0x14a9c8){return _0x26d617[_0x82dd('0x1b')](_0x5b286d);}return _0x26d617[_0x82dd('0x1c')](_0x5b286d)[_0x82dd('0x1d')]();};}function respondWithResult(_0x329f75,_0x482aa6){_0x482aa6=_0x482aa6||0xc8;return function(_0x4195a6){if(_0x4195a6){return _0x329f75[_0x82dd('0x1c')](_0x482aa6)[_0x82dd('0x1e')](_0x4195a6);}};}function respondWithFilteredResult(_0x2d737a,_0x28cca6){return function(_0xf39459){if(_0xf39459){var _0x5419cf=typeof _0x28cca6[_0x82dd('0x1f')]===_0x82dd('0x20')&&typeof _0x28cca6[_0x82dd('0x21')]===_0x82dd('0x20');var _0x1e1861=_0xf39459['count'];var _0x1fc62a=_0x5419cf?0x0:_0x28cca6['offset'];var _0x4d971c=_0x5419cf?_0xf39459['count']:_0x28cca6[_0x82dd('0x1f')]+_0x28cca6['limit'];var _0x4bcdd2;if(_0x4d971c>=_0x1e1861){_0x4d971c=_0x1e1861;_0x4bcdd2=0xc8;}else{_0x4bcdd2=0xce;}_0x2d737a['status'](_0x4bcdd2);return _0x2d737a['set'](_0x82dd('0x22'),_0x1fc62a+'-'+_0x4d971c+'/'+_0x1e1861)[_0x82dd('0x1e')](_0xf39459);}return null;};}function patchUpdates(_0x415414){return function(_0x3c81a9){try{jsonpatch[_0x82dd('0x23')](_0x3c81a9,_0x415414,!![]);}catch(_0x38f9df){return BPromise[_0x82dd('0x24')](_0x38f9df);}return _0x3c81a9[_0x82dd('0x25')]();};}function saveUpdates(_0x2ad78e,_0x33c987){return function(_0x50ba1b){if(_0x50ba1b){return _0x50ba1b['update'](_0x2ad78e)['then'](function(_0x4441b7){return _0x4441b7;});}return null;};}function removeEntity(_0x3d25b0,_0x241ec0){return function(_0x3ad53f){if(_0x3ad53f){return _0x3ad53f['destroy']()['then'](function(){var _0x7fb6a2=_0x3ad53f[_0x82dd('0x26')]({'plain':!![]});var _0x544e14=_0x82dd('0x27');return db['UserProfileResource'][_0x82dd('0x28')]({'where':{'type':_0x544e14,'resourceId':_0x7fb6a2['id']}})[_0x82dd('0x29')](function(){return _0x3ad53f;});})[_0x82dd('0x29')](function(){_0x3d25b0[_0x82dd('0x1c')](0xcc)[_0x82dd('0x1d')]();});}};}function handleEntityNotFound(_0x486dac,_0xc77c8c){return function(_0x1d7657){if(!_0x1d7657){_0x486dac['sendStatus'](0x194);}return _0x1d7657;};}function handleError(_0x4c1fd9,_0x5351e8){_0x5351e8=_0x5351e8||0x1f4;return function(_0x319af7){logger[_0x82dd('0x2a')](_0x319af7['stack']);if(_0x319af7[_0x82dd('0x2b')]){delete _0x319af7[_0x82dd('0x2b')];}_0x4c1fd9['status'](_0x5351e8)['send'](_0x319af7);};}exports[_0x82dd('0x2c')]=function(_0x2264d4,_0x1572d3){var _0x80ef46={},_0x252a69={},_0x5aed46={'count':0x0,'rows':[]};var _0xcdd62d=_['map'](db[_0x82dd('0x2d')]['rawAttributes'],function(_0x1020eb){return{'name':_0x1020eb[_0x82dd('0x2e')],'type':_0x1020eb['type']['key']};});_0x252a69[_0x82dd('0x2f')]=_[_0x82dd('0x30')](_0xcdd62d,_0x82dd('0x2b'));_0x252a69[_0x82dd('0x31')]=_['keys'](_0x2264d4[_0x82dd('0x31')]);_0x252a69[_0x82dd('0x32')]=_[_0x82dd('0x33')](_0x252a69[_0x82dd('0x2f')],_0x252a69['query']);_0x80ef46['attributes']=_[_0x82dd('0x33')](_0x252a69[_0x82dd('0x2f')],qs[_0x82dd('0x34')](_0x2264d4[_0x82dd('0x31')][_0x82dd('0x34')]));_0x80ef46['attributes']=_0x80ef46[_0x82dd('0x35')]['length']?_0x80ef46[_0x82dd('0x35')]:_0x252a69[_0x82dd('0x2f')];if(!_0x2264d4[_0x82dd('0x31')][_0x82dd('0x36')](_0x82dd('0x37'))){_0x80ef46['limit']=qs[_0x82dd('0x21')](_0x2264d4['query'][_0x82dd('0x21')]);_0x80ef46['offset']=qs['offset'](_0x2264d4[_0x82dd('0x31')][_0x82dd('0x1f')]);}_0x80ef46['order']=qs[_0x82dd('0x38')](_0x2264d4['query'][_0x82dd('0x38')]);_0x80ef46[_0x82dd('0x39')]=qs[_0x82dd('0x32')](_[_0x82dd('0x3a')](_0x2264d4['query'],_0x252a69[_0x82dd('0x32')]),_0xcdd62d);if(_0x2264d4[_0x82dd('0x31')][_0x82dd('0x3b')]){_0x80ef46[_0x82dd('0x39')]=_[_0x82dd('0x3c')](_0x80ef46[_0x82dd('0x39')],{'$or':_[_0x82dd('0x30')](_0xcdd62d,function(_0x9fb0d5){if(_0x9fb0d5[_0x82dd('0x3d')]!=='VIRTUAL'){var _0x479806={};_0x479806[_0x9fb0d5[_0x82dd('0x2b')]]={'$like':'%'+_0x2264d4[_0x82dd('0x31')]['filter']+'%'};return _0x479806;}})});}_0x80ef46=_['merge']({},_0x80ef46,_0x2264d4[_0x82dd('0x3e')]);var _0x6d7532={'where':_0x80ef46['where']};return db['Plugin'][_0x82dd('0x3f')](_0x6d7532)[_0x82dd('0x29')](function(_0x6ab89){_0x5aed46[_0x82dd('0x3f')]=_0x6ab89;if(_0x2264d4[_0x82dd('0x31')][_0x82dd('0x40')]){_0x80ef46[_0x82dd('0x41')]=[{'all':!![]}];}return db[_0x82dd('0x2d')][_0x82dd('0x42')](_0x80ef46);})[_0x82dd('0x29')](function(_0xc685a1){_0x5aed46[_0x82dd('0x43')]=_0xc685a1;return _0x5aed46;})[_0x82dd('0x29')](respondWithFilteredResult(_0x1572d3,_0x80ef46))[_0x82dd('0x44')](handleError(_0x1572d3,null));};exports['show']=function(_0x2e58e4,_0x3a1ede){var _0x145d4c={'raw':!![],'where':{'id':_0x2e58e4[_0x82dd('0x45')]['id']}},_0x121014={};_0x121014[_0x82dd('0x2f')]=_[_0x82dd('0x46')](db[_0x82dd('0x2d')][_0x82dd('0x47')]);_0x121014[_0x82dd('0x31')]=_[_0x82dd('0x46')](_0x2e58e4[_0x82dd('0x31')]);_0x121014[_0x82dd('0x32')]=_['intersection'](_0x121014[_0x82dd('0x2f')],_0x121014[_0x82dd('0x31')]);_0x145d4c[_0x82dd('0x35')]=_[_0x82dd('0x33')](_0x121014[_0x82dd('0x2f')],qs[_0x82dd('0x34')](_0x2e58e4[_0x82dd('0x31')][_0x82dd('0x34')]));_0x145d4c[_0x82dd('0x35')]=_0x145d4c[_0x82dd('0x35')][_0x82dd('0x48')]?_0x145d4c[_0x82dd('0x35')]:_0x121014[_0x82dd('0x2f')];if(_0x2e58e4[_0x82dd('0x31')]['includeAll']){_0x145d4c[_0x82dd('0x41')]=[{'all':!![]}];}_0x145d4c=_['merge']({},_0x145d4c,_0x2e58e4[_0x82dd('0x3e')]);return db[_0x82dd('0x2d')][_0x82dd('0x49')](_0x145d4c)['then'](handleEntityNotFound(_0x3a1ede,null))[_0x82dd('0x29')](respondWithResult(_0x3a1ede,null))[_0x82dd('0x44')](handleError(_0x3a1ede,null));};exports['download']=function(_0x55c1c8,_0x5f51f7,_0x48231c){return db[_0x82dd('0x2d')]['find']({'where':{'id':_0x55c1c8[_0x82dd('0x45')]['id']},'attributes':['name',_0x82dd('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x5f51f7,null))[_0x82dd('0x29')](function(_0x506860){if(_0x506860){var _0x4058b0=path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),util[_0x82dd('0x4e')]('%s.zip',path[_0x82dd('0x4f')](_0x506860['path'])));var _0x5391b4=fs[_0x82dd('0x50')](_0x4058b0);var _0x554ebc=archiver(_0x82dd('0x51'),{'zlib':{'level':0x9}});_0x554ebc['on']('warning',function(_0x40309a){if(_0x40309a[_0x82dd('0x52')]===_0x82dd('0x53')){logger['error'](_0x40309a);}else{throw new db[(_0x82dd('0x54'))]['Error'](_0x82dd('0x55'));}});_0x554ebc['on'](_0x82dd('0x2a'),function(_0x4c0ce7){throw new db[(_0x82dd('0x54'))][(_0x82dd('0x56'))](_0x82dd('0x55'));});_0x554ebc[_0x82dd('0x57')](_0x5391b4);_0x554ebc[_0x82dd('0x58')](_0x82dd('0x59'),{'cwd':path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),path[_0x82dd('0x5a')](_0x506860[_0x82dd('0x4a')])),'ignore':[path[_0x82dd('0x4b')](path[_0x82dd('0x4f')](_0x506860[_0x82dd('0x4a')]),_0x82dd('0x5b')),path[_0x82dd('0x4b')](path[_0x82dd('0x4f')](_0x506860[_0x82dd('0x4a')]),'attachments/**/*')],'nodir':!![]})[_0x82dd('0x5c')]();_0x5391b4['on'](_0x82dd('0x5d'),function(){if(!fs[_0x82dd('0x5e')](_0x4058b0)){throw new db[(_0x82dd('0x54'))][(_0x82dd('0x56'))](_0x82dd('0x5f'));}return _0x5f51f7[_0x82dd('0x60')](_0x4058b0,util['format'](_0x82dd('0x61'),path['basename'](_0x506860['path'])),function(_0x175018){if(_0x175018){throw new db[(_0x82dd('0x54'))]['Error'](_0x82dd('0x62'));}fs[_0x82dd('0x63')](_0x4058b0);logger[_0x82dd('0x64')]('Download\x20completed');logger['info'](_0x82dd('0x65'));});});}return null;})[_0x82dd('0x44')](handleError(_0x5f51f7,null));};exports[_0x82dd('0x66')]=function(_0x401375,_0x596103,_0x10fe6e){var _0x5ab1b7=path[_0x82dd('0x4f')](_0x401375[_0x82dd('0x67')]['filename'],path['extname'](_0x401375[_0x82dd('0x67')]['filename']));var _0x23e5a2=path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),_0x401375[_0x82dd('0x67')][_0x82dd('0x68')]);var _0x1f0159=path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),_0x5ab1b7);logger[_0x82dd('0x64')](_0x82dd('0x69'),_0x23e5a2);logger[_0x82dd('0x64')](_0x82dd('0x6a'),_0x1f0159);try{fs[_0x82dd('0x6b')](_0x23e5a2,parseInt(_0x82dd('0x6c'),0x8));extract(_0x23e5a2,{'dir':_0x1f0159},function(_0x1f1aa6){if(_0x1f1aa6){logger[_0x82dd('0x2a')](_0x1f1aa6);handleError(_0x1f1aa6,!![]);};var _0x2fe0bc=fs[_0x82dd('0x6d')](_0x1f0159);if(_0x2fe0bc[_0x82dd('0x48')]>0x1){removeReferences(_0x23e5a2,_0x1f0159);logger[_0x82dd('0x2a')](_0x82dd('0x6e'));return _0x10fe6e(new Error(_0x82dd('0x6e')));}var _0xac78b1=fs[_0x82dd('0x6f')](path[_0x82dd('0x4b')](_0x1f0159,_0x2fe0bc[0x0]));if(_0xac78b1['isFile']()){removeReferences(_0x23e5a2,_0x1f0159);logger['error']('Invalid\x20plugin\x20structure');return _0x10fe6e(new Error(_0x82dd('0x6e')));}if(_0xac78b1[_0x82dd('0x70')]()){var _0x447658=fs[_0x82dd('0x6d')](path['join'](_0x1f0159,_0x2fe0bc[0x0]));if(_0x447658[_0x82dd('0x48')]===0x0){removeReferences(_0x23e5a2,_0x1f0159);logger[_0x82dd('0x2a')](_0x82dd('0x6e'));return _0x10fe6e(new Error(_0x82dd('0x6e')));}var _0xe04f06=_0x447658[_0x82dd('0x71')](function(_0x5bf279){return _0x5bf279===_0x82dd('0x72');});if(!_0xe04f06){return _0x10fe6e(new Error(_0x82dd('0x73')));}var _0x1e7b16=fs['readFileSync'](path[_0x82dd('0x4b')](_0x1f0159,_0x2fe0bc[0x0],_0x82dd('0x72')));var _0x4b8d99=JSON['parse'](_0x1e7b16);if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x2b')]){return _0x10fe6e(new Error(_0x82dd('0x74')));}if('undefined'==typeof _0x4b8d99[_0x82dd('0x3d')]){return _0x10fe6e(new Error(_0x82dd('0x75')));}if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x76')]){return _0x10fe6e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x82dd('0x20')==typeof _0x4b8d99['parameters']){return _0x10fe6e(new Error(_0x82dd('0x77')));}if(_0x4b8d99[_0x82dd('0x3d')]===_0x82dd('0x78')){if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x79')]['views']){return _0x10fe6e(new Error(_0x82dd('0x7a')));}if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x79')]['views'][_0x82dd('0x7b')]&&'undefined'==typeof _0x4b8d99['parameters']['views'][_0x82dd('0x7c')]){return _0x10fe6e(new Error(_0x82dd('0x7d')));}}else if(_0x4b8d99[_0x82dd('0x3d')]==='script'){if('undefined'==typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x7e')]){return _0x10fe6e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x79')]['scriptPath']){return _0x10fe6e(new Error(_0x82dd('0x7f')));}}else{return _0x10fe6e(new Error(_0x82dd('0x80')));}var _0x434446=_0x4b8d99[_0x82dd('0x2b')];var _0x34853e=_0x4b8d99[_0x82dd('0x81')];var _0x5d1c0c=_0x4b8d99[_0x82dd('0x3d')];var _0x217831=_0x4b8d99[_0x82dd('0x82')]?_0x4b8d99['sidebar']:_0x82dd('0x83');var _0x4c60de=_0x4b8d99['icon']?_0x4b8d99[_0x82dd('0x84')]:_0x82dd('0x85');var _0x45b2dc='';var _0x33d738='';var _0x32178d='';var _0x23885d='';var _0x3e40cc=_0x4b8d99[_0x82dd('0x76')];if(_0x5d1c0c===_0x82dd('0x78')){if('undefined'!=typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7b')]){var _0x30c1b4=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x30c1b4)){_0x45b2dc=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x30c1b4);}else{_0x45b2dc=_0x30c1b4;}}else{logger[_0x82dd('0x64')](_0x82dd('0x89'));}if('undefined'!=typeof _0x4b8d99['parameters'][_0x82dd('0x86')][_0x82dd('0x7c')]){var _0x56a067=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x56a067)){_0x33d738=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x56a067);}else{_0x33d738=_0x56a067;}}else{logger[_0x82dd('0x64')](_0x82dd('0x8a'));}}else if(_0x5d1c0c===_0x82dd('0x8b')){_0x32178d=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x7e')];_0x23885d=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x8c')];if(_0x82dd('0x20')!=typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')]){if(_0x82dd('0x20')!=typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7b')]){var _0x30c1b4=_0x4b8d99[_0x82dd('0x79')]['views'][_0x82dd('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x30c1b4)){_0x45b2dc=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x30c1b4);}else{_0x45b2dc=_0x30c1b4;}}if('undefined'!=typeof _0x4b8d99[_0x82dd('0x79')]['views'][_0x82dd('0x7c')]){var _0x56a067=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x56a067)){_0x33d738=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x56a067);}else{_0x33d738=_0x56a067;}}}}var _0x441209={'name':_0x434446,'description':_0x34853e,'path':path[_0x82dd('0x4b')](_0x5ab1b7,_0x2fe0bc[0x0]),'type':_0x5d1c0c,'sidebar':_0x217831,'icon':_0x4c60de,'adminUrl':_0x45b2dc,'agentUrl':_0x33d738,'scriptName':_0x32178d,'scriptPath':_0x23885d,'version':_0x3e40cc};removeReferences(_0x23e5a2,null);return db['Plugin'][_0x82dd('0x8d')](_0x441209)[_0x82dd('0x29')](function(_0x433845){var _0x1e70a1={'role':_0x401375[_0x82dd('0x8e')]['role'],'userProfileId':_0x401375['body'][_0x82dd('0x8f')]};if(!_0x1e70a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e70a1[_0x82dd('0x90')]===_0x82dd('0x91')){var _0x4f408c=_0x433845[_0x82dd('0x26')]({'plain':!![]});return db[_0x82dd('0x92')][_0x82dd('0x49')]({'where':{'name':_0x82dd('0x27'),'userProfileId':_0x1e70a1[_0x82dd('0x8f')]},'raw':!![]})[_0x82dd('0x29')](function(_0x24ac5e){if(_0x24ac5e&&_0x24ac5e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4f408c['name'],'resourceId':_0x4f408c['id'],'type':_0x24ac5e[_0x82dd('0x2b')],'sectionId':_0x24ac5e['id']},{})[_0x82dd('0x29')](function(){return _0x433845;});}else{return _0x433845;}})['catch'](function(_0x5c94e2){logger[_0x82dd('0x2a')](_0x82dd('0x93'),_0x5c94e2);throw _0x5c94e2;});}return _0x433845;})['then'](respondWithResult(_0x596103,null))['catch'](handleError(_0x596103,null));}});}catch(_0x1dba95){_0x596103['status'](0x1f4)['send'](_0x1dba95);}};function removeReferences(_0x2c0660,_0x53c042){try{if(_0x2c0660){fs[_0x82dd('0x63')](_0x2c0660);logger[_0x82dd('0x64')](_0x82dd('0x94'));}if(_0x53c042){rimraf(_0x53c042,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x180537){logger[_0x82dd('0x2a')](_0x180537);}}exports[_0x82dd('0x95')]=function(_0x130b88,_0x2c41a6,_0x5ec206){return db[_0x82dd('0x2d')][_0x82dd('0x49')]({'where':{'id':_0x130b88[_0x82dd('0x45')]['id']}})[_0x82dd('0x29')](handleEntityNotFound(_0x2c41a6,null))[_0x82dd('0x29')](saveUpdates(_0x130b88[_0x82dd('0x8e')],null))[_0x82dd('0x29')](respondWithResult(_0x2c41a6,null))['catch'](handleError(_0x2c41a6,null));};exports[_0x82dd('0x96')]=function(_0x2eb9b7,_0x1fb150,_0x398cb3){return db[_0x82dd('0x2d')]['find']({'where':{'id':_0x2eb9b7[_0x82dd('0x45')]['id']}})[_0x82dd('0x29')](function(_0x2f9994){if(_0x2f9994){return _0x2f9994[_0x82dd('0x28')]();}})[_0x82dd('0x29')](function(_0x41b884){rimraf(path['join'](config[_0x82dd('0x4c')],'server/files/plugins',path[_0x82dd('0x5a')](_0x41b884[_0x82dd('0x4a')])),function(){});return _0x41b884;})[_0x82dd('0x29')](handleEntityNotFound(_0x1fb150,null))['then'](respondWithStatusCode(_0x1fb150,null))[_0x82dd('0x44')](handleError(_0x1fb150,null));};exports[_0x82dd('0x97')]=function(_0x4a685a,_0x1f333c,_0x48eb4a){return BPromise['resolve']()['then'](function(){if(!_0x4a685a['query'][_0x82dd('0x4a')]){throw new Error(_0x82dd('0x98'));}if(!_0x4a685a[_0x82dd('0x31')][_0x82dd('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x306ea8=_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9a')]?_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9a')]+':'+_0x4a685a[_0x82dd('0x31')][_0x82dd('0x99')]:_0x82dd('0x9b')+_0x4a685a[_0x82dd('0x31')][_0x82dd('0x99')];var _0x2a4bee=_0x4a685a['query']['json']?_0x4a685a[_0x82dd('0x31')][_0x82dd('0x1e')]:!![];var _0x495b6c=_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9c')]?_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9c')]:null;var _0x4aef5d={'method':_0x4a685a['method'],'uri':util[_0x82dd('0x4e')](_0x82dd('0x9d'),_0x306ea8,_0x4a685a[_0x82dd('0x31')][_0x82dd('0x4a')]),'json':_0x2a4bee,'resolveWithFullResponse':!![],'encoding':_0x495b6c,'qs':_0x4a685a['query']};if(_0x4a685a['headers']){_0x4aef5d[_0x82dd('0x9e')]=_0x4a685a[_0x82dd('0x9e')];if(_0x4aef5d[_0x82dd('0x9e')]['content-length']){delete _0x4aef5d[_0x82dd('0x9e')][_0x82dd('0x9f')];}}if(_0x4aef5d['headers'][_0x82dd('0xa0')]){delete _0x4aef5d['headers'][_0x82dd('0xa0')];}return rp(_0x4aef5d);})[_0x82dd('0x29')](function(_0x3fe90e){if(_0x3fe90e){_0x1f333c[_0x82dd('0xa1')](_0x3fe90e[_0x82dd('0x9e')]);logger[_0x82dd('0x64')](_0x3fe90e['body']);if(_[_0x82dd('0xa2')](_0x4a685a[_0x82dd('0x31')][_0x82dd('0x4a')],_0x82dd('0x60'))&&_0x3fe90e[_0x82dd('0xa3')]==0x1f4){return _0x1f333c[_0x82dd('0x1b')](_0x3fe90e[_0x82dd('0xa3')]);}else{return _0x1f333c[_0x82dd('0x1c')](_0x3fe90e[_0x82dd('0xa3')])[_0x82dd('0xa4')](_0x3fe90e['body']);}}else{return _0x1f333c[_0x82dd('0x1b')](0xc8);}})[_0x82dd('0x44')](handleError(_0x1f333c,null));};exports[_0x82dd('0xa5')]=function(_0x2fae8b,_0x506c9c,_0x539468){return BPromise[_0x82dd('0xa6')]()['then'](function(){if(!_0x2fae8b['query'][_0x82dd('0x4a')]){throw new Error(_0x82dd('0x98'));}if(!_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x125234=_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x9a')]?_0x2fae8b[_0x82dd('0x31')]['hostname']+':'+_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x99')]:_0x82dd('0x9b')+_0x2fae8b['query'][_0x82dd('0x99')];var _0x5198e9=_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x1e')]?_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x1e')]:!![];var _0x7b1bf8=_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x9c')]?_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x9c')]:null;var _0x21aa21={'method':_0x2fae8b[_0x82dd('0xa7')],'uri':util['format'](_0x82dd('0x9d'),_0x125234,_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x4a')]),'json':_0x5198e9,'resolveWithFullResponse':!![],'encoding':_0x7b1bf8,'body':_0x2fae8b[_0x82dd('0x8e')]};if(_0x2fae8b[_0x82dd('0x9e')]){_0x21aa21[_0x82dd('0x9e')]=_0x2fae8b['headers'];if(_0x21aa21[_0x82dd('0x9e')][_0x82dd('0x9f')]){delete _0x21aa21['headers'][_0x82dd('0x9f')];}}if(_0x21aa21['headers']['content-type']){delete _0x21aa21[_0x82dd('0x9e')][_0x82dd('0xa0')];}return rp(_0x21aa21);})['then'](function(_0x507ae9){if(_0x507ae9){_0x506c9c[_0x82dd('0xa1')](_0x507ae9[_0x82dd('0x9e')]);logger[_0x82dd('0x64')](_0x507ae9['body']);return _0x506c9c[_0x82dd('0x1c')](_0x507ae9['statusCode'])[_0x82dd('0xa4')](_0x507ae9[_0x82dd('0x8e')]);}else{return _0x506c9c[_0x82dd('0x1b')](0xc8);}})[_0x82dd('0x44')](handleError(_0x506c9c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 28d4b29..c51db99 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 _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 +var _0x0619=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update','remove'];(function(_0x4113f8,_0x21f91c){var _0x1201d9=function(_0x1a5ebe){while(--_0x1a5ebe){_0x4113f8['push'](_0x4113f8['shift']());}};_0x1201d9(++_0x21f91c);}(_0x0619,0x90));var _0x9061=function(_0x3d46fb,_0x27709e){_0x3d46fb=_0x3d46fb-0x0;var _0x4ddbbf=_0x0619[_0x3d46fb];return _0x4ddbbf;};'use strict';var EventEmitter=require(_0x9061('0x0'));var Plugin=require(_0x9061('0x1'))['db'][_0x9061('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x9061('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9061('0x4'),'afterDestroy':_0x9061('0x5')};function emitEvent(_0x1f0fe8){return function(_0x1384a7,_0x1bc8ce,_0xa713e1){PluginEvents[_0x9061('0x6')](_0x1f0fe8+':'+_0x1384a7['id'],_0x1384a7);PluginEvents[_0x9061('0x6')](_0x1f0fe8,_0x1384a7);_0xa713e1(null);};}for(var e in events){if(events[_0x9061('0x7')](e)){var event=events[e];Plugin[_0x9061('0x8')](e,emitEvent(event));}}module[_0x9061('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 a092ed5..9dfef7c 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 _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 +var _0x18ae=['define','Plugin','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x1b0da1,_0x501aa6){var _0x19aeb5=function(_0x3334fa){while(--_0x3334fa){_0x1b0da1['push'](_0x1b0da1['shift']());}};_0x19aeb5(++_0x501aa6);}(_0x18ae,0x1c5));var _0xe18a=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x18ae[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0xe18a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe18a('0x1'));var BPromise=require(_0xe18a('0x2'));var rp=require(_0xe18a('0x3'));var fs=require('fs');var path=require(_0xe18a('0x4'));var rimraf=require(_0xe18a('0x5'));var config=require(_0xe18a('0x6'));var attributes=require(_0xe18a('0x7'));module[_0xe18a('0x8')]=function(_0x284bd9,_0x4683a1){return _0x284bd9[_0xe18a('0x9')](_0xe18a('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 76ffd27..d7143fe 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 _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 +var _0xd15d=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4b719b,_0x440b42){var _0x90fbee=function(_0xccfd7e){while(--_0xccfd7e){_0x4b719b['push'](_0x4b719b['shift']());}};_0x90fbee(++_0x440b42);}(_0xd15d,0xe1));var _0xdd15=function(_0x2d0d4b,_0x2e4c34){_0x2d0d4b=_0x2d0d4b-0x0;var _0x55a5dd=_0xd15d[_0x2d0d4b];return _0x55a5dd;};'use strict';var _=require(_0xdd15('0x0'));var util=require(_0xdd15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdd15('0x2'));var fs=require('fs');var Redis=require(_0xdd15('0x3'));var db=require(_0xdd15('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd15('0x5'))(_0xdd15('0x6'));var config=require(_0xdd15('0x7'));var jayson=require(_0xdd15('0x8'));var client=jayson['client'][_0xdd15('0x9')]({'port':0x232a});config[_0xdd15('0xa')]=_[_0xdd15('0xb')](config[_0xdd15('0xa')],{'host':_0xdd15('0xc'),'port':0x18eb});var socket=require(_0xdd15('0xd'))(new Redis(config[_0xdd15('0xa')]));require(_0xdd15('0xe'))['register'](socket);function respondWithRpcPromise(_0x64c710,_0x1ce611,_0x307d01){return new BPromise(function(_0x47a020,_0x3f9bfa){return client[_0xdd15('0xf')](_0x64c710,_0x307d01)['then'](function(_0x220822){logger[_0xdd15('0x10')](_0xdd15('0x11'),_0x1ce611,'request\x20sent');logger[_0xdd15('0x12')](_0xdd15('0x13'),_0x1ce611,_0xdd15('0x14'),JSON[_0xdd15('0x15')](_0x220822));if(_0x220822[_0xdd15('0x16')]){if(_0x220822[_0xdd15('0x16')][_0xdd15('0x17')]===0x1f4){logger[_0xdd15('0x16')](_0xdd15('0x11'),_0x1ce611,_0x220822['error'][_0xdd15('0x18')]);return _0x3f9bfa(_0x220822[_0xdd15('0x16')][_0xdd15('0x18')]);}logger[_0xdd15('0x16')](_0xdd15('0x11'),_0x1ce611,_0x220822[_0xdd15('0x16')][_0xdd15('0x18')]);return _0x47a020(_0x220822[_0xdd15('0x16')][_0xdd15('0x18')]);}else{logger[_0xdd15('0x10')](_0xdd15('0x11'),_0x1ce611,_0xdd15('0x14'));_0x47a020(_0x220822[_0xdd15('0x19')][_0xdd15('0x18')]);}})[_0xdd15('0x1a')](function(_0x2a8944){logger[_0xdd15('0x16')](_0xdd15('0x11'),_0x1ce611,_0x2a8944);_0x3f9bfa(_0x2a8944);});});}exports['CreatePlugin']=function(_0x348573){var _0x338edc=this;return new Promise(function(_0x5ac3af,_0x1105e6){return db[_0xdd15('0x1b')][_0xdd15('0x1c')](_0x348573[_0xdd15('0x1d')],{'raw':_0x348573['options']?_0x348573[_0xdd15('0x1e')][_0xdd15('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x54fc41){logger[_0xdd15('0x10')](_0xdd15('0x20'),_0x348573);logger[_0xdd15('0x12')](_0xdd15('0x20'),_0x348573,JSON[_0xdd15('0x15')](_0x54fc41));_0x5ac3af(_0x54fc41);})[_0xdd15('0x1a')](function(_0x348f04){logger[_0xdd15('0x16')](_0xdd15('0x20'),_0x348f04['message'],_0x348573);_0x1105e6(_0x338edc[_0xdd15('0x16')](0x1f4,_0x348f04[_0xdd15('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4df86de..3f9f364 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 _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 +var _0xb15c=['save','update','emit','removeListener','register','length','plugin:'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb15c,0x103));var _0xcb15=function(_0x595719,_0x475ccc){_0x595719=_0x595719-0x0;var _0x4226ff=_0xb15c[_0x595719];return _0x4226ff;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xcb15('0x0'),'remove',_0xcb15('0x1')];function createListener(_0x3e0cc9,_0x498187){return function(_0x3b0e23){_0x498187[_0xcb15('0x2')](_0x3e0cc9,_0x3b0e23);};}function removeListener(_0x401a0d,_0xe310b6){return function(){PluginEvents[_0xcb15('0x3')](_0x401a0d,_0xe310b6);};}exports[_0xcb15('0x4')]=function(_0x4234b6){for(var _0x2f1ade=0x0,_0x533f2f=events[_0xcb15('0x5')];_0x2f1ade<_0x533f2f;_0x2f1ade++){var _0x355823=events[_0x2f1ade];var _0x1a5d2a=createListener(_0xcb15('0x6')+_0x355823,_0x4234b6);PluginEvents['on'](_0x355823,_0x1a5d2a);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 86c63a0..98545a8 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(_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 +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x3c327d,_0x1c6652){var _0x15bdbe=function(_0x862b16){while(--_0x862b16){_0x3c327d['push'](_0x3c327d['shift']());}};_0x15bdbe(++_0x1c6652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 cdfe913..a7061f6 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3667=['lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','params','destroy','delete'];(function(_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 +var _0x9c44=['exec','bluebird','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','motion2','length','catch','body','script','join','../../files/plugins','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','../../config/logger','api','path','child_process'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var exec=require(_0x49c4('0x3'))[_0x49c4('0x4')];var BPromise=require(_0x49c4('0x5'));function handleEntityNotFound(_0x4e0313,_0x4941f1){return function(_0x41a183){if(!_0x41a183){_0x4e0313['sendStatus'](0x194);;}return _0x41a183;};}function respondWithResult(_0xc1278f,_0x6030ae){_0x6030ae=_0x6030ae||0xc8;return function(_0x69bc41){if(_0x69bc41){return _0xc1278f[_0x49c4('0x6')](_0x6030ae)[_0x49c4('0x7')](_0x69bc41);}return null;};}function handleError(_0x511d53,_0x11c586){_0x11c586=_0x11c586||0x1f4;return function(_0x42e4f8){logger[_0x49c4('0x8')](_0x42e4f8[_0x49c4('0x9')]);if(_0x42e4f8['name']){delete _0x42e4f8['name'];}_0x511d53[_0x49c4('0x6')](_0x11c586)[_0x49c4('0xa')](_0x42e4f8);};}function execChildProcess(){return new BPromise(function(_0x58cad7,_0xb611a1){exec(_0x49c4('0xb'),function(_0x4adb3c,_0x536d42,_0x1d19bf){logger[_0x49c4('0xc')](_0x536d42);logger['info'](_0x1d19bf);if(_0x4adb3c){logger[_0x49c4('0x8')](_0x4adb3c);return _0xb611a1(_0x4adb3c);}return _0x58cad7(_0x536d42);});});}exports[_0x49c4('0xd')]=function(_0x5f2fd9,_0x1909fe){return pm2[_0x49c4('0xe')]()[_0x49c4('0xf')](function(_0x2decee){if(_0x2decee){var _0x12777c=_[_0x49c4('0x10')](_0x2decee,function(_0x75ea8){return _0x75ea8[_0x49c4('0x11')]==='express'||_0x75ea8[_0x49c4('0x11')]===_0x49c4('0x12');});return{'rows':_0x12777c,'count':_0x12777c[_0x49c4('0x13')]};}return null;})[_0x49c4('0xf')](respondWithResult(_0x1909fe,null))[_0x49c4('0x14')](handleError(_0x1909fe,null));};exports['show']=function(_0x44e607,_0x2891f4){return pm2['describe'](_0x44e607['params']['id'])[_0x49c4('0xf')](respondWithResult(_0x2891f4,null))[_0x49c4('0xf')](handleEntityNotFound(_0x2891f4,null))[_0x49c4('0x14')](handleError(_0x2891f4,null));};exports['create']=function(_0x24856d,_0x50b151){if(_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')]&&_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]){var _0x382040=path[_0x49c4('0x17')](__dirname,_0x49c4('0x18'),_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]);var _0x578447=process['cwd']();process['chdir'](path[_0x49c4('0x19')](_0x382040));return execChildProcess()['then'](function(_0x592bb8){process[_0x49c4('0x1a')](_0x578447);return pm2[_0x49c4('0x1b')]({'name':_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')],'script':_0x382040});})['then'](function(_0x5850f2){pm2[_0x49c4('0x1c')]();return _0x5850f2[0x0];})[_0x49c4('0xf')](respondWithResult(_0x50b151,0xc9))['catch'](handleError(_0x50b151,null));}else{return _0x50b151[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x1d')});}};exports[_0x49c4('0x1e')]=function(_0x531d92,_0x543ea2){if(_0x531d92[_0x49c4('0x15')]['id']){delete _0x531d92['body']['id'];}var _0x3800b7={'online':_0x49c4('0x1f'),'stopped':_0x49c4('0x20')};if(_0x3800b7[_0x49c4('0x21')](_0x531d92['body'][_0x49c4('0x6')])){return pm2[_0x3800b7[_0x531d92[_0x49c4('0x15')][_0x49c4('0x6')]]](_0x531d92[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](respondWithResult(_0x543ea2,0xc8))[_0x49c4('0x14')](handleError(_0x543ea2,null));}else{return _0x543ea2[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x23')});}};exports[_0x49c4('0x24')]=function(_0x46f7ea,_0x4ea6ea){if(_0x46f7ea['body']['id']){delete _0x46f7ea['body']['id'];}if(_0x46f7ea[_0x49c4('0x22')]['id']){return pm2[_0x49c4('0x25')](_0x46f7ea[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](function(_0x28eb47){pm2['dump']();return _0x28eb47[0x0];})[_0x49c4('0xf')](respondWithResult(_0x4ea6ea,null))[_0x49c4('0x14')](handleError(_0x4ea6ea,null));}else{return _0x4ea6ea[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index bb71ca1..fd5a87c 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 _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 +var _0x7331=['get','/agents','getAgents','/queues','isAuthenticated','getQueues','express','Router','../../components/auth/service'];(function(_0x4f03e5,_0x16d974){var _0x2d4e1c=function(_0x487e9f){while(--_0x487e9f){_0x4f03e5['push'](_0x4f03e5['shift']());}};_0x2d4e1c(++_0x16d974);}(_0x7331,0x189));var _0x1733=function(_0x34c4ec,_0x4804f0){_0x34c4ec=_0x34c4ec-0x0;var _0x4defbf=_0x7331[_0x34c4ec];return _0x4defbf;};'use strict';var express=require(_0x1733('0x0'));var router=express[_0x1733('0x1')]();var auth=require(_0x1733('0x2'));var controller=require('./realtime.controller');router[_0x1733('0x3')](_0x1733('0x4'),auth['isAuthenticated'](),controller[_0x1733('0x5')]);router[_0x1733('0x3')](_0x1733('0x6'),auth[_0x1733('0x7')](),controller[_0x1733('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e37e938..fcbd3b0 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 _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 +var _0x1c08=['UserProfile','getResources','User','find','filterAgentAttributes','globalStatus','getAgentStatus','includes','voice','voiceStatus','Status','sortAgentsByStatus','pick','getQueues','resolve','startCase','outbound','dialActive','dialMethod','QueueCampaigns','Queues','name','filter','findAndCountAll','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','fields','join','then','getRealtimeAgents','rows','getAgentIdsByStatus','map','rawAttributes','fieldName','type','key','agent','getOptions','length','sequelize','literal','order','push','Pause','forEach','where','merge','user','role','userProfileId','Agents','online','extraQueryConditions','assign'];(function(_0x1816ae,_0x29ca4c){var _0x3173ec=function(_0x3ae04e){while(--_0x3ae04e){_0x1816ae['push'](_0x1816ae['shift']());}};_0x3173ec(++_0x29ca4c);}(_0x1c08,0x169));var _0x81c0=function(_0x5b6828,_0x4a19d9){_0x5b6828=_0x5b6828-0x0;var _0x2dbd2c=_0x1c08[_0x5b6828];return _0x2dbd2c;};'use strict';var _=require(_0x81c0('0x0'));var util=require(_0x81c0('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x81c0('0x2'));var qs=require(_0x81c0('0x3'));var utils=require(_0x81c0('0x4'));var db=require(_0x81c0('0x5'))['db'];var APIBadRequestError=require(_0x81c0('0x6'))[_0x81c0('0x7')];var APIHandleError=require('../../errors/api')[_0x81c0('0x8')];function respondWithFilteredResult(_0x43ed11,_0x7499f7){return function(_0x48fd44){if(_0x48fd44){var _0x20e7e1=typeof _0x7499f7[_0x81c0('0x9')]===_0x81c0('0xa')&&typeof _0x7499f7[_0x81c0('0xb')]==='undefined';var _0x565ca6=_0x48fd44[_0x81c0('0xc')];var _0x55dd4f=_0x20e7e1?0x0:_0x7499f7[_0x81c0('0x9')];var _0x2a5871=_0x20e7e1?_0x48fd44[_0x81c0('0xc')]:_0x7499f7['offset']+_0x7499f7[_0x81c0('0xb')];var _0x27019c;if(_0x2a5871>=_0x565ca6){_0x2a5871=_0x565ca6;_0x27019c=0xc8;}else{_0x27019c=0xce;}_0x43ed11['status'](_0x27019c);return _0x43ed11[_0x81c0('0xd')](_0x81c0('0xe'),_0x55dd4f+'-'+_0x2a5871+'/'+_0x565ca6)[_0x81c0('0xf')](_0x48fd44);}return null;};}exports[_0x81c0('0x10')]=function(_0x5f4440,_0x40875b){var _0x2619a6={'count':0x0,'rows':[]};var _0x162b73={};var _0x499e38;var _0x5a6b21=utils[_0x81c0('0x11')]();var _0xe5ecce;var _0xc43409;var _0x5613dc=_0x5f4440[_0x81c0('0x12')][_0x81c0('0x13')];var _0x1a2649=_0x5f4440[_0x81c0('0x12')][_0x81c0('0x14')];var _0x4b9a05=_0x5f4440[_0x81c0('0x12')][_0x81c0('0x15')];var _0x3e8062=_0x1a2649===_0x81c0('0x16')||_0x1a2649===_0x81c0('0x17')?!![]:![];var _0x17fabb=[];var _0x29a781;var _0x3cd2b0;Promise['resolve']()['then'](function(){if(_0x5f4440[_0x81c0('0x12')][_0x81c0('0x18')]){if(!utils[_0x81c0('0x19')](_0x5f4440['query'][_0x81c0('0x18')])){throw new APIBadRequestError(util[_0x81c0('0x1a')](_0x81c0('0x1b'),_0x5f4440[_0x81c0('0x12')]['channel']));}_0x499e38=_0x5f4440[_0x81c0('0x12')]['channel'][_0x81c0('0x1c')]();}if(!_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]||!_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]['includes']('globalStatus')){_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]=rta['validateSortParameter'](_0x5f4440[_0x81c0('0x12')]['sort']);return;}var _0x496d1a=rta['getUpdatedSortOptions'](_0x5f4440[_0x81c0('0x12')]['sort']);_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]=_0x496d1a[_0x81c0('0x1e')][_0x81c0('0x1f')](',');_0x29a781=_0x496d1a['order'];})[_0x81c0('0x20')](function(){if(!_0x5613dc){return[];}return rta['getAgentIdsByQueues'](_0x5613dc,_0x499e38);})['then'](function(_0x47dcf6){_0x17fabb=_0x47dcf6;return rta[_0x81c0('0x21')]();})[_0x81c0('0x20')](function(_0x1e83e5){_0xc43409=_0x1e83e5[_0x81c0('0x22')];if((!_0x1a2649||_0x3e8062)&&!_0x29a781){return _0x17fabb;}if(_0x29a781&&!_0x1a2649){return rta['getSortedAgentsIdsByStatus'](_0xc43409,_0x17fabb,_0x29a781);}else{return rta[_0x81c0('0x23')](_0xc43409,_0x17fabb,_0x1a2649);}})[_0x81c0('0x20')](function(_0x195c47){_0x17fabb=_0x195c47;var _0x56d021=![];if(_0x17fabb['length']===0x0){if(_0x5613dc||_0x1a2649){_0x56d021=!![];}if(_0x3e8062){_0x56d021=![];}}if(_0x56d021){return _0x2619a6;}var _0x425045=_[_0x81c0('0x24')](db['User'][_0x81c0('0x25')],function(_0x4c588c){return{'name':_0x4c588c[_0x81c0('0x26')],'type':_0x4c588c[_0x81c0('0x27')][_0x81c0('0x28')]};});_0x5f4440[_0x81c0('0x12')]['role']=_0x81c0('0x29');_0x162b73=qs[_0x81c0('0x2a')](_0x425045,_0x5f4440);_0x162b73['raw']=!![];var _0x3103ec=[];if(_0x17fabb[_0x81c0('0x2b')]>0x0){_0x3103ec['push']({'id':{'$in':_0x17fabb}});if(_0x29a781&&!_0x1a2649){_0x3cd2b0=[db[_0x81c0('0x2c')][_0x81c0('0x2d')]('FIELD(id,'+_0x17fabb+')')];_0x162b73[_0x81c0('0x2e')]=_0x3cd2b0;}}if(_0x3e8062){_0x5a6b21['forEach'](function(_0x66231a){var _0x4c5294=!![];if(_0x1a2649===_0x81c0('0x17')&&_0x499e38!==_0x66231a){_0x4c5294=![];}_0x3103ec[_0x81c0('0x2f')]({[_0x66231a+_0x81c0('0x30')]:_0x4c5294});});if(_0x4b9a05){_0x3103ec[_0x81c0('0x2f')]({'pauseType':_0x4b9a05});}}else if(_0x1a2649){_0x5a6b21[_0x81c0('0x31')](function(_0x4d90a0){_0x3103ec[_0x81c0('0x2f')]({[_0x4d90a0+_0x81c0('0x30')]:![]});});}_0x162b73[_0x81c0('0x32')]=_[_0x81c0('0x33')](_0x162b73['where'],{'$and':_0x3103ec});if(_0x5f4440[_0x81c0('0x34')][_0x81c0('0x35')]===_0x81c0('0x34')){var _0x170076={'params':{'id':_0x5f4440[_0x81c0('0x34')][_0x81c0('0x36')]},'query':{'section':_0x81c0('0x37'),'role':_0x81c0('0x29'),'raw':!![],'ids':_0x17fabb,'customSorting':_0x3cd2b0}};if(_0x5f4440[_0x81c0('0x12')][_0x81c0('0x38')]){_0x170076['query']['online']=!![];}if(_0x3e8062){_0x170076[_0x81c0('0x12')][_0x81c0('0x39')]=_0x3103ec;}_0x170076[_0x81c0('0x12')]=Object[_0x81c0('0x3a')](_0x170076[_0x81c0('0x12')],_['omit'](_0x5f4440[_0x81c0('0x12')],'id'));return db[_0x81c0('0x3b')][_0x81c0('0x3c')](_0x170076);}return db[_0x81c0('0x3d')]['findAndCountAll'](_0x162b73);})[_0x81c0('0x20')](function(_0x25a73f){_0x2619a6[_0x81c0('0xc')]=_0x25a73f[_0x81c0('0xc')];_0xe5ecce=_0x25a73f['rows'];return _0xe5ecce[_0x81c0('0x24')](function(_0x4cc77e){var _0x43f775=_[_0x81c0('0x3e')](_0xc43409,['id',_0x4cc77e['id']]);if(_0x43f775){var _0x189d1a=rta[_0x81c0('0x3f')](_0x43f775);_[_0x81c0('0x33')](_0x4cc77e,_0x189d1a);}_0x4cc77e[_0x81c0('0x40')]=rta[_0x81c0('0x41')](_0x4cc77e);if(_0x4cc77e[_0x81c0('0x40')][_0x81c0('0x42')](_0x81c0('0x16'))){_0x5a6b21[_0x81c0('0x31')](function(_0x427926){if(_0x4cc77e[_0x427926+'Pause']){if(_0x427926===_0x81c0('0x43')){if(_0x4cc77e[_0x81c0('0x44')]!=='talking'){_0x4cc77e[_0x81c0('0x44')]=_0x81c0('0x16');}}else{_0x4cc77e[_0x427926+_0x81c0('0x45')]=_0x81c0('0x16');}}});}return _0x4cc77e;});})['then'](function(_0x3e9986){if(!_0x29a781||_0x3cd2b0){return _0x3e9986;}return rta[_0x81c0('0x46')](_0x3e9986,_0x29a781);})[_0x81c0('0x20')](function(_0x5cf335){var _0x33f082=rta['getRealtimeAgentsQueryFields']();_0x2619a6[_0x81c0('0x22')]=_0x5cf335[_0x81c0('0x24')](function(_0x66790e){return _[_0x81c0('0x47')](_0x66790e,_0x33f082);});return _0x2619a6;})[_0x81c0('0x20')](respondWithFilteredResult(_0x40875b,_0x162b73))['catch'](APIHandleError(_0x40875b));};exports[_0x81c0('0x48')]=function(_0xa4d24d,_0x314dfe){var _0x25f7e5={'count':0x0,'rows':[]};var _0x3a8f4d={};var _0x2a528e;var _0x525498;var _0x15e4ca;Promise[_0x81c0('0x49')]()[_0x81c0('0x20')](function(){if(_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')]){if(!utils[_0x81c0('0x19')](_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')])){throw new APIBadRequestError(util[_0x81c0('0x1a')](_0x81c0('0x1b'),_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')]));}_0x2a528e=_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')][_0x81c0('0x1c')]();}var _0x4a6409=_[_0x81c0('0x4a')](_0x2a528e)+'Queue';var _0x2742a1=_[_0x81c0('0x24')](db[_0x4a6409][_0x81c0('0x25')],function(_0x53c8aa){return{'name':_0x53c8aa[_0x81c0('0x26')],'type':_0x53c8aa['type'][_0x81c0('0x28')]};});if(!_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x1e')]){var _0x57b259=['id','name'];if(_0x2a528e===_0x81c0('0x43')){_0x57b259['push'](_0x81c0('0x27'));if(_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x27')]===_0x81c0('0x4b')){_0x57b259[_0x81c0('0x2f')]([_0x81c0('0x4c'),_0x81c0('0x4d')]);}}_0xa4d24d['query'][_0x81c0('0x1e')]=_0x57b259[_0x81c0('0x1f')](',');}_0x3a8f4d=qs[_0x81c0('0x2a')](_0x2742a1,_0xa4d24d);if(_0xa4d24d[_0x81c0('0x34')]['role']===_0x81c0('0x34')){var _0x58c41d={'params':{'id':_0xa4d24d['user'][_0x81c0('0x36')]},'query':{'section':_0x2a528e===_0x81c0('0x43')&&_0xa4d24d['query'][_0x81c0('0x27')]===_0x81c0('0x4b')?_0x81c0('0x4e'):_[_0x81c0('0x4a')](_0x2a528e)+_0x81c0('0x4f'),'type':_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x27')],'nolimit':!![],'sort':_0x81c0('0x50'),'filter':_0xa4d24d['query'][_0x81c0('0x51')]}};_0x58c41d['query']=Object[_0x81c0('0x3a')](_0x58c41d[_0x81c0('0x12')],_0xa4d24d['query']);delete _0x58c41d['query']['id'];return db[_0x81c0('0x3b')][_0x81c0('0x3c')](_0x58c41d);}return db[_0x4a6409][_0x81c0('0x52')](_0x3a8f4d);})[_0x81c0('0x20')](function(_0x4f83b2){_0x25f7e5[_0x81c0('0xc')]=_0x4f83b2[_0x81c0('0xc')];_0x525498=_0x4f83b2[_0x81c0('0x22')];return rtq['getRealtimeQueues'](_0xa4d24d,_0x2a528e);})[_0x81c0('0x20')](function(_0x487ef3){_0x15e4ca=_0x487ef3['rows'];return rtq[_0x81c0('0x53')](_0x525498,_0x15e4ca,_0x2a528e,_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x27')]);})[_0x81c0('0x20')](function(_0x2ed314){_0x25f7e5['rows']=_0x2ed314;return _0x25f7e5;})[_0x81c0('0x20')](respondWithFilteredResult(_0x314dfe,_0x3a8f4d))['catch'](APIHandleError(_0x314dfe));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9a1fbf2..8c85579 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x275383,_0x21ad58){var _0x348e94=function(_0x45ddd5){while(--_0x45ddd5){_0x275383['push'](_0x275383['shift']());}};_0x348e94(++_0x21ad58);}(_0x70e0,0x17b));var _0x070e=function(_0x2be7c8,_0x3ffd42){_0x2be7c8=_0x2be7c8-0x0;var _0x1580c3=_0x70e0[_0x2be7c8];return _0x1580c3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index d03d9c4..4056931 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 _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 +var _0xe0c1=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x2ed13c,_0x190337){var _0x10cf06=function(_0x2d95cc){while(--_0x2d95cc){_0x2ed13c['push'](_0x2ed13c['shift']());}};_0x10cf06(++_0x190337);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x564e3e,_0x19524d){_0x564e3e=_0x564e3e-0x0;var _0x4e35dc=_0xe0c1[_0x564e3e];return _0x4e35dc;};'use strict';var Sequelize=require(_0x1e0c('0x0'));module[_0x1e0c('0x1')]={'state':{'type':Sequelize[_0x1e0c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1e0c('0x3')]},'scheduledat':{'type':Sequelize[_0x1e0c('0x4')]},'uniqueid':{'type':Sequelize[_0x1e0c('0x3')]},'starttime':{'type':Sequelize[_0x1e0c('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'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 b7a552b..358edc5 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 _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 +var _0xc4cb=['./reportAgentPreview.attributes','exports','define','lodash','util','request-promise','path','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc4cb,0x1a3));var _0xbc4c=function(_0x1d484c,_0x27c954){_0x1d484c=_0x1d484c-0x0;var _0xb2ec18=_0xc4cb[_0x1d484c];return _0xb2ec18;};'use strict';var _=require(_0xbc4c('0x0'));var util=require(_0xbc4c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc4c('0x2'));var fs=require('fs');var path=require(_0xbc4c('0x3'));var rimraf=require('rimraf');var config=require(_0xbc4c('0x4'));var attributes=require(_0xbc4c('0x5'));module[_0xbc4c('0x6')]=function(_0x3d2b7a,_0x4a6d2e){return _0x3d2b7a[_0xbc4c('0x7')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 51c35a4..92c098a 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 _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 +var _0xb05c=['http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb05c,0x1dd));var _0xcb05=function(_0xf58718,_0x33541a){_0xf58718=_0xf58718-0x0;var _0x5aea10=_0xb05c[_0xf58718];return _0x5aea10;};'use strict';var _=require('lodash');var util=require(_0xcb05('0x0'));var moment=require('moment');var BPromise=require(_0xcb05('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb05('0x2'));var db=require(_0xcb05('0x3'))['db'];var utils=require(_0xcb05('0x4'));var logger=require(_0xcb05('0x5'))(_0xcb05('0x6'));var config=require(_0xcb05('0x7'));var jayson=require(_0xcb05('0x8'));var client=jayson['client'][_0xcb05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe48e84,_0x56acb8,_0x6d97d4){return new BPromise(function(_0xdffd23,_0x2f7b1c){return client['request'](_0xe48e84,_0x6d97d4)[_0xcb05('0xa')](function(_0x2e3a98){logger[_0xcb05('0xb')](_0xcb05('0xc'),_0x56acb8,_0xcb05('0xd'));logger[_0xcb05('0xe')](_0xcb05('0xf'),_0x56acb8,_0xcb05('0xd'),JSON[_0xcb05('0x10')](_0x2e3a98));if(_0x2e3a98[_0xcb05('0x11')]){if(_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x12')]===0x1f4){logger[_0xcb05('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x56acb8,_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x13')]);return _0x2f7b1c(_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x13')]);}logger[_0xcb05('0x11')](_0xcb05('0xc'),_0x56acb8,_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x13')]);return _0xdffd23(_0x2e3a98[_0xcb05('0x11')]['message']);}else{logger[_0xcb05('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x56acb8,_0xcb05('0xd'));_0xdffd23(_0x2e3a98[_0xcb05('0x14')][_0xcb05('0x13')]);}})['catch'](function(_0x1f6fb5){logger['error'](_0xcb05('0xc'),_0x56acb8,_0x1f6fb5);_0x2f7b1c(_0x1f6fb5);});});}exports['CreateReportAgentPreview']=function(_0x43bc08){var _0x525e8=this;return new Promise(function(_0x5c3c33,_0x25c785){return db[_0xcb05('0x15')]['create'](_0x43bc08[_0xcb05('0x16')],{'raw':_0x43bc08[_0xcb05('0x17')]?_0x43bc08[_0xcb05('0x17')][_0xcb05('0x18')]===undefined?!![]:![]:!![]})[_0xcb05('0xa')](function(_0x3afd45){logger[_0xcb05('0xb')](_0xcb05('0x19'),_0x43bc08);logger[_0xcb05('0xe')]('CreateReportAgentPreview',_0x43bc08,JSON[_0xcb05('0x10')](_0x3afd45));_0x5c3c33(_0x3afd45);})[_0xcb05('0x1a')](function(_0x55124d){logger['error'](_0xcb05('0x19'),_0x55124d[_0xcb05('0x13')],_0x43bc08);_0x25c785(_0x525e8[_0xcb05('0x11')](0x1f4,_0x55124d[_0xcb05('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 240e15f..c91cf54 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 _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 +var _0xadf5=['whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xadf5,0xf1));var _0x5adf=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xadf5[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require(_0x5adf('0x0'));var util=require('util');var path=require(_0x5adf('0x1'));var express=require('express');var router=express[_0x5adf('0x2')]();var auth=require(_0x5adf('0x3'));var controller=require(_0x5adf('0x4'));router[_0x5adf('0x5')](_0x5adf('0x6'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x8')]);router[_0x5adf('0x5')](_0x5adf('0x9'),auth[_0x5adf('0x7')](),controller[_0x5adf('0xa')]);router['get'](_0x5adf('0xb'),auth[_0x5adf('0x7')](),controller[_0x5adf('0xc')]);router[_0x5adf('0x5')](_0x5adf('0xd'),auth[_0x5adf('0x7')](),controller[_0x5adf('0xe')]);router[_0x5adf('0x5')](_0x5adf('0xf'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x10')]);router[_0x5adf('0x5')](_0x5adf('0x11'),auth['isAuthenticated'](),controller[_0x5adf('0x12')]);router[_0x5adf('0x5')](_0x5adf('0x13'),auth[_0x5adf('0x7')](),controller['mailAccounts']);router[_0x5adf('0x5')]('/openchannel/queues',auth[_0x5adf('0x7')](),controller['openchannelQueues']);router['get'](_0x5adf('0x14'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x15')]);router[_0x5adf('0x5')](_0x5adf('0x16'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x17')]);router['get'](_0x5adf('0x18'),auth['isAuthenticated'](),controller[_0x5adf('0x19')]);router[_0x5adf('0x5')](_0x5adf('0x1a'),auth['isAuthenticated'](),controller[_0x5adf('0x1b')]);router[_0x5adf('0x5')](_0x5adf('0x1c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x1d')]);router[_0x5adf('0x5')](_0x5adf('0x1e'),auth['isAuthenticated'](),controller[_0x5adf('0x1f')]);router['get'](_0x5adf('0x20'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x21')]);router[_0x5adf('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5adf('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x5adf('0x5')](_0x5adf('0x22'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x23')]);router['put'](_0x5adf('0x22'),auth['isAuthenticated'](),controller[_0x5adf('0x24')]);router[_0x5adf('0x5')]('/outbound',auth[_0x5adf('0x7')](),controller[_0x5adf('0x25')]);router['get']('/outbound/channels',auth[_0x5adf('0x7')](),controller[_0x5adf('0x26')]);router[_0x5adf('0x5')](_0x5adf('0x27'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x28')]);router[_0x5adf('0x29')](_0x5adf('0x2a'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x5adf('0x5')](_0x5adf('0x2b'),auth[_0x5adf('0x7')](),controller['telephones']);router['get'](_0x5adf('0x2c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x2d')]);router[_0x5adf('0x5')](_0x5adf('0x2e'),auth['isAuthenticated'](),controller[_0x5adf('0x2f')]);router[_0x5adf('0x5')](_0x5adf('0x30'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x31')]);router[_0x5adf('0x5')](_0x5adf('0x32'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x33')]);router[_0x5adf('0x5')](_0x5adf('0x34'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x35')]);router[_0x5adf('0x5')](_0x5adf('0x36'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x37')]);router[_0x5adf('0x5')](_0x5adf('0x38'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x39')]);router[_0x5adf('0x5')](_0x5adf('0x3a'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x3b')]);router[_0x5adf('0x5')](_0x5adf('0x3c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x3d')]);router[_0x5adf('0x5')](_0x5adf('0x3e'),auth['isAuthenticated'](),controller[_0x5adf('0x3f')]);router[_0x5adf('0x40')](_0x5adf('0x41'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x43')));router[_0x5adf('0x5')](_0x5adf('0x44'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x45')]);router[_0x5adf('0x40')](_0x5adf('0x46'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x47')));router[_0x5adf('0x5')](_0x5adf('0x48'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x49')]);router[_0x5adf('0x40')](_0x5adf('0x4a'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')]('fax'));router[_0x5adf('0x5')]('/fax/queues/:id',auth[_0x5adf('0x7')](),controller[_0x5adf('0x4b')]);router[_0x5adf('0x40')](_0x5adf('0x4c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x4d')));router[_0x5adf('0x5')]('/openchannel/queues/:id',auth[_0x5adf('0x7')](),controller[_0x5adf('0x4e')]);router[_0x5adf('0x40')](_0x5adf('0x4f'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x50')));router['post'](_0x5adf('0x51'),auth['isAuthenticated'](),controller[_0x5adf('0x42')]('whatsapp'));router['get']('/sms/queues/:id',auth[_0x5adf('0x7')](),controller[_0x5adf('0x52')]);router[_0x5adf('0x5')](_0x5adf('0x53'),auth['isAuthenticated'](),controller[_0x5adf('0x54')]);router[_0x5adf('0x40')](_0x5adf('0x55'),auth['isAuthenticated'](),controller[_0x5adf('0x56')]);module[_0x5adf('0x57')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 34a9ada..f89c50a 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(_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 +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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 55ffd60..8da0691 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 _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 +var _0xff88=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/run','run','post','create','put','delete','destroy','exports','multer'];(function(_0x77fbf8,_0x31cf3f){var _0x2df250=function(_0x24b65f){while(--_0x24b65f){_0x77fbf8['push'](_0x77fbf8['shift']());}};_0x2df250(++_0x31cf3f);}(_0xff88,0x1e2));var _0x8ff8=function(_0x4de442,_0x5abd68){_0x4de442=_0x4de442-0x0;var _0x1d503a=_0xff88[_0x4de442];return _0x1d503a;};'use strict';var multer=require(_0x8ff8('0x0'));var util=require(_0x8ff8('0x1'));var path=require(_0x8ff8('0x2'));var timeout=require(_0x8ff8('0x3'));var express=require(_0x8ff8('0x4'));var router=express[_0x8ff8('0x5')]();var fs_extra=require(_0x8ff8('0x6'));var auth=require(_0x8ff8('0x7'));var interaction=require(_0x8ff8('0x8'));var config=require(_0x8ff8('0x9'));var controller=require('./schedule.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8ff8('0xa')]);router[_0x8ff8('0xb')](_0x8ff8('0xc'),auth[_0x8ff8('0xd')](),controller[_0x8ff8('0xe')]);router['get'](_0x8ff8('0xf'),auth[_0x8ff8('0xd')](),controller[_0x8ff8('0x10')]);router[_0x8ff8('0x11')]('/',auth[_0x8ff8('0xd')](),controller[_0x8ff8('0x12')]);router[_0x8ff8('0x13')](_0x8ff8('0xc'),auth[_0x8ff8('0xd')](),controller['update']);router[_0x8ff8('0x14')]('/:id',auth[_0x8ff8('0xd')](),controller[_0x8ff8('0x15')]);module[_0x8ff8('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 3583ecf..f55b5b0 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 _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 +var _0xe5e3=['years','quarters','hours','days','csv','pdf','xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x467ef6,_0x932cef){var _0x3e4aa2=function(_0xb56bb5){while(--_0xb56bb5){_0x467ef6['push'](_0x467ef6['shift']());}};_0x3e4aa2(++_0x932cef);}(_0xe5e3,0x1da));var _0x3e5e=function(_0x1af56e,_0x3cae62){_0x1af56e=_0x1af56e-0x0;var _0x511827=_0xe5e3[_0x1af56e];return _0x511827;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3e5e('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3e5e('0x0')]},'active':{'type':Sequelize[_0x3e5e('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3e5e('0x0')],'allowNull':![],'defaultValue':_0x3e5e('0x2')},'startAt':{'type':Sequelize[_0x3e5e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3e5e('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3e5e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3e5e('0x5')](_0x3e5e('0x6'),_0x3e5e('0x7'),'months','weeks','days',_0x3e5e('0x8'),'minutes'),'allowNull':![],'defaultValue':_0x3e5e('0x9')},'output':{'type':Sequelize[_0x3e5e('0x5')](_0x3e5e('0xa'),_0x3e5e('0xb'),_0x3e5e('0xc')),'allowNull':![],'defaultValue':_0x3e5e('0xa')},'type':{'type':Sequelize['ENUM'](_0x3e5e('0xd'),_0x3e5e('0xe')),'allowNull':![],'defaultValue':_0x3e5e('0xd')},'sendMail':{'type':Sequelize[_0x3e5e('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x3e5e('0x0')]},'cc':{'type':Sequelize[_0x3e5e('0xf')]},'bcc':{'type':Sequelize[_0x3e5e('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x3e5e('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f92621d..a4f961f 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 _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 +var _0x37ba=['length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','then','destroy','get','Scheduler','end','send','index','map','Schedule','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x37ba,0x1ac));var _0xa37b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x37ba[_0x485b5a];return _0xd2b34d;};'use strict';var emlformat=require(_0xa37b('0x0'));var rimraf=require(_0xa37b('0x1'));var zipdir=require(_0xa37b('0x2'));var jsonpatch=require(_0xa37b('0x3'));var rp=require(_0xa37b('0x4'));var moment=require(_0xa37b('0x5'));var BPromise=require(_0xa37b('0x6'));var Mustache=require(_0xa37b('0x7'));var util=require(_0xa37b('0x8'));var path=require(_0xa37b('0x9'));var sox=require('sox');var csv=require(_0xa37b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa37b('0xb'));var crypto=require(_0xa37b('0xc'));var jsforce=require(_0xa37b('0xd'));var deskjs=require(_0xa37b('0xe'));var toCsv=require(_0xa37b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa37b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa37b('0x10'));var as=require(_0xa37b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa37b('0x12'));var utils=require('../../config/utils');var config=require(_0xa37b('0x13'));var licenseUtil=require(_0xa37b('0x14'));var db=require(_0xa37b('0x15'))['db'];function respondWithStatusCode(_0x12578c,_0x3fe8f0){_0x3fe8f0=_0x3fe8f0||0xcc;return function(_0xceff7b){if(_0xceff7b){return _0x12578c[_0xa37b('0x16')](_0x3fe8f0);}return _0x12578c[_0xa37b('0x17')](_0x3fe8f0)['end']();};}function respondWithResult(_0x3b0bc4,_0x16b81b){_0x16b81b=_0x16b81b||0xc8;return function(_0x123218){if(_0x123218){return _0x3b0bc4[_0xa37b('0x17')](_0x16b81b)[_0xa37b('0x18')](_0x123218);}};}function respondWithFilteredResult(_0xea3a0,_0x54ce10){return function(_0x45348d){if(_0x45348d){var _0x7fc15e=typeof _0x54ce10[_0xa37b('0x19')]===_0xa37b('0x1a')&&typeof _0x54ce10['limit']===_0xa37b('0x1a');var _0x350067=_0x45348d[_0xa37b('0x1b')];var _0x562503=_0x7fc15e?0x0:_0x54ce10['offset'];var _0x1121ab=_0x7fc15e?_0x45348d['count']:_0x54ce10[_0xa37b('0x19')]+_0x54ce10[_0xa37b('0x1c')];var _0x3bab55;if(_0x1121ab>=_0x350067){_0x1121ab=_0x350067;_0x3bab55=0xc8;}else{_0x3bab55=0xce;}_0xea3a0[_0xa37b('0x17')](_0x3bab55);return _0xea3a0[_0xa37b('0x1d')]('Content-Range',_0x562503+'-'+_0x1121ab+'/'+_0x350067)[_0xa37b('0x18')](_0x45348d);}return null;};}function patchUpdates(_0x5548ba){return function(_0x1362a6){try{jsonpatch['apply'](_0x1362a6,_0x5548ba,!![]);}catch(_0xa6adc5){return BPromise[_0xa37b('0x1e')](_0xa6adc5);}return _0x1362a6['save']();};}function saveUpdates(_0x38dd5a,_0x5e7080){return function(_0x176085){if(_0x176085){return _0x176085['update'](_0x38dd5a)[_0xa37b('0x1f')](function(_0x1d7b0a){return _0x1d7b0a;});}return null;};}function removeEntity(_0x550e90,_0x45ffd3){return function(_0x190126){if(_0x190126){return _0x190126[_0xa37b('0x20')]()['then'](function(){var _0x5e3d0d=_0x190126[_0xa37b('0x21')]({'plain':!![]});var _0x3530df=_0xa37b('0x22');return db['UserProfileResource'][_0xa37b('0x20')]({'where':{'type':_0x3530df,'resourceId':_0x5e3d0d['id']}})[_0xa37b('0x1f')](function(){return _0x190126;});})[_0xa37b('0x1f')](function(){_0x550e90[_0xa37b('0x17')](0xcc)[_0xa37b('0x23')]();});}};}function handleEntityNotFound(_0x56daff,_0x2e8e13){return function(_0x33a298){if(!_0x33a298){_0x56daff[_0xa37b('0x16')](0x194);}return _0x33a298;};}function handleError(_0x29b308,_0x2ff214){_0x2ff214=_0x2ff214||0x1f4;return function(_0x4e1ac3){logger['error'](_0x4e1ac3['stack']);if(_0x4e1ac3['name']){delete _0x4e1ac3['name'];}_0x29b308[_0xa37b('0x17')](_0x2ff214)[_0xa37b('0x24')](_0x4e1ac3);};}exports[_0xa37b('0x25')]=function(_0x4f29e2,_0x1e5696){var _0x55e9bd={},_0x13d7a2={},_0x5beab5={'count':0x0,'rows':[]};var _0x355341=_[_0xa37b('0x26')](db[_0xa37b('0x27')][_0xa37b('0x28')],function(_0x3289ec){return{'name':_0x3289ec[_0xa37b('0x29')],'type':_0x3289ec[_0xa37b('0x2a')][_0xa37b('0x2b')]};});_0x13d7a2['model']=_['map'](_0x355341,_0xa37b('0x2c'));_0x13d7a2[_0xa37b('0x2d')]=_[_0xa37b('0x2e')](_0x4f29e2[_0xa37b('0x2d')]);_0x13d7a2[_0xa37b('0x2f')]=_['intersection'](_0x13d7a2[_0xa37b('0x30')],_0x13d7a2[_0xa37b('0x2d')]);_0x55e9bd[_0xa37b('0x31')]=_[_0xa37b('0x32')](_0x13d7a2[_0xa37b('0x30')],qs[_0xa37b('0x33')](_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x33')]));_0x55e9bd[_0xa37b('0x31')]=_0x55e9bd['attributes'][_0xa37b('0x34')]?_0x55e9bd['attributes']:_0x13d7a2[_0xa37b('0x30')];if(!_0x4f29e2[_0xa37b('0x2d')]['hasOwnProperty']('nolimit')){_0x55e9bd[_0xa37b('0x1c')]=qs[_0xa37b('0x1c')](_0x4f29e2['query'][_0xa37b('0x1c')]);_0x55e9bd[_0xa37b('0x19')]=qs[_0xa37b('0x19')](_0x4f29e2[_0xa37b('0x2d')]['offset']);}_0x55e9bd[_0xa37b('0x35')]=qs[_0xa37b('0x36')](_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x36')]);_0x55e9bd[_0xa37b('0x37')]=qs[_0xa37b('0x2f')](_[_0xa37b('0x38')](_0x4f29e2['query'],_0x13d7a2['filters']),_0x355341);if(_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x39')]){_0x55e9bd[_0xa37b('0x37')]=_[_0xa37b('0x3a')](_0x55e9bd[_0xa37b('0x37')],{'$or':_['map'](_0x355341,function(_0x5f1a2c){if(_0x5f1a2c[_0xa37b('0x2a')]!==_0xa37b('0x3b')){var _0x47bedd={};_0x47bedd[_0x5f1a2c[_0xa37b('0x2c')]]={'$like':'%'+_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x39')]+'%'};return _0x47bedd;}})});}_0x55e9bd=_['merge']({},_0x55e9bd,_0x4f29e2[_0xa37b('0x3c')]);var _0xe556df={'where':_0x55e9bd[_0xa37b('0x37')]};return db[_0xa37b('0x27')][_0xa37b('0x1b')](_0xe556df)[_0xa37b('0x1f')](function(_0x591c6a){_0x5beab5['count']=_0x591c6a;if(_0x4f29e2['query'][_0xa37b('0x3d')]){_0x55e9bd['include']=[{'all':!![]}];}return db[_0xa37b('0x27')]['findAll'](_0x55e9bd);})[_0xa37b('0x1f')](function(_0x34fdcd){_0x5beab5[_0xa37b('0x3e')]=_0x34fdcd;return _0x5beab5;})[_0xa37b('0x1f')](respondWithFilteredResult(_0x1e5696,_0x55e9bd))[_0xa37b('0x3f')](handleError(_0x1e5696,null));};exports[_0xa37b('0x40')]=function(_0x592fc9,_0xd332dc){var _0x2736a3={'raw':![],'where':{'id':_0x592fc9['params']['id']}},_0x1abca6={};_0x1abca6[_0xa37b('0x30')]=_[_0xa37b('0x2e')](db[_0xa37b('0x27')][_0xa37b('0x28')]);_0x1abca6[_0xa37b('0x2d')]=_[_0xa37b('0x2e')](_0x592fc9[_0xa37b('0x2d')]);_0x1abca6['filters']=_[_0xa37b('0x32')](_0x1abca6[_0xa37b('0x30')],_0x1abca6[_0xa37b('0x2d')]);_0x2736a3['attributes']=_[_0xa37b('0x32')](_0x1abca6['model'],qs[_0xa37b('0x33')](_0x592fc9[_0xa37b('0x2d')]['fields']));_0x2736a3[_0xa37b('0x31')]=_0x2736a3[_0xa37b('0x31')][_0xa37b('0x34')]?_0x2736a3['attributes']:_0x1abca6[_0xa37b('0x30')];if(_0x592fc9[_0xa37b('0x2d')][_0xa37b('0x3d')]){_0x2736a3['include']=[{'all':!![]}];}_0x2736a3=_[_0xa37b('0x3a')]({},_0x2736a3,_0x592fc9[_0xa37b('0x3c')]);return db[_0xa37b('0x27')][_0xa37b('0x41')](_0x2736a3)[_0xa37b('0x1f')](handleEntityNotFound(_0xd332dc,null))[_0xa37b('0x1f')](respondWithResult(_0xd332dc,null))[_0xa37b('0x3f')](handleError(_0xd332dc,null));};exports[_0xa37b('0x42')]=function(_0x3c5af2,_0x1d3d24){return db[_0xa37b('0x27')][_0xa37b('0x42')](_0x3c5af2['body'],{})['then'](function(_0x1c0842){var _0x17c556=_0x3c5af2[_0xa37b('0x43')][_0xa37b('0x21')]({'plain':!![]});if(!_0x17c556)throw new Error(_0xa37b('0x44'));if(_0x17c556[_0xa37b('0x45')]===_0xa37b('0x43')){var _0x4009b1=_0x1c0842[_0xa37b('0x21')]({'plain':!![]});var _0x72ae96='Scheduler';return db['UserProfileSection'][_0xa37b('0x41')]({'where':{'name':_0x72ae96,'userProfileId':_0x17c556[_0xa37b('0x46')]},'raw':!![]})[_0xa37b('0x1f')](function(_0x5eebce){if(_0x5eebce&&_0x5eebce[_0xa37b('0x47')]===0x0){return db[_0xa37b('0x48')][_0xa37b('0x42')]({'name':_0x4009b1[_0xa37b('0x2c')],'resourceId':_0x4009b1['id'],'type':_0x5eebce[_0xa37b('0x2c')],'sectionId':_0x5eebce['id']},{})[_0xa37b('0x1f')](function(){return _0x1c0842;});}else{return _0x1c0842;}})[_0xa37b('0x3f')](function(_0x50d048){logger[_0xa37b('0x49')](_0xa37b('0x4a'),_0x50d048);throw _0x50d048;});}return _0x1c0842;})[_0xa37b('0x1f')](respondWithResult(_0x1d3d24,0xc9))[_0xa37b('0x3f')](handleError(_0x1d3d24,null));};exports[_0xa37b('0x4b')]=function(_0x103b55,_0x3e7b23){if(_0x103b55['body']['id']){delete _0x103b55[_0xa37b('0x4c')]['id'];}return db['Schedule'][_0xa37b('0x41')]({'where':{'id':_0x103b55[_0xa37b('0x4d')]['id']}})[_0xa37b('0x1f')](handleEntityNotFound(_0x3e7b23,null))[_0xa37b('0x1f')](saveUpdates(_0x103b55[_0xa37b('0x4c')],null))[_0xa37b('0x1f')](respondWithResult(_0x3e7b23,null))['catch'](handleError(_0x3e7b23,null));};exports['destroy']=function(_0x45c275,_0x49e115){return db[_0xa37b('0x27')][_0xa37b('0x41')]({'where':{'id':_0x45c275[_0xa37b('0x4d')]['id']}})[_0xa37b('0x1f')](handleEntityNotFound(_0x49e115,null))[_0xa37b('0x1f')](removeEntity(_0x49e115,null))['catch'](handleError(_0x49e115,null));};exports['run']=function(_0x44a4b1,_0x4a76f5,_0x2a5c92){var _0x55ff2=require(_0xa37b('0x4e'));return db['Schedule'][_0xa37b('0x41')]({'where':{'id':_0x44a4b1[_0xa37b('0x4d')]['id']},'raw':!![]})[_0xa37b('0x1f')](handleEntityNotFound(_0x4a76f5,null))['then'](function(){_0x55ff2[_0xa37b('0x4f')](_0x44a4b1[_0xa37b('0x4d')]['id']);})[_0xa37b('0x1f')](respondWithStatusCode(_0x4a76f5,null))[_0xa37b('0x3f')](handleError(_0x4a76f5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1825e86..bfd21e1 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 _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 +var _0x14c5=['define','Schedule','tools_schedules','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x48c2e9,_0x2ba941){var _0x3e6c24=function(_0x316cdc){while(--_0x316cdc){_0x48c2e9['push'](_0x48c2e9['shift']());}};_0x3e6c24(++_0x2ba941);}(_0x14c5,0xdf));var _0x514c=function(_0x4767fa,_0x367ed9){_0x4767fa=_0x4767fa-0x0;var _0x1fc61a=_0x14c5[_0x4767fa];return _0x1fc61a;};'use strict';var _=require(_0x514c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x514c('0x1'));var BPromise=require(_0x514c('0x2'));var rp=require(_0x514c('0x3'));var fs=require('fs');var path=require(_0x514c('0x4'));var rimraf=require(_0x514c('0x5'));var config=require(_0x514c('0x6'));var attributes=require('./schedule.attributes');module[_0x514c('0x7')]=function(_0x867848,_0x3b97c7){return _0x867848[_0x514c('0x8')](_0x514c('0x9'),attributes,{'tableName':_0x514c('0xa'),'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 61f22ac..7a9a188 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 _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 +var _0xc029=['debug','error','Schedule,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x534a4b,_0x44c67a){var _0x311ed6=function(_0x48b06a){while(--_0x48b06a){_0x534a4b['push'](_0x534a4b['shift']());}};_0x311ed6(++_0x44c67a);}(_0xc029,0x7d));var _0x9c02=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xc029[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var moment=require(_0x9c02('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c02('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c02('0x4'))['db'];var utils=require(_0x9c02('0x5'));var logger=require('../../config/logger')(_0x9c02('0x6'));var config=require(_0x9c02('0x7'));var jayson=require(_0x9c02('0x8'));var client=jayson[_0x9c02('0x9')][_0x9c02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c1378,_0x4ce8de,_0x362894){return new BPromise(function(_0x5da18d,_0x23f873){return client[_0x9c02('0xb')](_0x2c1378,_0x362894)[_0x9c02('0xc')](function(_0x190af8){logger[_0x9c02('0xd')]('Schedule,\x20%s,\x20%s',_0x4ce8de,_0x9c02('0xe'));logger[_0x9c02('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4ce8de,_0x9c02('0xe'),JSON['stringify'](_0x190af8));if(_0x190af8[_0x9c02('0x10')]){if(_0x190af8['error']['code']===0x1f4){logger[_0x9c02('0x10')](_0x9c02('0x11'),_0x4ce8de,_0x190af8['error']['message']);return _0x23f873(_0x190af8[_0x9c02('0x10')][_0x9c02('0x12')]);}logger[_0x9c02('0x10')]('Schedule,\x20%s,\x20%s',_0x4ce8de,_0x190af8['error']['message']);return _0x5da18d(_0x190af8['error'][_0x9c02('0x12')]);}else{logger[_0x9c02('0xd')]('Schedule,\x20%s,\x20%s',_0x4ce8de,'request\x20sent');_0x5da18d(_0x190af8[_0x9c02('0x13')][_0x9c02('0x12')]);}})['catch'](function(_0x1c2a6f){logger['error'](_0x9c02('0x11'),_0x4ce8de,_0x1c2a6f);_0x23f873(_0x1c2a6f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c063233..638a12f 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 _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 +var _0xac5e=['describe','/:id','show','/:id/download','download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0xac5e,0x172));var _0xeac5=function(_0x57d624,_0x453030){_0x57d624=_0x57d624-0x0;var _0x35663b=_0xac5e[_0x57d624];return _0x35663b;};'use strict';var multer=require(_0xeac5('0x0'));var util=require(_0xeac5('0x1'));var path=require(_0xeac5('0x2'));var timeout=require(_0xeac5('0x3'));var express=require(_0xeac5('0x4'));var router=express['Router']();var fs_extra=require(_0xeac5('0x5'));var auth=require(_0xeac5('0x6'));var interaction=require(_0xeac5('0x7'));var config=require(_0xeac5('0x8'));var controller=require(_0xeac5('0x9'));router[_0xeac5('0xa')]('/',auth[_0xeac5('0xb')](),controller[_0xeac5('0xc')]);router[_0xeac5('0xa')](_0xeac5('0xd'),auth[_0xeac5('0xb')](),controller[_0xeac5('0xe')]);router['get'](_0xeac5('0xf'),auth[_0xeac5('0xb')](),controller[_0xeac5('0x10')]);router['get'](_0xeac5('0x11'),auth['isAuthenticated'](),controller[_0xeac5('0x12')]);router[_0xeac5('0x13')]('/',auth[_0xeac5('0xb')](),controller['create']);router['put'](_0xeac5('0xf'),auth[_0xeac5('0xb')](),controller[_0xeac5('0x14')]);router[_0xeac5('0x15')](_0xeac5('0xf'),auth[_0xeac5('0xb')](),controller[_0xeac5('0x16')]);module[_0xeac5('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d1cee5f..1f085de 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 _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 +var _0x57ef=['duration','DATE','startedAt','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','setDataValue','subtract'];(function(_0x2e1511,_0x1ea390){var _0x3a2aa0=function(_0x45cee1){while(--_0x45cee1){_0x2e1511['push'](_0x2e1511['shift']());}};_0x3a2aa0(++_0x1ea390);}(_0x57ef,0xdb));var _0xf57e=function(_0x5e4140,_0xb8f3f0){_0x5e4140=_0x5e4140-0x0;var _0x1a5b7e=_0x57ef[_0x5e4140];return _0x1a5b7e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf57e('0x0'));var path=require(_0xf57e('0x1'));var config=require(_0xf57e('0x2'));module[_0xf57e('0x3')]={'format':{'type':Sequelize[_0xf57e('0x4')],'get':function(){return this[_0xf57e('0x5')](_0xf57e('0x6'))?path['extname'](this[_0xf57e('0x5')](_0xf57e('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xf57e('0x7')]},'channel':{'type':Sequelize[_0xf57e('0x7')]},'value':{'type':Sequelize[_0xf57e('0x7')],'set':function(_0x2f47b5){var _0x2498c5=_0x2f47b5[_0xf57e('0x8')](/\\/g,'/');this['setDataValue'](_0xf57e('0x6'),_0x2498c5);}},'rating':{'type':Sequelize[_0xf57e('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xf57e('0x9')],'set':function(_0x2430b1){this[_0xf57e('0xa')]('startedAt',moment()[_0xf57e('0xb')](_0x2430b1,'ms'));this[_0xf57e('0xa')]('closedAt',moment());this[_0xf57e('0xa')](_0xf57e('0xc'),_0x2430b1);}},'startedAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0xe')))[_0xf57e('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xf57e('0x10')]();}},'closedAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0x11')))[_0xf57e('0xf')](_0xf57e('0x12'))[_0xf57e('0x10')]();}},'createdAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0x13')))[_0xf57e('0xf')](_0xf57e('0x12'))[_0xf57e('0x10')]();}},'updatedAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0x14')))[_0xf57e('0xf')](_0xf57e('0x12'))[_0xf57e('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 7593a38..5082908 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 _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 +var _0x46ed=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','params','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','filters'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['differenceBy'](_[_0xd46e('0x2a')](_0x106edc,_0xd46e('0x27')),[_0xd46e('0x31')]);_0x2d1afe[_0xd46e('0x32')]=_['keys'](_0x58aeef[_0xd46e('0x32')]);_0x2d1afe[_0xd46e('0x33')]=_['intersection'](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe[_0xd46e('0x32')]);_0x3a1ced['attributes']=_[_0xd46e('0x34')](_0x2d1afe[_0xd46e('0x30')],qs[_0xd46e('0x35')](_0x58aeef['query']['fields']));_0x3a1ced[_0xd46e('0x36')]=_0x3a1ced[_0xd46e('0x36')][_0xd46e('0x37')]?_0x3a1ced[_0xd46e('0x36')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x32')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x3a1ced['limit']=qs[_0xd46e('0x1d')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1c')]);}_0x3a1ced['order']=qs[_0xd46e('0x3a')](_0x58aeef[_0xd46e('0x32')]['sort']);_0x3a1ced[_0xd46e('0x3b')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x32')],_0x2d1afe['filters']),_0x106edc);if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0x220c57){if(_0x220c57[_0xd46e('0x2e')]!=='VIRTUAL'){var _0x232e6f={};_0x232e6f[_0x220c57[_0xd46e('0x27')]]={'$like':'%'+_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]+'%'};return _0x232e6f;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef['options']);var _0x964c66={'where':_0x3a1ced['where']};return db['ScreenRecording']['count'](_0x964c66)['then'](function(_0x17c3d9){_0xa716ce['count']=_0x17c3d9;if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x3a1ced['include']=[{'all':!![]}];}return db[_0xd46e('0x2b')][_0xd46e('0x40')](_0x3a1ced);})[_0xd46e('0x25')](function(_0x31ba12){_0xa716ce[_0xd46e('0x41')]=_0x31ba12;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x42')](handleError(_0x465d54,null));};exports[_0xd46e('0x43')]=function(_0x3a98e4,_0xec367d){var _0x259e2={'raw':![],'where':{'id':_0x3a98e4['params']['id']}},_0x5ea048={};_0x5ea048['model']=_[_0xd46e('0x44')](db['ScreenRecording'][_0xd46e('0x2c')]);_0x5ea048[_0xd46e('0x32')]=_[_0xd46e('0x44')](_0x3a98e4[_0xd46e('0x32')]);_0x5ea048[_0xd46e('0x33')]=_[_0xd46e('0x34')](_0x5ea048[_0xd46e('0x30')],_0x5ea048[_0xd46e('0x32')]);_0x259e2['attributes']=_[_0xd46e('0x34')](_0x5ea048['model'],qs[_0xd46e('0x35')](_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x35')]));_0x259e2[_0xd46e('0x36')]=_0x259e2[_0xd46e('0x36')]['length']?_0x259e2[_0xd46e('0x36')]:_0x5ea048[_0xd46e('0x30')];if(_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x259e2[_0xd46e('0x45')]=[{'all':!![]}];}_0x259e2=_['merge']({},_0x259e2,_0x3a98e4[_0xd46e('0x46')]);return db[_0xd46e('0x2b')][_0xd46e('0x47')](_0x259e2)[_0xd46e('0x25')](handleEntityNotFound(_0xec367d,null))[_0xd46e('0x25')](respondWithResult(_0xec367d,null))['catch'](handleError(_0xec367d,null));};exports[_0xd46e('0x48')]=function(_0x3ea9e6,_0x45baf1){return db[_0xd46e('0x2b')][_0xd46e('0x48')](_0x3ea9e6[_0xd46e('0x49')],{})[_0xd46e('0x25')](respondWithResult(_0x45baf1,0xc9))[_0xd46e('0x42')](handleError(_0x45baf1,null));};exports['update']=function(_0xf9dab,_0x71a8dc){if(_0xf9dab[_0xd46e('0x49')]['id']){delete _0xf9dab[_0xd46e('0x49')]['id'];}delete _0xf9dab[_0xd46e('0x49')]['duration'];delete _0xf9dab['body'][_0xd46e('0x4a')];delete _0xf9dab[_0xd46e('0x49')][_0xd46e('0x4b')];delete _0xf9dab['body']['value'];return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0xf9dab['params']['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x71a8dc,null))[_0xd46e('0x25')](saveUpdates(_0xf9dab[_0xd46e('0x49')],null))[_0xd46e('0x25')](respondWithResult(_0x71a8dc,null))[_0xd46e('0x42')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x4c')]=function(_0x80ed51,_0x16ca0e){return db['ScreenRecording'][_0xd46e('0x4c')]()[_0xd46e('0x25')](respondWithResult(_0x16ca0e,null))[_0xd46e('0x42')](handleError(_0x16ca0e,null));};exports[_0xd46e('0x4d')]=function(_0x4ec295,_0x56dd9a,_0xced102){var _0x5a4a44=require(_0xd46e('0x4e'));var _0x2af20b=![];var _0x393cb9={};if(_0x4ec295[_0xd46e('0x32')][_0xd46e('0x2e')]&&_0x4ec295[_0xd46e('0x32')]['type']===_0xd46e('0x4f')){_0x393cb9[_0xd46e('0x4f')]=_0x4ec295[_0xd46e('0x50')]['id'];}else{_0x393cb9['id']=_0x4ec295['params']['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':_0x393cb9,'attributes':['id',_0xd46e('0x51')],'raw':!![]})[_0xd46e('0x25')](handleEntityNotFound(_0x56dd9a,null))[_0xd46e('0x25')](function(_0x2cc676){if(_0x2cc676){var _0x2760ef=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x2cc676[_0xd46e('0x51')]);var _0x411b19=util[_0xd46e('0x31')](_0xd46e('0x55'),_0x2760ef);if(fs['existsSync'](_0x411b19)){_0x2af20b=!![];return _0x5a4a44[_0xd46e('0x56')](_0x411b19,_0x2760ef,config[_0xd46e('0x57')][_0xd46e('0x58')])[_0xd46e('0x25')](function(){return _0x2cc676;});}return _0x2cc676;}})['then'](function(_0x636f15){if(_0x636f15){var _0x36e18a=path[_0xd46e('0x52')](config[_0xd46e('0x53')],'server/files/screen_recordings',_0x636f15[_0xd46e('0x51')]);if(!fs[_0xd46e('0x59')](_0x36e18a)){throw new db['Sequelize']['ValidationError'](_0xd46e('0x5a'));}if(_0x636f15[_0xd46e('0x5b')]){return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,_0x636f15['filename']+path['extname'](_0x36e18a),function(){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}else{return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,function(_0x1f310d){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}}})[_0xd46e('0x42')](function(_0x2f9fcb){if(_0x2f9fcb[_0xd46e('0x5d')]===_0xd46e('0x5a')){_0x56dd9a[_0xd46e('0x1b')](0x194)[_0xd46e('0x28')](_0xd46e('0x5e'));}else{return handleError(_0x56dd9a,null);}});};exports[_0xd46e('0x5f')]=function(_0x272514,_0x329204){return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0x272514['params']['id']}})[_0xd46e('0x25')](function(_0x1a3771){if(_[_0xd46e('0x60')](_0x1a3771)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1a3771;})[_0xd46e('0x25')](function(_0x313c7e){var _0x4dec29=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x313c7e['value']);logger[_0xd46e('0x61')](_0xd46e('0x62'),_0x4dec29);if(!_[_0xd46e('0x60')](_0x313c7e['value'])&&fs[_0xd46e('0x59')](_0x4dec29)){logger['info'](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}_0x4dec29=_0x4dec29+'.cypher';if(!_[_0xd46e('0x60')](_0x313c7e[_0xd46e('0x51')])&&fs[_0xd46e('0x59')](_0x4dec29)){logger[_0xd46e('0x61')](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}return _0x313c7e;})[_0xd46e('0x25')](function(_0x300ee9){if(!_0x300ee9)throw new InternalError();return _0x300ee9[_0xd46e('0x5f')]();})[_0xd46e('0x25')](function(){_0x329204[_0xd46e('0x1b')](0xcc)[_0xd46e('0x66')]();})[_0xd46e('0x42')](handleError(_0x329204,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e579269..785f3cb 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 _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 +var _0x2daf=['exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x3970d9,_0x43e60d){var _0x42ff83=function(_0x4505cf){while(--_0x4505cf){_0x3970d9['push'](_0x3970d9['shift']());}};_0x42ff83(++_0x43e60d);}(_0x2daf,0x1c5));var _0xf2da=function(_0x152405,_0x5e8952){_0x152405=_0x152405-0x0;var _0x46647a=_0x2daf[_0x152405];return _0x46647a;};'use strict';var _=require(_0xf2da('0x0'));var util=require(_0xf2da('0x1'));var logger=require(_0xf2da('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2da('0x3'));var rp=require(_0xf2da('0x4'));var fs=require('fs');var path=require(_0xf2da('0x5'));var rimraf=require(_0xf2da('0x6'));var config=require(_0xf2da('0x7'));var attributes=require(_0xf2da('0x8'));module[_0xf2da('0x9')]=function(_0x239770,_0x2b43dd){return _0x239770[_0xf2da('0xa')](_0xf2da('0xb'),attributes,{'tableName':_0xf2da('0xc'),'paranoid':![],'indexes':[{'name':_0xf2da('0xd'),'fields':[_0xf2da('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 5bfe258..11c13a5 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 _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 +var _0xa919=['catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x51e20e,_0x568d8b){var _0x1e8ee3=function(_0x45f883){while(--_0x45f883){_0x51e20e['push'](_0x51e20e['shift']());}};_0x1e8ee3(++_0x568d8b);}(_0xa919,0x1cf));var _0x9a91=function(_0x449158,_0x44e1b0){_0x449158=_0x449158-0x0;var _0x1f3c3a=_0xa919[_0x449158];return _0x1f3c3a;};'use strict';var _=require(_0x9a91('0x0'));var util=require(_0x9a91('0x1'));var moment=require(_0x9a91('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a91('0x4'));var logger=require(_0x9a91('0x5'))(_0x9a91('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a91('0x7'));var client=jayson['client'][_0x9a91('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ed42b,_0xb7d4b0,_0x386c8d){return new BPromise(function(_0x4dd4d3,_0x45e00b){return client['request'](_0x2ed42b,_0x386c8d)[_0x9a91('0x9')](function(_0x356f59){logger['info'](_0x9a91('0xa'),_0xb7d4b0,_0x9a91('0xb'));logger[_0x9a91('0xc')](_0x9a91('0xd'),_0xb7d4b0,_0x9a91('0xb'),JSON[_0x9a91('0xe')](_0x356f59));if(_0x356f59[_0x9a91('0xf')]){if(_0x356f59[_0x9a91('0xf')][_0x9a91('0x10')]===0x1f4){logger[_0x9a91('0xf')](_0x9a91('0xa'),_0xb7d4b0,_0x356f59[_0x9a91('0xf')]['message']);return _0x45e00b(_0x356f59[_0x9a91('0xf')][_0x9a91('0x11')]);}logger[_0x9a91('0xf')](_0x9a91('0xa'),_0xb7d4b0,_0x356f59[_0x9a91('0xf')][_0x9a91('0x11')]);return _0x4dd4d3(_0x356f59[_0x9a91('0xf')][_0x9a91('0x11')]);}else{logger[_0x9a91('0x12')](_0x9a91('0xa'),_0xb7d4b0,_0x9a91('0xb'));_0x4dd4d3(_0x356f59[_0x9a91('0x13')][_0x9a91('0x11')]);}})[_0x9a91('0x14')](function(_0x1499ed){logger[_0x9a91('0xf')](_0x9a91('0xa'),_0xb7d4b0,_0x1499ed);_0x45e00b(_0x1499ed);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 0332629..17f940d 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 _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 +var _0x369c=['/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s','originalname','post','single','addLogo','join','logologin','extname','file','preferred','/:id/preferred','favicon','put','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index'];(function(_0x57455c,_0x2dc57c){var _0x3dc97e=function(_0x1a7100){while(--_0x1a7100){_0x57455c['push'](_0x57455c['shift']());}};_0x3dc97e(++_0x2dc57c);}(_0x369c,0xe4));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc369('0x0'));var util=require(_0xc369('0x1'));var path=require(_0xc369('0x2'));var timeout=require('connect-timeout');var express=require(_0xc369('0x3'));var router=express[_0xc369('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc369('0x5'));var interaction=require(_0xc369('0x6'));var config=require(_0xc369('0x7'));var controller=require(_0xc369('0x8'));router[_0xc369('0x9')]('/',auth[_0xc369('0xa')](),controller[_0xc369('0xb')]);router[_0xc369('0x9')](_0xc369('0xc'),controller['getDate']);router[_0xc369('0x9')](_0xc369('0xd'),controller[_0xc369('0xe')]);router['get'](_0xc369('0xf'),controller[_0xc369('0x10')]);router[_0xc369('0x9')](_0xc369('0x11'),controller[_0xc369('0x12')]);router[_0xc369('0x9')](_0xc369('0x13'),controller['gdpr']);router[_0xc369('0x9')]('/:id/preferred',controller[_0xc369('0x14')]);router['get'](_0xc369('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x20fb42,_0x1430f9,_0x2c845f){_0x2c845f(null,path['join'](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0x500509,_0x743ad,_0xebd7ce){_0xebd7ce(null,util[_0xc369('0x19')](_0xc369('0x1a'),'logo',path['extname'](_0x743ad[_0xc369('0x1b')])));}})});router[_0xc369('0x1c')](_0xc369('0xf'),upload[_0xc369('0x1d')]('file'),controller[_0xc369('0x1e')]);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x259246,_0x242454,_0x42bf4f){_0x42bf4f(null,path[_0xc369('0x1f')](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0xefc02f,_0x307fe3,_0x215938){_0x215938(null,util[_0xc369('0x19')](_0xc369('0x1a'),_0xc369('0x20'),path[_0xc369('0x21')](_0x307fe3[_0xc369('0x1b')])));}})});router[_0xc369('0x1c')]('/:id/logo_login',upload[_0xc369('0x1d')](_0xc369('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x4b1f1a,_0x2670ae,_0x19b779){_0x19b779(null,path['join'](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0x113008,_0x289dfa,_0x4030bf){_0x4030bf(null,util[_0xc369('0x19')]('%s%s',_0xc369('0x23'),path[_0xc369('0x21')](_0x289dfa[_0xc369('0x1b')])));}})});router[_0xc369('0x1c')](_0xc369('0x24'),upload['single'](_0xc369('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x49c5a5,_0x514dbb,_0x17b521){_0x17b521(null,path[_0xc369('0x1f')](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0x278217,_0x2e5e7a,_0x5af15f){_0x5af15f(null,util[_0xc369('0x19')](_0xc369('0x1a'),_0xc369('0x25'),path[_0xc369('0x21')](_0x2e5e7a['originalname'])));}})});router['post'](_0xc369('0x15'),upload[_0xc369('0x1d')](_0xc369('0x22')),controller['addFavicon']);router[_0xc369('0x26')](_0xc369('0xd'),auth[_0xc369('0xa')](),controller[_0xc369('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 340fd0d..cea41b6 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 _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 +var _0x39e0=['INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x39e0,0x1a3));var _0x039e=function(_0x1b103c,_0x139e86){_0x1b103c=_0x1b103c-0x0;var _0x5ecbe8=_0x39e0[_0x1b103c];return _0x5ecbe8;};'use strict';var Sequelize=require('sequelize');module[_0x039e('0x0')]={'min_internal':{'type':Sequelize[_0x039e('0x1')](0xb),'unique':_0x039e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x039e('0x1')](0xb),'unique':_0x039e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x039e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x039e('0x4')},'logo':{'type':Sequelize[_0x039e('0x5')]},'defaultLogo':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x039e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x039e('0x5')]},'turnaddr':{'type':Sequelize[_0x039e('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x039e('0x5')]},'pageTitle':{'type':Sequelize[_0x039e('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x039e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x039e('0x5')],'defaultValue':_0x039e('0x7')},'enableEmailPreview':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x039e('0x5')],'defaultValue':_0x039e('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x039e('0x5')]},'defaultPreferred':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x039e('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x039e('0x5')]},'sentiment':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x039e('0x1')]},'sentimentRegion':{'type':Sequelize[_0x039e('0x5')]},'language':{'type':Sequelize[_0x039e('0x5')]},'bucket':{'type':Sequelize[_0x039e('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x039e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x039e('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x039e('0x1')](0x2)[_0x039e('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x039e('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 77592ed..7cb608d 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 _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 +var _0xcf75=['default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','apply','reject','save','update','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','show','fields','find','body','params','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','custom','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf75,0x83));var _0x5cf7=function(_0x2422bd,_0x1120d2){_0x2422bd=_0x2422bd-0x0;var _0x1a6113=_0xcf75[_0x2422bd];return _0x1a6113;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cf7('0x0'));var zipdir=require(_0x5cf7('0x1'));var jsonpatch=require(_0x5cf7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5cf7('0x3'));var Mustache=require(_0x5cf7('0x4'));var util=require('util');var path=require(_0x5cf7('0x5'));var sox=require(_0x5cf7('0x6'));var csv=require(_0x5cf7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cf7('0x8'));var _=require(_0x5cf7('0x9'));var squel=require('squel');var crypto=require(_0x5cf7('0xa'));var jsforce=require(_0x5cf7('0xb'));var deskjs=require(_0x5cf7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5cf7('0xd'));var Papa=require(_0x5cf7('0xe'));var Redis=require(_0x5cf7('0xf'));var authService=require(_0x5cf7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5cf7('0x11'));var hardwareService=require(_0x5cf7('0x12'));var logger=require(_0x5cf7('0x13'))('api');var utils=require(_0x5cf7('0x14'));var config=require(_0x5cf7('0x15'));var licenseUtil=require(_0x5cf7('0x16'));var db=require(_0x5cf7('0x17'))['db'];var jayson=require(_0x5cf7('0x18'));var client=jayson[_0x5cf7('0x19')][_0x5cf7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x59636c,_0xbee2fe,_0x501738,_0x15e638){return new BPromise(function(_0x2ffa28,_0x48e63f){var _0x85019c=_0x15e638||client;return _0x85019c[_0x5cf7('0x1b')](_0x59636c,_0x501738)[_0x5cf7('0x1c')](function(_0x5a2653){logger[_0x5cf7('0x1d')](_0x5cf7('0x1e'),_0xbee2fe,_0x5cf7('0x1f'));logger[_0x5cf7('0x20')](_0x5cf7('0x21'),_0xbee2fe,_0x5cf7('0x1f'),JSON[_0x5cf7('0x22')](_0x5a2653));if(_0x5a2653[_0x5cf7('0x23')]){if(_0x5a2653[_0x5cf7('0x23')][_0x5cf7('0x24')]===0x1f4){logger[_0x5cf7('0x23')]('Setting,\x20%s,\x20%s',_0xbee2fe,_0x5a2653[_0x5cf7('0x23')][_0x5cf7('0x25')]);return _0x48e63f(_0x5a2653['error'][_0x5cf7('0x25')]);}logger[_0x5cf7('0x23')](_0x5cf7('0x1e'),_0xbee2fe,_0x5a2653[_0x5cf7('0x23')][_0x5cf7('0x25')]);return _0x2ffa28(_0x5a2653['error'][_0x5cf7('0x25')]);}else{logger[_0x5cf7('0x1d')](_0x5cf7('0x1e'),_0xbee2fe,_0x5cf7('0x1f'));_0x2ffa28(_0x5a2653[_0x5cf7('0x26')]['message']);}})[_0x5cf7('0x27')](function(_0x1867cb){logger[_0x5cf7('0x23')]('Setting,\x20%s,\x20%s',_0xbee2fe,_0x1867cb);_0x48e63f(_0x1867cb);});});}function respondWithStatusCode(_0x30895c,_0x1e16a6){_0x1e16a6=_0x1e16a6||0xcc;return function(_0x1bba38){if(_0x1bba38){return _0x30895c[_0x5cf7('0x28')](_0x1e16a6);}return _0x30895c[_0x5cf7('0x29')](_0x1e16a6)[_0x5cf7('0x2a')]();};}function respondWithResult(_0x4daa56,_0x3ba3aa){_0x3ba3aa=_0x3ba3aa||0xc8;return function(_0x2aadd3){if(_0x2aadd3){return _0x4daa56[_0x5cf7('0x29')](_0x3ba3aa)[_0x5cf7('0x2b')](_0x2aadd3);}};}function respondWithFilteredResult(_0xd444a6,_0x20560f){return function(_0x3fec44){if(_0x3fec44){var _0x5b94dd=typeof _0x20560f[_0x5cf7('0x2c')]===_0x5cf7('0x2d')&&typeof _0x20560f['limit']===_0x5cf7('0x2d');var _0x546a21=_0x3fec44['count'];var _0x3abf5e=_0x5b94dd?0x0:_0x20560f[_0x5cf7('0x2c')];var _0x22b9b7=_0x5b94dd?_0x3fec44['count']:_0x20560f[_0x5cf7('0x2c')]+_0x20560f['limit'];var _0x206426;if(_0x22b9b7>=_0x546a21){_0x22b9b7=_0x546a21;_0x206426=0xc8;}else{_0x206426=0xce;}_0xd444a6[_0x5cf7('0x29')](_0x206426);return _0xd444a6['set']('Content-Range',_0x3abf5e+'-'+_0x22b9b7+'/'+_0x546a21)[_0x5cf7('0x2b')](_0x3fec44);}return null;};}function patchUpdates(_0x54b8bc){return function(_0x5c33e0){try{jsonpatch[_0x5cf7('0x2e')](_0x5c33e0,_0x54b8bc,!![]);}catch(_0x45c423){return BPromise[_0x5cf7('0x2f')](_0x45c423);}return _0x5c33e0[_0x5cf7('0x30')]();};}function saveUpdates(_0x38935f,_0x36b4fa){return function(_0x70f233){if(_0x70f233){return _0x70f233[_0x5cf7('0x31')](_0x38935f)[_0x5cf7('0x1c')](function(_0x3cc6ce){return _0x3cc6ce;});}return null;};}function removeEntity(_0x198ee5,_0x21519f){return function(_0x1960e2){if(_0x1960e2){return _0x1960e2['destroy']()[_0x5cf7('0x1c')](function(){_0x198ee5[_0x5cf7('0x29')](0xcc)[_0x5cf7('0x2a')]();});}};}function handleEntityNotFound(_0x2fb459,_0x3228b4){return function(_0x59e539){if(!_0x59e539){_0x2fb459['sendStatus'](0x194);}return _0x59e539;};}function handleError(_0x231812,_0x4cc74a){_0x4cc74a=_0x4cc74a||0x1f4;return function(_0x24a417){logger[_0x5cf7('0x23')](_0x24a417['stack']);if(_0x24a417[_0x5cf7('0x32')]){delete _0x24a417[_0x5cf7('0x32')];}_0x231812[_0x5cf7('0x29')](_0x4cc74a)[_0x5cf7('0x33')](_0x24a417);};}exports[_0x5cf7('0x34')]=function(_0x480ac6,_0x3f3b05){var _0x42a400={},_0x44fb56={},_0xc9dd2={'count':0x0,'rows':[]};var _0x50dd07=_[_0x5cf7('0x35')](db[_0x5cf7('0x36')][_0x5cf7('0x37')],function(_0x4fb5d8){return{'name':_0x4fb5d8[_0x5cf7('0x38')],'type':_0x4fb5d8[_0x5cf7('0x39')]['key']};});_0x44fb56[_0x5cf7('0x3a')]=_[_0x5cf7('0x35')](_0x50dd07,_0x5cf7('0x32'));_0x44fb56[_0x5cf7('0x3b')]=_[_0x5cf7('0x3c')](_0x480ac6[_0x5cf7('0x3b')]);_0x44fb56[_0x5cf7('0x3d')]=_[_0x5cf7('0x3e')](_0x44fb56[_0x5cf7('0x3a')],_0x44fb56['query']);_0x42a400[_0x5cf7('0x3f')]=_['intersection'](_0x44fb56[_0x5cf7('0x3a')],qs['fields'](_0x480ac6['query']['fields']));_0x42a400[_0x5cf7('0x3f')]=_0x42a400['attributes'][_0x5cf7('0x40')]?_0x42a400[_0x5cf7('0x3f')]:_0x44fb56['model'];if(!_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x41')](_0x5cf7('0x42'))){_0x42a400['limit']=qs[_0x5cf7('0x43')](_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x43')]);_0x42a400[_0x5cf7('0x2c')]=qs[_0x5cf7('0x2c')](_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x2c')]);}_0x42a400[_0x5cf7('0x44')]=qs[_0x5cf7('0x45')](_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x45')]);_0x42a400[_0x5cf7('0x46')]=qs[_0x5cf7('0x3d')](_[_0x5cf7('0x47')](_0x480ac6[_0x5cf7('0x3b')],_0x44fb56[_0x5cf7('0x3d')]),_0x50dd07);if(_0x480ac6[_0x5cf7('0x3b')]['filter']){_0x42a400['where']=_[_0x5cf7('0x48')](_0x42a400['where'],{'$or':_[_0x5cf7('0x35')](_0x50dd07,function(_0x1ff1d9){if(_0x1ff1d9[_0x5cf7('0x39')]!==_0x5cf7('0x49')){var _0x2de773={};_0x2de773[_0x1ff1d9[_0x5cf7('0x32')]]={'$like':'%'+_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x4a')]+'%'};return _0x2de773;}})});}_0x42a400=_[_0x5cf7('0x48')]({},_0x42a400,_0x480ac6[_0x5cf7('0x4b')]);var _0xfa9be7={'where':_0x42a400[_0x5cf7('0x46')]};return db[_0x5cf7('0x36')]['count'](_0xfa9be7)[_0x5cf7('0x1c')](function(_0x36054a){_0xc9dd2[_0x5cf7('0x4c')]=_0x36054a;if(_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x4d')]){_0x42a400[_0x5cf7('0x4e')]=[{'all':!![]}];}return db[_0x5cf7('0x36')][_0x5cf7('0x4f')](_0x42a400);})[_0x5cf7('0x1c')](function(_0x1d6256){_0xc9dd2['rows']=_0x1d6256;return _0xc9dd2;})[_0x5cf7('0x1c')](respondWithFilteredResult(_0x3f3b05,_0x42a400))['catch'](handleError(_0x3f3b05,null));};exports[_0x5cf7('0x50')]=function(_0x2c132f,_0x5060c3){var _0x15dc95={'raw':![],'where':{'id':_0x2c132f['params']['id']}},_0x52447c={};_0x52447c[_0x5cf7('0x3a')]=_['keys'](db[_0x5cf7('0x36')]['rawAttributes']);_0x52447c[_0x5cf7('0x3b')]=_['keys'](_0x2c132f['query']);_0x52447c['filters']=_[_0x5cf7('0x3e')](_0x52447c[_0x5cf7('0x3a')],_0x52447c[_0x5cf7('0x3b')]);_0x15dc95[_0x5cf7('0x3f')]=_['intersection'](_0x52447c[_0x5cf7('0x3a')],qs[_0x5cf7('0x51')](_0x2c132f[_0x5cf7('0x3b')][_0x5cf7('0x51')]));_0x15dc95['attributes']=_0x15dc95['attributes'][_0x5cf7('0x40')]?_0x15dc95[_0x5cf7('0x3f')]:_0x52447c[_0x5cf7('0x3a')];if(_0x2c132f[_0x5cf7('0x3b')][_0x5cf7('0x4d')]){_0x15dc95['include']=[{'all':!![]}];}_0x15dc95=_[_0x5cf7('0x48')]({},_0x15dc95,_0x2c132f[_0x5cf7('0x4b')]);return db[_0x5cf7('0x36')][_0x5cf7('0x52')](_0x15dc95)[_0x5cf7('0x1c')](handleEntityNotFound(_0x5060c3,null))[_0x5cf7('0x1c')](respondWithResult(_0x5060c3,null))[_0x5cf7('0x27')](handleError(_0x5060c3,null));};exports[_0x5cf7('0x31')]=function(_0x90caa,_0x4e0dc0){if(_0x90caa[_0x5cf7('0x53')]['id']){delete _0x90caa[_0x5cf7('0x53')]['id'];}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x90caa[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x4e0dc0,null))[_0x5cf7('0x1c')](saveUpdates(_0x90caa[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x4e0dc0,null))['catch'](handleError(_0x4e0dc0,null));};exports['addLogo']=function(_0x34905e,_0x57d75d,_0x5373c2){if(_0x34905e[_0x5cf7('0x55')]&&_0x34905e[_0x5cf7('0x55')][_0x5cf7('0x56')]){_0x34905e['body'][_0x5cf7('0x57')]=_0x34905e['file'][_0x5cf7('0x56')];}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x34905e[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x57d75d,null))[_0x5cf7('0x1c')](saveUpdates(_0x34905e['body'],null))['then'](respondWithResult(_0x57d75d,null))[_0x5cf7('0x27')](handleError(_0x57d75d,null));};exports[_0x5cf7('0x58')]=function(_0x322608,_0x4dcdf2,_0xef03b5){if(_0x322608[_0x5cf7('0x55')]&&_0x322608[_0x5cf7('0x55')][_0x5cf7('0x56')]){_0x322608[_0x5cf7('0x53')][_0x5cf7('0x59')]=_0x322608[_0x5cf7('0x55')][_0x5cf7('0x56')];}return db['Setting'][_0x5cf7('0x52')]({'where':{'id':_0x322608[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x4dcdf2,null))[_0x5cf7('0x1c')](saveUpdates(_0x322608[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x4dcdf2,null))[_0x5cf7('0x27')](handleError(_0x4dcdf2,null));};var utilLicense=require(_0x5cf7('0x16'));exports[_0x5cf7('0x5a')]=function(_0x24eaf2,_0x265053,_0x2584c4){var _0x35be78=_0x5cf7('0x5b');var _0x1d89cc={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x75b398){if(_0x75b398){_0x1d89cc=_0x75b398;}return db['Setting'][_0x5cf7('0x52')]({'where':{'id':_0x24eaf2[_0x5cf7('0x54')]['id']},'attributes':[_0x5cf7('0x57'),'loginLogo','preferred',_0x5cf7('0x5d'),_0x5cf7('0x5e'),_0x5cf7('0x5f'),_0x5cf7('0x60'),_0x5cf7('0x61')],'raw':!![]});})[_0x5cf7('0x1c')](handleEntityNotFound(_0x265053,null))[_0x5cf7('0x1c')](function(_0x32a26b){if(_0x32a26b){var _0x586641=_0x32a26b['logo']&&fs[_0x5cf7('0x62')](path[_0x5cf7('0x63')](config['root'],_0x35be78,_[_0x5cf7('0x64')](_0x32a26b[_0x5cf7('0x57')])))?path[_0x5cf7('0x63')](config['root'],_0x35be78,_[_0x5cf7('0x64')](_0x32a26b[_0x5cf7('0x57')])):path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x35be78,_['toLower'](_0x5cf7('0x66')));var _0x5e6f1c=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x57'));if(_0x32a26b[_0x5e6f1c]||!_0x1d89cc['custom']){_0x586641=path['join'](config[_0x5cf7('0x65')],_0x35be78,_[_0x5cf7('0x64')](_0x5cf7('0x66')));}if(!fs[_0x5cf7('0x62')](_0x586641)){throw new db[(_0x5cf7('0x69'))][(_0x5cf7('0x6a'))](_[_0x5cf7('0x68')](_0x5cf7('0x57'))+_0x5cf7('0x6b'));}return _0x265053[_0x5cf7('0x6c')](_0x586641);}})[_0x5cf7('0x27')](handleError(_0x265053,null));};var utilLicense=require(_0x5cf7('0x16'));exports[_0x5cf7('0x6d')]=function(_0x1ad10f,_0x326fb2,_0x50167b){var _0x402bfa=_0x5cf7('0x5b');var _0x334db1={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x456303){if(_0x456303){_0x334db1=_0x456303;}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x1ad10f[_0x5cf7('0x54')]['id']},'attributes':['logo',_0x5cf7('0x59'),_0x5cf7('0x6e'),_0x5cf7('0x5d'),_0x5cf7('0x5e'),'defaultLoginLogo',_0x5cf7('0x60'),_0x5cf7('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x326fb2,null))['then'](function(_0x22bfaf){if(_0x22bfaf){var _0x12bf5b=_0x22bfaf['loginLogo']&&fs['existsSync'](path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x402bfa,_[_0x5cf7('0x64')](_0x22bfaf[_0x5cf7('0x59')])))?path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x402bfa,_[_0x5cf7('0x64')](_0x22bfaf[_0x5cf7('0x59')])):path[_0x5cf7('0x63')](config['root'],_0x402bfa,_[_0x5cf7('0x64')]('default_loginLogo.svg'));var _0x4ea1b4=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x59'));if(_0x22bfaf[_0x4ea1b4]||!_0x334db1[_0x5cf7('0x6f')]){_0x12bf5b=path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x402bfa,_[_0x5cf7('0x64')](_0x5cf7('0x70')));}if(!fs[_0x5cf7('0x62')](_0x12bf5b)){throw new db[(_0x5cf7('0x69'))][(_0x5cf7('0x6a'))](_[_0x5cf7('0x68')](_0x5cf7('0x59'))+_0x5cf7('0x6b'));}return _0x326fb2[_0x5cf7('0x6c')](_0x12bf5b);}})[_0x5cf7('0x27')](handleError(_0x326fb2,null));};exports[_0x5cf7('0x71')]=function(_0x19652f,_0x56034e){return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x19652f[_0x5cf7('0x54')]['id']},'attributes':['securePassword']})[_0x5cf7('0x1c')](respondWithResult(_0x56034e,null))['catch'](handleError(_0x56034e,null));};exports[_0x5cf7('0x72')]=function(_0x3d349c,_0x126022,_0x17e4ec){if(_0x3d349c['file']&&_0x3d349c[_0x5cf7('0x55')]['filename']){_0x3d349c[_0x5cf7('0x53')]['preferred']=_0x3d349c[_0x5cf7('0x55')][_0x5cf7('0x56')];}return db['Setting'][_0x5cf7('0x52')]({'where':{'id':_0x3d349c['params']['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x126022,null))['then'](saveUpdates(_0x3d349c[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x126022,null))[_0x5cf7('0x27')](handleError(_0x126022,null));};var utilLicense=require(_0x5cf7('0x16'));exports[_0x5cf7('0x73')]=function(_0x27fa07,_0x2e0f5f,_0x16ee80){var _0x664197=_0x5cf7('0x5b');var _0x254933={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x2dde5f){if(_0x2dde5f){_0x254933=_0x2dde5f;}return db[_0x5cf7('0x36')]['find']({'where':{'id':_0x27fa07[_0x5cf7('0x54')]['id']},'attributes':[_0x5cf7('0x57'),_0x5cf7('0x59'),_0x5cf7('0x6e'),_0x5cf7('0x5d'),_0x5cf7('0x5e'),_0x5cf7('0x5f'),_0x5cf7('0x60'),_0x5cf7('0x61')],'raw':!![]});})[_0x5cf7('0x1c')](handleEntityNotFound(_0x2e0f5f,null))[_0x5cf7('0x1c')](function(_0x4a0285){if(_0x4a0285){var _0x52621b=_0x4a0285[_0x5cf7('0x6e')]&&fs[_0x5cf7('0x62')](path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_[_0x5cf7('0x64')](_0x4a0285[_0x5cf7('0x6e')])))?path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_[_0x5cf7('0x64')](_0x4a0285['preferred'])):path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_['toLower'](_0x5cf7('0x74')));var _0x43967e=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x6e'));if(_0x4a0285[_0x43967e]||!_0x254933['custom']||!_0x254933[_0x5cf7('0x6e')]){_0x52621b=path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_['toLower']('default_preferred.png'));}if(!fs[_0x5cf7('0x62')](_0x52621b)){throw new db[(_0x5cf7('0x69'))]['ValidationError'](_[_0x5cf7('0x68')](_0x5cf7('0x6e'))+_0x5cf7('0x6b'));}return _0x2e0f5f['download'](_0x52621b);}})['catch'](handleError(_0x2e0f5f,null));};exports[_0x5cf7('0x75')]=function(_0x3c851c,_0x158466,_0xca987){if(_0x3c851c[_0x5cf7('0x55')]&&_0x3c851c[_0x5cf7('0x55')][_0x5cf7('0x56')]){_0x3c851c[_0x5cf7('0x53')]['favicon']=_0x3c851c[_0x5cf7('0x55')][_0x5cf7('0x56')];}return db[_0x5cf7('0x36')]['find']({'where':{'id':_0x3c851c[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x158466,null))[_0x5cf7('0x1c')](saveUpdates(_0x3c851c[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x158466,null))[_0x5cf7('0x27')](handleError(_0x158466,null));};var utilLicense=require('../../config/license/util');exports[_0x5cf7('0x76')]=function(_0x1bedd8,_0x2661b1,_0xca978b){var _0x42bc96=_0x5cf7('0x5b');var _0x130f6e={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x251551){if(_0x251551){_0x130f6e=_0x251551;}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x1bedd8[_0x5cf7('0x54')]['id']},'attributes':['logo','loginLogo',_0x5cf7('0x6e'),_0x5cf7('0x5d'),_0x5cf7('0x5e'),_0x5cf7('0x5f'),'defaultPreferred',_0x5cf7('0x61')],'raw':!![]});})[_0x5cf7('0x1c')](handleEntityNotFound(_0x2661b1,null))[_0x5cf7('0x1c')](function(_0x2914ce){if(_0x2914ce){var _0x1af9be=_0x2914ce[_0x5cf7('0x5d')]&&fs['existsSync'](path['join'](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x2914ce[_0x5cf7('0x5d')])))?path['join'](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x2914ce[_0x5cf7('0x5d')])):path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x5cf7('0x77')));var _0x5c7b0e=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x5d'));if(_0x2914ce[_0x5c7b0e]||!_0x130f6e['custom']){_0x1af9be=path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x5cf7('0x77')));}if(!fs[_0x5cf7('0x62')](_0x1af9be)){throw new db['Sequelize'][(_0x5cf7('0x6a'))](_['upperFirst'](_0x5cf7('0x5d'))+_0x5cf7('0x6b'));}return _0x2661b1[_0x5cf7('0x6c')](_0x1af9be);}})[_0x5cf7('0x27')](handleError(_0x2661b1,null));};exports[_0x5cf7('0x78')]=function(_0x302495,_0x51db37){var _0x4d1597={'offset':moment()[_0x5cf7('0x79')]()};_0x4d1597[_0x5cf7('0x7a')]=moment()[_0x5cf7('0x79')](_0x4d1597[_0x5cf7('0x2c')])[_0x5cf7('0x7b')](_0x5cf7('0x7c'));return _0x51db37[_0x5cf7('0x29')](0xc8)[_0x5cf7('0x33')](_0x4d1597);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1e779f9..6b822b7 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 _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 +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x1018b6,_0x36df64){var _0x4ef97e=function(_0x2d624b){while(--_0x2d624b){_0x1018b6['push'](_0x1018b6['shift']());}};_0x4ef97e(++_0x36df64);}(_0x34e8,0x12c));var _0x834e=function(_0x527e56,_0x54a240){_0x527e56=_0x527e56-0x0;var _0x319aa6=_0x34e8[_0x527e56];return _0x319aa6;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 556844b..001a654 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 _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 +var _0x9277=['error','code','message','catch','ShowSetting','Setting','options','where','attributes','map','include','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xe19fdd,_0x147735){var _0x1cc94b=function(_0x5ade99){while(--_0x5ade99){_0xe19fdd['push'](_0xe19fdd['shift']());}};_0x1cc94b(++_0x147735);}(_0x9277,0x111));var _0x7927=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x9277[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x7927('0x0'));var util=require(_0x7927('0x1'));var moment=require(_0x7927('0x2'));var BPromise=require('bluebird');var rs=require(_0x7927('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7927('0x4'))['db'];var utils=require(_0x7927('0x5'));var logger=require('../../config/logger')(_0x7927('0x6'));var config=require(_0x7927('0x7'));var jayson=require(_0x7927('0x8'));var client=jayson['client'][_0x7927('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432b73,_0x5df478,_0x2bbfaa){return new BPromise(function(_0x4a8277,_0xeec2eb){return client[_0x7927('0xa')](_0x432b73,_0x2bbfaa)[_0x7927('0xb')](function(_0x3d8e4f){logger[_0x7927('0xc')](_0x7927('0xd'),_0x5df478,_0x7927('0xe'));logger[_0x7927('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x5df478,_0x7927('0xe'),JSON[_0x7927('0x10')](_0x3d8e4f));if(_0x3d8e4f[_0x7927('0x11')]){if(_0x3d8e4f[_0x7927('0x11')][_0x7927('0x12')]===0x1f4){logger[_0x7927('0x11')]('Setting,\x20%s,\x20%s',_0x5df478,_0x3d8e4f[_0x7927('0x11')][_0x7927('0x13')]);return _0xeec2eb(_0x3d8e4f[_0x7927('0x11')][_0x7927('0x13')]);}logger[_0x7927('0x11')](_0x7927('0xd'),_0x5df478,_0x3d8e4f['error'][_0x7927('0x13')]);return _0x4a8277(_0x3d8e4f[_0x7927('0x11')]['message']);}else{logger['info'](_0x7927('0xd'),_0x5df478,_0x7927('0xe'));_0x4a8277(_0x3d8e4f['result'][_0x7927('0x13')]);}})[_0x7927('0x14')](function(_0x271234){logger[_0x7927('0x11')]('Setting,\x20%s,\x20%s',_0x5df478,_0x271234);_0xeec2eb(_0x271234);});});}exports[_0x7927('0x15')]=function(_0x823df1){var _0x5eafb3=this;return new Promise(function(_0x1ad138,_0x34ec10){return db[_0x7927('0x16')]['find']({'raw':_0x823df1[_0x7927('0x17')]?_0x823df1[_0x7927('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x823df1[_0x7927('0x17')]?_0x823df1[_0x7927('0x17')][_0x7927('0x18')]||null:null,'attributes':_0x823df1['options']?_0x823df1['options'][_0x7927('0x19')]||null:null,'include':_0x823df1['options']?_0x823df1[_0x7927('0x17')]['include']?_[_0x7927('0x1a')](_0x823df1[_0x7927('0x17')][_0x7927('0x1b')],function(_0x5b4a3b){return{'model':db[_0x5b4a3b[_0x7927('0x1c')]],'as':_0x5b4a3b['as'],'attributes':_0x5b4a3b[_0x7927('0x19')],'include':_0x5b4a3b[_0x7927('0x1b')]?_[_0x7927('0x1a')](_0x5b4a3b[_0x7927('0x1b')],function(_0x173ae2){return{'model':db[_0x173ae2['model']],'as':_0x173ae2['as'],'attributes':_0x173ae2[_0x7927('0x19')],'include':_0x173ae2[_0x7927('0x1b')]?_['map'](_0x173ae2['include'],function(_0xcf2cf3){return{'model':db[_0xcf2cf3[_0x7927('0x1c')]],'as':_0xcf2cf3['as'],'attributes':_0xcf2cf3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x182c1a){logger[_0x7927('0xc')](_0x7927('0x15'),_0x823df1);logger[_0x7927('0xf')](_0x7927('0x15'),_0x823df1,JSON[_0x7927('0x10')](_0x182c1a));_0x1ad138(_0x182c1a);})[_0x7927('0x14')](function(_0x36e0fd){logger[_0x7927('0x11')]('ShowSetting',_0x36e0fd[_0x7927('0x13')],_0x823df1);_0x34ec10(_0x5eafb3[_0x7927('0x11')](0x1f4,_0x36e0fd[_0x7927('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 0cb413e..74b8068 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 _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 +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(_0x473b41,_0x1c320f){var _0x4e521d=function(_0x19a745){while(--_0x19a745){_0x473b41['push'](_0x473b41['shift']());}};_0x4e521d(++_0x1c320f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 3e13c3f..e71d440 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 _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 +var _0x6872=['mandatoryDispositionPauseId','setDataValue','sequelize','exports','name','STRING','generate','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2c0312,_0x2be972){var _0x46222d=function(_0x593c31){while(--_0x593c31){_0x2c0312['push'](_0x2c0312['shift']());}};_0x46222d(++_0x2be972);}(_0x6872,0xaa));var _0x2687=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x6872[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x2687('0x0'));var rs=require('randomstring');module[_0x2687('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2687('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x2687('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2687('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2687('0x3')],'defaultValue':function(){return rs[_0x2687('0x4')]();}},'phone':{'type':Sequelize[_0x2687('0x3')]},'type':{'type':Sequelize['ENUM'](_0x2687('0x5'),'skebby',_0x2687('0x6'),_0x2687('0x7'),_0x2687('0x8'),_0x2687('0x9'),'bandwidth',_0x2687('0xa'),_0x2687('0xb'),_0x2687('0xc'))},'accountSid':{'type':Sequelize[_0x2687('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x2687('0x3')]},'smsMethod':{'type':Sequelize[_0x2687('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2687('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2687('0x3')]},'applicationId':{'type':Sequelize[_0x2687('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2687('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x2687('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2687('0xe')],'defaultValue':function(){return _0x2687('0xf');}},'notificationSound':{'type':Sequelize[_0x2687('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2687('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2687('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2687('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2687('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x487e72){if(!_0x487e72)this['setDataValue'](_0x2687('0x13'),null);this[_0x2687('0x14')]('mandatoryDisposition',_0x487e72);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 69d4a2c..7d7758b 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 _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 +var _0x24fa=['model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','SmsAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','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','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','queueId','SmsQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','SmsAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type'];(function(_0x2be240,_0x1e119d){var _0x123543=function(_0x580bf4){while(--_0x580bf4){_0x2be240['push'](_0x2be240['shift']());}};_0x123543(++_0x1e119d);}(_0x24fa,0xa8));var _0xa24f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24fa[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa24f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa24f('0x1'));var rp=require(_0xa24f('0x2'));var moment=require(_0xa24f('0x3'));var BPromise=require(_0xa24f('0x4'));var Mustache=require(_0xa24f('0x5'));var util=require(_0xa24f('0x6'));var path=require('path');var sox=require(_0xa24f('0x7'));var csv=require(_0xa24f('0x8'));var ejs=require(_0xa24f('0x9'));var fs=require('fs');var fs_extra=require(_0xa24f('0xa'));var _=require(_0xa24f('0xb'));var squel=require(_0xa24f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa24f('0xd'));var toCsv=require(_0xa24f('0x8'));var querystring=require(_0xa24f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa24f('0xf'));var authService=require(_0xa24f('0x10'));var qs=require(_0xa24f('0x11'));var as=require(_0xa24f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24f('0x13'))(_0xa24f('0x14'));var utils=require(_0xa24f('0x15'));var config=require(_0xa24f('0x16'));var licenseUtil=require(_0xa24f('0x17'));var db=require(_0xa24f('0x18'))['db'];config[_0xa24f('0x19')]=_[_0xa24f('0x1a')](config[_0xa24f('0x19')],{'host':_0xa24f('0x1b'),'port':0x18eb});var socket=require(_0xa24f('0x1c'))(new Redis(config[_0xa24f('0x19')]));require(_0xa24f('0x1d'))['register'](socket);var jayson=require(_0xa24f('0x1e'));var client=jayson[_0xa24f('0x1f')][_0xa24f('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4280e1,_0x30a311,_0x28a752,_0x4236d5){return new BPromise(function(_0x9bb3b,_0x2a4a7c){var _0x18059d=_0x4236d5||client;return _0x18059d[_0xa24f('0x21')](_0x4280e1,_0x28a752)[_0xa24f('0x22')](function(_0x4ab44c){logger[_0xa24f('0x23')](_0xa24f('0x24'),_0x30a311,'request\x20sent');logger[_0xa24f('0x25')](_0xa24f('0x26'),_0x30a311,_0xa24f('0x27'),JSON['stringify'](_0x4ab44c));if(_0x4ab44c[_0xa24f('0x28')]){if(_0x4ab44c[_0xa24f('0x28')][_0xa24f('0x29')]===0x1f4){logger['error'](_0xa24f('0x24'),_0x30a311,_0x4ab44c[_0xa24f('0x28')]['message']);return _0x2a4a7c(_0x4ab44c['error']['message']);}logger['error'](_0xa24f('0x24'),_0x30a311,_0x4ab44c[_0xa24f('0x28')][_0xa24f('0x2a')]);return _0x9bb3b(_0x4ab44c[_0xa24f('0x28')][_0xa24f('0x2a')]);}else{logger['info'](_0xa24f('0x24'),_0x30a311,'request\x20sent');_0x9bb3b(_0x4ab44c[_0xa24f('0x2b')][_0xa24f('0x2a')]);}})[_0xa24f('0x2c')](function(_0x16fff3){logger[_0xa24f('0x28')]('SmsAccount,\x20%s,\x20%s',_0x30a311,_0x16fff3);_0x2a4a7c(_0x16fff3);});});}function respondWithStatusCode(_0x29e788,_0x53bc7b){_0x53bc7b=_0x53bc7b||0xcc;return function(_0x4485df){if(_0x4485df){return _0x29e788[_0xa24f('0x2d')](_0x53bc7b);}return _0x29e788['status'](_0x53bc7b)[_0xa24f('0x2e')]();};}function respondWithResult(_0x316918,_0x3e152f){_0x3e152f=_0x3e152f||0xc8;return function(_0x470b2c){if(_0x470b2c){return _0x316918[_0xa24f('0x2f')](_0x3e152f)[_0xa24f('0x30')](_0x470b2c);}};}function respondWithFilteredResult(_0x10c6cb,_0x29bea3){return function(_0x2d5e27){if(_0x2d5e27){var _0x5d2aca=typeof _0x29bea3[_0xa24f('0x31')]===_0xa24f('0x32')&&typeof _0x29bea3[_0xa24f('0x33')]==='undefined';var _0x27418a=_0x2d5e27[_0xa24f('0x34')];var _0x4678a1=_0x5d2aca?0x0:_0x29bea3['offset'];var _0x407e50=_0x5d2aca?_0x2d5e27[_0xa24f('0x34')]:_0x29bea3[_0xa24f('0x31')]+_0x29bea3[_0xa24f('0x33')];var _0x1c06d5;if(_0x407e50>=_0x27418a){_0x407e50=_0x27418a;_0x1c06d5=0xc8;}else{_0x1c06d5=0xce;}_0x10c6cb[_0xa24f('0x2f')](_0x1c06d5);return _0x10c6cb[_0xa24f('0x35')](_0xa24f('0x36'),_0x4678a1+'-'+_0x407e50+'/'+_0x27418a)[_0xa24f('0x30')](_0x2d5e27);}return null;};}function patchUpdates(_0x1160e6){return function(_0x585fd9){try{jsonpatch[_0xa24f('0x37')](_0x585fd9,_0x1160e6,!![]);}catch(_0x46627a){return BPromise[_0xa24f('0x38')](_0x46627a);}return _0x585fd9[_0xa24f('0x39')]();};}function saveUpdates(_0x3b3d2b,_0x3f0cd7){return function(_0x10f2a8){if(_0x10f2a8){return _0x10f2a8['update'](_0x3b3d2b)[_0xa24f('0x22')](function(_0x33b49b){return _0x33b49b;});}return null;};}function removeEntity(_0x2c2bae,_0x2120b2){return function(_0x4a6fa5){if(_0x4a6fa5){return _0x4a6fa5['destroy']()[_0xa24f('0x22')](function(){var _0x306883=_0x4a6fa5['get']({'plain':!![]});var _0x1cfc6f=_0xa24f('0x3a');return db['UserProfileResource'][_0xa24f('0x3b')]({'where':{'type':_0x1cfc6f,'resourceId':_0x306883['id']}})['then'](function(){return _0x4a6fa5;});})['then'](function(){_0x2c2bae[_0xa24f('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c1930,_0x578e16){return function(_0xd79940){if(!_0xd79940){_0x4c1930[_0xa24f('0x2d')](0x194);}return _0xd79940;};}function handleError(_0x29e12c,_0x56d19e){_0x56d19e=_0x56d19e||0x1f4;return function(_0x3ae158){logger[_0xa24f('0x28')](_0x3ae158[_0xa24f('0x3c')]);if(_0x3ae158[_0xa24f('0x3d')]){delete _0x3ae158[_0xa24f('0x3d')];}_0x29e12c[_0xa24f('0x2f')](_0x56d19e)[_0xa24f('0x3e')](_0x3ae158);};}exports[_0xa24f('0x3f')]=function(_0xd52d15,_0x41c94f){var _0x1cb84d={'include':[{'model':db[_0xa24f('0x40')],'as':_0xa24f('0x41')}]},_0x52affe={},_0xf7effa={'count':0x0,'rows':[]};var _0x486499=_['map'](db[_0xa24f('0x42')][_0xa24f('0x43')],function(_0x45056f){return{'name':_0x45056f['fieldName'],'type':_0x45056f[_0xa24f('0x44')]['key']};});_0x52affe[_0xa24f('0x45')]=_[_0xa24f('0x46')](_0x486499,_0xa24f('0x3d'));_0x52affe[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0xd52d15[_0xa24f('0x47')]);_0x52affe['filters']=_[_0xa24f('0x49')](_0x52affe[_0xa24f('0x45')],_0x52affe[_0xa24f('0x47')]);_0x1cb84d['attributes']=_['intersection'](_0x52affe['model'],qs[_0xa24f('0x4a')](_0xd52d15[_0xa24f('0x47')][_0xa24f('0x4a')]));_0x1cb84d['attributes']=_0x1cb84d[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0x1cb84d[_0xa24f('0x4b')]:_0x52affe['model'];if(!_0xd52d15[_0xa24f('0x47')][_0xa24f('0x4d')](_0xa24f('0x4e'))){_0x1cb84d[_0xa24f('0x33')]=qs[_0xa24f('0x33')](_0xd52d15['query'][_0xa24f('0x33')]);_0x1cb84d[_0xa24f('0x31')]=qs[_0xa24f('0x31')](_0xd52d15['query'][_0xa24f('0x31')]);}_0x1cb84d[_0xa24f('0x4f')]=qs[_0xa24f('0x50')](_0xd52d15[_0xa24f('0x47')]['sort']);_0x1cb84d[_0xa24f('0x51')]=qs[_0xa24f('0x52')](_[_0xa24f('0x53')](_0xd52d15[_0xa24f('0x47')],_0x52affe[_0xa24f('0x52')]),_0x486499);if(_0xd52d15['query']['filter']){_0x1cb84d['where']=_[_0xa24f('0x54')](_0x1cb84d[_0xa24f('0x51')],{'$or':_[_0xa24f('0x46')](_0x486499,function(_0x822b7a){if(_0x822b7a[_0xa24f('0x44')]!==_0xa24f('0x55')){var _0x3a8001={};_0x3a8001[_0x822b7a[_0xa24f('0x3d')]]={'$like':'%'+_0xd52d15[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x3a8001;}})});}_0x1cb84d=_[_0xa24f('0x54')]({},_0x1cb84d,_0xd52d15[_0xa24f('0x57')]);var _0x514302={'where':_0x1cb84d[_0xa24f('0x51')]};return db['SmsAccount']['count'](_0x514302)[_0xa24f('0x22')](function(_0x5a92da){_0xf7effa['count']=_0x5a92da;if(_0xd52d15[_0xa24f('0x47')][_0xa24f('0x58')]){_0x1cb84d['include']=[{'all':!![]}];}return db[_0xa24f('0x42')][_0xa24f('0x59')](_0x1cb84d);})[_0xa24f('0x22')](function(_0x3fd82e){_0xf7effa[_0xa24f('0x5a')]=_0x3fd82e;return _0xf7effa;})[_0xa24f('0x22')](respondWithFilteredResult(_0x41c94f,_0x1cb84d))[_0xa24f('0x2c')](handleError(_0x41c94f,null));};exports['show']=function(_0x2f85c1,_0x1ee8a4){var _0x3293c7={'raw':![],'where':{'id':_0x2f85c1['params']['id']},'include':[{'model':db[_0xa24f('0x40')],'as':_0xa24f('0x41')}]},_0x3ed18d={};_0x3ed18d[_0xa24f('0x45')]=_[_0xa24f('0x48')](db[_0xa24f('0x42')][_0xa24f('0x43')]);_0x3ed18d[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x2f85c1[_0xa24f('0x47')]);_0x3ed18d[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x3ed18d[_0xa24f('0x45')],_0x3ed18d[_0xa24f('0x47')]);_0x3293c7[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x3ed18d[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x2f85c1[_0xa24f('0x47')][_0xa24f('0x4a')]));_0x3293c7['attributes']=_0x3293c7[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0x3293c7[_0xa24f('0x4b')]:_0x3ed18d['model'];if(_0x2f85c1[_0xa24f('0x47')]['includeAll']){_0x3293c7[_0xa24f('0x5b')]=[{'all':!![]}];}_0x3293c7=_[_0xa24f('0x54')]({},_0x3293c7,_0x2f85c1[_0xa24f('0x57')]);return db[_0xa24f('0x42')]['find'](_0x3293c7)['then'](handleEntityNotFound(_0x1ee8a4,null))[_0xa24f('0x22')](respondWithResult(_0x1ee8a4,null))['catch'](handleError(_0x1ee8a4,null));};exports['create']=function(_0x19b520,_0xf25bdd){return db['SmsAccount'][_0xa24f('0x5c')](_0x19b520[_0xa24f('0x5d')],{})[_0xa24f('0x22')](function(_0x50ce3a){var _0x3aba99=_0x19b520['user'][_0xa24f('0x5e')]({'plain':!![]});if(!_0x3aba99)throw new Error(_0xa24f('0x5f'));if(_0x3aba99['role']===_0xa24f('0x60')){var _0x59d974=_0x50ce3a[_0xa24f('0x5e')]({'plain':!![]});var _0x137cbf='SmsAccounts';return db['UserProfileSection'][_0xa24f('0x61')]({'where':{'name':_0x137cbf,'userProfileId':_0x3aba99[_0xa24f('0x62')]},'raw':!![]})[_0xa24f('0x22')](function(_0x3ad097){if(_0x3ad097&&_0x3ad097[_0xa24f('0x63')]===0x0){return db[_0xa24f('0x64')][_0xa24f('0x5c')]({'name':_0x59d974[_0xa24f('0x3d')],'resourceId':_0x59d974['id'],'type':_0x3ad097[_0xa24f('0x3d')],'sectionId':_0x3ad097['id']},{})['then'](function(){return _0x50ce3a;});}else{return _0x50ce3a;}})[_0xa24f('0x2c')](function(_0x23f897){logger[_0xa24f('0x28')](_0xa24f('0x65'),_0x23f897);throw _0x23f897;});}return _0x50ce3a;})['then'](respondWithResult(_0xf25bdd,0xc9))[_0xa24f('0x2c')](handleError(_0xf25bdd,null));};exports[_0xa24f('0x66')]=function(_0x18f94d,_0xabf90b){if(_0x18f94d['body']['id']){delete _0x18f94d[_0xa24f('0x5d')]['id'];}return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0x18f94d[_0xa24f('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0xa24f('0x41')}]})[_0xa24f('0x22')](handleEntityNotFound(_0xabf90b,null))['then'](saveUpdates(_0x18f94d[_0xa24f('0x5d')],null))['then'](respondWithResult(_0xabf90b,null))[_0xa24f('0x2c')](handleError(_0xabf90b,null));};exports[_0xa24f('0x3b')]=function(_0x5cd620,_0x25104d){return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0x5cd620[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x25104d,null))['then'](removeEntity(_0x25104d,null))[_0xa24f('0x2c')](handleError(_0x25104d,null));};exports['describe']=function(_0x2591de,_0x3425ca){return db['SmsAccount'][_0xa24f('0x68')]()['then'](respondWithResult(_0x3425ca,null))['catch'](handleError(_0x3425ca,null));};exports[_0xa24f('0x69')]=function(_0x29ff40,_0x16d94e,_0x361797){if(_0x29ff40[_0xa24f('0x5d')]['id']){delete _0x29ff40[_0xa24f('0x5d')]['id'];}return db[_0xa24f('0x42')]['find']({'where':{'id':_0x29ff40['params']['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x16d94e,null))[_0xa24f('0x22')](function(_0x1f4d9e){if(_0x1f4d9e){_0x29ff40[_0xa24f('0x5d')][_0xa24f('0x6a')]=_0x1f4d9e['id'];return db[_0xa24f('0x6b')][_0xa24f('0x5c')](_0x29ff40[_0xa24f('0x5d')]);}})[_0xa24f('0x22')](respondWithResult(_0x16d94e,null))[_0xa24f('0x2c')](handleError(_0x16d94e,null));};exports['getDispositions']=function(_0x4dcc9c,_0x315acb,_0x3f1855){var _0x9eb6f3={'raw':![],'where':{}};var _0x2c2c1f={};var _0x4ab89b={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa24f('0x6c')]({'where':{'id':_0x4dcc9c[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x315acb,null))[_0xa24f('0x22')](function(_0x354355){if(_0x354355){_0x2c2c1f[_0xa24f('0x45')]=_[_0xa24f('0x48')](db[_0xa24f('0x6b')][_0xa24f('0x43')]);_0x2c2c1f[_0xa24f('0x47')]=_['keys'](_0x4dcc9c[_0xa24f('0x47')]);_0x2c2c1f[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x2c2c1f[_0xa24f('0x45')],_0x2c2c1f[_0xa24f('0x47')]);_0x9eb6f3[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x2c2c1f[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x4dcc9c['query'][_0xa24f('0x4a')]));_0x9eb6f3['attributes']=_0x9eb6f3[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0x9eb6f3[_0xa24f('0x4b')]:_0x2c2c1f[_0xa24f('0x45')];if(!_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x4d')]('nolimit')){_0x9eb6f3['limit']=qs[_0xa24f('0x33')](_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x33')]);_0x9eb6f3[_0xa24f('0x31')]=qs[_0xa24f('0x31')](_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x31')]);}_0x9eb6f3[_0xa24f('0x4f')]=qs['sort'](_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x50')]);_0x9eb6f3[_0xa24f('0x51')]=qs['filters'](_[_0xa24f('0x53')](_0x4dcc9c[_0xa24f('0x47')],_0x2c2c1f[_0xa24f('0x52')]));_0x9eb6f3['where'][_0xa24f('0x6a')]=_0x354355['id'];if(_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x56')]){_0x9eb6f3['where']=_[_0xa24f('0x54')](_0x9eb6f3['where'],{'$or':_[_0xa24f('0x46')](_0x9eb6f3['attributes'],function(_0x30daaa){var _0x223e55={};_0x223e55[_0x30daaa]={'$like':'%'+_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x223e55;})});}_0x9eb6f3=_['merge']({},_0x9eb6f3,_0x4dcc9c['options']);return db[_0xa24f('0x6b')]['count']({'where':_0x9eb6f3[_0xa24f('0x51')]})[_0xa24f('0x22')](function(_0x120dcc){_0x4ab89b[_0xa24f('0x34')]=_0x120dcc;if(_0x4dcc9c['query'][_0xa24f('0x58')]){_0x9eb6f3['include']=[{'all':!![]}];}return db['Disposition'][_0xa24f('0x59')](_0x9eb6f3);})[_0xa24f('0x22')](function(_0x25020b){_0x4ab89b['rows']=_0x25020b;return _0x4ab89b;});}})[_0xa24f('0x22')](respondWithFilteredResult(_0x315acb,_0x9eb6f3))[_0xa24f('0x2c')](handleError(_0x315acb,null));};exports[_0xa24f('0x6d')]=function(_0x29ac5e,_0x472ccc,_0xf2e223){return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0x29ac5e[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x472ccc,null))[_0xa24f('0x22')](function(_0x5aa8a4){if(_0x5aa8a4){return _0x5aa8a4[_0xa24f('0x6d')](_0x29ac5e[_0xa24f('0x47')][_0xa24f('0x6e')]);}})[_0xa24f('0x22')](respondWithStatusCode(_0x472ccc,null))['catch'](handleError(_0x472ccc,null));};exports[_0xa24f('0x6f')]=function(_0x2c1631,_0x3f03f,_0x2b2184){if(_0x2c1631[_0xa24f('0x5d')]['id']){delete _0x2c1631[_0xa24f('0x5d')]['id'];}return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0x2c1631[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x3f03f,null))['then'](function(_0x3516c3){if(_0x3516c3){_0x2c1631['body']['SmsAccountId']=_0x3516c3['id'];return db[_0xa24f('0x70')]['create'](_0x2c1631[_0xa24f('0x5d')]);}})[_0xa24f('0x22')](respondWithResult(_0x3f03f,null))[_0xa24f('0x2c')](handleError(_0x3f03f,null));};exports[_0xa24f('0x71')]=function(_0x5d3198,_0x122e8e,_0x1b0356){var _0xd55cf6={'raw':![],'where':{}};var _0x54f911={};var _0x22cc85={'count':0x0,'rows':[]};return db[_0xa24f('0x42')]['findOne']({'where':{'id':_0x5d3198[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x122e8e,null))[_0xa24f('0x22')](function(_0x38ffc6){if(_0x38ffc6){_0x54f911[_0xa24f('0x45')]=_['keys'](db[_0xa24f('0x70')]['rawAttributes']);_0x54f911['query']=_['keys'](_0x5d3198['query']);_0x54f911[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x54f911[_0xa24f('0x45')],_0x54f911[_0xa24f('0x47')]);_0xd55cf6[_0xa24f('0x4b')]=_['intersection'](_0x54f911[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x5d3198[_0xa24f('0x47')]['fields']));_0xd55cf6[_0xa24f('0x4b')]=_0xd55cf6[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0xd55cf6[_0xa24f('0x4b')]:_0x54f911[_0xa24f('0x45')];if(!_0x5d3198['query'][_0xa24f('0x4d')]('nolimit')){_0xd55cf6['limit']=qs[_0xa24f('0x33')](_0x5d3198['query'][_0xa24f('0x33')]);_0xd55cf6['offset']=qs[_0xa24f('0x31')](_0x5d3198['query']['offset']);}_0xd55cf6[_0xa24f('0x4f')]=qs[_0xa24f('0x50')](_0x5d3198[_0xa24f('0x47')]['sort']);_0xd55cf6['where']=qs['filters'](_[_0xa24f('0x53')](_0x5d3198['query'],_0x54f911[_0xa24f('0x52')]));_0xd55cf6[_0xa24f('0x51')][_0xa24f('0x6a')]=_0x38ffc6['id'];if(_0x5d3198[_0xa24f('0x47')][_0xa24f('0x56')]){_0xd55cf6[_0xa24f('0x51')]=_[_0xa24f('0x54')](_0xd55cf6['where'],{'$or':_[_0xa24f('0x46')](_0xd55cf6['attributes'],function(_0x457bd6){var _0x304fed={};_0x304fed[_0x457bd6]={'$like':'%'+_0x5d3198[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x304fed;})});}_0xd55cf6=_[_0xa24f('0x54')]({},_0xd55cf6,_0x5d3198[_0xa24f('0x57')]);return db['CannedAnswer'][_0xa24f('0x34')]({'where':_0xd55cf6['where']})[_0xa24f('0x22')](function(_0x1669a4){_0x22cc85[_0xa24f('0x34')]=_0x1669a4;if(_0x5d3198[_0xa24f('0x47')][_0xa24f('0x58')]){_0xd55cf6[_0xa24f('0x5b')]=[{'all':!![]}];}return db[_0xa24f('0x70')]['findAll'](_0xd55cf6);})[_0xa24f('0x22')](function(_0x259c8b){_0x22cc85['rows']=_0x259c8b;return _0x22cc85;});}})[_0xa24f('0x22')](respondWithFilteredResult(_0x122e8e,_0xd55cf6))[_0xa24f('0x2c')](handleError(_0x122e8e,null));};exports[_0xa24f('0x72')]=function(_0x49532c,_0x495459,_0x41ebb2){return db[_0xa24f('0x42')]['find']({'where':{'id':_0x49532c['params']['id']}})['then'](handleEntityNotFound(_0x495459,null))[_0xa24f('0x22')](function(_0x2e5965){if(_0x2e5965){return _0x2e5965[_0xa24f('0x72')](_0x49532c[_0xa24f('0x47')][_0xa24f('0x6e')]);}})[_0xa24f('0x22')](respondWithStatusCode(_0x495459,null))[_0xa24f('0x2c')](handleError(_0x495459,null));};exports[_0xa24f('0x73')]=function(_0x1be0ad,_0x1ddc8a,_0x4131db){var _0x1fdbd1={'channel':_0xa24f('0x74')};var _0x387a2a=[];var _0x44a597=[];var _0x4e7a45={};return db[_0xa24f('0x42')]['find']({'where':{'id':_0x1be0ad[_0xa24f('0x67')]['id']},'include':[{'model':db[_0xa24f('0x75')],'as':'Applications'}]})[_0xa24f('0x22')](handleEntityNotFound(_0x1ddc8a,null))[_0xa24f('0x22')](function(_0x478d70){_0x1fdbd1[_0xa24f('0x76')]=_0x478d70;_0x1fdbd1[_0xa24f('0x77')]=_[_0xa24f('0x78')](_0x478d70[_0xa24f('0x79')],['priority'],['asc']);if(_0x1fdbd1[_0xa24f('0x76')][_0xa24f('0x79')]){delete _0x1fdbd1[_0xa24f('0x76')]['Applications'];}return db['CmContact'][_0xa24f('0x68')]();})[_0xa24f('0x22')](function(_0x4621bf){if(!_0x4621bf){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))]('no\x20available\x20attributes');}_0x387a2a=_['difference'](_[_0xa24f('0x48')](_0x4621bf),[_0xa24f('0x7c'),'updatedAt']);_0x44a597=_['difference'](_[_0xa24f('0x48')](_0x4621bf),['createdAt',_0xa24f('0x7d'),_0xa24f('0x7e'),_0xa24f('0x7f')]);_0x1fdbd1[_0xa24f('0x5d')]={'mapKey':_0xa24f('0x80')};if(_0x1fdbd1[_0xa24f('0x76')]['type']){switch(_0x1fdbd1[_0xa24f('0x76')]['type']){case _0xa24f('0x81'):_0x1fdbd1['body'][_0xa24f('0x82')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x83')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x84')];_0x1fdbd1['body'][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x86')];break;case _0xa24f('0x87'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]='+'+_0x1be0ad['body'][_0xa24f('0x88')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x89')];break;case _0xa24f('0x8a'):_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x82')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x2a')];break;case _0xa24f('0x8b'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]=_0x1be0ad[_0xa24f('0x5d')]['from'];_0x1fdbd1['body'][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x5d')];_0x1fdbd1[_0xa24f('0x5d')]['messageId']=_0x1be0ad['body'][_0xa24f('0x8c')];break;case'plivo':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]=_0x1be0ad['body']['From'];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x8d')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x8e')];break;case _0xa24f('0x8f'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]='+'+_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x90')][0x0][_0xa24f('0x82')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad['body'][_0xa24f('0x90')][0x0]['text'];_0x1fdbd1['body'][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')]['results'][0x0][_0xa24f('0x85')];break;case _0xa24f('0x91'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x92')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad['body'][_0xa24f('0x93')][_0xa24f('0x2a')];break;case _0xa24f('0x94'):_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x95')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x89')];_0x1fdbd1['body'][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x96')];break;case _0xa24f('0x97'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x85')]=_0x1be0ad['body'][0x0][_0xa24f('0x2a')]['id'];_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad[_0xa24f('0x5d')][0x0][_0xa24f('0x2a')][_0xa24f('0x82')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][0x0]['message'][_0xa24f('0x89')];break;case _0xa24f('0x98'):_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad['body'][_0xa24f('0x82')];_0x1fdbd1['body'][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x2a')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x85')]=_0x1be0ad['body'][_0xa24f('0x99')];break;}}if(_0x1fdbd1[_0xa24f('0x5d')]['id']){delete _0x1fdbd1[_0xa24f('0x5d')]['id'];}if(_[_0xa24f('0x9a')](_0x1fdbd1['body'][_0xa24f('0x82')])){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))](_0xa24f('0x9b'));}if(_[_0xa24f('0x9a')](_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')])||_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]===''){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))](_0xa24f('0x9c'));}if(_['isNil'](_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')])){throw new db['Sequelize']['ValidationError'](_0xa24f('0x9e')+_0x44a597);}if(!_[_0xa24f('0x9f')](_0x44a597,_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')])){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x44a597);}_0x4e7a45[_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')]]=_0x1fdbd1[_0xa24f('0x5d')]['from'];return db[_0xa24f('0xa0')]['find']({'where':{'id':_0x1fdbd1['account'][_0xa24f('0x7f')]},'include':[{'model':db['CmContact'],'as':_0xa24f('0xa1'),'where':_0x4e7a45,'limit':0x1,'order':[[_0xa24f('0x7d'),_0xa24f('0xa2')]]}]});})['then'](handleEntityNotFound(_0x1ddc8a,null))[_0xa24f('0x22')](function(_0x1f04cf){if(_0x1f04cf){_0x1fdbd1[_0xa24f('0xa3')]=_[_0xa24f('0xa4')](_0x1f04cf,['Contacts']);if(_0x1f04cf['Contacts']['length']){return _0x1f04cf[_0xa24f('0xa1')][0x0];}var _0x5b4dea=_[_0xa24f('0x1a')](_0x1fdbd1[_0xa24f('0x5d')],{'firstName':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')],'ListId':_0x1f04cf['id']});_0x5b4dea[_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')]]=_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')];return db['CmContact']['create'](_0x5b4dea,{'fields':_0x387a2a,'raw':!![]});}})['then'](handleEntityNotFound(_0x1ddc8a,null))[_0xa24f('0x22')](function(_0x31c42f){if(_0x31c42f){_0x1fdbd1['contact']=_0x31c42f;var _0x3a1c90={'ContactId':_0x31c42f['id'],'phone':_0x1fdbd1[_0xa24f('0x5d')]['from'],'SmsAccountId':_0x1be0ad[_0xa24f('0x67')]['id']};var _0x3099fa={'ContactId':_0x31c42f['id'],'SmsAccountId':_0x1be0ad[_0xa24f('0x67')]['id'],'closed':![]};return db[_0xa24f('0xa5')][_0xa24f('0x61')]({'where':_0x3099fa})[_0xa24f('0x22')](function(_0x572aca){if(_0x572aca){return[_0x572aca,![]];}return db['SmsInteraction']['create'](_0x3a1c90)['then'](function(_0x1414a8){return[_0x1414a8,!![]];});});}})[_0xa24f('0xa6')](function(_0x4856c9,_0xf6adee){_0x1fdbd1[_0xa24f('0xa7')]=_0x4856c9[_0xa24f('0x5e')]({'plain':!![]});_0x1fdbd1[_0xa24f('0xa7')][_0xa24f('0xa8')]=![];if(_0xf6adee){if(_0x1fdbd1[_0xa24f('0x76')][_0xa24f('0xa9')]){_0x1fdbd1['applications'][_0xa24f('0xaa')]({'id':0x0,'priority':_0x1fdbd1[_0xa24f('0x77')][_0xa24f('0x4c')]+0x1,'app':_0xa24f('0xab'),'appdata':_0xa24f('0xac'),'interval':_0xa24f('0xad')});}_0x1fdbd1['interaction'][_0xa24f('0xa8')]=!![];}return db[_0xa24f('0xae')]['create']({'phone':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')],'messageId':_0x1fdbd1['body'][_0xa24f('0x85')],'body':_0x1fdbd1['body']['body'],'SmsAccountId':_0x1be0ad[_0xa24f('0x67')]['id'],'SmsInteractionId':_0x4856c9['id'],'direction':'in','ContactId':_0x4856c9[_0xa24f('0xaf')],'AttachmentId':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0xb0')]});})['then'](function(_0x28cd40){_0x1fdbd1[_0xa24f('0x2a')]=_0x28cd40;if(!_0x1fdbd1['interaction'][_0xa24f('0xb1')])return;return db[_0xa24f('0xb2')]['find']({'attributes':['id',_0xa24f('0x3d')],'where':{'id':_0x1fdbd1[_0xa24f('0xa7')][_0xa24f('0xb1')]}});})['then'](function(_0x26e735){if(_0x26e735){_0x1fdbd1[_0xa24f('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa24f('0xb3'),'appdata':_0x26e735['name']+','+(_0x1fdbd1['account']['waitForTheAssignedAgent']||0xa),'interval':_0xa24f('0xad')});}if(!_0x1fdbd1[_0xa24f('0xa7')][_0xa24f('0xb4')])return;return db[_0xa24f('0xb5')]['find']({'attributes':['id',_0xa24f('0x3d')],'where':{'id':_0x1fdbd1['interaction'][_0xa24f('0xb4')]}});})[_0xa24f('0x22')](function(_0x5127d6){if(_0x5127d6){_0x1fdbd1[_0xa24f('0x77')][_0xa24f('0xb6')]({'id':0x0,'priority':0x1,'app':_0xa24f('0xb7'),'appdata':_0x5127d6[_0xa24f('0x3d')]+','+(_0x1fdbd1['account'][_0xa24f('0xb8')]||0x12c),'interval':_0xa24f('0xad')});}return respondWithRpcPromise(_0xa24f('0xb9'),_0xa24f('0xba'),_0x1fdbd1);})[_0xa24f('0x22')](function(_0x9e9822){if(_0x9e9822){var _0x26582e=0xc8;var _0x35cfd1=_0xa24f('0xbb');logger[_0xa24f('0x23')](_0xa24f('0x26'),_0x35cfd1,_0x26582e,_0xa24f('0xbc'));logger[_0xa24f('0x25')](_0xa24f('0xbd'),_0x35cfd1,_0x26582e,_0xa24f('0xbc'),JSON['stringify'](_0x9e9822));if(_0x1fdbd1[_0xa24f('0x76')][_0xa24f('0x44')]==='twilio'){return _0x1ddc8a['status'](_0x26582e)[_0xa24f('0x35')](_0xa24f('0xbe'),_0xa24f('0xbf'))[_0xa24f('0x3e')](_0xa24f('0xc0'));}else{return _0x1ddc8a[_0xa24f('0x2f')](_0x26582e)[_0xa24f('0x30')](_0x9e9822);}}})[_0xa24f('0x2c')](handleError(_0x1ddc8a,null));};exports[_0xa24f('0xc1')]=function(_0x3c902b,_0x459f6d){var _0x33fc58=_0x3c902b[_0xa24f('0x67')]['id'];var _0x5aa93a=_0x3c902b[_0xa24f('0x5d')];var _0xc42843=0xc8;var _0xf05590=null;return db[_0xa24f('0xc2')][_0xa24f('0xc3')]({'isolationLevel':db[_0xa24f('0xc2')][_0xa24f('0xc4')]['ISOLATION_LEVELS'][_0xa24f('0xc5')]},function(_0x4a7f7d){return db[_0xa24f('0x42')]['findOne']({'where':{'id':_0x33fc58},'transaction':_0x4a7f7d})[_0xa24f('0x22')](function(_0x1b9872){if(_0x1b9872){return db[_0xa24f('0x75')]['destroy']({'where':{'SmsAccountId':_0x33fc58},'transaction':_0x4a7f7d})[_0xa24f('0x22')](function(){var _0x27ea93=_[_0xa24f('0x46')](_0x5aa93a,function(_0x3191c9){_0x3191c9[_0xa24f('0x6a')]=_0x33fc58;return _0x3191c9;});return db[_0xa24f('0x75')][_0xa24f('0xc6')](_0x27ea93,{'transaction':_0x4a7f7d});});}else{_0xc42843=0x194;_0xf05590=[];}});})[_0xa24f('0x22')](function(){if(_0xc42843!==0x194){return db[_0xa24f('0x75')][_0xa24f('0xc7')]({'where':{'SmsAccountId':_0x33fc58},'order':_0xa24f('0xc8')})[_0xa24f('0x22')](function(_0x53df4c){_0xf05590=_0x53df4c;});}})['catch'](function(_0xe768a2){_0xc42843=0x1f4;logger[_0xa24f('0x28')](_0xe768a2[_0xa24f('0x3c')]);if(_0xe768a2['name']){delete _0xe768a2['name'];}_0xf05590=_0xe768a2;})[_0xa24f('0xc9')](function(){if(_0xf05590===null){_0x459f6d[_0xa24f('0x2d')](_0xc42843);}else{if(_0xc42843===0x1f4){_0x459f6d[_0xa24f('0x2f')](_0xc42843)[_0xa24f('0x3e')](_0xf05590);}else{_0x459f6d[_0xa24f('0x2f')](_0xc42843)[_0xa24f('0x30')](_0xf05590);}}});};exports[_0xa24f('0xca')]=function(_0x1565f0,_0x8776ea,_0x1992dc){var _0x56f335={};var _0x314fda={};var _0xf97991;var _0x5e8ff5;return db['SmsAccount'][_0xa24f('0x6c')]({'where':{'id':_0x1565f0[_0xa24f('0x67')]['id']}})['then'](handleEntityNotFound(_0x8776ea,null))[_0xa24f('0x22')](function(_0x21e14d){if(_0x21e14d){_0xf97991=_0x21e14d;_0x314fda['model']=_[_0xa24f('0x48')](db[_0xa24f('0x75')][_0xa24f('0x43')]);_0x314fda[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x1565f0[_0xa24f('0x47')]);_0x314fda[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x314fda[_0xa24f('0x45')],_0x314fda[_0xa24f('0x47')]);_0x56f335[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x314fda['model'],qs[_0xa24f('0x4a')](_0x1565f0['query']['fields']));_0x56f335[_0xa24f('0x4b')]=_0x56f335['attributes']['length']?_0x56f335[_0xa24f('0x4b')]:_0x314fda[_0xa24f('0x45')];_0x56f335[_0xa24f('0x4f')]=qs['sort'](_0x1565f0[_0xa24f('0x47')][_0xa24f('0x50')]);_0x56f335['where']=qs[_0xa24f('0x52')](_[_0xa24f('0x53')](_0x1565f0[_0xa24f('0x47')],_0x314fda[_0xa24f('0x52')]));if(_0x1565f0[_0xa24f('0x47')]['filter']){_0x56f335[_0xa24f('0x51')]=_[_0xa24f('0x54')](_0x56f335['where'],{'$or':_[_0xa24f('0x46')](_0x56f335[_0xa24f('0x4b')],function(_0x527124){var _0x51bf77={};_0x51bf77[_0x527124]={'$like':'%'+_0x1565f0[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x51bf77;})});}_0x56f335=_[_0xa24f('0x54')]({},_0x56f335,_0x1565f0[_0xa24f('0x57')]);return _0xf97991[_0xa24f('0xca')](_0x56f335);}})[_0xa24f('0x22')](function(_0x391d6f){if(_0x391d6f){_0x5e8ff5=_0x391d6f['length'];if(!_0x1565f0[_0xa24f('0x47')]['hasOwnProperty'](_0xa24f('0x4e'))){_0x56f335[_0xa24f('0x33')]=qs[_0xa24f('0x33')](_0x1565f0[_0xa24f('0x47')]['limit']);_0x56f335['offset']=qs[_0xa24f('0x31')](_0x1565f0[_0xa24f('0x47')][_0xa24f('0x31')]);}return _0xf97991[_0xa24f('0xca')](_0x56f335);}})[_0xa24f('0x22')](function(_0x28e2c3){if(_0x28e2c3){return _0x28e2c3?{'count':_0x5e8ff5,'rows':_0x28e2c3}:null;}})[_0xa24f('0x22')](respondWithResult(_0x8776ea,null))[_0xa24f('0x2c')](handleError(_0x8776ea,null));};exports[_0xa24f('0xcb')]=function(_0x1b5366,_0x4c0a9e,_0xc11a23){var _0x40eab8={'raw':![],'where':{}};var _0x209f2c={};var _0x336f62={'count':0x0,'rows':[]};return db[_0xa24f('0x42')][_0xa24f('0x6c')]({'where':{'id':_0x1b5366[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x4c0a9e,null))['then'](function(_0x31991e){if(_0x31991e){_0x209f2c[_0xa24f('0x45')]=_[_0xa24f('0x48')](db[_0xa24f('0xa5')]['rawAttributes']);_0x209f2c[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x1b5366[_0xa24f('0x47')]);_0x209f2c[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x209f2c[_0xa24f('0x45')],_0x209f2c[_0xa24f('0x47')]);_0x40eab8[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x209f2c[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x1b5366['query']['fields']));_0x40eab8[_0xa24f('0x4b')]=_0x40eab8['attributes'][_0xa24f('0x4c')]?_0x40eab8[_0xa24f('0x4b')]:_0x209f2c['model'];if(!_0x1b5366[_0xa24f('0x47')][_0xa24f('0x4d')]('nolimit')){_0x40eab8[_0xa24f('0x33')]=qs['limit'](_0x1b5366['query'][_0xa24f('0x33')]);_0x40eab8['offset']=qs[_0xa24f('0x31')](_0x1b5366[_0xa24f('0x47')][_0xa24f('0x31')]);}_0x40eab8['order']=qs[_0xa24f('0x50')](_0x1b5366[_0xa24f('0x47')][_0xa24f('0x50')]);_0x40eab8[_0xa24f('0x51')]=qs['filters'](_[_0xa24f('0x53')](_0x1b5366['query'],_0x209f2c['filters']));_0x40eab8[_0xa24f('0x51')][_0xa24f('0x6a')]=_0x31991e['id'];if(_0x1b5366['query'][_0xa24f('0x56')]){_0x40eab8[_0xa24f('0x51')]=_[_0xa24f('0x54')](_0x40eab8[_0xa24f('0x51')],{'$or':_[_0xa24f('0x46')](_0x40eab8[_0xa24f('0x4b')],function(_0x4ce1fd){var _0x1590d4={};_0x1590d4[_0x4ce1fd]={'$like':'%'+_0x1b5366[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x1590d4;})});}_0x40eab8=_[_0xa24f('0x54')]({},_0x40eab8,_0x1b5366[_0xa24f('0x57')]);return db[_0xa24f('0xa5')][_0xa24f('0x34')]({'where':_0x40eab8[_0xa24f('0x51')]})[_0xa24f('0x22')](function(_0x1788e1){_0x336f62[_0xa24f('0x34')]=_0x1788e1;if(_0x1b5366['query']['includeAll']){_0x40eab8[_0xa24f('0x5b')]=[{'model':db[_0xa24f('0xcc')],'as':_0xa24f('0xcd'),'required':![]},{'model':db[_0xa24f('0xb2')],'as':_0xa24f('0xce'),'attributes':[_0xa24f('0x3d'),_0xa24f('0xcf'),_0xa24f('0xd0')],'required':![]},{'model':db[_0xa24f('0xd1')],'as':_0xa24f('0xd2'),'attributes':['id',_0xa24f('0x3d'),_0xa24f('0xd3')],'where':_0x1b5366[_0xa24f('0x47')][_0xa24f('0xd4')]?{'id':_0x1b5366['query'][_0xa24f('0xd4')]}:undefined,'required':_0x1b5366[_0xa24f('0x47')][_0xa24f('0xd4')]?!![]:![]}];}return db[_0xa24f('0xa5')]['findAll'](_0x40eab8);})['then'](function(_0x53ca86){_0x336f62[_0xa24f('0x5a')]=_0x53ca86;return _0x336f62;});}})[_0xa24f('0x22')](respondWithFilteredResult(_0x4c0a9e,_0x40eab8))[_0xa24f('0x2c')](handleError(_0x4c0a9e,null));};exports[_0xa24f('0x3e')]=function(_0x3e8d7e,_0x4e450d,_0x5d1aa8){var _0x44e620,_0x5b7cd1,_0x234738;if(_['isNil'](_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')])||_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')]===''){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa24f('0x9a')](_0x3e8d7e['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xa24f('0xd5'));}_0x44e620=_0x3e8d7e[_0xa24f('0x5d')]['to'];return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0x3e8d7e[_0xa24f('0x67')]['id']},'include':[{'model':db[_0xa24f('0xa0')],'as':_0xa24f('0xd6'),'include':[{'model':db[_0xa24f('0xcc')],'as':_0xa24f('0xa1'),'where':{'mobile':_0x44e620},'limit':0x1,'order':[[_0xa24f('0x7d'),_0xa24f('0xa2')]]}]}]})[_0xa24f('0x22')](handleEntityNotFound(_0x4e450d,null))[_0xa24f('0x22')](function(_0x551d52){if(_0x551d52&&_0x551d52[_0xa24f('0xd6')]){_0x5b7cd1=_0x551d52[_0xa24f('0x5e')]({'plain':!![]});if(_0x5b7cd1[_0xa24f('0xd6')]&&_0x5b7cd1[_0xa24f('0xd6')][_0xa24f('0xa1')][_0xa24f('0x4c')]){return _0x5b7cd1[_0xa24f('0xd6')][_0xa24f('0xa1')][0x0];}return db[_0xa24f('0xcc')][_0xa24f('0x5c')](_['defaults'](_0x3e8d7e[_0xa24f('0x5d')],{'firstName':_0x44e620,'mobile':_0x44e620,'phone':_0x44e620,'ListId':_0x5b7cd1['ListId']}));}})[_0xa24f('0x22')](handleEntityNotFound(_0x4e450d,null))[_0xa24f('0x22')](function(_0x21bf6b){if(_0x21bf6b){_0x234738=_0x21bf6b;return db['SmsInteraction'][_0xa24f('0x61')]({'where':{'ContactId':_0x234738['id'],'closed':![],'SmsAccountId':_0x5b7cd1['id']}})['then'](function(_0xa43b8e){if(_0xa43b8e){return[_0xa43b8e,![]];}return db['SmsInteraction'][_0xa24f('0x5c')]({'UserId':_0x3e8d7e[_0xa24f('0x60')]['id'],'ContactId':_0x234738['id'],'SmsAccountId':_0x5b7cd1['id'],'phone':_0x44e620,'firstMsgDirection':'out','Messages':[_[_0xa24f('0x54')](_0x3e8d7e[_0xa24f('0x5d')],{'read':![],'body':_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')],'phone':_0x44e620,'SmsAccountId':_0x5b7cd1['id'],'UserId':_0x3e8d7e[_0xa24f('0x60')]['id'],'ContactId':_0x234738['id']})]},{'include':[{'model':db[_0xa24f('0xae')],'as':_0xa24f('0xd7')}]})[_0xa24f('0x22')](function(_0x5a25c1){return[_0x5a25c1,!![]];});});}})[_0xa24f('0xa6')](function(_0x224142,_0x555cd5){if(_0x555cd5){return _0x224142;}return db['SmsMessage'][_0xa24f('0x5c')](_[_0xa24f('0x54')](_0x3e8d7e[_0xa24f('0x5d')],{'read':![],'body':_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')],'phone':_0x44e620,'SmsAccountId':_0x5b7cd1['id'],'SmsInteractionId':_0x224142['id'],'UserId':_0x3e8d7e[_0xa24f('0x60')]['id'],'ContactId':_0x234738['id']}))[_0xa24f('0x22')](function(_0x26ec11){_0x224142['dataValues'][_0xa24f('0xd7')]=[];_0x224142[_0xa24f('0xd8')]['Messages'][_0xa24f('0xaa')](_0x26ec11[_0xa24f('0xd8')]);return _0x224142;});})['then'](respondWithResult(_0x4e450d,null))['catch'](handleError(_0x4e450d,null));};exports[_0xa24f('0x2f')]=function(_0x38fc4c,_0x13820d,_0x1287a5){if(_0x38fc4c[_0xa24f('0x5d')]['id']){delete _0x38fc4c['body']['id'];}var _0x49debe,_0x3c6ab0,_0x26cf3f;return db[_0xa24f('0x42')]['find']({'where':{'id':_0x38fc4c[_0xa24f('0x67')]['id']}})['then'](handleEntityNotFound(_0x13820d,null))[_0xa24f('0x22')](function(_0x3ab20f){if(_0x3ab20f){_0x26cf3f=_0x3ab20f;logger[_0xa24f('0x25')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0xd9'),_0x3ab20f[_0xa24f('0x44')],util[_0xa24f('0xda')](_0x38fc4c['body'],{'showHidden':![],'depth':null}));switch(_0x3ab20f[_0xa24f('0x44')]){case'skebby':if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdb')]&&_0x38fc4c[_0xa24f('0x5d')]['status']){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x2f')];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c['body'][_0xa24f('0xdb')]}});}break;case _0xa24f('0x8a'):if(_0x38fc4c[_0xa24f('0x5d')]['requestid']&&_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdc')]){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdc')];return db['SmsMessage'][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdd')]}});}break;case _0xa24f('0x8b'):if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x8c')]&&_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xde')]){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xde')];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x8c')]}});}break;case _0xa24f('0x8f'):var _0x3475a7=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x90')][0x0];if(_0x3475a7[_0xa24f('0x85')]&&_0x3475a7[_0xa24f('0x2f')]['groupName']===_0xa24f('0xdf')){_0x3c6ab0=_0x3475a7[_0xa24f('0x2f')][_0xa24f('0xe0')];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x3475a7['messageId']}});}break;case'clickatell':if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x85')]&&_0x38fc4c[_0xa24f('0x5d')]['status']){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')]['status'];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c['body']['messageId']}});}break;case _0xa24f('0x97'):if(_0x38fc4c[_0xa24f('0x5d')][0x0]['message']['id']){_0x3c6ab0=_0x38fc4c['body'][0x0][_0xa24f('0x44')];return db[_0xa24f('0xae')]['find']({'where':{'messageId':_0x38fc4c[_0xa24f('0x5d')][0x0][_0xa24f('0x2a')]['id']}});}break;case _0xa24f('0x98'):if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xe1')]&&_0x38fc4c['body'][_0xa24f('0x2f')]){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')]['status'];return db['SmsMessage'][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c['body'][_0xa24f('0xe1')]}});}break;}}})[_0xa24f('0x22')](handleEntityNotFound(_0x13820d,null))[_0xa24f('0x22')](function(_0x1ff644){if(_0x1ff644){_0x49debe=_0x1ff644;switch(_0x26cf3f['type']){case _0xa24f('0x87'):if(_0x3c6ab0===_0xa24f('0xdf')){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x87'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa24f('0x8a'):if(_0x3c6ab0==='1'){return _0x49debe['update']({'read':!![]});}else{logger[_0xa24f('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa24f('0x2f'),_0xa24f('0x87'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xe2')]&&_0x3c6ab0>=0xc8&&_0x3c6ab0<=0xce){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),'status',_0xa24f('0x8b'),util['inspect'](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa24f('0x8f'):var _0x39b880=_0x38fc4c['body'][_0xa24f('0x90')][0x0];if(_0x39b880[_0xa24f('0x2f')][_0xa24f('0xe0')]===_0xa24f('0xdf')){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger['error'](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x8f'),util[_0xa24f('0xda')](_0x38fc4c['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3c6ab0==_0xa24f('0xe3')||_0x3c6ab0=='RECEIVED_BY_RECIPIENT'){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x94'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3c6ab0==_0xa24f('0xe4')){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x97'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa24f('0x98'):if(_0x3c6ab0===_0xa24f('0xe5')||_0x3c6ab0==='ACCEPTD'){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),'status',_0xa24f('0x98'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x49debe;}})[_0xa24f('0x22')](respondWithResult(_0x13820d,null))[_0xa24f('0x2c')](handleError(_0x13820d,null));};exports['statusGet']=function(_0xd2c76d,_0x365d0f,_0x423efe){var _0x5bd3b5,_0x36f317,_0x434ebf;return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0xd2c76d[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x365d0f,null))[_0xa24f('0x22')](function(_0x36a480){if(_0x36a480){_0x434ebf=_0x36a480;logger[_0xa24f('0x25')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0xd9'),_0x36a480['type'],util[_0xa24f('0xda')](_0xd2c76d['query'],{'showHidden':![],'depth':null}));switch(_0x36a480[_0xa24f('0x44')]){case _0xa24f('0x91'):if(_0xd2c76d[_0xa24f('0x47')][_0xa24f('0xe6')]&&_0xd2c76d[_0xa24f('0x47')][_0xa24f('0xe7')]){_0x36f317=_0xd2c76d[_0xa24f('0x47')]['state'];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0xd2c76d[_0xa24f('0x47')][_0xa24f('0xe6')]}});}break;}}})['then'](handleEntityNotFound(_0x365d0f,null))[_0xa24f('0x22')](function(_0x7b3d1e){if(_0x7b3d1e){_0x5bd3b5=_0x7b3d1e;switch(_0x434ebf[_0xa24f('0x44')]){case _0xa24f('0x91'):if(_0x36f317==='2'||_0x36f317==='6'){return _0x5bd3b5['update']({'read':!![]});}else{logger[_0xa24f('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa24f('0x2f'),_0xa24f('0x91'),util['inspect'](_0xd2c76d[_0xa24f('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x5bd3b5;}})['then'](respondWithResult(_0x365d0f,null))['catch'](handleError(_0x365d0f,null));};exports[_0xa24f('0xe8')]=function(_0x50283d,_0x1c3747,_0x4a82f5){return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0x50283d[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x1c3747,null))[_0xa24f('0x22')](function(_0x5e075f){if(_0x5e075f){return _0x5e075f[_0xa24f('0xe8')](_0x50283d[_0xa24f('0x5d')][_0xa24f('0x6e')],_[_0xa24f('0xa4')](_0x50283d['body'],[_0xa24f('0x6e'),'id'])||{})[_0xa24f('0xa6')](function(_0x33deed){for(var _0x5b7563=0x0;_0x5b7563<_0x50283d[_0xa24f('0x5d')][_0xa24f('0x6e')]['length'];_0x5b7563+=0x1){socket[_0xa24f('0xe9')]('userSmsAccount:save',{'UserId':Number(_0x50283d[_0xa24f('0x5d')]['ids'][_0x5b7563]),'SmsAccountId':Number(_0x50283d['params']['id'])});}return _0x33deed;});}})[_0xa24f('0x22')](respondWithResult(_0x1c3747,null))[_0xa24f('0x2c')](handleError(_0x1c3747,null));};exports[_0xa24f('0xea')]=function(_0xa1b8e9,_0x30af8b,_0x1d6a7f){return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0xa1b8e9['params']['id']}})['then'](handleEntityNotFound(_0x30af8b,null))[_0xa24f('0x22')](function(_0xff807e){if(_0xff807e){return _0xff807e[_0xa24f('0xea')](_0xa1b8e9[_0xa24f('0x47')][_0xa24f('0x6e')])[_0xa24f('0x22')](function(){if(_['isArray'](_0xa1b8e9[_0xa24f('0x47')][_0xa24f('0x6e')])){for(var _0x561e33=0x0;_0x561e33<_0xa1b8e9[_0xa24f('0x47')][_0xa24f('0x6e')][_0xa24f('0x4c')];_0x561e33+=0x1){socket[_0xa24f('0xe9')](_0xa24f('0xeb'),{'UserId':Number(_0xa1b8e9['query'][_0xa24f('0x6e')][_0x561e33]),'SmsAccountId':Number(_0xa1b8e9['params']['id'])});}}else{socket[_0xa24f('0xe9')](_0xa24f('0xeb'),{'UserId':Number(_0xa1b8e9[_0xa24f('0x47')]['ids']),'SmsAccountId':Number(_0xa1b8e9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x30af8b,null))[_0xa24f('0x2c')](handleError(_0x30af8b,null));};exports[_0xa24f('0xec')]=function(_0x4e76fb,_0x345c26,_0xafb0){var _0x34df07={};var _0x3af0cb={};var _0x1b174e;var _0x409634;return db['SmsAccount'][_0xa24f('0x6c')]({'where':{'id':_0x4e76fb[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x345c26,null))[_0xa24f('0x22')](function(_0x40165e){if(_0x40165e){_0x1b174e=_0x40165e;_0x3af0cb['model']=_[_0xa24f('0x48')](db[_0xa24f('0xb2')][_0xa24f('0x43')]);_0x3af0cb[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x4e76fb['query']);_0x3af0cb[_0xa24f('0x52')]=_['intersection'](_0x3af0cb[_0xa24f('0x45')],_0x3af0cb[_0xa24f('0x47')]);_0x34df07[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x3af0cb['model'],qs[_0xa24f('0x4a')](_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x4a')]));_0x34df07['attributes']=_0x34df07[_0xa24f('0x4b')]['length']?_0x34df07[_0xa24f('0x4b')]:_0x3af0cb['model'];_0x34df07[_0xa24f('0x4f')]=qs[_0xa24f('0x50')](_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x50')]);_0x34df07[_0xa24f('0x51')]=qs['filters'](_[_0xa24f('0x53')](_0x4e76fb['query'],_0x3af0cb['filters']));if(_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x56')]){_0x34df07['where']=_['merge'](_0x34df07['where'],{'$or':_[_0xa24f('0x46')](_0x34df07['attributes'],function(_0x29fc3d){var _0x50fcaf={};_0x50fcaf[_0x29fc3d]={'$like':'%'+_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x50fcaf;})});}_0x34df07=_[_0xa24f('0x54')]({},_0x34df07,_0x4e76fb[_0xa24f('0x57')]);return _0x1b174e[_0xa24f('0xec')](_0x34df07);}})[_0xa24f('0x22')](function(_0x59b13e){if(_0x59b13e){_0x409634=_0x59b13e['length'];if(!_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x4d')]('nolimit')){_0x34df07[_0xa24f('0x33')]=qs[_0xa24f('0x33')](_0x4e76fb[_0xa24f('0x47')]['limit']);_0x34df07[_0xa24f('0x31')]=qs[_0xa24f('0x31')](_0x4e76fb[_0xa24f('0x47')]['offset']);}return _0x1b174e[_0xa24f('0xec')](_0x34df07);}})[_0xa24f('0x22')](function(_0x4f34cd){if(_0x4f34cd){return _0x4f34cd?{'count':_0x409634,'rows':_0x4f34cd}:null;}})['then'](respondWithResult(_0x345c26,null))[_0xa24f('0x2c')](handleError(_0x345c26,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ed75fe4..66e916e 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 _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 +var _0x08b9=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x08b9,0xa3));var _0x908b=function(_0x4a22c5,_0x5ac44b){_0x4a22c5=_0x4a22c5-0x0;var _0x5ba569=_0x08b9[_0x4a22c5];return _0x5ba569;};'use strict';var EventEmitter=require(_0x908b('0x0'));var SmsAccount=require(_0x908b('0x1'))['db'][_0x908b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x908b('0x3')](0x0);var events={'afterCreate':_0x908b('0x4'),'afterUpdate':'update','afterDestroy':_0x908b('0x5')};function emitEvent(_0x51ebb7){return function(_0x363707,_0x354f2a,_0x4e4c33){SmsAccountEvents[_0x908b('0x6')](_0x51ebb7+':'+_0x363707['id'],_0x363707);SmsAccountEvents[_0x908b('0x6')](_0x51ebb7,_0x363707);_0x4e4c33(null);};}for(var e in events){if(events[_0x908b('0x7')](e)){var event=events[e];SmsAccount[_0x908b('0x8')](e,emitEvent(event));}}module[_0x908b('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 875097b..3ade6cb 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 _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 +var _0x0e27=['define','SmsAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0e27,0x7a));var _0x70e2=function(_0x2fadf7,_0x2bfc9d){_0x2fadf7=_0x2fadf7-0x0;var _0x5bccca=_0x0e27[_0x2fadf7];return _0x5bccca;};'use strict';var _=require('lodash');var util=require(_0x70e2('0x0'));var logger=require(_0x70e2('0x1'))(_0x70e2('0x2'));var moment=require(_0x70e2('0x3'));var BPromise=require(_0x70e2('0x4'));var rp=require(_0x70e2('0x5'));var fs=require('fs');var path=require(_0x70e2('0x6'));var rimraf=require(_0x70e2('0x7'));var config=require('../../config/environment');var attributes=require(_0x70e2('0x8'));module[_0x70e2('0x9')]=function(_0x23296e,_0x45af19){return _0x23296e[_0x70e2('0xa')](_0x70e2('0xb'),attributes,{'tableName':'sms_accounts','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 038f504..1db917c 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 _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 +var _0x4f4f=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SmsAccount','find','options','raw','attributes','map','include','model','then','ShowSmsAccount','util','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x25572a,_0x5debf7){var _0x4da0b5=function(_0xb04fa3){while(--_0xb04fa3){_0x25572a['push'](_0x25572a['shift']());}};_0x4da0b5(++_0x5debf7);}(_0x4f4f,0x1a8));var _0xf4f4=function(_0x553183,_0x5479b4){_0x553183=_0x553183-0x0;var _0xfc0ebe=_0x4f4f[_0x553183];return _0xfc0ebe;};'use strict';var _=require('lodash');var util=require(_0xf4f4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4f4('0x1'));var db=require(_0xf4f4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4f4('0x3'))(_0xf4f4('0x4'));var config=require(_0xf4f4('0x5'));var jayson=require(_0xf4f4('0x6'));var client=jayson['client'][_0xf4f4('0x7')]({'port':0x232a});config[_0xf4f4('0x8')]=_[_0xf4f4('0x9')](config[_0xf4f4('0x8')],{'host':_0xf4f4('0xa'),'port':0x18eb});var socket=require(_0xf4f4('0xb'))(new Redis(config[_0xf4f4('0x8')]));require('./smsAccount.socket')[_0xf4f4('0xc')](socket);function respondWithRpcPromise(_0x4c72b6,_0x33605a,_0xf53454){return new BPromise(function(_0x505b32,_0x312506){return client[_0xf4f4('0xd')](_0x4c72b6,_0xf53454)['then'](function(_0x2e1619){logger[_0xf4f4('0xe')](_0xf4f4('0xf'),_0x33605a,_0xf4f4('0x10'));logger[_0xf4f4('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x33605a,_0xf4f4('0x10'),JSON[_0xf4f4('0x12')](_0x2e1619));if(_0x2e1619[_0xf4f4('0x13')]){if(_0x2e1619['error'][_0xf4f4('0x14')]===0x1f4){logger[_0xf4f4('0x13')](_0xf4f4('0xf'),_0x33605a,_0x2e1619[_0xf4f4('0x13')][_0xf4f4('0x15')]);return _0x312506(_0x2e1619[_0xf4f4('0x13')][_0xf4f4('0x15')]);}logger[_0xf4f4('0x13')]('SmsAccount,\x20%s,\x20%s',_0x33605a,_0x2e1619[_0xf4f4('0x13')][_0xf4f4('0x15')]);return _0x505b32(_0x2e1619[_0xf4f4('0x13')]['message']);}else{logger[_0xf4f4('0xe')](_0xf4f4('0xf'),_0x33605a,_0xf4f4('0x10'));_0x505b32(_0x2e1619['result'][_0xf4f4('0x15')]);}})[_0xf4f4('0x16')](function(_0x83def6){logger[_0xf4f4('0x13')](_0xf4f4('0xf'),_0x33605a,_0x83def6);_0x312506(_0x83def6);});});}exports['ShowSmsAccount']=function(_0x2f674f){var _0x3a666c=this;return new Promise(function(_0x547e73,_0x58edd9){return db[_0xf4f4('0x17')][_0xf4f4('0x18')]({'raw':_0x2f674f[_0xf4f4('0x19')]?_0x2f674f[_0xf4f4('0x19')][_0xf4f4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f674f[_0xf4f4('0x19')]?_0x2f674f['options']['where']||null:null,'attributes':_0x2f674f[_0xf4f4('0x19')]?_0x2f674f[_0xf4f4('0x19')][_0xf4f4('0x1b')]||null:null,'include':_0x2f674f['options']?_0x2f674f['options']['include']?_[_0xf4f4('0x1c')](_0x2f674f[_0xf4f4('0x19')][_0xf4f4('0x1d')],function(_0x37816b){return{'model':db[_0x37816b[_0xf4f4('0x1e')]],'as':_0x37816b['as'],'attributes':_0x37816b['attributes'],'include':_0x37816b['include']?_[_0xf4f4('0x1c')](_0x37816b[_0xf4f4('0x1d')],function(_0x2dff17){return{'model':db[_0x2dff17[_0xf4f4('0x1e')]],'as':_0x2dff17['as'],'attributes':_0x2dff17[_0xf4f4('0x1b')],'include':_0x2dff17[_0xf4f4('0x1d')]?_[_0xf4f4('0x1c')](_0x2dff17[_0xf4f4('0x1d')],function(_0x317892){return{'model':db[_0x317892['model']],'as':_0x317892['as'],'attributes':_0x317892['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4f4('0x1f')](function(_0xa8ffa4){logger[_0xf4f4('0xe')](_0xf4f4('0x20'),_0x2f674f);logger[_0xf4f4('0x11')](_0xf4f4('0x20'),_0x2f674f,JSON[_0xf4f4('0x12')](_0xa8ffa4));_0x547e73(_0xa8ffa4);})[_0xf4f4('0x16')](function(_0xb1b4fb){logger[_0xf4f4('0x13')]('ShowSmsAccount',_0xb1b4fb['message'],_0x2f674f);_0x58edd9(_0x3a666c[_0xf4f4('0x13')](0x1f4,_0xb1b4fb[_0xf4f4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 06116bc..56cf7dd 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(_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 +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 b4b9b43..23f0d01 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_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 +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(_0x464889,_0x10045){var _0x3d66a4=function(_0x249969){while(--_0x249969){_0x464889['push'](_0x464889['shift']());}};_0x3d66a4(++_0x10045);}(_0x008c,0x188));var _0xc008=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x008c[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index e0c3d99..5a16c0f 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 _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 +var _0x41c6=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x2ec498,_0xe698dd){var _0x156726=function(_0x258a4a){while(--_0x258a4a){_0x2ec498['push'](_0x2ec498['shift']());}};_0x156726(++_0xe698dd);}(_0x41c6,0xe0));var _0x641c=function(_0x1e9950,_0x5db1c6){_0x1e9950=_0x1e9950-0x0;var _0x8f6b95=_0x41c6[_0x1e9950];return _0x8f6b95;};'use strict';var Sequelize=require(_0x641c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x641c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x641c('0x2')],'allowNull':![],'defaultValue':_0x641c('0x3')},'appdata':{'type':Sequelize[_0x641c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x641c('0x2')],'defaultValue':_0x641c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0a0c78a..6dce057 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 _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 +var _0x88e5=['catch','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','SmsApplication','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows'];(function(_0x54a3d0,_0x26b80c){var _0x3f898f=function(_0x423c8b){while(--_0x423c8b){_0x54a3d0['push'](_0x54a3d0['shift']());}};_0x3f898f(++_0x26b80c);}(_0x88e5,0xe3));var _0x588e=function(_0x35f3d5,_0x4cd1aa){_0x35f3d5=_0x35f3d5-0x0;var _0x2828ec=_0x88e5[_0x35f3d5];return _0x2828ec;};'use strict';var emlformat=require(_0x588e('0x0'));var rimraf=require(_0x588e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x588e('0x2'));var rp=require(_0x588e('0x3'));var moment=require(_0x588e('0x4'));var BPromise=require(_0x588e('0x5'));var Mustache=require(_0x588e('0x6'));var util=require(_0x588e('0x7'));var path=require(_0x588e('0x8'));var sox=require(_0x588e('0x9'));var csv=require(_0x588e('0xa'));var ejs=require(_0x588e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x588e('0xc'));var squel=require('squel');var crypto=require(_0x588e('0xd'));var jsforce=require(_0x588e('0xe'));var deskjs=require(_0x588e('0xf'));var toCsv=require(_0x588e('0xa'));var querystring=require(_0x588e('0x10'));var Papa=require('papaparse');var Redis=require(_0x588e('0x11'));var authService=require(_0x588e('0x12'));var qs=require(_0x588e('0x13'));var as=require(_0x588e('0x14'));var hardwareService=require(_0x588e('0x15'));var logger=require('../../config/logger')(_0x588e('0x16'));var utils=require('../../config/utils');var config=require(_0x588e('0x17'));var licenseUtil=require(_0x588e('0x18'));var db=require(_0x588e('0x19'))['db'];function respondWithStatusCode(_0x3d00f0,_0x5b5ad7){_0x5b5ad7=_0x5b5ad7||0xcc;return function(_0x295d6a){if(_0x295d6a){return _0x3d00f0[_0x588e('0x1a')](_0x5b5ad7);}return _0x3d00f0['status'](_0x5b5ad7)[_0x588e('0x1b')]();};}function respondWithResult(_0x185307,_0x111fe1){_0x111fe1=_0x111fe1||0xc8;return function(_0x4f841b){if(_0x4f841b){return _0x185307[_0x588e('0x1c')](_0x111fe1)[_0x588e('0x1d')](_0x4f841b);}};}function respondWithFilteredResult(_0x217b1a,_0x303ba2){return function(_0x5db324){if(_0x5db324){var _0x479459=typeof _0x303ba2[_0x588e('0x1e')]===_0x588e('0x1f')&&typeof _0x303ba2[_0x588e('0x20')]===_0x588e('0x1f');var _0x4e900f=_0x5db324[_0x588e('0x21')];var _0x1d0750=_0x479459?0x0:_0x303ba2[_0x588e('0x1e')];var _0x2fb34f=_0x479459?_0x5db324[_0x588e('0x21')]:_0x303ba2[_0x588e('0x1e')]+_0x303ba2[_0x588e('0x20')];var _0x2795eb;if(_0x2fb34f>=_0x4e900f){_0x2fb34f=_0x4e900f;_0x2795eb=0xc8;}else{_0x2795eb=0xce;}_0x217b1a[_0x588e('0x1c')](_0x2795eb);return _0x217b1a[_0x588e('0x22')](_0x588e('0x23'),_0x1d0750+'-'+_0x2fb34f+'/'+_0x4e900f)['json'](_0x5db324);}return null;};}function patchUpdates(_0x460e1d){return function(_0x158be5){try{jsonpatch['apply'](_0x158be5,_0x460e1d,!![]);}catch(_0x4f5b4f){return BPromise['reject'](_0x4f5b4f);}return _0x158be5['save']();};}function saveUpdates(_0x2ebb63,_0xefcc48){return function(_0xc83555){if(_0xc83555){return _0xc83555[_0x588e('0x24')](_0x2ebb63)[_0x588e('0x25')](function(_0x5c172c){return _0x5c172c;});}return null;};}function removeEntity(_0x2cbb95,_0x1c1693){return function(_0x2a86ec){if(_0x2a86ec){return _0x2a86ec[_0x588e('0x26')]()['then'](function(){_0x2cbb95[_0x588e('0x1c')](0xcc)[_0x588e('0x1b')]();});}};}function handleEntityNotFound(_0x1aa96d,_0x220673){return function(_0x471e35){if(!_0x471e35){_0x1aa96d[_0x588e('0x1a')](0x194);}return _0x471e35;};}function handleError(_0x107d70,_0x1985fa){_0x1985fa=_0x1985fa||0x1f4;return function(_0x31e97e){logger[_0x588e('0x27')](_0x31e97e[_0x588e('0x28')]);if(_0x31e97e[_0x588e('0x29')]){delete _0x31e97e[_0x588e('0x29')];}_0x107d70[_0x588e('0x1c')](_0x1985fa)['send'](_0x31e97e);};}exports[_0x588e('0x2a')]=function(_0x2fe744,_0x113f88){var _0x5e6483={},_0x48427c={},_0x462c52={'count':0x0,'rows':[]};var _0x3fb304=_['map'](db[_0x588e('0x2b')][_0x588e('0x2c')],function(_0x58cb2e){return{'name':_0x58cb2e[_0x588e('0x2d')],'type':_0x58cb2e[_0x588e('0x2e')][_0x588e('0x2f')]};});_0x48427c['model']=_[_0x588e('0x30')](_0x3fb304,'name');_0x48427c['query']=_[_0x588e('0x31')](_0x2fe744[_0x588e('0x32')]);_0x48427c[_0x588e('0x33')]=_['intersection'](_0x48427c[_0x588e('0x34')],_0x48427c[_0x588e('0x32')]);_0x5e6483[_0x588e('0x35')]=_[_0x588e('0x36')](_0x48427c[_0x588e('0x34')],qs[_0x588e('0x37')](_0x2fe744['query'][_0x588e('0x37')]));_0x5e6483[_0x588e('0x35')]=_0x5e6483['attributes']['length']?_0x5e6483[_0x588e('0x35')]:_0x48427c[_0x588e('0x34')];if(!_0x2fe744['query'][_0x588e('0x38')](_0x588e('0x39'))){_0x5e6483[_0x588e('0x20')]=qs[_0x588e('0x20')](_0x2fe744[_0x588e('0x32')]['limit']);_0x5e6483['offset']=qs[_0x588e('0x1e')](_0x2fe744['query'][_0x588e('0x1e')]);}_0x5e6483[_0x588e('0x3a')]=qs[_0x588e('0x3b')](_0x2fe744[_0x588e('0x32')]['sort']);_0x5e6483[_0x588e('0x3c')]=qs[_0x588e('0x33')](_['pick'](_0x2fe744['query'],_0x48427c[_0x588e('0x33')]),_0x3fb304);if(_0x2fe744['query']['filter']){_0x5e6483['where']=_[_0x588e('0x3d')](_0x5e6483[_0x588e('0x3c')],{'$or':_[_0x588e('0x30')](_0x3fb304,function(_0x3b1c43){if(_0x3b1c43[_0x588e('0x2e')]!==_0x588e('0x3e')){var _0x128511={};_0x128511[_0x3b1c43[_0x588e('0x29')]]={'$like':'%'+_0x2fe744[_0x588e('0x32')][_0x588e('0x3f')]+'%'};return _0x128511;}})});}_0x5e6483=_[_0x588e('0x3d')]({},_0x5e6483,_0x2fe744[_0x588e('0x40')]);var _0x3d4153={'where':_0x5e6483[_0x588e('0x3c')]};return db[_0x588e('0x2b')][_0x588e('0x21')](_0x3d4153)['then'](function(_0x31d68b){_0x462c52[_0x588e('0x21')]=_0x31d68b;if(_0x2fe744[_0x588e('0x32')][_0x588e('0x41')]){_0x5e6483[_0x588e('0x42')]=[{'all':!![]}];}return db[_0x588e('0x2b')][_0x588e('0x43')](_0x5e6483);})[_0x588e('0x25')](function(_0x282448){_0x462c52[_0x588e('0x44')]=_0x282448;return _0x462c52;})[_0x588e('0x25')](respondWithFilteredResult(_0x113f88,_0x5e6483))[_0x588e('0x45')](handleError(_0x113f88,null));};exports['show']=function(_0xc2ba91,_0x28a429){var _0x3cb239={'raw':!![],'where':{'id':_0xc2ba91['params']['id']}},_0xdf5b4e={};_0xdf5b4e[_0x588e('0x34')]=_[_0x588e('0x31')](db[_0x588e('0x2b')][_0x588e('0x2c')]);_0xdf5b4e['query']=_[_0x588e('0x31')](_0xc2ba91[_0x588e('0x32')]);_0xdf5b4e[_0x588e('0x33')]=_[_0x588e('0x36')](_0xdf5b4e[_0x588e('0x34')],_0xdf5b4e[_0x588e('0x32')]);_0x3cb239[_0x588e('0x35')]=_['intersection'](_0xdf5b4e['model'],qs[_0x588e('0x37')](_0xc2ba91[_0x588e('0x32')][_0x588e('0x37')]));_0x3cb239['attributes']=_0x3cb239[_0x588e('0x35')]['length']?_0x3cb239[_0x588e('0x35')]:_0xdf5b4e['model'];if(_0xc2ba91[_0x588e('0x32')][_0x588e('0x41')]){_0x3cb239[_0x588e('0x42')]=[{'all':!![]}];}_0x3cb239=_[_0x588e('0x3d')]({},_0x3cb239,_0xc2ba91['options']);return db[_0x588e('0x2b')][_0x588e('0x46')](_0x3cb239)[_0x588e('0x25')](handleEntityNotFound(_0x28a429,null))[_0x588e('0x25')](respondWithResult(_0x28a429,null))[_0x588e('0x45')](handleError(_0x28a429,null));};exports['create']=function(_0x199930,_0x465a99){return db[_0x588e('0x2b')][_0x588e('0x47')](_0x199930[_0x588e('0x48')],{})[_0x588e('0x25')](respondWithResult(_0x465a99,0xc9))['catch'](handleError(_0x465a99,null));};exports['update']=function(_0x4010f4,_0x5f4f18){if(_0x4010f4[_0x588e('0x48')]['id']){delete _0x4010f4[_0x588e('0x48')]['id'];}return db[_0x588e('0x2b')][_0x588e('0x46')]({'where':{'id':_0x4010f4[_0x588e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f4f18,null))[_0x588e('0x25')](saveUpdates(_0x4010f4['body'],null))[_0x588e('0x25')](respondWithResult(_0x5f4f18,null))['catch'](handleError(_0x5f4f18,null));};exports[_0x588e('0x26')]=function(_0x2035ed,_0x280271){return db['SmsApplication'][_0x588e('0x46')]({'where':{'id':_0x2035ed['params']['id']}})['then'](handleEntityNotFound(_0x280271,null))[_0x588e('0x25')](removeEntity(_0x280271,null))[_0x588e('0x45')](handleError(_0x280271,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index efec92d..1697eef 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 _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 +var _0x28c8=['request-promise','path','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','util','bluebird'];(function(_0x17240f,_0x5da80b){var _0x3b1fac=function(_0x10c62f){while(--_0x10c62f){_0x17240f['push'](_0x17240f['shift']());}};_0x3b1fac(++_0x5da80b);}(_0x28c8,0x127));var _0x828c=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x28c8[_0x1ac120];return _0x19b703;};'use strict';var _=require('lodash');var util=require(_0x828c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x828c('0x1'));var rp=require(_0x828c('0x2'));var fs=require('fs');var path=require(_0x828c('0x3'));var rimraf=require('rimraf');var config=require(_0x828c('0x4'));var attributes=require(_0x828c('0x5'));module['exports']=function(_0xc1e09d,_0x528548){return _0xc1e09d[_0x828c('0x6')](_0x828c('0x7'),attributes,{'tableName':_0x828c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index db575b6..4cc111f 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 _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 +var _0xa3db=['client','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0xa3db,0x10c));var _0xba3d=function(_0x14b6c2,_0x4a790a){_0x14b6c2=_0x14b6c2-0x0;var _0x6ac993=_0xa3db[_0x14b6c2];return _0x6ac993;};'use strict';var _=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var moment=require(_0xba3d('0x2'));var BPromise=require(_0xba3d('0x3'));var rs=require(_0xba3d('0x4'));var fs=require('fs');var Redis=require(_0xba3d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba3d('0x6'))('rpc');var config=require(_0xba3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba3d('0x8')][_0xba3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x477583,_0x1bacd7,_0x1bd181){return new BPromise(function(_0x426868,_0x3b69e9){return client[_0xba3d('0xa')](_0x477583,_0x1bd181)[_0xba3d('0xb')](function(_0x102fe6){logger[_0xba3d('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1bacd7,_0xba3d('0xd'));logger[_0xba3d('0xe')](_0xba3d('0xf'),_0x1bacd7,_0xba3d('0xd'),JSON[_0xba3d('0x10')](_0x102fe6));if(_0x102fe6['error']){if(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x12')]===0x1f4){logger[_0xba3d('0x11')]('SmsApplication,\x20%s,\x20%s',_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x3b69e9(_0x102fe6[_0xba3d('0x11')]['message']);}logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x426868(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x13')]);}else{logger[_0xba3d('0xc')](_0xba3d('0x14'),_0x1bacd7,_0xba3d('0xd'));_0x426868(_0x102fe6[_0xba3d('0x15')][_0xba3d('0x13')]);}})[_0xba3d('0x16')](function(_0x2ce092){logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x2ce092);_0x3b69e9(_0x2ce092);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2ce9313..80c556f 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 _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 +var _0x4024=['addTags','put','smsinteraction:update','update','delete','destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x4024,0x89));var _0x4402=function(_0x803ae0,_0x5c5f30){_0x803ae0=_0x803ae0-0x0;var _0x3c38b1=_0x4024[_0x803ae0];return _0x3c38b1;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/describe',auth[_0x4402('0x7')](),controller['describe']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4402('0x9')]('/:id/messages',auth[_0x4402('0x7')](),controller['getMessages']);router[_0x4402('0x9')]('/:id/download',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xc')]);router[_0x4402('0xd')]('/:id/messages',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xd')](_0x4402('0xf'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x12')),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x15')),controller[_0x4402('0x16')]);router[_0x4402('0x17')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')]('sms','smsinteraction:destroy'),controller[_0x4402('0x18')]);router[_0x4402('0x17')]('/:id/tags',auth[_0x4402('0x7')](),controller[_0x4402('0x19')]);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 db7aaea..fd6d259 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 _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 +var _0xfe39=['out','sequelize','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x1adb1a,_0x281561){var _0xa733a3=function(_0x56830c){while(--_0x56830c){_0x1adb1a['push'](_0x1adb1a['shift']());}};_0xa733a3(++_0x281561);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xfe39[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x9fe3('0x0'));var moment=require(_0x9fe3('0x1'));module['exports']={'closed':{'type':Sequelize[_0x9fe3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9fe3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9fe3('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9fe3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9fe3('0x5')]('in',_0x9fe3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9fe3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9fe3('0x5')]('in',_0x9fe3('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9fe3('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a8fc4a7..586f9c9 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 _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 +var _0x95a5=['merge','options','find','create','body','catch','describe','SmsMessage','addMessage','omit','ids','findOne','rawAttributes','fields','nolimit','order','sort','where','filters','pick','SmsInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','removeTags','download','unix','toString','join','server','tmp','transcript-%d-%s.zip','push','User','CmContact','lastName','createdAt','direction','secret','read','Account','Owner','fullname','get','mkdirSync','closed','closedAt','disposition','Messages','Contact','firstName','out','value','renderFile','root','views','downloadInteraction.ejs','transcript-','Sms','err','zip-dir','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','end','stack','name','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','user','show','params','model','keys','query','intersection','attributes','includeAll','include'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x95a5,0x12b));var _0x595a=function(_0x4a9dbb,_0x2b123b){_0x4a9dbb=_0x4a9dbb-0x0;var _0x9c1a3f=_0x95a5[_0x4a9dbb];return _0x9c1a3f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x595a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x595a('0x1'));var path=require(_0x595a('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x595a('0x3'));var Redis=require('ioredis');var interaction=require(_0x595a('0x4'));var qs=require(_0x595a('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x595a('0x6'))(_0x595a('0x7'));var config=require(_0x595a('0x8'));var db=require(_0x595a('0x9'))['db'];config[_0x595a('0xa')]=_[_0x595a('0xb')](config[_0x595a('0xa')],{'host':_0x595a('0xc'),'port':0x18eb});var socket=require(_0x595a('0xd'))(new Redis(config[_0x595a('0xa')]));require(_0x595a('0xe'))['register'](socket);function respondWithStatusCode(_0x30e4f1,_0x590622){_0x590622=_0x590622||0xcc;return function(_0x4a2dc6){if(_0x4a2dc6){return _0x30e4f1[_0x595a('0xf')](_0x590622);}return _0x30e4f1[_0x595a('0x10')](_0x590622)['end']();};}function respondWithResult(_0x450509,_0x84226e){_0x84226e=_0x84226e||0xc8;return function(_0x21f6a4){if(_0x21f6a4){return _0x450509[_0x595a('0x10')](_0x84226e)[_0x595a('0x11')](_0x21f6a4);}};}function respondWithFilteredResult(_0x23b127,_0x141200){return function(_0x5f34f2){if(_0x5f34f2){var _0x5758bc=typeof _0x141200[_0x595a('0x12')]===_0x595a('0x13')&&typeof _0x141200[_0x595a('0x14')]==='undefined';var _0x3e18ee=_0x5f34f2[_0x595a('0x15')];var _0x4050fc=_0x5758bc?0x0:_0x141200['offset'];var _0x8d78b4=_0x5758bc?_0x5f34f2['count']:_0x141200[_0x595a('0x12')]+_0x141200['limit'];var _0x12a4cb;if(_0x8d78b4>=_0x3e18ee){_0x8d78b4=_0x3e18ee;_0x12a4cb=0xc8;}else{_0x12a4cb=0xce;}_0x23b127['status'](_0x12a4cb);return _0x23b127[_0x595a('0x16')]('Content-Range',_0x4050fc+'-'+_0x8d78b4+'/'+_0x3e18ee)[_0x595a('0x11')](_0x5f34f2);}return null;};}function saveUpdates(_0x3c85e0){return function(_0x1695ff){if(_0x1695ff){return _0x1695ff[_0x595a('0x17')](_0x3c85e0)[_0x595a('0x18')](function(_0x3345b1){return _0x3345b1;});}return null;};}function removeEntity(_0x791fc4){return function(_0x16f61c){if(_0x16f61c){return _0x16f61c[_0x595a('0x19')]()[_0x595a('0x18')](function(){_0x791fc4[_0x595a('0x10')](0xcc)[_0x595a('0x1a')]();});}};}function handleEntityNotFound(_0x4fcac5){return function(_0x1e2c5f){if(!_0x1e2c5f){_0x4fcac5[_0x595a('0xf')](0x194);}return _0x1e2c5f;};}function handleError(_0x523eb6,_0x59b385){_0x59b385=_0x59b385||0x1f4;return function(_0x1333fc){logger['error'](_0x1333fc[_0x595a('0x1b')]);if(_0x1333fc[_0x595a('0x1c')]){delete _0x1333fc['name'];}_0x523eb6[_0x595a('0x10')](_0x59b385)['send'](_0x1333fc);};}exports['index']=function(_0x589c74,_0x2855de){var _0xc388ea={};var _0x1756d1=_['map'](db[_0x595a('0x1d')]['rawAttributes'],function(_0x2376dc){return{'name':_0x2376dc[_0x595a('0x1e')],'type':_0x2376dc[_0x595a('0x1f')][_0x595a('0x20')]};});_0xc388ea=qs[_0x595a('0x21')](_0x1756d1,_0x589c74);return interaction[_0x595a('0x22')](_0x595a('0x23'),_0x589c74['query'],_0x589c74[_0x595a('0x24')],_0xc388ea,_0x1756d1)[_0x595a('0x18')](respondWithFilteredResult(_0x2855de,_0xc388ea))['catch'](handleError(_0x2855de,null));};exports[_0x595a('0x25')]=function(_0x236add,_0x16d812){var _0xfd66c={'raw':![],'where':{'id':_0x236add[_0x595a('0x26')]['id']}},_0x3a4a32={};_0x3a4a32[_0x595a('0x27')]=_[_0x595a('0x28')](db[_0x595a('0x1d')]['rawAttributes']);_0x3a4a32[_0x595a('0x29')]=_[_0x595a('0x28')](_0x236add[_0x595a('0x29')]);_0x3a4a32['filters']=_[_0x595a('0x2a')](_0x3a4a32['model'],_0x3a4a32[_0x595a('0x29')]);_0xfd66c[_0x595a('0x2b')]=_[_0x595a('0x2a')](_0x3a4a32[_0x595a('0x27')],qs['fields'](_0x236add['query']['fields']));_0xfd66c[_0x595a('0x2b')]=_0xfd66c[_0x595a('0x2b')]['length']?_0xfd66c[_0x595a('0x2b')]:_0x3a4a32[_0x595a('0x27')];if(_0x236add[_0x595a('0x29')][_0x595a('0x2c')]){_0xfd66c[_0x595a('0x2d')]=[{'all':!![]}];}_0xfd66c=_[_0x595a('0x2e')]({},_0xfd66c,_0x236add[_0x595a('0x2f')]);return db[_0x595a('0x1d')][_0x595a('0x30')](_0xfd66c)[_0x595a('0x18')](handleEntityNotFound(_0x16d812,null))[_0x595a('0x18')](respondWithResult(_0x16d812,null))['catch'](handleError(_0x16d812,null));};exports[_0x595a('0x31')]=function(_0x41f856,_0xefafbc){return db[_0x595a('0x1d')][_0x595a('0x31')](_0x41f856[_0x595a('0x32')],{})[_0x595a('0x18')](respondWithResult(_0xefafbc,0xc9))[_0x595a('0x33')](handleError(_0xefafbc,null));};exports[_0x595a('0x17')]=function(_0x41ae6c,_0x2e1b34){if(_0x41ae6c[_0x595a('0x32')]['id']){delete _0x41ae6c['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x41ae6c[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x2e1b34,null))[_0x595a('0x18')](saveUpdates(_0x41ae6c[_0x595a('0x32')],null))[_0x595a('0x18')](respondWithResult(_0x2e1b34,null))['catch'](handleError(_0x2e1b34,null));};exports[_0x595a('0x19')]=function(_0x514dc5,_0x19ca54){return db[_0x595a('0x1d')][_0x595a('0x30')]({'where':{'id':_0x514dc5['params']['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x19ca54,null))[_0x595a('0x18')](removeEntity(_0x19ca54,null))[_0x595a('0x33')](handleError(_0x19ca54,null));};exports['describe']=function(_0xf6185d,_0x55786f){return db[_0x595a('0x1d')][_0x595a('0x34')]()['then'](respondWithResult(_0x55786f,null))[_0x595a('0x33')](handleError(_0x55786f,null));};exports['addMessage']=function(_0x538872,_0x246fab){return db[_0x595a('0x35')][_0x595a('0x30')]({'where':{'id':_0x538872[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x246fab,null))['then'](function(_0xc7b8d6){if(_0xc7b8d6){return _0xc7b8d6[_0x595a('0x36')](_0x538872[_0x595a('0x32')]['ids'],_[_0x595a('0x37')](_0x538872['body'],[_0x595a('0x38'),'id'])||{});}})[_0x595a('0x18')](respondWithResult(_0x246fab,null))[_0x595a('0x33')](handleError(_0x246fab,null));};exports['getMessages']=function(_0x57b61c,_0x25adb0){var _0x12e7a5={'raw':![],'where':{}};var _0x19dc3a={};var _0x46cb8f={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x595a('0x39')]({'where':{'id':_0x57b61c[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x25adb0,null))[_0x595a('0x18')](function(_0x2cecf3){if(_0x2cecf3){_0x19dc3a[_0x595a('0x27')]=_['keys'](db['SmsMessage'][_0x595a('0x3a')]);_0x19dc3a[_0x595a('0x29')]=_[_0x595a('0x28')](_0x57b61c[_0x595a('0x29')]);_0x19dc3a['filters']=_[_0x595a('0x2a')](_0x19dc3a['model'],_0x19dc3a[_0x595a('0x29')]);_0x12e7a5[_0x595a('0x2b')]=_['intersection'](_0x19dc3a[_0x595a('0x27')],qs[_0x595a('0x3b')](_0x57b61c[_0x595a('0x29')][_0x595a('0x3b')]));_0x12e7a5['attributes']=_0x12e7a5[_0x595a('0x2b')]['length']?_0x12e7a5[_0x595a('0x2b')]:_0x19dc3a[_0x595a('0x27')];if(!_0x57b61c['query']['hasOwnProperty'](_0x595a('0x3c'))){_0x12e7a5[_0x595a('0x14')]=qs[_0x595a('0x14')](_0x57b61c[_0x595a('0x29')][_0x595a('0x14')]);_0x12e7a5[_0x595a('0x12')]=qs[_0x595a('0x12')](_0x57b61c[_0x595a('0x29')]['offset']);}_0x12e7a5[_0x595a('0x3d')]=qs[_0x595a('0x3e')](_0x57b61c[_0x595a('0x29')][_0x595a('0x3e')]);_0x12e7a5[_0x595a('0x3f')]=qs[_0x595a('0x40')](_[_0x595a('0x41')](_0x57b61c[_0x595a('0x29')],_0x19dc3a['filters']));_0x12e7a5['where'][_0x595a('0x42')]=_0x2cecf3['id'];if(_0x57b61c['query'][_0x595a('0x43')]){_0x12e7a5[_0x595a('0x3f')]=_[_0x595a('0x2e')](_0x12e7a5[_0x595a('0x3f')],{'$or':_[_0x595a('0x44')](_0x12e7a5[_0x595a('0x2b')],function(_0x239318){var _0x264fca={};_0x264fca[_0x239318]={'$like':'%'+_0x57b61c[_0x595a('0x29')][_0x595a('0x43')]+'%'};return _0x264fca;})});}if(_0x57b61c['query'][_0x595a('0x45')]){var _0x476105=_0x57b61c['query']['$gte'][_0x595a('0x46')](',');var _0x1dbc3f={};_0x1dbc3f[_0x476105[0x0]]={'$gte':moment(_0x476105[0x1])[_0x595a('0x47')](_0x595a('0x48'))};_0x12e7a5[_0x595a('0x3f')]=_[_0x595a('0x2e')](_0x12e7a5[_0x595a('0x3f')],_0x1dbc3f);}_0x12e7a5=_[_0x595a('0x2e')]({},_0x12e7a5,_0x57b61c[_0x595a('0x2f')]);return db[_0x595a('0x35')][_0x595a('0x15')]({'where':_0x12e7a5[_0x595a('0x3f')]})[_0x595a('0x18')](function(_0x8058cf){_0x46cb8f['count']=_0x8058cf;if(_0x57b61c[_0x595a('0x29')][_0x595a('0x2c')]){_0x12e7a5['include']=[{'all':!![]}];}return db[_0x595a('0x35')][_0x595a('0x22')](_0x12e7a5);})['then'](function(_0x1a9704){_0x46cb8f[_0x595a('0x49')]=_0x1a9704;return _0x46cb8f;});}})[_0x595a('0x18')](respondWithFilteredResult(_0x25adb0,_0x12e7a5))[_0x595a('0x33')](handleError(_0x25adb0,null));};exports[_0x595a('0x4a')]=function(_0x2d2979,_0x9c57a2){return db[_0x595a('0x1d')]['find']({'where':{'id':_0x2d2979[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x9c57a2,null))[_0x595a('0x18')](function(_0x10adee){if(_0x10adee){return _0x10adee[_0x595a('0x4b')](_0x2d2979[_0x595a('0x32')]['ids'],_[_0x595a('0x37')](_0x2d2979[_0x595a('0x32')],['ids','id'])||{})['spread'](function(){return db[_0x595a('0x4c')]['findAll']({'attributes':['id',_0x595a('0x1c'),_0x595a('0x4d')],'where':{'id':_0x2d2979['body'][_0x595a('0x38')]}});})[_0x595a('0x18')](function(_0x205574){socket[_0x595a('0x4e')]('smsInteractionTags:save',{'id':Number(_0x2d2979[_0x595a('0x26')]['id']),'tags':_0x205574||[]});return{'id':Number(_0x2d2979[_0x595a('0x26')]['id']),'tags':_0x205574||[]};});}})[_0x595a('0x18')](respondWithResult(_0x9c57a2,null))[_0x595a('0x33')](handleError(_0x9c57a2,null));};exports[_0x595a('0x4f')]=function(_0x3c704f,_0x3676f7){return db[_0x595a('0x1d')][_0x595a('0x30')]({'where':{'id':_0x3c704f[_0x595a('0x26')]['id']}})['then'](handleEntityNotFound(_0x3676f7,null))[_0x595a('0x18')](function(_0x1e2a3f){if(_0x1e2a3f){return _0x1e2a3f[_0x595a('0x4f')](_0x3c704f[_0x595a('0x29')][_0x595a('0x38')]);}})[_0x595a('0x18')](respondWithStatusCode(_0x3676f7,null))[_0x595a('0x33')](handleError(_0x3676f7,null));};exports[_0x595a('0x50')]=function(_0x2a168a,_0x38094e){var _0x3fec99=moment()[_0x595a('0x51')]()[_0x595a('0x52')]();var _0x3450e1=path[_0x595a('0x53')](config['root'],_0x595a('0x54'),'files',_0x595a('0x55'));var _0x2c7731=path[_0x595a('0x53')](_0x3450e1,_0x3fec99);var _0x35c53d=util[_0x595a('0x47')](_0x595a('0x56'),_0x2a168a[_0x595a('0x26')]['id'],_0x3fec99);var _0x4ffbd6=path[_0x595a('0x53')](_0x3450e1,_0x35c53d);var _0x158bf5=[];_0x158bf5[_0x595a('0x57')]({'model':db[_0x595a('0x58')],'as':_0x595a('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x158bf5['push']({'model':db[_0x595a('0x59')],'as':'Contact','attributes':['id','firstName',_0x595a('0x5a')],'raw':!![]});var _0x45b3ad=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0x595a('0x5b'),_0x595a('0x5c'),_0x595a('0x5d'),_0x595a('0x5e')],'include':_0x158bf5}];_0x45b3ad[_0x595a('0x57')]({'model':db['SmsAccount'],'as':_0x595a('0x5f'),'attributes':['id',_0x595a('0x1c')]});_0x45b3ad[_0x595a('0x57')]({'model':db[_0x595a('0x58')],'as':_0x595a('0x60'),'attributes':['id',_0x595a('0x61')]});return db['SmsInteraction'][_0x595a('0x30')]({'where':{'id':_0x2a168a[_0x595a('0x26')]['id']},'include':_0x45b3ad})[_0x595a('0x18')](handleEntityNotFound(_0x38094e,null))[_0x595a('0x18')](function(_0x31623f){if(_0x31623f){var _0xe3efc0=_0x31623f[_0x595a('0x62')]({'plain':!![]});fs[_0x595a('0x63')](_0x2c7731);var _0xb104eb={'channel':'Sms','account':_0xe3efc0[_0x595a('0x5f')][_0x595a('0x1c')],'agent':_0xe3efc0[_0x595a('0x60')]?_0xe3efc0[_0x595a('0x60')]['fullname']:'N.A.','createdAt':moment(_0xe3efc0[_0x595a('0x5b')])[_0x595a('0x47')](_0x595a('0x48'))[_0x595a('0x52')](),'closedAt':_0xe3efc0[_0x595a('0x64')]?moment(_0xe3efc0[_0x595a('0x65')])[_0x595a('0x47')](_0x595a('0x48'))[_0x595a('0x52')]():'','disposition':_0xe3efc0[_0x595a('0x66')],'messages':_(_0xe3efc0[_0x595a('0x67')])[_0x595a('0x43')]({'secret':![]})[_0x595a('0x44')](function(_0x5459f1){return{'date':moment(_0x5459f1[_0x595a('0x5b')])[_0x595a('0x47')](_0x595a('0x48'))[_0x595a('0x52')](),'sender':_0x5459f1[_0x595a('0x5c')]==='out'?_0x5459f1['User']?_0x5459f1[_0x595a('0x58')]['fullname']:'System':_0x5459f1[_0x595a('0x68')][_0x595a('0x69')]+(_0x5459f1[_0x595a('0x68')]['lastName']?'\x20'+_0x5459f1[_0x595a('0x68')]['lastName']:''),'body':_0x5459f1[_0x595a('0x32')],'direction':_0x5459f1['direction']===_0x595a('0x6a')?'A':'C','secret':_0x5459f1[_0x595a('0x5d')],'read':_0x5459f1[_0x595a('0x5e')]};})[_0x595a('0x6b')]()};return ejs[_0x595a('0x6c')](path['join'](config[_0x595a('0x6d')],_0x595a('0x54'),_0x595a('0x6e'),_0x595a('0x6f')),{'interaction':_0xb104eb})[_0x595a('0x18')](function(_0x59889d){var _0x39d740=path[_0x595a('0x53')](_0x2c7731,_0x595a('0x70')+_0xe3efc0['id']+'-'+_0x3fec99+'.pdf');var _0x4e3d89={'path':_0x39d740,'channel':_0x595a('0x71'),'interactionId':_0xe3efc0['id']};return pdf['createPdfFromHTML'](_0x59889d,_0x4e3d89);})[_0x595a('0x18')](function(){return new BPromise(function(_0x2c5a1e,_0xceeadb){zipdir(_0x2c7731,{'saveTo':_0x4ffbd6},function(_0x48b5a2,_0x2295a0){if(_0x48b5a2)return _0xceeadb(_0x48b5a2);return _0x2c5a1e(_0x2295a0);});})[_0x595a('0x18')](function(){return new BPromise(function(_0x4809d4,_0x5a0cfd){rimraf(_0x2c7731,function(_0x1d2263){if(_0x1d2263)_0x5a0cfd(_0x1d2263);return _0x4809d4();});});})[_0x595a('0x18')](function(){return _0x38094e[_0x595a('0x50')](_0x4ffbd6,_0x35c53d,function(_0x130404){if(_0x130404){console['log'](_0x595a('0x72'),_0x130404);}else{fs['unlinkSync'](_0x4ffbd6);}});});});}else{return _0x38094e['sendStatus'](0xc8);}})['catch'](handleError(_0x38094e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index bb05fa6..9341987 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 _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 +var _0x6343=['then','map','findAll','setDataValue','emit','hasOwnProperty','hook','exports','SmsInteraction','../../mysqldb','remove'];(function(_0x4866cb,_0x46b5c9){var _0x17ca38=function(_0x4d05e8){while(--_0x4d05e8){_0x4866cb['push'](_0x4866cb['shift']());}};_0x17ca38(++_0x46b5c9);}(_0x6343,0x168));var _0x3634=function(_0x96b5be,_0x18015d){_0x96b5be=_0x96b5be-0x0;var _0x223f06=_0x6343[_0x96b5be];return _0x223f06;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3634('0x0')];var SmsMessage=require(_0x3634('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3634('0x2')};function emitEvent(_0x420510){return function(_0x57c5e4,_0x247964,_0x388c18){_0x57c5e4['getUsers']({'attributes':['id'],'raw':!![]})[_0x3634('0x3')](function(_0xd40513){_0x57c5e4['setDataValue']('Users',_0xd40513[_0x3634('0x4')](function(_0x1bcdb2){return{'id':_0x1bcdb2['id']};}));return SmsMessage[_0x3634('0x5')]({'where':{'SmsInteractionId':_0x57c5e4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3634('0x3')](function(_0x2e8e8b){_0x57c5e4[_0x3634('0x6')]('unreadMessages',_0x2e8e8b['length']);SmsInteractionEvents[_0x3634('0x7')](_0x420510+':'+_0x57c5e4['id'],_0x57c5e4);SmsInteractionEvents[_0x3634('0x7')](_0x420510,_0x57c5e4);_0x388c18(null);})['catch'](_0x388c18(null));};}for(var e in events){if(events[_0x3634('0x8')](e)){var event=events[e];SmsInteraction[_0x3634('0x9')](e,emitEvent(event));}}module[_0x3634('0xa')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 62ac144..4dcb256 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 _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 +var _0xa4aa=['request-promise','path','../../config/environment','sms_interactions','changed','closed','closedAt','format','lodash','util'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa4aa,0x170));var _0xaa4a=function(_0x128d1b,_0x1b863b){_0x128d1b=_0x128d1b-0x0;var _0x3d955c=_0xa4aa[_0x128d1b];return _0x3d955c;};'use strict';var _=require(_0xaa4a('0x0'));var util=require(_0xaa4a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa4a('0x2'));var fs=require('fs');var path=require(_0xaa4a('0x3'));var rimraf=require('rimraf');var config=require(_0xaa4a('0x4'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x18a188,_0x5ca896){return _0x18a188['define']('SmsInteraction',attributes,{'tableName':_0xaa4a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a2515,_0x55e282,_0x1a4547){if(_0x5a2515[_0xaa4a('0x6')](_0xaa4a('0x7'))){_0x5a2515[_0xaa4a('0x8')]=moment()[_0xaa4a('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a4547(null,_0x5a2515);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b398c93..80203fe 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 _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 +var _0x3147=['request\x20sent','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x3439bc,_0x620c5e){var _0x3120cf=function(_0x16c871){while(--_0x16c871){_0x3439bc['push'](_0x3439bc['shift']());}};_0x3120cf(++_0x620c5e);}(_0x3147,0x6b));var _0x7314=function(_0x3fc81b,_0xd49a94){_0x3fc81b=_0x3fc81b-0x0;var _0x39596d=_0x3147[_0x3fc81b];return _0x39596d;};'use strict';var _=require(_0x7314('0x0'));var util=require(_0x7314('0x1'));var moment=require(_0x7314('0x2'));var BPromise=require(_0x7314('0x3'));var rs=require(_0x7314('0x4'));var fs=require('fs');var Redis=require(_0x7314('0x5'));var db=require(_0x7314('0x6'))['db'];var utils=require(_0x7314('0x7'));var logger=require(_0x7314('0x8'))(_0x7314('0x9'));var config=require(_0x7314('0xa'));var jayson=require(_0x7314('0xb'));var client=jayson['client'][_0x7314('0xc')]({'port':0x232a});config[_0x7314('0xd')]=_[_0x7314('0xe')](config[_0x7314('0xd')],{'host':_0x7314('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7314('0xd')]));require('./smsInteraction.socket')[_0x7314('0x10')](socket);function respondWithRpcPromise(_0x1d8c0d,_0x40e16b,_0x420936){return new BPromise(function(_0x3608f7,_0x5add0a){return client['request'](_0x1d8c0d,_0x420936)[_0x7314('0x11')](function(_0x70bd57){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x40e16b,'request\x20sent');logger[_0x7314('0x12')](_0x7314('0x13'),_0x40e16b,'request\x20sent',JSON[_0x7314('0x14')](_0x70bd57));if(_0x70bd57[_0x7314('0x15')]){if(_0x70bd57[_0x7314('0x15')][_0x7314('0x16')]===0x1f4){logger[_0x7314('0x15')](_0x7314('0x17'),_0x40e16b,_0x70bd57['error']['message']);return _0x5add0a(_0x70bd57[_0x7314('0x15')][_0x7314('0x18')]);}logger[_0x7314('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x40e16b,_0x70bd57['error'][_0x7314('0x18')]);return _0x3608f7(_0x70bd57[_0x7314('0x15')]['message']);}else{logger['info'](_0x7314('0x17'),_0x40e16b,_0x7314('0x19'));_0x3608f7(_0x70bd57[_0x7314('0x1a')]['message']);}})[_0x7314('0x1b')](function(_0x323279){logger[_0x7314('0x15')](_0x7314('0x17'),_0x40e16b,_0x323279);_0x5add0a(_0x323279);});});}exports[_0x7314('0x1c')]=function(_0x865d3c){var _0xa9e4fe=this;return new Promise(function(_0x277193,_0x2b5978){return db[_0x7314('0x1d')][_0x7314('0x1e')](_0x865d3c[_0x7314('0x1f')],{'raw':_0x865d3c[_0x7314('0x20')]?_0x865d3c[_0x7314('0x20')][_0x7314('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x865d3c[_0x7314('0x20')]?_0x865d3c[_0x7314('0x20')][_0x7314('0x22')]||null:null,'attributes':_0x865d3c['options']?_0x865d3c[_0x7314('0x20')][_0x7314('0x23')]||null:null,'limit':_0x865d3c['options']?_0x865d3c[_0x7314('0x20')][_0x7314('0x24')]||null:null})['then'](function(_0x2a2834){logger['info'](_0x7314('0x1c'),_0x865d3c);logger[_0x7314('0x12')](_0x7314('0x1c'),_0x865d3c,JSON['stringify'](_0x2a2834));_0x277193(_0x2a2834);})['catch'](function(_0x24e5ed){logger[_0x7314('0x15')](_0x7314('0x1c'),_0x24e5ed[_0x7314('0x18')],_0x865d3c);_0x2b5978(_0xa9e4fe[_0x7314('0x15')](0x1f4,_0x24e5ed[_0x7314('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x204517){return new Promise(function(_0x57c902,_0x8e3b59){return db['SmsInteraction'][_0x7314('0x25')]({'where':_0x204517[_0x7314('0x20')]?_0x204517[_0x7314('0x20')]['where']||null:null})[_0x7314('0x11')](function(_0x50409d){if(_0x50409d){return _0x50409d[_0x7314('0x26')](_0x204517['body'][_0x7314('0x27')],_[_0x7314('0x28')](_0x204517[_0x7314('0x1f')],[_0x7314('0x27'),'id'])||{});}})[_0x7314('0x29')](function(_0x1d2eeb){logger[_0x7314('0x2a')]('AddTags',_0x204517);logger[_0x7314('0x12')](_0x7314('0x2b'),_0x204517,JSON['stringify'](_0x1d2eeb));_0x57c902(_0x1d2eeb);})['catch'](function(_0x3c63c1){logger['error'](_0x7314('0x2b'),_0x3c63c1[_0x7314('0x18')],_0x204517);_0x8e3b59(_this['error'](0x1f4,_0x3c63c1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0aa390e..79e2541 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 _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 +var _0x652a=['length','smsInteraction:','./smsInteraction.events','save','update','emit','removeListener','register'];(function(_0x3b0b8a,_0x52bcd1){var _0x1ee320=function(_0x1b40fb){while(--_0x1b40fb){_0x3b0b8a['push'](_0x3b0b8a['shift']());}};_0x1ee320(++_0x52bcd1);}(_0x652a,0x14a));var _0xa652=function(_0x18c917,_0x589c41){_0x18c917=_0x18c917-0x0;var _0x77f600=_0x652a[_0x18c917];return _0x77f600;};'use strict';var SmsInteractionEvents=require(_0xa652('0x0'));var events=[_0xa652('0x1'),'remove',_0xa652('0x2')];function createListener(_0x2ab061,_0x44e4d8){return function(_0x3942a6){_0x44e4d8[_0xa652('0x3')](_0x2ab061,_0x3942a6);};}function removeListener(_0x15d556,_0x54f896){return function(){SmsInteractionEvents[_0xa652('0x4')](_0x15d556,_0x54f896);};}exports[_0xa652('0x5')]=function(_0x21b24f){for(var _0x4f864d=0x0,_0x227aae=events[_0xa652('0x6')];_0x4f864d<_0x227aae;_0x4f864d++){var _0x405701=events[_0x4f864d];var _0x4b95e1=createListener(_0xa652('0x7')+_0x405701,_0x21b24f);SmsInteractionEvents['on'](_0x405701,_0x4b95e1);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e6c00b4..02d5b12 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 _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 +var _0xcc22=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','smsmessage:create','/:id/status','status','put','update','/:id/accept'];(function(_0x273edb,_0x224407){var _0x345a37=function(_0x54c30b){while(--_0x54c30b){_0x273edb['push'](_0x273edb['shift']());}};_0x345a37(++_0x224407);}(_0xcc22,0x19c));var _0x2cc2=function(_0x572c8b,_0x202e71){_0x572c8b=_0x572c8b-0x0;var _0x500ca1=_0xcc22[_0x572c8b];return _0x500ca1;};'use strict';var multer=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var path=require(_0x2cc2('0x2'));var timeout=require(_0x2cc2('0x3'));var express=require(_0x2cc2('0x4'));var router=express['Router']();var fs_extra=require(_0x2cc2('0x5'));var auth=require(_0x2cc2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2cc2('0x7'));var controller=require(_0x2cc2('0x8'));router[_0x2cc2('0x9')]('/',auth['isAuthenticated'](),controller[_0x2cc2('0xa')]);router[_0x2cc2('0x9')](_0x2cc2('0xb'),auth[_0x2cc2('0xc')](),controller['describe']);router[_0x2cc2('0x9')](_0x2cc2('0xd'),auth['isAuthenticated'](),controller[_0x2cc2('0xe')]);router[_0x2cc2('0xf')]('/',auth['isAuthenticated'](),interaction[_0x2cc2('0x10')]('sms',_0x2cc2('0x11')),controller['create']);router[_0x2cc2('0xf')](_0x2cc2('0x12'),controller[_0x2cc2('0x13')]);router[_0x2cc2('0x14')]('/:id',auth[_0x2cc2('0xc')](),controller[_0x2cc2('0x15')]);router['put'](_0x2cc2('0x16'),auth['isAuthenticated'](),controller[_0x2cc2('0x17')]);router['put'](_0x2cc2('0x18'),auth[_0x2cc2('0xc')](),controller[_0x2cc2('0x19')]);router[_0x2cc2('0x1a')]('/:id',auth[_0x2cc2('0xc')](),controller[_0x2cc2('0x1b')]);module[_0x2cc2('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 5887923..9b6874a 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 _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 +var _0x142f=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','medium'];(function(_0x40eea5,_0x340e03){var _0x3fbbd0=function(_0x3a637a){while(--_0x3a637a){_0x40eea5['push'](_0x40eea5['shift']());}};_0x3fbbd0(++_0x340e03);}(_0x142f,0x136));var _0xf142=function(_0x281334,_0x4d8013){_0x281334=_0x281334-0x0;var _0x115f37=_0x142f[_0x281334];return _0x115f37;};'use strict';var Sequelize=require(_0xf142('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xf142('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xf142('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf142('0x3')]('in',_0xf142('0x4')),'defaultValue':_0xf142('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf142('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf142('0x5')]},'readAt':{'type':Sequelize[_0xf142('0x6')]},'secret':{'type':Sequelize[_0xf142('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf142('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0a8339a..1485b80 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 _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 +var _0x8edd=['interface','channel','motionChannel','EventManager','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','includeAll','merge','find','create','body','params','describe','accept','reject','sms','UserId','user','agent','get','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal'];(function(_0x4fe923,_0x57f797){var _0x31631e=function(_0x57ac12){while(--_0x57ac12){_0x4fe923['push'](_0x4fe923['shift']());}};_0x31631e(++_0x57f797);}(_0x8edd,0x175));var _0xd8ed=function(_0x13c475,_0x18dda1){_0x13c475=_0x13c475-0x0;var _0x1e04c5=_0x8edd[_0x13c475];return _0x1e04c5;};'use strict';var util=require(_0xd8ed('0x0'));var _=require(_0xd8ed('0x1'));var Redis=require(_0xd8ed('0x2'));var interactionService=require(_0xd8ed('0x3'));var qs=require(_0xd8ed('0x4'));var logger=require('../../config/logger')(_0xd8ed('0x5'));var config=require(_0xd8ed('0x6'));var db=require(_0xd8ed('0x7'))['db'];config[_0xd8ed('0x8')]=_['defaults'](config[_0xd8ed('0x8')],{'host':_0xd8ed('0x9'),'port':0x18eb});var socket=require(_0xd8ed('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xd8ed('0xb')](socket);var jayson=require(_0xd8ed('0xc'));var client=jayson[_0xd8ed('0xd')][_0xd8ed('0xe')]({'port':0x232c});var client9002=jayson[_0xd8ed('0xd')][_0xd8ed('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x25aee0,_0xfc4b15,_0x4583d8,_0x3c6c1e){return new Promise(function(_0x458893,_0x4b0525){var _0x464f03=_0x3c6c1e||client;return _0x464f03['request'](_0x25aee0,_0x4583d8)['then'](function(_0x16253e){logger[_0xd8ed('0xf')](_0xd8ed('0x10'),_0xfc4b15,_0xd8ed('0x11'));logger[_0xd8ed('0x12')](_0xd8ed('0x13'),_0xfc4b15,_0xd8ed('0x11'),JSON['stringify'](_0x16253e));if(_0x16253e[_0xd8ed('0x14')]){if(_0x16253e[_0xd8ed('0x14')]['code']===0x1f4){logger[_0xd8ed('0x14')]('SmsMessage,\x20%s,\x20%s',_0xfc4b15,_0x16253e[_0xd8ed('0x14')][_0xd8ed('0x15')]);return _0x4b0525(_0x16253e[_0xd8ed('0x14')]['message']);}logger[_0xd8ed('0x14')](_0xd8ed('0x10'),_0xfc4b15,_0x16253e[_0xd8ed('0x14')][_0xd8ed('0x15')]);return _0x458893(_0x16253e[_0xd8ed('0x14')][_0xd8ed('0x15')]);}else{logger[_0xd8ed('0xf')]('SmsMessage,\x20%s,\x20%s',_0xfc4b15,_0xd8ed('0x11'));_0x458893(_0x16253e[_0xd8ed('0x16')][_0xd8ed('0x15')]);}})[_0xd8ed('0x17')](function(_0x19624f){logger[_0xd8ed('0x14')](_0xd8ed('0x10'),_0xfc4b15,_0x19624f);_0x4b0525(_0x19624f);});});}function respondWithResult(_0x1c54c1,_0x1b0143){_0x1b0143=_0x1b0143||0xc8;return function(_0x5c1997){if(_0x5c1997){return _0x1c54c1[_0xd8ed('0x18')](_0x1b0143)[_0xd8ed('0x19')](_0x5c1997);}};}function respondWithFilteredResult(_0x2d0fd2,_0x12bce8){return function(_0x29f988){if(_0x29f988){var _0x5450a5=typeof _0x12bce8[_0xd8ed('0x1a')]===_0xd8ed('0x1b')&&typeof _0x12bce8['limit']===_0xd8ed('0x1b');var _0x257765=_0x29f988[_0xd8ed('0x1c')];var _0x3de60a=_0x5450a5?0x0:_0x12bce8[_0xd8ed('0x1a')];var _0x9f6a04=_0x5450a5?_0x29f988[_0xd8ed('0x1c')]:_0x12bce8[_0xd8ed('0x1a')]+_0x12bce8[_0xd8ed('0x1d')];var _0x473a5f;if(_0x9f6a04>=_0x257765){_0x9f6a04=_0x257765;_0x473a5f=0xc8;}else{_0x473a5f=0xce;}_0x2d0fd2[_0xd8ed('0x18')](_0x473a5f);return _0x2d0fd2[_0xd8ed('0x1e')]('Content-Range',_0x3de60a+'-'+_0x9f6a04+'/'+_0x257765)[_0xd8ed('0x19')](_0x29f988);}return null;};}function saveUpdates(_0x4b3a7a){return function(_0x616516){if(_0x616516){return _0x616516[_0xd8ed('0x1f')](_0x4b3a7a)[_0xd8ed('0x20')](function(_0x56d825){return _0x56d825;});}return null;};}function removeEntity(_0x1df68a){return function(_0x56d6af){if(_0x56d6af){return _0x56d6af[_0xd8ed('0x21')]()['then'](function(){_0x1df68a[_0xd8ed('0x18')](0xcc)[_0xd8ed('0x22')]();});}};}function handleEntityNotFound(_0x47c244){return function(_0x3bbb7e){if(!_0x3bbb7e){_0x47c244[_0xd8ed('0x23')](0x194);}return _0x3bbb7e;};}function handleError(_0x5ee00d,_0x1921d1){_0x1921d1=_0x1921d1||0x1f4;return function(_0x12bd4d){logger[_0xd8ed('0x14')](_0x12bd4d[_0xd8ed('0x24')]);if(_0x12bd4d[_0xd8ed('0x25')]){delete _0x12bd4d['name'];}_0x5ee00d[_0xd8ed('0x18')](_0x1921d1)['send'](_0x12bd4d);};}exports[_0xd8ed('0x26')]=function(_0x421f80,_0x439209){var _0x13371d={},_0x13e5d4={},_0x44d361={'count':0x0,'rows':[]};var _0xef9d54=_[_0xd8ed('0x27')](db[_0xd8ed('0x28')][_0xd8ed('0x29')],function(_0x2ec2b0){return{'name':_0x2ec2b0[_0xd8ed('0x2a')],'type':_0x2ec2b0[_0xd8ed('0x2b')][_0xd8ed('0x2c')]};});_0x13e5d4['model']=_[_0xd8ed('0x27')](_0xef9d54,_0xd8ed('0x25'));_0x13e5d4['query']=_[_0xd8ed('0x2d')](_0x421f80[_0xd8ed('0x2e')]);_0x13e5d4[_0xd8ed('0x2f')]=_[_0xd8ed('0x30')](_0x13e5d4[_0xd8ed('0x31')],_0x13e5d4['query']);_0x13371d[_0xd8ed('0x32')]=_[_0xd8ed('0x30')](_0x13e5d4[_0xd8ed('0x31')],qs['fields'](_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x33')]));_0x13371d[_0xd8ed('0x32')]=_0x13371d[_0xd8ed('0x32')][_0xd8ed('0x34')]?_0x13371d[_0xd8ed('0x32')]:_0x13e5d4['model'];if(!_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x35')](_0xd8ed('0x36'))){_0x13371d[_0xd8ed('0x1d')]=qs['limit'](_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x1d')]);_0x13371d[_0xd8ed('0x1a')]=qs[_0xd8ed('0x1a')](_0x421f80[_0xd8ed('0x2e')]['offset']);}_0x13371d[_0xd8ed('0x37')]=qs['sort'](_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x38')]);_0x13371d['where']=qs[_0xd8ed('0x2f')](_[_0xd8ed('0x39')](_0x421f80['query'],_0x13e5d4[_0xd8ed('0x2f')]),_0xef9d54);if(_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x3a')]){_0x13371d[_0xd8ed('0x3b')]=_['merge'](_0x13371d[_0xd8ed('0x3b')],{'$or':_['map'](_0xef9d54,function(_0x10ddfd){if(_0x10ddfd[_0xd8ed('0x2b')]!==_0xd8ed('0x3c')){var _0x280f10={};_0x280f10[_0x10ddfd[_0xd8ed('0x25')]]={'$like':'%'+_0x421f80['query'][_0xd8ed('0x3a')]+'%'};return _0x280f10;}})});}_0x13371d=_['merge']({},_0x13371d,_0x421f80[_0xd8ed('0x3d')]);var _0x1d4ef4={'where':_0x13371d['where']};return db[_0xd8ed('0x28')]['count'](_0x1d4ef4)[_0xd8ed('0x20')](function(_0x2c84d2){_0x44d361[_0xd8ed('0x1c')]=_0x2c84d2;if(_0x421f80[_0xd8ed('0x2e')]['includeAll']){_0x13371d[_0xd8ed('0x3e')]=[{'all':!![]}];}return db['SmsMessage'][_0xd8ed('0x3f')](_0x13371d);})[_0xd8ed('0x20')](function(_0x3b1d01){_0x44d361[_0xd8ed('0x40')]=_0x3b1d01;return _0x44d361;})['then'](respondWithFilteredResult(_0x439209,_0x13371d))[_0xd8ed('0x17')](handleError(_0x439209,null));};exports['show']=function(_0x5afdac,_0x4a036c){var _0x592db6={'raw':!![],'where':{'id':_0x5afdac['params']['id']}},_0x5c9eab={};_0x5c9eab[_0xd8ed('0x31')]=_[_0xd8ed('0x2d')](db['SmsMessage'][_0xd8ed('0x29')]);_0x5c9eab[_0xd8ed('0x2e')]=_[_0xd8ed('0x2d')](_0x5afdac[_0xd8ed('0x2e')]);_0x5c9eab[_0xd8ed('0x2f')]=_[_0xd8ed('0x30')](_0x5c9eab[_0xd8ed('0x31')],_0x5c9eab[_0xd8ed('0x2e')]);_0x592db6[_0xd8ed('0x32')]=_[_0xd8ed('0x30')](_0x5c9eab[_0xd8ed('0x31')],qs[_0xd8ed('0x33')](_0x5afdac['query']['fields']));_0x592db6[_0xd8ed('0x32')]=_0x592db6[_0xd8ed('0x32')][_0xd8ed('0x34')]?_0x592db6[_0xd8ed('0x32')]:_0x5c9eab[_0xd8ed('0x31')];if(_0x5afdac[_0xd8ed('0x2e')][_0xd8ed('0x41')]){_0x592db6['include']=[{'all':!![]}];}_0x592db6=_[_0xd8ed('0x42')]({},_0x592db6,_0x5afdac[_0xd8ed('0x3d')]);return db[_0xd8ed('0x28')][_0xd8ed('0x43')](_0x592db6)[_0xd8ed('0x20')](handleEntityNotFound(_0x4a036c,null))[_0xd8ed('0x20')](respondWithResult(_0x4a036c,null))[_0xd8ed('0x17')](handleError(_0x4a036c,null));};exports[_0xd8ed('0x44')]=function(_0x391864,_0x4d2f0c){return db[_0xd8ed('0x28')][_0xd8ed('0x44')](_0x391864[_0xd8ed('0x45')],{})[_0xd8ed('0x20')](respondWithResult(_0x4d2f0c,0xc9))['catch'](handleError(_0x4d2f0c,null));};exports['update']=function(_0x591d44,_0x268542){if(_0x591d44[_0xd8ed('0x45')]['id']){delete _0x591d44['body']['id'];}return db['SmsMessage'][_0xd8ed('0x43')]({'where':{'id':_0x591d44[_0xd8ed('0x46')]['id']}})[_0xd8ed('0x20')](handleEntityNotFound(_0x268542,null))[_0xd8ed('0x20')](saveUpdates(_0x591d44[_0xd8ed('0x45')],null))[_0xd8ed('0x20')](respondWithResult(_0x268542,null))['catch'](handleError(_0x268542,null));};exports[_0xd8ed('0x21')]=function(_0xfcc3aa,_0x372169){return db[_0xd8ed('0x28')][_0xd8ed('0x43')]({'where':{'id':_0xfcc3aa[_0xd8ed('0x46')]['id']}})['then'](handleEntityNotFound(_0x372169,null))[_0xd8ed('0x20')](removeEntity(_0x372169,null))[_0xd8ed('0x17')](handleError(_0x372169,null));};exports[_0xd8ed('0x47')]=function(_0x25e00a,_0x33bd48){return db[_0xd8ed('0x28')][_0xd8ed('0x47')]()[_0xd8ed('0x20')](respondWithResult(_0x33bd48,null))[_0xd8ed('0x17')](handleError(_0x33bd48,null));};exports[_0xd8ed('0x48')]=function(_0x5cc414,_0x4d890c){var _0x1d971e='sms';return interactionService['acceptMessage'](_0x5cc414,_0x1d971e)[_0xd8ed('0x20')](respondWithResult(_0x4d890c,null))[_0xd8ed('0x17')](handleError(_0x4d890c,null));};exports[_0xd8ed('0x49')]=function(_0x588840,_0xf35e68){var _0x37175a={'agent':{},'channel':_0xd8ed('0x4a')};if(_0x588840[_0xd8ed('0x45')]['id']){delete _0x588840[_0xd8ed('0x45')]['id'];}_0x588840[_0xd8ed('0x45')][_0xd8ed('0x4b')]=_0x588840['body']['UserId']||_0x588840[_0xd8ed('0x4c')]['id'];_0x37175a[_0xd8ed('0x4d')]['id']=_0x588840['body'][_0xd8ed('0x4b')];return db[_0xd8ed('0x28')]['find']({'where':{'id':_0x588840[_0xd8ed('0x46')]['id'],'UserId':null}})[_0xd8ed('0x20')](handleEntityNotFound(_0xf35e68,null))['then'](function(_0xdb9587){if(_0xdb9587){_0x37175a['message']=_0xdb9587[_0xd8ed('0x4e')]({'plain':!![]});return db[_0xd8ed('0x4f')][_0xd8ed('0x43')]({'where':{'id':_0xdb9587[_0xd8ed('0x50')]}});}return null;})['then'](handleEntityNotFound(_0xf35e68,null))[_0xd8ed('0x20')](function(_0x17e0da){if(_0x17e0da){_0x37175a['interaction']=_0x17e0da[_0xd8ed('0x4e')]({'plain':!![]});interaction_log['info'](_0xd8ed('0x51'),_0x588840[_0xd8ed('0x4c')]['id'],_0x588840['user']['name'],_0x588840['user'][_0xd8ed('0x52')],_0x37175a[_0xd8ed('0x53')]['id'],_0x588840[_0xd8ed('0x45')]?JSON[_0xd8ed('0x54')](_0x588840['body']):'null');return respondWithRpcPromise('RejectMessage',_0xd8ed('0x55'),_0x37175a);}return null;})[_0xd8ed('0x20')](function(_0xb541ec){var _0x1b56e0=_0xd8ed('0x56')+_0xb541ec[_0xd8ed('0x15')][_0xd8ed('0x57')];return db[_0xd8ed('0x58')][_0xd8ed('0x2e')](_0x1b56e0,{'type':db[_0xd8ed('0x59')]['QueryTypes'][_0xd8ed('0x5a')],'raw':!![]})[_0xd8ed('0x20')](function(_0x33972b){return _0x33972b;});})[_0xd8ed('0x20')](function(_0x361720){if(_0x361720){_0x37175a[_0xd8ed('0x15')][_0xd8ed('0x5b')]=_0x361720[0x0];if(!_0x588840[_0xd8ed('0x45')][_0xd8ed('0x4b')])return;return db[_0xd8ed('0x5c')][_0xd8ed('0x43')]({'where':{'id':_0x588840['body'][_0xd8ed('0x4b')],'role':_0xd8ed('0x4d')},'attributes':['id',_0xd8ed('0x25'),'fullname',_0xd8ed('0x5d'),_0xd8ed('0x5e')],'raw':!![]});}return null;})[_0xd8ed('0x20')](function(_0x3df51b){if(!_0x3df51b)return null;_0x37175a['message']['agent']=_0x3df51b;return _0x37175a;})[_0xd8ed('0x20')](function(_0x130593){if(_0x130593){_0x130593[_0xd8ed('0x15')][_0xd8ed('0x5f')]=util['format']('SIP/%s',_0x588840[_0xd8ed('0x4c')]['name']);_0x130593[_0xd8ed('0x15')][_0xd8ed('0x60')]=_0x37175a[_0xd8ed('0x60')];_0x130593[_0xd8ed('0x15')][_0xd8ed('0x61')]=_0x37175a['channel'];_0x130593[_0xd8ed('0x15')]['event']=_0xd8ed('0x49');respondWithRpcPromise(_0xd8ed('0x62'),'EventManager',{'event':_0xd8ed('0x63'),'message':_0x130593['message']},client9002);return _0x37175a;}return null;})[_0xd8ed('0x20')](respondWithResult(_0xf35e68,null))[_0xd8ed('0x17')](handleError(_0xf35e68,null));};exports[_0xd8ed('0x18')]=function(_0x9ce309,_0x4a4a21){if(_0x9ce309['body']['id']){delete _0x9ce309[_0xd8ed('0x45')]['id'];}var _0x1170d2;return db[_0xd8ed('0x28')][_0xd8ed('0x43')]({'where':{'id':_0x9ce309[_0xd8ed('0x46')]['id']}})[_0xd8ed('0x20')](handleEntityNotFound(_0x4a4a21,null))[_0xd8ed('0x20')](function(_0xd88d34){if(_0xd88d34){_0x1170d2=_0xd88d34;return db['SmsAccount'][_0xd8ed('0x43')]({'where':{'id':_0xd88d34[_0xd8ed('0x64')]}});}})[_0xd8ed('0x20')](handleEntityNotFound(_0x4a4a21,null))[_0xd8ed('0x20')](function(_0x3789fc){if(_0x3789fc){logger[_0xd8ed('0x12')](_0xd8ed('0x13'),_0xd8ed('0x18'),_0xd8ed('0x65'),_0x3789fc[_0xd8ed('0x2b')],util[_0xd8ed('0x66')](_0x9ce309[_0xd8ed('0x45')],{'showHidden':![],'depth':null}));switch(_0x3789fc[_0xd8ed('0x2b')]){case _0xd8ed('0x67'):if(_0x9ce309[_0xd8ed('0x45')][_0xd8ed('0x68')]&&_0x9ce309[_0xd8ed('0x45')][_0xd8ed('0x68')]===_0x1170d2[_0xd8ed('0x69')]){return _0x1170d2[_0xd8ed('0x1f')]({'read':!![]});}else{logger[_0xd8ed('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd8ed('0x67'),util[_0xd8ed('0x66')](_0x9ce309[_0xd8ed('0x45')],{'showHidden':![],'depth':null}));}break;case _0xd8ed('0x6a'):if(_0x9ce309[_0xd8ed('0x45')][_0xd8ed('0x6b')]&&_0x9ce309[_0xd8ed('0x45')]['MessageUUID']===_0x1170d2['messageId']&&_[_0xd8ed('0x6c')]([_0xd8ed('0x6d'),_0xd8ed('0x6e')],_0x9ce309['body'][_0xd8ed('0x6f')])>=0x0){return _0x1170d2[_0xd8ed('0x1f')]({'read':!![]});}else{logger[_0xd8ed('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd8ed('0x18'),_0xd8ed('0x70'),util[_0xd8ed('0x66')](_0x9ce309[_0xd8ed('0x45')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x33e8ae=_0x9ce309['body'][_0xd8ed('0x71')][0x0];if(_0x33e8ae[_0xd8ed('0x18')][_0xd8ed('0x72')]==='DELIVERED'){return _0x1170d2[_0xd8ed('0x1f')]({'read':!![]});}else{logger[_0xd8ed('0x14')](_0xd8ed('0x73'),_0xd8ed('0x18'),_0xd8ed('0x74'),util[_0xd8ed('0x66')](_0x9ce309['body'],{'showHidden':![],'depth':null}));}break;}return _0x1170d2;}})['then'](respondWithResult(_0x4a4a21,null))[_0xd8ed('0x17')](handleError(_0x4a4a21,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d2aba64..927e8b6 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 _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 +var _0x74b6=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4747d4,_0x3e7853){var _0x282803=function(_0x4a8a3b){while(--_0x4a8a3b){_0x4747d4['push'](_0x4747d4['shift']());}};_0x282803(++_0x3e7853);}(_0x74b6,0x80));var _0x674b=function(_0xd324cd,_0x506a6c){_0xd324cd=_0xd324cd-0x0;var _0x306a33=_0x74b6[_0xd324cd];return _0x306a33;};'use strict';var EventEmitter=require(_0x674b('0x0'));var SmsMessage=require(_0x674b('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x674b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x674b('0x3'),'afterDestroy':_0x674b('0x4')};function emitEvent(_0x5c6735){return function(_0x59eb53,_0x301763,_0xf71f25){SmsMessageEvents[_0x674b('0x5')](_0x5c6735+':'+_0x59eb53['id'],_0x59eb53);SmsMessageEvents[_0x674b('0x5')](_0x5c6735,_0x59eb53);_0xf71f25(null);};}for(var e in events){if(events[_0x674b('0x6')](e)){var event=events[e];SmsMessage[_0x674b('0x7')](e,emitEvent(event));}}module[_0x674b('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a12d31f..074d343 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 _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 +var _0x97be=['sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','username','smsMethod','sender','&password=','password','split','sms','POST','user_key','session_key','total_sent','deliveryReport','senderString','https://smsapi.connectel.se/api/v2/send/','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage'];(function(_0x4511d8,_0x434729){var _0x4c6413=function(_0x5f3218){while(--_0x5f3218){_0x4511d8['push'](_0x4511d8['shift']());}};_0x4c6413(++_0x434729);}(_0x97be,0x1ee));var _0xe97b=function(_0x205135,_0x41fa04){_0x205135=_0x205135-0x0;var _0x166636=_0x97be[_0x205135];return _0x166636;};'use strict';var _=require(_0xe97b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe97b('0x1'));var BPromise=require(_0xe97b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe97b('0x3'));var rimraf=require(_0xe97b('0x4'));var config=require(_0xe97b('0x5'));var attributes=require(_0xe97b('0x6'));module[_0xe97b('0x7')]=function(_0x22a94a,_0x3b9351){return _0x22a94a[_0xe97b('0x8')](_0xe97b('0x9'),attributes,{'tableName':_0xe97b('0xa'),'paranoid':![],'indexes':[{'name':_0xe97b('0xb'),'fields':[_0xe97b('0xb')]},{'name':_0xe97b('0xc'),'fields':[_0xe97b('0xd')],'type':_0xe97b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42b069,_0xeafcc8,_0x1f150f){var _0x1126a3=_0x22a94a[_0xe97b('0xf')];var _0x46f67e=_0x42b069[_0xe97b('0x10')]({'plain':!![]});if(_0x46f67e[_0xe97b('0x11')][_0xe97b('0x12')]()==='in'||_0x46f67e[_0xe97b('0x11')][_0xe97b('0x12')]()===_0xe97b('0x13')&&!_0x46f67e[_0xe97b('0x14')]&&!_['isNil'](_0x46f67e[_0xe97b('0x15')])&&!_[_0xe97b('0x16')](_0x46f67e[_0xe97b('0x17')])){_0x1126a3[_0xe97b('0x18')][_0xe97b('0x19')]({'where':{'id':_0x46f67e['SmsInteractionId']}})[_0xe97b('0x1a')](function(_0x1044ee){if(_0x1044ee){_0x1044ee[_0xe97b('0x1b')]({'lastMsgAt':_0x46f67e['createdAt'],'lastMsgDirection':_0x46f67e[_0xe97b('0x11')][_0xe97b('0x12')]()});}})[_0xe97b('0x1c')](function(_0x531727){console[_0xe97b('0x1d')](_0x531727);});}if(_0x46f67e[_0xe97b('0x11')]===_0xe97b('0x13')&&!_0x46f67e[_0xe97b('0x14')]){var _0x357ec4;_0x1126a3[_0xe97b('0x1e')][_0xe97b('0x1f')]({'where':{'id':_0x46f67e[_0xe97b('0x20')]},'raw':!![]})[_0xe97b('0x1a')](function(_0x4caca6){_0x357ec4=_0x4caca6;if(_0x357ec4&&_0x357ec4[_0xe97b('0x21')]){switch(_0x357ec4[_0xe97b('0x21')]){case _0xe97b('0x22'):var _0x1fe2dd=require(_0xe97b('0x22'));if(_0x357ec4[_0xe97b('0x23')]&&_0x357ec4[_0xe97b('0x24')]&&_0x357ec4[_0xe97b('0x25')]){var _0x2a2d5b=new _0x1fe2dd(_0x357ec4['accountSid'],_0x357ec4[_0xe97b('0x24')]);_0x2a2d5b[_0xe97b('0x26')][_0xe97b('0x27')]({'body':_0x46f67e[_0xe97b('0xd')],'to':_0x46f67e[_0xe97b('0x25')],'from':_0x357ec4[_0xe97b('0x25')],'statusCallback':_0x357ec4['remote']+'/api/sms/messages/'+_0x46f67e['id']+'/status?token='+_0x357ec4[_0xe97b('0x28')]})[_0xe97b('0x1a')](function(_0x4ad4eb){if(_0x4ad4eb[_0xe97b('0x29')]){return _0x42b069[_0xe97b('0x1b')]({'messageId':_0x4ad4eb[_0xe97b('0x29')]});}})[_0xe97b('0x1c')](function(_0x2a7570){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x22'),util[_0xe97b('0x2c')](_0x2a7570,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe97b('0x2d'):var _0x35b9ba='https://api.skebby.it/API/v1.0/REST/';if(_0x357ec4[_0xe97b('0x2e')]&&_0x357ec4['password']){var _0x3fdc9b={'recipient':[_0x46f67e['phone']],'message':_0x46f67e[_0xe97b('0xd')],'message_type':_0x357ec4['smsMethod']};if(_0x357ec4[_0xe97b('0x2f')]&&_0x357ec4[_0xe97b('0x2f')]!=='SI'){_0x3fdc9b[_0xe97b('0x30')]=_0x357ec4['phone'];}var _0x25145b={'url':_0x35b9ba+'login?username='+_0x357ec4[_0xe97b('0x2e')]+_0xe97b('0x31')+_0x357ec4[_0xe97b('0x32')],'method':'GET'};rp(_0x25145b)[_0xe97b('0x1a')](function(_0x43a210){var _0x126011=_0x43a210[_0xe97b('0x33')](';');var _0x40646f={'user_key':_0x126011[0x0],'session_key':_0x126011[0x1]};_0x25145b={'url':_0x35b9ba+_0xe97b('0x34'),'method':_0xe97b('0x35'),'headers':{'user_key':_0x40646f[_0xe97b('0x36')],'Session_key':_0x40646f[_0xe97b('0x37')]},'json':!![],'body':_0x3fdc9b};return rp(_0x25145b);})[_0xe97b('0x1a')](function(_0x127eb1){if(_0x127eb1[_0xe97b('0x38')]>=0x1){var _0x2673f3={'messageId':_0x127eb1['internal_order_id']};if(_0x357ec4[_0xe97b('0x2f')]!=='GP'||!_0x357ec4[_0xe97b('0x39')]){_0x2673f3['read']=!![];}return _0x42b069[_0xe97b('0x1b')](_0x2673f3);}else{return logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),'skebby',util[_0xe97b('0x2c')](_0x127eb1,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x314f16){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x2d'),util[_0xe97b('0x2c')](_0x314f16,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x357ec4[_0xe97b('0x24')]){var _0x5361ec={'recipient':_0x46f67e[_0xe97b('0x25')],'message':_0x46f67e[_0xe97b('0xd')],'sender':_0x357ec4[_0xe97b('0x3a')]||_0x357ec4['phone'],'authorization':_0x357ec4[_0xe97b('0x24')]};var _0xeafcc8={'method':_0xe97b('0x35'),'uri':_0xe97b('0x3b'),'body':_0x5361ec,'json':!![]};rp(_0xeafcc8)[_0xe97b('0x1a')](function(_0x3e5e3a){var _0x47d937={'messageId':_0x3e5e3a['requestid']};if(!_0x357ec4['deliveryReport']){_0x47d937[_0xe97b('0x3c')]=!![];}return _0x42b069[_0xe97b('0x1b')](_0x47d937);})['catch'](function(_0x2fe590){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate',_0xe97b('0x3d'),util[_0xe97b('0x2c')](_0x2fe590,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),'connectel',_0xe97b('0x3e'));}break;case _0xe97b('0x3f'):if(_0x357ec4[_0xe97b('0x2e')]&&_0x357ec4[_0xe97b('0x32')]){var _0x5361ec={'messages':[{'source':_0xe97b('0x40'),'to':_0x46f67e['phone'],'body':_0x46f67e[_0xe97b('0xd')],'from':_0x357ec4[_0xe97b('0x3a')]||_0x357ec4[_0xe97b('0x25')]}]};var _0x112bdd=util[_0xe97b('0x41')](_0xe97b('0x42'),_0x357ec4['username'],_0x357ec4[_0xe97b('0x32')]);var _0xeafcc8={'method':_0xe97b('0x35'),'uri':_0xe97b('0x43'),'body':_0x5361ec,'headers':{'Authorization':util[_0xe97b('0x41')]('Basic\x20%s',new Buffer(_0x112bdd)['toString'](_0xe97b('0x44')))},'json':!![]};rp(_0xeafcc8)[_0xe97b('0x1a')](function(_0x19acde){if(_0x19acde['http_code']>=0xc8&&_0x19acde[_0xe97b('0x45')]<=0xce){if(_0x19acde[_0xe97b('0x46')]&&_0x19acde[_0xe97b('0x46')][_0xe97b('0x47')]>0x0){var _0xf59817=_['head'](_0x19acde[_0xe97b('0x46')][_0xe97b('0x26')]);var _0x375f24={'messageId':_0xf59817[_0xe97b('0x48')]};if(!_0x357ec4[_0xe97b('0x39')]){_0x375f24[_0xe97b('0x3c')]=!![];}return _0x42b069['update'](_0x375f24);}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),'clickSend',util[_0xe97b('0x2c')](_0x19acde,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),'clickSend',util[_0xe97b('0x2c')](_0x19acde,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x469563){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x49'),util[_0xe97b('0x2c')](_0x469563,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),_0xe97b('0x49'),_0xe97b('0x4a'));}break;case _0xe97b('0x4b'):if(_0x357ec4[_0xe97b('0x4c')]&&_0x357ec4[_0xe97b('0x24')]){var _0x5361ec={'dst':_0x46f67e[_0xe97b('0x25')],'text':_0x46f67e['body'],'src':_0x357ec4[_0xe97b('0x3a')]||_0x357ec4[_0xe97b('0x25')],'url':_0x357ec4[_0xe97b('0x4d')]+_0xe97b('0x4e')+_0x46f67e['id']+_0xe97b('0x4f')+_0x357ec4[_0xe97b('0x28')]};var _0x112bdd=util[_0xe97b('0x41')]('%s:%s',_0x357ec4['authId'],_0x357ec4[_0xe97b('0x24')]);var _0xeafcc8={'method':_0xe97b('0x35'),'uri':util[_0xe97b('0x41')](_0xe97b('0x50'),_0x357ec4[_0xe97b('0x4c')]),'body':_0x5361ec,'headers':{'Authorization':util[_0xe97b('0x41')](_0xe97b('0x51'),new Buffer(_0x112bdd)[_0xe97b('0x52')](_0xe97b('0x44')))},'json':!![]};rp(_0xeafcc8)[_0xe97b('0x1a')](function(_0x2cc9bc){var _0x49a812={'messageId':_0x2cc9bc[_0xe97b('0x53')][0x0]};return _0x42b069['update'](_0x49a812);})['catch'](function(_0x37ce12){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate','plivo',util[_0xe97b('0x2c')](_0x37ce12,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x4b'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe97b('0x54'):if(_0x357ec4['username']&&_0x357ec4['password']){if(_0x357ec4[_0xe97b('0x55')]){var _0x12dc0c={'method':'POST','uri':_0x357ec4[_0xe97b('0x55')]+_0xe97b('0x56'),'body':{'username':_0x357ec4[_0xe97b('0x2e')],'password':_0x357ec4[_0xe97b('0x32')]},'json':!![]};return rp(_0x12dc0c)[_0xe97b('0x1a')](function(_0x43c167){var _0x3acd78={'method':_0xe97b('0x35'),'uri':_0x357ec4['baseUrl']+_0xe97b('0x57'),'body':{'messages':[{'from':_0x357ec4[_0xe97b('0x25')],'destinations':[{'to':_0x46f67e[_0xe97b('0x25')]}],'text':_0x46f67e[_0xe97b('0xd')],'notifyUrl':_0x357ec4[_0xe97b('0x4d')]+_0xe97b('0x4e')+_0x46f67e['id']+_0xe97b('0x4f')+_0x357ec4[_0xe97b('0x28')],'notifyContentType':_0xe97b('0x58'),'callbackData':_0x357ec4[_0xe97b('0x25')]+';'+_0x46f67e[_0xe97b('0xd')]}]},'headers':{'Authorization':_0xe97b('0x59')+_0x43c167[_0xe97b('0x28')]},'json':!![]};return rp(_0x3acd78)[_0xe97b('0x1a')](function(_0x11866a){if(_0x11866a['messages']){var _0xdaf153={'messageId':_0x11866a[_0xe97b('0x26')][0x0][_0xe97b('0xb')]};if(!_0x357ec4[_0xe97b('0x39')]){_0xdaf153['read']=!![];}return _0x42b069[_0xe97b('0x1b')](_0xdaf153);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),_0xe97b('0x54'),util[_0xe97b('0x2c')](_0x11866a,{'showHidden':![],'depth':null}));}});})[_0xe97b('0x1c')](function(_0xcabe42){return logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x54'),util[_0xe97b('0x2c')](_0xcabe42,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x54'),_0xe97b('0x5a'));}}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe97b('0x5b'):var _0x51c723=require('crypto');if(_0x357ec4[_0xe97b('0x5c')]){var _0x5d0b2f={};_0x5d0b2f[_0xe97b('0x5d')]=_0x357ec4['username'];_0x5d0b2f['phone']=_0x46f67e[_0xe97b('0x25')];_0x5d0b2f['sender']=_0x357ec4[_0xe97b('0x25')];_0x5d0b2f[_0xe97b('0x5e')]=_0x46f67e[_0xe97b('0xd')];_0x5d0b2f[_0xe97b('0x5f')]=+new Date();var _0x5893c6='';var _0x1cc22b='';var _0x5a20ac=Object[_0xe97b('0x60')](_0x5d0b2f);_0x5a20ac[_0xe97b('0x61')]();for(var _0x40dffe=0x0;_0x40dffe<_0x5a20ac['length'];_0x40dffe++){if(_0x5893c6!=''){_0x5893c6+='&';}_0x5893c6+=_0x5a20ac[_0x40dffe]+'='+encodeURIComponent(_0x5d0b2f[_0x5a20ac[_0x40dffe]]);_0x1cc22b+=_0x5d0b2f[_0x5a20ac[_0x40dffe]];}_0x1cc22b+=_0x357ec4[_0xe97b('0x5c')];_0x1cc22b=_0x51c723[_0xe97b('0x62')](_0xe97b('0x63'))[_0xe97b('0x1b')](_0x1cc22b)[_0xe97b('0x64')](_0xe97b('0x65'));if(_0x5893c6!==''){_0x5893c6+='&';}_0x5893c6+=_0xe97b('0x66')+_0x1cc22b;var _0x25145b={'method':_0xe97b('0x67'),'uri':_0x357ec4[_0xe97b('0x55')]+_0xe97b('0x68')+_0x5893c6,'json':!![]};return rp(_0x25145b)[_0xe97b('0x1a')](function(_0x2ea68f){var _0x5723b6=Object[_0xe97b('0x60')](_0x2ea68f);if(_0x2ea68f[_0x5723b6[0x0]]['error']&&parseInt(_0x2ea68f[_0x5723b6[0x0]][_0xe97b('0x1d')])===0x0){var _0x5254ea={'messageId':_0x2ea68f[_0x5723b6[0x0]][_0xe97b('0x69')]};if(!_0x357ec4[_0xe97b('0x39')]){_0x5254ea['read']=!![];}return _0x42b069['update'](_0x5254ea);}else{return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x5b'),util[_0xe97b('0x2c')](_0x2ea68f[_0xe97b('0x1d')],{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x209b2a){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x5b'),util[_0xe97b('0x2c')](_0x209b2a,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case _0xe97b('0x6a'):if(_0x357ec4[_0xe97b('0x5c')]){var _0x5edf1d={'method':_0xe97b('0x35'),'uri':_0xe97b('0x6b'),'headers':{'Authorization':_0x357ec4[_0xe97b('0x5c')]},'body':{'content':_0x46f67e['body'],'to':[_0x46f67e[_0xe97b('0x25')]],'from':_0x357ec4[_0xe97b('0x25')],'binary':![],'clientMessageId':'uuid','charset':_0xe97b('0x6c')},'json':!![]};rp(_0x5edf1d)[_0xe97b('0x1a')](function(_0x1ad8e3){if(!_0x1ad8e3[_0xe97b('0x1d')]){var _0x2acd04={'messageId':_0x1ad8e3[_0xe97b('0x26')][0x0][_0xe97b('0x6d')]};if(!_0x357ec4[_0xe97b('0x39')]){_0x2acd04[_0xe97b('0x3c')]=!![];}return _0x42b069[_0xe97b('0x1b')](_0x2acd04);}else{return logger['error'](_0xe97b('0x2a'),'afterCreate','clickatell',util[_0xe97b('0x2c')](_0x1ad8e3['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bbe21){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x6a'),util[_0xe97b('0x2c')](_0x3bbe21,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),_0xe97b('0x6a'),_0xe97b('0x6e'));}break;case _0xe97b('0x6f'):if(_0x357ec4[_0xe97b('0x2e')]&&_0x357ec4[_0xe97b('0x32')]){var _0x112bdd=util[_0xe97b('0x41')]('%s:%s',_0x357ec4[_0xe97b('0x2e')],_0x357ec4['password']);var _0xeafcc8={'method':_0xe97b('0x35'),'uri':_0xe97b('0x70')+_0x357ec4[_0xe97b('0x71')]+_0xe97b('0x72'),'body':{'to':[_0x46f67e[_0xe97b('0x25')]],'text':_0x46f67e['body'],'from':_0x357ec4[_0xe97b('0x25')],'applicationId':_0x357ec4[_0xe97b('0x73')]},'headers':{'Authorization':util[_0xe97b('0x41')]('Basic\x20%s',new Buffer(_0x112bdd)[_0xe97b('0x52')](_0xe97b('0x44')))},'json':!![]};rp(_0xeafcc8)['then'](function(_0x2670e7){if(_0x2670e7['id']){var _0x215bcd={'messageId':_0x2670e7['id']};return _0x42b069['update'](_0x215bcd);}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x6f'),util['inspect'](_0x2670e7,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x56f11b){logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),'bandwidth',util[_0xe97b('0x2c')](_0x56f11b,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x6f'),_0xe97b('0x4a'));}break;case _0xe97b('0x74'):if(_0x357ec4[_0xe97b('0x5c')]){var _0x330d9c={};var _0x25145b={'method':'POST','uri':_0xe97b('0x75'),'headers':{'Authorization':_0xe97b('0x76')+_0x357ec4['apiKey'],'Content-Type':_0xe97b('0x58')},'body':{'from':_0x357ec4[_0xe97b('0x25')],'to':_0x46f67e[_0xe97b('0x25')],'text':_0x46f67e[_0xe97b('0xd')]},'json':!![]};return rp(_0x25145b)[_0xe97b('0x1a')](function(_0x459743){if(_0x459743[_0xe97b('0x77')]==0xca){_0x330d9c[_0xe97b('0x78')]=_0x459743;var _0x1060f6={'method':'POST','uri':_0xe97b('0x79'),'headers':{'Authorization':'Bearer\x20'+_0x357ec4[_0xe97b('0x5c')],'Content-Type':_0xe97b('0x58')},'body':{'refid':_0x330d9c[_0xe97b('0x78')][_0xe97b('0x7a')]},'json':!![]};return rp(_0x1060f6)[_0xe97b('0x1a')](function(_0x3c766c){_0x330d9c[_0xe97b('0x7b')]=_0x3c766c;var _0x1eb639={'messageId':_0x330d9c[_0xe97b('0x78')][_0xe97b('0x7a')],'read':!![]};return _0x42b069[_0xe97b('0x1b')](_0x1eb639);});}else{return logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),'intelepeer',util['inspect'](_0x459743,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x5c99da){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate',_0xe97b('0x74'),util[_0xe97b('0x2c')](_0x5c99da,{'showHidden':![],'depth':null}));});}else{return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x74'),_0xe97b('0x7c'));}break;}}})['finally'](function(){_0x1f150f();});}else{_0x1f150f();}}},'charset':'utf8mb4','collate':_0xe97b('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index be5a715..de5f371 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 _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 +var _0xbca4=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','body','options','lodash'];(function(_0x4f4882,_0x22255c){var _0x126d36=function(_0xa2c0c8){while(--_0xa2c0c8){_0x4f4882['push'](_0x4f4882['shift']());}};_0x126d36(++_0x22255c);}(_0xbca4,0x8b));var _0x4bca=function(_0x5aa593,_0x275634){_0x5aa593=_0x5aa593-0x0;var _0x3c2770=_0xbca4[_0x5aa593];return _0x3c2770;};'use strict';var _=require(_0x4bca('0x0'));var util=require(_0x4bca('0x1'));var moment=require('moment');var BPromise=require(_0x4bca('0x2'));var rs=require(_0x4bca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bca('0x5'))(_0x4bca('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bca('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4bca('0x8')],{'host':_0x4bca('0x9'),'port':0x18eb});var socket=require(_0x4bca('0xa'))(new Redis(config[_0x4bca('0x8')]));require('./smsMessage.socket')[_0x4bca('0xb')](socket);function respondWithRpcPromise(_0x1274bd,_0x4b6be7,_0x555e95){return new BPromise(function(_0x15b806,_0x43720f){return client[_0x4bca('0xc')](_0x1274bd,_0x555e95)[_0x4bca('0xd')](function(_0x5dc8ef){logger[_0x4bca('0xe')](_0x4bca('0xf'),_0x4b6be7,_0x4bca('0x10'));logger[_0x4bca('0x11')](_0x4bca('0x12'),_0x4b6be7,_0x4bca('0x10'),JSON[_0x4bca('0x13')](_0x5dc8ef));if(_0x5dc8ef[_0x4bca('0x14')]){if(_0x5dc8ef['error'][_0x4bca('0x15')]===0x1f4){logger[_0x4bca('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4b6be7,_0x5dc8ef[_0x4bca('0x14')][_0x4bca('0x16')]);return _0x43720f(_0x5dc8ef['error'][_0x4bca('0x16')]);}logger[_0x4bca('0x14')](_0x4bca('0xf'),_0x4b6be7,_0x5dc8ef[_0x4bca('0x14')]['message']);return _0x15b806(_0x5dc8ef['error']['message']);}else{logger['info'](_0x4bca('0xf'),_0x4b6be7,_0x4bca('0x10'));_0x15b806(_0x5dc8ef[_0x4bca('0x17')]['message']);}})[_0x4bca('0x18')](function(_0x43a616){logger[_0x4bca('0x14')](_0x4bca('0xf'),_0x4b6be7,_0x43a616);_0x43720f(_0x43a616);});});}exports[_0x4bca('0x19')]=function(_0x3c4e6b){var _0x4b9645=this;return new Promise(function(_0x143334,_0x10de05){return db['SmsMessage']['create'](_0x3c4e6b[_0x4bca('0x1a')],{'raw':_0x3c4e6b[_0x4bca('0x1b')]?_0x3c4e6b[_0x4bca('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x4bca('0xd')](function(_0x3f7aa6){logger['info']('CreateSmsMessage',_0x3c4e6b);logger[_0x4bca('0x11')](_0x4bca('0x19'),_0x3c4e6b,JSON[_0x4bca('0x13')](_0x3f7aa6));_0x143334(_0x3f7aa6);})['catch'](function(_0x590179){logger[_0x4bca('0x14')](_0x4bca('0x19'),_0x590179['message'],_0x3c4e6b);_0x10de05(_0x4b9645['error'](0x1f4,_0x590179[_0x4bca('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a4832f4..2e1e8a4 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 _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 +var _0x21f1=['update','emit','removeListener','register','length','./smsMessage.events','remove'];(function(_0x4abc8f,_0xef597d){var _0x5d7939=function(_0x145f23){while(--_0x145f23){_0x4abc8f['push'](_0x4abc8f['shift']());}};_0x5d7939(++_0xef597d);}(_0x21f1,0x1ef));var _0x121f=function(_0x58d988,_0x41978f){_0x58d988=_0x58d988-0x0;var _0x39ec4a=_0x21f1[_0x58d988];return _0x39ec4a;};'use strict';var SmsMessageEvents=require(_0x121f('0x0'));var events=['save',_0x121f('0x1'),_0x121f('0x2')];function createListener(_0x455cd9,_0x53d479){return function(_0x2cb2ff){_0x53d479[_0x121f('0x3')](_0x455cd9,_0x2cb2ff);};}function removeListener(_0x4981fd,_0xeaa825){return function(){SmsMessageEvents[_0x121f('0x4')](_0x4981fd,_0xeaa825);};}exports[_0x121f('0x5')]=function(_0x296eab){for(var _0x31f592=0x0,_0x3957db=events[_0x121f('0x6')];_0x31f592<_0x3957db;_0x31f592++){var _0x5b893a=events[_0x31f592];var _0x116491=createListener('smsMessage:'+_0x5b893a,_0x296eab);SmsMessageEvents['on'](_0x5b893a,_0x116491);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 11de73b..a147199 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 _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 +var _0x66a1=['post','addTeams','addAgents','put','delete','/:id','destroy','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0x66a1,0x121));var _0x166a=function(_0x684918,_0x338d95){_0x684918=_0x684918-0x0;var _0x340ee3=_0x66a1[_0x684918];return _0x340ee3;};'use strict';var multer=require(_0x166a('0x0'));var util=require(_0x166a('0x1'));var path=require('path');var timeout=require(_0x166a('0x2'));var express=require('express');var router=express[_0x166a('0x3')]();var fs_extra=require(_0x166a('0x4'));var auth=require(_0x166a('0x5'));var interaction=require(_0x166a('0x6'));var config=require(_0x166a('0x7'));var controller=require(_0x166a('0x8'));router[_0x166a('0x9')]('/',auth[_0x166a('0xa')](),controller[_0x166a('0xb')]);router[_0x166a('0x9')](_0x166a('0xc'),auth['isAuthenticated'](),controller[_0x166a('0xd')]);router[_0x166a('0x9')]('/:id',auth[_0x166a('0xa')](),controller[_0x166a('0xe')]);router[_0x166a('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x166a('0xf')]);router[_0x166a('0x9')](_0x166a('0x10'),auth[_0x166a('0xa')](),controller['getTeams']);router['get'](_0x166a('0x11'),auth[_0x166a('0xa')](),controller[_0x166a('0x12')]);router[_0x166a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x166a('0x10'),auth[_0x166a('0xa')](),controller[_0x166a('0x14')]);router[_0x166a('0x13')](_0x166a('0x11'),auth[_0x166a('0xa')](),controller[_0x166a('0x15')]);router[_0x166a('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x166a('0x17')](_0x166a('0x18'),auth['isAuthenticated'](),controller[_0x166a('0x19')]);router[_0x166a('0x17')](_0x166a('0x10'),auth[_0x166a('0xa')](),controller['removeTeams']);router[_0x166a('0x17')](_0x166a('0x11'),auth[_0x166a('0xa')](),controller[_0x166a('0x1a')]);module[_0x166a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index eac15d0..0b779b3 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 _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 +var _0x32f7=['INTEGER','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x3a39bd,_0x5c5c15){var _0x4c7f04=function(_0x288218){while(--_0x288218){_0x3a39bd['push'](_0x3a39bd['shift']());}};_0x4c7f04(++_0x5c5c15);}(_0x32f7,0xb1));var _0x732f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x732f('0x0'));module[_0x732f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x732f('0x2')]},'timeout':{'type':Sequelize[_0x732f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x732f('0x4'),_0x732f('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0259e23..e6a7f8e 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 _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 +var _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x404562,_0x581f17){var _0x2982dc=function(_0x50b01d){while(--_0x50b01d){_0x404562['push'](_0x404562['shift']());}};_0x2982dc(++_0x581f17);}(_0x7a54,0x106));var _0x47a5=function(_0x1e71e1,_0x57f3f5){_0x1e71e1=_0x1e71e1-0x0;var _0x3ad421=_0x7a54[_0x1e71e1];return _0x3ad421;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3f1c516..5f2c6d0 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 _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 +var _0xf5c1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x4bbaaf,_0x4a0e26){var _0x567c80=function(_0x303fae){while(--_0x303fae){_0x4bbaaf['push'](_0x4bbaaf['shift']());}};_0x567c80(++_0x4a0e26);}(_0xf5c1,0x19b));var _0x1f5c=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0xf5c1[_0x11b1b3];return _0x437029;};'use strict';var EventEmitter=require(_0x1f5c('0x0'));var SmsQueue=require(_0x1f5c('0x1'))['db'][_0x1f5c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1f5c('0x3')](0x0);var events={'afterCreate':_0x1f5c('0x4'),'afterUpdate':_0x1f5c('0x5'),'afterDestroy':_0x1f5c('0x6')};function emitEvent(_0x1468d3){return function(_0x3fee81,_0x483ca0,_0x6ecede){SmsQueueEvents['emit'](_0x1468d3+':'+_0x3fee81['id'],_0x3fee81);SmsQueueEvents[_0x1f5c('0x7')](_0x1468d3,_0x3fee81);_0x6ecede(null);};}for(var e in events){if(events[_0x1f5c('0x8')](e)){var event=events[e];SmsQueue[_0x1f5c('0x9')](e,emitEvent(event));}}module[_0x1f5c('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 926eae7..d5afdf0 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 _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 +var _0xaa76=['lodash','util','../../config/logger','bluebird','path','rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x3cbbf0,_0x1b630f){var _0x557d5d=function(_0x4f17fb){while(--_0x4f17fb){_0x3cbbf0['push'](_0x3cbbf0['shift']());}};_0x557d5d(++_0x1b630f);}(_0xaa76,0xbb));var _0x6aa7=function(_0x453052,_0x5824cd){_0x453052=_0x453052-0x0;var _0xddc922=_0xaa76[_0x453052];return _0xddc922;};'use strict';var _=require(_0x6aa7('0x0'));var util=require(_0x6aa7('0x1'));var logger=require(_0x6aa7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6aa7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6aa7('0x4'));var rimraf=require(_0x6aa7('0x5'));var config=require('../../config/environment');var attributes=require(_0x6aa7('0x6'));module[_0x6aa7('0x7')]=function(_0x1664bd,_0x9514de){return _0x1664bd[_0x6aa7('0x8')](_0x6aa7('0x9'),attributes,{'tableName':_0x6aa7('0xa'),'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 712548c..e2c4a31 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 _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 +var _0xbcdb=['rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xbcdb,0x1a6));var _0xbbcd=function(_0xdfc21c,_0x65831a){_0xdfc21c=_0xdfc21c-0x0;var _0x4cedda=_0xbcdb[_0xdfc21c];return _0x4cedda;};'use strict';var _=require(_0xbbcd('0x0'));var util=require(_0xbbcd('0x1'));var moment=require(_0xbbcd('0x2'));var BPromise=require(_0xbbcd('0x3'));var rs=require(_0xbbcd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbcd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbcd('0x6'))(_0xbbcd('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbcd('0x8'));var client=jayson[_0xbbcd('0x9')][_0xbbcd('0xa')]({'port':0x232a});config['redis']=_[_0xbbcd('0xb')](config[_0xbbcd('0xc')],{'host':_0xbbcd('0xd'),'port':0x18eb});var socket=require(_0xbbcd('0xe'))(new Redis(config[_0xbbcd('0xc')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x144f05,_0x592f,_0x283bf1){return new BPromise(function(_0x49a98f,_0xde160e){return client[_0xbbcd('0xf')](_0x144f05,_0x283bf1)[_0xbbcd('0x10')](function(_0x54a638){logger[_0xbbcd('0x11')]('SmsQueue,\x20%s,\x20%s',_0x592f,'request\x20sent');logger[_0xbbcd('0x12')](_0xbbcd('0x13'),_0x592f,_0xbbcd('0x14'),JSON[_0xbbcd('0x15')](_0x54a638));if(_0x54a638['error']){if(_0x54a638[_0xbbcd('0x16')][_0xbbcd('0x17')]===0x1f4){logger['error'](_0xbbcd('0x18'),_0x592f,_0x54a638['error'][_0xbbcd('0x19')]);return _0xde160e(_0x54a638[_0xbbcd('0x16')]['message']);}logger[_0xbbcd('0x16')]('SmsQueue,\x20%s,\x20%s',_0x592f,_0x54a638[_0xbbcd('0x16')][_0xbbcd('0x19')]);return _0x49a98f(_0x54a638[_0xbbcd('0x16')][_0xbbcd('0x19')]);}else{logger[_0xbbcd('0x11')](_0xbbcd('0x18'),_0x592f,_0xbbcd('0x14'));_0x49a98f(_0x54a638['result'][_0xbbcd('0x19')]);}})[_0xbbcd('0x1a')](function(_0x1d58ae){logger[_0xbbcd('0x16')](_0xbbcd('0x18'),_0x592f,_0x1d58ae);_0xde160e(_0x1d58ae);});});}exports[_0xbbcd('0x1b')]=function(_0xceccb0){var _0x5f0bcf=this;return new Promise(function(_0x144386,_0x5a42e9){return db[_0xbbcd('0x1c')][_0xbbcd('0x1d')]({'raw':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0[_0xbbcd('0x1e')][_0xbbcd('0x1f')]===undefined?!![]:![]:!![],'where':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0[_0xbbcd('0x1e')][_0xbbcd('0x20')]||null:null,'attributes':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0['options'][_0xbbcd('0x21')]||null:null,'limit':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0[_0xbbcd('0x1e')][_0xbbcd('0x22')]||null:null,'include':_0xceccb0['options']?_0xceccb0['options'][_0xbbcd('0x23')]?_[_0xbbcd('0x24')](_0xceccb0['options'][_0xbbcd('0x23')],function(_0x369870){return{'model':db[_0x369870[_0xbbcd('0x25')]],'as':_0x369870['as'],'attributes':_0x369870[_0xbbcd('0x21')],'include':_0x369870[_0xbbcd('0x23')]?_['map'](_0x369870[_0xbbcd('0x23')],function(_0x508f2c){return{'model':db[_0x508f2c[_0xbbcd('0x25')]],'as':_0x508f2c['as'],'attributes':_0x508f2c[_0xbbcd('0x21')],'include':_0x508f2c[_0xbbcd('0x23')]?_[_0xbbcd('0x24')](_0x508f2c[_0xbbcd('0x23')],function(_0x5593ce){return{'model':db[_0x5593ce[_0xbbcd('0x25')]],'as':_0x5593ce['as'],'attributes':_0x5593ce['attributes']};}):[]};}):[]};}):[]:[]})[_0xbbcd('0x10')](function(_0x59d15c){logger['info']('GetSmsQueue',_0xceccb0);logger[_0xbbcd('0x12')](_0xbbcd('0x1b'),_0xceccb0,JSON[_0xbbcd('0x15')](_0x59d15c));_0x144386(_0x59d15c);})[_0xbbcd('0x1a')](function(_0x123895){logger['error']('GetSmsQueue',_0x123895[_0xbbcd('0x19')],_0xceccb0);_0x5a42e9(_0x5f0bcf[_0xbbcd('0x16')](0x1f4,_0x123895[_0xbbcd('0x19')]));});});};exports[_0xbbcd('0x26')]=function(_0x360a62){var _0x3660bd=this;return new Promise(function(_0x2e139c,_0x4f4570){return db[_0xbbcd('0x1c')]['find']({'raw':_0x360a62[_0xbbcd('0x1e')]?_0x360a62['options'][_0xbbcd('0x1f')]===undefined?!![]:![]:!![],'where':_0x360a62['options']?_0x360a62['options'][_0xbbcd('0x20')]||null:null,'attributes':_0x360a62[_0xbbcd('0x1e')]?_0x360a62['options']['attributes']||null:null,'include':_0x360a62['options']?_0x360a62[_0xbbcd('0x1e')]['include']?_[_0xbbcd('0x24')](_0x360a62[_0xbbcd('0x1e')]['include'],function(_0x3a4840){return{'model':db[_0x3a4840[_0xbbcd('0x25')]],'as':_0x3a4840['as'],'attributes':_0x3a4840[_0xbbcd('0x21')],'include':_0x3a4840[_0xbbcd('0x23')]?_['map'](_0x3a4840[_0xbbcd('0x23')],function(_0xe6a46f){return{'model':db[_0xe6a46f[_0xbbcd('0x25')]],'as':_0xe6a46f['as'],'attributes':_0xe6a46f['attributes'],'include':_0xe6a46f['include']?_[_0xbbcd('0x24')](_0xe6a46f[_0xbbcd('0x23')],function(_0x4386f7){return{'model':db[_0x4386f7[_0xbbcd('0x25')]],'as':_0x4386f7['as'],'attributes':_0x4386f7[_0xbbcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbbcd('0x10')](function(_0x5214e5){logger[_0xbbcd('0x11')](_0xbbcd('0x26'),_0x360a62);logger[_0xbbcd('0x12')]('ShowSmsQueue',_0x360a62,JSON[_0xbbcd('0x15')](_0x5214e5));_0x2e139c(_0x5214e5);})[_0xbbcd('0x1a')](function(_0x5af98d){logger[_0xbbcd('0x16')](_0xbbcd('0x26'),_0x5af98d[_0xbbcd('0x19')],_0x360a62);_0x4f4570(_0x3660bd[_0xbbcd('0x16')](0x1f4,_0x5af98d[_0xbbcd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f0321e9..5272bc9 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 _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 +var _0xcec8=['register','smsQueue:','save','remove','update','emit','removeListener'];(function(_0x53ed97,_0x1b32fd){var _0x5eb20e=function(_0x40fc0a){while(--_0x40fc0a){_0x53ed97['push'](_0x53ed97['shift']());}};_0x5eb20e(++_0x1b32fd);}(_0xcec8,0x1b4));var _0x8cec=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xcec8[_0x415603];return _0x131e72;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x8cec('0x0'),_0x8cec('0x1'),_0x8cec('0x2')];function createListener(_0xad6150,_0x2f3385){return function(_0x39dd68){_0x2f3385[_0x8cec('0x3')](_0xad6150,_0x39dd68);};}function removeListener(_0xc43346,_0x492566){return function(){SmsQueueEvents[_0x8cec('0x4')](_0xc43346,_0x492566);};}exports[_0x8cec('0x5')]=function(_0x29aeda){for(var _0x438dd5=0x0,_0x361e1e=events['length'];_0x438dd5<_0x361e1e;_0x438dd5++){var _0x3e7e8b=events[_0x438dd5];var _0x200ea2=createListener(_0x8cec('0x6')+_0x3e7e8b,_0x29aeda);SmsQueueEvents['on'](_0x3e7e8b,_0x200ea2);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e43b149..1646099 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 _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 +var _0x6cca=['/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','post','put'];(function(_0x6d255e,_0x14f32a){var _0x251baa=function(_0xa68748){while(--_0xa68748){_0x6d255e['push'](_0x6d255e['shift']());}};_0x251baa(++_0x14f32a);}(_0x6cca,0x10e));var _0xa6cc=function(_0x39748b,_0xfe0c17){_0x39748b=_0x39748b-0x0;var _0x1d9391=_0x6cca[_0x39748b];return _0x1d9391;};'use strict';var multer=require(_0xa6cc('0x0'));var util=require(_0xa6cc('0x1'));var path=require('path');var timeout=require(_0xa6cc('0x2'));var express=require(_0xa6cc('0x3'));var router=express[_0xa6cc('0x4')]();var fs_extra=require(_0xa6cc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa6cc('0x6'));var config=require(_0xa6cc('0x7'));var controller=require(_0xa6cc('0x8'));router[_0xa6cc('0x9')]('/',auth[_0xa6cc('0xa')](),controller['index']);router[_0xa6cc('0x9')](_0xa6cc('0xb'),auth[_0xa6cc('0xa')](),controller[_0xa6cc('0xc')]);router[_0xa6cc('0x9')]('/:id',auth[_0xa6cc('0xa')](),controller['show']);router[_0xa6cc('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6cc('0xe')](_0xa6cc('0xf'),auth[_0xa6cc('0xa')](),controller[_0xa6cc('0x10')]);router['delete'](_0xa6cc('0xf'),auth[_0xa6cc('0xa')](),controller[_0xa6cc('0x11')]);module[_0xa6cc('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index fd2ce06..fb6deca 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 _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 +var _0x0a31=['exports','STRING','DATE','moment'];(function(_0x264432,_0x2ad221){var _0x5c4da7=function(_0x3a846b){while(--_0x3a846b){_0x264432['push'](_0x264432['shift']());}};_0x5c4da7(++_0x2ad221);}(_0x0a31,0xf3));var _0x10a3=function(_0x11b1fe,_0x306e9a){_0x11b1fe=_0x11b1fe-0x0;var _0x449e9c=_0x0a31[_0x11b1fe];return _0x449e9c;};'use strict';var moment=require(_0x10a3('0x0'));var Sequelize=require('sequelize');module[_0x10a3('0x1')]={'uniqueid':{'type':Sequelize[_0x10a3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x10a3('0x2')]},'joinAt':{'type':Sequelize[_0x10a3('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x10a3('0x3')]},'exitAt':{'type':Sequelize[_0x10a3('0x3')]},'reason':{'type':Sequelize[_0x10a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 3a12b17..b10219f 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 _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 +var _0xdd2e=['params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','length','find','create','body'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xdd2e,0x174));var _0xedd2=function(_0x1f47b0,_0x2c4a70){_0x1f47b0=_0x1f47b0-0x0;var _0x322e10=_0xdd2e[_0x1f47b0];return _0x322e10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedd2('0x0'));var zipdir=require(_0xedd2('0x1'));var jsonpatch=require(_0xedd2('0x2'));var rp=require(_0xedd2('0x3'));var moment=require(_0xedd2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xedd2('0x5'));var util=require(_0xedd2('0x6'));var path=require(_0xedd2('0x7'));var sox=require(_0xedd2('0x8'));var csv=require('to-csv');var ejs=require(_0xedd2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedd2('0xa'));var squel=require('squel');var crypto=require(_0xedd2('0xb'));var jsforce=require(_0xedd2('0xc'));var deskjs=require(_0xedd2('0xd'));var toCsv=require(_0xedd2('0xe'));var querystring=require(_0xedd2('0xf'));var Papa=require(_0xedd2('0x10'));var Redis=require(_0xedd2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xedd2('0x12'));var as=require(_0xedd2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedd2('0x14'));var utils=require(_0xedd2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xedd2('0x16'))['db'];function respondWithStatusCode(_0xd4817e,_0x18d92d){_0x18d92d=_0x18d92d||0xcc;return function(_0x4928a7){if(_0x4928a7){return _0xd4817e[_0xedd2('0x17')](_0x18d92d);}return _0xd4817e[_0xedd2('0x18')](_0x18d92d)[_0xedd2('0x19')]();};}function respondWithResult(_0x5042c3,_0x3ef64d){_0x3ef64d=_0x3ef64d||0xc8;return function(_0x2e850b){if(_0x2e850b){return _0x5042c3[_0xedd2('0x18')](_0x3ef64d)['json'](_0x2e850b);}};}function respondWithFilteredResult(_0x59e637,_0x58cbfd){return function(_0x5e897f){if(_0x5e897f){var _0x2a49d7=typeof _0x58cbfd[_0xedd2('0x1a')]===_0xedd2('0x1b')&&typeof _0x58cbfd[_0xedd2('0x1c')]==='undefined';var _0x804046=_0x5e897f[_0xedd2('0x1d')];var _0x3c64a7=_0x2a49d7?0x0:_0x58cbfd[_0xedd2('0x1a')];var _0x24083b=_0x2a49d7?_0x5e897f[_0xedd2('0x1d')]:_0x58cbfd['offset']+_0x58cbfd['limit'];var _0x44e118;if(_0x24083b>=_0x804046){_0x24083b=_0x804046;_0x44e118=0xc8;}else{_0x44e118=0xce;}_0x59e637['status'](_0x44e118);return _0x59e637[_0xedd2('0x1e')]('Content-Range',_0x3c64a7+'-'+_0x24083b+'/'+_0x804046)[_0xedd2('0x1f')](_0x5e897f);}return null;};}function patchUpdates(_0x4de9a9){return function(_0x5e7907){try{jsonpatch[_0xedd2('0x20')](_0x5e7907,_0x4de9a9,!![]);}catch(_0x234600){return BPromise[_0xedd2('0x21')](_0x234600);}return _0x5e7907[_0xedd2('0x22')]();};}function saveUpdates(_0xad6473,_0x3b41d3){return function(_0x6a9eb5){if(_0x6a9eb5){return _0x6a9eb5[_0xedd2('0x23')](_0xad6473)[_0xedd2('0x24')](function(_0xa17b20){return _0xa17b20;});}return null;};}function removeEntity(_0x1f1e70,_0xf67f70){return function(_0x5f1c4d){if(_0x5f1c4d){return _0x5f1c4d[_0xedd2('0x25')]()[_0xedd2('0x24')](function(){_0x1f1e70[_0xedd2('0x18')](0xcc)[_0xedd2('0x19')]();});}};}function handleEntityNotFound(_0x3abbe7,_0x989ded){return function(_0x16297c){if(!_0x16297c){_0x3abbe7[_0xedd2('0x17')](0x194);}return _0x16297c;};}function handleError(_0x16fa54,_0x4f066d){_0x4f066d=_0x4f066d||0x1f4;return function(_0x392880){logger['error'](_0x392880['stack']);if(_0x392880[_0xedd2('0x26')]){delete _0x392880['name'];}_0x16fa54[_0xedd2('0x18')](_0x4f066d)[_0xedd2('0x27')](_0x392880);};}exports[_0xedd2('0x28')]=function(_0x33897d,_0x4ba449){var _0x2baa66={},_0x27c9e3={},_0x393087={'count':0x0,'rows':[]};var _0x6373b9=_[_0xedd2('0x29')](db[_0xedd2('0x2a')][_0xedd2('0x2b')],function(_0x162343){return{'name':_0x162343[_0xedd2('0x2c')],'type':_0x162343['type'][_0xedd2('0x2d')]};});_0x27c9e3[_0xedd2('0x2e')]=_[_0xedd2('0x29')](_0x6373b9,_0xedd2('0x26'));_0x27c9e3[_0xedd2('0x2f')]=_[_0xedd2('0x30')](_0x33897d[_0xedd2('0x2f')]);_0x27c9e3['filters']=_[_0xedd2('0x31')](_0x27c9e3['model'],_0x27c9e3[_0xedd2('0x2f')]);_0x2baa66[_0xedd2('0x32')]=_[_0xedd2('0x31')](_0x27c9e3[_0xedd2('0x2e')],qs[_0xedd2('0x33')](_0x33897d[_0xedd2('0x2f')]['fields']));_0x2baa66['attributes']=_0x2baa66[_0xedd2('0x32')]['length']?_0x2baa66['attributes']:_0x27c9e3[_0xedd2('0x2e')];if(!_0x33897d['query'][_0xedd2('0x34')](_0xedd2('0x35'))){_0x2baa66['limit']=qs['limit'](_0x33897d['query']['limit']);_0x2baa66[_0xedd2('0x1a')]=qs['offset'](_0x33897d['query'][_0xedd2('0x1a')]);}_0x2baa66[_0xedd2('0x36')]=qs[_0xedd2('0x37')](_0x33897d[_0xedd2('0x2f')]['sort']);_0x2baa66[_0xedd2('0x38')]=qs[_0xedd2('0x39')](_[_0xedd2('0x3a')](_0x33897d[_0xedd2('0x2f')],_0x27c9e3[_0xedd2('0x39')]),_0x6373b9);if(_0x33897d[_0xedd2('0x2f')][_0xedd2('0x3b')]){_0x2baa66[_0xedd2('0x38')]=_[_0xedd2('0x3c')](_0x2baa66[_0xedd2('0x38')],{'$or':_[_0xedd2('0x29')](_0x6373b9,function(_0x5d58a6){if(_0x5d58a6[_0xedd2('0x3d')]!==_0xedd2('0x3e')){var _0x3b69a5={};_0x3b69a5[_0x5d58a6['name']]={'$like':'%'+_0x33897d['query'][_0xedd2('0x3b')]+'%'};return _0x3b69a5;}})});}_0x2baa66=_[_0xedd2('0x3c')]({},_0x2baa66,_0x33897d[_0xedd2('0x3f')]);var _0x5894b5={'where':_0x2baa66[_0xedd2('0x38')]};return db['SmsQueueReport'][_0xedd2('0x1d')](_0x5894b5)[_0xedd2('0x24')](function(_0x4ddd96){_0x393087[_0xedd2('0x1d')]=_0x4ddd96;if(_0x33897d[_0xedd2('0x2f')]['includeAll']){_0x2baa66[_0xedd2('0x40')]=[{'all':!![]}];}return db[_0xedd2('0x2a')][_0xedd2('0x41')](_0x2baa66);})[_0xedd2('0x24')](function(_0x327425){_0x393087['rows']=_0x327425;return _0x393087;})['then'](respondWithFilteredResult(_0x4ba449,_0x2baa66))[_0xedd2('0x42')](handleError(_0x4ba449,null));};exports[_0xedd2('0x43')]=function(_0x4f8f08,_0x120e5e){var _0x5bc15c={'raw':!![],'where':{'id':_0x4f8f08['params']['id']}},_0xb51e18={};_0xb51e18[_0xedd2('0x2e')]=_[_0xedd2('0x30')](db['SmsQueueReport'][_0xedd2('0x2b')]);_0xb51e18[_0xedd2('0x2f')]=_[_0xedd2('0x30')](_0x4f8f08[_0xedd2('0x2f')]);_0xb51e18[_0xedd2('0x39')]=_['intersection'](_0xb51e18[_0xedd2('0x2e')],_0xb51e18[_0xedd2('0x2f')]);_0x5bc15c[_0xedd2('0x32')]=_[_0xedd2('0x31')](_0xb51e18['model'],qs['fields'](_0x4f8f08[_0xedd2('0x2f')]['fields']));_0x5bc15c[_0xedd2('0x32')]=_0x5bc15c['attributes'][_0xedd2('0x44')]?_0x5bc15c['attributes']:_0xb51e18[_0xedd2('0x2e')];if(_0x4f8f08[_0xedd2('0x2f')]['includeAll']){_0x5bc15c[_0xedd2('0x40')]=[{'all':!![]}];}_0x5bc15c=_[_0xedd2('0x3c')]({},_0x5bc15c,_0x4f8f08[_0xedd2('0x3f')]);return db[_0xedd2('0x2a')][_0xedd2('0x45')](_0x5bc15c)[_0xedd2('0x24')](handleEntityNotFound(_0x120e5e,null))[_0xedd2('0x24')](respondWithResult(_0x120e5e,null))['catch'](handleError(_0x120e5e,null));};exports[_0xedd2('0x46')]=function(_0x4ac1ef,_0x21571f){return db[_0xedd2('0x2a')][_0xedd2('0x46')](_0x4ac1ef[_0xedd2('0x47')],{})[_0xedd2('0x24')](respondWithResult(_0x21571f,0xc9))['catch'](handleError(_0x21571f,null));};exports[_0xedd2('0x23')]=function(_0x6faaf8,_0x566600){if(_0x6faaf8[_0xedd2('0x47')]['id']){delete _0x6faaf8[_0xedd2('0x47')]['id'];}return db[_0xedd2('0x2a')][_0xedd2('0x45')]({'where':{'id':_0x6faaf8[_0xedd2('0x48')]['id']}})[_0xedd2('0x24')](handleEntityNotFound(_0x566600,null))[_0xedd2('0x24')](saveUpdates(_0x6faaf8[_0xedd2('0x47')],null))['then'](respondWithResult(_0x566600,null))[_0xedd2('0x42')](handleError(_0x566600,null));};exports[_0xedd2('0x25')]=function(_0x4eecd6,_0x2b1c20){return db[_0xedd2('0x2a')]['find']({'where':{'id':_0x4eecd6['params']['id']}})['then'](handleEntityNotFound(_0x2b1c20,null))['then'](removeEntity(_0x2b1c20,null))['catch'](handleError(_0x2b1c20,null));};exports['describe']=function(_0x415f17,_0x17c03d){return db['SmsQueueReport'][_0xedd2('0x49')]()[_0xedd2('0x24')](respondWithResult(_0x17c03d,null))[_0xedd2('0x42')](handleError(_0x17c03d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9b52d05..28e52e2 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x347884,_0xd8ef37){var _0x2cd3fa=function(_0xbeb1b8){while(--_0xbeb1b8){_0x347884['push'](_0x347884['shift']());}};_0x2cd3fa(++_0xd8ef37);}(_0xe706,0xa3));var _0x6e70=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0xe706[_0x5a187b];return _0x14d601;};'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 4bd0b4d..fbedaf1 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 _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 +var _0x9dc6=['body','options','raw','catch','UpdateSmsQueueReport','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x3e81fa,_0x14a31a){var _0x23c012=function(_0x2a4dac){while(--_0x2a4dac){_0x3e81fa['push'](_0x3e81fa['shift']());}};_0x23c012(++_0x14a31a);}(_0x9dc6,0xc6));var _0x69dc=function(_0x103af6,_0x478b29){_0x103af6=_0x103af6-0x0;var _0x1fcf40=_0x9dc6[_0x103af6];return _0x1fcf40;};'use strict';var _=require(_0x69dc('0x0'));var util=require(_0x69dc('0x1'));var moment=require(_0x69dc('0x2'));var BPromise=require(_0x69dc('0x3'));var rs=require(_0x69dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69dc('0x5'))['db'];var utils=require(_0x69dc('0x6'));var logger=require(_0x69dc('0x7'))(_0x69dc('0x8'));var config=require(_0x69dc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x69dc('0xa')][_0x69dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2965e1,_0x1de0cd,_0x43238f){return new BPromise(function(_0x17d181,_0x1aa0e7){return client['request'](_0x2965e1,_0x43238f)[_0x69dc('0xc')](function(_0x27e7bf){logger[_0x69dc('0xd')](_0x69dc('0xe'),_0x1de0cd,_0x69dc('0xf'));logger[_0x69dc('0x10')](_0x69dc('0x11'),_0x1de0cd,_0x69dc('0xf'),JSON[_0x69dc('0x12')](_0x27e7bf));if(_0x27e7bf[_0x69dc('0x13')]){if(_0x27e7bf[_0x69dc('0x13')][_0x69dc('0x14')]===0x1f4){logger[_0x69dc('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x1de0cd,_0x27e7bf[_0x69dc('0x13')][_0x69dc('0x15')]);return _0x1aa0e7(_0x27e7bf[_0x69dc('0x13')]['message']);}logger[_0x69dc('0x13')](_0x69dc('0xe'),_0x1de0cd,_0x27e7bf['error'][_0x69dc('0x15')]);return _0x17d181(_0x27e7bf['error'][_0x69dc('0x15')]);}else{logger[_0x69dc('0xd')](_0x69dc('0xe'),_0x1de0cd,_0x69dc('0xf'));_0x17d181(_0x27e7bf[_0x69dc('0x16')][_0x69dc('0x15')]);}})['catch'](function(_0x3574f9){logger[_0x69dc('0x13')](_0x69dc('0xe'),_0x1de0cd,_0x3574f9);_0x1aa0e7(_0x3574f9);});});}exports[_0x69dc('0x17')]=function(_0x14793a){var _0x3a0f18=this;return new Promise(function(_0x2b6218,_0x57a1c4){return db[_0x69dc('0x18')][_0x69dc('0x19')](_0x14793a[_0x69dc('0x1a')],{'raw':_0x14793a['options']?_0x14793a[_0x69dc('0x1b')][_0x69dc('0x1c')]===undefined?!![]:![]:!![]})[_0x69dc('0xc')](function(_0xc46c4){logger[_0x69dc('0xd')](_0x69dc('0x17'),_0x14793a);logger[_0x69dc('0x10')](_0x69dc('0x17'),_0x14793a,JSON['stringify'](_0xc46c4));_0x2b6218(_0xc46c4);})[_0x69dc('0x1d')](function(_0x7b5a98){logger[_0x69dc('0x13')]('CreateSmsQueueReport',_0x7b5a98['message'],_0x14793a);_0x57a1c4(_0x3a0f18[_0x69dc('0x13')](0x1f4,_0x7b5a98['message']));});});};exports[_0x69dc('0x1e')]=function(_0x46754b){var _0x5e97e2=this;return new Promise(function(_0xc68ce3,_0x139e9e){return db[_0x69dc('0x18')]['update'](_0x46754b[_0x69dc('0x1a')],{'raw':_0x46754b['options']?_0x46754b[_0x69dc('0x1b')][_0x69dc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46754b['options']?_0x46754b[_0x69dc('0x1b')][_0x69dc('0x1f')]||null:null,'attributes':_0x46754b[_0x69dc('0x1b')]?_0x46754b[_0x69dc('0x1b')]['attributes']||null:null,'limit':_0x46754b[_0x69dc('0x1b')]?_0x46754b[_0x69dc('0x1b')]['limit']||null:null})[_0x69dc('0xc')](function(_0x2d3b7d){logger['info'](_0x69dc('0x1e'),_0x46754b);logger['debug'](_0x69dc('0x1e'),_0x46754b,JSON[_0x69dc('0x12')](_0x2d3b7d));_0xc68ce3(_0x2d3b7d);})[_0x69dc('0x1d')](function(_0x18a07f){logger[_0x69dc('0x13')]('UpdateSmsQueueReport',_0x18a07f[_0x69dc('0x15')],_0x46754b);_0x139e9e(_0x5e97e2[_0x69dc('0x13')](0x1f4,_0x18a07f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 624d51c..a887fec 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 _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 +var _0xa9b1=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a9b('0x0'));var timeout=require(_0x1a9b('0x1'));var express=require(_0x1a9b('0x2'));var router=express[_0x1a9b('0x3')]();var fs_extra=require(_0x1a9b('0x4'));var auth=require(_0x1a9b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x1a9b('0x6')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0x8')]);router[_0x1a9b('0x6')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xa')]);router[_0x1a9b('0x6')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xc')]);router[_0x1a9b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a9b('0xe')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller['update']);router['delete']('/:id',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xf')]);module[_0x1a9b('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 89c7e28..a779f6b 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 _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 +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x18d1c3,_0x62846b){var _0x2c00cb=function(_0x1e3b23){while(--_0x1e3b23){_0x18d1c3['push'](_0x18d1c3['shift']());}};_0x2c00cb(++_0x62846b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x4b84[_0x52f159];return _0x156799;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 77b3718..1772acb 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 _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 +var _0xc639=['rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x1bc4d3,_0x9bb12f){var _0x506aa1=function(_0x55d3ca){while(--_0x55d3ca){_0x1bc4d3['push'](_0x1bc4d3['shift']());}};_0x506aa1(++_0x9bb12f);}(_0xc639,0x1ad));var _0x9c63=function(_0x264afb,_0x5bb0e4){_0x264afb=_0x264afb-0x0;var _0x5606bd=_0xc639[_0x264afb];return _0x5606bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c63('0x0'));var zipdir=require(_0x9c63('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c63('0x2'));var moment=require(_0x9c63('0x3'));var BPromise=require(_0x9c63('0x4'));var Mustache=require(_0x9c63('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9c63('0x6'));var csv=require(_0x9c63('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c63('0x8'));var _=require('lodash');var squel=require(_0x9c63('0x9'));var crypto=require(_0x9c63('0xa'));var jsforce=require(_0x9c63('0xb'));var deskjs=require(_0x9c63('0xc'));var toCsv=require(_0x9c63('0x7'));var querystring=require('querystring');var Papa=require(_0x9c63('0xd'));var Redis=require('ioredis');var authService=require(_0x9c63('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9c63('0xf'));var hardwareService=require(_0x9c63('0x10'));var logger=require(_0x9c63('0x11'))('api');var utils=require(_0x9c63('0x12'));var config=require(_0x9c63('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c63('0x14'))['db'];function respondWithStatusCode(_0x26534b,_0x59b45b){_0x59b45b=_0x59b45b||0xcc;return function(_0x1a91fd){if(_0x1a91fd){return _0x26534b['sendStatus'](_0x59b45b);}return _0x26534b['status'](_0x59b45b)[_0x9c63('0x15')]();};}function respondWithResult(_0xe92fe7,_0x2f08aa){_0x2f08aa=_0x2f08aa||0xc8;return function(_0x376126){if(_0x376126){return _0xe92fe7[_0x9c63('0x16')](_0x2f08aa)[_0x9c63('0x17')](_0x376126);}};}function respondWithFilteredResult(_0x4d1d7a,_0x22c6f6){return function(_0x187209){if(_0x187209){var _0x363e4a=typeof _0x22c6f6[_0x9c63('0x18')]==='undefined'&&typeof _0x22c6f6[_0x9c63('0x19')]===_0x9c63('0x1a');var _0x47188d=_0x187209[_0x9c63('0x1b')];var _0x3e78a0=_0x363e4a?0x0:_0x22c6f6[_0x9c63('0x18')];var _0x49c0a5=_0x363e4a?_0x187209[_0x9c63('0x1b')]:_0x22c6f6['offset']+_0x22c6f6[_0x9c63('0x19')];var _0x4db131;if(_0x49c0a5>=_0x47188d){_0x49c0a5=_0x47188d;_0x4db131=0xc8;}else{_0x4db131=0xce;}_0x4d1d7a[_0x9c63('0x16')](_0x4db131);return _0x4d1d7a[_0x9c63('0x1c')](_0x9c63('0x1d'),_0x3e78a0+'-'+_0x49c0a5+'/'+_0x47188d)[_0x9c63('0x17')](_0x187209);}return null;};}function patchUpdates(_0x402926){return function(_0x324f33){try{jsonpatch[_0x9c63('0x1e')](_0x324f33,_0x402926,!![]);}catch(_0x128434){return BPromise[_0x9c63('0x1f')](_0x128434);}return _0x324f33['save']();};}function saveUpdates(_0x4ab25e,_0x17e275){return function(_0x59fd8d){if(_0x59fd8d){return _0x59fd8d[_0x9c63('0x20')](_0x4ab25e)[_0x9c63('0x21')](function(_0x23de97){return _0x23de97;});}return null;};}function removeEntity(_0x5d21cf,_0x493931){return function(_0x4a74b5){if(_0x4a74b5){return _0x4a74b5[_0x9c63('0x22')]()[_0x9c63('0x21')](function(){_0x5d21cf[_0x9c63('0x16')](0xcc)[_0x9c63('0x15')]();});}};}function handleEntityNotFound(_0x1d7212,_0x5ebe03){return function(_0x56dfc0){if(!_0x56dfc0){_0x1d7212[_0x9c63('0x23')](0x194);}return _0x56dfc0;};}function handleError(_0x38a6e3,_0x28abcf){_0x28abcf=_0x28abcf||0x1f4;return function(_0x17c64a){logger['error'](_0x17c64a['stack']);if(_0x17c64a[_0x9c63('0x24')]){delete _0x17c64a[_0x9c63('0x24')];}_0x38a6e3[_0x9c63('0x16')](_0x28abcf)[_0x9c63('0x25')](_0x17c64a);};}exports[_0x9c63('0x26')]=function(_0x12a2cd,_0x51720b){var _0x4d78b1={},_0x48b2c0={},_0x203fcf={'count':0x0,'rows':[]};var _0x28f790=_[_0x9c63('0x27')](db[_0x9c63('0x28')][_0x9c63('0x29')],function(_0x3e8ece){return{'name':_0x3e8ece['fieldName'],'type':_0x3e8ece[_0x9c63('0x2a')][_0x9c63('0x2b')]};});_0x48b2c0[_0x9c63('0x2c')]=_[_0x9c63('0x27')](_0x28f790,_0x9c63('0x24'));_0x48b2c0['query']=_['keys'](_0x12a2cd[_0x9c63('0x2d')]);_0x48b2c0[_0x9c63('0x2e')]=_[_0x9c63('0x2f')](_0x48b2c0[_0x9c63('0x2c')],_0x48b2c0[_0x9c63('0x2d')]);_0x4d78b1[_0x9c63('0x30')]=_[_0x9c63('0x2f')](_0x48b2c0[_0x9c63('0x2c')],qs[_0x9c63('0x31')](_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x31')]));_0x4d78b1[_0x9c63('0x30')]=_0x4d78b1[_0x9c63('0x30')][_0x9c63('0x32')]?_0x4d78b1[_0x9c63('0x30')]:_0x48b2c0[_0x9c63('0x2c')];if(!_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x33')]('nolimit')){_0x4d78b1[_0x9c63('0x19')]=qs[_0x9c63('0x19')](_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x19')]);_0x4d78b1[_0x9c63('0x18')]=qs[_0x9c63('0x18')](_0x12a2cd[_0x9c63('0x2d')]['offset']);}_0x4d78b1[_0x9c63('0x34')]=qs['sort'](_0x12a2cd[_0x9c63('0x2d')]['sort']);_0x4d78b1[_0x9c63('0x35')]=qs[_0x9c63('0x2e')](_[_0x9c63('0x36')](_0x12a2cd['query'],_0x48b2c0['filters']),_0x28f790);if(_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x37')]){_0x4d78b1['where']=_[_0x9c63('0x38')](_0x4d78b1[_0x9c63('0x35')],{'$or':_[_0x9c63('0x27')](_0x28f790,function(_0x45ddfc){if(_0x45ddfc[_0x9c63('0x2a')]!=='VIRTUAL'){var _0x3f3eb6={};_0x3f3eb6[_0x45ddfc[_0x9c63('0x24')]]={'$like':'%'+_0x12a2cd['query'][_0x9c63('0x37')]+'%'};return _0x3f3eb6;}})});}_0x4d78b1=_['merge']({},_0x4d78b1,_0x12a2cd[_0x9c63('0x39')]);var _0x145253={'where':_0x4d78b1['where']};return db[_0x9c63('0x28')][_0x9c63('0x1b')](_0x145253)[_0x9c63('0x21')](function(_0x1886d7){_0x203fcf[_0x9c63('0x1b')]=_0x1886d7;if(_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x3a')]){_0x4d78b1[_0x9c63('0x3b')]=[{'all':!![]}];}return db[_0x9c63('0x28')][_0x9c63('0x3c')](_0x4d78b1);})[_0x9c63('0x21')](function(_0x1ee41d){_0x203fcf[_0x9c63('0x3d')]=_0x1ee41d;return _0x203fcf;})[_0x9c63('0x21')](respondWithFilteredResult(_0x51720b,_0x4d78b1))[_0x9c63('0x3e')](handleError(_0x51720b,null));};exports[_0x9c63('0x3f')]=function(_0xf121f1,_0x1ac270){var _0x1ea30a={'raw':!![],'where':{'id':_0xf121f1[_0x9c63('0x40')]['id']}},_0x1deec2={};_0x1deec2[_0x9c63('0x2c')]=_['keys'](db[_0x9c63('0x28')][_0x9c63('0x29')]);_0x1deec2['query']=_[_0x9c63('0x41')](_0xf121f1[_0x9c63('0x2d')]);_0x1deec2[_0x9c63('0x2e')]=_['intersection'](_0x1deec2[_0x9c63('0x2c')],_0x1deec2[_0x9c63('0x2d')]);_0x1ea30a[_0x9c63('0x30')]=_['intersection'](_0x1deec2['model'],qs[_0x9c63('0x31')](_0xf121f1[_0x9c63('0x2d')][_0x9c63('0x31')]));_0x1ea30a[_0x9c63('0x30')]=_0x1ea30a['attributes'][_0x9c63('0x32')]?_0x1ea30a['attributes']:_0x1deec2['model'];if(_0xf121f1[_0x9c63('0x2d')][_0x9c63('0x3a')]){_0x1ea30a[_0x9c63('0x3b')]=[{'all':!![]}];}_0x1ea30a=_[_0x9c63('0x38')]({},_0x1ea30a,_0xf121f1[_0x9c63('0x39')]);return db[_0x9c63('0x28')][_0x9c63('0x42')](_0x1ea30a)[_0x9c63('0x21')](handleEntityNotFound(_0x1ac270,null))['then'](respondWithResult(_0x1ac270,null))['catch'](handleError(_0x1ac270,null));};exports[_0x9c63('0x43')]=function(_0x175c59,_0x358a46){return db['SmsTransferReport'][_0x9c63('0x43')](_0x175c59[_0x9c63('0x44')],{})[_0x9c63('0x21')](respondWithResult(_0x358a46,0xc9))['catch'](handleError(_0x358a46,null));};exports['update']=function(_0x2f8bd5,_0x211643){if(_0x2f8bd5['body']['id']){delete _0x2f8bd5['body']['id'];}return db['SmsTransferReport'][_0x9c63('0x42')]({'where':{'id':_0x2f8bd5[_0x9c63('0x40')]['id']}})[_0x9c63('0x21')](handleEntityNotFound(_0x211643,null))['then'](saveUpdates(_0x2f8bd5[_0x9c63('0x44')],null))[_0x9c63('0x21')](respondWithResult(_0x211643,null))['catch'](handleError(_0x211643,null));};exports['destroy']=function(_0x2aad80,_0x436efa){return db[_0x9c63('0x28')]['find']({'where':{'id':_0x2aad80[_0x9c63('0x40')]['id']}})[_0x9c63('0x21')](handleEntityNotFound(_0x436efa,null))['then'](removeEntity(_0x436efa,null))[_0x9c63('0x3e')](handleError(_0x436efa,null));};exports[_0x9c63('0x45')]=function(_0x108f09,_0x3d2cd7){return db[_0x9c63('0x28')]['describe']()['then'](respondWithResult(_0x3d2cd7,null))[_0x9c63('0x3e')](handleError(_0x3d2cd7,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 7c086d2..70b9ac5 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 _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 +var _0x90c8=['moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5d7cf7,_0x783d86){var _0x48ffe2=function(_0x40274e){while(--_0x40274e){_0x5d7cf7['push'](_0x5d7cf7['shift']());}};_0x48ffe2(++_0x783d86);}(_0x90c8,0x1eb));var _0x890c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x90c8[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x890c('0x0'));var util=require(_0x890c('0x1'));var logger=require(_0x890c('0x2'))(_0x890c('0x3'));var moment=require(_0x890c('0x4'));var BPromise=require(_0x890c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x890c('0x6'));var rimraf=require(_0x890c('0x7'));var config=require(_0x890c('0x8'));var attributes=require(_0x890c('0x9'));module[_0x890c('0xa')]=function(_0x1b1b10,_0x1adc15){return _0x1b1b10[_0x890c('0xb')](_0x890c('0xc'),attributes,{'tableName':_0x890c('0xd'),'paranoid':![],'indexes':[{'name':_0x890c('0xe'),'fields':[_0x890c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 6d0cbe4..d04c044 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 _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 +var _0xe35c=['request','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe35c,0x146));var _0xce35=function(_0x1b3254,_0x310a7f){_0x1b3254=_0x1b3254-0x0;var _0x388744=_0xe35c[_0x1b3254];return _0x388744;};'use strict';var _=require(_0xce35('0x0'));var util=require(_0xce35('0x1'));var moment=require(_0xce35('0x2'));var BPromise=require(_0xce35('0x3'));var rs=require(_0xce35('0x4'));var fs=require('fs');var Redis=require(_0xce35('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce35('0x6'))('rpc');var config=require(_0xce35('0x7'));var jayson=require(_0xce35('0x8'));var client=jayson[_0xce35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270b81,_0x2df0d0,_0x2b4a82){return new BPromise(function(_0x74ae5e,_0x55e7f0){return client[_0xce35('0xa')](_0x270b81,_0x2b4a82)['then'](function(_0x549f60){logger[_0xce35('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x2df0d0,'request\x20sent');logger[_0xce35('0xc')](_0xce35('0xd'),_0x2df0d0,_0xce35('0xe'),JSON[_0xce35('0xf')](_0x549f60));if(_0x549f60[_0xce35('0x10')]){if(_0x549f60['error']['code']===0x1f4){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);return _0x55e7f0(_0x549f60[_0xce35('0x10')]['message']);}logger['error'](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')]['message']);return _0x74ae5e(_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);}else{logger[_0xce35('0xb')](_0xce35('0x11'),_0x2df0d0,_0xce35('0xe'));_0x74ae5e(_0x549f60[_0xce35('0x13')][_0xce35('0x12')]);}})[_0xce35('0x14')](function(_0x4388fd){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x4388fd);_0x55e7f0(_0x4388fd);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 7490baa..359d172 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 _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 +var _0x3aba=['isAuthenticated','index','/:id','show','download','join','server/files/sounds/original/','originalname','basename','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x3aba,0x82));var _0xa3ab=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x3aba[_0x7a3247];return _0x1bfde5;};'use strict';var multer=require(_0xa3ab('0x0'));var util=require(_0xa3ab('0x1'));var path=require(_0xa3ab('0x2'));var timeout=require(_0xa3ab('0x3'));var express=require(_0xa3ab('0x4'));var router=express['Router']();var fs_extra=require(_0xa3ab('0x5'));var auth=require(_0xa3ab('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa3ab('0x7'));var controller=require(_0xa3ab('0x8'));router[_0xa3ab('0x9')]('/',auth[_0xa3ab('0xa')](),controller[_0xa3ab('0xb')]);router[_0xa3ab('0x9')](_0xa3ab('0xc'),auth[_0xa3ab('0xa')](),controller[_0xa3ab('0xd')]);router[_0xa3ab('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xa3ab('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x414046,_0x176b65,_0x48c1ee){_0x48c1ee(null,path[_0xa3ab('0xf')](config['root'],_0xa3ab('0x10')));},'filename':function(_0x23c035,_0x110b9e,_0x124c51){_0x110b9e[_0xa3ab('0x11')]=_0x110b9e[_0xa3ab('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x124c51(null,util['format']('%s-%s%s',path[_0xa3ab('0x12')](_0x110b9e[_0xa3ab('0x11')],path['extname'](_0x110b9e['originalname'])),Date[_0xa3ab('0x13')](),path['extname'](_0x110b9e[_0xa3ab('0x11')])));}})});router[_0xa3ab('0x14')]('/',upload[_0xa3ab('0x15')](_0xa3ab('0x16')),controller[_0xa3ab('0x17')]);router[_0xa3ab('0x18')]('/:id',auth[_0xa3ab('0xa')](),controller[_0xa3ab('0x19')]);router[_0xa3ab('0x1a')](_0xa3ab('0xc'),auth[_0xa3ab('0xa')](),controller[_0xa3ab('0x1a')]);module[_0xa3ab('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 593bcf6..0da8b44 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 _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 +var _0xc7e9=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x58707c,_0x329446){var _0x4765dc=function(_0x4fa42e){while(--_0x4fa42e){_0x58707c['push'](_0x58707c['shift']());}};_0x4765dc(++_0x329446);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc7e9[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0x9c7e('0x0'));module[_0x9c7e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c7e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9c7e('0x3')]},'display_name':{'type':Sequelize[_0x9c7e('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x9c7e('0x3')]},'original_duration':{'type':Sequelize[_0x9c7e('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x9c7e('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x9c7e('0x3')]},'converted_duration':{'type':Sequelize[_0x9c7e('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x9c7e('0x5')]},'converted_channelCount':{'type':Sequelize[_0x9c7e('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x9c7e('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index aebb8e6..76f379d 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 _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 +var _0xc353=['root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','join','format','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','start','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get','Sounds','UserProfileResource','error','name','send','map','Sound','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','length','find','download','converted_format','existsSync'];(function(_0x3eb28d,_0x2fb93e){var _0x44a424=function(_0x935b10){while(--_0x935b10){_0x3eb28d['push'](_0x3eb28d['shift']());}};_0x44a424(++_0x2fb93e);}(_0xc353,0x134));var _0x3c35=function(_0x5ac707,_0x106792){_0x5ac707=_0x5ac707-0x0;var _0x11451b=_0xc353[_0x5ac707];return _0x11451b;};'use strict';var emlformat=require(_0x3c35('0x0'));var rimraf=require(_0x3c35('0x1'));var zipdir=require(_0x3c35('0x2'));var jsonpatch=require(_0x3c35('0x3'));var rp=require(_0x3c35('0x4'));var moment=require(_0x3c35('0x5'));var BPromise=require(_0x3c35('0x6'));var Mustache=require(_0x3c35('0x7'));var util=require(_0x3c35('0x8'));var path=require(_0x3c35('0x9'));var sox=require(_0x3c35('0xa'));var csv=require('to-csv');var ejs=require(_0x3c35('0xb'));var fs=require('fs');var fs_extra=require(_0x3c35('0xc'));var _=require(_0x3c35('0xd'));var squel=require(_0x3c35('0xe'));var crypto=require(_0x3c35('0xf'));var jsforce=require(_0x3c35('0x10'));var deskjs=require(_0x3c35('0x11'));var toCsv=require(_0x3c35('0x12'));var querystring=require(_0x3c35('0x13'));var Papa=require(_0x3c35('0x14'));var Redis=require(_0x3c35('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x3c35('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c35('0x17'));var logger=require(_0x3c35('0x18'))(_0x3c35('0x19'));var utils=require(_0x3c35('0x1a'));var config=require(_0x3c35('0x1b'));var licenseUtil=require(_0x3c35('0x1c'));var db=require(_0x3c35('0x1d'))['db'];function respondWithStatusCode(_0x5ad412,_0x5d4d01){_0x5d4d01=_0x5d4d01||0xcc;return function(_0x544814){if(_0x544814){return _0x5ad412[_0x3c35('0x1e')](_0x5d4d01);}return _0x5ad412[_0x3c35('0x1f')](_0x5d4d01)[_0x3c35('0x20')]();};}function respondWithResult(_0x2c8407,_0x1d5497){_0x1d5497=_0x1d5497||0xc8;return function(_0xd11e56){if(_0xd11e56){return _0x2c8407[_0x3c35('0x1f')](_0x1d5497)[_0x3c35('0x21')](_0xd11e56);}};}function respondWithFilteredResult(_0x179950,_0x503946){return function(_0x1b25c2){if(_0x1b25c2){var _0x1eb897=typeof _0x503946[_0x3c35('0x22')]===_0x3c35('0x23')&&typeof _0x503946['limit']===_0x3c35('0x23');var _0x46cbc4=_0x1b25c2[_0x3c35('0x24')];var _0x8d708=_0x1eb897?0x0:_0x503946['offset'];var _0x30d9f8=_0x1eb897?_0x1b25c2[_0x3c35('0x24')]:_0x503946['offset']+_0x503946['limit'];var _0x2cffaf;if(_0x30d9f8>=_0x46cbc4){_0x30d9f8=_0x46cbc4;_0x2cffaf=0xc8;}else{_0x2cffaf=0xce;}_0x179950[_0x3c35('0x1f')](_0x2cffaf);return _0x179950[_0x3c35('0x25')](_0x3c35('0x26'),_0x8d708+'-'+_0x30d9f8+'/'+_0x46cbc4)[_0x3c35('0x21')](_0x1b25c2);}return null;};}function patchUpdates(_0x561b38){return function(_0x275b8e){try{jsonpatch[_0x3c35('0x27')](_0x275b8e,_0x561b38,!![]);}catch(_0x420f63){return BPromise[_0x3c35('0x28')](_0x420f63);}return _0x275b8e['save']();};}function saveUpdates(_0x3ce200,_0x36aac0){return function(_0x443346){if(_0x443346){return _0x443346[_0x3c35('0x29')](_0x3ce200)['then'](function(_0x1b1f6c){return _0x1b1f6c;});}return null;};}function removeEntity(_0x9e45ae,_0x1867c9){return function(_0x44a4fc){if(_0x44a4fc){return _0x44a4fc[_0x3c35('0x2a')]()[_0x3c35('0x2b')](function(){var _0x1253df=_0x44a4fc[_0x3c35('0x2c')]({'plain':!![]});var _0x1a0167=_0x3c35('0x2d');return db[_0x3c35('0x2e')][_0x3c35('0x2a')]({'where':{'type':_0x1a0167,'resourceId':_0x1253df['id']}})[_0x3c35('0x2b')](function(){return _0x44a4fc;});})[_0x3c35('0x2b')](function(){_0x9e45ae['status'](0xcc)[_0x3c35('0x20')]();});}};}function handleEntityNotFound(_0x28c091,_0x4c1b43){return function(_0x13631b){if(!_0x13631b){_0x28c091[_0x3c35('0x1e')](0x194);}return _0x13631b;};}function handleError(_0x5e3032,_0x91fe98){_0x91fe98=_0x91fe98||0x1f4;return function(_0x46a92d){logger[_0x3c35('0x2f')](_0x46a92d['stack']);if(_0x46a92d[_0x3c35('0x30')]){delete _0x46a92d[_0x3c35('0x30')];}_0x5e3032[_0x3c35('0x1f')](_0x91fe98)[_0x3c35('0x31')](_0x46a92d);};}exports['index']=function(_0x546133,_0x5f434e){var _0x20c65c={},_0x29c81e={},_0x4b73f3={'count':0x0,'rows':[]};var _0x3ddbbf=_[_0x3c35('0x32')](db[_0x3c35('0x33')][_0x3c35('0x34')],function(_0x345baa){return{'name':_0x345baa[_0x3c35('0x35')],'type':_0x345baa[_0x3c35('0x36')][_0x3c35('0x37')]};});_0x29c81e[_0x3c35('0x38')]=_[_0x3c35('0x32')](_0x3ddbbf,_0x3c35('0x30'));_0x29c81e['query']=_[_0x3c35('0x39')](_0x546133[_0x3c35('0x3a')]);_0x29c81e['filters']=_[_0x3c35('0x3b')](_0x29c81e['model'],_0x29c81e[_0x3c35('0x3a')]);_0x20c65c['attributes']=_['intersection'](_0x29c81e['model'],qs[_0x3c35('0x3c')](_0x546133[_0x3c35('0x3a')][_0x3c35('0x3c')]));_0x20c65c[_0x3c35('0x3d')]=_0x20c65c['attributes']['length']?_0x20c65c[_0x3c35('0x3d')]:_0x29c81e[_0x3c35('0x38')];if(!_0x546133[_0x3c35('0x3a')][_0x3c35('0x3e')](_0x3c35('0x3f'))){_0x20c65c[_0x3c35('0x40')]=qs[_0x3c35('0x40')](_0x546133[_0x3c35('0x3a')][_0x3c35('0x40')]);_0x20c65c[_0x3c35('0x22')]=qs['offset'](_0x546133[_0x3c35('0x3a')][_0x3c35('0x22')]);}_0x20c65c[_0x3c35('0x41')]=qs[_0x3c35('0x42')](_0x546133[_0x3c35('0x3a')][_0x3c35('0x42')]);_0x20c65c[_0x3c35('0x43')]=qs['filters'](_[_0x3c35('0x44')](_0x546133[_0x3c35('0x3a')],_0x29c81e['filters']),_0x3ddbbf);if(_0x546133[_0x3c35('0x3a')][_0x3c35('0x45')]){_0x20c65c[_0x3c35('0x43')]=_[_0x3c35('0x46')](_0x20c65c[_0x3c35('0x43')],{'$or':_[_0x3c35('0x32')](_0x3ddbbf,function(_0xe5e8e7){if(_0xe5e8e7['type']!=='VIRTUAL'){var _0x59d2e7={};_0x59d2e7[_0xe5e8e7[_0x3c35('0x30')]]={'$like':'%'+_0x546133[_0x3c35('0x3a')]['filter']+'%'};return _0x59d2e7;}})});}_0x20c65c=_[_0x3c35('0x46')]({},_0x20c65c,_0x546133['options']);var _0x540696={'where':_0x20c65c[_0x3c35('0x43')]};return db['Sound']['count'](_0x540696)['then'](function(_0x323384){_0x4b73f3[_0x3c35('0x24')]=_0x323384;if(_0x546133[_0x3c35('0x3a')][_0x3c35('0x47')]){_0x20c65c[_0x3c35('0x48')]=[{'all':!![]}];}return db['Sound'][_0x3c35('0x49')](_0x20c65c);})[_0x3c35('0x2b')](function(_0x29f6fb){_0x4b73f3['rows']=_0x29f6fb;return _0x4b73f3;})['then'](respondWithFilteredResult(_0x5f434e,_0x20c65c))[_0x3c35('0x4a')](handleError(_0x5f434e,null));};exports[_0x3c35('0x4b')]=function(_0x2177f7,_0x4dfb19){var _0x5e6f09={'raw':!![],'where':{'id':_0x2177f7[_0x3c35('0x4c')]['id']}},_0x1106eb={};_0x1106eb[_0x3c35('0x38')]=_[_0x3c35('0x39')](db[_0x3c35('0x33')][_0x3c35('0x34')]);_0x1106eb[_0x3c35('0x3a')]=_[_0x3c35('0x39')](_0x2177f7['query']);_0x1106eb['filters']=_[_0x3c35('0x3b')](_0x1106eb[_0x3c35('0x38')],_0x1106eb[_0x3c35('0x3a')]);_0x5e6f09['attributes']=_[_0x3c35('0x3b')](_0x1106eb['model'],qs[_0x3c35('0x3c')](_0x2177f7['query'][_0x3c35('0x3c')]));_0x5e6f09['attributes']=_0x5e6f09[_0x3c35('0x3d')][_0x3c35('0x4d')]?_0x5e6f09[_0x3c35('0x3d')]:_0x1106eb[_0x3c35('0x38')];if(_0x2177f7['query'][_0x3c35('0x47')]){_0x5e6f09[_0x3c35('0x48')]=[{'all':!![]}];}_0x5e6f09=_[_0x3c35('0x46')]({},_0x5e6f09,_0x2177f7['options']);return db[_0x3c35('0x33')][_0x3c35('0x4e')](_0x5e6f09)[_0x3c35('0x2b')](handleEntityNotFound(_0x4dfb19,null))[_0x3c35('0x2b')](respondWithResult(_0x4dfb19,null))[_0x3c35('0x4a')](handleError(_0x4dfb19,null));};exports[_0x3c35('0x4f')]=function(_0x5445e0,_0x244176,_0x5b1469){return db[_0x3c35('0x33')][_0x3c35('0x4e')]({'where':{'id':_0x5445e0['params']['id']},'attributes':['name','save_name',_0x3c35('0x50')],'raw':!![]})[_0x3c35('0x2b')](handleEntityNotFound(_0x244176,null))[_0x3c35('0x2b')](function(_0x1770e0){if(_0x1770e0){if(!fs[_0x3c35('0x51')](path['join'](config[_0x3c35('0x52')],_0x3c35('0x53'),_0x1770e0[_0x3c35('0x54')]+'.'+_0x1770e0[_0x3c35('0x50')]))){throw new db[(_0x3c35('0x55'))][(_0x3c35('0x56'))](_0x3c35('0x57'));}return _0x244176[_0x3c35('0x4f')](path[_0x3c35('0x58')](config['root'],_0x3c35('0x53'),util['format']('%s.%s',_0x1770e0[_0x3c35('0x54')],_0x1770e0['converted_format'])),util[_0x3c35('0x59')]('%s.%s',_0x1770e0[_0x3c35('0x30')],_0x1770e0[_0x3c35('0x50')]));}return null;})[_0x3c35('0x4a')](handleError(_0x244176,null));};exports[_0x3c35('0x5a')]=function(_0x10bbdc,_0x56dcd4,_0x38835c){var _0x14ae5a={'name':path[_0x3c35('0x5b')](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5d')],path[_0x3c35('0x5e')](_0x10bbdc[_0x3c35('0x5c')]['originalname'])),'save_name':path[_0x3c35('0x5b')](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')],path['extname'](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')])),'original_format':path[_0x3c35('0x5e')](_0x10bbdc[_0x3c35('0x5c')]['originalname'])[_0x3c35('0x60')](0x1),'converted_format':'wav'};var _0x4230a7=path['join'](config[_0x3c35('0x52')],_0x3c35('0x61'),_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')]);var _0x5e14dc=path[_0x3c35('0x58')](config[_0x3c35('0x52')],_0x3c35('0x53'),util[_0x3c35('0x59')](_0x3c35('0x62'),path['basename'](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')],path[_0x3c35('0x5e')](_0x10bbdc[_0x3c35('0x5c')]['filename'])),_0x14ae5a['converted_format']));logger[_0x3c35('0x63')](_0x3c35('0x64'),_0x4230a7);logger[_0x3c35('0x63')](_0x3c35('0x65'),_0x5e14dc);try{fs[_0x3c35('0x66')](_0x4230a7,parseInt(_0x3c35('0x67'),0x8));var _0x26ddb3=sox['transcode'](_0x4230a7,_0x5e14dc,{'sampleRate':0x1f40,'format':_0x3c35('0x68'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x26ddb3['on']('error',function(_0x32c7eb){fs['unlinkSync'](_0x4230a7);_0x56dcd4[_0x3c35('0x1f')](0x1f4)[_0x3c35('0x31')](_0x32c7eb);});_0x26ddb3['on'](_0x3c35('0x69'),function(_0x3a8408){_0x14ae5a['original_duration']=isNaN(_0x3a8408[_0x3c35('0x6a')])?null:_0x3a8408[_0x3c35('0x6a')]*0x3e8;_0x14ae5a['original_sampleCount']=isNaN(_0x3a8408['sampleCount'])?null:_0x3a8408[_0x3c35('0x6b')];_0x14ae5a[_0x3c35('0x6c')]=isNaN(_0x3a8408[_0x3c35('0x6d')])?null:_0x3a8408['channelCount'];_0x14ae5a[_0x3c35('0x6e')]=isNaN(_0x3a8408[_0x3c35('0x6f')])?null:_0x3a8408[_0x3c35('0x6f')];_0x14ae5a['original_sampleRate']=isNaN(_0x3a8408[_0x3c35('0x70')])?null:_0x3a8408[_0x3c35('0x70')];});_0x26ddb3['on'](_0x3c35('0x71'),function(_0x8a107b){_0x14ae5a[_0x3c35('0x72')]=isNaN(_0x8a107b[_0x3c35('0x6a')])?null:_0x8a107b[_0x3c35('0x6a')]*0x3e8;_0x14ae5a[_0x3c35('0x73')]=isNaN(_0x8a107b[_0x3c35('0x6b')])?null:_0x8a107b[_0x3c35('0x6b')];_0x14ae5a[_0x3c35('0x74')]=isNaN(_0x8a107b['channelCount'])?null:_0x8a107b[_0x3c35('0x6d')];_0x14ae5a[_0x3c35('0x75')]=isNaN(_0x8a107b['bitRate'])?null:_0x8a107b['bitRate'];_0x14ae5a[_0x3c35('0x76')]=isNaN(_0x8a107b[_0x3c35('0x70')])?null:_0x8a107b[_0x3c35('0x70')];});_0x26ddb3['on']('end',function(){fs[_0x3c35('0x66')](_0x5e14dc,parseInt(_0x3c35('0x67'),0x8));return db[_0x3c35('0x33')][_0x3c35('0x5a')](_0x14ae5a)[_0x3c35('0x2b')](function(_0x5caadc){var _0x40b96a={'role':_0x10bbdc[_0x3c35('0x77')][_0x3c35('0x78')],'userProfileId':_0x10bbdc['body'][_0x3c35('0x79')]};if(!_0x40b96a)throw new Error(_0x3c35('0x7a'));if(_0x40b96a[_0x3c35('0x78')]===_0x3c35('0x7b')){var _0x538f1e=_0x5caadc[_0x3c35('0x2c')]({'plain':!![]});return db[_0x3c35('0x7c')][_0x3c35('0x4e')]({'where':{'name':_0x3c35('0x2d'),'userProfileId':_0x40b96a['userProfileId']},'raw':!![]})['then'](function(_0x30aa3d){if(_0x30aa3d&&_0x30aa3d['autoAssociation']===0x0){return db[_0x3c35('0x2e')][_0x3c35('0x5a')]({'name':_0x538f1e[_0x3c35('0x30')],'resourceId':_0x538f1e['id'],'type':_0x30aa3d[_0x3c35('0x30')],'sectionId':_0x30aa3d['id']},{})[_0x3c35('0x2b')](function(){return _0x5caadc;});}else{return _0x5caadc;}})[_0x3c35('0x4a')](function(_0x8f2797){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8f2797);throw _0x8f2797;});}return _0x5caadc;})[_0x3c35('0x2b')](respondWithResult(_0x56dcd4,null))['catch'](handleError(_0x56dcd4,null));});_0x26ddb3[_0x3c35('0x7d')]();}catch(_0x3e0d14){_0x56dcd4[_0x3c35('0x1f')](0x1f4)[_0x3c35('0x31')](_0x3e0d14);}};exports[_0x3c35('0x29')]=function(_0xdc2969,_0x23c74b,_0x2458fe){return db['Sound']['find']({'where':{'id':_0xdc2969[_0x3c35('0x4c')]['id']}})[_0x3c35('0x2b')](handleEntityNotFound(_0x23c74b,null))[_0x3c35('0x2b')](saveUpdates(_['pick'](_0xdc2969[_0x3c35('0x77')],['name',_0x3c35('0x7e')]),null))[_0x3c35('0x2b')](respondWithResult(_0x23c74b,null))['catch'](handleError(_0x23c74b,null));};exports[_0x3c35('0x7f')]=function(_0x15fd80,_0x4d4897,_0x5d1335){return db[_0x3c35('0x33')]['find']({'where':{'id':_0x15fd80['params']['id']}})[_0x3c35('0x2b')](function(_0x34119f){if(_0x34119f){return _0x34119f[_0x3c35('0x2a')]();}})['then'](function(_0x234605){var _0x35e9a6=path[_0x3c35('0x58')](config[_0x3c35('0x52')],_0x3c35('0x61'),util[_0x3c35('0x59')](_0x3c35('0x62'),_0x234605[_0x3c35('0x54')],_0x234605[_0x3c35('0x80')]));var _0xe24f5e=path[_0x3c35('0x58')](config['root'],_0x3c35('0x53'),util[_0x3c35('0x59')](_0x3c35('0x62'),_0x234605[_0x3c35('0x54')],_0x234605[_0x3c35('0x50')]));fs[_0x3c35('0x81')](_0x35e9a6);fs['unlinkSync'](_0xe24f5e);return _0x234605;})['then'](function(_0x40a7bb){if(_0x40a7bb){return _0x4d4897[_0x3c35('0x1f')](0xcc)[_0x3c35('0x20')]();}})[_0x3c35('0x2b')](handleEntityNotFound(_0x4d4897,null))['catch'](handleError(_0x4d4897,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f145509..1a4dedf 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 _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 +var _0x50bd=['exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./sound.attributes'];(function(_0x48ad11,_0x52a7f1){var _0x5a0be9=function(_0x3aca25){while(--_0x3aca25){_0x48ad11['push'](_0x48ad11['shift']());}};_0x5a0be9(++_0x52a7f1);}(_0x50bd,0xc3));var _0xd50b=function(_0x6f0435,_0x4fd891){_0x6f0435=_0x6f0435-0x0;var _0x254166=_0x50bd[_0x6f0435];return _0x254166;};'use strict';var _=require(_0xd50b('0x0'));var util=require(_0xd50b('0x1'));var logger=require(_0xd50b('0x2'))(_0xd50b('0x3'));var moment=require(_0xd50b('0x4'));var BPromise=require(_0xd50b('0x5'));var rp=require(_0xd50b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd50b('0x7'));var config=require('../../config/environment');var attributes=require(_0xd50b('0x8'));module[_0xd50b('0x9')]=function(_0x4e11b8,_0x15beaa){return _0x4e11b8[_0xd50b('0xa')]('Sound',attributes,{'tableName':_0xd50b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 8d6c43d..3e32aab 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 _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 +var _0x4e5d=['options','raw','where','include','model','attributes','map','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find'];(function(_0xf29ccb,_0x2e8ddf){var _0x36f405=function(_0x347229){while(--_0x347229){_0xf29ccb['push'](_0xf29ccb['shift']());}};_0x36f405(++_0x2e8ddf);}(_0x4e5d,0x19a));var _0xd4e5=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0x4e5d[_0x183256];return _0x5394a2;};'use strict';var _=require(_0xd4e5('0x0'));var util=require('util');var moment=require(_0xd4e5('0x1'));var BPromise=require(_0xd4e5('0x2'));var rs=require(_0xd4e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd4e5('0x5'));var jayson=require(_0xd4e5('0x6'));var client=jayson[_0xd4e5('0x7')][_0xd4e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a7b52,_0x5acd89,_0x13cb4e){return new BPromise(function(_0x34bbff,_0x51986e){return client[_0xd4e5('0x9')](_0x2a7b52,_0x13cb4e)[_0xd4e5('0xa')](function(_0x3df959){logger[_0xd4e5('0xb')]('Sound,\x20%s,\x20%s',_0x5acd89,'request\x20sent');logger[_0xd4e5('0xc')](_0xd4e5('0xd'),_0x5acd89,_0xd4e5('0xe'),JSON[_0xd4e5('0xf')](_0x3df959));if(_0x3df959[_0xd4e5('0x10')]){if(_0x3df959[_0xd4e5('0x10')]['code']===0x1f4){logger[_0xd4e5('0x10')](_0xd4e5('0x11'),_0x5acd89,_0x3df959['error'][_0xd4e5('0x12')]);return _0x51986e(_0x3df959['error'][_0xd4e5('0x12')]);}logger['error'](_0xd4e5('0x11'),_0x5acd89,_0x3df959[_0xd4e5('0x10')][_0xd4e5('0x12')]);return _0x34bbff(_0x3df959[_0xd4e5('0x10')][_0xd4e5('0x12')]);}else{logger[_0xd4e5('0xb')](_0xd4e5('0x11'),_0x5acd89,_0xd4e5('0xe'));_0x34bbff(_0x3df959[_0xd4e5('0x13')]['message']);}})[_0xd4e5('0x14')](function(_0x4f6601){logger[_0xd4e5('0x10')](_0xd4e5('0x11'),_0x5acd89,_0x4f6601);_0x51986e(_0x4f6601);});});}exports[_0xd4e5('0x15')]=function(_0x25f09a){var _0x201b9e=this;return new Promise(function(_0x390567,_0x2c8820){return db[_0xd4e5('0x16')][_0xd4e5('0x17')]({'raw':_0x25f09a[_0xd4e5('0x18')]?_0x25f09a[_0xd4e5('0x18')][_0xd4e5('0x19')]===undefined?!![]:![]:!![],'where':_0x25f09a[_0xd4e5('0x18')]?_0x25f09a['options'][_0xd4e5('0x1a')]||null:null,'attributes':_0x25f09a[_0xd4e5('0x18')]?_0x25f09a['options']['attributes']||null:null,'include':_0x25f09a['options']?_0x25f09a[_0xd4e5('0x18')][_0xd4e5('0x1b')]?_['map'](_0x25f09a['options'][_0xd4e5('0x1b')],function(_0x981ed9){return{'model':db[_0x981ed9[_0xd4e5('0x1c')]],'as':_0x981ed9['as'],'attributes':_0x981ed9[_0xd4e5('0x1d')],'include':_0x981ed9['include']?_[_0xd4e5('0x1e')](_0x981ed9[_0xd4e5('0x1b')],function(_0x5e466b){return{'model':db[_0x5e466b[_0xd4e5('0x1c')]],'as':_0x5e466b['as'],'attributes':_0x5e466b[_0xd4e5('0x1d')],'include':_0x5e466b[_0xd4e5('0x1b')]?_[_0xd4e5('0x1e')](_0x5e466b['include'],function(_0x5eccde){return{'model':db[_0x5eccde['model']],'as':_0x5eccde['as'],'attributes':_0x5eccde[_0xd4e5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3915){logger['info']('ShowSound',_0x25f09a);logger[_0xd4e5('0xc')](_0xd4e5('0x15'),_0x25f09a,JSON[_0xd4e5('0xf')](_0x1d3915));_0x390567(_0x1d3915);})[_0xd4e5('0x14')](function(_0x1b0e88){logger['error'](_0xd4e5('0x15'),_0x1b0e88[_0xd4e5('0x12')],_0x25f09a);_0x2c8820(_0x201b9e[_0xd4e5('0x10')](0x1f4,_0x1b0e88['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 2ef599a..d6ec586 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 _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 +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3beea0,_0x416691){var _0x314eb1=function(_0x937185){while(--_0x937185){_0x3beea0['push'](_0x3beea0['shift']());}};_0x314eb1(++_0x416691);}(_0x8603,0x190));var _0x3860=function(_0x4e0ab8,_0x401afb){_0x4e0ab8=_0x4e0ab8-0x0;var _0x4c1f40=_0x8603[_0x4e0ab8];return _0x4c1f40;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 148f2c4..f044632 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 _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 +var _0x8726=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x185781,_0x131f71){var _0x10f1ae=function(_0x45e7bd){while(--_0x45e7bd){_0x185781['push'](_0x185781['shift']());}};_0x10f1ae(++_0x131f71);}(_0x8726,0x10c));var _0x6872=function(_0x1691dc,_0x3ff728){_0x1691dc=_0x1691dc-0x0;var _0x4769de=_0x8726[_0x1691dc];return _0x4769de;};'use strict';var Sequelize=require(_0x6872('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6872('0x1')]},'body':{'type':Sequelize[_0x6872('0x2')](_0x6872('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6872('0x4')]('in',_0x6872('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x6872('0x1')]},'providerResponse':{'type':Sequelize[_0x6872('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 90432ed..f3faf8d 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 _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 +var _0xaaee=['fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','intersection','catch','create','body','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','SquareMessage','rawAttributes','type','key','keys','query','filters','attributes','model'];(function(_0x4654a4,_0x101d85){var _0x535f45=function(_0x1d3a3c){while(--_0x1d3a3c){_0x4654a4['push'](_0x4654a4['shift']());}};_0x535f45(++_0x101d85);}(_0xaaee,0xa9));var _0xeaae=function(_0x4f0ee6,_0x15d9b4){_0x4f0ee6=_0x4f0ee6-0x0;var _0x146ee5=_0xaaee[_0x4f0ee6];return _0x146ee5;};'use strict';var emlformat=require(_0xeaae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeaae('0x1'));var jsonpatch=require(_0xeaae('0x2'));var rp=require('request-promise');var moment=require(_0xeaae('0x3'));var BPromise=require(_0xeaae('0x4'));var Mustache=require(_0xeaae('0x5'));var util=require(_0xeaae('0x6'));var path=require('path');var sox=require(_0xeaae('0x7'));var csv=require(_0xeaae('0x8'));var ejs=require(_0xeaae('0x9'));var fs=require('fs');var fs_extra=require(_0xeaae('0xa'));var _=require(_0xeaae('0xb'));var squel=require(_0xeaae('0xc'));var crypto=require('crypto');var jsforce=require(_0xeaae('0xd'));var deskjs=require(_0xeaae('0xe'));var toCsv=require(_0xeaae('0x8'));var querystring=require(_0xeaae('0xf'));var Papa=require(_0xeaae('0x10'));var Redis=require(_0xeaae('0x11'));var authService=require(_0xeaae('0x12'));var qs=require(_0xeaae('0x13'));var as=require(_0xeaae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaae('0x15'))(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeaae('0x18'))['db'];function respondWithStatusCode(_0xf4e6b7,_0x16c851){_0x16c851=_0x16c851||0xcc;return function(_0x564b56){if(_0x564b56){return _0xf4e6b7[_0xeaae('0x19')](_0x16c851);}return _0xf4e6b7[_0xeaae('0x1a')](_0x16c851)[_0xeaae('0x1b')]();};}function respondWithResult(_0x3f46ff,_0x4f3501){_0x4f3501=_0x4f3501||0xc8;return function(_0x4d3766){if(_0x4d3766){return _0x3f46ff[_0xeaae('0x1a')](_0x4f3501)[_0xeaae('0x1c')](_0x4d3766);}};}function respondWithFilteredResult(_0x8dc1ac,_0x25b974){return function(_0x49741a){if(_0x49741a){var _0x1dd48f=typeof _0x25b974['offset']===_0xeaae('0x1d')&&typeof _0x25b974[_0xeaae('0x1e')]===_0xeaae('0x1d');var _0x355f39=_0x49741a['count'];var _0x538e3d=_0x1dd48f?0x0:_0x25b974['offset'];var _0x5b44f5=_0x1dd48f?_0x49741a[_0xeaae('0x1f')]:_0x25b974[_0xeaae('0x20')]+_0x25b974['limit'];var _0x4667ff;if(_0x5b44f5>=_0x355f39){_0x5b44f5=_0x355f39;_0x4667ff=0xc8;}else{_0x4667ff=0xce;}_0x8dc1ac['status'](_0x4667ff);return _0x8dc1ac[_0xeaae('0x21')](_0xeaae('0x22'),_0x538e3d+'-'+_0x5b44f5+'/'+_0x355f39)[_0xeaae('0x1c')](_0x49741a);}return null;};}function patchUpdates(_0x52de90){return function(_0x3be7cf){try{jsonpatch[_0xeaae('0x23')](_0x3be7cf,_0x52de90,!![]);}catch(_0x4c925a){return BPromise['reject'](_0x4c925a);}return _0x3be7cf[_0xeaae('0x24')]();};}function saveUpdates(_0x5ee523,_0x48f4a9){return function(_0x12f1b0){if(_0x12f1b0){return _0x12f1b0[_0xeaae('0x25')](_0x5ee523)[_0xeaae('0x26')](function(_0x25945c){return _0x25945c;});}return null;};}function removeEntity(_0xefe74b,_0x41739e){return function(_0x2a961c){if(_0x2a961c){return _0x2a961c[_0xeaae('0x27')]()[_0xeaae('0x26')](function(){_0xefe74b[_0xeaae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa7fa13,_0x124b21){return function(_0x10a0f2){if(!_0x10a0f2){_0xa7fa13[_0xeaae('0x19')](0x194);}return _0x10a0f2;};}function handleError(_0x98ec5a,_0x45a6df){_0x45a6df=_0x45a6df||0x1f4;return function(_0x145b46){logger[_0xeaae('0x28')](_0x145b46['stack']);if(_0x145b46['name']){delete _0x145b46[_0xeaae('0x29')];}_0x98ec5a[_0xeaae('0x1a')](_0x45a6df)[_0xeaae('0x2a')](_0x145b46);};}exports['index']=function(_0x294938,_0x30e777){var _0xa334c8={},_0x14a68a={},_0x24d86a={'count':0x0,'rows':[]};var _0x1c7175=_[_0xeaae('0x2b')](db[_0xeaae('0x2c')][_0xeaae('0x2d')],function(_0x24f0f2){return{'name':_0x24f0f2['fieldName'],'type':_0x24f0f2[_0xeaae('0x2e')][_0xeaae('0x2f')]};});_0x14a68a['model']=_['map'](_0x1c7175,_0xeaae('0x29'));_0x14a68a['query']=_[_0xeaae('0x30')](_0x294938[_0xeaae('0x31')]);_0x14a68a[_0xeaae('0x32')]=_['intersection'](_0x14a68a['model'],_0x14a68a['query']);_0xa334c8[_0xeaae('0x33')]=_['intersection'](_0x14a68a[_0xeaae('0x34')],qs[_0xeaae('0x35')](_0x294938[_0xeaae('0x31')]['fields']));_0xa334c8[_0xeaae('0x33')]=_0xa334c8[_0xeaae('0x33')][_0xeaae('0x36')]?_0xa334c8[_0xeaae('0x33')]:_0x14a68a[_0xeaae('0x34')];if(!_0x294938['query'][_0xeaae('0x37')](_0xeaae('0x38'))){_0xa334c8[_0xeaae('0x1e')]=qs[_0xeaae('0x1e')](_0x294938[_0xeaae('0x31')][_0xeaae('0x1e')]);_0xa334c8[_0xeaae('0x20')]=qs[_0xeaae('0x20')](_0x294938[_0xeaae('0x31')][_0xeaae('0x20')]);}_0xa334c8[_0xeaae('0x39')]=qs['sort'](_0x294938['query']['sort']);_0xa334c8['where']=qs['filters'](_[_0xeaae('0x3a')](_0x294938['query'],_0x14a68a[_0xeaae('0x32')]),_0x1c7175);if(_0x294938['query'][_0xeaae('0x3b')]){_0xa334c8['where']=_['merge'](_0xa334c8[_0xeaae('0x3c')],{'$or':_[_0xeaae('0x2b')](_0x1c7175,function(_0x58089f){if(_0x58089f[_0xeaae('0x2e')]!==_0xeaae('0x3d')){var _0x4af203={};_0x4af203[_0x58089f[_0xeaae('0x29')]]={'$like':'%'+_0x294938[_0xeaae('0x31')][_0xeaae('0x3b')]+'%'};return _0x4af203;}})});}_0xa334c8=_[_0xeaae('0x3e')]({},_0xa334c8,_0x294938[_0xeaae('0x3f')]);var _0x5a97a8={'where':_0xa334c8[_0xeaae('0x3c')]};return db['SquareMessage'][_0xeaae('0x1f')](_0x5a97a8)[_0xeaae('0x26')](function(_0x4b47db){_0x24d86a[_0xeaae('0x1f')]=_0x4b47db;if(_0x294938[_0xeaae('0x31')][_0xeaae('0x40')]){_0xa334c8['include']=[{'all':!![]}];}return db[_0xeaae('0x2c')][_0xeaae('0x41')](_0xa334c8);})[_0xeaae('0x26')](function(_0x40d844){_0x24d86a[_0xeaae('0x42')]=_0x40d844;return _0x24d86a;})['then'](respondWithFilteredResult(_0x30e777,_0xa334c8))['catch'](handleError(_0x30e777,null));};exports[_0xeaae('0x43')]=function(_0x2b97c9,_0x2d81b5){var _0x47d796={'raw':!![],'where':{'id':_0x2b97c9['params']['id']}},_0x467a65={};_0x467a65[_0xeaae('0x34')]=_['keys'](db[_0xeaae('0x2c')][_0xeaae('0x2d')]);_0x467a65[_0xeaae('0x31')]=_['keys'](_0x2b97c9[_0xeaae('0x31')]);_0x467a65['filters']=_[_0xeaae('0x44')](_0x467a65['model'],_0x467a65['query']);_0x47d796[_0xeaae('0x33')]=_[_0xeaae('0x44')](_0x467a65['model'],qs[_0xeaae('0x35')](_0x2b97c9[_0xeaae('0x31')][_0xeaae('0x35')]));_0x47d796[_0xeaae('0x33')]=_0x47d796[_0xeaae('0x33')][_0xeaae('0x36')]?_0x47d796['attributes']:_0x467a65[_0xeaae('0x34')];if(_0x2b97c9[_0xeaae('0x31')][_0xeaae('0x40')]){_0x47d796['include']=[{'all':!![]}];}_0x47d796=_['merge']({},_0x47d796,_0x2b97c9[_0xeaae('0x3f')]);return db[_0xeaae('0x2c')]['find'](_0x47d796)[_0xeaae('0x26')](handleEntityNotFound(_0x2d81b5,null))[_0xeaae('0x26')](respondWithResult(_0x2d81b5,null))[_0xeaae('0x45')](handleError(_0x2d81b5,null));};exports[_0xeaae('0x46')]=function(_0x29121a,_0x57a5ff){return db[_0xeaae('0x2c')]['create'](_0x29121a['body'],{})[_0xeaae('0x26')](respondWithResult(_0x57a5ff,0xc9))[_0xeaae('0x45')](handleError(_0x57a5ff,null));};exports[_0xeaae('0x25')]=function(_0x285dfe,_0x235b0d){if(_0x285dfe[_0xeaae('0x47')]['id']){delete _0x285dfe[_0xeaae('0x47')]['id'];}return db[_0xeaae('0x2c')][_0xeaae('0x48')]({'where':{'id':_0x285dfe[_0xeaae('0x49')]['id']}})[_0xeaae('0x26')](handleEntityNotFound(_0x235b0d,null))[_0xeaae('0x26')](saveUpdates(_0x285dfe[_0xeaae('0x47')],null))[_0xeaae('0x26')](respondWithResult(_0x235b0d,null))['catch'](handleError(_0x235b0d,null));};exports[_0xeaae('0x27')]=function(_0x506341,_0x1e6af9){return db[_0xeaae('0x2c')][_0xeaae('0x48')]({'where':{'id':_0x506341[_0xeaae('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e6af9,null))[_0xeaae('0x26')](removeEntity(_0x1e6af9,null))['catch'](handleError(_0x1e6af9,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b70ba40..4855d13 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 _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 +var _0x8e5d=['bluebird','request-promise','path','rimraf','./squareMessage.attributes','SquareMessage','square_messages','lodash','../../config/logger','api','moment'];(function(_0x5ac542,_0x52b641){var _0xcd1a9=function(_0x1a1470){while(--_0x1a1470){_0x5ac542['push'](_0x5ac542['shift']());}};_0xcd1a9(++_0x52b641);}(_0x8e5d,0x6a));var _0xd8e5=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x8e5d[_0x15cbce];return _0x257f29;};'use strict';var _=require(_0xd8e5('0x0'));var util=require('util');var logger=require(_0xd8e5('0x1'))(_0xd8e5('0x2'));var moment=require(_0xd8e5('0x3'));var BPromise=require(_0xd8e5('0x4'));var rp=require(_0xd8e5('0x5'));var fs=require('fs');var path=require(_0xd8e5('0x6'));var rimraf=require(_0xd8e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xd8e5('0x8'));module['exports']=function(_0x1816d0,_0x3a8c08){return _0x1816d0['define'](_0xd8e5('0x9'),attributes,{'tableName':_0xd8e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 2cf21a7..8d9f983 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 _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 +var _0x8801=['options','raw','then','CreateSquareMessage','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','create','body'];(function(_0x201319,_0xed17ce){var _0x84c5be=function(_0x37db25){while(--_0x37db25){_0x201319['push'](_0x201319['shift']());}};_0x84c5be(++_0xed17ce);}(_0x8801,0xad));var _0x1880=function(_0x28f09f,_0x5d7c60){_0x28f09f=_0x28f09f-0x0;var _0x1d7650=_0x8801[_0x28f09f];return _0x1d7650;};'use strict';var _=require('lodash');var util=require(_0x1880('0x0'));var moment=require(_0x1880('0x1'));var BPromise=require('bluebird');var rs=require(_0x1880('0x2'));var fs=require('fs');var Redis=require(_0x1880('0x3'));var db=require(_0x1880('0x4'))['db'];var utils=require(_0x1880('0x5'));var logger=require(_0x1880('0x6'))(_0x1880('0x7'));var config=require(_0x1880('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1880('0x9')][_0x1880('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eae09,_0x3135aa,_0x294a55){return new BPromise(function(_0x18801e,_0x1a84ea){return client['request'](_0x5eae09,_0x294a55)['then'](function(_0x3b36ff){logger[_0x1880('0xb')]('SquareMessage,\x20%s,\x20%s',_0x3135aa,_0x1880('0xc'));logger['debug'](_0x1880('0xd'),_0x3135aa,_0x1880('0xc'),JSON[_0x1880('0xe')](_0x3b36ff));if(_0x3b36ff[_0x1880('0xf')]){if(_0x3b36ff['error'][_0x1880('0x10')]===0x1f4){logger[_0x1880('0xf')](_0x1880('0x11'),_0x3135aa,_0x3b36ff['error'][_0x1880('0x12')]);return _0x1a84ea(_0x3b36ff[_0x1880('0xf')][_0x1880('0x12')]);}logger[_0x1880('0xf')](_0x1880('0x11'),_0x3135aa,_0x3b36ff[_0x1880('0xf')][_0x1880('0x12')]);return _0x18801e(_0x3b36ff['error'][_0x1880('0x12')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x3135aa,_0x1880('0xc'));_0x18801e(_0x3b36ff[_0x1880('0x13')]['message']);}})[_0x1880('0x14')](function(_0x1b3bbf){logger[_0x1880('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3135aa,_0x1b3bbf);_0x1a84ea(_0x1b3bbf);});});}exports['CreateSquareMessage']=function(_0x30fa17){var _0x2fe3d1=this;return new Promise(function(_0x58407c,_0x52c646){return db['SquareMessage'][_0x1880('0x15')](_0x30fa17[_0x1880('0x16')],{'raw':_0x30fa17[_0x1880('0x17')]?_0x30fa17[_0x1880('0x17')][_0x1880('0x18')]===undefined?!![]:![]:!![]})[_0x1880('0x19')](function(_0x590f9c){logger[_0x1880('0xb')](_0x1880('0x1a'),_0x30fa17);logger[_0x1880('0x1b')](_0x1880('0x1a'),_0x30fa17,JSON[_0x1880('0xe')](_0x590f9c));_0x58407c(_0x590f9c);})[_0x1880('0x14')](function(_0x3a5d95){logger[_0x1880('0xf')](_0x1880('0x1a'),_0x3a5d95['message'],_0x30fa17);_0x52c646(_0x2fe3d1[_0x1880('0xf')](0x1f4,_0x3a5d95[_0x1880('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 678c7be..eac7d61 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 _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 +var _0x844b=['delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','15s','post','create','put'];(function(_0x32239c,_0x279d71){var _0x9111dd=function(_0x414ecd){while(--_0x414ecd){_0x32239c['push'](_0x32239c['shift']());}};_0x9111dd(++_0x279d71);}(_0x844b,0x80));var _0xb844=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0x844b[_0x4cfa2e];return _0x279b50;};'use strict';var multer=require(_0xb844('0x0'));var util=require(_0xb844('0x1'));var path=require(_0xb844('0x2'));var timeout=require(_0xb844('0x3'));var express=require(_0xb844('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb844('0x5'));var interaction=require(_0xb844('0x6'));var config=require(_0xb844('0x7'));var controller=require(_0xb844('0x8'));router[_0xb844('0x9')]('/',auth['isAuthenticated'](),controller[_0xb844('0xa')]);router[_0xb844('0x9')](_0xb844('0xb'),auth[_0xb844('0xc')](),controller[_0xb844('0xd')]);router[_0xb844('0x9')](_0xb844('0xe'),auth['isAuthenticated'](),timeout(_0xb844('0xf')),controller['test']);router[_0xb844('0x10')]('/',auth[_0xb844('0xc')](),controller[_0xb844('0x11')]);router[_0xb844('0x12')]('/:id',auth[_0xb844('0xc')](),controller['update']);router[_0xb844('0x13')](_0xb844('0xb'),auth[_0xb844('0xc')](),controller['destroy']);module[_0xb844('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1877f0a..256bc4d 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 _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 +var _0x1e13=['name','exports','STRING'];(function(_0xbfc51a,_0x1b3642){var _0x3bc5db=function(_0xf24669){while(--_0xf24669){_0xbfc51a['push'](_0xbfc51a['shift']());}};_0x3bc5db(++_0x1b3642);}(_0x1e13,0x184));var _0x31e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1e13[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x31e1('0x0')]={'name':{'type':Sequelize[_0x31e1('0x1')],'unique':_0x31e1('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x31e1('0x1')]},'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 329ddab..f819e24 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 _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 +var _0x7f89=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','ODBC','UserProfileResource','end','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','test','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2c2775,_0x195446){var _0x3bbad9=function(_0x7a7a71){while(--_0x7a7a71){_0x2c2775['push'](_0x2c2775['shift']());}};_0x3bbad9(++_0x195446);}(_0x7f89,0x149));var _0x97f8=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0x7f89[_0x3662b4];return _0x50928c;};'use strict';var emlformat=require(_0x97f8('0x0'));var rimraf=require(_0x97f8('0x1'));var zipdir=require(_0x97f8('0x2'));var jsonpatch=require(_0x97f8('0x3'));var rp=require(_0x97f8('0x4'));var moment=require('moment');var BPromise=require(_0x97f8('0x5'));var Mustache=require(_0x97f8('0x6'));var util=require(_0x97f8('0x7'));var path=require(_0x97f8('0x8'));var sox=require(_0x97f8('0x9'));var csv=require(_0x97f8('0xa'));var ejs=require(_0x97f8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97f8('0xc'));var crypto=require(_0x97f8('0xd'));var jsforce=require(_0x97f8('0xe'));var deskjs=require(_0x97f8('0xf'));var toCsv=require(_0x97f8('0xa'));var querystring=require(_0x97f8('0x10'));var Papa=require(_0x97f8('0x11'));var Redis=require(_0x97f8('0x12'));var authService=require(_0x97f8('0x13'));var qs=require(_0x97f8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97f8('0x15'));var logger=require(_0x97f8('0x16'))(_0x97f8('0x17'));var utils=require('../../config/utils');var config=require(_0x97f8('0x18'));var licenseUtil=require(_0x97f8('0x19'));var db=require(_0x97f8('0x1a'))['db'];function respondWithStatusCode(_0x394100,_0x584b69){_0x584b69=_0x584b69||0xcc;return function(_0xd4ffb1){if(_0xd4ffb1){return _0x394100[_0x97f8('0x1b')](_0x584b69);}return _0x394100[_0x97f8('0x1c')](_0x584b69)['end']();};}function respondWithResult(_0x1a8b85,_0x44d740){_0x44d740=_0x44d740||0xc8;return function(_0x18d431){if(_0x18d431){return _0x1a8b85['status'](_0x44d740)[_0x97f8('0x1d')](_0x18d431);}};}function respondWithFilteredResult(_0x5ca165,_0x2187fa){return function(_0x92caac){if(_0x92caac){var _0x2f829b=typeof _0x2187fa[_0x97f8('0x1e')]===_0x97f8('0x1f')&&typeof _0x2187fa['limit']===_0x97f8('0x1f');var _0x25a019=_0x92caac[_0x97f8('0x20')];var _0x9ebf5c=_0x2f829b?0x0:_0x2187fa[_0x97f8('0x1e')];var _0xf77b94=_0x2f829b?_0x92caac[_0x97f8('0x20')]:_0x2187fa[_0x97f8('0x1e')]+_0x2187fa[_0x97f8('0x21')];var _0x346519;if(_0xf77b94>=_0x25a019){_0xf77b94=_0x25a019;_0x346519=0xc8;}else{_0x346519=0xce;}_0x5ca165[_0x97f8('0x1c')](_0x346519);return _0x5ca165['set'](_0x97f8('0x22'),_0x9ebf5c+'-'+_0xf77b94+'/'+_0x25a019)['json'](_0x92caac);}return null;};}function patchUpdates(_0x3535f8){return function(_0x1c819e){try{jsonpatch['apply'](_0x1c819e,_0x3535f8,!![]);}catch(_0x4c3640){return BPromise[_0x97f8('0x23')](_0x4c3640);}return _0x1c819e[_0x97f8('0x24')]();};}function saveUpdates(_0x160dd3,_0x2e749b){return function(_0x504dfd){if(_0x504dfd){return _0x504dfd[_0x97f8('0x25')](_0x160dd3)[_0x97f8('0x26')](function(_0x4fd204){return _0x4fd204;});}return null;};}function removeEntity(_0x2c5aa3,_0x3bf6b9){return function(_0x1829c0){if(_0x1829c0){return _0x1829c0['destroy']()['then'](function(){var _0x26589d=_0x1829c0['get']({'plain':!![]});var _0x17313c=_0x97f8('0x27');return db[_0x97f8('0x28')]['destroy']({'where':{'type':_0x17313c,'resourceId':_0x26589d['id']}})[_0x97f8('0x26')](function(){return _0x1829c0;});})[_0x97f8('0x26')](function(){_0x2c5aa3[_0x97f8('0x1c')](0xcc)[_0x97f8('0x29')]();});}};}function handleEntityNotFound(_0x51502c,_0x5531c8){return function(_0x5b84e5){if(!_0x5b84e5){_0x51502c['sendStatus'](0x194);}return _0x5b84e5;};}function handleError(_0x51ef8d,_0x21667f){_0x21667f=_0x21667f||0x1f4;return function(_0x205869){logger['error'](_0x205869[_0x97f8('0x2a')]);if(_0x205869[_0x97f8('0x2b')]){delete _0x205869[_0x97f8('0x2b')];}_0x51ef8d[_0x97f8('0x1c')](_0x21667f)['send'](_0x205869);};}exports[_0x97f8('0x2c')]=function(_0x1ae9e9,_0x58720a){var _0x1a1d16={},_0x353973={},_0x2f6051={'count':0x0,'rows':[]};var _0x12eec9=_[_0x97f8('0x2d')](db[_0x97f8('0x2e')][_0x97f8('0x2f')],function(_0x1745d7){return{'name':_0x1745d7[_0x97f8('0x30')],'type':_0x1745d7[_0x97f8('0x31')][_0x97f8('0x32')]};});_0x353973[_0x97f8('0x33')]=_[_0x97f8('0x2d')](_0x12eec9,_0x97f8('0x2b'));_0x353973[_0x97f8('0x34')]=_['keys'](_0x1ae9e9[_0x97f8('0x34')]);_0x353973[_0x97f8('0x35')]=_[_0x97f8('0x36')](_0x353973[_0x97f8('0x33')],_0x353973[_0x97f8('0x34')]);_0x1a1d16[_0x97f8('0x37')]=_['intersection'](_0x353973[_0x97f8('0x33')],qs[_0x97f8('0x38')](_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x38')]));_0x1a1d16[_0x97f8('0x37')]=_0x1a1d16[_0x97f8('0x37')][_0x97f8('0x39')]?_0x1a1d16[_0x97f8('0x37')]:_0x353973[_0x97f8('0x33')];if(!_0x1ae9e9['query']['hasOwnProperty']('nolimit')){_0x1a1d16['limit']=qs[_0x97f8('0x21')](_0x1ae9e9['query'][_0x97f8('0x21')]);_0x1a1d16[_0x97f8('0x1e')]=qs[_0x97f8('0x1e')](_0x1ae9e9[_0x97f8('0x34')]['offset']);}_0x1a1d16[_0x97f8('0x3a')]=qs[_0x97f8('0x3b')](_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x3b')]);_0x1a1d16['where']=qs[_0x97f8('0x35')](_[_0x97f8('0x3c')](_0x1ae9e9[_0x97f8('0x34')],_0x353973[_0x97f8('0x35')]),_0x12eec9);if(_0x1ae9e9['query'][_0x97f8('0x3d')]){_0x1a1d16[_0x97f8('0x3e')]=_[_0x97f8('0x3f')](_0x1a1d16['where'],{'$or':_['map'](_0x12eec9,function(_0x27f87c){if(_0x27f87c['type']!==_0x97f8('0x40')){var _0x2f9a34={};_0x2f9a34[_0x27f87c[_0x97f8('0x2b')]]={'$like':'%'+_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x3d')]+'%'};return _0x2f9a34;}})});}_0x1a1d16=_[_0x97f8('0x3f')]({},_0x1a1d16,_0x1ae9e9[_0x97f8('0x41')]);var _0x5ec2c6={'where':_0x1a1d16[_0x97f8('0x3e')]};return db[_0x97f8('0x2e')][_0x97f8('0x20')](_0x5ec2c6)[_0x97f8('0x26')](function(_0x5cd83e){_0x2f6051[_0x97f8('0x20')]=_0x5cd83e;if(_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x42')]){_0x1a1d16[_0x97f8('0x43')]=[{'all':!![]}];}return db[_0x97f8('0x2e')][_0x97f8('0x44')](_0x1a1d16);})[_0x97f8('0x26')](function(_0xa3e3ff){_0x2f6051[_0x97f8('0x45')]=_0xa3e3ff;return _0x2f6051;})[_0x97f8('0x26')](respondWithFilteredResult(_0x58720a,_0x1a1d16))['catch'](handleError(_0x58720a,null));};exports[_0x97f8('0x46')]=function(_0x3e878b,_0x55461b){var _0x376b43={'raw':!![],'where':{'id':_0x3e878b[_0x97f8('0x47')]['id']}},_0x7f19c={};_0x7f19c['model']=_['keys'](db[_0x97f8('0x2e')][_0x97f8('0x2f')]);_0x7f19c[_0x97f8('0x34')]=_[_0x97f8('0x48')](_0x3e878b[_0x97f8('0x34')]);_0x7f19c['filters']=_[_0x97f8('0x36')](_0x7f19c[_0x97f8('0x33')],_0x7f19c[_0x97f8('0x34')]);_0x376b43[_0x97f8('0x37')]=_[_0x97f8('0x36')](_0x7f19c['model'],qs['fields'](_0x3e878b['query'][_0x97f8('0x38')]));_0x376b43[_0x97f8('0x37')]=_0x376b43[_0x97f8('0x37')]['length']?_0x376b43[_0x97f8('0x37')]:_0x7f19c[_0x97f8('0x33')];if(_0x3e878b[_0x97f8('0x34')]['includeAll']){_0x376b43[_0x97f8('0x43')]=[{'all':!![]}];}_0x376b43=_['merge']({},_0x376b43,_0x3e878b[_0x97f8('0x41')]);return db[_0x97f8('0x2e')][_0x97f8('0x49')](_0x376b43)[_0x97f8('0x26')](handleEntityNotFound(_0x55461b,null))['then'](respondWithResult(_0x55461b,null))[_0x97f8('0x4a')](handleError(_0x55461b,null));};exports['create']=function(_0x994e88,_0x296cd0){return db[_0x97f8('0x2e')]['create'](_0x994e88[_0x97f8('0x4b')],{})['then'](function(_0x3ccd4e){var _0x2de78f=_0x994e88[_0x97f8('0x4c')][_0x97f8('0x4d')]({'plain':!![]});if(!_0x2de78f)throw new Error(_0x97f8('0x4e'));if(_0x2de78f[_0x97f8('0x4f')]===_0x97f8('0x4c')){var _0x2d7fd0=_0x3ccd4e[_0x97f8('0x4d')]({'plain':!![]});var _0x71d9f1=_0x97f8('0x27');return db[_0x97f8('0x50')][_0x97f8('0x49')]({'where':{'name':_0x71d9f1,'userProfileId':_0x2de78f[_0x97f8('0x51')]},'raw':!![]})['then'](function(_0x5b4125){if(_0x5b4125&&_0x5b4125[_0x97f8('0x52')]===0x0){return db[_0x97f8('0x28')][_0x97f8('0x53')]({'name':_0x2d7fd0[_0x97f8('0x2b')],'resourceId':_0x2d7fd0['id'],'type':_0x5b4125['name'],'sectionId':_0x5b4125['id']},{})[_0x97f8('0x26')](function(){return _0x3ccd4e;});}else{return _0x3ccd4e;}})[_0x97f8('0x4a')](function(_0x14d562){logger[_0x97f8('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14d562);throw _0x14d562;});}return _0x3ccd4e;})['then'](respondWithResult(_0x296cd0,0xc9))[_0x97f8('0x4a')](handleError(_0x296cd0,null));};exports[_0x97f8('0x25')]=function(_0x3ad080,_0x22bcf7){if(_0x3ad080[_0x97f8('0x4b')]['id']){delete _0x3ad080[_0x97f8('0x4b')]['id'];}return db['SquareOdbc'][_0x97f8('0x49')]({'where':{'id':_0x3ad080[_0x97f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x22bcf7,null))[_0x97f8('0x26')](saveUpdates(_0x3ad080[_0x97f8('0x4b')],null))['then'](respondWithResult(_0x22bcf7,null))['catch'](handleError(_0x22bcf7,null));};exports['destroy']=function(_0x405df2,_0x47dd88){return db[_0x97f8('0x2e')][_0x97f8('0x49')]({'where':{'id':_0x405df2[_0x97f8('0x47')]['id']}})[_0x97f8('0x26')](handleEntityNotFound(_0x47dd88,null))[_0x97f8('0x26')](removeEntity(_0x47dd88,null))[_0x97f8('0x4a')](handleError(_0x47dd88,null));};exports[_0x97f8('0x55')]=function(_0x1e56f6,_0x20f01e,_0x4ee7d9){var _0x2d6937;return db['SquareOdbc']['find']({'where':{'id':_0x1e56f6[_0x97f8('0x47')]['id']},'attributes':['id',_0x97f8('0x56')]})[_0x97f8('0x26')](handleEntityNotFound(_0x20f01e,null))[_0x97f8('0x26')](function(_0x26af9e){if(_0x26af9e){var _0x3f8eb5=require('odbc')();_0x3f8eb5['openSync'](_0x26af9e[_0x97f8('0x56')]);_0x3f8eb5[_0x97f8('0x57')]();return _0x26af9e;}})[_0x97f8('0x26')](respondWithResult(_0x20f01e,null))[_0x97f8('0x4a')](handleError(_0x20f01e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9e40d59..c72282a 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 _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 +var _0x83df=['exports','define','SquareOdbc','util','../../config/logger','bluebird','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x5c51b2,_0x577f30){var _0x3970eb=function(_0x43327b){while(--_0x43327b){_0x5c51b2['push'](_0x5c51b2['shift']());}};_0x3970eb(++_0x577f30);}(_0x83df,0x159));var _0xf83d=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0x83df[_0x16eb11];return _0x3ae7ef;};'use strict';var _=require('lodash');var util=require(_0xf83d('0x0'));var logger=require(_0xf83d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf83d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf83d('0x3'));var config=require(_0xf83d('0x4'));var attributes=require(_0xf83d('0x5'));module[_0xf83d('0x6')]=function(_0x2ae173,_0x2fa92f){return _0x2ae173[_0xf83d('0x7')](_0xf83d('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 01cb74a..0f44279 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 _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 +var _0x33f0=['../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b5e13,_0x376b25){var _0x1a6fba=function(_0x423e0f){while(--_0x423e0f){_0x4b5e13['push'](_0x4b5e13['shift']());}};_0x1a6fba(++_0x376b25);}(_0x33f0,0x19e));var _0x033f=function(_0x4bcd80,_0x8a825a){_0x4bcd80=_0x4bcd80-0x0;var _0x1d31a3=_0x33f0[_0x4bcd80];return _0x1d31a3;};'use strict';var _=require('lodash');var util=require(_0x033f('0x0'));var moment=require(_0x033f('0x1'));var BPromise=require(_0x033f('0x2'));var rs=require(_0x033f('0x3'));var fs=require('fs');var Redis=require(_0x033f('0x4'));var db=require(_0x033f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x033f('0x6'));var jayson=require(_0x033f('0x7'));var client=jayson[_0x033f('0x8')][_0x033f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46b093,_0x5940a9,_0x594aa8){return new BPromise(function(_0x4f125d,_0x652273){return client[_0x033f('0xa')](_0x46b093,_0x594aa8)[_0x033f('0xb')](function(_0x3073a0){logger[_0x033f('0xc')](_0x033f('0xd'),_0x5940a9,'request\x20sent');logger[_0x033f('0xe')](_0x033f('0xf'),_0x5940a9,_0x033f('0x10'),JSON['stringify'](_0x3073a0));if(_0x3073a0['error']){if(_0x3073a0[_0x033f('0x11')]['code']===0x1f4){logger[_0x033f('0x11')](_0x033f('0xd'),_0x5940a9,_0x3073a0[_0x033f('0x11')][_0x033f('0x12')]);return _0x652273(_0x3073a0[_0x033f('0x11')][_0x033f('0x12')]);}logger[_0x033f('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x5940a9,_0x3073a0[_0x033f('0x11')]['message']);return _0x4f125d(_0x3073a0[_0x033f('0x11')][_0x033f('0x12')]);}else{logger[_0x033f('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x5940a9,_0x033f('0x10'));_0x4f125d(_0x3073a0['result'][_0x033f('0x12')]);}})['catch'](function(_0x4eef4a){logger['error'](_0x033f('0xd'),_0x5940a9,_0x4eef4a);_0x652273(_0x4eef4a);});});}exports[_0x033f('0x13')]=function(_0x56e14a){var _0x514598=this;return new Promise(function(_0x17f62e,_0x56592e){return db['SquareOdbc'][_0x033f('0x14')]({'raw':_0x56e14a[_0x033f('0x15')]?_0x56e14a[_0x033f('0x15')][_0x033f('0x16')]===undefined?!![]:![]:!![],'where':_0x56e14a['options']?_0x56e14a[_0x033f('0x15')][_0x033f('0x17')]||null:null,'attributes':_0x56e14a[_0x033f('0x15')]?_0x56e14a[_0x033f('0x15')][_0x033f('0x18')]||null:null,'include':_0x56e14a[_0x033f('0x15')]?_0x56e14a[_0x033f('0x15')][_0x033f('0x19')]?_[_0x033f('0x1a')](_0x56e14a[_0x033f('0x15')][_0x033f('0x19')],function(_0x35f6ab){return{'model':db[_0x35f6ab[_0x033f('0x1b')]],'as':_0x35f6ab['as'],'attributes':_0x35f6ab[_0x033f('0x18')],'include':_0x35f6ab[_0x033f('0x19')]?_['map'](_0x35f6ab[_0x033f('0x19')],function(_0x4780ee){return{'model':db[_0x4780ee['model']],'as':_0x4780ee['as'],'attributes':_0x4780ee[_0x033f('0x18')],'include':_0x4780ee['include']?_['map'](_0x4780ee[_0x033f('0x19')],function(_0x17f63f){return{'model':db[_0x17f63f[_0x033f('0x1b')]],'as':_0x17f63f['as'],'attributes':_0x17f63f[_0x033f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x033f('0xb')](function(_0x91027c){logger[_0x033f('0xc')]('ShowSquareOdbc',_0x56e14a);logger[_0x033f('0xe')]('ShowSquareOdbc',_0x56e14a,JSON[_0x033f('0x1c')](_0x91027c));_0x17f62e(_0x91027c);})[_0x033f('0x1d')](function(_0x5254f5){logger[_0x033f('0x11')](_0x033f('0x13'),_0x5254f5[_0x033f('0x12')],_0x56e14a);_0x56592e(_0x514598[_0x033f('0x11')](0x1f4,_0x5254f5[_0x033f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a25f1f0..f8a439b 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 _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 +var _0x720a=['/:id','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','post','isAuthenticated','create','put'];(function(_0x3c0a36,_0x8e2f2b){var _0x5ac4cb=function(_0x42b695){while(--_0x42b695){_0x3c0a36['push'](_0x3c0a36['shift']());}};_0x5ac4cb(++_0x8e2f2b);}(_0x720a,0x17d));var _0xa720=function(_0x54e0c5,_0x40fd32){_0x54e0c5=_0x54e0c5-0x0;var _0x13a1d5=_0x720a[_0x54e0c5];return _0x13a1d5;};'use strict';var multer=require(_0xa720('0x0'));var util=require(_0xa720('0x1'));var path=require('path');var timeout=require(_0xa720('0x2'));var express=require(_0xa720('0x3'));var router=express[_0xa720('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa720('0x5'));var interaction=require(_0xa720('0x6'));var config=require(_0xa720('0x7'));var controller=require(_0xa720('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa720('0x9')]);router[_0xa720('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa720('0xb')]('/',auth[_0xa720('0xc')](),controller[_0xa720('0xd')]);router[_0xa720('0xe')](_0xa720('0xf'),auth['isAuthenticated'](),controller[_0xa720('0x10')]);router[_0xa720('0x11')](_0xa720('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ae6a168..4d6f582 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 _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 +var _0x9ec0=['name','TEXT','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING'];(function(_0x29caf3,_0x88a317){var _0x3dc931=function(_0x228469){while(--_0x228469){_0x29caf3['push'](_0x29caf3['shift']());}};_0x3dc931(++_0x88a317);}(_0x9ec0,0x1b9));var _0x09ec=function(_0x3f8965,_0x3c80b9){_0x3f8965=_0x3f8965-0x0;var _0xcdf5c9=_0x9ec0[_0x3f8965];return _0xcdf5c9;};'use strict';var Sequelize=require(_0x09ec('0x0'));module[_0x09ec('0x1')]={'name':{'type':Sequelize[_0x09ec('0x2')],'unique':_0x09ec('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x09ec('0x2')]},'notes':{'type':Sequelize[_0x09ec('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x09ec('0x5')](_0x09ec('0x6'))){return this['getDataValue'](_0x09ec('0x6'))[_0x09ec('0x7')](_0x09ec('0x8'));}}},'production':{'type':Sequelize[_0x09ec('0x9')]('long'),'get':function(){if(this[_0x09ec('0x5')](_0x09ec('0xa'))){return this[_0x09ec('0x5')](_0x09ec('0xa'))[_0x09ec('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x09ec('0xb')]},'publishedAt':{'type':Sequelize[_0x09ec('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d86bea3..ff79011 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 _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 +var _0x66a6=['update','then','SquareProjects','UserProfileResource','destroy','publish','stringify','end','sendStatus','name','status','send','index','map','SquareProject','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','user','get','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','agi','pick','production','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','json','undefined','limit','count','set','Content-Range'];(function(_0x43b4b5,_0x3efc1b){var _0x2df432=function(_0x10b3bb){while(--_0x10b3bb){_0x43b4b5['push'](_0x43b4b5['shift']());}};_0x2df432(++_0x3efc1b);}(_0x66a6,0x1c0));var _0x666a=function(_0x2378ce,_0x1ae0fb){_0x2378ce=_0x2378ce-0x0;var _0x18cfa8=_0x66a6[_0x2378ce];return _0x18cfa8;};'use strict';var _=require(_0x666a('0x0'));var Redis=require('ioredis');var qs=require(_0x666a('0x1'));var logger=require(_0x666a('0x2'))('api');var config=require(_0x666a('0x3'));var db=require(_0x666a('0x4'))['db'];config[_0x666a('0x5')]=_[_0x666a('0x6')](config[_0x666a('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x666a('0x5')]));require(_0x666a('0x7'))['register'](socket);function respondWithResult(_0x28694f,_0x5d1190){_0x5d1190=_0x5d1190||0xc8;return function(_0x157faa){if(_0x157faa){return _0x28694f['status'](_0x5d1190)[_0x666a('0x8')](_0x157faa);}};}function respondWithFilteredResult(_0x4964e9,_0x2272ba){return function(_0x11e170){if(_0x11e170){var _0x14aef8=typeof _0x2272ba['offset']===_0x666a('0x9')&&typeof _0x2272ba[_0x666a('0xa')]===_0x666a('0x9');var _0x37e13a=_0x11e170[_0x666a('0xb')];var _0x349f55=_0x14aef8?0x0:_0x2272ba['offset'];var _0x295809=_0x14aef8?_0x11e170[_0x666a('0xb')]:_0x2272ba['offset']+_0x2272ba['limit'];var _0x34d008;if(_0x295809>=_0x37e13a){_0x295809=_0x37e13a;_0x34d008=0xc8;}else{_0x34d008=0xce;}_0x4964e9['status'](_0x34d008);return _0x4964e9[_0x666a('0xc')](_0x666a('0xd'),_0x349f55+'-'+_0x295809+'/'+_0x37e13a)['json'](_0x11e170);}return null;};}function saveUpdates(_0x310009){return function(_0x4a4a1b){if(_0x4a4a1b){return _0x4a4a1b[_0x666a('0xe')](_0x310009)['then'](function(_0x639dd2){return _0x639dd2;});}return null;};}function removeEntity(_0x507df8){return function(_0x14fb3b){if(_0x14fb3b){return _0x14fb3b['destroy']()[_0x666a('0xf')](function(){var _0x2dd00f=_0x14fb3b['get']({'plain':!![]});var _0x3db5ce=_0x666a('0x10');return db[_0x666a('0x11')][_0x666a('0x12')]({'where':{'type':_0x3db5ce,'resourceId':_0x2dd00f['id']}})[_0x666a('0xf')](function(){return _0x14fb3b;});})[_0x666a('0xf')](function(){var _0x4b7b4a=new Redis(config[_0x666a('0x5')]);_0x4b7b4a[_0x666a('0x13')]('agi',JSON[_0x666a('0x14')]({'id':_0x14fb3b['id'],'deleted':!![]}));})['then'](function(){_0x507df8['status'](0xcc)[_0x666a('0x15')]();});}};}function handleEntityNotFound(_0x4c6412){return function(_0x348420){if(!_0x348420){_0x4c6412[_0x666a('0x16')](0x194);}return _0x348420;};}function handleError(_0x1f1cea,_0x4487c8){_0x4487c8=_0x4487c8||0x1f4;return function(_0x546b01){logger['error'](_0x546b01['stack']);if(_0x546b01[_0x666a('0x17')]){delete _0x546b01[_0x666a('0x17')];}_0x1f1cea[_0x666a('0x18')](_0x4487c8)[_0x666a('0x19')](_0x546b01);};}exports[_0x666a('0x1a')]=function(_0x20d27f,_0x4cc909){var _0x2af91b={},_0x41df5f={},_0x5cda41={'count':0x0,'rows':[]};var _0x4e5b9a=_[_0x666a('0x1b')](db[_0x666a('0x1c')][_0x666a('0x1d')],function(_0x3e0dd1){return{'name':_0x3e0dd1['fieldName'],'type':_0x3e0dd1['type'][_0x666a('0x1e')]};});_0x41df5f[_0x666a('0x1f')]=_[_0x666a('0x1b')](_0x4e5b9a,'name');_0x41df5f[_0x666a('0x20')]=_['keys'](_0x20d27f[_0x666a('0x20')]);_0x41df5f[_0x666a('0x21')]=_[_0x666a('0x22')](_0x41df5f['model'],_0x41df5f[_0x666a('0x20')]);_0x2af91b[_0x666a('0x23')]=_[_0x666a('0x22')](_0x41df5f['model'],qs[_0x666a('0x24')](_0x20d27f[_0x666a('0x20')][_0x666a('0x24')]));_0x2af91b['attributes']=_0x2af91b[_0x666a('0x23')][_0x666a('0x25')]?_0x2af91b[_0x666a('0x23')]:_0x41df5f[_0x666a('0x1f')];if(!_0x20d27f[_0x666a('0x20')][_0x666a('0x26')]('nolimit')){_0x2af91b[_0x666a('0xa')]=qs[_0x666a('0xa')](_0x20d27f['query'][_0x666a('0xa')]);_0x2af91b['offset']=qs['offset'](_0x20d27f['query'][_0x666a('0x27')]);}_0x2af91b[_0x666a('0x28')]=qs[_0x666a('0x29')](_0x20d27f['query']['sort']);_0x2af91b[_0x666a('0x2a')]=qs[_0x666a('0x21')](_['pick'](_0x20d27f['query'],_0x41df5f['filters']),_0x4e5b9a);if(_0x20d27f[_0x666a('0x20')][_0x666a('0x2b')]){_0x2af91b[_0x666a('0x2a')]=_[_0x666a('0x2c')](_0x2af91b['where'],{'$or':_['map'](_0x4e5b9a,function(_0x6569e0){if(_0x6569e0[_0x666a('0x2d')]!==_0x666a('0x2e')){var _0x2a0e51={};_0x2a0e51[_0x6569e0[_0x666a('0x17')]]={'$like':'%'+_0x20d27f['query'][_0x666a('0x2b')]+'%'};return _0x2a0e51;}})});}_0x2af91b=_[_0x666a('0x2c')]({},_0x2af91b,_0x20d27f[_0x666a('0x2f')]);var _0x29adf5={'where':_0x2af91b[_0x666a('0x2a')]};return db[_0x666a('0x1c')]['count'](_0x29adf5)['then'](function(_0x5c3aff){_0x5cda41[_0x666a('0xb')]=_0x5c3aff;if(_0x20d27f[_0x666a('0x20')][_0x666a('0x30')]){_0x2af91b[_0x666a('0x31')]=[{'all':!![]}];}return db[_0x666a('0x1c')]['findAll'](_0x2af91b);})[_0x666a('0xf')](function(_0x57b404){_0x5cda41[_0x666a('0x32')]=_0x57b404;return _0x5cda41;})[_0x666a('0xf')](respondWithFilteredResult(_0x4cc909,_0x2af91b))[_0x666a('0x33')](handleError(_0x4cc909,null));};exports[_0x666a('0x34')]=function(_0x3aa157,_0x18265f){var _0x320adb={'raw':![],'where':{'id':_0x3aa157['params']['id']}},_0x2468e7={};_0x2468e7[_0x666a('0x1f')]=_[_0x666a('0x35')](db['SquareProject'][_0x666a('0x1d')]);_0x2468e7[_0x666a('0x20')]=_[_0x666a('0x35')](_0x3aa157['query']);_0x2468e7[_0x666a('0x21')]=_[_0x666a('0x22')](_0x2468e7[_0x666a('0x1f')],_0x2468e7['query']);_0x320adb[_0x666a('0x23')]=_['intersection'](_0x2468e7[_0x666a('0x1f')],qs[_0x666a('0x24')](_0x3aa157[_0x666a('0x20')]['fields']));_0x320adb[_0x666a('0x23')]=_0x320adb[_0x666a('0x23')]['length']?_0x320adb[_0x666a('0x23')]:_0x2468e7[_0x666a('0x1f')];if(_0x3aa157[_0x666a('0x20')][_0x666a('0x30')]){_0x320adb[_0x666a('0x31')]=[{'all':!![]}];}_0x320adb=_[_0x666a('0x2c')]({},_0x320adb,_0x3aa157['options']);return db[_0x666a('0x1c')][_0x666a('0x36')](_0x320adb)[_0x666a('0xf')](handleEntityNotFound(_0x18265f,null))[_0x666a('0xf')](respondWithResult(_0x18265f,null))[_0x666a('0x33')](handleError(_0x18265f,null));};exports['create']=function(_0x37857e,_0x1139d4){return db[_0x666a('0x1c')]['create'](_0x37857e['body'],{})['then'](function(_0x18689a){var _0x26f023=_0x37857e[_0x666a('0x37')][_0x666a('0x38')]({'plain':!![]});if(!_0x26f023)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26f023[_0x666a('0x39')]==='user'){var _0x389260=_0x18689a['get']({'plain':!![]});var _0x51cc8a=_0x666a('0x10');return db['UserProfileSection']['find']({'where':{'name':_0x51cc8a,'userProfileId':_0x26f023['userProfileId']},'raw':!![]})[_0x666a('0xf')](function(_0x411abb){if(_0x411abb&&_0x411abb[_0x666a('0x3a')]===0x0){return db['UserProfileResource'][_0x666a('0x3b')]({'name':_0x389260['name'],'resourceId':_0x389260['id'],'type':_0x411abb['name'],'sectionId':_0x411abb['id']},{})[_0x666a('0xf')](function(){return _0x18689a;});}else{return _0x18689a;}})[_0x666a('0x33')](function(_0x4c2654){logger['error'](_0x666a('0x3c'),_0x4c2654);throw _0x4c2654;});}return _0x18689a;})[_0x666a('0xf')](respondWithResult(_0x1139d4,0xc9))[_0x666a('0x33')](handleError(_0x1139d4,null));};exports[_0x666a('0xe')]=function(_0xa2516b,_0x2c08d6){if(_0xa2516b['body']['id']){delete _0xa2516b['body']['id'];}return db[_0x666a('0x1c')][_0x666a('0x36')]({'where':{'id':_0xa2516b[_0x666a('0x3d')]['id']}})[_0x666a('0xf')](handleEntityNotFound(_0x2c08d6,null))[_0x666a('0xf')](saveUpdates(_0xa2516b[_0x666a('0x3e')],null))[_0x666a('0xf')](function(_0x2d0df1){if(!_0x2d0df1)return;var _0x5d0965=_0x2d0df1[_0x666a('0x38')]({'plain':!![]});return _0x5d0965;})[_0x666a('0xf')](function(_0x3e8b52){var _0x26fa8c=new Redis(config[_0x666a('0x5')]);_0x26fa8c[_0x666a('0x13')](_0x666a('0x3f'),JSON[_0x666a('0x14')](_[_0x666a('0x40')](_0x3e8b52,['id',_0x666a('0x17'),_0x666a('0x41')])));return _0x3e8b52;})[_0x666a('0xf')](respondWithResult(_0x2c08d6,null))[_0x666a('0x33')](handleError(_0x2c08d6,null));};exports[_0x666a('0x12')]=function(_0x318825,_0x1e8041){return db[_0x666a('0x1c')]['find']({'where':{'id':_0x318825['params']['id']}})['then'](handleEntityNotFound(_0x1e8041,null))[_0x666a('0xf')](removeEntity(_0x1e8041,null))[_0x666a('0x33')](handleError(_0x1e8041,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5859cd6..ab4cf42 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 _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 +var _0xe2e0=['exports','save','update','remove','emit','hook'];(function(_0x1fc26d,_0x5c78ce){var _0x36c777=function(_0xaf61f2){while(--_0xaf61f2){_0x1fc26d['push'](_0x1fc26d['shift']());}};_0x36c777(++_0x5c78ce);}(_0xe2e0,0x18d));var _0x0e2e=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0xe2e0[_0x28278f];return _0x3d9f74;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e2e('0x0'),'afterUpdate':_0x0e2e('0x1'),'afterDestroy':_0x0e2e('0x2')};function emitEvent(_0x417fb0){return function(_0x38a32,_0x48cadf,_0x15670c){SquareProjectEvents[_0x0e2e('0x3')](_0x417fb0+':'+_0x38a32['id'],_0x38a32);SquareProjectEvents['emit'](_0x417fb0,_0x38a32);_0x15670c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x0e2e('0x4')](e,emitEvent(event));}}module[_0x0e2e('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b08f03d..061ae1d 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 _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 +var _0x5f70=['savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','util','../../config/logger','api','bluebird','path','./squareProject.attributes','exports','SquareProject','square_projects','changed'];(function(_0x18ce6e,_0x1eff3a){var _0x533bc9=function(_0x2286b4){while(--_0x2286b4){_0x18ce6e['push'](_0x18ce6e['shift']());}};_0x533bc9(++_0x1eff3a);}(_0x5f70,0xc8));var _0x05f7=function(_0x127bed,_0x50c9b3){_0x127bed=_0x127bed-0x0;var _0x5ca418=_0x5f70[_0x127bed];return _0x5ca418;};'use strict';var _=require('lodash');var util=require(_0x05f7('0x0'));var logger=require(_0x05f7('0x1'))(_0x05f7('0x2'));var moment=require('moment');var BPromise=require(_0x05f7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05f7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x05f7('0x5'));module[_0x05f7('0x6')]=function(_0xedcba2,_0xc2d2){return _0xedcba2['define'](_0x05f7('0x7'),attributes,{'tableName':_0x05f7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dc3fd,_0x25e73f,_0x1de6ce){if(_0x1dc3fd[_0x05f7('0x9')]('preproduction')){_0x1dc3fd[_0x05f7('0xa')]=moment()['format'](_0x05f7('0xb'));}if(_0x1dc3fd[_0x05f7('0x9')](_0x05f7('0xc'))){_0x1dc3fd[_0x05f7('0xd')]=moment()[_0x05f7('0xe')](_0x05f7('0xb'));}_0x1de6ce(null,_0x1dc3fd);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 49dd46b..333877b 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 _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 +var _0x6349=['catch','lodash','ioredis','rpc','redis','localhost','socket.io-emitter','register','GetSquareProjects','findAll','options','where','attributes','limit','include','map','model','then','info','debug','error','message','ShowSquareProject','SquareProject','raw','stringify'];(function(_0x5c804e,_0x583316){var _0x317514=function(_0x266b66){while(--_0x266b66){_0x5c804e['push'](_0x5c804e['shift']());}};_0x317514(++_0x583316);}(_0x6349,0xeb));var _0x9634=function(_0x11a3d1,_0x48935a){_0x11a3d1=_0x11a3d1-0x0;var _0x3ea618=_0x6349[_0x11a3d1];return _0x3ea618;};'use strict';var _=require(_0x9634('0x0'));var Redis=require(_0x9634('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x9634('0x2'));var config=require('../../config/environment');config[_0x9634('0x3')]=_['defaults'](config[_0x9634('0x3')],{'host':_0x9634('0x4'),'port':0x18eb});var socket=require(_0x9634('0x5'))(new Redis(config['redis']));require('./squareProject.socket')[_0x9634('0x6')](socket);exports[_0x9634('0x7')]=function(_0x60182b){var _0x36e8fd=this;return new Promise(function(_0x186753,_0x4b9984){return db['SquareProject'][_0x9634('0x8')]({'raw':_0x60182b[_0x9634('0x9')]?_0x60182b['options']['raw']===undefined?!![]:![]:!![],'where':_0x60182b[_0x9634('0x9')]?_0x60182b[_0x9634('0x9')][_0x9634('0xa')]||null:null,'attributes':_0x60182b[_0x9634('0x9')]?_0x60182b[_0x9634('0x9')][_0x9634('0xb')]||null:null,'limit':_0x60182b['options']?_0x60182b[_0x9634('0x9')][_0x9634('0xc')]||null:null,'include':_0x60182b[_0x9634('0x9')]?_0x60182b[_0x9634('0x9')][_0x9634('0xd')]?_[_0x9634('0xe')](_0x60182b[_0x9634('0x9')]['include'],function(_0xd541e2){return{'model':db[_0xd541e2[_0x9634('0xf')]],'as':_0xd541e2['as'],'attributes':_0xd541e2[_0x9634('0xb')],'include':_0xd541e2['include']?_[_0x9634('0xe')](_0xd541e2[_0x9634('0xd')],function(_0x459da0){return{'model':db[_0x459da0[_0x9634('0xf')]],'as':_0x459da0['as'],'attributes':_0x459da0[_0x9634('0xb')],'include':_0x459da0['include']?_[_0x9634('0xe')](_0x459da0[_0x9634('0xd')],function(_0x4b57ee){return{'model':db[_0x4b57ee[_0x9634('0xf')]],'as':_0x4b57ee['as'],'attributes':_0x4b57ee[_0x9634('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9634('0x10')](function(_0xc0ee87){logger[_0x9634('0x11')](_0x9634('0x7'),_0x60182b);logger[_0x9634('0x12')](_0x9634('0x7'),_0x60182b,JSON['stringify'](_0xc0ee87));_0x186753(_0xc0ee87);})['catch'](function(_0xd34bd9){logger[_0x9634('0x13')](_0x9634('0x7'),_0xd34bd9[_0x9634('0x14')],_0x60182b);_0x4b9984(_0x36e8fd['error'](0x1f4,_0xd34bd9[_0x9634('0x14')]));});});};exports[_0x9634('0x15')]=function(_0x1721ff){var _0x4f80b3=this;return new Promise(function(_0x4e77c7,_0x20f863){return db[_0x9634('0x16')]['find']({'raw':_0x1721ff['options']?_0x1721ff['options'][_0x9634('0x17')]===undefined?!![]:![]:!![],'where':_0x1721ff[_0x9634('0x9')]?_0x1721ff[_0x9634('0x9')][_0x9634('0xa')]||null:null,'attributes':_0x1721ff[_0x9634('0x9')]?_0x1721ff[_0x9634('0x9')][_0x9634('0xb')]||null:null,'include':_0x1721ff[_0x9634('0x9')]?_0x1721ff[_0x9634('0x9')][_0x9634('0xd')]?_[_0x9634('0xe')](_0x1721ff['options'][_0x9634('0xd')],function(_0xcf4f7b){return{'model':db[_0xcf4f7b[_0x9634('0xf')]],'as':_0xcf4f7b['as'],'attributes':_0xcf4f7b[_0x9634('0xb')],'include':_0xcf4f7b[_0x9634('0xd')]?_['map'](_0xcf4f7b[_0x9634('0xd')],function(_0x296511){return{'model':db[_0x296511[_0x9634('0xf')]],'as':_0x296511['as'],'attributes':_0x296511['attributes'],'include':_0x296511[_0x9634('0xd')]?_[_0x9634('0xe')](_0x296511[_0x9634('0xd')],function(_0x10ea45){return{'model':db[_0x10ea45['model']],'as':_0x10ea45['as'],'attributes':_0x10ea45[_0x9634('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9634('0x10')](function(_0x3404d2){logger[_0x9634('0x11')](_0x9634('0x15'),_0x1721ff);logger[_0x9634('0x12')](_0x9634('0x15'),_0x1721ff,JSON[_0x9634('0x18')](_0x3404d2));_0x4e77c7(_0x3404d2);})[_0x9634('0x19')](function(_0x1ec409){logger[_0x9634('0x13')](_0x9634('0x15'),_0x1ec409['message'],_0x1721ff);_0x20f863(_0x4f80b3[_0x9634('0x13')](0x1f4,_0x1ec409[_0x9634('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d508bdd..d4b6dc8 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 _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 +var _0x7fd3=['squareProject:','update','emit','removeListener'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7fd3,0xd9));var _0x37fd=function(_0x2f3c2a,_0x4b83fb){_0x2f3c2a=_0x2f3c2a-0x0;var _0x30d632=_0x7fd3[_0x2f3c2a];return _0x30d632;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove',_0x37fd('0x0')];function createListener(_0x49a6ba,_0x13ef23){return function(_0x377ba8){_0x13ef23[_0x37fd('0x1')](_0x49a6ba,_0x377ba8);};}function removeListener(_0x5c186f,_0x11efac){return function(){SquareProjectEvents[_0x37fd('0x2')](_0x5c186f,_0x11efac);};}exports['register']=function(_0x592eef){for(var _0x54bcf9=0x0,_0x4bbb2a=events['length'];_0x54bcf9<_0x4bbb2a;_0x54bcf9++){var _0x16db1c=events[_0x54bcf9];var _0x4bec2f=createListener(_0x37fd('0x3')+_0x16db1c,_0x592eef);SquareProjectEvents['on'](_0x16db1c,_0x4bec2f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1d84074..ea38b69 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(_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 +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x433e3f,_0xfa4126){var _0x49b364=function(_0x37b57e){while(--_0x37b57e){_0x433e3f['push'](_0x433e3f['shift']());}};_0x49b364(++_0xfa4126);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index cd7ac12..a7887fd 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 _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 +var _0xd6d6=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x533c47,_0xe3e2fa){var _0x476709=function(_0x477fba){while(--_0x477fba){_0x533c47['push'](_0x533c47['shift']());}};_0x476709(++_0xe3e2fa);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x13a150,_0x10756f){_0x13a150=_0x13a150-0x0;var _0x3bbe00=_0xd6d6[_0x13a150];return _0x3bbe00;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'callerid':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6d6d('0x2')]},'extension':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'dnid':{'type':Sequelize[_0x6d6d('0x2')]},'projectName':{'type':Sequelize[_0x6d6d('0x2')]},'saveName':{'type':Sequelize[_0x6d6d('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x6d6d('0x2')]},'format':{'type':Sequelize[_0x6d6d('0x3')],'get':function(){var _0x44f83d='';var _0x18f824=this[_0x6d6d('0x4')](_0x6d6d('0x5'));if(_0x18f824){_0x44f83d=_0x18f824[_0x6d6d('0x6')](_0x18f824['lastIndexOf']('.'));}return _0x44f83d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e6a12fa..93e372a 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 _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 +var _0xae85=['cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','end','sendStatus','error','stack','name','index','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found'];(function(_0x2d17b7,_0x349746){var _0x57e94e=function(_0x39256e){while(--_0x39256e){_0x2d17b7['push'](_0x2d17b7['shift']());}};_0x57e94e(++_0x349746);}(_0xae85,0x13e));var _0x5ae8=function(_0x4ee7ad,_0x30b922){_0x4ee7ad=_0x4ee7ad-0x0;var _0x4d8d34=_0xae85[_0x4ee7ad];return _0x4d8d34;};'use strict';var emlformat=require(_0x5ae8('0x0'));var rimraf=require(_0x5ae8('0x1'));var zipdir=require(_0x5ae8('0x2'));var jsonpatch=require(_0x5ae8('0x3'));var rp=require(_0x5ae8('0x4'));var moment=require('moment');var BPromise=require(_0x5ae8('0x5'));var Mustache=require(_0x5ae8('0x6'));var util=require('util');var path=require(_0x5ae8('0x7'));var sox=require(_0x5ae8('0x8'));var csv=require(_0x5ae8('0x9'));var ejs=require(_0x5ae8('0xa'));var fs=require('fs');var fs_extra=require(_0x5ae8('0xb'));var _=require(_0x5ae8('0xc'));var squel=require(_0x5ae8('0xd'));var crypto=require('crypto');var jsforce=require(_0x5ae8('0xe'));var deskjs=require(_0x5ae8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5ae8('0x10'));var Papa=require(_0x5ae8('0x11'));var Redis=require(_0x5ae8('0x12'));var authService=require(_0x5ae8('0x13'));var qs=require(_0x5ae8('0x14'));var as=require(_0x5ae8('0x15'));var hardwareService=require(_0x5ae8('0x16'));var logger=require('../../config/logger')(_0x5ae8('0x17'));var utils=require(_0x5ae8('0x18'));var config=require(_0x5ae8('0x19'));var licenseUtil=require(_0x5ae8('0x1a'));var db=require(_0x5ae8('0x1b'))['db'];function respondWithStatusCode(_0x18d9cf,_0x11fae0){_0x11fae0=_0x11fae0||0xcc;return function(_0x495978){if(_0x495978){return _0x18d9cf['sendStatus'](_0x11fae0);}return _0x18d9cf[_0x5ae8('0x1c')](_0x11fae0)['end']();};}function respondWithResult(_0x477067,_0xa9591c){_0xa9591c=_0xa9591c||0xc8;return function(_0x111dd8){if(_0x111dd8){return _0x477067[_0x5ae8('0x1c')](_0xa9591c)[_0x5ae8('0x1d')](_0x111dd8);}};}function respondWithFilteredResult(_0x145e5d,_0x25c0d0){return function(_0x55f2c0){if(_0x55f2c0){var _0x4bc8e4=typeof _0x25c0d0[_0x5ae8('0x1e')]==='undefined'&&typeof _0x25c0d0['limit']===_0x5ae8('0x1f');var _0x50175f=_0x55f2c0[_0x5ae8('0x20')];var _0x9a4ced=_0x4bc8e4?0x0:_0x25c0d0[_0x5ae8('0x1e')];var _0x13cbfc=_0x4bc8e4?_0x55f2c0['count']:_0x25c0d0[_0x5ae8('0x1e')]+_0x25c0d0[_0x5ae8('0x21')];var _0x22011f;if(_0x13cbfc>=_0x50175f){_0x13cbfc=_0x50175f;_0x22011f=0xc8;}else{_0x22011f=0xce;}_0x145e5d[_0x5ae8('0x1c')](_0x22011f);return _0x145e5d[_0x5ae8('0x22')](_0x5ae8('0x23'),_0x9a4ced+'-'+_0x13cbfc+'/'+_0x50175f)[_0x5ae8('0x1d')](_0x55f2c0);}return null;};}function patchUpdates(_0x3e705f){return function(_0x1bcf82){try{jsonpatch['apply'](_0x1bcf82,_0x3e705f,!![]);}catch(_0x5a7af7){return BPromise[_0x5ae8('0x24')](_0x5a7af7);}return _0x1bcf82[_0x5ae8('0x25')]();};}function saveUpdates(_0x7fdc90,_0x364d78){return function(_0xa0f04c){if(_0xa0f04c){return _0xa0f04c['update'](_0x7fdc90)[_0x5ae8('0x26')](function(_0x3fc57f){return _0x3fc57f;});}return null;};}function removeEntity(_0x3c99e8,_0x46f0cf){return function(_0x106c3b){if(_0x106c3b){return _0x106c3b['destroy']()[_0x5ae8('0x26')](function(){_0x3c99e8['status'](0xcc)[_0x5ae8('0x27')]();});}};}function handleEntityNotFound(_0x1fda87,_0x52f59d){return function(_0x5b866b){if(!_0x5b866b){_0x1fda87[_0x5ae8('0x28')](0x194);}return _0x5b866b;};}function handleError(_0x226fe7,_0x336ade){_0x336ade=_0x336ade||0x1f4;return function(_0x5ad92e){logger[_0x5ae8('0x29')](_0x5ad92e[_0x5ae8('0x2a')]);if(_0x5ad92e['name']){delete _0x5ad92e[_0x5ae8('0x2b')];}_0x226fe7[_0x5ae8('0x1c')](_0x336ade)['send'](_0x5ad92e);};}exports[_0x5ae8('0x2c')]=function(_0x2146a4,_0x263203){var _0x27de9a={},_0x40bc4e={},_0x317bb3={'count':0x0,'rows':[]};var _0x296bec=_['map'](db[_0x5ae8('0x2d')][_0x5ae8('0x2e')],function(_0x5bf8b6){return{'name':_0x5bf8b6['fieldName'],'type':_0x5bf8b6[_0x5ae8('0x2f')][_0x5ae8('0x30')]};});_0x40bc4e[_0x5ae8('0x31')]=_['map'](_0x296bec,_0x5ae8('0x2b'));_0x40bc4e[_0x5ae8('0x32')]=_[_0x5ae8('0x33')](_0x2146a4[_0x5ae8('0x32')]);_0x40bc4e[_0x5ae8('0x34')]=_[_0x5ae8('0x35')](_0x40bc4e[_0x5ae8('0x31')],_0x40bc4e['query']);_0x27de9a[_0x5ae8('0x36')]=_['intersection'](_0x40bc4e['model'],qs[_0x5ae8('0x37')](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x37')]));_0x27de9a[_0x5ae8('0x36')]=_0x27de9a[_0x5ae8('0x36')][_0x5ae8('0x38')]?_0x27de9a[_0x5ae8('0x36')]:_0x40bc4e[_0x5ae8('0x31')];if(!_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x39')](_0x5ae8('0x3a'))){_0x27de9a[_0x5ae8('0x21')]=qs['limit'](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x21')]);_0x27de9a[_0x5ae8('0x1e')]=qs[_0x5ae8('0x1e')](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x1e')]);}_0x27de9a[_0x5ae8('0x3b')]=qs['sort'](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x3c')]);_0x27de9a[_0x5ae8('0x3d')]=qs[_0x5ae8('0x34')](_[_0x5ae8('0x3e')](_0x2146a4[_0x5ae8('0x32')],_0x40bc4e['filters']),_0x296bec);if(_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x3f')]){_0x27de9a['where']=_[_0x5ae8('0x40')](_0x27de9a['where'],{'$or':_['map'](_0x296bec,function(_0x15795e){if(_0x15795e[_0x5ae8('0x2f')]!==_0x5ae8('0x41')){var _0x335598={};_0x335598[_0x15795e[_0x5ae8('0x2b')]]={'$like':'%'+_0x2146a4[_0x5ae8('0x32')]['filter']+'%'};return _0x335598;}})});}_0x27de9a=_[_0x5ae8('0x40')]({},_0x27de9a,_0x2146a4[_0x5ae8('0x42')]);var _0x26a8ed={'where':_0x27de9a[_0x5ae8('0x3d')]};return db['SquareRecording'][_0x5ae8('0x20')](_0x26a8ed)['then'](function(_0x581ab6){_0x317bb3[_0x5ae8('0x20')]=_0x581ab6;if(_0x2146a4[_0x5ae8('0x32')]['includeAll']){_0x27de9a[_0x5ae8('0x43')]=[{'all':!![]}];}return db['SquareRecording'][_0x5ae8('0x44')](_0x27de9a);})[_0x5ae8('0x26')](function(_0x26191d){_0x317bb3[_0x5ae8('0x45')]=_0x26191d;return _0x317bb3;})[_0x5ae8('0x26')](respondWithFilteredResult(_0x263203,_0x27de9a))[_0x5ae8('0x46')](handleError(_0x263203,null));};exports[_0x5ae8('0x47')]=function(_0x330a6f,_0x384cd0){var _0x5df369={'raw':!![],'where':{'id':_0x330a6f[_0x5ae8('0x48')]['id']}},_0x139303={};_0x139303[_0x5ae8('0x31')]=_[_0x5ae8('0x33')](db[_0x5ae8('0x2d')][_0x5ae8('0x2e')]);_0x139303[_0x5ae8('0x32')]=_[_0x5ae8('0x33')](_0x330a6f['query']);_0x139303['filters']=_[_0x5ae8('0x35')](_0x139303[_0x5ae8('0x31')],_0x139303[_0x5ae8('0x32')]);_0x5df369[_0x5ae8('0x36')]=_[_0x5ae8('0x35')](_0x139303[_0x5ae8('0x31')],qs[_0x5ae8('0x37')](_0x330a6f[_0x5ae8('0x32')][_0x5ae8('0x37')]));_0x5df369[_0x5ae8('0x36')]=_0x5df369['attributes'][_0x5ae8('0x38')]?_0x5df369[_0x5ae8('0x36')]:_0x139303[_0x5ae8('0x31')];if(_0x330a6f[_0x5ae8('0x32')][_0x5ae8('0x49')]){_0x5df369[_0x5ae8('0x43')]=[{'all':!![]}];}_0x5df369=_[_0x5ae8('0x40')]({},_0x5df369,_0x330a6f['options']);return db['SquareRecording'][_0x5ae8('0x4a')](_0x5df369)['then'](handleEntityNotFound(_0x384cd0,null))[_0x5ae8('0x26')](respondWithResult(_0x384cd0,null))[_0x5ae8('0x46')](handleError(_0x384cd0,null));};exports[_0x5ae8('0x4b')]=function(_0x57946d,_0x36c1f5){return db[_0x5ae8('0x2d')][_0x5ae8('0x4b')](_0x57946d[_0x5ae8('0x4c')],{})[_0x5ae8('0x26')](respondWithResult(_0x36c1f5,0xc9))[_0x5ae8('0x46')](handleError(_0x36c1f5,null));};exports[_0x5ae8('0x4d')]=function(_0x54b4b1,_0xd222c8){if(_0x54b4b1[_0x5ae8('0x4c')]['id']){delete _0x54b4b1['body']['id'];}return db[_0x5ae8('0x2d')][_0x5ae8('0x4a')]({'where':{'id':_0x54b4b1[_0x5ae8('0x48')]['id']}})['then'](handleEntityNotFound(_0xd222c8,null))['then'](saveUpdates(_0x54b4b1[_0x5ae8('0x4c')],null))['then'](respondWithResult(_0xd222c8,null))['catch'](handleError(_0xd222c8,null));};exports[_0x5ae8('0x4e')]=function(_0x5012a9,_0x577b63,_0x37c45a){var _0xc6cf89=require(_0x5ae8('0x4f'));var _0x4c73f8=![];var _0x5c98d6={};if(_0x5012a9[_0x5ae8('0x32')][_0x5ae8('0x2f')]&&_0x5012a9[_0x5ae8('0x32')][_0x5ae8('0x2f')]===_0x5ae8('0x50')){_0x5c98d6[_0x5ae8('0x50')]=_0x5012a9[_0x5ae8('0x48')]['id'];}else{_0x5c98d6['id']=_0x5012a9[_0x5ae8('0x48')]['id'];}return db['SquareRecording'][_0x5ae8('0x4a')]({'where':_0x5c98d6,'attributes':['id','savePath',_0x5ae8('0x51')],'raw':!![]})[_0x5ae8('0x26')](handleEntityNotFound(_0x577b63,null))['then'](function(_0x50d67d){if(_0x50d67d){var _0xbfb37b=_0x50d67d[_0x5ae8('0x52')];var _0xb75141=util[_0x5ae8('0x53')]('%s.cypher',_0xbfb37b);if(fs[_0x5ae8('0x54')](_0xb75141)){_0x4c73f8=!![];return _0xc6cf89[_0x5ae8('0x55')](_0xb75141,_0xbfb37b,config[_0x5ae8('0x56')][_0x5ae8('0x57')])[_0x5ae8('0x26')](function(){return _0x50d67d;});}return _0x50d67d;}})[_0x5ae8('0x26')](function(_0x3b46a3){if(_0x3b46a3){var _0xa6b114=_0x3b46a3[_0x5ae8('0x52')];if(!fs['existsSync'](_0xa6b114)){throw new db['Sequelize'][(_0x5ae8('0x58'))](_0x5ae8('0x59'));}if(_0x3b46a3['filename']){return _0x577b63[_0x5ae8('0x4e')](_0xa6b114,_0x3b46a3[_0x5ae8('0x51')]+path[_0x5ae8('0x5a')](_0xa6b114),function(){if(_0x4c73f8){fs[_0x5ae8('0x5b')](_0xa6b114);}});}else{return _0x577b63[_0x5ae8('0x4e')](_0xa6b114,function(_0x4468c8){if(_0x4c73f8){fs[_0x5ae8('0x5b')](_0xa6b114);}});}}})['catch'](function(_0x476f46){if(_0x476f46[_0x5ae8('0x5c')]===_0x5ae8('0x59')){_0x577b63[_0x5ae8('0x1c')](0x194)[_0x5ae8('0x5d')](_0x5ae8('0x5e'));}else{return handleError(_0x577b63,null);}});};exports[_0x5ae8('0x5f')]=function(_0x42b337,_0x3215a6){return db['SquareRecording']['find']({'where':{'id':_0x42b337[_0x5ae8('0x48')]['id']}})[_0x5ae8('0x26')](function(_0x43ec94){if(_[_0x5ae8('0x60')](_0x43ec94)){throw new ReferenceError(_0x5ae8('0x61'));}return _0x43ec94;})[_0x5ae8('0x26')](function(_0x13aaea){var _0xf28f53=_0x13aaea['savePath'];logger['info'](_0x5ae8('0x62'),_0xf28f53);if(!_[_0x5ae8('0x60')](_0x13aaea[_0x5ae8('0x52')])&&fs[_0x5ae8('0x54')](_0xf28f53)){logger[_0x5ae8('0x63')](_0x5ae8('0x64')+_0xf28f53+_0x5ae8('0x65'));fs[_0x5ae8('0x66')](_0xf28f53);}_0xf28f53=_0xf28f53+_0x5ae8('0x67');if(!_[_0x5ae8('0x60')](_0x13aaea[_0x5ae8('0x52')])&&fs[_0x5ae8('0x54')](_0xf28f53)){logger[_0x5ae8('0x63')](_0x5ae8('0x64')+_0xf28f53+_0x5ae8('0x65'));fs[_0x5ae8('0x66')](_0xf28f53);}return _0x13aaea;})[_0x5ae8('0x26')](function(_0x55981b){if(!_0x55981b)throw new InternalError();return _0x55981b[_0x5ae8('0x5f')]();})['then'](function(){_0x3215a6[_0x5ae8('0x1c')](0xcc)[_0x5ae8('0x27')]();})[_0x5ae8('0x46')](handleError(_0x3215a6,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index be46141..f0caf57 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 _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 +var _0x0eeb=['../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0eeb[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('SquareRecording',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 5ccbed5..eeb8f48 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 _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 +var _0x0e93=['client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x0e93,0x158));var _0x30e9=function(_0x1e59b0,_0x3bfdd8){_0x1e59b0=_0x1e59b0-0x0;var _0x56c55b=_0x0e93[_0x1e59b0];return _0x56c55b;};'use strict';var _=require(_0x30e9('0x0'));var util=require(_0x30e9('0x1'));var moment=require(_0x30e9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x30e9('0x4'));var logger=require(_0x30e9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x30e9('0x6')][_0x30e9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42ac44,_0x3d66b7,_0x12460b){return new BPromise(function(_0x3eaad9,_0x77566f){return client[_0x30e9('0x8')](_0x42ac44,_0x12460b)['then'](function(_0x17ddd3){logger[_0x30e9('0x9')](_0x30e9('0xa'),_0x3d66b7,_0x30e9('0xb'));logger[_0x30e9('0xc')](_0x30e9('0xd'),_0x3d66b7,_0x30e9('0xb'),JSON[_0x30e9('0xe')](_0x17ddd3));if(_0x17ddd3[_0x30e9('0xf')]){if(_0x17ddd3['error']['code']===0x1f4){logger[_0x30e9('0xf')](_0x30e9('0xa'),_0x3d66b7,_0x17ddd3[_0x30e9('0xf')]['message']);return _0x77566f(_0x17ddd3[_0x30e9('0xf')]['message']);}logger[_0x30e9('0xf')](_0x30e9('0xa'),_0x3d66b7,_0x17ddd3[_0x30e9('0xf')][_0x30e9('0x10')]);return _0x3eaad9(_0x17ddd3[_0x30e9('0xf')]['message']);}else{logger[_0x30e9('0x9')](_0x30e9('0xa'),_0x3d66b7,'request\x20sent');_0x3eaad9(_0x17ddd3[_0x30e9('0x11')][_0x30e9('0x10')]);}})[_0x30e9('0x12')](function(_0x3286f8){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3d66b7,_0x3286f8);_0x77566f(_0x3286f8);});});}exports[_0x30e9('0x13')]=function(_0x23bff3){var _0x2a7cc1=this;return new Promise(function(_0x3d9272,_0x53609b){return db[_0x30e9('0x14')]['create'](_0x23bff3[_0x30e9('0x15')],{'raw':_0x23bff3[_0x30e9('0x16')]?_0x23bff3['options'][_0x30e9('0x17')]===undefined?!![]:![]:!![]})[_0x30e9('0x18')](function(_0x190aad){logger[_0x30e9('0x9')](_0x30e9('0x13'),_0x23bff3);logger[_0x30e9('0xc')]('CreateSquareRecording',_0x23bff3,JSON[_0x30e9('0xe')](_0x190aad));_0x3d9272(_0x190aad);})[_0x30e9('0x12')](function(_0x1a7422){logger['error'](_0x30e9('0x13'),_0x1a7422['message'],_0x23bff3);_0x53609b(_0x2a7cc1[_0x30e9('0xf')](0x1f4,_0x1a7422[_0x30e9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 3a9c982..077398e 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 _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 +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x80591,_0x576439){var _0x4e9466=function(_0x2b2452){while(--_0x2b2452){_0x80591['push'](_0x80591['shift']());}};_0x4e9466(++_0x576439);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f4bd898..8b344b9 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 _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 +var _0x42e7=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x40912e,_0x4ed6be){var _0x222657=function(_0x225bf1){while(--_0x225bf1){_0x40912e['push'](_0x40912e['shift']());}};_0x222657(++_0x4ed6be);}(_0x42e7,0xb7));var _0x742e=function(_0x4a6f6a,_0x2e2051){_0x4a6f6a=_0x4a6f6a-0x0;var _0x2b3860=_0x42e7[_0x4a6f6a];return _0x2b3860;};'use strict';var Sequelize=require(_0x742e('0x0'));module['exports']={'network':{'type':Sequelize[_0x742e('0x1')]},'network_script':{'type':Sequelize[_0x742e('0x1')]},'request':{'type':Sequelize[_0x742e('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x742e('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x742e('0x1')]},'version':{'type':Sequelize[_0x742e('0x1')]},'callerid':{'type':Sequelize[_0x742e('0x1')]},'calleridname':{'type':Sequelize[_0x742e('0x1')]},'callingpres':{'type':Sequelize[_0x742e('0x1')]},'callingani2':{'type':Sequelize[_0x742e('0x1')]},'callington':{'type':Sequelize[_0x742e('0x1')]},'callingtns':{'type':Sequelize[_0x742e('0x1')]},'dnid':{'type':Sequelize[_0x742e('0x1')]},'rdnis':{'type':Sequelize[_0x742e('0x1')]},'context':{'type':Sequelize[_0x742e('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x742e('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x742e('0x1')]},'threadid':{'type':Sequelize[_0x742e('0x1')]},'project_name':{'type':Sequelize[_0x742e('0x1')]},'joinAt':{'type':Sequelize[_0x742e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x742e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index c66b4ab..dfbc913 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 _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 +var _0x749c=['../../config/environment','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','SquareReport','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x26efb1,_0x15548c){var _0x23643a=function(_0x44c542){while(--_0x44c542){_0x26efb1['push'](_0x26efb1['shift']());}};_0x23643a(++_0x15548c);}(_0x749c,0x1a5));var _0xc749=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x749c[_0x5ce8b9];return _0xe34be0;};'use strict';var emlformat=require(_0xc749('0x0'));var rimraf=require(_0xc749('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc749('0x2'));var rp=require(_0xc749('0x3'));var moment=require(_0xc749('0x4'));var BPromise=require(_0xc749('0x5'));var Mustache=require(_0xc749('0x6'));var util=require(_0xc749('0x7'));var path=require(_0xc749('0x8'));var sox=require(_0xc749('0x9'));var csv=require(_0xc749('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc749('0xb'));var _=require(_0xc749('0xc'));var squel=require('squel');var crypto=require(_0xc749('0xd'));var jsforce=require(_0xc749('0xe'));var deskjs=require(_0xc749('0xf'));var toCsv=require(_0xc749('0xa'));var querystring=require(_0xc749('0x10'));var Papa=require(_0xc749('0x11'));var Redis=require(_0xc749('0x12'));var authService=require(_0xc749('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc749('0x14'));var logger=require(_0xc749('0x15'))('api');var utils=require(_0xc749('0x16'));var config=require(_0xc749('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c7657,_0x520370){_0x520370=_0x520370||0xcc;return function(_0x24409e){if(_0x24409e){return _0x1c7657['sendStatus'](_0x520370);}return _0x1c7657[_0xc749('0x18')](_0x520370)[_0xc749('0x19')]();};}function respondWithResult(_0x82c5c,_0x17b165){_0x17b165=_0x17b165||0xc8;return function(_0x4a96fc){if(_0x4a96fc){return _0x82c5c['status'](_0x17b165)[_0xc749('0x1a')](_0x4a96fc);}};}function respondWithFilteredResult(_0x2b8399,_0x2d9a13){return function(_0x370baf){if(_0x370baf){var _0x580c06=typeof _0x2d9a13['offset']==='undefined'&&typeof _0x2d9a13[_0xc749('0x1b')]===_0xc749('0x1c');var _0xb7e565=_0x370baf[_0xc749('0x1d')];var _0x1569ef=_0x580c06?0x0:_0x2d9a13[_0xc749('0x1e')];var _0x261cc3=_0x580c06?_0x370baf['count']:_0x2d9a13['offset']+_0x2d9a13['limit'];var _0x471e80;if(_0x261cc3>=_0xb7e565){_0x261cc3=_0xb7e565;_0x471e80=0xc8;}else{_0x471e80=0xce;}_0x2b8399[_0xc749('0x18')](_0x471e80);return _0x2b8399[_0xc749('0x1f')](_0xc749('0x20'),_0x1569ef+'-'+_0x261cc3+'/'+_0xb7e565)['json'](_0x370baf);}return null;};}function patchUpdates(_0x522e62){return function(_0x2d8570){try{jsonpatch[_0xc749('0x21')](_0x2d8570,_0x522e62,!![]);}catch(_0x477579){return BPromise[_0xc749('0x22')](_0x477579);}return _0x2d8570[_0xc749('0x23')]();};}function saveUpdates(_0x49dab7,_0x3469ab){return function(_0x34c3c0){if(_0x34c3c0){return _0x34c3c0['update'](_0x49dab7)[_0xc749('0x24')](function(_0xf4cf70){return _0xf4cf70;});}return null;};}function removeEntity(_0x5f2ee3,_0x21001b){return function(_0x5ced62){if(_0x5ced62){return _0x5ced62[_0xc749('0x25')]()[_0xc749('0x24')](function(){_0x5f2ee3[_0xc749('0x18')](0xcc)[_0xc749('0x19')]();});}};}function handleEntityNotFound(_0x24caa8,_0x58c012){return function(_0x4ae925){if(!_0x4ae925){_0x24caa8['sendStatus'](0x194);}return _0x4ae925;};}function handleError(_0x4bc1bd,_0x30015a){_0x30015a=_0x30015a||0x1f4;return function(_0x2ba311){logger['error'](_0x2ba311[_0xc749('0x26')]);if(_0x2ba311[_0xc749('0x27')]){delete _0x2ba311[_0xc749('0x27')];}_0x4bc1bd['status'](_0x30015a)[_0xc749('0x28')](_0x2ba311);};}exports['index']=function(_0x2f9952,_0x53dce6){var _0x8c6416={},_0x28a12d={},_0x1b6c60={'count':0x0,'rows':[]};var _0x7b3f5f=_['map'](db[_0xc749('0x29')][_0xc749('0x2a')],function(_0x223f4f){return{'name':_0x223f4f['fieldName'],'type':_0x223f4f[_0xc749('0x2b')][_0xc749('0x2c')]};});_0x28a12d[_0xc749('0x2d')]=_[_0xc749('0x2e')](_0x7b3f5f,'name');_0x28a12d[_0xc749('0x2f')]=_[_0xc749('0x30')](_0x2f9952['query']);_0x28a12d[_0xc749('0x31')]=_['intersection'](_0x28a12d['model'],_0x28a12d[_0xc749('0x2f')]);_0x8c6416[_0xc749('0x32')]=_[_0xc749('0x33')](_0x28a12d['model'],qs[_0xc749('0x34')](_0x2f9952[_0xc749('0x2f')][_0xc749('0x34')]));_0x8c6416['attributes']=_0x8c6416[_0xc749('0x32')][_0xc749('0x35')]?_0x8c6416[_0xc749('0x32')]:_0x28a12d[_0xc749('0x2d')];if(!_0x2f9952[_0xc749('0x2f')]['hasOwnProperty'](_0xc749('0x36'))){_0x8c6416['limit']=qs[_0xc749('0x1b')](_0x2f9952[_0xc749('0x2f')][_0xc749('0x1b')]);_0x8c6416[_0xc749('0x1e')]=qs[_0xc749('0x1e')](_0x2f9952[_0xc749('0x2f')]['offset']);}_0x8c6416[_0xc749('0x37')]=qs['sort'](_0x2f9952[_0xc749('0x2f')]['sort']);_0x8c6416[_0xc749('0x38')]=qs[_0xc749('0x31')](_[_0xc749('0x39')](_0x2f9952['query'],_0x28a12d[_0xc749('0x31')]),_0x7b3f5f);if(_0x2f9952['query'][_0xc749('0x3a')]){_0x8c6416['where']=_[_0xc749('0x3b')](_0x8c6416[_0xc749('0x38')],{'$or':_['map'](_0x7b3f5f,function(_0x18fc29){if(_0x18fc29[_0xc749('0x2b')]!==_0xc749('0x3c')){var _0x21e2eb={};_0x21e2eb[_0x18fc29[_0xc749('0x27')]]={'$like':'%'+_0x2f9952[_0xc749('0x2f')][_0xc749('0x3a')]+'%'};return _0x21e2eb;}})});}_0x8c6416=_[_0xc749('0x3b')]({},_0x8c6416,_0x2f9952['options']);var _0x5bea79={'where':_0x8c6416[_0xc749('0x38')]};return db[_0xc749('0x29')][_0xc749('0x1d')](_0x5bea79)[_0xc749('0x24')](function(_0x3d48c0){_0x1b6c60[_0xc749('0x1d')]=_0x3d48c0;if(_0x2f9952['query'][_0xc749('0x3d')]){_0x8c6416[_0xc749('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0xc749('0x3f')](_0x8c6416);})[_0xc749('0x24')](function(_0x6464db){_0x1b6c60[_0xc749('0x40')]=_0x6464db;return _0x1b6c60;})[_0xc749('0x24')](respondWithFilteredResult(_0x53dce6,_0x8c6416))['catch'](handleError(_0x53dce6,null));};exports[_0xc749('0x41')]=function(_0x57c2f8,_0x531164){var _0x2771e2={'raw':!![],'where':{'id':_0x57c2f8[_0xc749('0x42')]['id']}},_0x2124ef={};_0x2124ef[_0xc749('0x2d')]=_[_0xc749('0x30')](db[_0xc749('0x29')][_0xc749('0x2a')]);_0x2124ef['query']=_[_0xc749('0x30')](_0x57c2f8[_0xc749('0x2f')]);_0x2124ef[_0xc749('0x31')]=_[_0xc749('0x33')](_0x2124ef[_0xc749('0x2d')],_0x2124ef[_0xc749('0x2f')]);_0x2771e2[_0xc749('0x32')]=_[_0xc749('0x33')](_0x2124ef[_0xc749('0x2d')],qs[_0xc749('0x34')](_0x57c2f8[_0xc749('0x2f')][_0xc749('0x34')]));_0x2771e2['attributes']=_0x2771e2[_0xc749('0x32')][_0xc749('0x35')]?_0x2771e2[_0xc749('0x32')]:_0x2124ef[_0xc749('0x2d')];if(_0x57c2f8['query'][_0xc749('0x3d')]){_0x2771e2[_0xc749('0x3e')]=[{'all':!![]}];}_0x2771e2=_['merge']({},_0x2771e2,_0x57c2f8[_0xc749('0x43')]);return db[_0xc749('0x29')]['find'](_0x2771e2)[_0xc749('0x24')](handleEntityNotFound(_0x531164,null))[_0xc749('0x24')](respondWithResult(_0x531164,null))[_0xc749('0x44')](handleError(_0x531164,null));};exports[_0xc749('0x45')]=function(_0x5a4ce4,_0x3667f3){return db[_0xc749('0x29')][_0xc749('0x45')](_0x5a4ce4[_0xc749('0x46')],{})['then'](respondWithResult(_0x3667f3,0xc9))[_0xc749('0x44')](handleError(_0x3667f3,null));};exports[_0xc749('0x47')]=function(_0x19ad53,_0x1eda8c){if(_0x19ad53['body']['id']){delete _0x19ad53[_0xc749('0x46')]['id'];}return db[_0xc749('0x29')][_0xc749('0x48')]({'where':{'id':_0x19ad53[_0xc749('0x42')]['id']}})['then'](handleEntityNotFound(_0x1eda8c,null))[_0xc749('0x24')](saveUpdates(_0x19ad53[_0xc749('0x46')],null))[_0xc749('0x24')](respondWithResult(_0x1eda8c,null))[_0xc749('0x44')](handleError(_0x1eda8c,null));};exports[_0xc749('0x25')]=function(_0x257121,_0x2b8f87){return db['SquareReport']['find']({'where':{'id':_0x257121[_0xc749('0x42')]['id']}})[_0xc749('0x24')](handleEntityNotFound(_0x2b8f87,null))[_0xc749('0x24')](removeEntity(_0x2b8f87,null))[_0xc749('0x44')](handleError(_0x2b8f87,null));};exports['describe']=function(_0x44a771,_0x6b75ab){return db[_0xc749('0x29')][_0xc749('0x49')]()[_0xc749('0x24')](respondWithResult(_0x6b75ab,null))[_0xc749('0x44')](handleError(_0x6b75ab,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 8002559..d655ec5 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 _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 +var _0xf6e6=['util','../../config/logger','api','moment','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xf6e6,0x1dc));var _0x6f6e=function(_0x3023b9,_0x556a){_0x3023b9=_0x3023b9-0x0;var _0x5a7787=_0xf6e6[_0x3023b9];return _0x5a7787;};'use strict';var _=require('lodash');var util=require(_0x6f6e('0x0'));var logger=require(_0x6f6e('0x1'))(_0x6f6e('0x2'));var moment=require(_0x6f6e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f6e('0x4'));var config=require(_0x6f6e('0x5'));var attributes=require(_0x6f6e('0x6'));module[_0x6f6e('0x7')]=function(_0x3439ea,_0x3b73f0){return _0x3439ea['define'](_0x6f6e('0x8'),attributes,{'tableName':_0x6f6e('0x9'),'paranoid':![],'indexes':[{'name':_0x6f6e('0xa'),'fields':[_0x6f6e('0xb'),_0x6f6e('0xc')]},{'name':_0x6f6e('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8f1bb8e..a99e9ea 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 _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 +var _0x6da6=['limit','UpdateSquareReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','SquareReport','body','options','CreateSquareReport','catch','update','attributes'];(function(_0x2d615a,_0x105110){var _0x56720f=function(_0x419394){while(--_0x419394){_0x2d615a['push'](_0x2d615a['shift']());}};_0x56720f(++_0x105110);}(_0x6da6,0x110));var _0x66da=function(_0x2f4069,_0x74eb6c){_0x2f4069=_0x2f4069-0x0;var _0x4e5d90=_0x6da6[_0x2f4069];return _0x4e5d90;};'use strict';var _=require(_0x66da('0x0'));var util=require('util');var moment=require(_0x66da('0x1'));var BPromise=require(_0x66da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66da('0x3'));var db=require(_0x66da('0x4'))['db'];var utils=require(_0x66da('0x5'));var logger=require(_0x66da('0x6'))(_0x66da('0x7'));var config=require('../../config/environment');var jayson=require(_0x66da('0x8'));var client=jayson[_0x66da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556617,_0x5b2004,_0x3c37ae){return new BPromise(function(_0xb1d778,_0x17ea0e){return client['request'](_0x556617,_0x3c37ae)[_0x66da('0xa')](function(_0x438acd){logger[_0x66da('0xb')]('SquareReport,\x20%s,\x20%s',_0x5b2004,_0x66da('0xc'));logger[_0x66da('0xd')](_0x66da('0xe'),_0x5b2004,'request\x20sent',JSON[_0x66da('0xf')](_0x438acd));if(_0x438acd[_0x66da('0x10')]){if(_0x438acd[_0x66da('0x10')][_0x66da('0x11')]===0x1f4){logger[_0x66da('0x10')](_0x66da('0x12'),_0x5b2004,_0x438acd[_0x66da('0x10')][_0x66da('0x13')]);return _0x17ea0e(_0x438acd[_0x66da('0x10')]['message']);}logger[_0x66da('0x10')](_0x66da('0x12'),_0x5b2004,_0x438acd[_0x66da('0x10')][_0x66da('0x13')]);return _0xb1d778(_0x438acd[_0x66da('0x10')]['message']);}else{logger[_0x66da('0xb')](_0x66da('0x12'),_0x5b2004,_0x66da('0xc'));_0xb1d778(_0x438acd[_0x66da('0x14')][_0x66da('0x13')]);}})['catch'](function(_0x4e83b1){logger[_0x66da('0x10')](_0x66da('0x12'),_0x5b2004,_0x4e83b1);_0x17ea0e(_0x4e83b1);});});}exports['CreateSquareReport']=function(_0x8f498){var _0x3d4c30=this;return new Promise(function(_0xf5d533,_0x3a6e98){return db[_0x66da('0x15')]['create'](_0x8f498[_0x66da('0x16')],{'raw':_0x8f498[_0x66da('0x17')]?_0x8f498[_0x66da('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3505d1){logger[_0x66da('0xb')]('CreateSquareReport',_0x8f498);logger['debug'](_0x66da('0x18'),_0x8f498,JSON[_0x66da('0xf')](_0x3505d1));_0xf5d533(_0x3505d1);})[_0x66da('0x19')](function(_0x2bd57e){logger[_0x66da('0x10')](_0x66da('0x18'),_0x2bd57e[_0x66da('0x13')],_0x8f498);_0x3a6e98(_0x3d4c30[_0x66da('0x10')](0x1f4,_0x2bd57e['message']));});});};exports['UpdateSquareReport']=function(_0x4255c6){var _0x1c7ddb=this;return new Promise(function(_0x927c3e,_0x212217){return db['SquareReport'][_0x66da('0x1a')](_0x4255c6[_0x66da('0x16')],{'raw':_0x4255c6[_0x66da('0x17')]?_0x4255c6[_0x66da('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4255c6['options']?_0x4255c6[_0x66da('0x17')]['where']||null:null,'attributes':_0x4255c6[_0x66da('0x17')]?_0x4255c6[_0x66da('0x17')][_0x66da('0x1b')]||null:null,'limit':_0x4255c6[_0x66da('0x17')]?_0x4255c6['options'][_0x66da('0x1c')]||null:null})[_0x66da('0xa')](function(_0x366595){logger[_0x66da('0xb')]('UpdateSquareReport',_0x4255c6);logger[_0x66da('0xd')](_0x66da('0x1d'),_0x4255c6,JSON['stringify'](_0x366595));_0x927c3e(_0x366595);})['catch'](function(_0x1ff028){logger[_0x66da('0x10')](_0x66da('0x1d'),_0x1ff028[_0x66da('0x13')],_0x4255c6);_0x212217(_0x1c7ddb[_0x66da('0x10')](0x1f4,_0x1ff028[_0x66da('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index cd524e3..edf01a4 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 _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 +var _0xf375=['./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','show','create','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x147b99,_0x5103a4){var _0x367e29=function(_0x3ea7f4){while(--_0x3ea7f4){_0x147b99['push'](_0x147b99['shift']());}};_0x367e29(++_0x5103a4);}(_0xf375,0xd1));var _0x5f37=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf375[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x5f37('0x0'));var util=require(_0x5f37('0x1'));var path=require('path');var timeout=require(_0x5f37('0x2'));var express=require(_0x5f37('0x3'));var router=express[_0x5f37('0x4')]();var fs_extra=require(_0x5f37('0x5'));var auth=require(_0x5f37('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f37('0x7'));router['get']('/',auth[_0x5f37('0x8')](),controller[_0x5f37('0x9')]);router[_0x5f37('0xa')](_0x5f37('0xb'),auth['isAuthenticated'](),controller[_0x5f37('0xc')]);router[_0x5f37('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5f37('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5f37('0xe')]);router['put'](_0x5f37('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x5f37('0x10')](_0x5f37('0xf'),auth[_0x5f37('0x8')](),controller[_0x5f37('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f35140d..90d7e79 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 _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 +var _0xe3b9=['TEXT','sequelize','exports','STRING'];(function(_0x19db4a,_0x39f04d){var _0x274fd4=function(_0x558813){while(--_0x558813){_0x19db4a['push'](_0x19db4a['shift']());}};_0x274fd4(++_0x39f04d);}(_0xe3b9,0x1b9));var _0x9e3b=function(_0x3fad30,_0x46e13a){_0x3fad30=_0x3fad30-0x0;var _0x3e92e9=_0xe3b9[_0x3fad30];return _0x3e92e9;};'use strict';var Sequelize=require(_0x9e3b('0x0'));module[_0x9e3b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9e3b('0x2')]},'application':{'type':Sequelize[_0x9e3b('0x2')]},'data':{'type':Sequelize[_0x9e3b('0x3')]},'project_name':{'type':Sequelize[_0x9e3b('0x2')]},'callerid':{'type':Sequelize[_0x9e3b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6c2ed08..505ba9d 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 _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 +var _0x1a11=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x228960,_0x262175){var _0x24f5ec=function(_0x3dc7f8){while(--_0x3dc7f8){_0x228960['push'](_0x228960['shift']());}};_0x24f5ec(++_0x262175);}(_0x1a11,0x17b));var _0x11a1=function(_0x970261,_0x3dfa10){_0x970261=_0x970261-0x0;var _0x5a2068=_0x1a11[_0x970261];return _0x5a2068;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11a1('0x1'));var rp=require(_0x11a1('0x2'));var moment=require(_0x11a1('0x3'));var BPromise=require(_0x11a1('0x4'));var Mustache=require(_0x11a1('0x5'));var util=require(_0x11a1('0x6'));var path=require(_0x11a1('0x7'));var sox=require(_0x11a1('0x8'));var csv=require(_0x11a1('0x9'));var ejs=require(_0x11a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11a1('0xb'));var squel=require(_0x11a1('0xc'));var crypto=require('crypto');var jsforce=require(_0x11a1('0xd'));var deskjs=require(_0x11a1('0xe'));var toCsv=require(_0x11a1('0x9'));var querystring=require(_0x11a1('0xf'));var Papa=require(_0x11a1('0x10'));var Redis=require(_0x11a1('0x11'));var authService=require(_0x11a1('0x12'));var qs=require(_0x11a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11a1('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x11a1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56329c,_0x3698cf){_0x3698cf=_0x3698cf||0xcc;return function(_0x420bfc){if(_0x420bfc){return _0x56329c['sendStatus'](_0x3698cf);}return _0x56329c['status'](_0x3698cf)[_0x11a1('0x16')]();};}function respondWithResult(_0x239d2d,_0x45b6d7){_0x45b6d7=_0x45b6d7||0xc8;return function(_0x37f799){if(_0x37f799){return _0x239d2d['status'](_0x45b6d7)[_0x11a1('0x17')](_0x37f799);}};}function respondWithFilteredResult(_0x356855,_0x498ef3){return function(_0x30f9be){if(_0x30f9be){var _0x1b9d3c=typeof _0x498ef3[_0x11a1('0x18')]===_0x11a1('0x19')&&typeof _0x498ef3['limit']===_0x11a1('0x19');var _0x114171=_0x30f9be[_0x11a1('0x1a')];var _0xf6290e=_0x1b9d3c?0x0:_0x498ef3['offset'];var _0x5b7fc8=_0x1b9d3c?_0x30f9be['count']:_0x498ef3[_0x11a1('0x18')]+_0x498ef3[_0x11a1('0x1b')];var _0x3d31ec;if(_0x5b7fc8>=_0x114171){_0x5b7fc8=_0x114171;_0x3d31ec=0xc8;}else{_0x3d31ec=0xce;}_0x356855[_0x11a1('0x1c')](_0x3d31ec);return _0x356855[_0x11a1('0x1d')](_0x11a1('0x1e'),_0xf6290e+'-'+_0x5b7fc8+'/'+_0x114171)['json'](_0x30f9be);}return null;};}function patchUpdates(_0x4fd2a1){return function(_0x2d4924){try{jsonpatch[_0x11a1('0x1f')](_0x2d4924,_0x4fd2a1,!![]);}catch(_0x570914){return BPromise[_0x11a1('0x20')](_0x570914);}return _0x2d4924[_0x11a1('0x21')]();};}function saveUpdates(_0x305edd,_0x38de5f){return function(_0x3bdb64){if(_0x3bdb64){return _0x3bdb64['update'](_0x305edd)[_0x11a1('0x22')](function(_0x2169c5){return _0x2169c5;});}return null;};}function removeEntity(_0x25b011,_0x2c45ac){return function(_0x543a2e){if(_0x543a2e){return _0x543a2e[_0x11a1('0x23')]()['then'](function(){_0x25b011[_0x11a1('0x1c')](0xcc)[_0x11a1('0x16')]();});}};}function handleEntityNotFound(_0x481985,_0x4e69e4){return function(_0x5bbd26){if(!_0x5bbd26){_0x481985['sendStatus'](0x194);}return _0x5bbd26;};}function handleError(_0x3f207b,_0x4c7c78){_0x4c7c78=_0x4c7c78||0x1f4;return function(_0x54c961){logger['error'](_0x54c961[_0x11a1('0x24')]);if(_0x54c961[_0x11a1('0x25')]){delete _0x54c961[_0x11a1('0x25')];}_0x3f207b[_0x11a1('0x1c')](_0x4c7c78)[_0x11a1('0x26')](_0x54c961);};}exports[_0x11a1('0x27')]=function(_0x546a1e,_0x679161){var _0x340cd4={},_0x1aa159={},_0x5ac202={'count':0x0,'rows':[]};var _0x5c55a9=_[_0x11a1('0x28')](db[_0x11a1('0x29')][_0x11a1('0x2a')],function(_0x1417ac){return{'name':_0x1417ac[_0x11a1('0x2b')],'type':_0x1417ac[_0x11a1('0x2c')][_0x11a1('0x2d')]};});_0x1aa159['model']=_['map'](_0x5c55a9,_0x11a1('0x25'));_0x1aa159[_0x11a1('0x2e')]=_[_0x11a1('0x2f')](_0x546a1e[_0x11a1('0x2e')]);_0x1aa159[_0x11a1('0x30')]=_[_0x11a1('0x31')](_0x1aa159[_0x11a1('0x32')],_0x1aa159[_0x11a1('0x2e')]);_0x340cd4[_0x11a1('0x33')]=_[_0x11a1('0x31')](_0x1aa159[_0x11a1('0x32')],qs['fields'](_0x546a1e[_0x11a1('0x2e')]['fields']));_0x340cd4[_0x11a1('0x33')]=_0x340cd4[_0x11a1('0x33')][_0x11a1('0x34')]?_0x340cd4[_0x11a1('0x33')]:_0x1aa159[_0x11a1('0x32')];if(!_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x35')](_0x11a1('0x36'))){_0x340cd4[_0x11a1('0x1b')]=qs[_0x11a1('0x1b')](_0x546a1e['query'][_0x11a1('0x1b')]);_0x340cd4['offset']=qs[_0x11a1('0x18')](_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x18')]);}_0x340cd4['order']=qs[_0x11a1('0x37')](_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x37')]);_0x340cd4[_0x11a1('0x38')]=qs[_0x11a1('0x30')](_[_0x11a1('0x39')](_0x546a1e[_0x11a1('0x2e')],_0x1aa159[_0x11a1('0x30')]),_0x5c55a9);if(_0x546a1e['query'][_0x11a1('0x3a')]){_0x340cd4[_0x11a1('0x38')]=_[_0x11a1('0x3b')](_0x340cd4[_0x11a1('0x38')],{'$or':_['map'](_0x5c55a9,function(_0x1a8266){if(_0x1a8266[_0x11a1('0x2c')]!==_0x11a1('0x3c')){var _0x5bc8aa={};_0x5bc8aa[_0x1a8266[_0x11a1('0x25')]]={'$like':'%'+_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x3a')]+'%'};return _0x5bc8aa;}})});}_0x340cd4=_[_0x11a1('0x3b')]({},_0x340cd4,_0x546a1e[_0x11a1('0x3d')]);var _0x3d6c4b={'where':_0x340cd4[_0x11a1('0x38')]};return db[_0x11a1('0x29')]['count'](_0x3d6c4b)[_0x11a1('0x22')](function(_0x24fe8c){_0x5ac202[_0x11a1('0x1a')]=_0x24fe8c;if(_0x546a1e['query'][_0x11a1('0x3e')]){_0x340cd4[_0x11a1('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x340cd4);})[_0x11a1('0x22')](function(_0x2efc18){_0x5ac202[_0x11a1('0x40')]=_0x2efc18;return _0x5ac202;})['then'](respondWithFilteredResult(_0x679161,_0x340cd4))[_0x11a1('0x41')](handleError(_0x679161,null));};exports[_0x11a1('0x42')]=function(_0x267fb5,_0xad5a11){var _0x2fa378={'raw':!![],'where':{'id':_0x267fb5[_0x11a1('0x43')]['id']}},_0xa9c282={};_0xa9c282[_0x11a1('0x32')]=_['keys'](db[_0x11a1('0x29')]['rawAttributes']);_0xa9c282[_0x11a1('0x2e')]=_[_0x11a1('0x2f')](_0x267fb5[_0x11a1('0x2e')]);_0xa9c282[_0x11a1('0x30')]=_[_0x11a1('0x31')](_0xa9c282['model'],_0xa9c282['query']);_0x2fa378[_0x11a1('0x33')]=_[_0x11a1('0x31')](_0xa9c282[_0x11a1('0x32')],qs[_0x11a1('0x44')](_0x267fb5['query'][_0x11a1('0x44')]));_0x2fa378[_0x11a1('0x33')]=_0x2fa378[_0x11a1('0x33')]['length']?_0x2fa378[_0x11a1('0x33')]:_0xa9c282[_0x11a1('0x32')];if(_0x267fb5[_0x11a1('0x2e')][_0x11a1('0x3e')]){_0x2fa378['include']=[{'all':!![]}];}_0x2fa378=_[_0x11a1('0x3b')]({},_0x2fa378,_0x267fb5[_0x11a1('0x3d')]);return db[_0x11a1('0x29')]['find'](_0x2fa378)[_0x11a1('0x22')](handleEntityNotFound(_0xad5a11,null))['then'](respondWithResult(_0xad5a11,null))[_0x11a1('0x41')](handleError(_0xad5a11,null));};exports['create']=function(_0x4afe4f,_0xadef9){return db[_0x11a1('0x29')][_0x11a1('0x45')](_0x4afe4f[_0x11a1('0x46')],{})[_0x11a1('0x22')](respondWithResult(_0xadef9,0xc9))[_0x11a1('0x41')](handleError(_0xadef9,null));};exports['update']=function(_0x5c8f92,_0x3c7e85){if(_0x5c8f92[_0x11a1('0x46')]['id']){delete _0x5c8f92['body']['id'];}return db[_0x11a1('0x29')]['find']({'where':{'id':_0x5c8f92['params']['id']}})[_0x11a1('0x22')](handleEntityNotFound(_0x3c7e85,null))[_0x11a1('0x22')](saveUpdates(_0x5c8f92[_0x11a1('0x46')],null))[_0x11a1('0x22')](respondWithResult(_0x3c7e85,null))[_0x11a1('0x41')](handleError(_0x3c7e85,null));};exports[_0x11a1('0x23')]=function(_0x24b80a,_0x506f76){return db[_0x11a1('0x29')][_0x11a1('0x47')]({'where':{'id':_0x24b80a[_0x11a1('0x43')]['id']}})[_0x11a1('0x22')](handleEntityNotFound(_0x506f76,null))['then'](removeEntity(_0x506f76,null))['catch'](handleError(_0x506f76,null));};exports[_0x11a1('0x48')]=function(_0x1fbd51,_0x50352a){return db[_0x11a1('0x29')][_0x11a1('0x48')]()[_0x11a1('0x22')](respondWithResult(_0x50352a,null))[_0x11a1('0x41')](handleError(_0x50352a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d574cc3..64c9f48 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 _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 +var _0x21c7=['./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0xc7144d,_0x5c332c){var _0x3a4323=function(_0x588d92){while(--_0x588d92){_0xc7144d['push'](_0xc7144d['shift']());}};_0x3a4323(++_0x5c332c);}(_0x21c7,0xb4));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x721c('0x0'));var util=require(_0x721c('0x1'));var logger=require(_0x721c('0x2'))(_0x721c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x721c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x721c('0x5'));var config=require(_0x721c('0x6'));var attributes=require(_0x721c('0x7'));module[_0x721c('0x8')]=function(_0x55de12,_0x391efa){return _0x55de12[_0x721c('0x9')]('SquareDetailsReport',attributes,{'tableName':_0x721c('0xa'),'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 5d810c2..24ae882 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 _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 +var _0xccde=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','create','body','options','raw','debug','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2cf094,_0x2e9087){var _0x8e3eec=function(_0x257876){while(--_0x257876){_0x2cf094['push'](_0x2cf094['shift']());}};_0x8e3eec(++_0x2e9087);}(_0xccde,0x1e1));var _0xeccd=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xccde[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var moment=require(_0xeccd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeccd('0x4'))(_0xeccd('0x5'));var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338742,_0x130f1c,_0x1b622f){return new BPromise(function(_0x1eebfb,_0x4b068e){return client[_0xeccd('0x9')](_0x338742,_0x1b622f)[_0xeccd('0xa')](function(_0x9dccd){logger[_0xeccd('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,'request\x20sent');logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'),JSON[_0xeccd('0xd')](_0x9dccd));if(_0x9dccd[_0xeccd('0xe')]){if(_0x9dccd[_0xeccd('0xe')][_0xeccd('0xf')]===0x1f4){logger['error'](_0xeccd('0x10'),_0x130f1c,_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);return _0x4b068e(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}logger[_0xeccd('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,_0x9dccd['error'][_0xeccd('0x11')]);return _0x1eebfb(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}else{logger[_0xeccd('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'));_0x1eebfb(_0x9dccd[_0xeccd('0x12')]['message']);}})['catch'](function(_0x42e47e){logger[_0xeccd('0xe')](_0xeccd('0x10'),_0x130f1c,_0x42e47e);_0x4b068e(_0x42e47e);});});}exports[_0xeccd('0x13')]=function(_0xb0fad7){var _0x360d25=this;return new Promise(function(_0x466d98,_0x17596a){return db['SquareDetailsReport'][_0xeccd('0x14')](_0xb0fad7[_0xeccd('0x15')],{'raw':_0xb0fad7[_0xeccd('0x16')]?_0xb0fad7[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![]})[_0xeccd('0xa')](function(_0x508439){logger['info']('CreateSquareDetailsReport',_0xb0fad7);logger[_0xeccd('0x18')]('CreateSquareDetailsReport',_0xb0fad7,JSON[_0xeccd('0xd')](_0x508439));_0x466d98(_0x508439);})[_0xeccd('0x19')](function(_0x54083d){logger[_0xeccd('0xe')]('CreateSquareDetailsReport',_0x54083d[_0xeccd('0x11')],_0xb0fad7);_0x17596a(_0x360d25[_0xeccd('0xe')](0x1f4,_0x54083d[_0xeccd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index eae0c22..fabbbd3 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 _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 +var _0x41ea=['./system.controller','get','index','/process/:pid/kill','exports','express','Router','../../components/auth/service'];(function(_0x5dc3e3,_0x172b8e){var _0x32cd73=function(_0x31efb3){while(--_0x31efb3){_0x5dc3e3['push'](_0x5dc3e3['shift']());}};_0x32cd73(++_0x172b8e);}(_0x41ea,0x85));var _0xa41e=function(_0x4a8323,_0x1aecc){_0x4a8323=_0x4a8323-0x0;var _0x4ac909=_0x41ea[_0x4a8323];return _0x4ac909;};'use strict';var express=require(_0xa41e('0x0'));var router=express[_0xa41e('0x1')]();var auth=require(_0xa41e('0x2'));var controller=require(_0xa41e('0x3'));router[_0xa41e('0x4')]('/',auth['isAuthenticated'](),controller[_0xa41e('0x5')]);router[_0xa41e('0x4')](_0xa41e('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0xa41e('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 710fe3f..4bf1672 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 _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 +var _0x37f9=['catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','error','inspect','name','status','index','then','json'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x37f9,0x7a));var _0x937f=function(_0xdf3852,_0x88c1be){_0xdf3852=_0xdf3852-0x0;var _0x44ffe3=_0x37f9[_0xdf3852];return _0x44ffe3;};'use strict';var info=require(_0x937f('0x0'));var exec=require(_0x937f('0x1'))['exec'];var logger=require(_0x937f('0x2'))('api');var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x17fb04,_0x4f02cf,_0x31043b){_0x4f02cf=_0x4f02cf||0x1f4;return function(_0xc010f4){logger[_0x937f('0x3')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x31043b,_0x4f02cf,util[_0x937f('0x4')](_0xc010f4,{'showHidden':![],'depth':null}));delete _0xc010f4[_0x937f('0x5')];_0x17fb04[_0x937f('0x6')](_0x4f02cf)['send'](_0xc010f4);};}exports[_0x937f('0x7')]=function(_0x20552b,_0x1691f1){return info['getAllData']()[_0x937f('0x8')](function(_0x223087){return _0x1691f1[_0x937f('0x6')](0xc8)[_0x937f('0x9')](_0x223087);})[_0x937f('0xa')](function(_0x551bb6){return _0x1691f1[_0x937f('0x6')](0x1f4)[_0x937f('0x9')](_0x551bb6);});};exports['killProcess']=function(_0x1b8ef6,_0x59e8da){var _0x2f7b55=[_0x937f('0xb')];return new BPromise(function(_0x1d8d23,_0x50001c){return exec(util[_0x937f('0xc')](_0x937f('0xd'),_0x1b8ef6['params'][_0x937f('0xe')]),function(_0x4dd264,_0x97ecb3,_0x2bd741){if(_0x4dd264){return _0x50001c(_0x4dd264);}return _0x1d8d23(_0x97ecb3);});})[_0x937f('0x8')](function(_0x36790d){var _0xc25d7c=![];var _0x1be344=_0x36790d[_0x937f('0xf')](/\n/);for(var _0x4d4b3e=0x0,_0x31c98f=_0x2f7b55['length'];_0x4d4b3e<_0x31c98f,_0xc25d7c===![];_0x4d4b3e+=0x1){if(_0x36790d[_0x937f('0x10')](_0x2f7b55[_0x4d4b3e])>=0x0){_0xc25d7c=!![];}}if(!_0xc25d7c){throw new Error(util['format'](_0x937f('0x11'),_0x1b8ef6[_0x937f('0x12')][_0x937f('0xe')]));}process[_0x937f('0x13')](_0x1b8ef6[_0x937f('0x12')][_0x937f('0xe')],'SIGINT');return _0x59e8da[_0x937f('0x6')](0xc8)['json']({'message':util['format'](_0x937f('0x14'),_0x1b8ef6[_0x937f('0x12')][_0x937f('0xe')])});})[_0x937f('0xa')](handleError(_0x59e8da,null,_0x937f('0x15')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 0c5cba1..ce588e8 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 _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 +var _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./tag.controller','get','isAuthenticated','index'];(function(_0x535963,_0x326515){var _0x3975f6=function(_0x2e624f){while(--_0x2e624f){_0x535963['push'](_0x535963['shift']());}};_0x3975f6(++_0x326515);}(_0x0e85,0x7c));var _0x50e8=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x0e85[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3c560ae..09e86f2 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 _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 +var _0xc893=['STRING','#0091EA','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc893,0x194));var _0x3c89=function(_0x52f4dd,_0x20e395){_0x52f4dd=_0x52f4dd-0x0;var _0x17f16a=_0xc893[_0x52f4dd];return _0x17f16a;};'use strict';var Sequelize=require('sequelize');module[_0x3c89('0x0')]={'name':{'type':Sequelize[_0x3c89('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x3c89('0x2')},'description':{'type':Sequelize[_0x3c89('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3c5ce3f..682c452 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 _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 +var _0xcf79=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','show','Tag','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','fieldName','type'];(function(_0x3703a5,_0xbaf317){var _0xdd9d92=function(_0x41f1de){while(--_0x41f1de){_0x3703a5['push'](_0x3703a5['shift']());}};_0xdd9d92(++_0xbaf317);}(_0xcf79,0x73));var _0x9cf7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcf79[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x9cf7('0x0'));var rimraf=require(_0x9cf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cf7('0x2'));var rp=require('request-promise');var moment=require(_0x9cf7('0x3'));var BPromise=require(_0x9cf7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cf7('0x5'));var csv=require(_0x9cf7('0x6'));var ejs=require(_0x9cf7('0x7'));var fs=require('fs');var fs_extra=require(_0x9cf7('0x8'));var _=require('lodash');var squel=require(_0x9cf7('0x9'));var crypto=require(_0x9cf7('0xa'));var jsforce=require(_0x9cf7('0xb'));var deskjs=require(_0x9cf7('0xc'));var toCsv=require(_0x9cf7('0x6'));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(_0x9cf7('0xd'));var hardwareService=require(_0x9cf7('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9cf7('0xf'));var licenseUtil=require(_0x9cf7('0x10'));var db=require(_0x9cf7('0x11'))['db'];function respondWithStatusCode(_0x1d8f0d,_0x4b6d94){_0x4b6d94=_0x4b6d94||0xcc;return function(_0x1779e6){if(_0x1779e6){return _0x1d8f0d[_0x9cf7('0x12')](_0x4b6d94);}return _0x1d8f0d[_0x9cf7('0x13')](_0x4b6d94)[_0x9cf7('0x14')]();};}function respondWithResult(_0x46a130,_0x28a6f4){_0x28a6f4=_0x28a6f4||0xc8;return function(_0x24f59f){if(_0x24f59f){return _0x46a130[_0x9cf7('0x13')](_0x28a6f4)[_0x9cf7('0x15')](_0x24f59f);}};}function respondWithFilteredResult(_0x1cfc22,_0x39c36c){return function(_0x31ec07){if(_0x31ec07){var _0x277422=typeof _0x39c36c['offset']===_0x9cf7('0x16')&&typeof _0x39c36c[_0x9cf7('0x17')]===_0x9cf7('0x16');var _0x4f0f28=_0x31ec07[_0x9cf7('0x18')];var _0x5718cf=_0x277422?0x0:_0x39c36c[_0x9cf7('0x19')];var _0x1bbd6e=_0x277422?_0x31ec07['count']:_0x39c36c[_0x9cf7('0x19')]+_0x39c36c[_0x9cf7('0x17')];var _0x588d92;if(_0x1bbd6e>=_0x4f0f28){_0x1bbd6e=_0x4f0f28;_0x588d92=0xc8;}else{_0x588d92=0xce;}_0x1cfc22[_0x9cf7('0x13')](_0x588d92);return _0x1cfc22[_0x9cf7('0x1a')](_0x9cf7('0x1b'),_0x5718cf+'-'+_0x1bbd6e+'/'+_0x4f0f28)[_0x9cf7('0x15')](_0x31ec07);}return null;};}function patchUpdates(_0x1d2865){return function(_0x4cdcc4){try{jsonpatch[_0x9cf7('0x1c')](_0x4cdcc4,_0x1d2865,!![]);}catch(_0x4d83a2){return BPromise['reject'](_0x4d83a2);}return _0x4cdcc4[_0x9cf7('0x1d')]();};}function saveUpdates(_0x40c983,_0x32c33b){return function(_0x3c013d){if(_0x3c013d){return _0x3c013d[_0x9cf7('0x1e')](_0x40c983)[_0x9cf7('0x1f')](function(_0x11a627){return _0x11a627;});}return null;};}function removeEntity(_0x59a539,_0x543d8d){return function(_0x3aa000){if(_0x3aa000){return _0x3aa000[_0x9cf7('0x20')]()[_0x9cf7('0x1f')](function(){var _0x5587f0=_0x3aa000[_0x9cf7('0x21')]({'plain':!![]});var _0x2955d8='Tags';return db[_0x9cf7('0x22')][_0x9cf7('0x20')]({'where':{'type':_0x2955d8,'resourceId':_0x5587f0['id']}})['then'](function(){return _0x3aa000;});})[_0x9cf7('0x1f')](function(){_0x59a539['status'](0xcc)[_0x9cf7('0x14')]();});}};}function handleEntityNotFound(_0x2df803,_0x353497){return function(_0x2b8baa){if(!_0x2b8baa){_0x2df803[_0x9cf7('0x12')](0x194);}return _0x2b8baa;};}function handleError(_0x11037b,_0x57436f){_0x57436f=_0x57436f||0x1f4;return function(_0x3a0afa){logger[_0x9cf7('0x23')](_0x3a0afa[_0x9cf7('0x24')]);if(_0x3a0afa[_0x9cf7('0x25')]){delete _0x3a0afa['name'];}_0x11037b[_0x9cf7('0x13')](_0x57436f)['send'](_0x3a0afa);};}exports['index']=function(_0x59e16f,_0x26d2d9){var _0x43dcf4={},_0x3b2dcf={},_0x5bd8dd={'count':0x0,'rows':[]};var _0x48fe25=_[_0x9cf7('0x26')](db['Tag']['rawAttributes'],function(_0x151645){return{'name':_0x151645[_0x9cf7('0x27')],'type':_0x151645[_0x9cf7('0x28')]['key']};});_0x3b2dcf[_0x9cf7('0x29')]=_[_0x9cf7('0x26')](_0x48fe25,_0x9cf7('0x25'));_0x3b2dcf[_0x9cf7('0x2a')]=_[_0x9cf7('0x2b')](_0x59e16f['query']);_0x3b2dcf[_0x9cf7('0x2c')]=_[_0x9cf7('0x2d')](_0x3b2dcf[_0x9cf7('0x29')],_0x3b2dcf[_0x9cf7('0x2a')]);_0x43dcf4[_0x9cf7('0x2e')]=_[_0x9cf7('0x2d')](_0x3b2dcf[_0x9cf7('0x29')],qs[_0x9cf7('0x2f')](_0x59e16f[_0x9cf7('0x2a')]['fields']));_0x43dcf4[_0x9cf7('0x2e')]=_0x43dcf4['attributes'][_0x9cf7('0x30')]?_0x43dcf4['attributes']:_0x3b2dcf[_0x9cf7('0x29')];if(!_0x59e16f[_0x9cf7('0x2a')][_0x9cf7('0x31')]('nolimit')){_0x43dcf4[_0x9cf7('0x17')]=qs[_0x9cf7('0x17')](_0x59e16f[_0x9cf7('0x2a')][_0x9cf7('0x17')]);_0x43dcf4[_0x9cf7('0x19')]=qs['offset'](_0x59e16f[_0x9cf7('0x2a')][_0x9cf7('0x19')]);}_0x43dcf4[_0x9cf7('0x32')]=qs['sort'](_0x59e16f['query'][_0x9cf7('0x33')]);_0x43dcf4['where']=qs[_0x9cf7('0x2c')](_[_0x9cf7('0x34')](_0x59e16f['query'],_0x3b2dcf[_0x9cf7('0x2c')]),_0x48fe25);if(_0x59e16f['query'][_0x9cf7('0x35')]){_0x43dcf4['where']=_[_0x9cf7('0x36')](_0x43dcf4[_0x9cf7('0x37')],{'$or':_['map'](_0x48fe25,function(_0x5116ae){if(_0x5116ae[_0x9cf7('0x28')]!==_0x9cf7('0x38')){var _0x509b15={};_0x509b15[_0x5116ae[_0x9cf7('0x25')]]={'$like':'%'+_0x59e16f['query'][_0x9cf7('0x35')]+'%'};return _0x509b15;}})});}_0x43dcf4=_[_0x9cf7('0x36')]({},_0x43dcf4,_0x59e16f[_0x9cf7('0x39')]);var _0x3a19db={'where':_0x43dcf4[_0x9cf7('0x37')]};return db['Tag'][_0x9cf7('0x18')](_0x3a19db)[_0x9cf7('0x1f')](function(_0x37a8f5){_0x5bd8dd[_0x9cf7('0x18')]=_0x37a8f5;if(_0x59e16f[_0x9cf7('0x2a')]['includeAll']){_0x43dcf4['include']=[{'all':!![]}];}return db['Tag'][_0x9cf7('0x3a')](_0x43dcf4);})[_0x9cf7('0x1f')](function(_0x1bef4c){_0x5bd8dd[_0x9cf7('0x3b')]=_0x1bef4c;return _0x5bd8dd;})[_0x9cf7('0x1f')](respondWithFilteredResult(_0x26d2d9,_0x43dcf4))['catch'](handleError(_0x26d2d9,null));};exports[_0x9cf7('0x3c')]=function(_0x151f7,_0x4815ea){var _0x5cd71d={'raw':!![],'where':{'id':_0x151f7['params']['id']}},_0x31216b={};_0x31216b[_0x9cf7('0x29')]=_[_0x9cf7('0x2b')](db[_0x9cf7('0x3d')][_0x9cf7('0x3e')]);_0x31216b[_0x9cf7('0x2a')]=_[_0x9cf7('0x2b')](_0x151f7['query']);_0x31216b['filters']=_[_0x9cf7('0x2d')](_0x31216b[_0x9cf7('0x29')],_0x31216b[_0x9cf7('0x2a')]);_0x5cd71d[_0x9cf7('0x2e')]=_[_0x9cf7('0x2d')](_0x31216b[_0x9cf7('0x29')],qs[_0x9cf7('0x2f')](_0x151f7[_0x9cf7('0x2a')][_0x9cf7('0x2f')]));_0x5cd71d['attributes']=_0x5cd71d[_0x9cf7('0x2e')][_0x9cf7('0x30')]?_0x5cd71d[_0x9cf7('0x2e')]:_0x31216b[_0x9cf7('0x29')];if(_0x151f7[_0x9cf7('0x2a')][_0x9cf7('0x3f')]){_0x5cd71d[_0x9cf7('0x40')]=[{'all':!![]}];}_0x5cd71d=_['merge']({},_0x5cd71d,_0x151f7[_0x9cf7('0x39')]);return db[_0x9cf7('0x3d')][_0x9cf7('0x41')](_0x5cd71d)[_0x9cf7('0x1f')](handleEntityNotFound(_0x4815ea,null))[_0x9cf7('0x1f')](respondWithResult(_0x4815ea,null))['catch'](handleError(_0x4815ea,null));};exports[_0x9cf7('0x42')]=function(_0x2015e5,_0x124e44){return db[_0x9cf7('0x3d')]['create'](_0x2015e5[_0x9cf7('0x43')],{})['then'](function(_0x526878){var _0x579234=_0x2015e5[_0x9cf7('0x44')][_0x9cf7('0x21')]({'plain':!![]});if(!_0x579234)throw new Error(_0x9cf7('0x45'));if(_0x579234[_0x9cf7('0x46')]===_0x9cf7('0x44')){var _0x5cdf8e=_0x526878[_0x9cf7('0x21')]({'plain':!![]});var _0x524075='Tags';return db[_0x9cf7('0x47')][_0x9cf7('0x41')]({'where':{'name':_0x524075,'userProfileId':_0x579234[_0x9cf7('0x48')]},'raw':!![]})[_0x9cf7('0x1f')](function(_0x2dd9d5){if(_0x2dd9d5&&_0x2dd9d5[_0x9cf7('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x5cdf8e['name'],'resourceId':_0x5cdf8e['id'],'type':_0x2dd9d5[_0x9cf7('0x25')],'sectionId':_0x2dd9d5['id']},{})[_0x9cf7('0x1f')](function(){return _0x526878;});}else{return _0x526878;}})[_0x9cf7('0x4a')](function(_0xc50ad){logger[_0x9cf7('0x23')](_0x9cf7('0x4b'),_0xc50ad);throw _0xc50ad;});}return _0x526878;})[_0x9cf7('0x1f')](respondWithResult(_0x124e44,0xc9))[_0x9cf7('0x4a')](handleError(_0x124e44,null));};exports['update']=function(_0x493d49,_0x565161){if(_0x493d49['body']['id']){delete _0x493d49[_0x9cf7('0x43')]['id'];}return db[_0x9cf7('0x3d')][_0x9cf7('0x41')]({'where':{'id':_0x493d49['params']['id']}})['then'](handleEntityNotFound(_0x565161,null))[_0x9cf7('0x1f')](saveUpdates(_0x493d49[_0x9cf7('0x43')],null))['then'](respondWithResult(_0x565161,null))['catch'](handleError(_0x565161,null));};exports['destroy']=function(_0x381139,_0xdd251c){return db[_0x9cf7('0x3d')][_0x9cf7('0x41')]({'where':{'id':_0x381139[_0x9cf7('0x4c')]['id']}})[_0x9cf7('0x1f')](handleEntityNotFound(_0xdd251c,null))[_0x9cf7('0x1f')](removeEntity(_0xdd251c,null))[_0x9cf7('0x4a')](handleError(_0xdd251c,null));};exports[_0x9cf7('0x4d')]=function(_0x44879f,_0x3a2f87){return db['Tag'][_0x9cf7('0x4d')]()[_0x9cf7('0x1f')](respondWithResult(_0x3a2f87,null))[_0x9cf7('0x4a')](handleError(_0x3a2f87,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index bbfe02a..254ee75 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 _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 +var _0x7d98=['moment','request-promise','./tag.attributes','exports','Tag','lodash','../../config/logger','api'];(function(_0x429be8,_0x12c1bd){var _0xae578a=function(_0x573902){while(--_0x573902){_0x429be8['push'](_0x429be8['shift']());}};_0xae578a(++_0x12c1bd);}(_0x7d98,0x75));var _0x87d9=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x7d98[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));var moment=require(_0x87d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x87d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x87d9('0x5'));module[_0x87d9('0x6')]=function(_0x2bc9fd,_0x23a797){return _0x2bc9fd['define'](_0x87d9('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 4008f1d..bf6d830 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 _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 +var _0xb647=['request','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x3545b2,_0x1b5535){var _0x4056bf=function(_0x557823){while(--_0x557823){_0x3545b2['push'](_0x3545b2['shift']());}};_0x4056bf(++_0x1b5535);}(_0xb647,0xdb));var _0x7b64=function(_0x46321f,_0xf8b0b0){_0x46321f=_0x46321f-0x0;var _0x42f002=_0xb647[_0x46321f];return _0x42f002;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var moment=require(_0x7b64('0x2'));var BPromise=require(_0x7b64('0x3'));var rs=require(_0x7b64('0x4'));var fs=require('fs');var Redis=require(_0x7b64('0x5'));var db=require(_0x7b64('0x6'))['db'];var utils=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var jayson=require(_0x7b64('0x9'));var client=jayson[_0x7b64('0xa')][_0x7b64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x80721a,_0xcdec41,_0x22eca3){return new BPromise(function(_0x727684,_0x2ff650){return client[_0x7b64('0xc')](_0x80721a,_0x22eca3)['then'](function(_0x1b8b2a){logger['info'](_0x7b64('0xd'),_0xcdec41,'request\x20sent');logger['debug'](_0x7b64('0xe'),_0xcdec41,_0x7b64('0xf'),JSON['stringify'](_0x1b8b2a));if(_0x1b8b2a[_0x7b64('0x10')]){if(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x11')]===0x1f4){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x2ff650(_0x1b8b2a['error'][_0x7b64('0x12')]);}logger['error']('Tag,\x20%s,\x20%s',_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x727684(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);}else{logger[_0x7b64('0x13')](_0x7b64('0xd'),_0xcdec41,_0x7b64('0xf'));_0x727684(_0x1b8b2a['result'][_0x7b64('0x12')]);}})[_0x7b64('0x14')](function(_0x16ff72){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x16ff72);_0x2ff650(_0x16ff72);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index fe2097e..911481f 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 1004e2c..214a0e2 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 _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 +var _0xd8b0=['exports','sequelize'];(function(_0xc1d1d3,_0x14747f){var _0x2e2abe=function(_0x2b3e5a){while(--_0x2b3e5a){_0xc1d1d3['push'](_0xc1d1d3['shift']());}};_0x2e2abe(++_0x14747f);}(_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 417a054..41d8f67 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 _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 +var _0xf90b=['moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','error','stack','name','send','index','map','Team','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','then','catch','show','params','rawAttributes','length','find','create','body','user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','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','UserWhatsappQueue','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','options','Queues','isValidChannel','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','get','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','VoicePrefixId','isArray','Whatsapp','removeAgents','Queue:remove','TeamVoicePrefix','order','getAgents','eml-format','rimraf','zip-dir','request-promise'];(function(_0x2a2ab1,_0x12b676){var _0x113b6d=function(_0x337df1){while(--_0x337df1){_0x2a2ab1['push'](_0x2a2ab1['shift']());}};_0x113b6d(++_0x12b676);}(_0xf90b,0x99));var _0xbf90=function(_0x17ba33,_0x331b6e){_0x17ba33=_0x17ba33-0x0;var _0x4cdc93=_0xf90b[_0x17ba33];return _0x4cdc93;};'use strict';var emlformat=require(_0xbf90('0x0'));var rimraf=require(_0xbf90('0x1'));var zipdir=require(_0xbf90('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf90('0x3'));var moment=require(_0xbf90('0x4'));var BPromise=require(_0xbf90('0x5'));var Mustache=require(_0xbf90('0x6'));var util=require(_0xbf90('0x7'));var path=require(_0xbf90('0x8'));var sox=require('sox');var csv=require(_0xbf90('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf90('0xa'));var _=require('lodash');var squel=require(_0xbf90('0xb'));var crypto=require(_0xbf90('0xc'));var jsforce=require(_0xbf90('0xd'));var deskjs=require(_0xbf90('0xe'));var toCsv=require(_0xbf90('0x9'));var querystring=require(_0xbf90('0xf'));var Papa=require(_0xbf90('0x10'));var Redis=require(_0xbf90('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf90('0x12'));var hardwareService=require(_0xbf90('0x13'));var logger=require(_0xbf90('0x14'))(_0xbf90('0x15'));var utils=require(_0xbf90('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf90('0x17'))['db'];config[_0xbf90('0x18')]=_[_0xbf90('0x19')](config[_0xbf90('0x18')],{'host':_0xbf90('0x1a'),'port':0x18eb});var socket=require(_0xbf90('0x1b'))(new Redis(config[_0xbf90('0x18')]));require(_0xbf90('0x1c'))[_0xbf90('0x1d')](socket);function respondWithStatusCode(_0x3e0a0d,_0x22bbd9){_0x22bbd9=_0x22bbd9||0xcc;return function(_0x55f60b){if(_0x55f60b){return _0x3e0a0d[_0xbf90('0x1e')](_0x22bbd9);}return _0x3e0a0d[_0xbf90('0x1f')](_0x22bbd9)[_0xbf90('0x20')]();};}function respondWithResult(_0x1e4119,_0x5597e8){_0x5597e8=_0x5597e8||0xc8;return function(_0x227501){if(_0x227501){return _0x1e4119[_0xbf90('0x1f')](_0x5597e8)['json'](_0x227501);}};}function respondWithFilteredResult(_0x1655fb,_0x331680){return function(_0x513702){if(_0x513702){var _0x3c8713=typeof _0x331680['offset']===_0xbf90('0x21')&&typeof _0x331680[_0xbf90('0x22')]==='undefined';var _0x406b90=_0x513702[_0xbf90('0x23')];var _0x5eb593=_0x3c8713?0x0:_0x331680[_0xbf90('0x24')];var _0x437821=_0x3c8713?_0x513702[_0xbf90('0x23')]:_0x331680[_0xbf90('0x24')]+_0x331680[_0xbf90('0x22')];var _0x1d09bd;if(_0x437821>=_0x406b90){_0x437821=_0x406b90;_0x1d09bd=0xc8;}else{_0x1d09bd=0xce;}_0x1655fb['status'](_0x1d09bd);return _0x1655fb[_0xbf90('0x25')](_0xbf90('0x26'),_0x5eb593+'-'+_0x437821+'/'+_0x406b90)[_0xbf90('0x27')](_0x513702);}return null;};}function patchUpdates(_0x64c601){return function(_0x47ce2c){try{jsonpatch[_0xbf90('0x28')](_0x47ce2c,_0x64c601,!![]);}catch(_0x4b2ad3){return BPromise[_0xbf90('0x29')](_0x4b2ad3);}return _0x47ce2c[_0xbf90('0x2a')]();};}function saveUpdates(_0x46ee74,_0x59a9e0){return function(_0xb09ce7){if(_0xb09ce7){return _0xb09ce7['update'](_0x46ee74)['then'](function(_0x35842c){return _0x35842c;});}return null;};}function handleEntityNotFound(_0x3ec0e0,_0x481c3d){return function(_0x1c57ce){if(!_0x1c57ce){_0x3ec0e0[_0xbf90('0x1e')](0x194);}return _0x1c57ce;};}function handleError(_0x3fd91d,_0x28581e){_0x28581e=_0x28581e||0x1f4;return function(_0x55e76d){logger[_0xbf90('0x2b')](_0x55e76d[_0xbf90('0x2c')]);if(_0x55e76d[_0xbf90('0x2d')]){delete _0x55e76d[_0xbf90('0x2d')];}_0x3fd91d['status'](_0x28581e)[_0xbf90('0x2e')](_0x55e76d);};}exports[_0xbf90('0x2f')]=function(_0x228d98,_0x101f54){var _0x5d943b={},_0x2a970e={},_0x437c12={'count':0x0,'rows':[]};var _0x4a314d=_[_0xbf90('0x30')](db[_0xbf90('0x31')]['rawAttributes'],function(_0x14ef41){return{'name':_0x14ef41['fieldName'],'type':_0x14ef41['type'][_0xbf90('0x32')]};});_0x2a970e[_0xbf90('0x33')]=_['map'](_0x4a314d,_0xbf90('0x2d'));_0x2a970e['query']=_[_0xbf90('0x34')](_0x228d98['query']);_0x2a970e[_0xbf90('0x35')]=_[_0xbf90('0x36')](_0x2a970e[_0xbf90('0x33')],_0x2a970e['query']);_0x5d943b[_0xbf90('0x37')]=_['intersection'](_0x2a970e[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x228d98[_0xbf90('0x39')][_0xbf90('0x38')]));_0x5d943b[_0xbf90('0x37')]=_0x5d943b[_0xbf90('0x37')]['length']?_0x5d943b[_0xbf90('0x37')]:_0x2a970e[_0xbf90('0x33')];if(!_0x228d98['query'][_0xbf90('0x3a')](_0xbf90('0x3b'))){_0x5d943b[_0xbf90('0x22')]=qs['limit'](_0x228d98[_0xbf90('0x39')]['limit']);_0x5d943b[_0xbf90('0x24')]=qs['offset'](_0x228d98[_0xbf90('0x39')][_0xbf90('0x24')]);}_0x5d943b['order']=qs[_0xbf90('0x3c')](_0x228d98[_0xbf90('0x39')][_0xbf90('0x3c')]);_0x5d943b[_0xbf90('0x3d')]=qs[_0xbf90('0x35')](_[_0xbf90('0x3e')](_0x228d98[_0xbf90('0x39')],_0x2a970e['filters']),_0x4a314d);if(_0x228d98[_0xbf90('0x39')][_0xbf90('0x3f')]){_0x5d943b[_0xbf90('0x3d')]=_[_0xbf90('0x40')](_0x5d943b[_0xbf90('0x3d')],{'$or':_[_0xbf90('0x30')](_0x4a314d,function(_0x24904a){if(_0x24904a['type']!=='VIRTUAL'){var _0x498a5f={};_0x498a5f[_0x24904a[_0xbf90('0x2d')]]={'$like':'%'+_0x228d98[_0xbf90('0x39')][_0xbf90('0x3f')]+'%'};return _0x498a5f;}})});}_0x5d943b=_[_0xbf90('0x40')]({},_0x5d943b,_0x228d98['options']);var _0x1283b5={'where':_0x5d943b[_0xbf90('0x3d')]};return db['Team'][_0xbf90('0x23')](_0x1283b5)['then'](function(_0x5d3a66){_0x437c12[_0xbf90('0x23')]=_0x5d3a66;if(_0x228d98[_0xbf90('0x39')][_0xbf90('0x41')]){_0x5d943b[_0xbf90('0x42')]=[{'all':!![]}];}return db[_0xbf90('0x31')][_0xbf90('0x43')](_0x5d943b);})[_0xbf90('0x44')](function(_0x2109ca){_0x437c12['rows']=_0x2109ca;return _0x437c12;})[_0xbf90('0x44')](respondWithFilteredResult(_0x101f54,_0x5d943b))[_0xbf90('0x45')](handleError(_0x101f54,null));};exports[_0xbf90('0x46')]=function(_0x30efbe,_0x151ad5){var _0x7d5946={'raw':![],'where':{'id':_0x30efbe[_0xbf90('0x47')]['id']}},_0x6c93a1={};_0x6c93a1[_0xbf90('0x33')]=_[_0xbf90('0x34')](db['Team'][_0xbf90('0x48')]);_0x6c93a1[_0xbf90('0x39')]=_['keys'](_0x30efbe[_0xbf90('0x39')]);_0x6c93a1['filters']=_['intersection'](_0x6c93a1[_0xbf90('0x33')],_0x6c93a1[_0xbf90('0x39')]);_0x7d5946[_0xbf90('0x37')]=_['intersection'](_0x6c93a1[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x30efbe['query'][_0xbf90('0x38')]));_0x7d5946[_0xbf90('0x37')]=_0x7d5946[_0xbf90('0x37')][_0xbf90('0x49')]?_0x7d5946[_0xbf90('0x37')]:_0x6c93a1[_0xbf90('0x33')];if(_0x30efbe[_0xbf90('0x39')][_0xbf90('0x41')]){_0x7d5946[_0xbf90('0x42')]=[{'all':!![]}];}_0x7d5946=_[_0xbf90('0x40')]({},_0x7d5946,_0x30efbe['options']);return db[_0xbf90('0x31')][_0xbf90('0x4a')](_0x7d5946)[_0xbf90('0x44')](handleEntityNotFound(_0x151ad5,null))[_0xbf90('0x44')](respondWithResult(_0x151ad5,null))[_0xbf90('0x45')](handleError(_0x151ad5,null));};exports[_0xbf90('0x4b')]=function(_0x16465a,_0x2192d4){return db[_0xbf90('0x31')][_0xbf90('0x4b')](_0x16465a[_0xbf90('0x4c')],{})[_0xbf90('0x44')](function(_0x16d9b2){var _0x304e5b=_0x16465a[_0xbf90('0x4d')]['get']({'plain':!![]});if(!_0x304e5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x304e5b[_0xbf90('0x4e')]===_0xbf90('0x4d')){var _0x3d89b1=_0x16d9b2['get']({'plain':!![]});var _0x1f2d1b=_0xbf90('0x4f');return db[_0xbf90('0x50')][_0xbf90('0x4a')]({'where':{'name':_0x1f2d1b,'userProfileId':_0x304e5b[_0xbf90('0x51')]},'raw':!![]})[_0xbf90('0x44')](function(_0x1da88c){if(_0x1da88c&&_0x1da88c[_0xbf90('0x52')]===0x0){return db[_0xbf90('0x53')][_0xbf90('0x4b')]({'name':_0x3d89b1['name'],'resourceId':_0x3d89b1['id'],'type':_0x1da88c['name'],'sectionId':_0x1da88c['id']},{})[_0xbf90('0x44')](function(){return _0x16d9b2;});}else{return _0x16d9b2;}})[_0xbf90('0x45')](function(_0x50e8ed){logger[_0xbf90('0x2b')](_0xbf90('0x54'),_0x50e8ed);throw _0x50e8ed;});}return _0x16d9b2;})[_0xbf90('0x44')](respondWithResult(_0x2192d4,0xc9))[_0xbf90('0x45')](handleError(_0x2192d4,null));};exports['update']=function(_0x3ee3dd,_0xb847fb){if(_0x3ee3dd[_0xbf90('0x4c')]['id']){delete _0x3ee3dd[_0xbf90('0x4c')]['id'];}return db[_0xbf90('0x31')][_0xbf90('0x4a')]({'where':{'id':_0x3ee3dd['params']['id']}})[_0xbf90('0x44')](handleEntityNotFound(_0xb847fb,null))[_0xbf90('0x44')](saveUpdates(_0x3ee3dd['body'],null))['then'](respondWithResult(_0xb847fb,null))[_0xbf90('0x45')](handleError(_0xb847fb,null));};exports[_0xbf90('0x55')]=function(_0x29815c,_0x1e6f15){var _0x37ab44=_0x29815c[_0xbf90('0x47')]['id'];var _0x228eaf=[];return db[_0xbf90('0x56')]['transaction'](function(_0x1bd10b){var _0x427564='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x427564,{'type':db[_0xbf90('0x57')]['QueryTypes'][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b})[_0xbf90('0x44')](function(_0x37fd47){_0x228eaf=_[_0xbf90('0x30')](_0x37fd47,function(_0x3a1499){return Number(_0x3a1499[_0xbf90('0x59')]);});})[_0xbf90('0x44')](function(){var _0x369ba1=_0xbf90('0x5a')+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x369ba1,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x3f102d){var _0x394e03=_[_0xbf90('0x30')](_0x3f102d,function(_0x49ec43){return Number(_0x49ec43[_0xbf90('0x5c')]);});return db['UserVoiceQueue'][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'VoiceQueueId':{'$in':_0x394e03}},'transaction':_0x1bd10b});})['then'](function(){var _0x275f33=_0xbf90('0x5d')+_0x37ab44;return db[_0xbf90('0x56')]['query'](_0x275f33,{'type':db[_0xbf90('0x57')]['QueryTypes'][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})['then'](function(_0x265d97){var _0x5d266e=_[_0xbf90('0x30')](_0x265d97,function(_0x48b3c9){return Number(_0x48b3c9[_0xbf90('0x5e')]);});return db[_0xbf90('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x228eaf},'MailQueueId':{'$in':_0x5d266e}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x1c4e68=_0xbf90('0x60')+_0x37ab44;return db[_0xbf90('0x56')]['query'](_0x1c4e68,{'type':db[_0xbf90('0x57')]['QueryTypes'][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x373fb6){var _0x5c7354=_[_0xbf90('0x30')](_0x373fb6,function(_0x17465d){return Number(_0x17465d[_0xbf90('0x61')]);});return db[_0xbf90('0x62')][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'SmsQueueId':{'$in':_0x5c7354}},'transaction':_0x1bd10b});})['then'](function(){var _0x456980=_0xbf90('0x63')+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x456980,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x4ad683){var _0x4785f1=_[_0xbf90('0x30')](_0x4ad683,function(_0x218537){return Number(_0x218537[_0xbf90('0x64')]);});return db[_0xbf90('0x65')]['destroy']({'where':{'UserId':{'$in':_0x228eaf},'ChatQueueId':{'$in':_0x4785f1}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x3fb63c=_0xbf90('0x66')+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x3fb63c,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})['then'](function(_0x9e9049){var _0x443a62=_[_0xbf90('0x30')](_0x9e9049,function(_0x5cc50a){return Number(_0x5cc50a[_0xbf90('0x67')]);});return db['UserFaxQueue'][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'FaxQueueId':{'$in':_0x443a62}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x25fed4='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x25fed4,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x373a85){var _0x5070e0=_[_0xbf90('0x30')](_0x373a85,function(_0x38bf6b){return Number(_0x38bf6b[_0xbf90('0x68')]);});return db[_0xbf90('0x69')][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'OpenchannelQueueId':{'$in':_0x5070e0}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x24724a=_0xbf90('0x6a')+_0x37ab44;return db['sequelize'][_0xbf90('0x39')](_0x24724a,{'type':db['Sequelize'][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})['then'](function(_0x42f847){var _0x4891c8=_['map'](_0x42f847,function(_0x472592){return Number(_0x472592[_0xbf90('0x6b')]);});return db[_0xbf90('0x6c')][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'WhatsappQueueId':{'$in':_0x4891c8}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x37ab44}});})['then'](function(_0x4345ff){if(_0x4345ff===null){return;}return db['UserVoicePrefix'][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'VoicePrefixId':_0x4345ff['VoicePrefixId']},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){return db[_0xbf90('0x31')][_0xbf90('0x55')]({'where':{'id':_0x37ab44},'cascade':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x42280d){if(_0x42280d===0x0){_0x1e6f15[_0xbf90('0x1e')](0x194);}else{return db[_0xbf90('0x53')]['destroy']({'where':{'type':'Teams','resourceId':_0x37ab44},'cascade':!![],'transaction':_0x1bd10b})['then'](function(){_0x1e6f15[_0xbf90('0x1f')](0xcc)[_0xbf90('0x20')]();});}})['catch'](function(_0x41cf07){_0x1e6f15[_0xbf90('0x1f')](0x1f4)['send'](_0x41cf07);});});};exports[_0xbf90('0x6d')]=function(_0x12efcf,_0x10d89e,_0x47ebd3){return db[_0xbf90('0x31')][_0xbf90('0x6e')]({'where':{'id':_0x12efcf[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](handleEntityNotFound(_0x10d89e,null))[_0xbf90('0x44')](function(_0x27c877){if(!_0x12efcf[_0xbf90('0x39')]['channel']||!utils['isValidChannel'](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x6f')])){throw new db[(_0xbf90('0x57'))][(_0xbf90('0x70'))](_0xbf90('0x71'));}var _0x4ae288={};var _0x263fca={};_0x263fca[_0xbf90('0x33')]=_[_0xbf90('0x34')](db[_[_0xbf90('0x72')](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x6f')][_0xbf90('0x73')]())+'Queue']['rawAttributes']);_0x263fca[_0xbf90('0x39')]=_['keys'](_0x12efcf[_0xbf90('0x39')]);_0x263fca[_0xbf90('0x35')]=_[_0xbf90('0x36')](_0x263fca['model'],_0x263fca['query']);_0x4ae288[_0xbf90('0x37')]=_[_0xbf90('0x36')](_0x263fca[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x12efcf['query']['fields']));_0x4ae288['attributes']=_0x4ae288[_0xbf90('0x37')][_0xbf90('0x49')]?_0x4ae288[_0xbf90('0x37')]:_0x263fca[_0xbf90('0x33')];_0x4ae288[_0xbf90('0x22')]=qs[_0xbf90('0x22')](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x22')]);_0x4ae288[_0xbf90('0x24')]=qs[_0xbf90('0x24')](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x24')]);_0x4ae288['order']=qs['sort'](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x3c')]);_0x4ae288[_0xbf90('0x3d')]=qs[_0xbf90('0x35')](_[_0xbf90('0x3e')](_0x12efcf[_0xbf90('0x39')],_0x263fca[_0xbf90('0x35')]));_0x4ae288=_['merge']({},_0x4ae288,_0x12efcf[_0xbf90('0x74')]);return _0x27c877['get'+_['capitalize'](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x6f')][_0xbf90('0x73')]())+_0xbf90('0x75')](_0x4ae288);})[_0xbf90('0x44')](respondWithResult(_0x10d89e,null))[_0xbf90('0x45')](handleError(_0x10d89e,null));};exports['addQueues']=function(_0x562a43,_0x172b0e,_0x54dda8){return db[_0xbf90('0x31')][_0xbf90('0x6e')]({'where':{'id':_0x562a43[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](function(_0xaf7929){if(_0xaf7929){if(!_0x562a43[_0xbf90('0x4c')]['channel']||!utils[_0xbf90('0x76')](_0x562a43['body'][_0xbf90('0x6f')])){throw new db[(_0xbf90('0x57'))][(_0xbf90('0x70'))](_0xbf90('0x71'));}return _0xaf7929['add'+_[_0xbf90('0x72')](_0x562a43['body'][_0xbf90('0x6f')][_0xbf90('0x73')]())+_0xbf90('0x75')](_0x562a43[_0xbf90('0x4c')][_0xbf90('0x77')]);}return null;})[_0xbf90('0x44')](handleEntityNotFound(_0x172b0e,null))['then'](respondWithStatusCode(_0x172b0e,null))['catch'](handleError(_0x172b0e,null));};exports[_0xbf90('0x78')]=function(_0x28846c,_0x20410f,_0x11c096){return db[_0xbf90('0x31')]['findOne']({'where':{'id':_0x28846c[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](function(_0x4c2139){if(_0x4c2139){if(!_0x28846c[_0xbf90('0x39')][_0xbf90('0x6f')]||!utils[_0xbf90('0x76')](_0x28846c[_0xbf90('0x39')]['channel'])){throw new db[(_0xbf90('0x57'))][(_0xbf90('0x70'))](_0xbf90('0x71'));}return _0x4c2139[_0xbf90('0x79')+_[_0xbf90('0x72')](_0x28846c[_0xbf90('0x39')][_0xbf90('0x6f')][_0xbf90('0x73')]())+_0xbf90('0x75')](_0x28846c['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x20410f,null))[_0xbf90('0x44')](respondWithStatusCode(_0x20410f,null))[_0xbf90('0x45')](handleError(_0x20410f,null));};exports[_0xbf90('0x7a')]=function(_0x15527e,_0x3311b5){var _0x31b72f=_['isArray'](_0x15527e[_0xbf90('0x4c')][_0xbf90('0x77')])?_0x15527e[_0xbf90('0x4c')][_0xbf90('0x77')]:[_0x15527e['body']['ids']];var _0x5a18b6=_0x15527e['params']['id'];return db[_0xbf90('0x31')][_0xbf90('0x4a')]({'where':{'id':_0x5a18b6}})['then'](handleEntityNotFound(_0x3311b5,null))[_0xbf90('0x44')](function(_0x3a71a7){if(_0x3a71a7){var _0x54fc3e=[_0xbf90('0x7b'),_0xbf90('0x7c'),_0xbf90('0x7d'),_0xbf90('0x7e'),_0xbf90('0x7f'),_0xbf90('0x80'),'Whatsapp'];return db[_0xbf90('0x56')]['transaction'](function(_0xcccec0){var _0x99cc83=_[_0xbf90('0x30')](_0x54fc3e,function(_0x48ea9f){var _0x283998={'attributes':['id',_0xbf90('0x2d')]};if(_0x48ea9f==='Voice'){_0x283998[_0xbf90('0x81')]={'attributes':[_0xbf90('0x82')]};}return _0x3a71a7[_0xbf90('0x83')+_0x48ea9f+_0xbf90('0x75')](_0x283998)[_0xbf90('0x44')](function(_0x1f32fc){var _0x12ccda=_[_0xbf90('0x30')](_0x1f32fc,function(_0x51f17e){var _0xb3a438=_['map'](_0x31b72f,function(_0xd9c27c){var _0x2e2eb6={'where':{'UserId':_0xd9c27c,[_0x48ea9f+_0xbf90('0x84')]:_0x51f17e['id']},'transaction':_0xcccec0};if(_0x48ea9f==='Voice'){_0x2e2eb6[_0xbf90('0x19')]={'penalty':_0x51f17e[_0xbf90('0x85')][_0xbf90('0x82')]};}return db[_0xbf90('0x86')+_0x48ea9f+_0xbf90('0x87')][_0xbf90('0x88')](_0x2e2eb6)[_0xbf90('0x44')](function(){socket[_0xbf90('0x89')](_0xbf90('0x4d')+_0x48ea9f+_0xbf90('0x8a'),{'UserId':_0xd9c27c,[_0x48ea9f+'QueueId']:_0x51f17e['id']});if(_0x48ea9f!==_0xbf90('0x7b')){return;}return db['User'][_0xbf90('0x43')]({'where':{'id':_0x31b72f,'online':0x1},'attributes':['id',_0xbf90('0x2d'),_0xbf90('0x8b'),_0xbf90('0x8c'),_0xbf90('0x8d')],'raw':!![]})[_0xbf90('0x44')](function(_0x42a8f5){var _0x1bb5b0=_[_0xbf90('0x30')](_0x42a8f5,function(_0x46c650){return db[_0xbf90('0x8e')][_0xbf90('0x8f')]({'membername':_0x46c650[_0xbf90('0x2d')],'UserId':_0x46c650['id'],'queue_name':_0x51f17e[_0xbf90('0x2d')],'VoiceQueueId':_0x51f17e['id'],'interface':_[_0xbf90('0x90')](_0x46c650[_0xbf90('0x8d')])?util[_0xbf90('0x91')](_0xbf90('0x92'),_0x46c650[_0xbf90('0x2d')]):_0x46c650[_0xbf90('0x8d')],'paused':_0x46c650[_0xbf90('0x8c')]||![],'penalty':_0x51f17e[_0xbf90('0x85')][_0xbf90('0x82')]},{'transaction':_0xcccec0});});return Promise['all'](_0x1bb5b0);});});});return Promise[_0xbf90('0x93')](_0xb3a438);});return Promise[_0xbf90('0x93')](_0x12ccda);})[_0xbf90('0x44')](function(){return db['TeamVoicePrefix'][_0xbf90('0x6e')]({'where':{'teamId':_0x5a18b6}})[_0xbf90('0x44')](function(_0x438266){if(_0x438266){var _0x555340=_[_0xbf90('0x30')](_0x31b72f,function(_0x5b176a){db[_0xbf90('0x94')][_0xbf90('0x8f')]({'UserId':_0x5b176a,'VoicePrefixId':_0x438266[_0xbf90('0x95')]});});return Promise[_0xbf90('0x93')](_0x555340);}});});});return Promise[_0xbf90('0x93')](_0x99cc83)[_0xbf90('0x44')](function(){return _0x3a71a7[_0xbf90('0x7a')](_0x31b72f,{'transaction':_0xcccec0})['spread'](function(_0x4ee217){return _0x4ee217;});});});}})[_0xbf90('0x44')](respondWithResult(_0x3311b5,null))[_0xbf90('0x45')](handleError(_0x3311b5,null));};exports['removeAgents']=function(_0x43ff38,_0x3262f0){var _0x197a6d=_[_0xbf90('0x96')](_0x43ff38[_0xbf90('0x39')][_0xbf90('0x77')])?_0x43ff38[_0xbf90('0x39')][_0xbf90('0x77')]:[_0x43ff38[_0xbf90('0x39')][_0xbf90('0x77')]];var _0x4b0321=_0x43ff38[_0xbf90('0x47')]['id'];return db[_0xbf90('0x31')][_0xbf90('0x4a')]({'where':{'id':_0x4b0321}})[_0xbf90('0x44')](handleEntityNotFound(_0x3262f0,null))[_0xbf90('0x44')](function(_0x350d46){if(_0x350d46){var _0x28de53=[_0xbf90('0x7b'),_0xbf90('0x7c'),_0xbf90('0x7d'),_0xbf90('0x7e'),_0xbf90('0x7f'),_0xbf90('0x80'),_0xbf90('0x97')];return db[_0xbf90('0x56')]['transaction'](function(_0xed1898){var _0x2f58ab=_['map'](_0x28de53,function(_0x423bb1){var _0x90041c={'attributes':['id',_0xbf90('0x2d')]};return _0x350d46[_0xbf90('0x83')+_0x423bb1+_0xbf90('0x75')](_0x90041c)['then'](function(_0x14262c){var _0xc544e3=_[_0xbf90('0x30')](_0x14262c,function(_0x310f05){return _0x310f05[_0xbf90('0x98')](_0x197a6d,{'transaction':_0xed1898})[_0xbf90('0x44')](function(){var _0x3d04f1=_[_0xbf90('0x30')](_0x197a6d,function(_0x26be3a){socket[_0xbf90('0x89')]('user'+_0x423bb1+_0xbf90('0x99'),{'UserId':Number(_0x26be3a),[_0x423bb1+_0xbf90('0x84')]:_0x310f05['id']});if(_0x423bb1!==_0xbf90('0x7b')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x310f05['id'],'UserId':_0x26be3a},'transaction':_0xed1898});});return Promise[_0xbf90('0x93')](_0x3d04f1);});});return Promise[_0xbf90('0x93')](_0xc544e3);});});return Promise[_0xbf90('0x93')](_0x2f58ab)[_0xbf90('0x44')](function(){return _0x350d46[_0xbf90('0x98')](_0x197a6d,{'transaction':_0xed1898});})['then'](function(){return db[_0xbf90('0x9a')]['findOne']({'where':{'teamId':_0x4b0321}})[_0xbf90('0x44')](function(_0x463537){if(_0x463537){var _0x1cdbdc=_[_0xbf90('0x30')](_0x197a6d,function(_0x349c8e){db[_0xbf90('0x94')]['destroy']({'where':{'UserId':_0x349c8e,'VoicePrefixId':_0x463537['VoicePrefixId']}});});return Promise['all'](_0x1cdbdc);}});});});}})[_0xbf90('0x44')](respondWithStatusCode(_0x3262f0,null))[_0xbf90('0x45')](handleError(_0x3262f0,null));};exports['getAgents']=function(_0x37a374,_0x26775e,_0x584ab9){var _0x3a24b1={};var _0x5e015a={};var _0x10f528;var _0x1418c0;return db['Team'][_0xbf90('0x6e')]({'where':{'id':_0x37a374[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](handleEntityNotFound(_0x26775e,null))['then'](function(_0x3f2d51){if(_0x3f2d51){_0x10f528=_0x3f2d51;_0x5e015a[_0xbf90('0x33')]=_['keys'](db['User'][_0xbf90('0x48')]);_0x5e015a['query']=_[_0xbf90('0x34')](_0x37a374[_0xbf90('0x39')]);_0x5e015a['filters']=_['intersection'](_0x5e015a[_0xbf90('0x33')],_0x5e015a['query']);_0x3a24b1[_0xbf90('0x37')]=_[_0xbf90('0x36')](_0x5e015a[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x38')]));_0x3a24b1['attributes']=_0x3a24b1[_0xbf90('0x37')][_0xbf90('0x49')]?_0x3a24b1['attributes']:_0x5e015a[_0xbf90('0x33')];_0x3a24b1[_0xbf90('0x9b')]=qs[_0xbf90('0x3c')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x3c')]);_0x3a24b1[_0xbf90('0x3d')]=qs['filters'](_['pick'](_0x37a374[_0xbf90('0x39')],_0x5e015a[_0xbf90('0x35')]));if(_0x37a374[_0xbf90('0x39')][_0xbf90('0x3f')]){_0x3a24b1[_0xbf90('0x3d')]=_[_0xbf90('0x40')](_0x3a24b1[_0xbf90('0x3d')],{'$or':_[_0xbf90('0x30')](_0x3a24b1[_0xbf90('0x37')],function(_0x4bc157){var _0x2947d3={};_0x2947d3[_0x4bc157]={'$like':'%'+_0x37a374[_0xbf90('0x39')][_0xbf90('0x3f')]+'%'};return _0x2947d3;})});}_0x3a24b1=_[_0xbf90('0x40')]({},_0x3a24b1,_0x37a374['options']);return _0x10f528['getAgents'](_0x3a24b1);}})[_0xbf90('0x44')](function(_0x40dab4){if(_0x40dab4){_0x1418c0=_0x40dab4[_0xbf90('0x49')];if(!_0x37a374[_0xbf90('0x39')][_0xbf90('0x3a')](_0xbf90('0x3b'))){_0x3a24b1[_0xbf90('0x22')]=qs[_0xbf90('0x22')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x22')]);_0x3a24b1[_0xbf90('0x24')]=qs[_0xbf90('0x24')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x24')]);}return _0x10f528[_0xbf90('0x9c')](_0x3a24b1);}})['then'](function(_0xf4ff66){if(_0xf4ff66){return _0xf4ff66?{'count':_0x1418c0,'rows':_0xf4ff66}:null;}})[_0xbf90('0x44')](respondWithResult(_0x26775e,null))['catch'](handleError(_0x26775e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 49653be..fb8e6ca 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 _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 +var _0xd61a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x3b17ac,_0x2232bc){var _0x16cacc=function(_0x4ba380){while(--_0x4ba380){_0x3b17ac['push'](_0x3b17ac['shift']());}};_0x16cacc(++_0x2232bc);}(_0xd61a,0x1eb));var _0xad61=function(_0x24c14e,_0x55fc09){_0x24c14e=_0x24c14e-0x0;var _0x589035=_0xd61a[_0x24c14e];return _0x589035;};'use strict';var EventEmitter=require(_0xad61('0x0'));var Team=require(_0xad61('0x1'))['db'][_0xad61('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xad61('0x3')](0x0);var events={'afterCreate':_0xad61('0x4'),'afterUpdate':_0xad61('0x5'),'afterDestroy':_0xad61('0x6')};function emitEvent(_0x8fba69){return function(_0x282a04,_0x429a26,_0xb3aeb0){TeamEvents[_0xad61('0x7')](_0x8fba69+':'+_0x282a04['id'],_0x282a04);TeamEvents[_0xad61('0x7')](_0x8fba69,_0x282a04);_0xb3aeb0(null);};}for(var e in events){if(events[_0xad61('0x8')](e)){var event=events[e];Team[_0xad61('0x9')](e,emitEvent(event));}}module[_0xad61('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index de082f2..598ac75 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 _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 +var _0xe68b=['map','setDataValue','channel','catch','exports','Team','teams','Fax','Voice','Whatsapp','then','all','./team.attributes','get','Queues'];(function(_0x24f107,_0x3c6c88){var _0x5116ab=function(_0x2b4985){while(--_0x2b4985){_0x24f107['push'](_0x24f107['shift']());}};_0x5116ab(++_0x3c6c88);}(_0xe68b,0x165));var _0xbe68=function(_0x30bc1f,_0xaa2a4a){_0x30bc1f=_0x30bc1f-0x0;var _0x176de3=_0xe68b[_0x30bc1f];return _0x176de3;};'use strict';var _=require('lodash');var attributes=require(_0xbe68('0x0'));function getQueuesByChannel(_0x3fd072,_0x5d4c93){var _0x2c54ba=_0xbe68('0x1')+_0x5d4c93+_0xbe68('0x2');return _0x3fd072[_0x2c54ba]()['then'](function(_0x4c928f){return _[_0xbe68('0x3')](_0x4c928f,function(_0x2fcea8){_0x2fcea8[_0xbe68('0x4')](_0xbe68('0x5'),_0x5d4c93);return _0x2fcea8;});})[_0xbe68('0x6')](function(_0x3c9a5f){throw _0x3c9a5f;});}module[_0xbe68('0x7')]=function(_0x39df4d){return _0x39df4d['define'](_0xbe68('0x8'),attributes,{'tableName':_0xbe68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1a8d8b=this;var _0xa0b006=['Chat',_0xbe68('0xa'),'Mail','Openchannel','Sms',_0xbe68('0xb'),_0xbe68('0xc')];return Promise['resolve']()[_0xbe68('0xd')](function(){var _0x195caf=_[_0xbe68('0x3')](_0xa0b006,function(_0x272c3a){return getQueuesByChannel(_0x1a8d8b,_0x272c3a);});return Promise[_0xbe68('0xe')](_0x195caf);})['catch'](function(_0x16f738){throw _0x16f738;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 99d5e83..d57c4f5 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 _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 +var _0xa95d=['lodash','util','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x2b8ebe,_0x4d4c78){var _0x536480=function(_0x3379fb){while(--_0x3379fb){_0x2b8ebe['push'](_0x2b8ebe['shift']());}};_0x536480(++_0x4d4c78);}(_0xa95d,0xb8));var _0xda95=function(_0x4d1ce8,_0x1a778e){_0x4d1ce8=_0x4d1ce8-0x0;var _0x129384=_0xa95d[_0x4d1ce8];return _0x129384;};'use strict';var _=require(_0xda95('0x0'));var util=require(_0xda95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xda95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xda95('0x3'));var logger=require(_0xda95('0x4'))(_0xda95('0x5'));var config=require('../../config/environment');var jayson=require(_0xda95('0x6'));var client=jayson[_0xda95('0x7')][_0xda95('0x8')]({'port':0x232a});config[_0xda95('0x9')]=_['defaults'](config['redis'],{'host':_0xda95('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda95('0x9')]));require(_0xda95('0xb'))[_0xda95('0xc')](socket);function respondWithRpcPromise(_0x51743f,_0x14aa74,_0x1667b1){return new BPromise(function(_0x1f9444,_0x13108a){return client[_0xda95('0xd')](_0x51743f,_0x1667b1)[_0xda95('0xe')](function(_0x30bc5e){logger['info'](_0xda95('0xf'),_0x14aa74,_0xda95('0x10'));logger[_0xda95('0x11')](_0xda95('0x12'),_0x14aa74,'request\x20sent',JSON['stringify'](_0x30bc5e));if(_0x30bc5e[_0xda95('0x13')]){if(_0x30bc5e[_0xda95('0x13')][_0xda95('0x14')]===0x1f4){logger[_0xda95('0x13')](_0xda95('0xf'),_0x14aa74,_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);return _0x13108a(_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);}logger['error']('Team,\x20%s,\x20%s',_0x14aa74,_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);return _0x1f9444(_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);}else{logger[_0xda95('0x16')]('Team,\x20%s,\x20%s',_0x14aa74,_0xda95('0x10'));_0x1f9444(_0x30bc5e['result'][_0xda95('0x15')]);}})['catch'](function(_0x485923){logger[_0xda95('0x13')](_0xda95('0xf'),_0x14aa74,_0x485923);_0x13108a(_0x485923);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d40c632..4066a4d 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 _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 +var _0x70f9=['removeListener','register','length','team:','remove','update'];(function(_0x51401d,_0x3f6d69){var _0x5651a9=function(_0xd35984){while(--_0xd35984){_0x51401d['push'](_0x51401d['shift']());}};_0x5651a9(++_0x3f6d69);}(_0x70f9,0x14e));var _0x970f=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x70f9[_0x710815];return _0x5b3b89;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x970f('0x0'),_0x970f('0x1')];function createListener(_0x36648e,_0x5339cd){return function(_0xaf70c9){_0x5339cd['emit'](_0x36648e,_0xaf70c9);};}function removeListener(_0x3265ad,_0x5a3196){return function(){TeamEvents[_0x970f('0x2')](_0x3265ad,_0x5a3196);};}exports[_0x970f('0x3')]=function(_0x27d07a){for(var _0x570d56=0x0,_0x1ba95f=events[_0x970f('0x4')];_0x570d56<_0x1ba95f;_0x570d56++){var _0x23a131=events[_0x570d56];var _0x39c068=createListener(_0x970f('0x5')+_0x23a131,_0x27d07a);TeamEvents['on'](_0x23a131,_0x39c068);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0965625..7a0e029 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 _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 +var _0x4fef=['INTEGER','sequelize','exports'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x4fef,0x10f));var _0xf4fe=function(_0x4a6a53,_0x1c68bd){_0x4a6a53=_0x4a6a53-0x0;var _0x28beee=_0x4fef[_0x4a6a53];return _0x28beee;};'use strict';var Sequelize=require(_0xf4fe('0x0'));module[_0xf4fe('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf4fe('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index ab00af9..d5fb80a 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 _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 +var _0xb09d=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x2d4290,_0x39514c){var _0x3d6902=function(_0x45c399){while(--_0x45c399){_0x2d4290['push'](_0x2d4290['shift']());}};_0x3d6902(++_0x39514c);}(_0xb09d,0xed));var _0xdb09=function(_0x1a2908,_0x44db3a){_0x1a2908=_0x1a2908-0x0;var _0x4ed05c=_0xb09d[_0x1a2908];return _0x4ed05c;};'use strict';var _=require(_0xdb09('0x0'));var util=require(_0xdb09('0x1'));var logger=require(_0xdb09('0x2'))(_0xdb09('0x3'));var moment=require(_0xdb09('0x4'));var BPromise=require(_0xdb09('0x5'));var rp=require(_0xdb09('0x6'));var fs=require('fs');var path=require(_0xdb09('0x7'));var rimraf=require('rimraf');var config=require(_0xdb09('0x8'));var attributes=require(_0xdb09('0x9'));module[_0xdb09('0xa')]=function(_0xd2e98f,_0x181d74){return _0xd2e98f[_0xdb09('0xb')](_0xdb09('0xc'),attributes,{'tableName':_0xdb09('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 5d35f63..13b742b 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 _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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x235ad6,_0x5e4437){var _0x2885d9=function(_0x3e55ba){while(--_0x3e55ba){_0x235ad6['push'](_0x235ad6['shift']());}};_0x2885d9(++_0x5e4437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 914f06c..0255620 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 _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 +var _0xcd59=['INTEGER','sequelize','exports'];(function(_0x4d3cf6,_0x533fe5){var _0x1a13f9=function(_0x1bd491){while(--_0x1bd491){_0x4d3cf6['push'](_0x4d3cf6['shift']());}};_0x1a13f9(++_0x533fe5);}(_0xcd59,0x14b));var _0x9cd5=function(_0x23c651,_0x143982){_0x23c651=_0x23c651-0x0;var _0xbe7bdb=_0xcd59[_0x23c651];return _0xbe7bdb;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'penalty':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 37dfdac..b92c1cb 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 _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 +var _0x402f=['exports','define','TeamVoiceQueue','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x36abd4,_0x541c66){var _0x193d37=function(_0x12c8af){while(--_0x12c8af){_0x36abd4['push'](_0x36abd4['shift']());}};_0x193d37(++_0x541c66);}(_0x402f,0x6f));var _0xf402=function(_0x1910cc,_0x44014b){_0x1910cc=_0x1910cc-0x0;var _0x135b43=_0x402f[_0x1910cc];return _0x135b43;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var logger=require(_0xf402('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf402('0x2'));var rp=require(_0xf402('0x3'));var fs=require('fs');var path=require(_0xf402('0x4'));var rimraf=require('rimraf');var config=require(_0xf402('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0xf402('0x6')]=function(_0x270766,_0x3a1d11){return _0x270766[_0xf402('0x7')](_0xf402('0x8'),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 e9f9ba3..171aeae 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 _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 +var _0xf31a=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','then'];(function(_0x2f2948,_0x29670e){var _0x3fec51=function(_0x43b5be){while(--_0x43b5be){_0x2f2948['push'](_0x2f2948['shift']());}};_0x3fec51(++_0x29670e);}(_0xf31a,0xaa));var _0xaf31=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf31a[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require(_0xaf31('0x0'));var moment=require(_0xaf31('0x1'));var BPromise=require(_0xaf31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf31('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf31('0x4'))(_0xaf31('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf31('0x6')][_0xaf31('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f2da3,_0x1ce3bf,_0xc89c79){return new BPromise(function(_0x501641,_0x1efd02){return client[_0xaf31('0x8')](_0x3f2da3,_0xc89c79)[_0xaf31('0x9')](function(_0x1949f7){logger[_0xaf31('0xa')](_0xaf31('0xb'),_0x1ce3bf,_0xaf31('0xc'));logger['debug'](_0xaf31('0xd'),_0x1ce3bf,_0xaf31('0xc'),JSON[_0xaf31('0xe')](_0x1949f7));if(_0x1949f7[_0xaf31('0xf')]){if(_0x1949f7['error'][_0xaf31('0x10')]===0x1f4){logger[_0xaf31('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x1efd02(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}logger[_0xaf31('0xf')](_0xaf31('0xb'),_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x501641(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}else{logger[_0xaf31('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1ce3bf,_0xaf31('0xc'));_0x501641(_0x1949f7[_0xaf31('0x12')][_0xaf31('0x11')]);}})[_0xaf31('0x13')](function(_0x2b3e42){logger['error'](_0xaf31('0xb'),_0x1ce3bf,_0x2b3e42);_0x1efd02(_0x2b3e42);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 180c3d5..79b3bcc 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 _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 +var _0xed20=['isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2e9341,_0x530359){var _0x2bc2e4=function(_0x5c3c35){while(--_0x5c3c35){_0x2e9341['push'](_0x2e9341['shift']());}};_0x2bc2e4(++_0x530359);}(_0xed20,0xce));var _0x0ed2=function(_0x15fc8c,_0x207742){_0x15fc8c=_0x15fc8c-0x0;var _0x205ba4=_0xed20[_0x15fc8c];return _0x205ba4;};'use strict';var multer=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var path=require(_0x0ed2('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ed2('0x3'));var router=express[_0x0ed2('0x4')]();var fs_extra=require(_0x0ed2('0x5'));var auth=require(_0x0ed2('0x6'));var interaction=require(_0x0ed2('0x7'));var config=require(_0x0ed2('0x8'));var controller=require('./template.controller');router[_0x0ed2('0x9')]('/',auth[_0x0ed2('0xa')](),controller['index']);router[_0x0ed2('0x9')](_0x0ed2('0xb'),auth[_0x0ed2('0xa')](),controller[_0x0ed2('0xc')]);router['post']('/',auth[_0x0ed2('0xa')](),controller[_0x0ed2('0xd')]);router[_0x0ed2('0xe')](_0x0ed2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0ed2('0xf')](_0x0ed2('0xb'),auth[_0x0ed2('0xa')](),controller[_0x0ed2('0x10')]);module[_0x0ed2('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f9788c0..9734ff0 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 _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 +var _0x26f9=['TEXT','sequelize','exports','STRING'];(function(_0xdc31de,_0x351c71){var _0x539a73=function(_0x5e78b1){while(--_0x5e78b1){_0xdc31de['push'](_0xdc31de['shift']());}};_0x539a73(++_0x351c71);}(_0x26f9,0x10d));var _0x926f=function(_0x59c1be,_0xba160a){_0x59c1be=_0x59c1be-0x0;var _0x47c031=_0x26f9[_0x59c1be];return _0x47c031;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'name':{'type':Sequelize[_0x926f('0x2')]},'description':{'type':Sequelize[_0x926f('0x2')]},'html':{'type':Sequelize[_0x926f('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0788d00..5407214 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 _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 +var _0xe5ca=['status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe5ca,0xe9));var _0xae5c=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0xe5ca[_0x5c78d9];return _0x69ae1f;};'use strict';var emlformat=require(_0xae5c('0x0'));var rimraf=require(_0xae5c('0x1'));var zipdir=require(_0xae5c('0x2'));var jsonpatch=require(_0xae5c('0x3'));var rp=require(_0xae5c('0x4'));var moment=require(_0xae5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae5c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xae5c('0x7'));var csv=require(_0xae5c('0x8'));var ejs=require(_0xae5c('0x9'));var fs=require('fs');var fs_extra=require(_0xae5c('0xa'));var _=require(_0xae5c('0xb'));var squel=require(_0xae5c('0xc'));var crypto=require(_0xae5c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xae5c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xae5c('0xf'));var Papa=require(_0xae5c('0x10'));var Redis=require(_0xae5c('0x11'));var authService=require(_0xae5c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xae5c('0x13'));var hardwareService=require(_0xae5c('0x14'));var logger=require(_0xae5c('0x15'))(_0xae5c('0x16'));var utils=require(_0xae5c('0x17'));var config=require(_0xae5c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xae5c('0x19'))['db'];function respondWithStatusCode(_0x3b3af3,_0x247ba8){_0x247ba8=_0x247ba8||0xcc;return function(_0x4a8a6d){if(_0x4a8a6d){return _0x3b3af3[_0xae5c('0x1a')](_0x247ba8);}return _0x3b3af3['status'](_0x247ba8)[_0xae5c('0x1b')]();};}function respondWithResult(_0x28eb4a,_0x13efb8){_0x13efb8=_0x13efb8||0xc8;return function(_0x47daa8){if(_0x47daa8){return _0x28eb4a[_0xae5c('0x1c')](_0x13efb8)[_0xae5c('0x1d')](_0x47daa8);}};}function respondWithFilteredResult(_0x41282c,_0x373b2f){return function(_0xe2a184){if(_0xe2a184){var _0x1f2bb4=typeof _0x373b2f[_0xae5c('0x1e')]===_0xae5c('0x1f')&&typeof _0x373b2f[_0xae5c('0x20')]==='undefined';var _0x176156=_0xe2a184['count'];var _0x10ac18=_0x1f2bb4?0x0:_0x373b2f[_0xae5c('0x1e')];var _0x13d1c5=_0x1f2bb4?_0xe2a184['count']:_0x373b2f[_0xae5c('0x1e')]+_0x373b2f[_0xae5c('0x20')];var _0x518039;if(_0x13d1c5>=_0x176156){_0x13d1c5=_0x176156;_0x518039=0xc8;}else{_0x518039=0xce;}_0x41282c['status'](_0x518039);return _0x41282c[_0xae5c('0x21')](_0xae5c('0x22'),_0x10ac18+'-'+_0x13d1c5+'/'+_0x176156)[_0xae5c('0x1d')](_0xe2a184);}return null;};}function patchUpdates(_0x2e96b5){return function(_0x5efb14){try{jsonpatch['apply'](_0x5efb14,_0x2e96b5,!![]);}catch(_0x8158c1){return BPromise[_0xae5c('0x23')](_0x8158c1);}return _0x5efb14[_0xae5c('0x24')]();};}function saveUpdates(_0x506728,_0x65824b){return function(_0x491cd8){if(_0x491cd8){return _0x491cd8[_0xae5c('0x25')](_0x506728)[_0xae5c('0x26')](function(_0x1fead7){return _0x1fead7;});}return null;};}function removeEntity(_0x1abaf7,_0x492161){return function(_0x5df0e6){if(_0x5df0e6){return _0x5df0e6[_0xae5c('0x27')]()[_0xae5c('0x26')](function(){var _0xffdf78=_0x5df0e6[_0xae5c('0x28')]({'plain':!![]});var _0x573d1c=_0xae5c('0x29');return db[_0xae5c('0x2a')][_0xae5c('0x27')]({'where':{'type':_0x573d1c,'resourceId':_0xffdf78['id']}})[_0xae5c('0x26')](function(){return _0x5df0e6;});})['then'](function(){_0x1abaf7[_0xae5c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f5a9,_0x3ecd8b){return function(_0x1bdb0c){if(!_0x1bdb0c){_0x50f5a9[_0xae5c('0x1a')](0x194);}return _0x1bdb0c;};}function handleError(_0x301f95,_0x2eb776){_0x2eb776=_0x2eb776||0x1f4;return function(_0x343111){logger[_0xae5c('0x2b')](_0x343111[_0xae5c('0x2c')]);if(_0x343111[_0xae5c('0x2d')]){delete _0x343111['name'];}_0x301f95[_0xae5c('0x1c')](_0x2eb776)[_0xae5c('0x2e')](_0x343111);};}exports[_0xae5c('0x2f')]=function(_0x4ce274,_0x527cb7){var _0x3905b5={},_0x291e57={},_0x126976={'count':0x0,'rows':[]};var _0xfea033=_[_0xae5c('0x30')](db[_0xae5c('0x31')][_0xae5c('0x32')],function(_0xd52567){return{'name':_0xd52567[_0xae5c('0x33')],'type':_0xd52567[_0xae5c('0x34')]['key']};});_0x291e57[_0xae5c('0x35')]=_[_0xae5c('0x30')](_0xfea033,'name');_0x291e57[_0xae5c('0x36')]=_['keys'](_0x4ce274[_0xae5c('0x36')]);_0x291e57['filters']=_[_0xae5c('0x37')](_0x291e57[_0xae5c('0x35')],_0x291e57[_0xae5c('0x36')]);_0x3905b5[_0xae5c('0x38')]=_[_0xae5c('0x37')](_0x291e57[_0xae5c('0x35')],qs['fields'](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x39')]));_0x3905b5['attributes']=_0x3905b5[_0xae5c('0x38')][_0xae5c('0x3a')]?_0x3905b5[_0xae5c('0x38')]:_0x291e57[_0xae5c('0x35')];if(!_0x4ce274[_0xae5c('0x36')][_0xae5c('0x3b')](_0xae5c('0x3c'))){_0x3905b5[_0xae5c('0x20')]=qs[_0xae5c('0x20')](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x20')]);_0x3905b5[_0xae5c('0x1e')]=qs[_0xae5c('0x1e')](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x1e')]);}_0x3905b5[_0xae5c('0x3d')]=qs[_0xae5c('0x3e')](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x3e')]);_0x3905b5[_0xae5c('0x3f')]=qs[_0xae5c('0x40')](_['pick'](_0x4ce274[_0xae5c('0x36')],_0x291e57[_0xae5c('0x40')]),_0xfea033);if(_0x4ce274[_0xae5c('0x36')][_0xae5c('0x41')]){_0x3905b5[_0xae5c('0x3f')]=_[_0xae5c('0x42')](_0x3905b5[_0xae5c('0x3f')],{'$or':_['map'](_0xfea033,function(_0x518e94){if(_0x518e94[_0xae5c('0x34')]!==_0xae5c('0x43')){var _0x7f04e3={};_0x7f04e3[_0x518e94[_0xae5c('0x2d')]]={'$like':'%'+_0x4ce274[_0xae5c('0x36')][_0xae5c('0x41')]+'%'};return _0x7f04e3;}})});}_0x3905b5=_['merge']({},_0x3905b5,_0x4ce274[_0xae5c('0x44')]);var _0x554353={'where':_0x3905b5[_0xae5c('0x3f')]};return db['Template']['count'](_0x554353)[_0xae5c('0x26')](function(_0x13b850){_0x126976[_0xae5c('0x45')]=_0x13b850;if(_0x4ce274[_0xae5c('0x36')][_0xae5c('0x46')]){_0x3905b5[_0xae5c('0x47')]=[{'all':!![]}];}return db[_0xae5c('0x31')][_0xae5c('0x48')](_0x3905b5);})['then'](function(_0x13f521){_0x126976[_0xae5c('0x49')]=_0x13f521;return _0x126976;})[_0xae5c('0x26')](respondWithFilteredResult(_0x527cb7,_0x3905b5))[_0xae5c('0x4a')](handleError(_0x527cb7,null));};exports[_0xae5c('0x4b')]=function(_0x5e8506,_0x15d3a2){var _0xa9e632={'raw':!![],'where':{'id':_0x5e8506[_0xae5c('0x4c')]['id']}},_0x338ca9={};_0x338ca9[_0xae5c('0x35')]=_[_0xae5c('0x4d')](db[_0xae5c('0x31')]['rawAttributes']);_0x338ca9[_0xae5c('0x36')]=_[_0xae5c('0x4d')](_0x5e8506[_0xae5c('0x36')]);_0x338ca9['filters']=_['intersection'](_0x338ca9[_0xae5c('0x35')],_0x338ca9[_0xae5c('0x36')]);_0xa9e632[_0xae5c('0x38')]=_[_0xae5c('0x37')](_0x338ca9[_0xae5c('0x35')],qs[_0xae5c('0x39')](_0x5e8506[_0xae5c('0x36')][_0xae5c('0x39')]));_0xa9e632[_0xae5c('0x38')]=_0xa9e632[_0xae5c('0x38')][_0xae5c('0x3a')]?_0xa9e632[_0xae5c('0x38')]:_0x338ca9['model'];if(_0x5e8506[_0xae5c('0x36')]['includeAll']){_0xa9e632['include']=[{'all':!![]}];}_0xa9e632=_[_0xae5c('0x42')]({},_0xa9e632,_0x5e8506['options']);return db['Template'][_0xae5c('0x4e')](_0xa9e632)['then'](handleEntityNotFound(_0x15d3a2,null))[_0xae5c('0x26')](respondWithResult(_0x15d3a2,null))[_0xae5c('0x4a')](handleError(_0x15d3a2,null));};exports['create']=function(_0x490cf6,_0x237548){return db['Template'][_0xae5c('0x4f')](_0x490cf6['body'],{})['then'](function(_0x55cd73){var _0x2a4f8f=_0x490cf6[_0xae5c('0x50')][_0xae5c('0x28')]({'plain':!![]});if(!_0x2a4f8f)throw new Error(_0xae5c('0x51'));if(_0x2a4f8f['role']===_0xae5c('0x50')){var _0x3e3e89=_0x55cd73[_0xae5c('0x28')]({'plain':!![]});var _0x41136c=_0xae5c('0x29');return db[_0xae5c('0x52')]['find']({'where':{'name':_0x41136c,'userProfileId':_0x2a4f8f[_0xae5c('0x53')]},'raw':!![]})[_0xae5c('0x26')](function(_0xc5bd29){if(_0xc5bd29&&_0xc5bd29[_0xae5c('0x54')]===0x0){return db[_0xae5c('0x2a')]['create']({'name':_0x3e3e89[_0xae5c('0x2d')],'resourceId':_0x3e3e89['id'],'type':_0xc5bd29['name'],'sectionId':_0xc5bd29['id']},{})[_0xae5c('0x26')](function(){return _0x55cd73;});}else{return _0x55cd73;}})[_0xae5c('0x4a')](function(_0x200056){logger[_0xae5c('0x2b')](_0xae5c('0x55'),_0x200056);throw _0x200056;});}return _0x55cd73;})[_0xae5c('0x26')](respondWithResult(_0x237548,0xc9))['catch'](handleError(_0x237548,null));};exports[_0xae5c('0x25')]=function(_0x50ff26,_0x10ddbb){if(_0x50ff26[_0xae5c('0x56')]['id']){delete _0x50ff26[_0xae5c('0x56')]['id'];}return db[_0xae5c('0x31')][_0xae5c('0x4e')]({'where':{'id':_0x50ff26[_0xae5c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x10ddbb,null))[_0xae5c('0x26')](saveUpdates(_0x50ff26['body'],null))['then'](respondWithResult(_0x10ddbb,null))[_0xae5c('0x4a')](handleError(_0x10ddbb,null));};exports[_0xae5c('0x27')]=function(_0x2155d9,_0x3ba301){return db[_0xae5c('0x31')]['find']({'where':{'id':_0x2155d9[_0xae5c('0x4c')]['id']}})[_0xae5c('0x26')](handleEntityNotFound(_0x3ba301,null))[_0xae5c('0x26')](removeEntity(_0x3ba301,null))[_0xae5c('0x4a')](handleError(_0x3ba301,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c772c45..3902a2b 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 _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 +var _0xa7c7=['moment','bluebird','path','rimraf','../../config/environment','define','tools_templates','lodash','util','../../config/logger','api'];(function(_0x54ed23,_0x137310){var _0x51df35=function(_0x16cc4e){while(--_0x16cc4e){_0x54ed23['push'](_0x54ed23['shift']());}};_0x51df35(++_0x137310);}(_0xa7c7,0x75));var _0x7a7c=function(_0x43625c,_0x1960e8){_0x43625c=_0x43625c-0x0;var _0x2db50e=_0xa7c7[_0x43625c];return _0x2db50e;};'use strict';var _=require(_0x7a7c('0x0'));var util=require(_0x7a7c('0x1'));var logger=require(_0x7a7c('0x2'))(_0x7a7c('0x3'));var moment=require(_0x7a7c('0x4'));var BPromise=require(_0x7a7c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a7c('0x6'));var rimraf=require(_0x7a7c('0x7'));var config=require(_0x7a7c('0x8'));var attributes=require('./template.attributes');module['exports']=function(_0x45957,_0x73ebcb){return _0x45957[_0x7a7c('0x9')]('Template',attributes,{'tableName':_0x7a7c('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 f6c8658..058386b 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 _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 +var _0x7dd1=['debug','stringify','error','message','info','Template,\x20%s,\x20%s','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','then','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','request\x20sent'];(function(_0x374907,_0x291c19){var _0x1746cc=function(_0x49ae5c){while(--_0x49ae5c){_0x374907['push'](_0x374907['shift']());}};_0x1746cc(++_0x291c19);}(_0x7dd1,0x169));var _0x17dd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7dd1[_0x432682];return _0x463d05;};'use strict';var _=require(_0x17dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x17dd('0x1'));var rs=require(_0x17dd('0x2'));var fs=require('fs');var Redis=require(_0x17dd('0x3'));var db=require(_0x17dd('0x4'))['db'];var utils=require(_0x17dd('0x5'));var logger=require(_0x17dd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17dd('0x7'));var client=jayson['client'][_0x17dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b9038,_0x591bbf,_0x44a3ed){return new BPromise(function(_0x29b28f,_0x5b1bd4){return client[_0x17dd('0x9')](_0x1b9038,_0x44a3ed)['then'](function(_0x4122db){logger['info']('Template,\x20%s,\x20%s',_0x591bbf,_0x17dd('0xa'));logger[_0x17dd('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x591bbf,_0x17dd('0xa'),JSON[_0x17dd('0xc')](_0x4122db));if(_0x4122db[_0x17dd('0xd')]){if(_0x4122db['error']['code']===0x1f4){logger[_0x17dd('0xd')]('Template,\x20%s,\x20%s',_0x591bbf,_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);return _0x5b1bd4(_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);}logger[_0x17dd('0xd')]('Template,\x20%s,\x20%s',_0x591bbf,_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);return _0x29b28f(_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);}else{logger[_0x17dd('0xf')](_0x17dd('0x10'),_0x591bbf,'request\x20sent');_0x29b28f(_0x4122db[_0x17dd('0x11')]['message']);}})['catch'](function(_0x2ccde7){logger[_0x17dd('0xd')]('Template,\x20%s,\x20%s',_0x591bbf,_0x2ccde7);_0x5b1bd4(_0x2ccde7);});});}exports[_0x17dd('0x12')]=function(_0x3345c5){var _0x5c0342=this;return new Promise(function(_0x41b9f2,_0x15ae11){return db[_0x17dd('0x13')][_0x17dd('0x14')]({'raw':_0x3345c5[_0x17dd('0x15')]?_0x3345c5[_0x17dd('0x15')][_0x17dd('0x16')]===undefined?!![]:![]:!![],'where':_0x3345c5[_0x17dd('0x15')]?_0x3345c5['options'][_0x17dd('0x17')]||null:null,'attributes':_0x3345c5[_0x17dd('0x15')]?_0x3345c5['options'][_0x17dd('0x18')]||null:null,'limit':_0x3345c5[_0x17dd('0x15')]?_0x3345c5[_0x17dd('0x15')][_0x17dd('0x19')]||null:null,'include':_0x3345c5[_0x17dd('0x15')]?_0x3345c5[_0x17dd('0x15')]['include']?_[_0x17dd('0x1a')](_0x3345c5[_0x17dd('0x15')][_0x17dd('0x1b')],function(_0x3a899f){return{'model':db[_0x3a899f[_0x17dd('0x1c')]],'as':_0x3a899f['as'],'attributes':_0x3a899f[_0x17dd('0x18')],'include':_0x3a899f[_0x17dd('0x1b')]?_['map'](_0x3a899f[_0x17dd('0x1b')],function(_0x3da60c){return{'model':db[_0x3da60c[_0x17dd('0x1c')]],'as':_0x3da60c['as'],'attributes':_0x3da60c[_0x17dd('0x18')],'include':_0x3da60c[_0x17dd('0x1b')]?_[_0x17dd('0x1a')](_0x3da60c[_0x17dd('0x1b')],function(_0xca2ef8){return{'model':db[_0xca2ef8[_0x17dd('0x1c')]],'as':_0xca2ef8['as'],'attributes':_0xca2ef8[_0x17dd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17dd('0x1d')](function(_0xb38ccb){logger[_0x17dd('0xf')]('GetTemplate',_0x3345c5);logger[_0x17dd('0xb')](_0x17dd('0x12'),_0x3345c5,JSON[_0x17dd('0xc')](_0xb38ccb));_0x41b9f2(_0xb38ccb);})[_0x17dd('0x1e')](function(_0x2910c7){logger[_0x17dd('0xd')](_0x17dd('0x12'),_0x2910c7[_0x17dd('0xe')],_0x3345c5);_0x15ae11(_0x5c0342[_0x17dd('0xd')](0x1f4,_0x2910c7[_0x17dd('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8324819..6b7f9e7 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 _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 +var _0x2032=['getActions','create','post','addAction','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions'];(function(_0xe7890a,_0x50d72f){var _0x3f1b52=function(_0x2129ee){while(--_0x2129ee){_0xe7890a['push'](_0xe7890a['shift']());}};_0x3f1b52(++_0x50d72f);}(_0x2032,0xd9));var _0x2203=function(_0x5e12a3,_0x58cabb){_0x5e12a3=_0x5e12a3-0x0;var _0x2ec84a=_0x2032[_0x5e12a3];return _0x2ec84a;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router['post'](_0x2203('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x2203('0x13')](_0x2203('0x10'),auth[_0x2203('0x9')](),controller[_0x2203('0x14')]);router[_0x2203('0x15')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x18')]);module[_0x2203('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5dd4fc8..dbd1a8f 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 _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 +var _0xf99c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5cc53f,_0x2652f8){var _0x3a0d7c=function(_0x12623b){while(--_0x12623b){_0x5cc53f['push'](_0x5cc53f['shift']());}};_0x3a0d7c(++_0x2652f8);}(_0xf99c,0x1b6));var _0xcf99=function(_0xb2c817,_0x52d3c4){_0xb2c817=_0xb2c817-0x0;var _0x2a0899=_0xf99c[_0xb2c817];return _0x2a0899;};'use strict';var Sequelize=require(_0xcf99('0x0'));module[_0xcf99('0x1')]={'name':{'type':Sequelize[_0xcf99('0x2')]},'channel':{'type':Sequelize[_0xcf99('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xcf99('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 14aa322..3c18560 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 _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 +var _0x0ca4=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','TriggerId','getActions','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model'];(function(_0x9d8096,_0x4f1910){var _0x4fdd3a=function(_0x58c873){while(--_0x58c873){_0x9d8096['push'](_0x9d8096['shift']());}};_0x4fdd3a(++_0x4f1910);}(_0x0ca4,0x8b));var _0x40ca=function(_0x4634d8,_0x11a66c){_0x4634d8=_0x4634d8-0x0;var _0x5c41d8=_0x0ca4[_0x4634d8];return _0x5c41d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40ca('0x0'));var zipdir=require(_0x40ca('0x1'));var jsonpatch=require(_0x40ca('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40ca('0x3'));var Mustache=require('mustache');var util=require(_0x40ca('0x4'));var path=require('path');var sox=require(_0x40ca('0x5'));var csv=require(_0x40ca('0x6'));var ejs=require(_0x40ca('0x7'));var fs=require('fs');var fs_extra=require(_0x40ca('0x8'));var _=require(_0x40ca('0x9'));var squel=require(_0x40ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x40ca('0x6'));var querystring=require(_0x40ca('0xb'));var Papa=require(_0x40ca('0xc'));var Redis=require(_0x40ca('0xd'));var authService=require(_0x40ca('0xe'));var qs=require(_0x40ca('0xf'));var as=require(_0x40ca('0x10'));var hardwareService=require(_0x40ca('0x11'));var logger=require(_0x40ca('0x12'))('api');var utils=require(_0x40ca('0x13'));var config=require(_0x40ca('0x14'));var licenseUtil=require(_0x40ca('0x15'));var db=require(_0x40ca('0x16'))['db'];function respondWithStatusCode(_0x375add,_0x4b7556){_0x4b7556=_0x4b7556||0xcc;return function(_0x294b16){if(_0x294b16){return _0x375add[_0x40ca('0x17')](_0x4b7556);}return _0x375add[_0x40ca('0x18')](_0x4b7556)[_0x40ca('0x19')]();};}function respondWithResult(_0x35569c,_0x417f99){_0x417f99=_0x417f99||0xc8;return function(_0x5a3f39){if(_0x5a3f39){return _0x35569c[_0x40ca('0x18')](_0x417f99)['json'](_0x5a3f39);}};}function respondWithFilteredResult(_0x5568a3,_0x2877d1){return function(_0x406418){if(_0x406418){var _0xc81e0a=typeof _0x2877d1[_0x40ca('0x1a')]===_0x40ca('0x1b')&&typeof _0x2877d1[_0x40ca('0x1c')]==='undefined';var _0x14cbb1=_0x406418[_0x40ca('0x1d')];var _0x5265e6=_0xc81e0a?0x0:_0x2877d1[_0x40ca('0x1a')];var _0x3106b3=_0xc81e0a?_0x406418['count']:_0x2877d1[_0x40ca('0x1a')]+_0x2877d1[_0x40ca('0x1c')];var _0x5c140f;if(_0x3106b3>=_0x14cbb1){_0x3106b3=_0x14cbb1;_0x5c140f=0xc8;}else{_0x5c140f=0xce;}_0x5568a3[_0x40ca('0x18')](_0x5c140f);return _0x5568a3[_0x40ca('0x1e')](_0x40ca('0x1f'),_0x5265e6+'-'+_0x3106b3+'/'+_0x14cbb1)[_0x40ca('0x20')](_0x406418);}return null;};}function patchUpdates(_0x428d32){return function(_0x5ede25){try{jsonpatch[_0x40ca('0x21')](_0x5ede25,_0x428d32,!![]);}catch(_0xf126af){return BPromise['reject'](_0xf126af);}return _0x5ede25[_0x40ca('0x22')]();};}function saveUpdates(_0x7b24a3,_0x4a8f6a){return function(_0x5e78ea){if(_0x5e78ea){return _0x5e78ea['update'](_0x7b24a3)['then'](function(_0x3e306a){return _0x3e306a;});}return null;};}function removeEntity(_0x2b68a9,_0x2ab628){return function(_0x3ac424){if(_0x3ac424){return _0x3ac424[_0x40ca('0x23')]()['then'](function(){var _0x1ada61=_0x3ac424[_0x40ca('0x24')]({'plain':!![]});var _0x1e37f2='Triggers';return db[_0x40ca('0x25')][_0x40ca('0x23')]({'where':{'type':_0x1e37f2,'resourceId':_0x1ada61['id']}})['then'](function(){return _0x3ac424;});})[_0x40ca('0x26')](function(){_0x2b68a9[_0x40ca('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x130eb6,_0x2e3f59){return function(_0x599c5d){if(!_0x599c5d){_0x130eb6[_0x40ca('0x17')](0x194);}return _0x599c5d;};}function handleError(_0x2946b5,_0x1d8bb1){_0x1d8bb1=_0x1d8bb1||0x1f4;return function(_0x1dea0a){logger[_0x40ca('0x27')](_0x1dea0a[_0x40ca('0x28')]);if(_0x1dea0a['name']){delete _0x1dea0a[_0x40ca('0x29')];}_0x2946b5[_0x40ca('0x18')](_0x1d8bb1)[_0x40ca('0x2a')](_0x1dea0a);};}exports[_0x40ca('0x2b')]=function(_0x6ceb0,_0x15d5fc){var _0x328fef={},_0x785dbc={},_0x50cb8c={'count':0x0,'rows':[]};var _0x29919a=_[_0x40ca('0x2c')](db[_0x40ca('0x2d')][_0x40ca('0x2e')],function(_0x17fd18){return{'name':_0x17fd18[_0x40ca('0x2f')],'type':_0x17fd18[_0x40ca('0x30')][_0x40ca('0x31')]};});_0x785dbc[_0x40ca('0x32')]=_[_0x40ca('0x2c')](_0x29919a,_0x40ca('0x29'));_0x785dbc[_0x40ca('0x33')]=_['keys'](_0x6ceb0[_0x40ca('0x33')]);_0x785dbc[_0x40ca('0x34')]=_[_0x40ca('0x35')](_0x785dbc[_0x40ca('0x32')],_0x785dbc['query']);_0x328fef[_0x40ca('0x36')]=_[_0x40ca('0x35')](_0x785dbc['model'],qs[_0x40ca('0x37')](_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x37')]));_0x328fef[_0x40ca('0x36')]=_0x328fef[_0x40ca('0x36')][_0x40ca('0x38')]?_0x328fef[_0x40ca('0x36')]:_0x785dbc[_0x40ca('0x32')];if(!_0x6ceb0[_0x40ca('0x33')]['hasOwnProperty'](_0x40ca('0x39'))){_0x328fef[_0x40ca('0x1c')]=qs[_0x40ca('0x1c')](_0x6ceb0['query'][_0x40ca('0x1c')]);_0x328fef[_0x40ca('0x1a')]=qs[_0x40ca('0x1a')](_0x6ceb0[_0x40ca('0x33')]['offset']);}_0x328fef[_0x40ca('0x3a')]=qs[_0x40ca('0x3b')](_0x6ceb0['query'][_0x40ca('0x3b')]);_0x328fef[_0x40ca('0x3c')]=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x6ceb0[_0x40ca('0x33')],_0x785dbc[_0x40ca('0x34')]),_0x29919a);if(_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x3e')]){_0x328fef[_0x40ca('0x3c')]=_[_0x40ca('0x3f')](_0x328fef[_0x40ca('0x3c')],{'$or':_[_0x40ca('0x2c')](_0x29919a,function(_0x142897){if(_0x142897[_0x40ca('0x30')]!==_0x40ca('0x40')){var _0x303307={};_0x303307[_0x142897['name']]={'$like':'%'+_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x3e')]+'%'};return _0x303307;}})});}_0x328fef=_['merge']({},_0x328fef,_0x6ceb0[_0x40ca('0x41')]);var _0x32b52f={'where':_0x328fef[_0x40ca('0x3c')]};return db['Trigger'][_0x40ca('0x1d')](_0x32b52f)[_0x40ca('0x26')](function(_0x278a62){_0x50cb8c[_0x40ca('0x1d')]=_0x278a62;if(_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x42')]){_0x328fef[_0x40ca('0x43')]=[{'all':!![]}];}return db[_0x40ca('0x2d')][_0x40ca('0x44')](_0x328fef);})['then'](function(_0x20d9e2){_0x50cb8c[_0x40ca('0x45')]=_0x20d9e2;return _0x50cb8c;})[_0x40ca('0x26')](respondWithFilteredResult(_0x15d5fc,_0x328fef))['catch'](handleError(_0x15d5fc,null));};exports[_0x40ca('0x46')]=function(_0x417538,_0x413f04){var _0x41b83e={'raw':![],'where':{'id':_0x417538[_0x40ca('0x47')]['id']}},_0x449f60={};_0x449f60[_0x40ca('0x32')]=_[_0x40ca('0x48')](db[_0x40ca('0x2d')]['rawAttributes']);_0x449f60['query']=_[_0x40ca('0x48')](_0x417538[_0x40ca('0x33')]);_0x449f60['filters']=_['intersection'](_0x449f60['model'],_0x449f60[_0x40ca('0x33')]);_0x41b83e['attributes']=_[_0x40ca('0x35')](_0x449f60['model'],qs[_0x40ca('0x37')](_0x417538['query'][_0x40ca('0x37')]));_0x41b83e[_0x40ca('0x36')]=_0x41b83e[_0x40ca('0x36')]['length']?_0x41b83e[_0x40ca('0x36')]:_0x449f60['model'];if(_0x417538['query']['includeAll']){_0x41b83e['include']=[{'all':!![]}];}_0x41b83e=_[_0x40ca('0x3f')]({},_0x41b83e,_0x417538['options']);return db[_0x40ca('0x2d')]['find'](_0x41b83e)[_0x40ca('0x26')](handleEntityNotFound(_0x413f04,null))['then'](respondWithResult(_0x413f04,null))[_0x40ca('0x49')](handleError(_0x413f04,null));};exports['create']=function(_0x1c536b,_0x486db){return db['Trigger'][_0x40ca('0x4a')](_0x1c536b['body'],{})[_0x40ca('0x26')](function(_0xa110ee){var _0x2c69b3=_0x1c536b[_0x40ca('0x4b')][_0x40ca('0x24')]({'plain':!![]});if(!_0x2c69b3)throw new Error(_0x40ca('0x4c'));if(_0x2c69b3[_0x40ca('0x4d')]==='user'){var _0x3351ad=_0xa110ee[_0x40ca('0x24')]({'plain':!![]});var _0xc9a932=_0x40ca('0x4e');return db[_0x40ca('0x4f')][_0x40ca('0x50')]({'where':{'name':_0xc9a932,'userProfileId':_0x2c69b3[_0x40ca('0x51')]},'raw':!![]})[_0x40ca('0x26')](function(_0x192c0a){if(_0x192c0a&&_0x192c0a[_0x40ca('0x52')]===0x0){return db[_0x40ca('0x25')][_0x40ca('0x4a')]({'name':_0x3351ad[_0x40ca('0x29')],'resourceId':_0x3351ad['id'],'type':_0x192c0a['name'],'sectionId':_0x192c0a['id']},{})[_0x40ca('0x26')](function(){return _0xa110ee;});}else{return _0xa110ee;}})[_0x40ca('0x49')](function(_0xbb6662){logger[_0x40ca('0x27')](_0x40ca('0x53'),_0xbb6662);throw _0xbb6662;});}return _0xa110ee;})[_0x40ca('0x26')](respondWithResult(_0x486db,0xc9))[_0x40ca('0x49')](handleError(_0x486db,null));};exports[_0x40ca('0x54')]=function(_0xa4c27a,_0xb21d3d){if(_0xa4c27a[_0x40ca('0x55')]['id']){delete _0xa4c27a[_0x40ca('0x55')]['id'];}return db[_0x40ca('0x2d')][_0x40ca('0x50')]({'where':{'id':_0xa4c27a[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0xb21d3d,null))[_0x40ca('0x26')](saveUpdates(_0xa4c27a['body'],null))['then'](respondWithResult(_0xb21d3d,null))['catch'](handleError(_0xb21d3d,null));};exports[_0x40ca('0x23')]=function(_0x30c05e,_0x2d15a3){return db[_0x40ca('0x2d')]['find']({'where':{'id':_0x30c05e[_0x40ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d15a3,null))['then'](removeEntity(_0x2d15a3,null))[_0x40ca('0x49')](handleError(_0x2d15a3,null));};exports['addAllCondition']=function(_0x3fc62c,_0x34262e,_0x1a87e5){if(_0x3fc62c['body']['id']){delete _0x3fc62c[_0x40ca('0x55')]['id'];}return db[_0x40ca('0x2d')]['find']({'where':{'id':_0x3fc62c['params']['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x34262e,null))['then'](function(_0x3ba1af){if(_0x3ba1af){_0x3fc62c[_0x40ca('0x55')][_0x40ca('0x56')]=_0x3ba1af['id'];return db[_0x40ca('0x57')][_0x40ca('0x4a')](_0x3fc62c[_0x40ca('0x55')]);}})['then'](respondWithResult(_0x34262e,null))['catch'](handleError(_0x34262e,null));};exports['addAnyCondition']=function(_0xdb2d9e,_0x3575a7,_0x3660f8){if(_0xdb2d9e[_0x40ca('0x55')]['id']){delete _0xdb2d9e['body']['id'];}return db['Trigger'][_0x40ca('0x50')]({'where':{'id':_0xdb2d9e[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x3575a7,null))['then'](function(_0x462d11){if(_0x462d11){_0xdb2d9e[_0x40ca('0x55')][_0x40ca('0x58')]=_0x462d11['id'];return db[_0x40ca('0x57')]['create'](_0xdb2d9e[_0x40ca('0x55')]);}})[_0x40ca('0x26')](respondWithResult(_0x3575a7,null))[_0x40ca('0x49')](handleError(_0x3575a7,null));};exports[_0x40ca('0x59')]=function(_0x2a407c,_0x58f634,_0x4acdb4){var _0x375d49={};var _0x561c8a={};var _0x4922ba;var _0x69b139;return db['Trigger'][_0x40ca('0x5a')]({'where':{'id':_0x2a407c[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x58f634,null))[_0x40ca('0x26')](function(_0x3bebe5){if(_0x3bebe5){_0x4922ba=_0x3bebe5;_0x561c8a[_0x40ca('0x32')]=_[_0x40ca('0x48')](db[_0x40ca('0x57')]['rawAttributes']);_0x561c8a[_0x40ca('0x33')]=_[_0x40ca('0x48')](_0x2a407c[_0x40ca('0x33')]);_0x561c8a['filters']=_[_0x40ca('0x35')](_0x561c8a[_0x40ca('0x32')],_0x561c8a['query']);_0x375d49[_0x40ca('0x36')]=_[_0x40ca('0x35')](_0x561c8a[_0x40ca('0x32')],qs[_0x40ca('0x37')](_0x2a407c[_0x40ca('0x33')][_0x40ca('0x37')]));_0x375d49['attributes']=_0x375d49[_0x40ca('0x36')]['length']?_0x375d49[_0x40ca('0x36')]:_0x561c8a['model'];_0x375d49[_0x40ca('0x3a')]=qs['sort'](_0x2a407c['query'][_0x40ca('0x3b')]);_0x375d49[_0x40ca('0x3c')]=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x2a407c[_0x40ca('0x33')],_0x561c8a['filters']));if(_0x2a407c['query']['filter']){_0x375d49['where']=_['merge'](_0x375d49[_0x40ca('0x3c')],{'$or':_['map'](_0x375d49[_0x40ca('0x36')],function(_0xc20dd7){var _0x4ba3a6={};_0x4ba3a6[_0xc20dd7]={'$like':'%'+_0x2a407c[_0x40ca('0x33')]['filter']+'%'};return _0x4ba3a6;})});}_0x375d49=_['merge']({},_0x375d49,_0x2a407c[_0x40ca('0x41')]);return _0x4922ba[_0x40ca('0x59')](_0x375d49);}})[_0x40ca('0x26')](function(_0x536bf8){if(_0x536bf8){_0x69b139=_0x536bf8[_0x40ca('0x38')];if(!_0x2a407c[_0x40ca('0x33')][_0x40ca('0x5b')](_0x40ca('0x39'))){_0x375d49[_0x40ca('0x1c')]=qs[_0x40ca('0x1c')](_0x2a407c[_0x40ca('0x33')][_0x40ca('0x1c')]);_0x375d49['offset']=qs[_0x40ca('0x1a')](_0x2a407c['query'][_0x40ca('0x1a')]);}return _0x4922ba[_0x40ca('0x59')](_0x375d49);}})[_0x40ca('0x26')](function(_0x113b1e){if(_0x113b1e){return _0x113b1e?{'count':_0x69b139,'rows':_0x113b1e}:null;}})[_0x40ca('0x26')](respondWithResult(_0x58f634,null))[_0x40ca('0x49')](handleError(_0x58f634,null));};exports[_0x40ca('0x5c')]=function(_0x38b391,_0x54eb5d,_0x4577a4){var _0xbbe759={};var _0x202495={};var _0x345b2b;var _0x13df6d;return db['Trigger'][_0x40ca('0x5a')]({'where':{'id':_0x38b391[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x54eb5d,null))[_0x40ca('0x26')](function(_0x516ea9){if(_0x516ea9){_0x345b2b=_0x516ea9;_0x202495[_0x40ca('0x32')]=_[_0x40ca('0x48')](db[_0x40ca('0x57')][_0x40ca('0x2e')]);_0x202495[_0x40ca('0x33')]=_['keys'](_0x38b391[_0x40ca('0x33')]);_0x202495[_0x40ca('0x34')]=_['intersection'](_0x202495['model'],_0x202495['query']);_0xbbe759['attributes']=_['intersection'](_0x202495[_0x40ca('0x32')],qs['fields'](_0x38b391['query'][_0x40ca('0x37')]));_0xbbe759[_0x40ca('0x36')]=_0xbbe759[_0x40ca('0x36')][_0x40ca('0x38')]?_0xbbe759[_0x40ca('0x36')]:_0x202495[_0x40ca('0x32')];_0xbbe759[_0x40ca('0x3a')]=qs[_0x40ca('0x3b')](_0x38b391[_0x40ca('0x33')]['sort']);_0xbbe759[_0x40ca('0x3c')]=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x38b391[_0x40ca('0x33')],_0x202495['filters']));if(_0x38b391[_0x40ca('0x33')]['filter']){_0xbbe759[_0x40ca('0x3c')]=_[_0x40ca('0x3f')](_0xbbe759[_0x40ca('0x3c')],{'$or':_['map'](_0xbbe759[_0x40ca('0x36')],function(_0x2257ff){var _0x349d7e={};_0x349d7e[_0x2257ff]={'$like':'%'+_0x38b391[_0x40ca('0x33')][_0x40ca('0x3e')]+'%'};return _0x349d7e;})});}_0xbbe759=_[_0x40ca('0x3f')]({},_0xbbe759,_0x38b391[_0x40ca('0x41')]);return _0x345b2b['getAnyConditions'](_0xbbe759);}})[_0x40ca('0x26')](function(_0x83c28c){if(_0x83c28c){_0x13df6d=_0x83c28c[_0x40ca('0x38')];if(!_0x38b391[_0x40ca('0x33')][_0x40ca('0x5b')]('nolimit')){_0xbbe759[_0x40ca('0x1c')]=qs['limit'](_0x38b391[_0x40ca('0x33')][_0x40ca('0x1c')]);_0xbbe759['offset']=qs[_0x40ca('0x1a')](_0x38b391[_0x40ca('0x33')][_0x40ca('0x1a')]);}return _0x345b2b['getAnyConditions'](_0xbbe759);}})[_0x40ca('0x26')](function(_0x7cb507){if(_0x7cb507){return _0x7cb507?{'count':_0x13df6d,'rows':_0x7cb507}:null;}})[_0x40ca('0x26')](respondWithResult(_0x54eb5d,null))['catch'](handleError(_0x54eb5d,null));};exports['addAction']=function(_0x3cf82c,_0x24752a,_0x59f5b1){if(_0x3cf82c[_0x40ca('0x55')]['id']){delete _0x3cf82c['body']['id'];}return db[_0x40ca('0x2d')][_0x40ca('0x50')]({'where':{'id':_0x3cf82c[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x24752a,null))[_0x40ca('0x26')](function(_0x5d63b5){if(_0x5d63b5){_0x3cf82c[_0x40ca('0x55')][_0x40ca('0x5d')]=_0x5d63b5['id'];return db['Action'][_0x40ca('0x4a')](_0x3cf82c[_0x40ca('0x55')]);}})['then'](respondWithResult(_0x24752a,null))['catch'](handleError(_0x24752a,null));};exports[_0x40ca('0x5e')]=function(_0x4dcc7f,_0xa1304,_0x2c5160){var _0x193bfd={};var _0x409a63={};var _0x1fe26a;var _0x860b09;return db[_0x40ca('0x2d')]['findOne']({'where':{'id':_0x4dcc7f[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0xa1304,null))[_0x40ca('0x26')](function(_0x5bdb8b){if(_0x5bdb8b){_0x1fe26a=_0x5bdb8b;_0x409a63[_0x40ca('0x32')]=_[_0x40ca('0x48')](db['Action'][_0x40ca('0x2e')]);_0x409a63[_0x40ca('0x33')]=_[_0x40ca('0x48')](_0x4dcc7f[_0x40ca('0x33')]);_0x409a63[_0x40ca('0x34')]=_[_0x40ca('0x35')](_0x409a63['model'],_0x409a63[_0x40ca('0x33')]);_0x193bfd[_0x40ca('0x36')]=_['intersection'](_0x409a63[_0x40ca('0x32')],qs[_0x40ca('0x37')](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x37')]));_0x193bfd['attributes']=_0x193bfd[_0x40ca('0x36')][_0x40ca('0x38')]?_0x193bfd[_0x40ca('0x36')]:_0x409a63['model'];_0x193bfd[_0x40ca('0x3a')]=qs['sort'](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x3b')]);_0x193bfd['where']=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x4dcc7f[_0x40ca('0x33')],_0x409a63['filters']));if(_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x3e')]){_0x193bfd[_0x40ca('0x3c')]=_['merge'](_0x193bfd['where'],{'$or':_[_0x40ca('0x2c')](_0x193bfd['attributes'],function(_0x4ce571){var _0xbc5510={};_0xbc5510[_0x4ce571]={'$like':'%'+_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x3e')]+'%'};return _0xbc5510;})});}_0x193bfd=_[_0x40ca('0x3f')]({},_0x193bfd,_0x4dcc7f[_0x40ca('0x41')]);return _0x1fe26a[_0x40ca('0x5e')](_0x193bfd);}})[_0x40ca('0x26')](function(_0x467e54){if(_0x467e54){_0x860b09=_0x467e54[_0x40ca('0x38')];if(!_0x4dcc7f['query'][_0x40ca('0x5b')]('nolimit')){_0x193bfd[_0x40ca('0x1c')]=qs[_0x40ca('0x1c')](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x1c')]);_0x193bfd['offset']=qs['offset'](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x1a')]);}return _0x1fe26a[_0x40ca('0x5e')](_0x193bfd);}})[_0x40ca('0x26')](function(_0xf44dd3){if(_0xf44dd3){return _0xf44dd3?{'count':_0x860b09,'rows':_0xf44dd3}:null;}})['then'](respondWithResult(_0xa1304,null))[_0x40ca('0x49')](handleError(_0xa1304,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8302765..33d80cd 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 _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 +var _0x7c22=['lodash','util','api','moment','request-promise','path','./trigger.attributes','define','Trigger'];(function(_0x3ce56e,_0x124432){var _0x4d2348=function(_0x4645a7){while(--_0x4645a7){_0x3ce56e['push'](_0x3ce56e['shift']());}};_0x4d2348(++_0x124432);}(_0x7c22,0x6c));var _0x27c2=function(_0x39cdb9,_0x4c64ac){_0x39cdb9=_0x39cdb9-0x0;var _0x4381b6=_0x7c22[_0x39cdb9];return _0x4381b6;};'use strict';var _=require(_0x27c2('0x0'));var util=require(_0x27c2('0x1'));var logger=require('../../config/logger')(_0x27c2('0x2'));var moment=require(_0x27c2('0x3'));var BPromise=require('bluebird');var rp=require(_0x27c2('0x4'));var fs=require('fs');var path=require(_0x27c2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x27c2('0x6'));module['exports']=function(_0x28548d,_0x5006bd){return _0x28548d[_0x27c2('0x7')](_0x27c2('0x8'),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 9abf067..cd2ecfa 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 _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 +var _0xdadc=['ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','code','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','include','map','model','then','GetTrigger','stringify'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xdadc,0x1ca));var _0xcdad=function(_0x4b8d9e,_0x408d0f){_0x4b8d9e=_0x4b8d9e-0x0;var _0x4595e9=_0xdadc[_0x4b8d9e];return _0x4595e9;};'use strict';var _=require(_0xcdad('0x0'));var util=require(_0xcdad('0x1'));var moment=require(_0xcdad('0x2'));var BPromise=require(_0xcdad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdad('0x4'));var db=require(_0xcdad('0x5'))['db'];var utils=require(_0xcdad('0x6'));var logger=require(_0xcdad('0x7'))(_0xcdad('0x8'));var config=require(_0xcdad('0x9'));var jayson=require(_0xcdad('0xa'));var client=jayson[_0xcdad('0xb')][_0xcdad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x107e99,_0x48b060,_0x331a83){return new BPromise(function(_0x504c9e,_0x87ea5d){return client[_0xcdad('0xd')](_0x107e99,_0x331a83)['then'](function(_0x48d483){logger[_0xcdad('0xe')]('Trigger,\x20%s,\x20%s',_0x48b060,_0xcdad('0xf'));logger[_0xcdad('0x10')](_0xcdad('0x11'),_0x48b060,_0xcdad('0xf'),JSON['stringify'](_0x48d483));if(_0x48d483['error']){if(_0x48d483['error'][_0xcdad('0x12')]===0x1f4){logger[_0xcdad('0x13')](_0xcdad('0x14'),_0x48b060,_0x48d483[_0xcdad('0x13')][_0xcdad('0x15')]);return _0x87ea5d(_0x48d483[_0xcdad('0x13')]['message']);}logger[_0xcdad('0x13')]('Trigger,\x20%s,\x20%s',_0x48b060,_0x48d483[_0xcdad('0x13')][_0xcdad('0x15')]);return _0x504c9e(_0x48d483[_0xcdad('0x13')]['message']);}else{logger[_0xcdad('0xe')]('Trigger,\x20%s,\x20%s',_0x48b060,'request\x20sent');_0x504c9e(_0x48d483[_0xcdad('0x16')][_0xcdad('0x15')]);}})[_0xcdad('0x17')](function(_0x1507ad){logger[_0xcdad('0x13')](_0xcdad('0x14'),_0x48b060,_0x1507ad);_0x87ea5d(_0x1507ad);});});}exports['GetTrigger']=function(_0x54b084){var _0x31c255=this;return new Promise(function(_0x152e1a,_0x395fac){return db[_0xcdad('0x18')][_0xcdad('0x19')]({'raw':_0x54b084[_0xcdad('0x1a')]?_0x54b084['options'][_0xcdad('0x1b')]===undefined?!![]:![]:!![],'where':_0x54b084['options']?_0x54b084['options'][_0xcdad('0x1c')]||null:null,'attributes':_0x54b084[_0xcdad('0x1a')]?_0x54b084[_0xcdad('0x1a')][_0xcdad('0x1d')]||null:null,'limit':_0x54b084[_0xcdad('0x1a')]?_0x54b084['options']['limit']||null:null,'include':_0x54b084['options']?_0x54b084['options'][_0xcdad('0x1e')]?_[_0xcdad('0x1f')](_0x54b084[_0xcdad('0x1a')][_0xcdad('0x1e')],function(_0x5dbcc5){return{'model':db[_0x5dbcc5['model']],'as':_0x5dbcc5['as'],'attributes':_0x5dbcc5[_0xcdad('0x1d')],'include':_0x5dbcc5[_0xcdad('0x1e')]?_['map'](_0x5dbcc5[_0xcdad('0x1e')],function(_0x2867f3){return{'model':db[_0x2867f3[_0xcdad('0x20')]],'as':_0x2867f3['as'],'attributes':_0x2867f3['attributes'],'include':_0x2867f3[_0xcdad('0x1e')]?_[_0xcdad('0x1f')](_0x2867f3['include'],function(_0x3b4421){return{'model':db[_0x3b4421['model']],'as':_0x3b4421['as'],'attributes':_0x3b4421[_0xcdad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdad('0x21')](function(_0x4d447e){logger[_0xcdad('0xe')](_0xcdad('0x22'),_0x54b084);logger[_0xcdad('0x10')](_0xcdad('0x22'),_0x54b084,JSON[_0xcdad('0x23')](_0x4d447e));_0x152e1a(_0x4d447e);})[_0xcdad('0x17')](function(_0x4617dd){logger['error']('GetTrigger',_0x4617dd['message'],_0x54b084);_0x395fac(_0x31c255[_0xcdad('0x13')](0x1f4,_0x4617dd['message']));});});};exports[_0xcdad('0x24')]=function(_0x91dc5a){var _0x4a24d1=this;return new Promise(function(_0x3d5bbd,_0x5dbed1){return db[_0xcdad('0x18')][_0xcdad('0x25')]({'raw':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a[_0xcdad('0x1a')][_0xcdad('0x1b')]===undefined?!![]:![]:!![],'where':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a['options'][_0xcdad('0x1c')]||null:null,'attributes':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a[_0xcdad('0x1a')][_0xcdad('0x1d')]||null:null,'include':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a['options'][_0xcdad('0x1e')]?_[_0xcdad('0x1f')](_0x91dc5a[_0xcdad('0x1a')]['include'],function(_0x4f60e8){return{'model':db[_0x4f60e8[_0xcdad('0x20')]],'as':_0x4f60e8['as'],'attributes':_0x4f60e8[_0xcdad('0x1d')],'include':_0x4f60e8[_0xcdad('0x1e')]?_['map'](_0x4f60e8[_0xcdad('0x1e')],function(_0x365192){return{'model':db[_0x365192[_0xcdad('0x20')]],'as':_0x365192['as'],'attributes':_0x365192['attributes'],'include':_0x365192['include']?_[_0xcdad('0x1f')](_0x365192[_0xcdad('0x1e')],function(_0x254b1e){return{'model':db[_0x254b1e[_0xcdad('0x20')]],'as':_0x254b1e['as'],'attributes':_0x254b1e[_0xcdad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdad('0x21')](function(_0x18a12c){logger[_0xcdad('0xe')]('ShowTrigger',_0x91dc5a);logger[_0xcdad('0x10')](_0xcdad('0x24'),_0x91dc5a,JSON[_0xcdad('0x23')](_0x18a12c));_0x3d5bbd(_0x18a12c);})[_0xcdad('0x17')](function(_0x4ad4bb){logger[_0xcdad('0x13')](_0xcdad('0x24'),_0x4ad4bb[_0xcdad('0x15')],_0x91dc5a);_0x5dbed1(_0x4a24d1[_0xcdad('0x13')](0x1f4,_0x4ad4bb['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dcc8b06..dc9143a 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 _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 +var _0xff2a=['show','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff2a,0x1ab));var _0xaff2=function(_0x3e4285,_0x83a4f0){_0x3e4285=_0x3e4285-0x0;var _0xce09e7=_0xff2a[_0x3e4285];return _0xce09e7;};'use strict';var multer=require(_0xaff2('0x0'));var util=require(_0xaff2('0x1'));var path=require(_0xaff2('0x2'));var timeout=require(_0xaff2('0x3'));var express=require(_0xaff2('0x4'));var router=express['Router']();var fs_extra=require(_0xaff2('0x5'));var auth=require(_0xaff2('0x6'));var interaction=require(_0xaff2('0x7'));var config=require(_0xaff2('0x8'));var controller=require('./trunk.controller');router[_0xaff2('0x9')]('/',auth[_0xaff2('0xa')](),controller[_0xaff2('0xb')]);router[_0xaff2('0x9')](_0xaff2('0xc'),auth[_0xaff2('0xa')](),controller[_0xaff2('0xd')]);router[_0xaff2('0xe')](_0xaff2('0xf'),auth[_0xaff2('0xa')](),controller[_0xaff2('0x10')]);router[_0xaff2('0xe')]('/',auth[_0xaff2('0xa')](),controller['create']);router[_0xaff2('0x11')]('/:id',auth[_0xaff2('0xa')](),controller[_0xaff2('0x12')]);router[_0xaff2('0x13')](_0xaff2('0xc'),auth['isAuthenticated'](),controller[_0xaff2('0x14')]);module[_0xaff2('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3f7a029..2d4ad78 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 _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 +var _0x5c3f=['passive','actpass','dynamic','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai','certificate'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x5c3f,0x1ee));var _0xf5c3=function(_0x5a88eb,_0xf1fb8e){_0x5a88eb=_0x5a88eb-0x0;var _0x9e01b2=_0x5c3f[_0x5a88eb];return _0x9e01b2;};'use strict';var Sequelize=require(_0xf5c3('0x0'));module[_0xf5c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf5c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x4'),_0xf5c3('0x5'),_0xf5c3('0x6')),'allowNull':![],'defaultValue':_0xf5c3('0x4')},'context':{'type':Sequelize[_0xf5c3('0x7')],'allowNull':![],'defaultValue':_0xf5c3('0x8')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xf5c3('0x9'),_0xf5c3('0xa'),_0xf5c3('0xb'),_0xf5c3('0xc'),_0xf5c3('0xd'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xf5c3('0x7')]},'permit':{'type':Sequelize[_0xf5c3('0x7')]},'secret':{'type':Sequelize[_0xf5c3('0x7')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf5c3('0xe'),'set':function(_0x3b7687){this[_0xf5c3('0xf')]('transport',_0x3b7687?_0x3b7687[_0xf5c3('0x10')](','):null);},'get':function(){return this[_0xf5c3('0x11')](_0xf5c3('0x12'))?this[_0xf5c3('0x11')](_0xf5c3('0x12'))[_0xf5c3('0x13')](','):null;},'comment':_0xf5c3('0x14')},'dtmfmode':{'type':Sequelize[_0xf5c3('0x3')]('rfc2833',_0xf5c3('0x15'),_0xf5c3('0x16'),'inband',_0xf5c3('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf5c3('0x3')]('yes','no',_0xf5c3('0x18'),_0xf5c3('0x19'),_0xf5c3('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf5c3('0x7')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x1c'),'set':function(_0x511b23){this[_0xf5c3('0xf')]('nat',_0x511b23?_0x511b23[_0xf5c3('0x10')](','):null);},'get':function(){return this[_0xf5c3('0x11')]('nat')?this['getDataValue']('nat')[_0xf5c3('0x13')](','):null;},'comment':_0xf5c3('0x1d')},'callgroup':{'type':Sequelize[_0xf5c3('0x7')]},'namedcallgroup':{'type':Sequelize[_0xf5c3('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf5c3('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf5c3('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf5c3('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x6a8346){this[_0xf5c3('0xf')](_0xf5c3('0x1e'),_0x6a8346?_0x6a8346['join'](';'):_0xf5c3('0x1f'));},'get':function(){return this['getDataValue'](_0xf5c3('0x1e'))?this[_0xf5c3('0x11')]('allow')['split'](';'):null;},'comment':_0xf5c3('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no')},'insecure':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x21'),'set':function(_0x4d5580){this[_0xf5c3('0xf')]('insecure',_0x4d5580?_0x4d5580[_0xf5c3('0x10')](','):null);},'get':function(){return this[_0xf5c3('0x11')]('insecure')?this[_0xf5c3('0x11')](_0xf5c3('0x22'))[_0xf5c3('0x13')](','):null;},'comment':_0xf5c3('0x23')},'trustrpid':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no',_0xf5c3('0x24'))},'promiscredir':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'accountcode':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x26')},'amaflags':{'type':Sequelize[_0xf5c3('0x7')]},'callcounter':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no'),'defaultValue':_0xf5c3('0x1b')},'busylevel':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf5c3('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xf5c3('0x7')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x27'),_0xf5c3('0x28'),'originate')},'session_expires':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x29'),_0xf5c3('0x2a')),'defaultValue':_0xf5c3('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xf5c3('0x7')]},'fromdomain':{'type':Sequelize[_0xf5c3('0x7')]},'fromuser':{'type':Sequelize[_0xf5c3('0x7')]},'port':{'type':Sequelize[_0xf5c3('0x25')](0x5)},'qualify':{'type':Sequelize[_0xf5c3('0x3')]('yes','no'),'defaultValue':_0xf5c3('0x1b')},'keepalive':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xf5c3('0x7')]},'defaultuser':{'type':Sequelize[_0xf5c3('0x7')]},'rtptimeout':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xf5c3('0x3')]('yes','no',_0xf5c3('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf5c3('0x7')]},'callbackextension':{'type':Sequelize[_0xf5c3('0x7')]},'timert1':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'timerb':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xf5c3('0x7')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xf5c3('0x7')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xf5c3('0x7')]},'maxforwards':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'encryption':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xf5c3('0x3')]('yes','no','fingerprint',_0xf5c3('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf5c3('0x7')]},'dtlsprivatekey':{'type':Sequelize[_0xf5c3('0x7')]},'dtlscipher':{'type':Sequelize[_0xf5c3('0x7')]},'dtlscafile':{'type':Sequelize[_0xf5c3('0x7')]},'dtlscapath':{'type':Sequelize[_0xf5c3('0x7')]},'dtlssetup':{'type':Sequelize[_0xf5c3('0x3')]('active',_0xf5c3('0x2d'),_0xf5c3('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf5c3('0x7')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xf5c3('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xf5c3('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xf5c3('0x7')]},'mohsuggest':{'type':Sequelize[_0xf5c3('0x7')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5c3('0x7')]},'host':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x2f')},'canreinvite':{'type':Sequelize[_0xf5c3('0x3')]('yes','no',_0xf5c3('0x18'),_0xf5c3('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf5c3('0x7')]},'otherFields':{'type':Sequelize[_0xf5c3('0x7')]},'active':{'type':Sequelize[_0xf5c3('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf5c3('0x7')],'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 9ea18d7..5d36ab7 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 _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 +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x4caf4f,_0x1f9d37){var _0xf64dd9=function(_0x37507){while(--_0x37507){_0x4caf4f['push'](_0x4caf4f['shift']());}};_0xf64dd9(++_0x1f9d37);}(_0x34e8,0x12c));var _0x834e=function(_0x25e5a2,_0x274b6a){_0x25e5a2=_0x25e5a2-0x0;var _0x2baa6b=_0x34e8[_0x25e5a2];return _0x2baa6b;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a238f1c..b9555de 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 _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 +var _0x0ec3=['../../config/environment','./trunk.attributes','exports','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xda0086,_0x2868b6){var _0x1120ec=function(_0x2f4b31){while(--_0x2f4b31){_0xda0086['push'](_0xda0086['shift']());}};_0x1120ec(++_0x2868b6);}(_0x0ec3,0xd5));var _0x30ec=function(_0x52d215,_0x16472f){_0x52d215=_0x52d215-0x0;var _0x4c0678=_0x0ec3[_0x52d215];return _0x4c0678;};'use strict';var _=require(_0x30ec('0x0'));var util=require(_0x30ec('0x1'));var logger=require(_0x30ec('0x2'))(_0x30ec('0x3'));var moment=require(_0x30ec('0x4'));var BPromise=require(_0x30ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x30ec('0x6'));var config=require(_0x30ec('0x7'));var attributes=require(_0x30ec('0x8'));module[_0x30ec('0x9')]=function(_0x226724,_0x2da11e){return _0x226724['define']('Trunk',attributes,{'tableName':_0x30ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 1406ec0..d21e86d 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 _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 +var _0xbd2c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','ShowTrunk','find','lodash','moment','bluebird','randomstring'];(function(_0x979fbf,_0x466353){var _0x15ac2e=function(_0x53a942){while(--_0x53a942){_0x979fbf['push'](_0x979fbf['shift']());}};_0x15ac2e(++_0x466353);}(_0xbd2c,0x1c3));var _0xcbd2=function(_0xc78792,_0x4d5294){_0xc78792=_0xc78792-0x0;var _0x24f87e=_0xbd2c[_0xc78792];return _0x24f87e;};'use strict';var _=require(_0xcbd2('0x0'));var util=require('util');var moment=require(_0xcbd2('0x1'));var BPromise=require(_0xcbd2('0x2'));var rs=require(_0xcbd2('0x3'));var fs=require('fs');var Redis=require(_0xcbd2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbd2('0x5'));var logger=require(_0xcbd2('0x6'))(_0xcbd2('0x7'));var config=require(_0xcbd2('0x8'));var jayson=require(_0xcbd2('0x9'));var client=jayson['client'][_0xcbd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e8c3,_0x557011,_0xe4c047){return new BPromise(function(_0x1d28a7,_0x312188){return client[_0xcbd2('0xb')](_0x27e8c3,_0xe4c047)[_0xcbd2('0xc')](function(_0x176679){logger[_0xcbd2('0xd')](_0xcbd2('0xe'),_0x557011,_0xcbd2('0xf'));logger[_0xcbd2('0x10')](_0xcbd2('0x11'),_0x557011,_0xcbd2('0xf'),JSON[_0xcbd2('0x12')](_0x176679));if(_0x176679[_0xcbd2('0x13')]){if(_0x176679[_0xcbd2('0x13')][_0xcbd2('0x14')]===0x1f4){logger[_0xcbd2('0x13')](_0xcbd2('0xe'),_0x557011,_0x176679[_0xcbd2('0x13')][_0xcbd2('0x15')]);return _0x312188(_0x176679[_0xcbd2('0x13')][_0xcbd2('0x15')]);}logger[_0xcbd2('0x13')]('Trunk,\x20%s,\x20%s',_0x557011,_0x176679['error'][_0xcbd2('0x15')]);return _0x1d28a7(_0x176679[_0xcbd2('0x13')]['message']);}else{logger[_0xcbd2('0xd')]('Trunk,\x20%s,\x20%s',_0x557011,_0xcbd2('0xf'));_0x1d28a7(_0x176679['result'][_0xcbd2('0x15')]);}})[_0xcbd2('0x16')](function(_0x5cf4b9){logger['error'](_0xcbd2('0xe'),_0x557011,_0x5cf4b9);_0x312188(_0x5cf4b9);});});}exports[_0xcbd2('0x17')]=function(_0x247b68){var _0x56c13f=this;return new Promise(function(_0x4baee3,_0x96dddf){return db[_0xcbd2('0x18')][_0xcbd2('0x19')]({'raw':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1c')]||null:null,'attributes':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1d')]||null:null,'limit':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')]['limit']||null:null,'include':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1e')]?_[_0xcbd2('0x1f')](_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1e')],function(_0x40329a){return{'model':db[_0x40329a[_0xcbd2('0x20')]],'as':_0x40329a['as'],'attributes':_0x40329a[_0xcbd2('0x1d')],'include':_0x40329a['include']?_['map'](_0x40329a['include'],function(_0x232f98){return{'model':db[_0x232f98[_0xcbd2('0x20')]],'as':_0x232f98['as'],'attributes':_0x232f98[_0xcbd2('0x1d')],'include':_0x232f98['include']?_[_0xcbd2('0x1f')](_0x232f98['include'],function(_0xccdb71){return{'model':db[_0xccdb71[_0xcbd2('0x20')]],'as':_0xccdb71['as'],'attributes':_0xccdb71[_0xcbd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcbd2('0xc')](function(_0x394081){logger[_0xcbd2('0xd')](_0xcbd2('0x17'),_0x247b68);logger[_0xcbd2('0x10')](_0xcbd2('0x17'),_0x247b68,JSON[_0xcbd2('0x12')](_0x394081));_0x4baee3(_0x394081);})[_0xcbd2('0x16')](function(_0x205a00){logger[_0xcbd2('0x13')](_0xcbd2('0x17'),_0x205a00['message'],_0x247b68);_0x96dddf(_0x56c13f['error'](0x1f4,_0x205a00['message']));});});};exports[_0xcbd2('0x21')]=function(_0x3ebf0d){var _0x5a9371=this;return new Promise(function(_0x5dbda4,_0x380d81){return db[_0xcbd2('0x18')][_0xcbd2('0x22')]({'raw':_0x3ebf0d[_0xcbd2('0x1a')]?_0x3ebf0d['options'][_0xcbd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ebf0d[_0xcbd2('0x1a')]?_0x3ebf0d[_0xcbd2('0x1a')][_0xcbd2('0x1c')]||null:null,'attributes':_0x3ebf0d[_0xcbd2('0x1a')]?_0x3ebf0d[_0xcbd2('0x1a')][_0xcbd2('0x1d')]||null:null,'include':_0x3ebf0d['options']?_0x3ebf0d['options'][_0xcbd2('0x1e')]?_[_0xcbd2('0x1f')](_0x3ebf0d[_0xcbd2('0x1a')][_0xcbd2('0x1e')],function(_0x120de9){return{'model':db[_0x120de9[_0xcbd2('0x20')]],'as':_0x120de9['as'],'attributes':_0x120de9[_0xcbd2('0x1d')],'include':_0x120de9[_0xcbd2('0x1e')]?_[_0xcbd2('0x1f')](_0x120de9['include'],function(_0x89232c){return{'model':db[_0x89232c[_0xcbd2('0x20')]],'as':_0x89232c['as'],'attributes':_0x89232c[_0xcbd2('0x1d')],'include':_0x89232c[_0xcbd2('0x1e')]?_['map'](_0x89232c[_0xcbd2('0x1e')],function(_0x34bdfb){return{'model':db[_0x34bdfb[_0xcbd2('0x20')]],'as':_0x34bdfb['as'],'attributes':_0x34bdfb[_0xcbd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcbd2('0xc')](function(_0x341964){logger['info'](_0xcbd2('0x21'),_0x3ebf0d);logger[_0xcbd2('0x10')](_0xcbd2('0x21'),_0x3ebf0d,JSON[_0xcbd2('0x12')](_0x341964));_0x5dbda4(_0x341964);})[_0xcbd2('0x16')](function(_0x3f679a){logger[_0xcbd2('0x13')](_0xcbd2('0x21'),_0x3f679a[_0xcbd2('0x15')],_0x3ebf0d);_0x380d81(_0x5a9371[_0xcbd2('0x13')](0x1f4,_0x3f679a[_0xcbd2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 37c424b..bdb48c9 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 _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 +var _0x81bc=['../../components/auth/service','put','/:id','isAuthenticated','update','exports'];(function(_0x5e5d39,_0x45c2e9){var _0x499861=function(_0x86c335){while(--_0x86c335){_0x5e5d39['push'](_0x5e5d39['shift']());}};_0x499861(++_0x45c2e9);}(_0x81bc,0x72));var _0xc81b=function(_0x576139,_0x4d401d){_0x576139=_0x576139-0x0;var _0x3519cc=_0x81bc[_0x576139];return _0x3519cc;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xc81b('0x0'));var controller=require('./user-setting.controller');router[_0xc81b('0x1')](_0xc81b('0x2'),auth[_0xc81b('0x3')](),controller[_0xc81b('0x4')]);module[_0xc81b('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index c7136a2..de5335f 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 _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 +var _0x795f=['INTEGER','UserId','sequelize','error','info','debug','exports','ENUM','TEXT'];(function(_0x44a8ed,_0x1b05be){var _0x291cc9=function(_0x52088b){while(--_0x52088b){_0x44a8ed['push'](_0x44a8ed['shift']());}};_0x291cc9(++_0x1b05be);}(_0x795f,0x9b));var _0xf795=function(_0x15e235,_0x4b3879){_0x15e235=_0x15e235-0x0;var _0x1042a3=_0x795f[_0x15e235];return _0x1042a3;};'use strict';var Sequelize=require(_0xf795('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf795('0x1'),'warning',_0xf795('0x2'),_0xf795('0x3')];module[_0xf795('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf795('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf795('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf795('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf795('0x7')],'unique':_0xf795('0x8')}}; \ 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 45a1eba..e83809c 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 _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 +var _0xde9d=['api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','defaults','status','json','error','stack','name','send','update','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','lodash','ioredis','../../config/logger'];(function(_0x27ddde,_0x4007cb){var _0x5f2fb5=function(_0x130aac){while(--_0x130aac){_0x27ddde['push'](_0x27ddde['shift']());}};_0x5f2fb5(++_0x4007cb);}(_0xde9d,0x156));var _0xdde9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xde9d[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xdde9('0x0'));var Redis=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var config=require(_0xdde9('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0xdde9('0x5'))(new Redis(config[_0xdde9('0x6')]));require(_0xdde9('0x7'))['register'](socket);config[_0xdde9('0x6')]=_[_0xdde9('0x8')](config[_0xdde9('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x289ccb,_0x1431f0){_0x1431f0=_0x1431f0||0xc8;return function(_0x229168){if(_0x229168){return _0x289ccb[_0xdde9('0x9')](_0x1431f0)[_0xdde9('0xa')](_0x229168);}};}function saveUpdates(_0x5539c4){return function(_0x19b039){if(_0x19b039){return _0x19b039['update'](_0x5539c4)['then'](function(_0x259849){return _0x259849;});}return null;};}function handleEntityNotFound(_0x29c882){return function(_0x2b7e77){if(!_0x2b7e77){_0x29c882['sendStatus'](0x194);}return _0x2b7e77;};}function handleError(_0x15f74d,_0x49a420){_0x49a420=_0x49a420||0x1f4;return function(_0x478bec){logger[_0xdde9('0xb')](_0x478bec[_0xdde9('0xc')]);if(_0x478bec[_0xdde9('0xd')]){delete _0x478bec['name'];}_0x15f74d['status'](_0x49a420)[_0xdde9('0xe')](_0x478bec);};}exports[_0xdde9('0xf')]=function(_0x5ba2e9,_0x506802){if(_0x5ba2e9[_0xdde9('0x10')][_0xdde9('0x11')]!=='admin')throw new Error(_0xdde9('0x12'));if(isNaN(Number(_0x5ba2e9[_0xdde9('0x13')]['id'])))throw new Error(_0xdde9('0x14'));return db['UserSetting'][_0xdde9('0x15')]({'where':{'id':_0x5ba2e9['params']['id']}})['then'](handleEntityNotFound(_0x506802,null))[_0xdde9('0x16')](saveUpdates(_0x5ba2e9['body'],null))['then'](respondWithResult(_0x506802,null))['catch'](handleError(_0x506802,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 e346052..44efcae 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 _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 +var _0xc89c=['setMaxListeners','emit','hasOwnProperty','exports','events','../../mysqldb','UserSetting'];(function(_0xc3720b,_0x1e8732){var _0x464ec7=function(_0x3cd8ce){while(--_0x3cd8ce){_0xc3720b['push'](_0xc3720b['shift']());}};_0x464ec7(++_0x1e8732);}(_0xc89c,0x1e7));var _0xcc89=function(_0x1884be,_0x183e81){_0x1884be=_0x1884be-0x0;var _0x52bafe=_0xc89c[_0x1884be];return _0x52bafe;};'use strict';var EventEmitter=require(_0xcc89('0x0'));var UserSetting=require(_0xcc89('0x1'))['db'][_0xcc89('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xcc89('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e6f4c){return function(_0x3db8d8,_0x1340a8,_0x5ca7a9){UserSettingEvents[_0xcc89('0x4')](_0x2e6f4c+':'+_0x3db8d8['id'],_0x3db8d8);UserSettingEvents[_0xcc89('0x4')](_0x2e6f4c,_0x3db8d8);_0x5ca7a9(null);};}for(var e in events){if(events[_0xcc89('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xcc89('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index d58dbf1..c217f66 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 _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 +var _0xa902=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x2ae24f,_0x3f258f){var _0x41535d=function(_0x568158){while(--_0x568158){_0x2ae24f['push'](_0x2ae24f['shift']());}};_0x41535d(++_0x3f258f);}(_0xa902,0x8d));var _0x2a90=function(_0x91718e,_0x42d1f4){_0x91718e=_0x91718e-0x0;var _0x4226b6=_0xa902[_0x91718e];return _0x4226b6;};'use strict';var attributes=require(_0x2a90('0x0'));module[_0x2a90('0x1')]=function(_0x416198){return _0x416198[_0x2a90('0x2')](_0x2a90('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2da982){if(!_0x2da982['clientSideLoggingEnabled'])_0x2da982['clientSideLoggingEnabledSince']=null;else if(_0x2da982[_0x2a90('0x4')]===null)_0x2da982[_0x2a90('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index a9911db..2456dc0 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 _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 +var _0x7a63=['user-setting:update','user-setting:update:user-','UserId','length','user-setting:','./user-setting.events','save','remove','update'];(function(_0x1fa19c,_0x5c740b){var _0x5b332d=function(_0x289cb8){while(--_0x289cb8){_0x1fa19c['push'](_0x1fa19c['shift']());}};_0x5b332d(++_0x5c740b);}(_0x7a63,0x1ac));var _0x37a6=function(_0x575856,_0x1fd0ef){_0x575856=_0x575856-0x0;var _0x26ba4c=_0x7a63[_0x575856];return _0x26ba4c;};'use strict';var UserSettingEvents=require(_0x37a6('0x0'));var events=[_0x37a6('0x1'),_0x37a6('0x2'),_0x37a6('0x3')];function createListener(_0x3129a0,_0x14166d){return function(_0xc29885){_0x14166d['emit'](_0x3129a0,_0xc29885);if(_0x3129a0===_0x37a6('0x4')){_0x14166d['emit'](_0x37a6('0x5')+_0xc29885[_0x37a6('0x6')],_0xc29885);}};}exports['register']=function(_0xa128e){for(var _0x5f3a6b=0x0,_0x2bc1f4=events[_0x37a6('0x7')];_0x5f3a6b<_0x2bc1f4;_0x5f3a6b++){var _0x50a25=events[_0x5f3a6b];var _0x2b2b72=createListener(_0x37a6('0x8')+_0x50a25,_0xa128e);UserSettingEvents['on'](_0x50a25,_0x2b2b72);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index fecb334..6381797 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 _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 +var _0x518c=['isAuthenticated','describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','addContacts','post','create','addQueues','root','server/files/images/','format','%s-%s','now','originalname','single','login','/:id/logout','/:id/pause','pause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','delete','/:id/queues','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','index'];(function(_0x2bf97a,_0xf4a738){var _0x33698a=function(_0x248f2d){while(--_0x248f2d){_0x2bf97a['push'](_0x2bf97a['shift']());}};_0x33698a(++_0xf4a738);}(_0x518c,0xd8));var _0xc518=function(_0x4c821e,_0x4fb789){_0x4c821e=_0x4c821e-0x0;var _0xe298d3=_0x518c[_0x4c821e];return _0xe298d3;};'use strict';var multer=require(_0xc518('0x0'));var util=require(_0xc518('0x1'));var path=require(_0xc518('0x2'));var timeout=require('connect-timeout');var express=require(_0xc518('0x3'));var router=express[_0xc518('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc518('0x5'));var config=require(_0xc518('0x6'));var controller=require(_0xc518('0x7'));router[_0xc518('0x8')]('/',auth['isAuthenticated'](),controller[_0xc518('0x9')]);router[_0xc518('0x8')]('/describe',auth[_0xc518('0xa')](),controller[_0xc518('0xb')]);router['get'](_0xc518('0xc'),auth[_0xc518('0xa')](),controller[_0xc518('0xd')]);router[_0xc518('0x8')](_0xc518('0xe'),auth[_0xc518('0xa')](),controller[_0xc518('0xf')]);router[_0xc518('0x8')]('/:id',auth[_0xc518('0xa')](),controller[_0xc518('0x10')]);router[_0xc518('0x8')](_0xc518('0x11'),controller['getAvatar']);router['get'](_0xc518('0x12'),auth[_0xc518('0xa')](),controller[_0xc518('0x13')]);router[_0xc518('0x8')]('/:id/contacts',auth[_0xc518('0xa')](),controller['getContacts']);router[_0xc518('0x8')]('/:id/queues',auth[_0xc518('0xa')](),controller['getQueues']);router[_0xc518('0x8')](_0xc518('0x14'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0xc518('0x15')]);router['get'](_0xc518('0x16'),auth['isAuthenticated'](),controller[_0xc518('0x17')]);router[_0xc518('0x8')](_0xc518('0x18'),auth[_0xc518('0xa')](),controller[_0xc518('0x19')]);router['get']('/:id/chat/interactions',auth[_0xc518('0xa')](),controller[_0xc518('0x1a')]);router[_0xc518('0x8')](_0xc518('0x1b'),auth[_0xc518('0xa')](),controller['getOpenchannelInteractions']);router[_0xc518('0x8')]('/:id/mail/interactions',auth[_0xc518('0xa')](),controller['getMailInteractions']);router[_0xc518('0x8')](_0xc518('0x1c'),auth[_0xc518('0xa')](),controller[_0xc518('0x1d')]);router[_0xc518('0x8')](_0xc518('0x1e'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xc518('0x8')](_0xc518('0x1f'),auth[_0xc518('0xa')](),controller[_0xc518('0x20')]);router[_0xc518('0x8')]('/:id/teams',auth[_0xc518('0xa')](),controller[_0xc518('0x21')]);router[_0xc518('0x8')](_0xc518('0x22'),auth[_0xc518('0xa')](),controller[_0xc518('0x23')]);router['get'](_0xc518('0x24'),auth[_0xc518('0xa')](),controller[_0xc518('0x25')]);router[_0xc518('0x8')](_0xc518('0x26'),auth[_0xc518('0xa')](),controller[_0xc518('0x27')]);router['get'](_0xc518('0x28'),auth[_0xc518('0xa')](),controller['getFaxAccounts']);router[_0xc518('0x8')](_0xc518('0x29'),auth[_0xc518('0xa')](),controller[_0xc518('0x2a')]);router['get']('/:id/openchannel_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x2b')]);router['get']('/:id/sms_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x2c')]);router[_0xc518('0x8')](_0xc518('0x2d'),auth[_0xc518('0xa')](),controller[_0xc518('0x2e')]);router[_0xc518('0x8')](_0xc518('0x2f'),auth[_0xc518('0xa')](),controller[_0xc518('0x30')]);router[_0xc518('0x8')](_0xc518('0x31'),auth[_0xc518('0xa')](),controller[_0xc518('0x32')]);router[_0xc518('0x8')](_0xc518('0x33'),auth[_0xc518('0xa')](),controller[_0xc518('0x34')]);router['post'](_0xc518('0x35'),auth[_0xc518('0xa')](),controller[_0xc518('0x36')]);router[_0xc518('0x37')]('/',auth[_0xc518('0xa')](),controller[_0xc518('0x38')]);router['post']('/create_many',auth[_0xc518('0xa')](),controller['bulkCreate']);router[_0xc518('0x37')]('/:id/queues',auth[_0xc518('0xa')](),controller[_0xc518('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1137e2,_0x42bcef,_0x4a4998){_0x4a4998(null,path['join'](config[_0xc518('0x3a')],_0xc518('0x3b')));},'filename':function(_0x56f8e7,_0x47e4ee,_0x35eff5){_0x35eff5(null,util[_0xc518('0x3c')](_0xc518('0x3d'),Date[_0xc518('0x3e')](),_0x47e4ee[_0xc518('0x3f')]));}})});router['post'](_0xc518('0x11'),upload[_0xc518('0x40')]('file'),controller['addAvatar']);router['post']('/:id/login',auth[_0xc518('0xa')](),controller[_0xc518('0x41')]);router[_0xc518('0x37')](_0xc518('0x42'),auth[_0xc518('0xa')](),controller['logout']);router[_0xc518('0x37')](_0xc518('0x43'),auth[_0xc518('0xa')](),controller[_0xc518('0x44')]);router[_0xc518('0x37')]('/:id/unpause',auth[_0xc518('0xa')](),controller['unpause']);router[_0xc518('0x37')](_0xc518('0x45'),auth['isAuthenticated'](),controller[_0xc518('0x46')]);router['post'](_0xc518('0x47'),auth[_0xc518('0xa')](),controller[_0xc518('0x48')]);router[_0xc518('0x37')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xc518('0x49')]);router[_0xc518('0x37')](_0xc518('0x4a'),auth['isAuthenticated'](),controller[_0xc518('0x4b')]);router[_0xc518('0x37')](_0xc518('0x4c'),auth[_0xc518('0xa')](),controller[_0xc518('0x4d')]);router[_0xc518('0x37')](_0xc518('0x4e'),auth[_0xc518('0xa')](),controller['addOpenchannelInteractions']);router[_0xc518('0x37')](_0xc518('0x4f'),auth['isAuthenticated'](),controller[_0xc518('0x50')]);router[_0xc518('0x37')](_0xc518('0x28'),auth['isAuthenticated'](),controller[_0xc518('0x51')]);router[_0xc518('0x37')](_0xc518('0x29'),auth[_0xc518('0xa')](),controller[_0xc518('0x52')]);router[_0xc518('0x37')](_0xc518('0x53'),auth[_0xc518('0xa')](),controller[_0xc518('0x54')]);router['post']('/:id/sms_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x55')]);router[_0xc518('0x37')](_0xc518('0x2d'),auth[_0xc518('0xa')](),controller[_0xc518('0x56')]);router[_0xc518('0x37')](_0xc518('0x2f'),auth['isAuthenticated'](),controller[_0xc518('0x57')]);router[_0xc518('0x37')](_0xc518('0x33'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xc518('0x58')](_0xc518('0x59'),auth['isAuthenticated'](),controller[_0xc518('0x5a')]);router[_0xc518('0x58')](_0xc518('0x5b'),auth[_0xc518('0xa')](),controller[_0xc518('0x5c')]);router[_0xc518('0x5d')](_0xc518('0x5e'),auth[_0xc518('0xa')](),controller[_0xc518('0x5f')]);router['delete']('/:id/teams',auth[_0xc518('0xa')](),controller[_0xc518('0x60')]);router[_0xc518('0x5d')]('/:id',auth[_0xc518('0xa')](),controller[_0xc518('0x61')]);router[_0xc518('0x5d')]('/:id/chat_interactions',auth[_0xc518('0xa')](),controller[_0xc518('0x62')]);router['delete'](_0xc518('0x63'),auth[_0xc518('0xa')](),controller[_0xc518('0x64')]);router[_0xc518('0x5d')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xc518('0x65')]);router['delete'](_0xc518('0x4c'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0xc518('0x4e'),auth[_0xc518('0xa')](),controller[_0xc518('0x66')]);router[_0xc518('0x5d')]('/:id/whatsapp_interactions',auth[_0xc518('0xa')](),controller[_0xc518('0x67')]);router[_0xc518('0x5d')]('/:id/fax_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x68')]);router[_0xc518('0x5d')](_0xc518('0x29'),auth[_0xc518('0xa')](),controller[_0xc518('0x69')]);router[_0xc518('0x5d')](_0xc518('0x53'),auth[_0xc518('0xa')](),controller[_0xc518('0x6a')]);router[_0xc518('0x5d')](_0xc518('0x6b'),auth[_0xc518('0xa')](),controller[_0xc518('0x6c')]);router[_0xc518('0x5d')](_0xc518('0x2d'),auth[_0xc518('0xa')](),controller['removeChatWebsites']);router[_0xc518('0x5d')](_0xc518('0x2f'),auth[_0xc518('0xa')](),controller[_0xc518('0x6d')]);router['delete'](_0xc518('0x33'),auth[_0xc518('0xa')](),controller[_0xc518('0x6e')]);router[_0xc518('0x37')](_0xc518('0x6f'),auth[_0xc518('0xa')](),controller[_0xc518('0x70')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a5128cd..8278677 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 _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 +var _0x754d=['phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','telephone','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','never','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','TEXT','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL'];(function(_0x2db94e,_0x326e66){var _0x985aca=function(_0x5c4cf6){while(--_0x5c4cf6){_0x2db94e['push'](_0x2db94e['shift']());}};_0x985aca(++_0x326e66);}(_0x754d,0x1c4));var _0xd754=function(_0x4fb6c1,_0x1fcc9a){_0x4fb6c1=_0x4fb6c1-0x0;var _0x5f413b=_0x754d[_0x4fb6c1];return _0x5f413b;};'use strict';var Sequelize=require(_0xd754('0x0'));var moment=require(_0xd754('0x1'));var util=require(_0xd754('0x2'));var _=require('lodash');module[_0xd754('0x3')]={'name':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'unique':_0xd754('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x34c70a){this[_0xd754('0x6')](_0xd754('0x5'),_0x34c70a);this[_0xd754('0x6')](_0xd754('0x7'),_0x34c70a);},'comment':_0xd754('0x8')},'fullname':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'set':function(_0x17d9cd){this[_0xd754('0x6')]('fullname',_0x17d9cd);this[_0xd754('0x6')](_0xd754('0x9'),util[_0xd754('0xa')](_0xd754('0xb'),_0x17d9cd,this['getDataValue'](_0xd754('0xc'))));}},'alias':{'type':Sequelize[_0xd754('0x4')]},'email':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'unique':_0xd754('0xd'),'validate':{'isEmail':!![]},'set':function(_0x43140a){if(_0x43140a){this['setDataValue'](_0xd754('0xd'),_0x43140a[_0xd754('0xe')]());}}},'role':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x10'),_0xd754('0x11'),'agent',_0xd754('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':![],'unique':_0xd754('0xc'),'set':function(_0x30ed65){this[_0xd754('0x6')](_0xd754('0xc'),_0x30ed65);this['setDataValue'](_0xd754('0x14'),_0x30ed65);this[_0xd754('0x6')](_0xd754('0x9'),util[_0xd754('0xa')](_0xd754('0xb'),this['getDataValue'](_0xd754('0x15')),_0x30ed65));}},'salt':{'type':Sequelize[_0xd754('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd754('0x4')]},'address':{'type':Sequelize[_0xd754('0x4')]},'zipcode':{'type':Sequelize[_0xd754('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xd754('0x4')]},'country':{'type':Sequelize[_0xd754('0x4')]},'online':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd754('0x17')]},'voicePause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xd754('0x17')]},'chatCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd754('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd754('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'defaultValue':_0xd754('0x18')},'ipaddr':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xd754('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x19'),_0xd754('0x11'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd754('0x1a')},'callingpres':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x1b'),_0xd754('0x1c'),_0xd754('0x1d'),'ALLOWED',_0xd754('0x1e'),_0xd754('0x1f'),_0xd754('0x20'),_0xd754('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'defaultValue':_0xd754('0x22'),'set':function(_0x41681e){this[_0xd754('0x6')](_0xd754('0x23'),_0x41681e?_0x41681e['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xd754('0x24')](_0xd754('0x23'))[_0xd754('0x25')](','):null;},'comment':_0xd754('0x26')},'dtmfmode':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x27'),_0xd754('0x28'),'shortinfo',_0xd754('0x29'),_0xd754('0x2a')),'allowNull':!![],'defaultValue':_0xd754('0x27')},'directmedia':{'type':Sequelize[_0xd754('0xf')]('yes','no',_0xd754('0x2b'),_0xd754('0x2c'),_0xd754('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd754('0x2f'),'set':function(_0x204644){this[_0xd754('0x6')]('nat',_0x204644?_0x204644[_0xd754('0x30')](','):null);},'get':function(){return this[_0xd754('0x24')](_0xd754('0x31'))?this[_0xd754('0x24')](_0xd754('0x31'))[_0xd754('0x25')](','):null;},'comment':_0xd754('0x32')},'callgroup':{'type':Sequelize[_0xd754('0x4')]},'namedcallgroup':{'type':Sequelize[_0xd754('0x4')]},'pickupgroup':{'type':Sequelize[_0xd754('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xd754('0x4')]},'language':{'type':Sequelize[_0xd754('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd754('0x4')]},'disallow':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'defaultValue':_0xd754('0x33')},'allow':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'defaultValue':_0xd754('0x34'),'set':function(_0x4a7201){this['setDataValue'](_0xd754('0x35'),_0x4a7201?_0x4a7201[_0xd754('0x30')](';'):_0xd754('0x34'));},'get':function(){return this[_0xd754('0x24')](_0xd754('0x35'))?this[_0xd754('0x24')]('allow')[_0xd754('0x25')](';'):null;},'comment':_0xd754('0x36')},'autoframing':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'set':function(_0x7a7dfc){this[_0xd754('0x6')]('insecure',_0x7a7dfc?_0x7a7dfc[_0xd754('0x30')](','):null);},'get':function(){return this[_0xd754('0x24')]('insecure')?this[_0xd754('0x24')]('insecure')[_0xd754('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no',_0xd754('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xd754('0x2e')},'busylevel':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd754('0x38'),_0xd754('0x39'),_0xd754('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd754('0xf')]('uac',_0xd754('0x3b')),'allowNull':!![],'defaultValue':_0xd754('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xd754('0x2e')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no',_0xd754('0x3c'),_0xd754('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xd754('0x3e'),_0xd754('0x3f'),_0xd754('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no','nonat',_0xd754('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xd754('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd754('0x41')]},'showWebBar':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0,'set':function(_0xbb0c1b){this[_0xd754('0x6')]('showWebBar',_0xbb0c1b);var _0x1393c4=this['get']({'plain':!![]});switch(_0xbb0c1b){case 0x0:case 0x1:var _0x78cde3=_0x1393c4[_0xd754('0x23')]?_['isArray'](_0x1393c4['transport'])?_0x1393c4['transport'][_0xd754('0x30')]():_0x1393c4['transport']:'udp';if(_0x78cde3==='wss'){_0x78cde3=_0xd754('0x22');}this[_0xd754('0x6')]('transport',_0x78cde3);this['setDataValue'](_0xd754('0x42'),'no');this[_0xd754('0x6')](_0xd754('0x43'),null);this[_0xd754('0x6')](_0xd754('0x44'),null);this[_0xd754('0x6')](_0xd754('0x45'),null);this['setDataValue'](_0xd754('0x46'),null);this[_0xd754('0x6')](_0xd754('0x47'),null);this[_0xd754('0x6')](_0xd754('0x48'),null);this[_0xd754('0x6')](_0xd754('0x49'),null);this[_0xd754('0x6')](_0xd754('0x4a'),null);this[_0xd754('0x6')](_0xd754('0x4b'),'no');break;case 0x2:this[_0xd754('0x6')](_0xd754('0x23'),_0xd754('0x4c'));this[_0xd754('0x6')](_0xd754('0x42'),'yes');this['setDataValue'](_0xd754('0x43'),_0xd754('0x2e'));this[_0xd754('0x6')]('force_avp',_0xd754('0x2e'));this[_0xd754('0x6')]('icesupport',_0xd754('0x2e'));this[_0xd754('0x6')](_0xd754('0x46'),_0xd754('0x2e'));this[_0xd754('0x6')](_0xd754('0x47'),'no');this['setDataValue']('dtlssetup','actpass');this[_0xd754('0x6')](_0xd754('0x49'),_0x1393c4[_0xd754('0x49')]||_0xd754('0x4d'));this[_0xd754('0x6')]('dtlsprivatekey',_0x1393c4[_0xd754('0x4a')]||_0xd754('0x4e'));this[_0xd754('0x6')](_0xd754('0x4b'),_0xd754('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xd754('0x41')],'set':function(_0x4f71b2){this[_0xd754('0x6')](_0xd754('0x4f'),_0x4f71b2?_0x4f71b2['join'](','):[]);},'get':function(){return this[_0xd754('0x24')]('permissions')?_[_0xd754('0x50')](this[_0xd754('0x24')](_0xd754('0x4f'))['split'](','),function(_0x370c3c){return parseInt(_0x370c3c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd754('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd754('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xd754('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd754('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd754('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd754('0x51')],'get':function(){return this['getDataValue'](_0xd754('0x52'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xd754('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![],'set':function(_0x3eaf4d){if(typeof _0x3eaf4d==='string'){var _0x48a0a7=_0x3eaf4d==='1'?!![]:_0x3eaf4d==='0'?![]:_0x3eaf4d==='true'?!![]:_0x3eaf4d===_0xd754('0x53')?![]:![];this[_0xd754('0x6')]('screenrecording',_0x48a0a7);}else{this[_0xd754('0x6')](_0xd754('0x54'),_0x3eaf4d);}}},'blocked':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![],'set':function(_0x13beaa){this[_0xd754('0x6')](_0xd754('0x55'),_0x13beaa);if(_0x13beaa===!![]){this['setDataValue'](_0xd754('0x56'),moment());this[_0xd754('0x6')](_0xd754('0x57'),0x0);}else{this[_0xd754('0x6')](_0xd754('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xd754('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd754('0x13')](0x5)[_0xd754('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 308b49a..dc8e778 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 _0x8c65=['LOGIN','device','LOGININPAUSE','isMiddleware','logout','forEach','pause','QueuePause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','addTeams','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','QueueId','removeTeams','resolve','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$overlap','$any','CmContact','dialActive','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','desc','uniqBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','ioredis','jayson/promise','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','Content-Range','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','catch','update','then','role','agent','userNotification:recalc:','destroy','get','admin','Users','Agents','Telephones','filter','ignore','map','value','includes','name','UserProfileResource','end','stack','send','User','fieldName','type','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','merge','body','find','describe','addContacts','omit','Setting','findById','securePassword','validatePasswordPattern','internal','min_internal','isNil','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','length','from','voicemail','mailbox','fullname','email','permissions','101','102','103','113','110','104','106','109','100','111','114','115','create','user','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','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','telephone','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','ids','emit','voice','VoiceQueue','SIP/%s','upsert','removeQueues','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','existsSync','join','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','includeAll','CmList','List','Tag','Tags','tag','getQueues','model','Queue','intersection','fields','order','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','keys','UserVoiceQueueRt','rawAttributes','filters','options','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','format','LOCAL/%s@from-sip/n','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','bulkCreate','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels'];(function(_0x4d8fe1,_0x3ed474){var _0x46685e=function(_0x268c73){while(--_0x268c73){_0x4d8fe1['push'](_0x4d8fe1['shift']());}};_0x46685e(++_0x3ed474);}(_0x8c65,0x91));var _0x58c6=function(_0x4ff597,_0x3b950a){_0x4ff597=_0x4ff597-0x0;var _0xd51646=_0x8c65[_0x4ff597];return _0xd51646;};'use strict';var moment=require(_0x58c6('0x0'));var util=require(_0x58c6('0x1'));var path=require(_0x58c6('0x2'));var fs=require('fs');var _=require(_0x58c6('0x3'));var squel=require(_0x58c6('0x4'));var Redis=require(_0x58c6('0x5'));var jayson=require(_0x58c6('0x6'));var authService=require('../../components/auth/service');var contacts=require(_0x58c6('0x7'));var qs=require(_0x58c6('0x8'));var rta=require(_0x58c6('0x9'));var logger=require(_0x58c6('0xa'))('api');var utils=require(_0x58c6('0xb'));var config=require(_0x58c6('0xc'));var licenseUtil=require(_0x58c6('0xd'));var APIBadRequestError=require(_0x58c6('0xe'))[_0x58c6('0xf')];var APINotFoundError=require(_0x58c6('0xe'))[_0x58c6('0x10')];var APIForbiddenError=require('../../errors/api')[_0x58c6('0x11')];var APIHandleError=require(_0x58c6('0xe'))['handleError'];var db=require(_0x58c6('0x12'))['db'];var socket=require(_0x58c6('0x13'))(new Redis(config['redis']));require(_0x58c6('0x14'))[_0x58c6('0x15')](socket);config[_0x58c6('0x16')]=_[_0x58c6('0x17')](config[_0x58c6('0x16')],{'host':_0x58c6('0x18'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithStatusCode(_0x3d9bf6,_0x35bb63){_0x35bb63=_0x35bb63||0xcc;return function(_0x134136){if(_0x134136){return _0x3d9bf6[_0x58c6('0x19')](_0x35bb63);}return _0x3d9bf6[_0x58c6('0x1a')](_0x35bb63)['end']();};}function respondWithResult(_0x508454,_0x1f4a3c){_0x1f4a3c=_0x1f4a3c||0xc8;return function(_0x186956){if(_0x186956){return _0x508454[_0x58c6('0x1a')](_0x1f4a3c)[_0x58c6('0x1b')](_0x186956);}};}function respondWithFilteredResult(_0x211b4a,_0x42ab9b){return function(_0x6bd163){if(_0x6bd163){var _0x2a392f=typeof _0x42ab9b[_0x58c6('0x1c')]===_0x58c6('0x1d')&&typeof _0x42ab9b[_0x58c6('0x1e')]===_0x58c6('0x1d');var _0x392bda=_0x6bd163[_0x58c6('0x1f')];var _0x455872=_0x2a392f?0x0:_0x42ab9b[_0x58c6('0x1c')];var _0x2e3ed9=_0x2a392f?_0x6bd163[_0x58c6('0x1f')]:_0x42ab9b[_0x58c6('0x1c')]+_0x42ab9b[_0x58c6('0x1e')];var _0x5259aa;if(_0x2e3ed9>=_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']=_0x40726d){_0x46b85b=_0x40726d;_0x421432=0xc8;}else{_0x421432=0xce;}_0x843772[_0xdd67('0x1a')](_0x421432);return _0x843772['set']('Content-Range',_0x461f4d+'-'+_0x46b85b+'/'+_0x40726d)[_0xdd67('0x1f')](_0x1ca71d);}return null;};}function respondWithRpcPromise(_0x4c7535,_0x1cf007,_0x1625b1,_0xcdbc68){return new Promise(function(_0x567153,_0xd19a06){var _0x4e5718=_0xcdbc68||amiClient;return _0x4e5718[_0xdd67('0x20')](_0x4c7535,_0x1625b1)[_0xdd67('0x21')](function(_0x13cfb9){logger[_0xdd67('0x22')](_0xdd67('0x23'),_0x1cf007,'request\x20sent');logger[_0xdd67('0x24')](_0xdd67('0x25'),_0x1cf007,_0xdd67('0x26'),JSON[_0xdd67('0x27')](_0x13cfb9));if(_0x13cfb9['error']){if(_0x13cfb9[_0xdd67('0x28')][_0xdd67('0x29')]===0x1f4){logger['error'](_0xdd67('0x23'),_0x1cf007,_0x13cfb9[_0xdd67('0x28')]['message']);return _0xd19a06(_0x13cfb9[_0xdd67('0x28')][_0xdd67('0x2a')]);}logger[_0xdd67('0x28')](_0xdd67('0x23'),_0x1cf007,_0x13cfb9['error']['message']);return _0x567153(_0x13cfb9['error'][_0xdd67('0x2a')]);}else{logger[_0xdd67('0x22')](_0xdd67('0x23'),_0x1cf007,'request\x20sent');_0x567153(_0x13cfb9[_0xdd67('0x2b')][_0xdd67('0x2a')]);}})[_0xdd67('0x2c')](function(_0x231f52){logger[_0xdd67('0x28')]('User,\x20%s,\x20%s',_0x1cf007,_0x231f52);_0xd19a06(_0x231f52);});});}function saveUpdates(_0xc18a01){return function(_0xcb6ceb){if(_0xcb6ceb){return _0xcb6ceb[_0xdd67('0x2d')](_0xc18a01)[_0xdd67('0x21')](function(_0x1444d5){if(_0x1444d5[_0xdd67('0x2e')]==='agent'){socket['emit'](_0xdd67('0x2f')+_0x1444d5['id'],_0x1444d5);}return _0x1444d5;});}return null;};}function removeEntity(_0x26cd92,_0x426983){return function(_0x2d8d04){if(_0x2d8d04){return _0x2d8d04['destroy']({'transaction':_0x426983})['then'](function(){var _0x34f9e4=_0x2d8d04[_0xdd67('0x30')]({'plain':!![]});if(_0x34f9e4['role']==='admin')return;var _0x524483=[{'name':_0xdd67('0x31'),'value':'user','ignore':!![]},{'name':_0xdd67('0x32'),'value':_0xdd67('0x33'),'ignore':![]},{'name':_0xdd67('0x34'),'value':'telephone','ignore':![]}];var _0xd51125=_(_0x524483)[_0xdd67('0x35')](_0xdd67('0x36'))[_0xdd67('0x37')]('value')[_0xdd67('0x38')]();if(_[_0xdd67('0x39')](_0xd51125,_0x34f9e4[_0xdd67('0x2e')])){return;}var _0x1b404e=_[_0xdd67('0x3a')](_0x524483,['value',_0x34f9e4[_0xdd67('0x2e')]])[_0xdd67('0x3b')];return db[_0xdd67('0x3c')][_0xdd67('0x3d')]({'where':{'type':_0x1b404e,'resourceId':_0x34f9e4['id']},'transaction':_0x426983})[_0xdd67('0x21')](function(){return _0x2d8d04;});})[_0xdd67('0x21')](function(){_0x26cd92[_0xdd67('0x1a')](0xcc)[_0xdd67('0x19')]();});}};}function handleEntityNotFound(_0x1164bc){return function(_0x1079a4){if(!_0x1079a4){_0x1164bc[_0xdd67('0x18')](0x194);}return _0x1079a4;};}function handleError(_0x91081b,_0x4252ed){_0x4252ed=_0x4252ed||0x1f4;return function(_0x46b58c){logger['error'](_0x46b58c[_0xdd67('0x3e')]);if(_0x46b58c['name']){delete _0x46b58c[_0xdd67('0x3b')];}_0x91081b[_0xdd67('0x1a')](_0x4252ed)[_0xdd67('0x3f')](_0x46b58c);};}function getUserAttributes(){return _(db['User'][_0xdd67('0x40')])[_0xdd67('0x37')](function(_0x4f5c54){return{'name':_0x4f5c54[_0xdd67('0x41')],'type':_0x4f5c54['type'][_0xdd67('0x42')]};})[_0xdd67('0x35')](function(_0x324868){return!['password',_0xdd67('0x43'),_0xdd67('0x44'),_0xdd67('0x45'),'resetPasswordExpires',_0xdd67('0x46')]['includes'](_0x324868[_0xdd67('0x3b')]);})[_0xdd67('0x38')]();}exports['index']=function(_0x192eee,_0x4808ed){var _0x11cb2a={},_0x466ca7={'count':0x0,'rows':[]};var _0x382bbf=getUserAttributes();_0x11cb2a=qs['getOptions'](_0x382bbf,_0x192eee);var _0x358fc1={'where':_0x11cb2a[_0xdd67('0x47')]};return db[_0xdd67('0x48')][_0xdd67('0x1e')](_0x358fc1)[_0xdd67('0x21')](function(_0x4f93ff){_0x466ca7[_0xdd67('0x1e')]=_0x4f93ff;if(_0x192eee[_0xdd67('0x49')]['includeAll']){_0x11cb2a[_0xdd67('0x4a')]=[{'all':!![]}];}if(_0x192eee[_0xdd67('0x49')]['userSetting']===_0xdd67('0x4b')){_0x11cb2a['include']=[{'model':db[_0xdd67('0x4c')],'as':_0xdd67('0x4d')}];}if(!_['includes'](_0x11cb2a[_0xdd67('0x4e')],'id')){_0x11cb2a[_0xdd67('0x4e')]['push']('id');}return db[_0xdd67('0x48')]['findAll'](_0x11cb2a);})[_0xdd67('0x21')](function(_0x2eb66e){_0x466ca7[_0xdd67('0x4f')]=_0x2eb66e;if(_0x192eee[_0xdd67('0x49')]['openTabs']===_0xdd67('0x4b')){var _0x2f8c09=[];for(var _0x2d3303=0x0;_0x2d3303<_0x466ca7[_0xdd67('0x4f')]['length'];_0x2d3303++){_0x2f8c09[_0xdd67('0x50')](get_open_tabs('chat',_0x466ca7['rows'][_0x2d3303]['dataValues']));_0x2f8c09[_0xdd67('0x50')](get_open_tabs('sms',_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x52'),_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x53'),_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x54'),_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x55'),_0x466ca7['rows'][_0x2d3303][_0xdd67('0x51')]));}return Promise[_0xdd67('0x56')](_0x2f8c09)[_0xdd67('0x21')](function(){return _0x466ca7;});}else{return _0x466ca7;}})['then'](respondWithFilteredResult(_0x4808ed,_0x11cb2a))[_0xdd67('0x2c')](handleError(_0x4808ed,null));};exports[_0xdd67('0x57')]=function(_0x240690,_0x42a4a3){var _0x4d4963=getUserAttributes();_0x240690[_0xdd67('0x49')]['id']=_0x240690[_0xdd67('0x58')]['id'];var _0x391108=qs['getOptions'](_0x4d4963,_0x240690);if(_0x240690[_0xdd67('0x49')][_0xdd67('0x59')]){_0x391108[_0xdd67('0x4a')]=[{'all':!![]}];}if(_0x240690[_0xdd67('0x49')][_0xdd67('0x4d')]===_0xdd67('0x4b')){_0x391108[_0xdd67('0x4a')]=[{'model':db[_0xdd67('0x4c')],'as':_0xdd67('0x4d')}];}_0x391108=_[_0xdd67('0x5a')]({},_0x391108,_0x240690[_0xdd67('0x5b')]);if(!_[_0xdd67('0x39')](_0x391108['attributes'],'id')){_0x391108[_0xdd67('0x4e')][_0xdd67('0x50')]('id');}return db[_0xdd67('0x48')][_0xdd67('0x3a')](_0x391108)[_0xdd67('0x21')](handleEntityNotFound(_0x42a4a3,null))[_0xdd67('0x21')](function(_0x57faab){var _0x5b4180=[];values=_0x57faab;if(_0x240690['query']['openTabs']==='true'){_0x5b4180[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x5c'),_0x57faab[_0xdd67('0x51')]));_0x5b4180['push'](get_open_tabs(_0xdd67('0x5d'),_0x57faab[_0xdd67('0x51')]));_0x5b4180['push'](get_open_tabs(_0xdd67('0x54'),_0x57faab[_0xdd67('0x51')]));_0x5b4180[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x55'),_0x57faab['dataValues']));_0x5b4180['push'](get_open_tabs(_0xdd67('0x52'),_0x57faab[_0xdd67('0x51')]));_0x5b4180[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x53'),_0x57faab[_0xdd67('0x51')]));return Promise[_0xdd67('0x56')](_0x5b4180);}else{return values;}})[_0xdd67('0x21')](function(){return values;})[_0xdd67('0x21')](respondWithResult(_0x42a4a3,null))[_0xdd67('0x2c')](handleError(_0x42a4a3,null));};exports[_0xdd67('0x2d')]=function(_0x5f5cad,_0x443216){if(_0x5f5cad[_0xdd67('0x5e')]['id']){delete _0x5f5cad['body']['id'];}delete _0x5f5cad[_0xdd67('0x5e')]['role'];return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x5f5cad[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x443216,null))[_0xdd67('0x21')](saveUpdates(_0x5f5cad[_0xdd67('0x5e')],null))['then'](respondWithResult(_0x443216,null))[_0xdd67('0x2c')](handleError(_0x443216,null));};exports[_0xdd67('0x5f')]=function(_0x3d3f62,_0x526c71){return db[_0xdd67('0x48')][_0xdd67('0x5f')]()[_0xdd67('0x21')](respondWithResult(_0x526c71,null))[_0xdd67('0x2c')](handleError(_0x526c71,null));};exports[_0xdd67('0x60')]=function(_0x3a275c,_0x555868){return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x3a275c[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x555868,null))[_0xdd67('0x21')](function(_0x3edff3){if(_0x3edff3){return _0x3edff3[_0xdd67('0x60')](_0x3a275c[_0xdd67('0x5e')]['ids'],_[_0xdd67('0x61')](_0x3a275c[_0xdd67('0x5e')],[_0xdd67('0x62'),'id'])||{});}})[_0xdd67('0x21')](respondWithResult(_0x555868,null))[_0xdd67('0x2c')](handleError(_0x555868,null));};function validateUser(_0x423fd4){return new Promise(function(_0x28ba7f,_0x2bd5f2){if(_0x423fd4[_0xdd67('0x63')])return _0x28ba7f(_0x423fd4);return db[_0xdd67('0x64')][_0xdd67('0x65')](0x1)['then'](function(_0x43f518){if(_0x43f518[_0xdd67('0x66')])authService[_0xdd67('0x67')](_0x423fd4[_0xdd67('0x68')]);db[_0xdd67('0x48')][_0xdd67('0x69')](_0xdd67('0x63'))['then'](function(_0x38ef1a){if(_[_0xdd67('0x6a')](_0x38ef1a)){_0x423fd4[_0xdd67('0x63')]=_0x43f518[_0xdd67('0x6b')]||0x1;return;}if(_[_0xdd67('0x6a')](_0x43f518[_0xdd67('0x6b')])||_0x43f518[_0xdd67('0x6b')]===_0x38ef1a){_0x423fd4[_0xdd67('0x63')]=_0x38ef1a+0x1;return;}if(_0x43f518['min_internal']>_0x38ef1a){_0x423fd4[_0xdd67('0x63')]=_0x43f518[_0xdd67('0x6b')];return;}return db['sequelize'][_0xdd67('0x49')](_0xdd67('0x6c'),{'type':db[_0xdd67('0x6d')][_0xdd67('0x6e')][_0xdd67('0x6f')]})[_0xdd67('0x21')](function(_0xfa9c21){if(_0xfa9c21&&_0xfa9c21[_0xdd67('0x70')]){for(var _0x2ecf80=0x0,_0x4bb53e=_0xfa9c21[_0xdd67('0x70')];_0x2ecf80<_0x4bb53e&&_[_0xdd67('0x6a')](_0x423fd4[_0xdd67('0x63')]);_0x2ecf80++){if(_0x43f518[_0xdd67('0x6b')]<=_0xfa9c21[_0x2ecf80][_0xdd67('0x71')]){_0x423fd4[_0xdd67('0x63')]=_0xfa9c21[_0x2ecf80][_0xdd67('0x71')];}else if(_0x43f518[_0xdd67('0x6b')]>_0xfa9c21[_0x2ecf80]['from']&&_0x43f518[_0xdd67('0x6b')]<=_0xfa9c21[_0x2ecf80]['to']){_0x423fd4[_0xdd67('0x63')]=_0x43f518[_0xdd67('0x6b')];}}}if(_['isNil'](_0x423fd4[_0xdd67('0x63')])){_0x423fd4[_0xdd67('0x63')]=_0x38ef1a+0x1;}return _0x28ba7f(_0x423fd4);});});})[_0xdd67('0x2c')](function(_0x2b8f2b){_0x2bd5f2(_0x2b8f2b);});});}function updateUser(_0x16133e){return new Promise(function(_0x5dc69e,_0x505ca1){try{if(_0x16133e['voicemail']){_0x16133e[_0xdd67('0x72')]=_0x16133e[_0xdd67('0x63')];_0x16133e[_0xdd67('0x73')]={'mailbox':_0x16133e[_0xdd67('0x63')],'password':_0x16133e[_0xdd67('0x68')],'fullname':_0x16133e[_0xdd67('0x74')],'email':_0x16133e[_0xdd67('0x75')]};}if(_0x16133e[_0xdd67('0x2e')]===_0xdd67('0x33')){if(!_0x16133e[_0xdd67('0x76')])_0x16133e[_0xdd67('0x76')]=[_0xdd67('0x77'),_0xdd67('0x78'),_0xdd67('0x79'),_0xdd67('0x7a'),_0xdd67('0x7b'),'104',_0xdd67('0x7c'),'106',_0xdd67('0x7d'),'108','109',_0xdd67('0x7e'),_0xdd67('0x7f'),'114',_0xdd67('0x80')];}_0x5dc69e(_0x16133e);}catch(_0x5a61b2){_0x505ca1(_0x5a61b2);}});}exports[_0xdd67('0x81')]=function(_0x25dd57,_0x4c1092){if(_0x25dd57['user'][_0xdd67('0x2e')]===_0xdd67('0x33'))throw new Error(_0xdd67('0x82'));if(_0x25dd57['body'][_0xdd67('0x2e')]==='user'&&_0x25dd57[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x84')){throw new Error(_0xdd67('0x85'));}if(_0x25dd57['body'][_0xdd67('0x2e')]===_0xdd67('0x84')&&_0x25dd57[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x84')){throw new Error(_0xdd67('0x86'));}return licenseUtil['checkUserLimits']([_0x25dd57[_0xdd67('0x5e')]])['then'](function(){return validateUser(_0x25dd57[_0xdd67('0x5e')]);})[_0xdd67('0x21')](function(_0xde2922){return updateUser(_0xde2922)['then'](function(_0x1730f4){if(_0x1730f4[_0xdd67('0x2e')]===_0xdd67('0x84')){_0x1730f4[_0xdd67('0x87')]=_0x25dd57[_0xdd67('0x83')]['settingsEnabled'];delete _0x1730f4[_0xdd67('0x88')];}return _0x1730f4;});})[_0xdd67('0x21')](function(_0x1f0d04){return db[_0xdd67('0x48')]['create'](_0x1f0d04,{'include':[{'model':db[_0xdd67('0x73')],'as':'VoiceMail'}]});})[_0xdd67('0x21')](function(_0x18a854){if(_0x25dd57['body'][_0xdd67('0x2e')]==='user')return _0x18a854;if(_0x25dd57[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x83'))return _0x18a854;return db['UserProfileSection']['find']({'where':{'name':_0x18a854[_0xdd67('0x2e')]==='agent'?_0xdd67('0x32'):'Telephones','userProfileId':_0x25dd57[_0xdd67('0x83')][_0xdd67('0x88')]},'raw':!![]})['then'](function(_0x4d2728){if(!_0x4d2728||_0x4d2728[_0xdd67('0x89')]!=0x0)return _0x18a854;return db['UserProfileResource'][_0xdd67('0x81')]({'name':_0x18a854['name'],'resourceId':_0x18a854['id'],'type':_0x4d2728[_0xdd67('0x3b')],'sectionId':_0x4d2728['id']},{})[_0xdd67('0x21')](function(){return _0x18a854;});})['catch'](function(_0x4281f2){logger[_0xdd67('0x28')](_0xdd67('0x8a'),_0x4281f2);throw _0x4281f2;});})[_0xdd67('0x21')](respondWithResult(_0x4c1092,0xc9))['catch'](handleError(_0x4c1092,null));};exports[_0xdd67('0x8b')]=function(_0x1f5459,_0x34300e){var _0x46eacb=_0x1f5459['body'];var _0x1e984b=[];if(_0x1f5459[_0xdd67('0x83')][_0xdd67('0x2e')]===_0xdd67('0x33'))throw new Error(_0xdd67('0x82'));if(_[_0xdd67('0x8c')](_0x46eacb,[_0xdd67('0x2e'),'user'])&&_0x1f5459['user']['role']!==_0xdd67('0x84')){throw new Error(_0xdd67('0x85'));}if(_[_0xdd67('0x8c')](_0x46eacb,[_0xdd67('0x2e'),_0xdd67('0x84')])&&_0x1f5459[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x84')){throw new Error(_0xdd67('0x8d'));}return licenseUtil[_0xdd67('0x8e')](_0x46eacb)[_0xdd67('0x21')](function(){return validateUser(_0x46eacb[0x0]);})[_0xdd67('0x21')](function(){for(var _0x3a7a6b=0x1;_0x3a7a6b<_0x46eacb[_0xdd67('0x70')];_0x3a7a6b++){var _0x535f01=_0x46eacb[_0x3a7a6b-0x1][_0xdd67('0x63')];if(!_0x46eacb[_0x3a7a6b]['internal'])_0x46eacb[_0x3a7a6b][_0xdd67('0x63')]=_0x535f01+0x1;_0x1e984b[_0xdd67('0x50')](validateUser(_0x46eacb[_0x3a7a6b]));}return Promise[_0xdd67('0x56')](_0x1e984b);})[_0xdd67('0x21')](function(){_0x1e984b=[];for(var _0xfd0b36=0x0;_0xfd0b36<_0x46eacb['length'];_0xfd0b36++){_0x1e984b['push'](updateUser(_0x46eacb[_0xfd0b36]));}return Promise[_0xdd67('0x56')](_0x1e984b);})[_0xdd67('0x21')](function(){_0x1e984b=_0x46eacb['map'](function(_0xc27002){return db['User']['create'](_0xc27002,{'include':[{'model':db[_0xdd67('0x73')],'as':'VoiceMail'}]})[_0xdd67('0x21')](function(_0x57d4c2){_0xc27002['id']=_0x57d4c2['id'];return _0xc27002;});});return Promise[_0xdd67('0x56')](_0x1e984b);})[_0xdd67('0x21')](function(_0x641cac){if(_0x1f5459['body'][_0xdd67('0x2e')]===_0xdd67('0x83'))return _0x641cac;if(_0x1f5459[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x83'))return _0x641cac;var _0x4a67bf=_[_0xdd67('0x8c')](_0x641cac,function(_0x4a5d68){return _0x4a5d68[_0xdd67('0x2e')]===_0xdd67('0x33')||_0x4a5d68[_0xdd67('0x2e')]===_0xdd67('0x8f');});if(!_0x4a67bf)return _0x641cac;return db[_0xdd67('0x90')]['findAll']({'where':{'name':{'$or':[_0xdd67('0x32'),'Telephones']},'userProfileId':_0x1f5459[_0xdd67('0x83')][_0xdd67('0x88')]},'raw':!![]})['then'](function(_0x48f105){if(_[_0xdd67('0x91')](_0x48f105)||!_[_0xdd67('0x8c')](_0x48f105,[_0xdd67('0x89'),0x0]))return _0x641cac;_0x1e984b=[];var _0x598ff5=_(_0x48f105)[_0xdd67('0x37')](function(_0x2e45ff){if(_0x2e45ff[_0xdd67('0x89')]===0x1)return;return _0x2e45ff['name']===_0xdd67('0x32')?'agent':_0xdd67('0x8f');})['compact']()[_0xdd67('0x38')]();for(var _0x239f0d=0x0;_0x239f0d<_0x641cac[_0xdd67('0x70')];_0x239f0d++){if(!_[_0xdd67('0x39')](_0x598ff5,_0x641cac[_0x239f0d]['role']))return;var _0x2c6d7c=_0x641cac[_0x239f0d][_0xdd67('0x2e')]===_0xdd67('0x33')?_0xdd67('0x32'):_0xdd67('0x34');_0x1e984b[_0xdd67('0x50')](db[_0xdd67('0x3c')][_0xdd67('0x81')]({'name':_0x641cac[_0x239f0d][_0xdd67('0x3b')],'resourceId':_0x641cac[_0x239f0d]['id'],'type':_0x2c6d7c,'sectionId':_['find'](_0x48f105,[_0xdd67('0x3b'),_0x2c6d7c])['id']},{}));}return Promise['all'](_0x1e984b);});})[_0xdd67('0x21')](respondWithResult(_0x34300e,0xc9))[_0xdd67('0x2c')](handleError(_0x34300e,null));};exports[_0xdd67('0x92')]=function(_0x50e097,_0x1f6112){if(_0x50e097[_0xdd67('0x5e')]['id']){delete _0x50e097[_0xdd67('0x5e')]['id'];}return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x50e097[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](function(_0x3ae203){if(!_0x3ae203)return null;if(_0x3ae203['id']===_0x50e097[_0xdd67('0x83')]['id']){if(!_0x50e097[_0xdd67('0x5e')][_0xdd67('0x93')]||!_0x50e097[_0xdd67('0x5e')][_0xdd67('0x94')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3ae203[_0xdd67('0x95')](_0x50e097[_0xdd67('0x5e')][_0xdd67('0x93')])){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x98'));}if(_0x50e097[_0xdd67('0x5e')][_0xdd67('0x93')]===_0x50e097[_0xdd67('0x5e')][_0xdd67('0x94')]){throw new db['Sequelize'][(_0xdd67('0x97'))](_0xdd67('0x99'));}}else if(_0x50e097[_0xdd67('0x83')][_0xdd67('0x2e')]==='admin'){if(!_0x50e097[_0xdd67('0x5e')][_0xdd67('0x94')]){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x9a'));}}else if(_0x50e097[_0xdd67('0x83')][_0xdd67('0x2e')]===_0xdd67('0x83')){if(!_0x50e097[_0xdd67('0x5e')]['newPassword']){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x9a'));}if(_0x3ae203[_0xdd67('0x2e')]!==_0xdd67('0x33')){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x82'));}}else{throw new db['Sequelize'][(_0xdd67('0x97'))](_0xdd67('0x82'));}return _0x3ae203;})[_0xdd67('0x21')](handleEntityNotFound(_0x1f6112,null))[_0xdd67('0x21')](function(_0x155259){return db[_0xdd67('0x64')][_0xdd67('0x9b')]({'attributes':['id','securePassword',_0xdd67('0x9c'),'passwordHistoryLimit']})['then'](function(_0x4fb3e4){if(_0x4fb3e4[_0xdd67('0x66')])authService[_0xdd67('0x67')](_0x50e097['body'][_0xdd67('0x94')]);if(!_0x4fb3e4[_0xdd67('0x9c')]||!_0x155259[_0xdd67('0x44')])return _0x155259;authService[_0xdd67('0x9d')](_0x50e097['body']['newPassword'],_0x155259[_0xdd67('0x44')],_0x4fb3e4['passwordHistoryLimit']);return _0x155259;})[_0xdd67('0x21')](saveUpdates({'password':_0x50e097['body'][_0xdd67('0x94')],'passwordResetAt':_0x50e097[_0xdd67('0x83')]['id']==_0x50e097[_0xdd67('0x58')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x50e097[_0xdd67('0x5e')]['newPassword'],_0x155259[_0xdd67('0x44')])},null));})[_0xdd67('0x21')](respondWithResult(_0x1f6112,null))[_0xdd67('0x2c')](handleError(_0x1f6112,null));};exports[_0xdd67('0x9e')]=function(_0x111d48,_0x2849b8){var _0x2353df=_0x111d48['body']['channel'];return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x111d48[_0xdd67('0x58')]['id']},'attributes':['id','name',_0xdd67('0x2e'),_0xdd67('0x9f'),_0xdd67('0xa0'),_0xdd67('0xa1'),_0xdd67('0xa2')]})[_0xdd67('0x21')](handleEntityNotFound(_0x2849b8,null))['then'](function(_0x4d11c3){if(_0x4d11c3){if(!utils[_0xdd67('0xa3')](_0x2353df)){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0xa4'));}return _0x4d11c3[_0xdd67('0xa5')+_[_0xdd67('0xa6')](_0x2353df[_0xdd67('0xa7')]())+_0xdd67('0xa8')](_0x111d48[_0xdd67('0x5e')][_0xdd67('0x62')],{'penalty':_0x111d48[_0xdd67('0x5e')]['penalty']||0x0})[_0xdd67('0xa9')](function(_0x55e37b){for(var _0x1734e2=0x0;_0x1734e2<_0x111d48[_0xdd67('0x5e')][_0xdd67('0x62')][_0xdd67('0x70')];_0x1734e2+=0x1){var _0x51e4af={'UserId':Number(_0x111d48[_0xdd67('0x58')]['id'])};_0x51e4af[_[_0xdd67('0xa6')](_0x2353df[_0xdd67('0xa7')]())+_0xdd67('0xaa')]=Number(_0x111d48[_0xdd67('0x5e')]['ids'][_0x1734e2]);socket[_0xdd67('0xab')](_0xdd67('0x83')+_[_0xdd67('0xa6')](_0x2353df['toLowerCase']())+_0xdd67('0xac'),_0x51e4af);}return _0x55e37b;})[_0xdd67('0x21')](function(){if(_0x2353df===_0xdd67('0xad')){return db['VoiceQueue'][_0xdd67('0xae')]({'where':{'id':_0x111d48[_0xdd67('0x5e')][_0xdd67('0x62')]||[]},'raw':!![],'attributes':['id',_0xdd67('0x3b')]});}})['then'](function(_0x40330a){var _0x26ed6c=_0x4d11c3[_0xdd67('0x30')]({'plain':!![]});var _0x480dc8=[];if(_0x2353df==='voice'&&_0x26ed6c[_0xdd67('0x2e')]===_0xdd67('0x33')&&_0x26ed6c[_0xdd67('0x9f')]){for(let _0x4a9139=0x0;_0x4a9139<_0x40330a[_0xdd67('0x70')];_0x4a9139+=0x1){_0x480dc8['push']({'membername':_0x26ed6c[_0xdd67('0x3b')],'UserId':_0x26ed6c['id'],'queue_name':_0x40330a[_0x4a9139][_0xdd67('0x3b')],'VoiceQueueId':_0x40330a[_0x4a9139]['id'],'interface':_['isNil'](_0x26ed6c['interface'])?util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x26ed6c[_0xdd67('0x3b')]):_0x26ed6c[_0xdd67('0xa2')],'paused':_0x26ed6c[_0xdd67('0xa1')]||![],'penalty':_0x111d48[_0xdd67('0x5e')]['penalty']||0x0});}return Promise[_0xdd67('0x56')](_0x480dc8[_0xdd67('0x37')](function(_0x5f5194){return db[_0xdd67('0xb1')][_0xdd67('0xb2')](_0x5f5194);}));}return _0x4d11c3;});}})[_0xdd67('0x21')](respondWithStatusCode(_0x2849b8,null))['catch'](handleError(_0x2849b8,null));};exports[_0xdd67('0xb3')]=function(_0x5a7a0a,_0x4e811b){var _0x3f2822,_0xa8af10;return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x5a7a0a[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0x3b'),_0xdd67('0x2e')]})['then'](handleEntityNotFound(_0x4e811b,null))[_0xdd67('0x21')](function(_0x39ae81){if(_0x39ae81){_0x3f2822=_0x39ae81;if(!_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]||!utils[_0xdd67('0xa3')](_0x5a7a0a['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0xdd67('0xa4'));}return _0x39ae81[_0xdd67('0xb5')+_['capitalize'](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')][_0xdd67('0xa7')]())+_0xdd67('0xa8')](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')]);}})[_0xdd67('0x21')](function(_0x5a9925){if(_[_0xdd67('0xb6')](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')])){for(var _0x1a4e62=0x0;_0x1a4e62<_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')][_0xdd67('0x70')];_0x1a4e62+=0x1){_0xa8af10={'UserId':Number(_0x5a7a0a[_0xdd67('0x58')]['id'])};_0xa8af10[_['capitalize'](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]['toLowerCase']())+'QueueId']=Number(_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')][_0x1a4e62]);socket[_0xdd67('0xab')](_0xdd67('0x83')+_[_0xdd67('0xa6')](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]['toLowerCase']())+'Queue:remove',_0xa8af10);}}else{_0xa8af10={'UserId':Number(_0x5a7a0a[_0xdd67('0x58')]['id'])};_0xa8af10[_[_0xdd67('0xa6')](_0x5a7a0a[_0xdd67('0x49')]['channel'][_0xdd67('0xa7')]())+_0xdd67('0xaa')]=Number(_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')]);socket[_0xdd67('0xab')](_0xdd67('0x83')+_[_0xdd67('0xa6')](_0x5a7a0a[_0xdd67('0x49')]['channel']['toLowerCase']())+_0xdd67('0xb7'),_0xa8af10);}return _0x5a9925;})['then'](function(){if(_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]==='voice'){return db['UserVoiceQueueRt'][_0xdd67('0x3d')]({'where':{'UserId':_0x5a7a0a['params']['id'],'VoiceQueueId':_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')]},'individualHooks':!![]})[_0xdd67('0x21')](function(){return _0x3f2822;});}return _0x3f2822;})[_0xdd67('0x21')](respondWithStatusCode(_0x4e811b,null))[_0xdd67('0x2c')](handleError(_0x4e811b,null));};exports[_0xdd67('0xb8')]=function(_0x10f0df,_0x141f36){_0x10f0df['body'][_0xdd67('0xb9')]=_0x10f0df[_0xdd67('0xba')][_0xdd67('0xbb')];return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x10f0df[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x141f36,null))[_0xdd67('0x21')](saveUpdates(_0x10f0df[_0xdd67('0x5e')],null))[_0xdd67('0x21')](respondWithResult(_0x141f36,null))[_0xdd67('0x2c')](handleError(_0x141f36,null));};exports[_0xdd67('0xbc')]=function(_0x2dfc8f,_0x36741f){var _0x26113=path[_0xdd67('0xbd')](config[_0xdd67('0xbe')],_0xdd67('0xbf'));return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x2dfc8f[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0xb9')],'raw':!![]})[_0xdd67('0x21')](handleEntityNotFound(_0x36741f,null))[_0xdd67('0x21')](function(_0x3f64e3){if(_0x3f64e3){if(_[_0xdd67('0x6a')](_0x3f64e3[_0xdd67('0xb9')])){return _0x36741f[_0xdd67('0xc0')](_0x26113);}else{if(!fs['existsSync'](path['join'](config[_0xdd67('0xbe')],_0xdd67('0xc1'),_0x3f64e3[_0xdd67('0xb9')]))){return _0x36741f[_0xdd67('0xc0')](_0x26113);}return _0x36741f[_0xdd67('0xc0')](path[_0xdd67('0xbd')](config['root'],_0xdd67('0xc1'),_0x3f64e3[_0xdd67('0xb9')]));}}})[_0xdd67('0x2c')](handleError(_0x36741f,null));};exports[_0xdd67('0xc2')]=function(_0x163054,_0x397dc9){return db[_0xdd67('0x48')]['find']({'where':{'id':_0x163054[_0xdd67('0x58')]['id']},'attributes':['id']})[_0xdd67('0x21')](handleEntityNotFound(_0x397dc9,null))[_0xdd67('0x21')](function(_0x448ff4){var _0x302239=[];values=_0x448ff4[_0xdd67('0x51')];_0x302239[_0xdd67('0x50')](get_open_tabs('chat',_0x448ff4[_0xdd67('0x51')]));_0x302239['push'](get_open_tabs('sms',_0x448ff4['dataValues']));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x54'),_0x448ff4[_0xdd67('0x51')]));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x55'),_0x448ff4[_0xdd67('0x51')]));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x52'),_0x448ff4[_0xdd67('0x51')]));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x53'),_0x448ff4[_0xdd67('0x51')]));return Promise[_0xdd67('0x56')](_0x302239);})[_0xdd67('0x21')](function(_0x5c188d){if(_0x5c188d){var _0x485d24=_['map'](values[_0xdd67('0xc3')],function(_0x29fc95){return{'channel':_0xdd67('0xc4'),'id':_0x29fc95['id'],'createdAt':_0x29fc95[_0xdd67('0xc5')]};});var _0x150986=_['map'](values['FaxOpenTabs'],function(_0x1ec5e2){return{'channel':_0xdd67('0xc6'),'id':_0x1ec5e2['id'],'createdAt':_0x1ec5e2[_0xdd67('0xc5')]};});var _0x4890ac=_[_0xdd67('0x37')](values[_0xdd67('0xc7')],function(_0xa2581a){return{'channel':_0xdd67('0xc8'),'id':_0xa2581a['id'],'createdAt':_0xa2581a[_0xdd67('0xc5')]};});var _0x3231ef=_['map'](values[_0xdd67('0xc9')],function(_0x456426){return{'channel':_0xdd67('0xca'),'id':_0x456426['id'],'createdAt':_0x456426[_0xdd67('0xc5')]};});var _0x5c57d1=_[_0xdd67('0x37')](values[_0xdd67('0xcb')],function(_0xdb2b39){return{'channel':'SMS','id':_0xdb2b39['id'],'createdAt':_0xdb2b39[_0xdd67('0xc5')]};});var _0x13ecec=_[_0xdd67('0x37')](values[_0xdd67('0xcc')],function(_0x5483bd){return{'channel':_0xdd67('0xcd'),'id':_0x5483bd['id'],'createdAt':_0x5483bd[_0xdd67('0xc5')]};});var _0x17099e=_[_0xdd67('0xce')](_0x485d24,_0x150986,_0x4890ac,_0x3231ef,_0x5c57d1,_0x13ecec);var _0x354f16={'count':_0x17099e[_0xdd67('0x70')],'rows':_0x17099e};return _0x354f16;}else return null;})['then'](respondWithResult(_0x397dc9,null))[_0xdd67('0x2c')](handleError(_0x397dc9,null));};exports[_0xdd67('0xcf')]=function(_0xef60f0,_0xa96d78){var _0x194c90={};return db['User'][_0xdd67('0x9b')]({'where':{'id':_0xef60f0['params']['id']}})[_0xdd67('0x21')](function(_0x56c3b5){if(!_0x56c3b5){throw new APINotFoundError(util[_0xdd67('0xaf')](_0xdd67('0xd0'),_0xef60f0[_0xdd67('0x58')]['id']));}return contacts[_0xdd67('0x5f')]();})[_0xdd67('0x21')](function(_0x4e9866){_0xef60f0[_0xdd67('0x49')][_0xdd67('0x48')]=_0xef60f0['params']['id'];_0x194c90=qs[_0xdd67('0xd1')](_0x4e9866,_0xef60f0);if(_0xef60f0['query']['hasOwnProperty'](_0xdd67('0x59'))){_0x194c90['include']=[{'model':db[_0xdd67('0xd2')],'as':_0xdd67('0xd3'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xdd67('0x3b'),_0xdd67('0xd4')],'where':_0xef60f0['query'][_0xdd67('0xd5')]?{'id':_0xef60f0[_0xdd67('0x49')]['tag']}:undefined,'required':_0xef60f0[_0xdd67('0x49')][_0xdd67('0xd5')]?!![]:![]}];}return contacts['findAll'](_0xef60f0[_0xdd67('0x49')],_0xef60f0['user'],_0x194c90,_0x4e9866);})[_0xdd67('0x21')](respondWithFilteredResult(_0xa96d78,_0x194c90))[_0xdd67('0x2c')](APIHandleError(_0xa96d78));};exports[_0xdd67('0xd6')]=function(_0x242d33,_0x35b3f7){var _0x5c706b;var _0x1c0a2f={};var _0x2c97ce;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x242d33[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0x3b'),'role']})[_0xdd67('0x21')](handleEntityNotFound(_0x35b3f7,null))[_0xdd67('0x21')](function(_0x24f42b){if(!utils['isValidChannel'](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))]('Unknown\x20channel');}_0x5c706b=_0x24f42b;var _0x3f8010={};_0x3f8010[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+'Queue'][_0xdd67('0x40')]);_0x3f8010[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x242d33[_0xdd67('0x49')]);_0x3f8010[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x3f8010[_0xdd67('0xd7')],_0x3f8010['query']);_0x1c0a2f[_0xdd67('0x4e')]=_['intersection'](_0x3f8010[_0xdd67('0xd7')],qs['fields'](_0x242d33['query'][_0xdd67('0xdb')]));_0x1c0a2f['attributes']=_0x1c0a2f[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x1c0a2f['attributes']:_0x3f8010[_0xdd67('0xd7')];_0x1c0a2f[_0xdd67('0xdc')]=qs['sort'](_0x242d33[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x1c0a2f[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x242d33[_0xdd67('0x49')],_0x3f8010[_0xdd67('0xd9')]));if(_0x242d33[_0xdd67('0x49')][_0xdd67('0x35')]){_0x1c0a2f[_0xdd67('0x47')]=_['merge'](_0x1c0a2f[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x1c0a2f[_0xdd67('0x4e')],function(_0x29eb8b){var _0x4a2e9b={};_0x4a2e9b[_0x29eb8b]={'$like':'%'+_0x242d33['query']['filter']+'%'};return _0x4a2e9b;})});}_0x1c0a2f=_['merge']({},_0x1c0a2f,_0x242d33[_0xdd67('0x5b')]);switch(_0x5c706b[_0xdd67('0x2e')]){case _0xdd67('0x84'):return db[_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+_0xdd67('0xdf')][_0xdd67('0xae')](_0x1c0a2f);case _0xdd67('0x83'):case _0xdd67('0x33'):return _0x5c706b['get'+_[_0xdd67('0xa6')](_0x242d33['query']['channel'])+_0xdd67('0xa8')](_0x1c0a2f);default:throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0xe0'));}})['then'](function(_0xad4d08){_0x2c97ce=_0xad4d08[_0xdd67('0x70')];if(!_0x242d33[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x1c0a2f[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x242d33[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x1c0a2f[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x242d33[_0xdd67('0x49')]['offset']);}switch(_0x5c706b[_0xdd67('0x2e')]){case _0xdd67('0x84'):return db[_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+_0xdd67('0xdf')][_0xdd67('0xae')](_0x1c0a2f);case _0xdd67('0x83'):case _0xdd67('0x33'):return _0x5c706b[_0xdd67('0x30')+_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+'Queues'](_0x1c0a2f);}})[_0xdd67('0x21')](function(_0x520204){return{'count':_0x2c97ce,'rows':_0x520204};})['then'](respondWithResult(_0x35b3f7,null))[_0xdd67('0x2c')](handleError(_0x35b3f7,null));};exports['getVoiceQueuesRt']=function(_0x2ac7e1,_0x50a037){var _0x5b5697={};var _0x108cd2={};var _0x4beb23;var _0x43e020;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x2ac7e1[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x50a037,null))['then'](function(_0x1269a9){if(_0x1269a9){_0x4beb23=_0x1269a9;_0x108cd2['model']=_[_0xdd67('0xd8')](db[_0xdd67('0xb1')][_0xdd67('0x40')]);_0x108cd2['query']=_[_0xdd67('0xd8')](_0x2ac7e1[_0xdd67('0x49')]);_0x108cd2[_0xdd67('0xd9')]=_['intersection'](_0x108cd2[_0xdd67('0xd7')],_0x108cd2[_0xdd67('0x49')]);_0x5b5697[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x108cd2[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x2ac7e1['query'][_0xdd67('0xdb')]));_0x5b5697['attributes']=_0x5b5697[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x5b5697['attributes']:_0x108cd2[_0xdd67('0xd7')];_0x5b5697[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x2ac7e1['query'][_0xdd67('0xdd')]);_0x5b5697[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x2ac7e1[_0xdd67('0x49')],_0x108cd2[_0xdd67('0xd9')]));if(_0x2ac7e1[_0xdd67('0x49')][_0xdd67('0x35')]){_0x5b5697['where']=_[_0xdd67('0x5a')](_0x5b5697[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x5b5697[_0xdd67('0x4e')],function(_0x42e4c4){var _0x2cb66c={};_0x2cb66c[_0x42e4c4]={'$like':'%'+_0x2ac7e1[_0xdd67('0x49')]['filter']+'%'};return _0x2cb66c;})});}_0x5b5697=_[_0xdd67('0x5a')]({},_0x5b5697,_0x2ac7e1[_0xdd67('0x5b')]);return _0x4beb23[_0xdd67('0xe3')](_0x5b5697);}})[_0xdd67('0x21')](function(_0x41427a){if(_0x41427a){_0x43e020=_0x41427a[_0xdd67('0x70')];if(!_0x2ac7e1[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x5b5697[_0xdd67('0x1d')]=qs['limit'](_0x2ac7e1[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x5b5697[_0xdd67('0x1b')]=qs['offset'](_0x2ac7e1['query'][_0xdd67('0x1b')]);}return _0x4beb23[_0xdd67('0xe3')](_0x5b5697);}})[_0xdd67('0x21')](function(_0x343c5a){if(_0x343c5a){return _0x343c5a?{'count':_0x43e020,'rows':_0x343c5a}:null;}})[_0xdd67('0x21')](respondWithResult(_0x50a037,null))[_0xdd67('0x2c')](handleError(_0x50a037,null));};exports[_0xdd67('0xe4')]=function(_0x2244b1,_0x53e86b){var _0x5c60ad={};var _0x3b8eb7={};var _0x5f2a64;var _0x1b684d;return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x2244b1[_0xdd67('0x58')]['id']}})['then'](handleEntityNotFound(_0x53e86b,null))['then'](function(_0x5495a7){if(_0x5495a7){_0x5f2a64=_0x5495a7;_0x3b8eb7[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xe5')][_0xdd67('0x40')]);_0x3b8eb7['query']=_['keys'](_0x2244b1[_0xdd67('0x49')]);_0x3b8eb7[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x3b8eb7[_0xdd67('0xd7')],_0x3b8eb7[_0xdd67('0x49')]);_0x5c60ad[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x3b8eb7['model'],qs[_0xdd67('0xdb')](_0x2244b1['query'][_0xdd67('0xdb')]));_0x5c60ad['attributes']=_0x5c60ad[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x5c60ad[_0xdd67('0x4e')]:_0x3b8eb7[_0xdd67('0xd7')];_0x5c60ad[_0xdd67('0xdc')]=qs['sort'](_0x2244b1[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x5c60ad['where']=qs['filters'](_[_0xdd67('0xde')](_0x2244b1['query'],_0x3b8eb7[_0xdd67('0xd9')]));if(_0x2244b1[_0xdd67('0x49')][_0xdd67('0x35')]){_0x5c60ad[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x5c60ad[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x5c60ad['attributes'],function(_0x3cd8b9){var _0x4ce875={};_0x4ce875[_0x3cd8b9]={'$like':'%'+_0x2244b1['query'][_0xdd67('0x35')]+'%'};return _0x4ce875;})});}_0x5c60ad=_[_0xdd67('0x5a')]({},_0x5c60ad,_0x2244b1['options']);return _0x5f2a64[_0xdd67('0xe4')](_0x5c60ad);}})[_0xdd67('0x21')](function(_0x361a2c){if(_0x361a2c){_0x1b684d=_0x361a2c[_0xdd67('0x70')];if(!_0x2244b1[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x5c60ad[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x2244b1[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x5c60ad[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x2244b1[_0xdd67('0x49')]['offset']);}return _0x5f2a64[_0xdd67('0xe4')](_0x5c60ad);}})[_0xdd67('0x21')](function(_0x133a63){if(_0x133a63){return _0x133a63?{'count':_0x1b684d,'rows':_0x133a63}:null;}})['then'](respondWithResult(_0x53e86b,null))[_0xdd67('0x2c')](handleError(_0x53e86b,null));};exports[_0xdd67('0xe6')]=function(_0x53e659,_0x41342c){var _0x388b17={'raw':!![],'where':{}};var _0x2baa94={};var _0xe34e={'count':0x0,'rows':[]};return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x53e659['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x41342c,null))[_0xdd67('0x21')](function(_0x3e4744){if(_0x3e4744){_0x2baa94[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xe7')][_0xdd67('0x40')]);_0x2baa94['query']=_[_0xdd67('0xd8')](_0x53e659[_0xdd67('0x49')]);_0x2baa94[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x2baa94[_0xdd67('0xd7')],_0x2baa94[_0xdd67('0x49')]);_0x388b17[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x2baa94[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x53e659['query'][_0xdd67('0xdb')]));_0x388b17[_0xdd67('0x4e')]=_0x388b17['attributes'][_0xdd67('0x70')]?_0x388b17[_0xdd67('0x4e')]:_0x2baa94['model'];if(!_0x53e659[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x388b17[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x53e659[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x388b17['offset']=qs[_0xdd67('0x1b')](_0x53e659[_0xdd67('0x49')]['offset']);}_0x388b17[_0xdd67('0xdc')]=qs['sort'](_0x53e659[_0xdd67('0x49')]['sort']);_0x388b17[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x53e659[_0xdd67('0x49')],_0x2baa94['filters']));_0x388b17[_0xdd67('0x47')][_0xdd67('0xe8')]=_0x3e4744['id'];if(_0x53e659['query'][_0xdd67('0x35')]){_0x388b17[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x388b17[_0xdd67('0x47')],{'$or':_['map'](_0x388b17[_0xdd67('0x4e')],function(_0x1b47ea){var _0x3b61ad={};_0x3b61ad[_0x1b47ea]={'$like':'%'+_0x53e659[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3b61ad;})});}_0x388b17=_[_0xdd67('0x5a')]({},_0x388b17,_0x53e659[_0xdd67('0x5b')]);return db['VoiceRecording'][_0xdd67('0x1e')]({'where':_0x388b17['where']})['then'](function(_0x5ae2bd){_0xe34e[_0xdd67('0x1e')]=_0x5ae2bd;if(_0x53e659['query']['includeAll']){_0x388b17[_0xdd67('0x4a')]=[{'all':!![]}];}return db['VoiceRecording'][_0xdd67('0xae')](_0x388b17);})[_0xdd67('0x21')](function(_0x5a5b90){_0xe34e[_0xdd67('0x4f')]=_0x5a5b90;return _0xe34e;});}})['then'](respondWithFilteredResult(_0x41342c,_0x388b17))['catch'](handleError(_0x41342c,null));};exports[_0xdd67('0xe9')]=function(_0x21ca64,_0x38070c){var _0x208b22={'raw':!![],'where':{}};var _0x46d5d8={};var _0x24675f={'count':0x0,'rows':[]};return db[_0xdd67('0x48')]['findOne']({'where':{'id':_0x21ca64[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x38070c,null))[_0xdd67('0x21')](function(_0x305b59){if(_0x305b59){_0x46d5d8['model']=_[_0xdd67('0xd8')](db[_0xdd67('0xea')][_0xdd67('0x40')]);_0x46d5d8['query']=_[_0xdd67('0xd8')](_0x21ca64['query']);_0x46d5d8[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x46d5d8[_0xdd67('0xd7')],_0x46d5d8[_0xdd67('0x49')]);_0x208b22[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x46d5d8[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x208b22['attributes']=_0x208b22['attributes'][_0xdd67('0x70')]?_0x208b22['attributes']:_0x46d5d8[_0xdd67('0xd7')];if(!_0x21ca64[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x208b22[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x208b22[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0x1b')]);}_0x208b22['order']=qs[_0xdd67('0xdd')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x208b22[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x21ca64[_0xdd67('0x49')],_0x46d5d8[_0xdd67('0xd9')]));_0x208b22[_0xdd67('0x47')][_0xdd67('0xe8')]=_0x305b59['id'];if(_0x21ca64[_0xdd67('0x49')]['filter']){_0x208b22['where']=_[_0xdd67('0x5a')](_0x208b22[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x208b22[_0xdd67('0x4e')],function(_0xda6de7){var _0x28a5ff={};_0x28a5ff[_0xda6de7]={'$like':'%'+_0x21ca64[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x28a5ff;})});}_0x208b22=_[_0xdd67('0x5a')]({},_0x208b22,_0x21ca64[_0xdd67('0x5b')]);return db[_0xdd67('0xea')][_0xdd67('0x1e')]({'where':_0x208b22[_0xdd67('0x47')]})['then'](function(_0x347c15){_0x24675f[_0xdd67('0x1e')]=_0x347c15;if(_0x21ca64[_0xdd67('0x49')]['includeAll']){_0x208b22[_0xdd67('0x4a')]=[{'all':!![]}];}return db[_0xdd67('0xea')][_0xdd67('0xae')](_0x208b22);})[_0xdd67('0x21')](function(_0x468db1){_0x24675f[_0xdd67('0x4f')]=_0x468db1;return _0x24675f;});}})[_0xdd67('0x21')](respondWithFilteredResult(_0x38070c,_0x208b22))[_0xdd67('0x2c')](handleError(_0x38070c,null));};exports['getChatInteractions']=function(_0x1eea01,_0x199169){var _0x34af22={};var _0x15e62a={};var _0x21fd24;var _0x37f1ae;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x1eea01['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x199169,null))[_0xdd67('0x21')](function(_0x5f1824){if(_0x5f1824){_0x21fd24=_0x5f1824;_0x15e62a[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db['ChatInteraction']['rawAttributes']);_0x15e62a[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x1eea01[_0xdd67('0x49')]);_0x15e62a[_0xdd67('0xd9')]=_['intersection'](_0x15e62a['model'],_0x15e62a[_0xdd67('0x49')]);_0x34af22['attributes']=_['intersection'](_0x15e62a['model'],qs[_0xdd67('0xdb')](_0x1eea01['query'][_0xdd67('0xdb')]));_0x34af22[_0xdd67('0x4e')]=_0x34af22[_0xdd67('0x4e')]['length']?_0x34af22[_0xdd67('0x4e')]:_0x15e62a[_0xdd67('0xd7')];_0x34af22[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x1eea01[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x34af22[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x1eea01[_0xdd67('0x49')],_0x15e62a[_0xdd67('0xd9')]));if(_0x1eea01[_0xdd67('0x49')]['filter']){_0x34af22[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x34af22[_0xdd67('0x47')],{'$or':_['map'](_0x34af22[_0xdd67('0x4e')],function(_0x2ad201){var _0x47fc77={};_0x47fc77[_0x2ad201]={'$like':'%'+_0x1eea01['query'][_0xdd67('0x35')]+'%'};return _0x47fc77;})});}_0x34af22=_[_0xdd67('0x5a')]({},_0x34af22,_0x1eea01[_0xdd67('0x5b')]);return _0x21fd24[_0xdd67('0xeb')](_0x34af22);}})['then'](function(_0x4339a8){if(_0x4339a8){_0x37f1ae=_0x4339a8['length'];if(!_0x1eea01[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x34af22['limit']=qs[_0xdd67('0x1d')](_0x1eea01['query'][_0xdd67('0x1d')]);_0x34af22['offset']=qs[_0xdd67('0x1b')](_0x1eea01[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x21fd24[_0xdd67('0xeb')](_0x34af22);}})['then'](function(_0x2b8bc0){if(_0x2b8bc0){return _0x2b8bc0?{'count':_0x37f1ae,'rows':_0x2b8bc0}:null;}})[_0xdd67('0x21')](respondWithResult(_0x199169,null))['catch'](handleError(_0x199169,null));};exports[_0xdd67('0xec')]=function(_0x29c204,_0x36c8a9){var _0x527223={};var _0x321253={};var _0x293e5e;var _0x1c24df;return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x29c204[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x36c8a9,null))[_0xdd67('0x21')](function(_0x378a8f){if(_0x378a8f){_0x293e5e=_0x378a8f;_0x321253[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xed')][_0xdd67('0x40')]);_0x321253[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x29c204[_0xdd67('0x49')]);_0x321253[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x321253[_0xdd67('0xd7')],_0x321253[_0xdd67('0x49')]);_0x527223[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x321253[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x29c204[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x527223[_0xdd67('0x4e')]=_0x527223[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x527223['attributes']:_0x321253['model'];_0x527223[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x29c204['query'][_0xdd67('0xdd')]);_0x527223[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_['pick'](_0x29c204[_0xdd67('0x49')],_0x321253[_0xdd67('0xd9')]));if(_0x29c204['query'][_0xdd67('0x35')]){_0x527223[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x527223[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x527223['attributes'],function(_0x142800){var _0x2d5f92={};_0x2d5f92[_0x142800]={'$like':'%'+_0x29c204[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x2d5f92;})});}_0x527223=_[_0xdd67('0x5a')]({},_0x527223,_0x29c204[_0xdd67('0x5b')]);return _0x293e5e[_0xdd67('0xec')](_0x527223);}})[_0xdd67('0x21')](function(_0x437058){if(_0x437058){_0x1c24df=_0x437058[_0xdd67('0x70')];if(!_0x29c204[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x527223[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x29c204[_0xdd67('0x49')]['limit']);_0x527223[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x29c204[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x293e5e[_0xdd67('0xec')](_0x527223);}})['then'](function(_0x3e9e34){if(_0x3e9e34){return _0x3e9e34?{'count':_0x1c24df,'rows':_0x3e9e34}:null;}})['then'](respondWithResult(_0x36c8a9,null))['catch'](handleError(_0x36c8a9,null));};exports['getMailInteractions']=function(_0x2ef4ca,_0x4fa73d){var _0x348815={'raw':!![],'where':{}};var _0xd9fe7d={};var _0x5b3d68={'count':0x0,'rows':[]};return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x2ef4ca[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x4fa73d,null))['then'](function(_0x571240){if(_0x571240){_0xd9fe7d[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xee')][_0xdd67('0x40')]);_0xd9fe7d[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x2ef4ca[_0xdd67('0x49')]);_0xd9fe7d[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0xd9fe7d[_0xdd67('0xd7')],_0xd9fe7d[_0xdd67('0x49')]);_0x348815[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0xd9fe7d[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x348815['attributes']=_0x348815[_0xdd67('0x4e')]['length']?_0x348815[_0xdd67('0x4e')]:_0xd9fe7d['model'];if(!_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x348815[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x348815['offset']=qs[_0xdd67('0x1b')](_0x2ef4ca[_0xdd67('0x49')]['offset']);}_0x348815['order']=qs[_0xdd67('0xdd')](_0x2ef4ca[_0xdd67('0x49')]['sort']);_0x348815[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x2ef4ca[_0xdd67('0x49')],_0xd9fe7d[_0xdd67('0xd9')]));_0x348815[_0xdd67('0x47')][_0xdd67('0xe8')]=_0x571240['id'];if(_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0x35')]){_0x348815[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x348815['where'],{'$or':_[_0xdd67('0x37')](_0x348815[_0xdd67('0x4e')],function(_0x1dcdae){var _0x2a09b7={};_0x2a09b7[_0x1dcdae]={'$like':'%'+_0x2ef4ca[_0xdd67('0x49')]['filter']+'%'};return _0x2a09b7;})});}_0x348815=_[_0xdd67('0x5a')]({},_0x348815,_0x2ef4ca[_0xdd67('0x5b')]);return db['MailInteraction'][_0xdd67('0x1e')]({'where':_0x348815[_0xdd67('0x47')]})[_0xdd67('0x21')](function(_0x402dcc){_0x5b3d68['count']=_0x402dcc;if(_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0x59')]){_0x348815[_0xdd67('0x4a')]=[{'all':!![]}];}return db[_0xdd67('0xee')][_0xdd67('0xae')](_0x348815);})[_0xdd67('0x21')](function(_0xdd50ec){_0x5b3d68[_0xdd67('0x4f')]=_0xdd50ec;return _0x5b3d68;});}})[_0xdd67('0x21')](respondWithFilteredResult(_0x4fa73d,_0x348815))[_0xdd67('0x2c')](handleError(_0x4fa73d,null));};exports[_0xdd67('0xef')]=function(_0x1ad4e9,_0x202431){var _0x5ce229={};var _0x1b4c07={};var _0x2c66ad;var _0x371c65;return db[_0xdd67('0x48')]['findOne']({'where':{'id':_0x1ad4e9[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x202431,null))[_0xdd67('0x21')](function(_0x580c64){if(_0x580c64){_0x2c66ad=_0x580c64;_0x1b4c07[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db['SmsInteraction'][_0xdd67('0x40')]);_0x1b4c07[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x1ad4e9[_0xdd67('0x49')]);_0x1b4c07[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x1b4c07['model'],_0x1b4c07[_0xdd67('0x49')]);_0x5ce229[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x1b4c07['model'],qs[_0xdd67('0xdb')](_0x1ad4e9['query'][_0xdd67('0xdb')]));_0x5ce229[_0xdd67('0x4e')]=_0x5ce229['attributes'][_0xdd67('0x70')]?_0x5ce229[_0xdd67('0x4e')]:_0x1b4c07[_0xdd67('0xd7')];_0x5ce229['order']=qs[_0xdd67('0xdd')](_0x1ad4e9['query']['sort']);_0x5ce229[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x1ad4e9[_0xdd67('0x49')],_0x1b4c07[_0xdd67('0xd9')]));if(_0x1ad4e9[_0xdd67('0x49')][_0xdd67('0x35')]){_0x5ce229[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x5ce229[_0xdd67('0x47')],{'$or':_['map'](_0x5ce229[_0xdd67('0x4e')],function(_0x474e36){var _0x3152bf={};_0x3152bf[_0x474e36]={'$like':'%'+_0x1ad4e9[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3152bf;})});}_0x5ce229=_['merge']({},_0x5ce229,_0x1ad4e9[_0xdd67('0x5b')]);return _0x2c66ad[_0xdd67('0xef')](_0x5ce229);}})[_0xdd67('0x21')](function(_0x1d105a){if(_0x1d105a){_0x371c65=_0x1d105a[_0xdd67('0x70')];if(!_0x1ad4e9[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x5ce229['limit']=qs[_0xdd67('0x1d')](_0x1ad4e9[_0xdd67('0x49')]['limit']);_0x5ce229[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x1ad4e9['query'][_0xdd67('0x1b')]);}return _0x2c66ad['getSmsInteractions'](_0x5ce229);}})[_0xdd67('0x21')](function(_0x44cefd){if(_0x44cefd){return _0x44cefd?{'count':_0x371c65,'rows':_0x44cefd}:null;}})[_0xdd67('0x21')](respondWithResult(_0x202431,null))[_0xdd67('0x2c')](handleError(_0x202431,null));};exports[_0xdd67('0xf0')]=function(_0x2e1bae,_0x6ac100){var _0xd1fdaf={};var _0x2fc016={};var _0x1ccc3f;var _0xdeba0f;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x2e1bae[_0xdd67('0x58')]['id']}})['then'](handleEntityNotFound(_0x6ac100,null))[_0xdd67('0x21')](function(_0x165264){if(_0x165264){_0x1ccc3f=_0x165264;_0x2fc016[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xf1')]['rawAttributes']);_0x2fc016[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x2e1bae[_0xdd67('0x49')]);_0x2fc016[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x2fc016['model'],_0x2fc016['query']);_0xd1fdaf['attributes']=_[_0xdd67('0xda')](_0x2fc016[_0xdd67('0xd7')],qs['fields'](_0x2e1bae['query']['fields']));_0xd1fdaf['attributes']=_0xd1fdaf[_0xdd67('0x4e')][_0xdd67('0x70')]?_0xd1fdaf['attributes']:_0x2fc016['model'];_0xd1fdaf[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x2e1bae[_0xdd67('0x49')]['sort']);_0xd1fdaf[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x2e1bae[_0xdd67('0x49')],_0x2fc016[_0xdd67('0xd9')]));if(_0x2e1bae['query'][_0xdd67('0x35')]){_0xd1fdaf[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0xd1fdaf[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0xd1fdaf[_0xdd67('0x4e')],function(_0x5d4585){var _0x4445c7={};_0x4445c7[_0x5d4585]={'$like':'%'+_0x2e1bae[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x4445c7;})});}_0xd1fdaf=_[_0xdd67('0x5a')]({},_0xd1fdaf,_0x2e1bae[_0xdd67('0x5b')]);return _0x1ccc3f[_0xdd67('0xf0')](_0xd1fdaf);}})['then'](function(_0x2256a9){if(_0x2256a9){_0xdeba0f=_0x2256a9[_0xdd67('0x70')];if(!_0x2e1bae[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0xd1fdaf['limit']=qs[_0xdd67('0x1d')](_0x2e1bae[_0xdd67('0x49')][_0xdd67('0x1d')]);_0xd1fdaf[_0xdd67('0x1b')]=qs['offset'](_0x2e1bae[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x1ccc3f[_0xdd67('0xf0')](_0xd1fdaf);}})['then'](function(_0x2ab204){if(_0x2ab204){return _0x2ab204?{'count':_0xdeba0f,'rows':_0x2ab204}:null;}})[_0xdd67('0x21')](respondWithResult(_0x6ac100,null))['catch'](handleError(_0x6ac100,null));};exports[_0xdd67('0xf2')]=function(_0x58694c,_0x5bd17c){var _0x594229={};var _0x2fe05f={};var _0x350ecb;var _0x4154f8;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x58694c[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x5bd17c,null))['then'](function(_0x23c2ff){if(_0x23c2ff){_0x350ecb=_0x23c2ff;_0x2fe05f[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xf3')][_0xdd67('0x40')]);_0x2fe05f[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x58694c['query']);_0x2fe05f[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x2fe05f['model'],_0x2fe05f['query']);_0x594229['attributes']=_[_0xdd67('0xda')](_0x2fe05f[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x58694c['query']['fields']));_0x594229[_0xdd67('0x4e')]=_0x594229[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x594229[_0xdd67('0x4e')]:_0x2fe05f[_0xdd67('0xd7')];_0x594229[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x58694c[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x594229['where']=qs['filters'](_['pick'](_0x58694c[_0xdd67('0x49')],_0x2fe05f[_0xdd67('0xd9')]));if(_0x58694c[_0xdd67('0x49')][_0xdd67('0x35')]){_0x594229[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x594229[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x594229['attributes'],function(_0x40b3f7){var _0x3b096f={};_0x3b096f[_0x40b3f7]={'$like':'%'+_0x58694c[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3b096f;})});}_0x594229=_[_0xdd67('0x5a')]({},_0x594229,_0x58694c[_0xdd67('0x5b')]);return _0x350ecb[_0xdd67('0xf2')](_0x594229);}})[_0xdd67('0x21')](function(_0x4e2ae5){if(_0x4e2ae5){_0x4154f8=_0x4e2ae5[_0xdd67('0x70')];if(!_0x58694c[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x594229[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x58694c[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x594229['offset']=qs[_0xdd67('0x1b')](_0x58694c[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x350ecb['getWhatsappInteractions'](_0x594229);}})[_0xdd67('0x21')](function(_0x45e295){if(_0x45e295){return _0x45e295?{'count':_0x4154f8,'rows':_0x45e295}:null;}})[_0xdd67('0x21')](respondWithResult(_0x5bd17c,null))[_0xdd67('0x2c')](handleError(_0x5bd17c,null));};exports[_0xdd67('0xf4')]=function(_0x706e07,_0xe52347,_0x10309b){var _0x4c12d8;var _0x16dfbc;var _0x2f4442;var _0x3e6976=!_[_0xdd67('0x6a')](_0x706e07['params']['id'])?_0x706e07['params']['id']:!_[_0xdd67('0x6a')](_0x706e07['user']['id'])?_0x706e07['user']['id']:null;return db[_0xdd67('0x48')]['find']({'where':{'id':_0x3e6976,'role':{'$or':[_0xdd67('0x84'),_0xdd67('0x83'),'agent']}},'attributes':['id','name',_0xdd67('0xf5'),'mobile',_0xdd67('0x2e'),_0xdd67('0x63'),_0xdd67('0xa0')]})['then'](function(_0x3dac28){if(_0x3dac28){if(_0x3dac28[_0xdd67('0x2e')]===_0xdd67('0x33')){_0x4c12d8=_0x3dac28;if(_0x706e07[_0xdd67('0x5e')][_0xdd67('0xa2')]){_0x2f4442=util['format'](_0xdd67('0xf6'),_0x4c12d8[_0x706e07['body'][_0xdd67('0xa2')]]);}else if(_0x706e07[_0xdd67('0x5e')][_0xdd67('0xf7')]){_0x2f4442=util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x706e07[_0xdd67('0x5e')][_0xdd67('0xf7')]);}else{_0x2f4442=util[_0xdd67('0xaf')]('SIP/%s',_0x4c12d8['name']);}socket['to'](util[_0xdd67('0xaf')](_0xdd67('0xf8'),_0x4c12d8[_0xdd67('0x3b')]))['emit'](_0xdd67('0xf9'),{'user':{'id':_0x4c12d8['id'],'name':_0x4c12d8[_0xdd67('0x3b')]},'ip':_0x706e07['headers'][_0xdd67('0xfa')]||_0x706e07[_0xdd67('0xfb')][_0xdd67('0xfc')]||_0x706e07[_0xdd67('0xfd')][_0xdd67('0xfc')]||_0x706e07[_0xdd67('0xfb')]['socket']['remoteAddress']});return new Promise(function(_0x11a9d6,_0x394642){db['sequelize'][_0xdd67('0xfe')]()[_0xdd67('0x21')](_0xb6d60b=>{db[_0xdd67('0xb1')][_0xdd67('0x3d')]({'where':{'membername':_0x4c12d8[_0xdd67('0x3b')]},'individualHooks':!![]},{'transaction':_0xb6d60b})[_0xdd67('0x21')](function(){return _0xb6d60b[_0xdd67('0xff')]();})[_0xdd67('0x21')](_0x11a9d6)['catch'](_0x394642);});});}}else{throw new db['Sequelize'][(_0xdd67('0x97'))](_0xdd67('0x100'));}})[_0xdd67('0x21')](function(){if(_0x4c12d8){return _0x4c12d8[_0xdd67('0x101')]({'raw':!![]});}})[_0xdd67('0x21')](function(_0x4055cf){if(_0x4c12d8){if(_0x4055cf){_0x16dfbc=_0x4055cf;if(_0x16dfbc[_0xdd67('0x70')]){var _0x3458e3=_0x16dfbc[_0xdd67('0x37')](function(_0x1e23a7){return{'membername':_0x4c12d8[_0xdd67('0x3b')],'UserId':_0x4c12d8['id'],'queue_name':_0x1e23a7[_0xdd67('0x3b')],'VoiceQueueId':_0x1e23a7['id'],'interface':_0x2f4442,'paused':_0x4c12d8[_0xdd67('0xa0')]||![],'penalty':_0x1e23a7[_0xdd67('0x102')]||0x0};});return db[_0xdd67('0xb1')][_0xdd67('0x8b')](_0x3458e3);}}}})[_0xdd67('0x21')](function(){if(_0x4c12d8){return db['MemberReport'][_0xdd67('0xae')]({'where':{'membername':_0x4c12d8[_0xdd67('0x3b')],'exitAt':null}});}})[_0xdd67('0x21')](function(_0x104fc9){if(_0x4c12d8){var _0x3f468b=[];_0x104fc9[_0xdd67('0x103')](function(_0x95534d){_0x3f468b[_0xdd67('0x50')](_0x95534d[_0xdd67('0x2d')]({'exitAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))}));});return Promise[_0xdd67('0x56')](_0x3f468b);}})[_0xdd67('0x21')](function(){if(_0x4c12d8){var _0xa42f9d=[];var _0x2e0c1a=[];var _0x3a6ee9=utils[_0xdd67('0x105')]();var _0x1cb7fe={'membername':_0x4c12d8[_0xdd67('0x3b')],'interface':_0x2f4442,'enterAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104')),'role':_0x4c12d8[_0xdd67('0x2e')],'internal':_0x4c12d8[_0xdd67('0x63')]};_0x3a6ee9['forEach'](function(_0xc4f7ec){_0xa42f9d['push'](_[_0xdd67('0x5a')]({'channel':_0xc4f7ec,'type':'LOGIN','data1':_0x706e07['body'][_0xdd67('0x106')],'data2':_0x2f4442},_0x1cb7fe));if(_0x4c12d8[_0xdd67('0xa0')]){_0x2e0c1a[_0xdd67('0x50')](_[_0xdd67('0x5a')]({'channel':_0xc4f7ec,'type':_0xdd67('0x107'),'data1':'LOGININPAUSE'},_0x1cb7fe));}});return db[_0xdd67('0x108')][_0xdd67('0x8b')](_0xa42f9d['concat'](_0x2e0c1a),{'individualHooks':!![]});}})[_0xdd67('0x21')](function(){if(_0x4c12d8){return _0x4c12d8['update']({'online':!![],'lastLoginAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104')),'voicePause':_0x4c12d8[_0xdd67('0xa0')]||![],'mailPause':_0x4c12d8[_0xdd67('0xa0')]||![],'chatPause':_0x4c12d8['loginInPause']||![],'faxPause':_0x4c12d8[_0xdd67('0xa0')]||![],'smsPause':_0x4c12d8[_0xdd67('0xa0')]||![],'openchannelPause':_0x4c12d8['loginInPause']||![],'whatsappPause':_0x4c12d8[_0xdd67('0xa0')]||![],'pauseType':_0x4c12d8[_0xdd67('0xa0')]?_0xdd67('0x109'):null,'interface':_0x2f4442,'lastPauseAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))});}})[_0xdd67('0x21')](function(_0x164d76){if(_0x706e07['isMiddleware']){return _0x10309b();}else{return Promise['resolve'](_0x164d76)['then'](respondWithResult(_0xe52347,null));}})[_0xdd67('0x2c')](handleError(_0xe52347,null));};exports[_0xdd67('0x10a')]=function(_0x23b034,_0x1bc2d6){var _0x1ef3df;return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x23b034[_0xdd67('0x58')]['id'],'role':_0xdd67('0x33')},'attributes':['id',_0xdd67('0x3b'),_0xdd67('0x2e')]})[_0xdd67('0x21')](handleEntityNotFound(_0x1bc2d6,null))[_0xdd67('0x21')](function(_0x4a9cf6){if(_0x4a9cf6){_0x1ef3df=_0x4a9cf6;return db[_0xdd67('0xb1')][_0xdd67('0x3d')]({'where':{'membername':_0x1ef3df[_0xdd67('0x3b')]},'individualHooks':!![]});}})[_0xdd67('0x21')](function(){return db[_0xdd67('0x108')][_0xdd67('0xae')]({'where':{'membername':_0x1ef3df[_0xdd67('0x3b')],'exitAt':null}});})[_0xdd67('0x21')](function(_0x119036){var _0x376106=[];_0x119036[_0xdd67('0x103')](function(_0x2da0c5){_0x376106['push'](_0x2da0c5[_0xdd67('0x2d')]({'exitAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))}));});return Promise[_0xdd67('0x56')](_0x376106);})[_0xdd67('0x21')](function(){return _0x1ef3df[_0xdd67('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xdd67('0x21')](respondWithResult(_0x1bc2d6,null))[_0xdd67('0x2c')](handleError(_0x1bc2d6,null));};exports[_0xdd67('0x10b')]=function(_0x239c67,_0x3e93f7){var _0x5aa642;return db['UserVoiceQueueRt'][_0xdd67('0x2d')]({'paused':0x1},{'where':{'UserId':_0x239c67[_0xdd67('0x58')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x239c67[_0xdd67('0x58')]['id'],'role':_0xdd67('0x33')},'attributes':['id','name',_0xdd67('0x2e'),_0xdd67('0x63'),_0xdd67('0xa2'),_0xdd67('0x9f')]});})[_0xdd67('0x21')](handleEntityNotFound(_0x3e93f7,null))['then'](function(_0x15ff0b){if(_0x15ff0b){_0x5aa642=_0x15ff0b;return respondWithRpcPromise(_0xdd67('0x10c'),'pause',{'id':_0x5aa642['id'],'name':_0x5aa642['name'],'pause':!![]});}})[_0xdd67('0x21')](function(){if(_0x5aa642){return db[_0xdd67('0x108')][_0xdd67('0xae')]({'where':{'membername':_0x5aa642[_0xdd67('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0xdd67('0x21')](function(_0x31ce77){if(_0x31ce77[_0xdd67('0x70')]){var _0x5da93f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x12237f=0x0,_0x4a4235=_0x31ce77[_0xdd67('0x70')];_0x12237f<_0x4a4235;_0x12237f++){_0x31ce77[_0x12237f]['updateAttributes']({'exitAt':_0x5da93f});}}})[_0xdd67('0x21')](function(){var _0x340f96=[];var _0x3a6ae5=utils['getChannels']();_0x3a6ae5[_0xdd67('0x103')](function(_0x4cf719){_0x340f96[_0xdd67('0x50')]({'channel':_0x4cf719,'membername':_0x5aa642[_0xdd67('0x3b')],'interface':_['isNil'](_0x5aa642[_0xdd67('0xa2')])?util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x5aa642[_0xdd67('0x3b')]):_0x5aa642['interface'],'type':_0xdd67('0x107'),'enterAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104')),'data1':_0x239c67[_0xdd67('0x5e')][_0xdd67('0x10d')]||_0xdd67('0x10e'),'role':_0x5aa642[_0xdd67('0x2e')],'internal':_0x5aa642[_0xdd67('0x63')]});});return db['MemberReport']['bulkCreate'](_0x340f96,{'individualHooks':!![]});})[_0xdd67('0x21')](function(){return _0x5aa642['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x239c67[_0xdd67('0x5e')][_0xdd67('0x10d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))});})[_0xdd67('0x21')](respondWithResult(_0x3e93f7,null))['catch'](handleError(_0x3e93f7,null));};exports[_0xdd67('0x10f')]=function(_0x4a716d,_0x126fc8){if(_0x4a716d[_0xdd67('0x5e')]['channel']&&!utils['isValidChannel'](_0x4a716d[_0xdd67('0x5e')]['channel'])){throw new APIBadRequestError(util[_0xdd67('0xaf')](_0xdd67('0x110'),_0x4a716d['body'][_0xdd67('0xb4')]));}return db['User'][_0xdd67('0x3a')]({'where':{'id':_0x4a716d[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0x3b'),_0xdd67('0x2e'),_0xdd67('0x63'),_0xdd67('0xa2'),_0xdd67('0x9f'),_0xdd67('0xa1'),_0xdd67('0x111'),_0xdd67('0x112'),'faxPause',_0xdd67('0x113'),_0xdd67('0x114'),_0xdd67('0x115'),'pauseType',_0xdd67('0x116')]})[_0xdd67('0x21')](function(_0x5b9977){if(!_0x5b9977){throw new APINotFoundError(util['format'](_0xdd67('0xd0'),_0x4a716d['params']['id']));}return _0x5b9977[_0xdd67('0x10f')](_0x4a716d[_0xdd67('0x5e')][_0xdd67('0xb4')]);})[_0xdd67('0x21')](respondWithResult(_0x126fc8,null))[_0xdd67('0x2c')](APIHandleError(_0x126fc8));};exports['getTeams']=function(_0x4607ae,_0x275c9e){var _0x29b830={};var _0xddfa33={};var _0x46eaa7;var _0x2886ff;return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x4607ae['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x275c9e,null))['then'](function(_0x7ced8d){if(_0x7ced8d){_0x46eaa7=_0x7ced8d;_0xddfa33[_0xdd67('0xd7')]=_['keys'](db[_0xdd67('0x117')][_0xdd67('0x40')]);_0xddfa33[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x4607ae[_0xdd67('0x49')]);_0xddfa33[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0xddfa33[_0xdd67('0xd7')],_0xddfa33[_0xdd67('0x49')]);_0x29b830[_0xdd67('0x4e')]=_['intersection'](_0xddfa33[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x4607ae[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x29b830[_0xdd67('0x4e')]=_0x29b830[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x29b830[_0xdd67('0x4e')]:_0xddfa33[_0xdd67('0xd7')];_0x29b830[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x4607ae[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x29b830[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x4607ae[_0xdd67('0x49')],_0xddfa33[_0xdd67('0xd9')]));if(_0x4607ae[_0xdd67('0x49')][_0xdd67('0x35')]){_0x29b830[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x29b830[_0xdd67('0x47')],{'$or':_['map'](_0x29b830['attributes'],function(_0x4019d9){var _0x3330e8={};_0x3330e8[_0x4019d9]={'$like':'%'+_0x4607ae[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3330e8;})});}_0x29b830=_['merge']({},_0x29b830,_0x4607ae[_0xdd67('0x5b')]);return _0x46eaa7[_0xdd67('0x118')](_0x29b830);}})[_0xdd67('0x21')](function(_0x3adda4){if(_0x3adda4){_0x2886ff=_0x3adda4[_0xdd67('0x70')];if(!_0x4607ae['query'][_0xdd67('0xe1')]('nolimit')){_0x29b830[_0xdd67('0x1d')]=qs['limit'](_0x4607ae['query'][_0xdd67('0x1d')]);_0x29b830['offset']=qs[_0xdd67('0x1b')](_0x4607ae[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x46eaa7[_0xdd67('0x118')](_0x29b830);}})[_0xdd67('0x21')](function(_0x5cb9f6){if(_0x5cb9f6){return _0x5cb9f6?{'count':_0x2886ff,'rows':_0x5cb9f6}:null;}})[_0xdd67('0x21')](respondWithResult(_0x275c9e,null))[_0xdd67('0x2c')](handleError(_0x275c9e,null));};exports['addTeams']=function(_0x20c9ef,_0x1cddf9){var _0x1c51da=_0x20c9ef[_0xdd67('0x58')]['id'];var _0x1feb0a=_0x20c9ef[_0xdd67('0x5e')]?_0x20c9ef[_0xdd67('0x5e')][_0xdd67('0x62')]:null;var _0x34969e=[];return Promise[_0xdd67('0x119')]()[_0xdd67('0x21')](function(){if(!_0x1feb0a)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xdd67('0x21')](function(){return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x1c51da}});})[_0xdd67('0x21')](function(_0x39d929){if(!_0x39d929)throw new APINotFoundError(util['format'](_0xdd67('0xd0'),_0x20c9ef[_0xdd67('0x58')]['id']));return db[_0xdd67('0x6d')]['transaction'](function(_0xfe3432){return _0x39d929['addTeams'](_0x1feb0a,{'transaction':_0xfe3432})['then'](function(){return db[_0xdd67('0x117')][_0xdd67('0xae')]({'where':{'id':{'$in':_0x1feb0a}}});})['then'](function(_0x558163){var _0x2505e2=_['map'](_0x558163,function(_0x3769ae){return _0x3769ae[_0xdd67('0x11a')]();});return Promise[_0xdd67('0x56')](_0x2505e2);})[_0xdd67('0x21')](function(_0x40ecc2){_0x34969e=_[_0xdd67('0x11b')](_0x40ecc2);var _0x851043=_['map'](_0x34969e,function(_0x44f7de){return _0x44f7de[_0xdd67('0x11c')](_0x39d929['id'],{'transaction':_0xfe3432});});return Promise[_0xdd67('0x56')](_0x851043);})[_0xdd67('0x21')](function(){if(!_0x39d929[_0xdd67('0x9f')])return;var _0x3760e7=_[_0xdd67('0x35')](_0x34969e,function(_0x99012f){return _0x99012f['getDataValue'](_0xdd67('0xb4'))===_0xdd67('0x11d');});var _0x49dca4=_[_0xdd67('0x37')](_0x3760e7,function(_0x2d08bc){return db[_0xdd67('0xb1')][_0xdd67('0xb2')]({'membername':_0x39d929[_0xdd67('0x3b')],'UserId':_0x39d929['id'],'queue_name':_0x2d08bc[_0xdd67('0x3b')],'VoiceQueueId':_0x2d08bc['id'],'interface':_[_0xdd67('0x6a')](_0x39d929['interface'])?util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x39d929[_0xdd67('0x3b')]):_0x39d929['interface'],'paused':_0x39d929['voicePause']||![],'penalty':_0x39d929[_0xdd67('0x11e')]},{'transaction':_0xfe3432});});return Promise['all'](_0x49dca4);})[_0xdd67('0x21')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x1feb0a}}});})[_0xdd67('0x21')](function(_0xeb8214){var _0x39d6da=_[_0xdd67('0x37')](_0xeb8214,function(_0x10ee0d){return db[_0xdd67('0x11f')]['create']({'UserId':_0x39d929['id'],'VoicePrefixId':_0x10ee0d[_0xdd67('0x120')]},{'transaction':_0xfe3432});});return Promise[_0xdd67('0x56')](_0x39d6da);});});})[_0xdd67('0x21')](function(){for(var _0x31cd21=0x0;_0x31cd21<_0x34969e[_0xdd67('0x70')];_0x31cd21++){var _0x32a09f=_0x34969e[_0x31cd21][_0xdd67('0x121')]('channel');var _0x18ae49=_0x32a09f+_0xdd67('0xaa');socket['emit']('user'+_0x32a09f+'Queue:save',{'UserId':_0x1c51da,['queueField']:_0x34969e[_0x31cd21]['id']});}})[_0xdd67('0x21')](respondWithStatusCode(_0x1cddf9,null))[_0xdd67('0x2c')](APIHandleError(_0x1cddf9));};exports[_0xdd67('0x122')]=function(_0x38b592,_0x2b83d4){var _0x32d3d7=_0x38b592[_0xdd67('0x58')]['id'];var _0x5468d8=null;if(_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')]){_0x5468d8=_[_0xdd67('0xb6')](_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')])?_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')]:[_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')]];}var _0x1a4cbc=[];return Promise['resolve']()[_0xdd67('0x21')](function(){if(!_0x5468d8)throw new APIBadRequestError(_0xdd67('0x123'));})[_0xdd67('0x21')](function(){return db[_0xdd67('0x48')]['findOne']({'where':{'id':_0x32d3d7}});})['then'](function(_0x294b31){if(!_0x294b31)throw new APINotFoundError(util[_0xdd67('0xaf')](_0xdd67('0xd0'),_0x38b592['params']['id']));return db[_0xdd67('0x6d')][_0xdd67('0xfe')](function(_0x3ff66c){return _0x294b31['removeTeams'](_0x5468d8,{'transaction':_0x3ff66c})[_0xdd67('0x21')](function(){return db['Team'][_0xdd67('0xae')]({'where':{'id':{'$in':_0x5468d8}}});})['then'](function(_0x1814d6){var _0x1a169b=_['map'](_0x1814d6,function(_0x506eef){return _0x506eef['getAssociatedQueues']();});return Promise[_0xdd67('0x56')](_0x1a169b);})[_0xdd67('0x21')](function(_0x205db8){_0x1a4cbc=_['flattenDeep'](_0x205db8);var _0x35f8b7=_['map'](_0x1a4cbc,function(_0x10dec1){return _0x10dec1['removeAgent'](_0x294b31['id'],{'transaction':_0x3ff66c});});return Promise[_0xdd67('0x56')](_0x35f8b7);})[_0xdd67('0x21')](function(){if(!_0x294b31[_0xdd67('0x9f')])return;var _0x262eb2=_['filter'](_0x1a4cbc,function(_0x1af9a){return _0x1af9a['getDataValue'](_0xdd67('0xb4'))==='Voice';});var _0x3fd4e5=_['map'](_0x262eb2,function(_0xf27308){return db[_0xdd67('0xb1')][_0xdd67('0x3d')]({'where':{'VoiceQueueId':_0xf27308['id'],'UserId':_0x294b31['id']},'transaction':_0x3ff66c});});return Promise[_0xdd67('0x56')](_0x3fd4e5);})[_0xdd67('0x21')](function(){return db[_0xdd67('0x124')][_0xdd67('0xae')]({'where':{'teamId':{'$in':_0x5468d8}}});})[_0xdd67('0x21')](function(_0x2f62b5){var _0x461522=_[_0xdd67('0x37')](_0x2f62b5,function(_0x4a2d78){return db['UserVoicePrefix'][_0xdd67('0x3d')]({'where':{'UserId':_0x294b31['id'],'VoicePrefixId':_0x4a2d78[_0xdd67('0x120')]}},{'transaction':_0x3ff66c});});return Promise['all'](_0x461522);});});})[_0xdd67('0x21')](function(){for(var _0x7040dc=0x0;_0x7040dc<_0x1a4cbc[_0xdd67('0x70')];_0x7040dc++){var _0x175185=_0x1a4cbc[_0x7040dc]['getDataValue']('channel');var _0x2f595f=_0x175185+'QueueId';socket[_0xdd67('0xab')](_0xdd67('0x83')+_0x175185+_0xdd67('0xb7'),{'UserId':_0x32d3d7,['queueField']:_0x1a4cbc[_0x7040dc]['id']});}})[_0xdd67('0x21')](respondWithStatusCode(_0x2b83d4,null))[_0xdd67('0x2c')](APIHandleError(_0x2b83d4));};exports['getLists']=function(_0x4f888c,_0x261428){var _0x417a5d={};var _0x889963={};var _0x4e88d4;var _0x11959b;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x4f888c['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x261428,null))[_0xdd67('0x21')](function(_0x2abae5){if(_0x2abae5){_0x4e88d4=_0x2abae5;_0x889963['model']=_[_0xdd67('0xd8')](db['CmList'][_0xdd67('0x40')]);_0x889963['query']=_[_0xdd67('0xd8')](_0x4f888c[_0xdd67('0x49')]);_0x889963['filters']=_['intersection'](_0x889963['model'],_0x889963[_0xdd67('0x49')]);_0x417a5d[_0xdd67('0x4e')]=_['intersection'](_0x889963['model'],qs[_0xdd67('0xdb')](_0x4f888c[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x417a5d[_0xdd67('0x4e')]=_0x417a5d[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x417a5d['attributes']:_0x889963[_0xdd67('0xd7')];_0x417a5d[_0xdd67('0xdc')]=qs['sort'](_0x4f888c[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x417a5d[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x4f888c['query'],_0x889963['filters']));if(_0x4f888c[_0xdd67('0x49')][_0xdd67('0x35')]){_0x417a5d['where']=_[_0xdd67('0x5a')](_0x417a5d[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x417a5d[_0xdd67('0x4e')],function(_0x217bfb){var _0x354b4b={};_0x354b4b[_0x217bfb]={'$like':'%'+_0x4f888c[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x354b4b;})});}_0x417a5d=_[_0xdd67('0x5a')]({},_0x417a5d,_0x4f888c['options']);return _0x4e88d4['getLists'](_0x417a5d);}})[_0xdd67('0x21')](function(_0x4b09c6){if(_0x4b09c6){_0x11959b=_0x4b09c6['length'];if(!_0x4f888c[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x417a5d['limit']=qs[_0xdd67('0x1d')](_0x4f888c[_0xdd67('0x49')]['limit']);_0x417a5d[_0xdd67('0x1b')]=qs['offset'](_0x4f888c[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x4e88d4[_0xdd67('0x125')](_0x417a5d);}})[_0xdd67('0x21')](function(_0x2e21a2){if(_0x2e21a2){return _0x2e21a2?{'count':_0x11959b,'rows':_0x2e21a2}:null;}})['then'](respondWithResult(_0x261428,null))['catch'](handleError(_0x261428,null));};exports[_0xdd67('0x126')]=function(_0x41ccc3,_0x25a1a1){var _0x2d2db3={};var _0x1b3cf9={};var _0x49e8bc;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x41ccc3['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x25a1a1,null))[_0xdd67('0x21')](function(_0x558199){if(_0x558199){_0x49e8bc=_0x558199;_0x1b3cf9[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0x48')][_0xdd67('0x40')]);_0x1b3cf9[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x41ccc3[_0xdd67('0x49')]);_0x1b3cf9[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x1b3cf9[_0xdd67('0xd7')],_0x1b3cf9[_0xdd67('0x49')]);_0x2d2db3['attributes']=_[_0xdd67('0xda')](_0x1b3cf9[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x41ccc3[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x2d2db3[_0xdd67('0x4e')]=_0x2d2db3[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x2d2db3[_0xdd67('0x4e')]:_0x1b3cf9[_0xdd67('0xd7')];_0x2d2db3[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x41ccc3['query'][_0xdd67('0xdd')]);_0x2d2db3['where']=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x41ccc3[_0xdd67('0x49')],_0x1b3cf9[_0xdd67('0xd9')]));if(_0x41ccc3[_0xdd67('0x49')][_0xdd67('0x35')]){_0x2d2db3['where']=_[_0xdd67('0x5a')](_0x2d2db3['where'],{'$or':_['map'](_0x2d2db3[_0xdd67('0x4e')],function(_0x362881){var _0x553dca={};_0x553dca[_0x362881]={'$like':'%'+_0x41ccc3[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x553dca;})});}_0x2d2db3[_0xdd67('0xd7')]=db[_0xdd67('0x48')];_0x2d2db3['as']='Agents';_0x2d2db3=_[_0xdd67('0x5a')]({},_0x2d2db3,_0x41ccc3[_0xdd67('0x5b')]);return _0x49e8bc[_0xdd67('0x101')]({'include':[_0x2d2db3]});}})[_0xdd67('0x21')](function(_0x4fbf43){if(_0x4fbf43){var _0x500e43={},_0x2d4b58=[];for(var _0x3300e4=0x0;_0x3300e4<_0x4fbf43[_0xdd67('0x70')];_0x3300e4+=0x1){for(var _0x2b4c8e=0x0,_0x39cb19;_0x2b4c8e<_0x4fbf43[_0x3300e4]['Agents'][_0xdd67('0x70')];_0x2b4c8e+=0x1){_0x39cb19=_0x4fbf43[_0x3300e4][_0xdd67('0x32')][_0x2b4c8e][_0xdd67('0x30')]({'plain':!![]});_0x500e43[_0x39cb19['id']]=_0x39cb19;}}_0x500e43=_[_0xdd67('0x127')](_0x500e43);for(var _0x1448ce=qs[_0xdd67('0x1b')](_0x41ccc3[_0xdd67('0x49')]['offset']);_0x1448ce<_0x500e43[_0xdd67('0x70')]&&_0x2d4b58['length']=_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 +var _0x1aa4=['../../config/logger','../../config/environment','redis','localhost','register','GetUser','User','options','raw','where','include','map','model','attributes','then','info','stringify','catch','error','message','ShowUser','find','debug','PauseUser','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','updateAttributes','getChannels','forEach','push','isNil','YYYY-MM-DD\x20HH:mm:ss','body','bulkCreate','type','DEFAULT\x20PAUSE','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','LogoutUser','all','mobile','phone','SIP/%s','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','findAll','merge','LOGIN','callysquare','loginInPause','LOGININPAUSE','concat','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x586eaf,_0x2d11b2){var _0x1ef149=function(_0x32d0ad){while(--_0x32d0ad){_0x586eaf['push'](_0x586eaf['shift']());}};_0x1ef149(++_0x2d11b2);}(_0x1aa4,0x15b));var _0x41aa=function(_0x36ed7a,_0x391884){_0x36ed7a=_0x36ed7a-0x0;var _0x18e0da=_0x1aa4[_0x36ed7a];return _0x18e0da;};'use strict';var _=require(_0x41aa('0x0'));var util=require('util');var moment=require(_0x41aa('0x1'));var BPromise=require('bluebird');var Redis=require(_0x41aa('0x2'));var db=require(_0x41aa('0x3'))['db'];var utils=require(_0x41aa('0x4'));var logger=require(_0x41aa('0x5'))('rpc');var config=require(_0x41aa('0x6'));config[_0x41aa('0x7')]=_['defaults'](config['redis'],{'host':_0x41aa('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41aa('0x7')]));require('./user.socket')[_0x41aa('0x9')](socket);exports[_0x41aa('0xa')]=function(_0x3c3c58){var _0xba3394=this;return new Promise(function(_0x3b443a,_0xae543c){return db[_0x41aa('0xb')]['findAll']({'raw':_0x3c3c58[_0x41aa('0xc')]?_0x3c3c58['options'][_0x41aa('0xd')]===undefined?!![]:![]:!![],'where':_0x3c3c58[_0x41aa('0xc')]?_0x3c3c58[_0x41aa('0xc')][_0x41aa('0xe')]||null:null,'attributes':_0x3c3c58['options']?_0x3c3c58[_0x41aa('0xc')]['attributes']||null:null,'limit':_0x3c3c58[_0x41aa('0xc')]?_0x3c3c58[_0x41aa('0xc')]['limit']||null:null,'include':_0x3c3c58[_0x41aa('0xc')]?_0x3c3c58[_0x41aa('0xc')][_0x41aa('0xf')]?_[_0x41aa('0x10')](_0x3c3c58[_0x41aa('0xc')][_0x41aa('0xf')],function(_0x3ca158){return{'model':db[_0x3ca158[_0x41aa('0x11')]],'as':_0x3ca158['as'],'attributes':_0x3ca158[_0x41aa('0x12')],'include':_0x3ca158[_0x41aa('0xf')]?_[_0x41aa('0x10')](_0x3ca158[_0x41aa('0xf')],function(_0x3793d0){return{'model':db[_0x3793d0['model']],'as':_0x3793d0['as'],'attributes':_0x3793d0[_0x41aa('0x12')],'include':_0x3793d0[_0x41aa('0xf')]?_[_0x41aa('0x10')](_0x3793d0[_0x41aa('0xf')],function(_0x447585){return{'model':db[_0x447585[_0x41aa('0x11')]],'as':_0x447585['as'],'attributes':_0x447585['attributes']};}):[]};}):[]};}):[]:[]})[_0x41aa('0x13')](function(_0x29db25){logger[_0x41aa('0x14')]('GetUser',_0x3c3c58);logger['debug']('GetUser',_0x3c3c58,JSON[_0x41aa('0x15')](_0x29db25));_0x3b443a(_0x29db25);})[_0x41aa('0x16')](function(_0x1e73d5){logger[_0x41aa('0x17')](_0x41aa('0xa'),_0x1e73d5[_0x41aa('0x18')],_0x3c3c58);_0xae543c(_0xba3394[_0x41aa('0x17')](0x1f4,_0x1e73d5[_0x41aa('0x18')]));});});};exports[_0x41aa('0x19')]=function(_0x3de155){var _0x2a2732=this;return new Promise(function(_0x419d1d,_0xdcb501){return db[_0x41aa('0xb')][_0x41aa('0x1a')]({'raw':_0x3de155['options']?_0x3de155['options'][_0x41aa('0xd')]===undefined?!![]:![]:!![],'where':_0x3de155['options']?_0x3de155[_0x41aa('0xc')][_0x41aa('0xe')]||null:null,'attributes':_0x3de155['options']?_0x3de155[_0x41aa('0xc')][_0x41aa('0x12')]||null:null,'include':_0x3de155[_0x41aa('0xc')]?_0x3de155['options'][_0x41aa('0xf')]?_['map'](_0x3de155[_0x41aa('0xc')][_0x41aa('0xf')],function(_0x1823a2){return{'model':db[_0x1823a2[_0x41aa('0x11')]],'as':_0x1823a2['as'],'attributes':_0x1823a2['attributes'],'include':_0x1823a2['include']?_[_0x41aa('0x10')](_0x1823a2[_0x41aa('0xf')],function(_0x2102e6){return{'model':db[_0x2102e6[_0x41aa('0x11')]],'as':_0x2102e6['as'],'attributes':_0x2102e6[_0x41aa('0x12')],'include':_0x2102e6[_0x41aa('0xf')]?_[_0x41aa('0x10')](_0x2102e6[_0x41aa('0xf')],function(_0x343b5f){return{'model':db[_0x343b5f['model']],'as':_0x343b5f['as'],'attributes':_0x343b5f[_0x41aa('0x12')]};}):[]};}):[]};}):[]:[]})[_0x41aa('0x13')](function(_0x3df4b2){logger[_0x41aa('0x14')](_0x41aa('0x19'),_0x3de155);logger[_0x41aa('0x1b')]('ShowUser',_0x3de155,JSON[_0x41aa('0x15')](_0x3df4b2));_0x419d1d(_0x3df4b2);})['catch'](function(_0x5d94be){logger[_0x41aa('0x17')]('ShowUser',_0x5d94be[_0x41aa('0x18')],_0x3de155);_0xdcb501(_0x2a2732[_0x41aa('0x17')](0x1f4,_0x5d94be[_0x41aa('0x18')]));});});};exports[_0x41aa('0x1c')]=function(_0xfd4b8e){var _0x56062e;return db[_0x41aa('0xb')][_0x41aa('0x1a')]({'where':_0xfd4b8e['options'][_0x41aa('0xe')]||{},'attributes':['id','name',_0x41aa('0x1d'),_0x41aa('0x1e'),_0x41aa('0x1f')]})[_0x41aa('0x13')](function(_0x445c8e){if(!_0x445c8e){throw new Error(util[_0x41aa('0x20')](_0x41aa('0x21'),_0xfd4b8e[_0x41aa('0x22')]['id']));}_0x56062e=_0x445c8e;return db[_0x41aa('0x23')][_0x41aa('0x24')]({'paused':0x1},{'where':{'UserId':_0x56062e['id']},'individualHooks':!![]});})[_0x41aa('0x13')](function(){return db[_0x41aa('0x25')]['findAll']({'where':{'membername':_0x56062e[_0x41aa('0x26')],'type':_0x41aa('0x27'),'exitAt':null}});})[_0x41aa('0x13')](function(_0x59d0c2){if(_0x59d0c2&&_0x59d0c2['length']){var _0x4f99be=moment()[_0x41aa('0x20')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x869e13=0x0,_0x4d480d=_0x59d0c2[_0x41aa('0x28')];_0x869e13<_0x4d480d;_0x869e13++){_0x59d0c2[_0x869e13][_0x41aa('0x29')]({'exitAt':_0x4f99be});}}})[_0x41aa('0x13')](function(){var _0x4fb95c=[];var _0x21f76a=utils[_0x41aa('0x2a')]();_0x21f76a[_0x41aa('0x2b')](function(_0x200bbf){_0x4fb95c[_0x41aa('0x2c')]({'channel':_0x200bbf,'membername':_0x56062e[_0x41aa('0x26')],'interface':_[_0x41aa('0x2d')](_0x56062e['interface'])?util[_0x41aa('0x20')]('SIP/%s',_0x56062e[_0x41aa('0x26')]):_0x56062e['interface'],'type':'PAUSE','enterAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e')),'data1':_0xfd4b8e[_0x41aa('0x2f')]['type']||'DEFAULT\x20PAUSE','role':_0x56062e['role'],'internal':_0x56062e[_0x41aa('0x1e')],'uniqueid':_0xfd4b8e[_0x41aa('0x2f')]['uniqueid']||null});});return db[_0x41aa('0x25')][_0x41aa('0x30')](_0x4fb95c,{'individualHooks':!![]});})[_0x41aa('0x13')](function(){return _0x56062e[_0x41aa('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xfd4b8e['body'][_0x41aa('0x31')]||_0x41aa('0x32'),'lastPauseAt':moment()['format'](_0x41aa('0x2e'))});})[_0x41aa('0x16')](function(_0x576c7c){throw _0x576c7c;});};exports['UnpauseUser']=function(_0x38005a){return Promise[_0x41aa('0x33')]()[_0x41aa('0x13')](function(){if(_0x38005a[_0x41aa('0x2f')][_0x41aa('0x34')]&&!utils['isValidChannel'](_0x38005a[_0x41aa('0x2f')][_0x41aa('0x34')])){throw new Error(util[_0x41aa('0x20')](_0x41aa('0x35'),_0x38005a['body'][_0x41aa('0x34')]));}return db[_0x41aa('0xb')][_0x41aa('0x36')]({'where':_0x38005a['options'][_0x41aa('0xe')]||{},'attributes':['id',_0x41aa('0x26'),'role',_0x41aa('0x1e'),'interface',_0x41aa('0x37'),_0x41aa('0x38'),_0x41aa('0x39'),_0x41aa('0x3a'),_0x41aa('0x3b'),_0x41aa('0x3c'),_0x41aa('0x3d'),_0x41aa('0x3e'),_0x41aa('0x3f'),_0x41aa('0x40')]});})['then'](function(_0x4e40be){if(!_0x4e40be){throw new Error(util[_0x41aa('0x20')](_0x41aa('0x21'),_0x38005a[_0x41aa('0x22')]['id']));}return _0x4e40be[_0x41aa('0x41')](_0x38005a[_0x41aa('0x2f')]['channel'],'system');})[_0x41aa('0x16')](function(_0x58eba0){throw _0x58eba0;});};exports[_0x41aa('0x42')]=function(_0x24f795){var _0x3abbdc=this;return new Promise(function(_0x5c45bf,_0x34bd78){var _0x505078;return db[_0x41aa('0xb')][_0x41aa('0x36')]({'where':_0x24f795['options']['where']||{},'attributes':['id',_0x41aa('0x26')]})[_0x41aa('0x13')](function(_0x19aa76){if(_0x19aa76){_0x505078=_0x19aa76;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x505078[_0x41aa('0x26')]},'individualHooks':!![]});}})[_0x41aa('0x13')](function(){if(_0x505078){return db['MemberReport']['findAll']({'where':{'membername':_0x505078[_0x41aa('0x26')],'exitAt':null}});}})['then'](function(_0x452ee4){if(_0x505078){if(_0x452ee4&&_0x452ee4[_0x41aa('0x28')]){var _0xe4aad9=[];_0x452ee4[_0x41aa('0x2b')](function(_0x16d3f9){_0xe4aad9['push'](_0x16d3f9[_0x41aa('0x24')]({'exitAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e'))}));});return BPromise[_0x41aa('0x43')](_0xe4aad9);}}})[_0x41aa('0x13')](function(){if(_0x505078){return _0x505078[_0x41aa('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x41aa('0x13')](function(_0x2bec25){_0x5c45bf(_0x2bec25);})[_0x41aa('0x16')](function(_0xfedb76){_0x34bd78(_0x3abbdc[_0x41aa('0x17')](0x1f4,_0xfedb76[_0x41aa('0x18')]));});});};exports['LoginUser']=function(_0x57b7a3){var _0x158009=this;return new Promise(function(_0x383730,_0x3464c5){var _0x40aba8;var _0x1db4f2;var _0x346849;var _0x130260;return db[_0x41aa('0xb')][_0x41aa('0x36')]({'where':_0x57b7a3['options']['where']||{},'attributes':['id','name','role',_0x41aa('0x44'),_0x41aa('0x45'),_0x41aa('0x1e'),'loginInPause','interface']})[_0x41aa('0x13')](function(_0x4bb22e){if(_0x4bb22e){_0x40aba8=_0x4bb22e;_0x130260=_0x57b7a3[_0x41aa('0x2f')][_0x41aa('0x1f')]?_0x57b7a3['body'][_0x41aa('0x1f')]:util['format'](_0x41aa('0x46'),_0x40aba8[_0x41aa('0x26')]);return db[_0x41aa('0xb')][_0x41aa('0x47')]({'where':{'role':_0x41aa('0x48'),'online':!![],'id':{'$ne':_0x40aba8['id']}}});}})[_0x41aa('0x13')](function(_0x54f2b3){if(_0x54f2b3){_0x346849=_0x54f2b3;return require(_0x41aa('0x49'))[_0x41aa('0x4a')]();}})[_0x41aa('0x13')](function(_0x4b019f){if(_0x4b019f&&_0x4b019f[_0x41aa('0x4b')]&&_0x346849>=_0x4b019f[_0x41aa('0x4b')]){throw new Error(_0x41aa('0x4c'));}})[_0x41aa('0x13')](function(){if(_0x40aba8){return db[_0x41aa('0x23')][_0x41aa('0x4d')]({'where':{'membername':_0x40aba8[_0x41aa('0x26')]},'individualHooks':!![]});}})[_0x41aa('0x13')](function(){if(_0x40aba8){return _0x40aba8[_0x41aa('0x4e')]({'raw':!![]});}})[_0x41aa('0x13')](function(_0x2d696e){if(_0x40aba8){if(_0x2d696e){var _0x34e324=[];_0x1db4f2=_0x2d696e;if(_0x1db4f2['length']){for(var _0x4abd74=0x0;_0x4abd74<_0x1db4f2['length'];_0x4abd74++){_0x34e324[_0x41aa('0x2c')](db[_0x41aa('0x23')][_0x41aa('0x4f')]({'membername':_0x40aba8[_0x41aa('0x26')],'UserId':_0x40aba8['id'],'queue_name':_0x1db4f2[_0x4abd74]['name'],'VoiceQueueId':_0x1db4f2[_0x4abd74]['id'],'interface':_0x130260,'paused':_0x40aba8['loginInPause']||![],'penalty':_0x1db4f2[_0x4abd74][_0x41aa('0x50')]||0x0}));}return BPromise[_0x41aa('0x43')](_0x34e324);}}}})['then'](function(){if(_0x40aba8){return db[_0x41aa('0x25')][_0x41aa('0x51')]({'where':{'membername':_0x40aba8[_0x41aa('0x26')],'exitAt':null}});}})[_0x41aa('0x13')](function(_0x1f6315){if(_0x40aba8){if(_0x1f6315&&_0x1f6315['length']){var _0x4b3703=[];_0x1f6315[_0x41aa('0x2b')](function(_0x447937){_0x4b3703[_0x41aa('0x2c')](_0x447937[_0x41aa('0x24')]({'exitAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e'))}));});return BPromise[_0x41aa('0x43')](_0x4b3703);}}})[_0x41aa('0x13')](function(){if(_0x40aba8){var _0x135667=[];var _0x568215=[];var _0x5d2bbe=utils['getChannels']();var _0x1fb661={'membername':_0x40aba8[_0x41aa('0x26')],'interface':_0x130260,'enterAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e')),'role':_0x40aba8[_0x41aa('0x1d')],'internal':_0x40aba8[_0x41aa('0x1e')]};_0x5d2bbe[_0x41aa('0x2b')](function(_0xa0fde4){_0x135667[_0x41aa('0x2c')](_[_0x41aa('0x52')]({'channel':_0xa0fde4,'type':_0x41aa('0x53'),'data1':_0x41aa('0x54'),'data2':_0x130260},_0x1fb661));if(_0x40aba8[_0x41aa('0x55')]){_0x568215[_0x41aa('0x2c')](_[_0x41aa('0x52')]({'channel':_0xa0fde4,'type':_0x41aa('0x27'),'data1':_0x41aa('0x56')},_0x1fb661));}});return db['MemberReport']['bulkCreate'](_0x135667[_0x41aa('0x57')](_0x568215),{'individualHooks':!![]});}})[_0x41aa('0x13')](function(){if(_0x40aba8){return _0x40aba8[_0x41aa('0x24')]({'online':!![],'lastLoginAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e')),'voicePause':_0x40aba8[_0x41aa('0x55')]||![],'mailPause':_0x40aba8[_0x41aa('0x55')]||![],'chatPause':_0x40aba8['loginInPause']||![],'faxPause':_0x40aba8[_0x41aa('0x55')]||![],'smsPause':_0x40aba8[_0x41aa('0x55')]||![],'openchannelPause':_0x40aba8[_0x41aa('0x55')]||![],'pauseType':_0x40aba8['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x41aa('0x2e')),'interface':_0x130260});}})['then'](function(_0x220817){_0x383730(_0x220817);})[_0x41aa('0x16')](function(_0x25bfc2){_0x3464c5(_0x158009[_0x41aa('0x17')](0x1f4,_0x25bfc2[_0x41aa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ef91794..b17fedd 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 _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 +var _0x1cbf=['remove','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x16c0c2,_0x3f7818){var _0x5c1442=function(_0x131d92){while(--_0x131d92){_0x16c0c2['push'](_0x16c0c2['shift']());}};_0x5c1442(++_0x3f7818);}(_0x1cbf,0xce));var _0xf1cb=function(_0x324edb,_0x8f30fd){_0x324edb=_0x324edb-0x0;var _0x231778=_0x1cbf[_0x324edb];return _0x231778;};'use strict';var UserEvents=require(_0xf1cb('0x0'));var events=[_0xf1cb('0x1'),_0xf1cb('0x2'),'update'];function createListener(_0x5160d,_0x216e1a){return function(_0x224ec3){_0x216e1a[_0xf1cb('0x3')](_0x5160d,_0x224ec3);};}function removeListener(_0x2f5728,_0x2e5009){return function(){UserEvents[_0xf1cb('0x4')](_0x2f5728,_0x2e5009);};}exports[_0xf1cb('0x5')]=function(_0x288d0a){for(var _0x196870=0x0,_0x4762e6=events[_0xf1cb('0x6')];_0x196870<_0x4762e6;_0x196870++){var _0x2375d6=events[_0x196870];var _0x248f72=createListener(_0xf1cb('0x7')+_0x2375d6,_0x288d0a);UserEvents['on'](_0x2375d6,_0x248f72);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7016f64..89df883 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 _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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3c4d2a,_0x1e5816){var _0x596a0b=function(_0x1ace1c){while(--_0x1ace1c){_0x3c4d2a['push'](_0x3c4d2a['shift']());}};_0x596a0b(++_0x1e5816);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7a4f525..bf5c538 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 _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 +var _0x6631=['exports','INTEGER','sequelize'];(function(_0x30fb13,_0x19860d){var _0x26f7d4=function(_0x4859b8){while(--_0x4859b8){_0x30fb13['push'](_0x30fb13['shift']());}};_0x26f7d4(++_0x19860d);}(_0x6631,0x134));var _0x1663=function(_0x27e2b8,_0x48b167){_0x27e2b8=_0x27e2b8-0x0;var _0x2201e0=_0x6631[_0x27e2b8];return _0x2201e0;};'use strict';var Sequelize=require(_0x1663('0x0'));module[_0x1663('0x1')]={'penalty':{'type':Sequelize[_0x1663('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index e225a07..c33ef51 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 _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 +var _0xe8e9=['exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe8e9,0x13b));var _0x9e8e=function(_0x5a20ee,_0x1172e4){_0x5a20ee=_0x5a20ee-0x0;var _0x407879=_0xe8e9[_0x5a20ee];return _0x407879;};'use strict';var _=require(_0x9e8e('0x0'));var util=require(_0x9e8e('0x1'));var logger=require(_0x9e8e('0x2'))('api');var moment=require(_0x9e8e('0x3'));var BPromise=require(_0x9e8e('0x4'));var rp=require(_0x9e8e('0x5'));var fs=require('fs');var path=require(_0x9e8e('0x6'));var rimraf=require(_0x9e8e('0x7'));var config=require(_0x9e8e('0x8'));var attributes=require(_0x9e8e('0x9'));module[_0x9e8e('0xa')]=function(_0x1b951b,_0x3bf779){return _0x1b951b['define'](_0x9e8e('0xb'),attributes,{'tableName':_0x9e8e('0xc'),'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 cb07d84..155c977 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 _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 +var _0x9b6a=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x7f7364,_0x59e59a){var _0x2271ab=function(_0x3591cb){while(--_0x3591cb){_0x7f7364['push'](_0x7f7364['shift']());}};_0x2271ab(++_0x59e59a);}(_0x9b6a,0xe7));var _0xa9b6=function(_0x1f8ec0,_0x933b58){_0x1f8ec0=_0x1f8ec0-0x0;var _0x5f4c0e=_0x9b6a[_0x1f8ec0];return _0x5f4c0e;};'use strict';var _=require('lodash');var util=require(_0xa9b6('0x0'));var moment=require(_0xa9b6('0x1'));var BPromise=require(_0xa9b6('0x2'));var rs=require(_0xa9b6('0x3'));var fs=require('fs');var Redis=require(_0xa9b6('0x4'));var db=require(_0xa9b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9b6('0x6'));var config=require(_0xa9b6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51a85c,_0x19b233,_0x943549){return new BPromise(function(_0x2bfbb1,_0x3fb0b6){return client['request'](_0x51a85c,_0x943549)['then'](function(_0x12ee4f){logger[_0xa9b6('0x9')](_0xa9b6('0xa'),_0x19b233,_0xa9b6('0xb'));logger[_0xa9b6('0xc')](_0xa9b6('0xd'),_0x19b233,_0xa9b6('0xb'),JSON[_0xa9b6('0xe')](_0x12ee4f));if(_0x12ee4f['error']){if(_0x12ee4f[_0xa9b6('0xf')][_0xa9b6('0x10')]===0x1f4){logger[_0xa9b6('0xf')](_0xa9b6('0xa'),_0x19b233,_0x12ee4f[_0xa9b6('0xf')]['message']);return _0x3fb0b6(_0x12ee4f[_0xa9b6('0xf')]['message']);}logger['error'](_0xa9b6('0xa'),_0x19b233,_0x12ee4f[_0xa9b6('0xf')]['message']);return _0x2bfbb1(_0x12ee4f[_0xa9b6('0xf')][_0xa9b6('0x11')]);}else{logger['info'](_0xa9b6('0xa'),_0x19b233,_0xa9b6('0xb'));_0x2bfbb1(_0x12ee4f['result'][_0xa9b6('0x11')]);}})['catch'](function(_0x2cf42f){logger[_0xa9b6('0xf')](_0xa9b6('0xa'),_0x19b233,_0x2cf42f);_0x3fb0b6(_0x2cf42f);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fd7a42f..b38044d 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 _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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x20927b,_0x308bbf){var _0x1f1de0=function(_0x963c89){while(--_0x963c89){_0x20927b['push'](_0x20927b['shift']());}};_0x1f1de0(++_0x308bbf);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 029375c..9a969cf 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 _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 +var _0x6227=['INTEGER','exports'];(function(_0x886b04,_0x4598b3){var _0x18e6c2=function(_0x460dd5){while(--_0x460dd5){_0x886b04['push'](_0x886b04['shift']());}};_0x18e6c2(++_0x4598b3);}(_0x6227,0xe9));var _0x7622=function(_0x3697ed,_0x5dcf33){_0x3697ed=_0x3697ed-0x0;var _0x5196f8=_0x6227[_0x3697ed];return _0x5196f8;};'use strict';var Sequelize=require('sequelize');module[_0x7622('0x0')]={'penalty':{'type':Sequelize[_0x7622('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9c8aaeb..7865d12 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 _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 +var _0x5c4b=['user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x420fc1,_0x4d1d8d){var _0x50b8d6=function(_0x4360ff){while(--_0x4360ff){_0x420fc1['push'](_0x420fc1['shift']());}};_0x50b8d6(++_0x4d1d8d);}(_0x5c4b,0x112));var _0xb5c4=function(_0x1f8210,_0x3e15af){_0x1f8210=_0x1f8210-0x0;var _0x13cca6=_0x5c4b[_0x1f8210];return _0x13cca6;};'use strict';var _=require(_0xb5c4('0x0'));var util=require(_0xb5c4('0x1'));var logger=require(_0xb5c4('0x2'))(_0xb5c4('0x3'));var moment=require('moment');var BPromise=require(_0xb5c4('0x4'));var rp=require(_0xb5c4('0x5'));var fs=require('fs');var path=require(_0xb5c4('0x6'));var rimraf=require(_0xb5c4('0x7'));var config=require(_0xb5c4('0x8'));var attributes=require(_0xb5c4('0x9'));module[_0xb5c4('0xa')]=function(_0x31f669,_0x3ef850){return _0x31f669[_0xb5c4('0xb')]('UserFaxQueue',attributes,{'tableName':_0xb5c4('0xc'),'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 7a5979f..4c0bb70 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 _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 +var _0x273d=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x463f91,_0x26ec38){var _0x552e15=function(_0x1fae37){while(--_0x1fae37){_0x463f91['push'](_0x463f91['shift']());}};_0x552e15(++_0x26ec38);}(_0x273d,0x149));var _0xd273=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x273d[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xd273('0x0'));var util=require('util');var moment=require(_0xd273('0x1'));var BPromise=require(_0xd273('0x2'));var rs=require(_0xd273('0x3'));var fs=require('fs');var Redis=require(_0xd273('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd273('0x5'));var logger=require(_0xd273('0x6'))('rpc');var config=require(_0xd273('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd273('0x8')][_0xd273('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13e25d,_0x3f18a3,_0x1295a4){return new BPromise(function(_0x32cf20,_0x490484){return client[_0xd273('0xa')](_0x13e25d,_0x1295a4)[_0xd273('0xb')](function(_0x329b71){logger[_0xd273('0xc')](_0xd273('0xd'),_0x3f18a3,_0xd273('0xe'));logger[_0xd273('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3f18a3,_0xd273('0xe'),JSON[_0xd273('0x10')](_0x329b71));if(_0x329b71['error']){if(_0x329b71[_0xd273('0x11')][_0xd273('0x12')]===0x1f4){logger['error'](_0xd273('0xd'),_0x3f18a3,_0x329b71['error'][_0xd273('0x13')]);return _0x490484(_0x329b71['error'][_0xd273('0x13')]);}logger[_0xd273('0x11')](_0xd273('0xd'),_0x3f18a3,_0x329b71[_0xd273('0x11')][_0xd273('0x13')]);return _0x32cf20(_0x329b71[_0xd273('0x11')][_0xd273('0x13')]);}else{logger[_0xd273('0xc')](_0xd273('0xd'),_0x3f18a3,_0xd273('0xe'));_0x32cf20(_0x329b71[_0xd273('0x14')][_0xd273('0x13')]);}})[_0xd273('0x15')](function(_0x54b964){logger[_0xd273('0x11')](_0xd273('0xd'),_0x3f18a3,_0x54b964);_0x490484(_0x54b964);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6f9b19d..285ab89 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 _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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4b238e,_0x26e123){var _0x420380=function(_0x307bc2){while(--_0x307bc2){_0x4b238e['push'](_0x4b238e['shift']());}};_0x420380(++_0x26e123);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xcb91[_0x3e2fcf];return _0x497db7;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 678030e..9006424 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 _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 +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 1f4361d..4867b73 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 _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 +var _0x632f=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x29231b,_0x30c95f){var _0xb65c00=function(_0x50e904){while(--_0x50e904){_0x29231b['push'](_0x29231b['shift']());}};_0xb65c00(++_0x30c95f);}(_0x632f,0xdc));var _0xf632=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x632f[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xf632('0x0'));var util=require('util');var logger=require(_0xf632('0x1'))(_0xf632('0x2'));var moment=require(_0xf632('0x3'));var BPromise=require(_0xf632('0x4'));var rp=require(_0xf632('0x5'));var fs=require('fs');var path=require(_0xf632('0x6'));var rimraf=require('rimraf');var config=require(_0xf632('0x7'));var attributes=require(_0xf632('0x8'));module[_0xf632('0x9')]=function(_0x17574e,_0x128686){return _0x17574e[_0xf632('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 def8634..1b35b15 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 _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 +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x4dacd1,_0x498edb){var _0xe4321f=function(_0x5dd9c0){while(--_0x5dd9c0){_0x4dacd1['push'](_0x4dacd1['shift']());}};_0xe4321f(++_0x498edb);}(_0xe14b,0x93));var _0xbe14=function(_0x1ca840,_0x4acf63){_0x1ca840=_0x1ca840-0x0;var _0x240aae=_0xe14b[_0x1ca840];return _0x240aae;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 0fecc32..aa7a770 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 _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 +var _0x097f=['express','fs-extra','../../components/auth/service','./userNotification.controller','post','isAuthenticated','exports','util','path','connect-timeout'];(function(_0x407071,_0x491886){var _0x53fcd7=function(_0x146279){while(--_0x146279){_0x407071['push'](_0x407071['shift']());}};_0x53fcd7(++_0x491886);}(_0x097f,0xc5));var _0xf097=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x097f[_0x55ff79];return _0x579067;};'use strict';var multer=require('multer');var util=require(_0xf097('0x0'));var path=require(_0xf097('0x1'));var timeout=require(_0xf097('0x2'));var express=require(_0xf097('0x3'));var router=express['Router']();var fs_extra=require(_0xf097('0x4'));var auth=require(_0xf097('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf097('0x6'));router[_0xf097('0x7')]('/',auth[_0xf097('0x8')](),controller['sendUserNotification']);module[_0xf097('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 5323918..7d1fed0 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 _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 +var _0x9aae=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1a8f15,_0x3711af){var _0x76f217=function(_0x188900){while(--_0x188900){_0x1a8f15['push'](_0x1a8f15['shift']());}};_0x76f217(++_0x3711af);}(_0x9aae,0x108));var _0xe9aa=function(_0xe00662,_0x51cf75){_0xe00662=_0xe00662-0x0;var _0x5ebbd8=_0x9aae[_0xe00662];return _0x5ebbd8;};'use strict';var Sequelize=require(_0xe9aa('0x0'));module[_0xe9aa('0x1')]={'body':{'type':Sequelize[_0xe9aa('0x2')]},'senderName':{'type':Sequelize[_0xe9aa('0x3')]},'recipientsId':{'type':Sequelize[_0xe9aa('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe9aa('0x3')]},'beep':{'type':Sequelize[_0xe9aa('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d7e7d02..40c998e 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 _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 +var _0x0df0=['json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','queue','Queue','ids','push','all','findOne','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end'];(function(_0x4467dc,_0x10d02e){var _0x41f03f=function(_0x315638){while(--_0x315638){_0x4467dc['push'](_0x4467dc['shift']());}};_0x41f03f(++_0x10d02e);}(_0x0df0,0x1d0));var _0x00df=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x0df0[_0x36da00];return _0x4b72c5;};'use strict';var emlformat=require(_0x00df('0x0'));var rimraf=require(_0x00df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00df('0x2'));var rp=require(_0x00df('0x3'));var moment=require('moment');var BPromise=require(_0x00df('0x4'));var Mustache=require(_0x00df('0x5'));var util=require(_0x00df('0x6'));var path=require(_0x00df('0x7'));var sox=require(_0x00df('0x8'));var csv=require('to-csv');var ejs=require(_0x00df('0x9'));var fs=require('fs');var fs_extra=require(_0x00df('0xa'));var _=require(_0x00df('0xb'));var squel=require(_0x00df('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x00df('0xd'));var toCsv=require(_0x00df('0xe'));var querystring=require(_0x00df('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x00df('0x10'));var qs=require(_0x00df('0x11'));var as=require(_0x00df('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00df('0x13'))(_0x00df('0x14'));var utils=require(_0x00df('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x00df('0x16'))['db'];config[_0x00df('0x17')]=_[_0x00df('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x00df('0x19'))(new Redis(config[_0x00df('0x17')]));require(_0x00df('0x1a'))[_0x00df('0x1b')](socket);function respondWithStatusCode(_0x57231c,_0x21264b){_0x21264b=_0x21264b||0xcc;return function(_0x59fcfc){if(_0x59fcfc){return _0x57231c[_0x00df('0x1c')](_0x21264b);}return _0x57231c[_0x00df('0x1d')](_0x21264b)[_0x00df('0x1e')]();};}function respondWithResult(_0x1b5ed1,_0x5941fb){_0x5941fb=_0x5941fb||0xc8;return function(_0x114a61){if(_0x114a61){return _0x1b5ed1[_0x00df('0x1d')](_0x5941fb)[_0x00df('0x1f')](_0x114a61);}};}function respondWithFilteredResult(_0x1ce2be,_0x308e02){return function(_0xba48f5){if(_0xba48f5){var _0x2a45bf=typeof _0x308e02['offset']===_0x00df('0x20')&&typeof _0x308e02[_0x00df('0x21')]===_0x00df('0x20');var _0x446295=_0xba48f5[_0x00df('0x22')];var _0x524e49=_0x2a45bf?0x0:_0x308e02['offset'];var _0x26986d=_0x2a45bf?_0xba48f5[_0x00df('0x22')]:_0x308e02[_0x00df('0x23')]+_0x308e02[_0x00df('0x21')];var _0x4b44d5;if(_0x26986d>=_0x446295){_0x26986d=_0x446295;_0x4b44d5=0xc8;}else{_0x4b44d5=0xce;}_0x1ce2be[_0x00df('0x1d')](_0x4b44d5);return _0x1ce2be[_0x00df('0x24')](_0x00df('0x25'),_0x524e49+'-'+_0x26986d+'/'+_0x446295)[_0x00df('0x1f')](_0xba48f5);}return null;};}function patchUpdates(_0x545c8b){return function(_0x95d033){try{jsonpatch[_0x00df('0x26')](_0x95d033,_0x545c8b,!![]);}catch(_0x2f46fd){return BPromise['reject'](_0x2f46fd);}return _0x95d033[_0x00df('0x27')]();};}function saveUpdates(_0xcbdd0c,_0x20289e){return function(_0x499fba){if(_0x499fba){return _0x499fba[_0x00df('0x28')](_0xcbdd0c)['then'](function(_0x183f70){return _0x183f70;});}return null;};}function removeEntity(_0xd0632c,_0x34eed0){return function(_0x1e4121){if(_0x1e4121){return _0x1e4121[_0x00df('0x29')]()[_0x00df('0x2a')](function(){_0xd0632c[_0x00df('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ce97f,_0x254001){return function(_0x55624b){if(!_0x55624b){_0x3ce97f[_0x00df('0x1c')](0x194);}return _0x55624b;};}function handleError(_0x1a186a,_0x451605){_0x451605=_0x451605||0x1f4;return function(_0x3a9b8a){logger[_0x00df('0x2b')](_0x3a9b8a[_0x00df('0x2c')]);if(_0x3a9b8a[_0x00df('0x2d')]){delete _0x3a9b8a[_0x00df('0x2d')];}_0x1a186a[_0x00df('0x1d')](_0x451605)[_0x00df('0x2e')](_0x3a9b8a);};}exports[_0x00df('0x2f')]=function(_0x1375fe,_0x506a33,_0x5c1d3a){if(!_0x1375fe['body'][_0x00df('0x30')]('text')&&!_0x1375fe[_0x00df('0x31')][_0x00df('0x30')](_0x00df('0x32'))){throw new db['Sequelize'][(_0x00df('0x33'))](_0x00df('0x34'));}else{if(_0x1375fe[_0x00df('0x31')][_0x00df('0x30')](_0x00df('0x32'))&&!_0x1375fe['body'][_0x00df('0x30')](_0x00df('0x35'))){throw new db['Sequelize'][(_0x00df('0x33'))](_0x00df('0x36'));}if(!_0x1375fe['body'][_0x00df('0x30')](_0x00df('0x37'))){throw new db[(_0x00df('0x38'))]['ValidationError'](_0x00df('0x39'));}else{try{var _0x5607aa=JSON[_0x00df('0x3a')](_0x1375fe[_0x00df('0x31')]['recipients']);}catch(_0x4171d3){logger[_0x00df('0x2b')](_0x4171d3);throw new db[(_0x00df('0x38'))][(_0x00df('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x1b4dcd=[_0x00df('0x3b'),_0x00df('0x3c'),_0x00df('0x3d'),_0x00df('0x3e'),'smsqueue','voicequeue',_0x00df('0x3f'),_0x00df('0x40'),_0x00df('0x41')];if(_[_0x00df('0x42')](_0x5607aa,function(_0x201b74){return!_[_0x00df('0x43')](_0x1b4dcd,_0x201b74[_0x00df('0x44')][_0x00df('0x45')]());})){throw new db[(_0x00df('0x38'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5cd46f={};_0x5cd46f[_0x00df('0x46')]=_0x1375fe['body'][_0x00df('0x30')]('senderName')?_0x1375fe['body'][_0x00df('0x46')]:_0x1375fe[_0x00df('0x41')]['fullname'];_0x5cd46f[_0x00df('0x47')]=_[_0x00df('0x48')](_0x1375fe[_0x00df('0x31')][_0x00df('0x47')])?null:_0x1375fe[_0x00df('0x31')]['recipientsDescription'];_0x5cd46f[_0x00df('0x49')]=_0x1375fe[_0x00df('0x31')]['beep']||![];_0x5cd46f[_0x00df('0x4a')]=_0x1375fe[_0x00df('0x41')]['id'];return getContent(_0x1375fe['body'])[_0x00df('0x2a')](function(_0x53fd2c){_0x5cd46f[_0x00df('0x31')]=_0x53fd2c;return getRecipients(_0x5607aa);})[_0x00df('0x2a')](function(_0x27dda5){_0x5cd46f[_0x00df('0x4b')]=_[_0x00df('0x4c')](_0x27dda5)[_0x00df('0x4d')](',');return db[_0x00df('0x4e')][_0x00df('0x4f')](function(_0x4abb3c){return db[_0x00df('0x50')]['create'](_0x5cd46f,{'raw':!![],'transaction':_0x4abb3c})[_0x00df('0x2a')](function(_0x5747f8){var _0x433fb2={'sender':_0x5cd46f[_0x00df('0x46')],'description':_0x5cd46f[_0x00df('0x47')],'content':_0x5cd46f[_0x00df('0x31')],'beep':_0x5cd46f[_0x00df('0x49')]};_0x27dda5['forEach'](function(_0x36d19c){_0x433fb2[_0x00df('0x51')]=_0x36d19c;socket[_0x00df('0x52')](_0x00df('0x53'),_0x433fb2);});return _0x5747f8;});});})['then'](respondWithResult(_0x506a33,0xc9))[_0x00df('0x54')](handleError(_0x506a33,null));};function getContent(_0x5e88e3){return new BPromise(function(_0xbd8913,_0x35517d){if(_0x5e88e3[_0x00df('0x55')]){_0xbd8913(_0x5e88e3[_0x00df('0x55')]);return;}return db[_0x00df('0x56')]['findOne']({'attributes':[_0x00df('0x57')],'where':{'id':_0x5e88e3[_0x00df('0x32')]},'raw':!![]})[_0x00df('0x2a')](function(_0x12e439){if(!_0x12e439)throw new db[(_0x00df('0x38'))][(_0x00df('0x33'))](_0x00df('0x58'));var _0x163c60=Mustache[_0x00df('0x59')](_0x12e439[_0x00df('0x57')],_0x5e88e3[_0x00df('0x35')]);_0xbd8913(_0x163c60);})[_0x00df('0x54')](function(_0x4184fc){_0x35517d(_0x4184fc);});});}function getRecipients(_0x54f5b6){return new BPromise(function(_0x23b055,_0x2f02ae){var _0x2fee48=[];var _0x33cf48=[];_0x54f5b6[_0x00df('0x5a')](function(_0x1592a6){var _0x6b8277=_[_0x00df('0x5b')](_0x1592a6[_0x00df('0x44')]['toLowerCase']());if(_0x6b8277==='User'){_0x2fee48=_['union'](_0x2fee48,_0x1592a6['ids']);}else{if(_[_0x00df('0x43')](_0x6b8277,_0x00df('0x5c')))_0x6b8277=_0x6b8277['replace'](_0x00df('0x5c'),_0x00df('0x5d'));_0x1592a6[_0x00df('0x5e')][_0x00df('0x5a')](function(_0x460b4d){_0x33cf48[_0x00df('0x5f')](getAgents(_0x6b8277,_0x460b4d));});}});return BPromise[_0x00df('0x60')](_0x33cf48)[_0x00df('0x2a')](function(_0x3d6304){_0x2fee48=_['union'](_0x2fee48,_['flatten'](_0x3d6304));_0x23b055(_0x2fee48);})[_0x00df('0x54')](function(_0x49f7b9){_0x2f02ae(_0x49f7b9);});});}function getAgents(_0x3bc661,_0x28eafd){return new BPromise(function(_0x46c73d,_0x4160ec){return db[_0x3bc661][_0x00df('0x61')]({'where':{'id':_0x28eafd}})[_0x00df('0x2a')](function(_0x3e7676){return _0x3e7676['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x2ebe18){var _0x53cc92=_[_0x00df('0x62')](_0x2ebe18,'id');_0x46c73d(_0x53cc92);});})[_0x00df('0x54')](function(_0x102363){_0x4160ec(_0x102363);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9be24c9..f82de62 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 _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 +var _0x8149=['hasOwnProperty','exports','events','../../mysqldb','UserNotification','save','update','remove','emit'];(function(_0x24d77f,_0x68202b){var _0x1c2063=function(_0x220c98){while(--_0x220c98){_0x24d77f['push'](_0x24d77f['shift']());}};_0x1c2063(++_0x68202b);}(_0x8149,0x107));var _0x9814=function(_0x59f2db,_0x1f935f){_0x59f2db=_0x59f2db-0x0;var _0x5ba49f=_0x8149[_0x59f2db];return _0x5ba49f;};'use strict';var EventEmitter=require(_0x9814('0x0'));var UserNotification=require(_0x9814('0x1'))['db'][_0x9814('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9814('0x3'),'afterUpdate':_0x9814('0x4'),'afterDestroy':_0x9814('0x5')};function emitEvent(_0x33b265){return function(_0x4380e9,_0x4d23a0,_0x26de8){UserNotificationEvents[_0x9814('0x6')](_0x33b265+':'+_0x4380e9['id'],_0x4380e9);UserNotificationEvents['emit'](_0x33b265,_0x4380e9);_0x26de8(null);};}for(var e in events){if(events[_0x9814('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9814('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f477cbd..7de6fb0 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 _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 +var _0x240e=['util','../../config/logger','api','moment','bluebird','request-promise','path','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x18de46,_0x15e5fe){var _0x1546d7=function(_0x58ab66){while(--_0x58ab66){_0x18de46['push'](_0x18de46['shift']());}};_0x1546d7(++_0x15e5fe);}(_0x240e,0x12b));var _0xe240=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x240e[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0xe240('0x0'));var logger=require(_0xe240('0x1'))(_0xe240('0x2'));var moment=require(_0xe240('0x3'));var BPromise=require(_0xe240('0x4'));var rp=require(_0xe240('0x5'));var fs=require('fs');var path=require(_0xe240('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe240('0x7'));module[_0xe240('0x8')]=function(_0x390b9d,_0x1cf75){return _0x390b9d[_0xe240('0x9')]('UserNotification',attributes,{'tableName':_0xe240('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe240('0xb'),'collate':_0xe240('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 5453bea..da5d210 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 _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 +var _0x9802=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x3f9320,_0x3c85d9){var _0x31b557=function(_0x2d3125){while(--_0x2d3125){_0x3f9320['push'](_0x3f9320['shift']());}};_0x31b557(++_0x3c85d9);}(_0x9802,0x9d));var _0x2980=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x9802[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x2980('0x0'));var util=require(_0x2980('0x1'));var moment=require(_0x2980('0x2'));var BPromise=require(_0x2980('0x3'));var rs=require(_0x2980('0x4'));var fs=require('fs');var Redis=require(_0x2980('0x5'));var db=require(_0x2980('0x6'))['db'];var utils=require(_0x2980('0x7'));var logger=require(_0x2980('0x8'))(_0x2980('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2980('0xa')][_0x2980('0xb')]({'port':0x232a});config[_0x2980('0xc')]=_[_0x2980('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2980('0xe'))(new Redis(config[_0x2980('0xc')]));require(_0x2980('0xf'))[_0x2980('0x10')](socket);function respondWithRpcPromise(_0x279bf8,_0x213418,_0x349d85){return new BPromise(function(_0x299b8c,_0x9b59f1){return client[_0x2980('0x11')](_0x279bf8,_0x349d85)[_0x2980('0x12')](function(_0x1f3255){logger['info'](_0x2980('0x13'),_0x213418,_0x2980('0x14'));logger[_0x2980('0x15')](_0x2980('0x16'),_0x213418,_0x2980('0x14'),JSON[_0x2980('0x17')](_0x1f3255));if(_0x1f3255[_0x2980('0x18')]){if(_0x1f3255[_0x2980('0x18')][_0x2980('0x19')]===0x1f4){logger[_0x2980('0x18')]('UserNotification,\x20%s,\x20%s',_0x213418,_0x1f3255[_0x2980('0x18')][_0x2980('0x1a')]);return _0x9b59f1(_0x1f3255[_0x2980('0x18')]['message']);}logger['error'](_0x2980('0x13'),_0x213418,_0x1f3255['error'][_0x2980('0x1a')]);return _0x299b8c(_0x1f3255[_0x2980('0x18')][_0x2980('0x1a')]);}else{logger[_0x2980('0x1b')](_0x2980('0x13'),_0x213418,_0x2980('0x14'));_0x299b8c(_0x1f3255[_0x2980('0x1c')]['message']);}})[_0x2980('0x1d')](function(_0x1fcd47){logger[_0x2980('0x18')](_0x2980('0x13'),_0x213418,_0x1fcd47);_0x9b59f1(_0x1fcd47);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index b011e9e..18bc304 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 _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 +var _0x78e1=['length','userNotification:','./userNotification.events','save','update','removeListener','register'];(function(_0x349823,_0x380ae9){var _0x3ce632=function(_0x111988){while(--_0x111988){_0x349823['push'](_0x349823['shift']());}};_0x3ce632(++_0x380ae9);}(_0x78e1,0x11a));var _0x178e=function(_0x1c7167,_0xf0d493){_0x1c7167=_0x1c7167-0x0;var _0xe332e2=_0x78e1[_0x1c7167];return _0xe332e2;};'use strict';var UserNotificationEvents=require(_0x178e('0x0'));var events=[_0x178e('0x1'),'remove',_0x178e('0x2')];function createListener(_0x981f23,_0x196d35){return function(_0x21cb86){_0x196d35['emit'](_0x981f23,_0x21cb86);};}function removeListener(_0x2efa28,_0x4fbe61){return function(){UserNotificationEvents[_0x178e('0x3')](_0x2efa28,_0x4fbe61);};}exports[_0x178e('0x4')]=function(_0x365395){for(var _0x5e3853=0x0,_0x14c928=events[_0x178e('0x5')];_0x5e3853<_0x14c928;_0x5e3853++){var _0x7f9c9a=events[_0x5e3853];var _0x5da1c5=createListener(_0x178e('0x6')+_0x7f9c9a,_0x365395);UserNotificationEvents['on'](_0x7f9c9a,_0x5da1c5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cce3508..c905121 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(_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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf32355,_0xd4d4a){var _0x5ce960=function(_0x48ebee){while(--_0x48ebee){_0xf32355['push'](_0xf32355['shift']());}};_0x5ce960(++_0xd4d4a);}(_0x70e0,0x17b));var _0x070e=function(_0x2c7e33,_0x303e50){_0x2c7e33=_0x2c7e33-0x0;var _0x430158=_0x70e0[_0x2c7e33];return _0x430158;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index be21abb..6a48f1c 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 _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 +var _0xef6d=['exports','INTEGER'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xef6d,0x12c));var _0xdef6=function(_0x28ac78,_0x4c9641){_0x28ac78=_0x28ac78-0x0;var _0x55227f=_0xef6d[_0x28ac78];return _0x55227f;};'use strict';var Sequelize=require('sequelize');module[_0xdef6('0x0')]={'penalty':{'type':Sequelize[_0xdef6('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index de9e5f7..eff5b34 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 _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 +var _0x186e=['request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','api','moment','bluebird'];(function(_0xa385fe,_0x311337){var _0x8f16a3=function(_0x2f75d3){while(--_0x2f75d3){_0xa385fe['push'](_0xa385fe['shift']());}};_0x8f16a3(++_0x311337);}(_0x186e,0x128));var _0xe186=function(_0x2643a1,_0x47a4a3){_0x2643a1=_0x2643a1-0x0;var _0x57e909=_0x186e[_0x2643a1];return _0x57e909;};'use strict';var _=require('lodash');var util=require(_0xe186('0x0'));var logger=require('../../config/logger')(_0xe186('0x1'));var moment=require(_0xe186('0x2'));var BPromise=require(_0xe186('0x3'));var rp=require(_0xe186('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe186('0x5'));var config=require(_0xe186('0x6'));var attributes=require(_0xe186('0x7'));module[_0xe186('0x8')]=function(_0x30f7b7,_0x514db3){return _0x30f7b7[_0xe186('0x9')](_0xe186('0xa'),attributes,{'tableName':_0xe186('0xb'),'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 73dacac..6192e79 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 _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 +var _0x92f5=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3203b8,_0x7d5ec8){var _0x2c4512=function(_0x7606c2){while(--_0x7606c2){_0x3203b8['push'](_0x3203b8['shift']());}};_0x2c4512(++_0x7d5ec8);}(_0x92f5,0x8b));var _0x592f=function(_0x4fb955,_0x481977){_0x4fb955=_0x4fb955-0x0;var _0x4f9797=_0x92f5[_0x4fb955];return _0x4f9797;};'use strict';var _=require(_0x592f('0x0'));var util=require(_0x592f('0x1'));var moment=require(_0x592f('0x2'));var BPromise=require(_0x592f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x592f('0x4'));var logger=require(_0x592f('0x5'))('rpc');var config=require(_0x592f('0x6'));var jayson=require(_0x592f('0x7'));var client=jayson[_0x592f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1585dc,_0x183a2f,_0x3e099d){return new BPromise(function(_0x5d5779,_0x245524){return client['request'](_0x1585dc,_0x3e099d)[_0x592f('0x9')](function(_0x160b67){logger['info'](_0x592f('0xa'),_0x183a2f,_0x592f('0xb'));logger['debug'](_0x592f('0xc'),_0x183a2f,_0x592f('0xb'),JSON[_0x592f('0xd')](_0x160b67));if(_0x160b67[_0x592f('0xe')]){if(_0x160b67[_0x592f('0xe')]['code']===0x1f4){logger[_0x592f('0xe')](_0x592f('0xa'),_0x183a2f,_0x160b67[_0x592f('0xe')]['message']);return _0x245524(_0x160b67[_0x592f('0xe')][_0x592f('0xf')]);}logger[_0x592f('0xe')](_0x592f('0xa'),_0x183a2f,_0x160b67[_0x592f('0xe')][_0x592f('0xf')]);return _0x5d5779(_0x160b67[_0x592f('0xe')][_0x592f('0xf')]);}else{logger[_0x592f('0x10')](_0x592f('0xa'),_0x183a2f,_0x592f('0xb'));_0x5d5779(_0x160b67[_0x592f('0x11')][_0x592f('0xf')]);}})[_0x592f('0x12')](function(_0x3256e2){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x183a2f,_0x3256e2);_0x245524(_0x3256e2);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 85d769e..90e5c42 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 _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 +var _0xf3a7=['get','/describe','describe','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index'];(function(_0x73ea6d,_0x57d5bd){var _0x4c3a66=function(_0xb3ffd1){while(--_0xb3ffd1){_0x73ea6d['push'](_0x73ea6d['shift']());}};_0x4c3a66(++_0x57d5bd);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7f3a('0x0'));var path=require(_0x7f3a('0x1'));var timeout=require(_0x7f3a('0x2'));var express=require(_0x7f3a('0x3'));var router=express[_0x7f3a('0x4')]();var fs_extra=require(_0x7f3a('0x5'));var auth=require(_0x7f3a('0x6'));var interaction=require(_0x7f3a('0x7'));var config=require(_0x7f3a('0x8'));var controller=require(_0x7f3a('0x9'));router['get']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xb')]);router[_0x7f3a('0xc')](_0x7f3a('0xd'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xe')]);router[_0x7f3a('0xc')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xf')]);router['get']('/:id/sections',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x10')]);router['get'](_0x7f3a('0x11'),auth['isAuthenticated'](),controller[_0x7f3a('0x12')]);router['post']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x13')]);router[_0x7f3a('0x14')](_0x7f3a('0x15'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x16')]);router[_0x7f3a('0x14')](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller['addSections']);router[_0x7f3a('0x14')]('/:id/resources',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x18')]);router[_0x7f3a('0x19')](_0x7f3a('0x1a'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1b')]);router[_0x7f3a('0x1c')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1d')]);router['delete'](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1e')]);router[_0x7f3a('0x1c')]('/:id/resources',auth['isAuthenticated'](),controller[_0x7f3a('0x1f')]);module[_0x7f3a('0x20')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 90c4514..4121cdc 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 _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 +var _0x54fb=['name','crudPermissions','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x54fb,0x124));var _0xb54f=function(_0x2af3e7,_0x46f551){_0x2af3e7=_0x2af3e7-0x0;var _0xc28eb8=_0x54fb[_0x2af3e7];return _0xc28eb8;};'use strict';var Sequelize=require(_0xb54f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb54f('0x1')],'allowNull':![],'unique':_0xb54f('0x2')},'crudPermissions':{'type':Sequelize[_0xb54f('0x1')],'set':function(_0x1793b1){this['setDataValue'](_0xb54f('0x3'),_0x1793b1?_0x1793b1['join'](''):[]);},'get':function(){return this[_0xb54f('0x4')]('crudPermissions')?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb54f('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a07b316..2f7d9dd 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 _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 +var _0xb39a=['create','clone','omit','createdAt','crudPermissions','body','updatedAt','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','find','describe','addSections','push','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','UserProfile','findAll','rows','catch','show','params','keys','include'];(function(_0xc3cc9e,_0x4cbdab){var _0x8e4267=function(_0x242aca){while(--_0x242aca){_0xc3cc9e['push'](_0xc3cc9e['shift']());}};_0x8e4267(++_0x4cbdab);}(_0xb39a,0x186));var _0xab39=function(_0x466bfd,_0x56f4bb){_0x466bfd=_0x466bfd-0x0;var _0x29293d=_0xb39a[_0x466bfd];return _0x29293d;};'use strict';var emlformat=require(_0xab39('0x0'));var rimraf=require(_0xab39('0x1'));var zipdir=require(_0xab39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab39('0x3'));var moment=require(_0xab39('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab39('0x5'));var util=require(_0xab39('0x6'));var path=require(_0xab39('0x7'));var sox=require('sox');var csv=require(_0xab39('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab39('0x9'));var _=require(_0xab39('0xa'));var squel=require(_0xab39('0xb'));var crypto=require(_0xab39('0xc'));var jsforce=require(_0xab39('0xd'));var deskjs=require(_0xab39('0xe'));var toCsv=require(_0xab39('0x8'));var querystring=require(_0xab39('0xf'));var Papa=require('papaparse');var Redis=require(_0xab39('0x10'));var authService=require(_0xab39('0x11'));var qs=require(_0xab39('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab39('0x13'));var logger=require('../../config/logger')(_0xab39('0x14'));var utils=require(_0xab39('0x15'));var config=require(_0xab39('0x16'));var licenseUtil=require(_0xab39('0x17'));var db=require(_0xab39('0x18'))['db'];config[_0xab39('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xab39('0x1a'))(new Redis(config[_0xab39('0x19')]));require(_0xab39('0x1b'))[_0xab39('0x1c')](socket);function respondWithStatusCode(_0xe4632c,_0x119ec9){_0x119ec9=_0x119ec9||0xcc;return function(_0x55eb01){if(_0x55eb01){return _0xe4632c[_0xab39('0x1d')](_0x119ec9);}return _0xe4632c[_0xab39('0x1e')](_0x119ec9)['end']();};}function respondWithResult(_0x2795ef,_0x29ba4e){_0x29ba4e=_0x29ba4e||0xc8;return function(_0x478f0c){if(_0x478f0c){return _0x2795ef[_0xab39('0x1e')](_0x29ba4e)[_0xab39('0x1f')](_0x478f0c);}};}function respondWithFilteredResult(_0x5212cb,_0x42d4a3){return function(_0x496ed7){if(_0x496ed7){var _0x6805ec=typeof _0x42d4a3['offset']===_0xab39('0x20')&&typeof _0x42d4a3['limit']===_0xab39('0x20');var _0x207ab9=_0x496ed7['count'];var _0x553363=_0x6805ec?0x0:_0x42d4a3['offset'];var _0x2902b4=_0x6805ec?_0x496ed7[_0xab39('0x21')]:_0x42d4a3[_0xab39('0x22')]+_0x42d4a3[_0xab39('0x23')];var _0x30e0f3;if(_0x2902b4>=_0x207ab9){_0x2902b4=_0x207ab9;_0x30e0f3=0xc8;}else{_0x30e0f3=0xce;}_0x5212cb[_0xab39('0x1e')](_0x30e0f3);return _0x5212cb['set'](_0xab39('0x24'),_0x553363+'-'+_0x2902b4+'/'+_0x207ab9)[_0xab39('0x1f')](_0x496ed7);}return null;};}function patchUpdates(_0x5b15ab){return function(_0xa6399c){try{jsonpatch[_0xab39('0x25')](_0xa6399c,_0x5b15ab,!![]);}catch(_0x19e9cf){return BPromise[_0xab39('0x26')](_0x19e9cf);}return _0xa6399c[_0xab39('0x27')]();};}function saveUpdates(_0x468a4e,_0x4c2f07){return function(_0xa0cec2){if(_0xa0cec2){return _0xa0cec2['update'](_0x468a4e)['then'](function(_0x25a690){return _0x25a690;});}return null;};}function removeEntity(_0x5d4feb,_0x43a1d9){return function(_0x5cc585){if(_0x5cc585){return _0x5cc585[_0xab39('0x28')]()[_0xab39('0x29')](function(){_0x5d4feb[_0xab39('0x1e')](0xcc)[_0xab39('0x2a')]();});}};}function handleEntityNotFound(_0x5aeef0,_0x41050f){return function(_0x3e916c){if(!_0x3e916c){_0x5aeef0['sendStatus'](0x194);}return _0x3e916c;};}function handleError(_0x389a3a,_0x3f15a3){_0x3f15a3=_0x3f15a3||0x1f4;return function(_0x47d27b){logger[_0xab39('0x2b')](_0x47d27b[_0xab39('0x2c')]);if(_0x47d27b[_0xab39('0x2d')]){delete _0x47d27b[_0xab39('0x2d')];}_0x389a3a[_0xab39('0x1e')](_0x3f15a3)[_0xab39('0x2e')](_0x47d27b);};}exports[_0xab39('0x2f')]=function(_0x44c86b,_0x33d64b){var _0x50ffb9={},_0x1f07dd={},_0x54c6be={'count':0x0,'rows':[]};var _0x8aebee=_[_0xab39('0x30')](db['UserProfile'][_0xab39('0x31')],function(_0x10b96c){return{'name':_0x10b96c[_0xab39('0x32')],'type':_0x10b96c[_0xab39('0x33')][_0xab39('0x34')]};});_0x1f07dd['model']=_[_0xab39('0x30')](_0x8aebee,_0xab39('0x2d'));_0x1f07dd[_0xab39('0x35')]=_['keys'](_0x44c86b[_0xab39('0x35')]);_0x1f07dd['filters']=_[_0xab39('0x36')](_0x1f07dd[_0xab39('0x37')],_0x1f07dd[_0xab39('0x35')]);_0x50ffb9[_0xab39('0x38')]=_[_0xab39('0x36')](_0x1f07dd['model'],qs[_0xab39('0x39')](_0x44c86b[_0xab39('0x35')][_0xab39('0x39')]));_0x50ffb9[_0xab39('0x38')]=_0x50ffb9[_0xab39('0x38')][_0xab39('0x3a')]?_0x50ffb9[_0xab39('0x38')]:_0x1f07dd[_0xab39('0x37')];if(!_0x44c86b[_0xab39('0x35')]['hasOwnProperty'](_0xab39('0x3b'))){_0x50ffb9[_0xab39('0x23')]=qs[_0xab39('0x23')](_0x44c86b[_0xab39('0x35')]['limit']);_0x50ffb9['offset']=qs[_0xab39('0x22')](_0x44c86b['query'][_0xab39('0x22')]);}_0x50ffb9[_0xab39('0x3c')]=qs['sort'](_0x44c86b[_0xab39('0x35')][_0xab39('0x3d')]);_0x50ffb9[_0xab39('0x3e')]=qs[_0xab39('0x3f')](_[_0xab39('0x40')](_0x44c86b[_0xab39('0x35')],_0x1f07dd[_0xab39('0x3f')]),_0x8aebee);if(_0x44c86b[_0xab39('0x35')][_0xab39('0x41')]){_0x50ffb9['where']=_[_0xab39('0x42')](_0x50ffb9[_0xab39('0x3e')],{'$or':_[_0xab39('0x30')](_0x8aebee,function(_0x3e986e){if(_0x3e986e['type']!==_0xab39('0x43')){var _0x2d8d7c={};_0x2d8d7c[_0x3e986e[_0xab39('0x2d')]]={'$like':'%'+_0x44c86b[_0xab39('0x35')]['filter']+'%'};return _0x2d8d7c;}})});}_0x50ffb9=_[_0xab39('0x42')]({},_0x50ffb9,_0x44c86b[_0xab39('0x44')]);var _0x103aab={'where':_0x50ffb9['where']};return db['UserProfile'][_0xab39('0x21')](_0x103aab)[_0xab39('0x29')](function(_0x5e4599){_0x54c6be[_0xab39('0x21')]=_0x5e4599;if(_0x44c86b[_0xab39('0x35')][_0xab39('0x45')]){_0x50ffb9['include']=[{'all':!![]}];}return db[_0xab39('0x46')][_0xab39('0x47')](_0x50ffb9);})['then'](function(_0x1c9639){_0x54c6be[_0xab39('0x48')]=_0x1c9639;return _0x54c6be;})['then'](respondWithFilteredResult(_0x33d64b,_0x50ffb9))[_0xab39('0x49')](handleError(_0x33d64b,null));};exports[_0xab39('0x4a')]=function(_0x903884,_0x329e94){var _0x22bd95={'raw':![],'where':{'id':_0x903884[_0xab39('0x4b')]['id']}},_0x369bcf={};_0x369bcf[_0xab39('0x37')]=_[_0xab39('0x4c')](db[_0xab39('0x46')][_0xab39('0x31')]);_0x369bcf[_0xab39('0x35')]=_[_0xab39('0x4c')](_0x903884[_0xab39('0x35')]);_0x369bcf[_0xab39('0x3f')]=_['intersection'](_0x369bcf[_0xab39('0x37')],_0x369bcf[_0xab39('0x35')]);_0x22bd95[_0xab39('0x38')]=_[_0xab39('0x36')](_0x369bcf[_0xab39('0x37')],qs[_0xab39('0x39')](_0x903884[_0xab39('0x35')][_0xab39('0x39')]));_0x22bd95[_0xab39('0x38')]=_0x22bd95['attributes'][_0xab39('0x3a')]?_0x22bd95[_0xab39('0x38')]:_0x369bcf[_0xab39('0x37')];if(_0x903884['query'][_0xab39('0x45')]){_0x22bd95[_0xab39('0x4d')]=[{'all':!![]}];}_0x22bd95=_[_0xab39('0x42')]({},_0x22bd95,_0x903884[_0xab39('0x44')]);return db[_0xab39('0x46')]['find'](_0x22bd95)[_0xab39('0x29')](handleEntityNotFound(_0x329e94,null))['then'](respondWithResult(_0x329e94,null))['catch'](handleError(_0x329e94,null));};exports['create']=function(_0x3ee741,_0x41bf80){return db[_0xab39('0x46')][_0xab39('0x4e')](_0x3ee741['body'],{})[_0xab39('0x29')](respondWithResult(_0x41bf80,0xc9))[_0xab39('0x49')](handleError(_0x41bf80,null));};exports[_0xab39('0x4f')]=function(_0x5c0316,_0x296b55){var _0x3e426b={'where':{'id':_0x5c0316[_0xab39('0x4b')]['id']}},_0x54e0a8={};_0x54e0a8[_0xab39('0x37')]=_[_0xab39('0x4c')](db[_0xab39('0x46')][_0xab39('0x31')]);_0x3e426b['attributes']=_[_0xab39('0x36')](_0x54e0a8['model'],qs[_0xab39('0x39')](_0x5c0316[_0xab39('0x35')]['fields']));_0x3e426b[_0xab39('0x38')]=_0x3e426b['attributes']['length']?_0x3e426b[_0xab39('0x38')]:_0x54e0a8[_0xab39('0x37')];if(_0x5c0316[_0xab39('0x35')]['includeAll']){_0x3e426b[_0xab39('0x4d')]=[{'all':!![]}];}_0x3e426b=_['merge']({},_0x3e426b,_0x5c0316[_0xab39('0x44')]);return db[_0xab39('0x46')]['find'](_0x3e426b)[_0xab39('0x29')](handleEntityNotFound(_0x296b55,null))[_0xab39('0x29')](function(_0x3d58f2){if(_0x3d58f2){var _0x42a953=_0x3d58f2['get']({'plain':!![]});_0x42a953=qs[_0xab39('0x50')](_0x42a953,['id',_0xab39('0x51'),'updatedAt',_0xab39('0x52')]);_0x5c0316[_0xab39('0x53')]=_['omit'](_0x5c0316[_0xab39('0x53')],['id','createdAt',_0xab39('0x54')]);return db[_0xab39('0x55')][_0xab39('0x56')](function(_0x392856){return db['UserProfile'][_0xab39('0x4e')](_[_0xab39('0x42')](_0x42a953,_0x5c0316[_0xab39('0x53')]),{'include':_0x5c0316['query'][_0xab39('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x392856})[_0xab39('0x29')](function(_0x223dab){var _0x3b5dc2=_0x223dab[_0xab39('0x57')]({'plain':!![]});return db['UserProfileSection'][_0xab39('0x47')]({'where':{'userProfileId':_0x5c0316['params']['id']},'raw':!![]})['then'](function(_0x5ec1ec){if(_0x5ec1ec){return BPromise[_0xab39('0x58')](_0x5ec1ec,function(_0x22dc2f){return new BPromise(function(_0x400598,_0x33fb06){if(_0x22dc2f[_0xab39('0x59')]===null||_0x22dc2f[_0xab39('0x59')]===0x1)_0x400598(null);return db[_0xab39('0x5a')][_0xab39('0x47')]({'where':{'sectionId':_0x22dc2f['id']},'raw':!![]})[_0xab39('0x29')](function(_0x2429f5){var _0x7c4d3d=_[_0xab39('0x30')](_0x2429f5,function(_0x18e11b){return qs[_0xab39('0x50')](_0x18e11b,['id',_0xab39('0x51'),'updatedAt',_0xab39('0x5b')]);});_0x400598(_0x7c4d3d);})['catch'](function(_0x571a2c){_0x33fb06(_0x571a2c);});})[_0xab39('0x29')](function(_0x31401d){var _0x402a49=qs['omit'](_0x22dc2f,['id',_0xab39('0x51'),_0xab39('0x54')]);_0x402a49[_0xab39('0x5c')]=_0x3b5dc2['id'];if(_0x31401d)_0x402a49[_0xab39('0x5d')]=_0x31401d;return _0x402a49;})[_0xab39('0x29')](function(_0x38b15f){return db[_0xab39('0x5e')][_0xab39('0x4e')](_0x38b15f,{'include':[{'model':db[_0xab39('0x5a')],'as':_0xab39('0x5d')}],'raw':!![],'transaction':_0x392856});});})['then'](function(){return _0x3b5dc2;});}});});});}})[_0xab39('0x29')](respondWithResult(_0x296b55,0xc9))[_0xab39('0x49')](handleError(_0x296b55,null));};exports[_0xab39('0x5f')]=function(_0xea4858,_0xe7ff01){if(_0xea4858[_0xab39('0x53')]['id']){delete _0xea4858[_0xab39('0x53')]['id'];}return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0xea4858[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](handleEntityNotFound(_0xe7ff01,null))['then'](saveUpdates(_0xea4858[_0xab39('0x53')],null))[_0xab39('0x29')](respondWithResult(_0xe7ff01,null))[_0xab39('0x49')](handleError(_0xe7ff01,null));};exports[_0xab39('0x28')]=function(_0x4bfedb,_0x4e7368){return db['UserProfile'][_0xab39('0x60')]({'where':{'id':_0x4bfedb[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](handleEntityNotFound(_0x4e7368,null))[_0xab39('0x29')](removeEntity(_0x4e7368,null))['catch'](handleError(_0x4e7368,null));};exports[_0xab39('0x61')]=function(_0x4864c1,_0x2b6c58){return db[_0xab39('0x46')][_0xab39('0x61')]()[_0xab39('0x29')](respondWithResult(_0x2b6c58,null))['catch'](handleError(_0x2b6c58,null));};exports[_0xab39('0x62')]=function(_0x388c05,_0x1ca9d1){var _0x169c14=_0x388c05['body'];return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x388c05['params']['id']}})['then'](handleEntityNotFound(_0x1ca9d1,null))[_0xab39('0x29')](function(_0xf4c3aa){if(_0xf4c3aa){return db[_0xab39('0x55')][_0xab39('0x56')](function(_0x103d54){return db[_0xab39('0x5e')][_0xab39('0x28')]({'where':{'userProfileId':_0x388c05[_0xab39('0x4b')]['id'],'sectionId':_[_0xab39('0x30')](_0x169c14,function(_0x1921b0){return _0x1921b0[_0xab39('0x5b')];})},'transaction':_0x103d54})['then'](function(){var _0x40a9db=_[_0xab39('0x30')](_0x169c14,function(_0x3b7237){_0x3b7237[_0xab39('0x5c')]=_0x388c05[_0xab39('0x4b')]['id'];return _0x3b7237;});var _0x532e54=[];return BPromise[_0xab39('0x58')](_0x40a9db,function(_0x458da3){return db['UserProfileSection'][_0xab39('0x4e')](_0x458da3,{'include':[{'model':db[_0xab39('0x5a')],'as':_0xab39('0x5d')}],'raw':!![],'transaction':_0x103d54})[_0xab39('0x29')](function(_0x1fb50d){_0x532e54[_0xab39('0x63')](_0x1fb50d[_0xab39('0x57')]({'plain':!![]}));});})[_0xab39('0x29')](function(){return _0x532e54;});});});}})['then'](function(_0xd6c9d1){return _0xd6c9d1;})[_0xab39('0x29')](respondWithResult(_0x1ca9d1,null))[_0xab39('0x49')](handleError(_0x1ca9d1,null));};exports['removeSections']=function(_0x5ed279,_0x13c5d7){var _0x4bb2bf;return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x5ed279[_0xab39('0x4b')]['id']},'attributes':['id',_0xab39('0x2d')]})[_0xab39('0x29')](handleEntityNotFound(_0x13c5d7,null))['then'](function(_0x4f0275){if(_0x4f0275){_0x4bb2bf=_0x4f0275;return db[_0xab39('0x5e')]['destroy']({'where':{'userProfileId':_0x5ed279['params']['id'],'sectionId':_0x5ed279[_0xab39('0x35')][_0xab39('0x64')]}});}})[_0xab39('0x29')](function(){return _0x4bb2bf;})[_0xab39('0x29')](respondWithStatusCode(_0x13c5d7,null))['catch'](handleError(_0x13c5d7,null));};exports[_0xab39('0x65')]=function(_0xd1d1bf,_0x374c5f){var _0x4ea68e=[];var _0x538514=[];return db[_0xab39('0x5e')][_0xab39('0x47')]({'where':{'userProfileId':_0xd1d1bf[_0xab39('0x4b')]['id']},'raw':!![]})[_0xab39('0x29')](function(_0x5a619f){_0x4ea68e=_['filter'](_0x5a619f,function(_0x46cad9){return _0x46cad9[_0xab39('0x66')]===0x1||_[_0xab39('0x67')]([0x3eb,0x709],_0x46cad9[_0xab39('0x5b')]);});if(!_['isEmpty'](_0x4ea68e)){return _[_0xab39('0x30')](_0x4ea68e,function(_0xf76730){return _0xf76730[_0xab39('0x5b')];});}else{return;}})[_0xab39('0x29')](function(_0x4a3c16){if(_0x4a3c16)_0x538514=_0x4a3c16;if(_['includes'](_0x538514,0x64)){var _0x45987d=_[_0xab39('0x60')](_0x4ea68e,{'sectionId':0x64});return hasDefaultDashboard(_0x45987d)[_0xab39('0x29')](function(_0x1db523){return _[_0xab39('0x30')](_0x4ea68e,function(_0x1adeea){if(_0x1adeea['sectionId']===0x64){_0x1adeea[_0xab39('0x68')]=_0x1db523;}return _0x1adeea;});});}else{return;}})['then'](function(_0x279fd0){if(_0x279fd0)_0x4ea68e=_0x279fd0;if(_['includes'](_0x538514,0x3eb)){var _0x326b60=_[_0xab39('0x60')](_0x4ea68e,{'sectionId':0x3eb});return getCustomDashboards(_0x326b60)[_0xab39('0x29')](function(_0x18a86d){return _[_0xab39('0x30')](_0x4ea68e,function(_0x585d31){if(_0x326b60[_0xab39('0x66')]){if(_0x585d31[_0xab39('0x5b')]===0x3eb){_0x585d31[_0xab39('0x68')]=_0x18a86d;}}else{if(_0x585d31['sectionId']===0x64){if(!_0x585d31[_0xab39('0x68')]){_0x585d31[_0xab39('0x68')]=[];}_0x585d31[_0xab39('0x68')]=_0x585d31[_0xab39('0x68')][_0xab39('0x69')](_0x18a86d);}}return _0x585d31;});});}else{return;}})[_0xab39('0x29')](function(_0x45c287){if(_0x45c287)_0x4ea68e=_0x45c287;if(_['includes'](_0x538514,0x709)){var _0x5650db=_[_0xab39('0x60')](_0x4ea68e,{'sectionId':0x709});return getPlugins(_0x5650db)[_0xab39('0x29')](function(_0x37a0cc){if(_0x5650db[_0xab39('0x66')]){return _[_0xab39('0x30')](_0x4ea68e,function(_0x1009f2){if(_0x1009f2['sectionId']===0x709){_0x1009f2[_0xab39('0x68')]=_0x37a0cc;}return _0x1009f2;});}else{var _0x8d4a34={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37a0cc};var _0x34383c=_['map'](_0x4ea68e);_0x34383c[_0xab39('0x63')](_0x8d4a34);return _0x34383c;}});}else{return;}})[_0xab39('0x29')](function(_0x3d11c0){if(_0x3d11c0)_0x4ea68e=_0x3d11c0;return _[_0xab39('0x41')](_0x4ea68e,[_0xab39('0x66'),0x1]);})['then'](respondWithResult(_0x374c5f,null))[_0xab39('0x49')](handleError(_0x374c5f,null));};function hasDefaultDashboard(_0x385427){var _0x7fb46e=[0x65];return new BPromise(function(_0x17f5aa,_0x16137e){try{if(_0x385427[_0xab39('0x59')]){_0x17f5aa(_0x7fb46e);}else{return db[_0xab39('0x5a')][_0xab39('0x6a')]({'where':{'sectionId':_0x385427['id']},'raw':!![]})[_0xab39('0x29')](function(_0x330300){_0x330300?_0x17f5aa(_0x7fb46e):_0x17f5aa();});}}catch(_0x5613ad){_0x16137e(_0x5613ad);}});}function getCustomDashboards(_0x14282d){var _0xfed7e4=[];return new BPromise(function(_0x6e65d0,_0x3f9bca){try{if(_0x14282d[_0xab39('0x59')]){return db[_0xab39('0x6b')][_0xab39('0x47')]({'raw':!![]})[_0xab39('0x29')](function(_0xe71923){_0xe71923[_0xab39('0x6c')](function(_0x3da3ee){_0xfed7e4['push'](_0x3da3ee['id']+0x1869f);});_0x6e65d0(_0xfed7e4);});}else{return db[_0xab39('0x5a')][_0xab39('0x47')]({'where':{'sectionId':_0x14282d['id']},'raw':!![]})[_0xab39('0x29')](function(_0x23927e){_0x23927e[_0xab39('0x6c')](function(_0x113464){_0xfed7e4[_0xab39('0x63')](_0x113464[_0xab39('0x6d')]+0x1869f);});_0x6e65d0(_0xfed7e4);});}}catch(_0x2f2045){_0x3f9bca(_0x2f2045);}});}function getPlugins(_0xc1d474){var _0x7621e7=[];return new BPromise(function(_0x14e288,_0x5b8910){try{if(_0xc1d474[_0xab39('0x59')]){return db['Plugin']['findAll']({'raw':!![]})[_0xab39('0x29')](function(_0x15cac9){_0x15cac9['forEach'](function(_0x2a0cd1){_0x7621e7[_0xab39('0x63')](_0x2a0cd1['id']+0x15b38);});_0x14e288(_0x7621e7);});}else{return db[_0xab39('0x5a')][_0xab39('0x47')]({'where':{'sectionId':_0xc1d474['id']},'raw':!![]})[_0xab39('0x29')](function(_0xc6c2b9){_0xc6c2b9[_0xab39('0x6c')](function(_0x260292){_0x7621e7['push'](_0x260292[_0xab39('0x6d')]+0x15b38);});_0x14e288(_0x7621e7);});}}catch(_0x1bc2c5){_0x5b8910(_0x1bc2c5);}});}exports[_0xab39('0x6e')]=function(_0x216403,_0x1b487a){return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x216403[_0xab39('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b487a,null))[_0xab39('0x29')](function(_0x43488e){if(_0x43488e){return db['sequelize']['transaction'](function(_0x48c81b){return db[_0xab39('0x5e')]['findAll']({'where':{'userProfileId':_0x216403[_0xab39('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xab39('0x29')](function(_0x50d28b){if(_0x50d28b){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x216403[_0xab39('0x4b')]['id'],'id':_[_0xab39('0x30')](_0x50d28b,function(_0x1606b7){return _0x1606b7['id'];})},'transaction':_0x48c81b});}})['then'](function(_0x54d96c){var _0x4b5688=_[_0xab39('0x30')](_0x216403[_0xab39('0x53')],function(_0x2f193f){_0x2f193f[_0xab39('0x5c')]=_0x216403[_0xab39('0x4b')]['id'];return _0x2f193f;});return db[_0xab39('0x5e')][_0xab39('0x6f')](_0x4b5688,{'raw':!![],'transaction':_0x48c81b});})['then'](function(_0x4304f5){var _0x552ff5=_['filter'](_[_0xab39('0x30')](_0x4304f5,function(_0x2467eb){return _0x2467eb[_0xab39('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x552ff5){return db[_0xab39('0x5e')][_0xab39('0x47')]({'where':{'userProfileId':_0x216403[_0xab39('0x4b')]['id'],'sectionId':_[_0xab39('0x30')](_0x552ff5,function(_0x2c0c7d){return _0x2c0c7d[_0xab39('0x5b')];})},'attributes':['id',_0xab39('0x5b')],'raw':!![]})[_0xab39('0x29')](function(_0x393aaa){var _0x5a1c9b=_['map'](_0x216403[_0xab39('0x53')],function(_0x11ead9){_0x11ead9[_0xab39('0x5c')]=_0x216403['params']['id'];return _0x11ead9;});return db[_0xab39('0x5a')][_0xab39('0x6f')](_0x5a1c9b,{'raw':!![],'transaction':_0x48c81b});});}})[_0xab39('0x49')](handleError(_0x1b487a,null));});}})[_0xab39('0x29')](function(_0x310270){var _0xc1cd71=_['map'](_0x310270,function(_0x247f79){return _0x247f79[_0xab39('0x57')]({'plain':!![]});});})[_0xab39('0x29')](respondWithResult(_0x1b487a,null))[_0xab39('0x49')](handleError(_0x1b487a,null));};exports['removeResources']=function(_0x5820b4,_0x50ab23,_0x439471){return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x5820b4[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](handleEntityNotFound(_0x50ab23,null))[_0xab39('0x29')](function(_0x4000bc){if(_0x4000bc){return _0x4000bc['removeResources'](_0x5820b4[_0xab39('0x35')][_0xab39('0x64')]);}})[_0xab39('0x29')](respondWithStatusCode(_0x50ab23,null))['catch'](handleError(_0x50ab23,null));};exports[_0xab39('0x70')]=function(_0x156897,_0x3bd1db){var _0x59321f={};if(!_0x156897[_0xab39('0x35')][_0xab39('0x71')])throw new Error(_0xab39('0x72'));if(!_0x156897[_0xab39('0x35')][_0xab39('0x73')](_0xab39('0x3b'))){_0x59321f[_0xab39('0x23')]=qs[_0xab39('0x23')](_0x156897[_0xab39('0x35')]['limit']);_0x59321f[_0xab39('0x22')]=qs['offset'](_0x156897['query']['offset']);}return db[_0xab39('0x46')]['find']({'where':{'id':_0x156897[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](function(_0x37acd4){if(!_0x37acd4)throw new Error(_0xab39('0x74')+_0x156897[_0xab39('0x4b')]['id']);return db[_0xab39('0x46')]['getResources'](_0x156897);})['then'](respondWithFilteredResult(_0x3bd1db,_0x59321f))[_0xab39('0x49')](handleError(_0x3bd1db,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 93eab32..b4d05e1 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 _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 +var _0x2581=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x2581,0xcb));var _0x1258=function(_0x286480,_0x9181e8){_0x286480=_0x286480-0x0;var _0x26907b=_0x2581[_0x286480];return _0x26907b;};'use strict';var EventEmitter=require(_0x1258('0x0'));var UserProfile=require(_0x1258('0x1'))['db'][_0x1258('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1258('0x3')](0x0);var events={'afterCreate':_0x1258('0x4'),'afterUpdate':'update','afterDestroy':_0x1258('0x5')};function emitEvent(_0x1235e5){return function(_0x339891,_0xb54644,_0x3ad6b0){UserProfileEvents[_0x1258('0x6')](_0x1235e5+':'+_0x339891['id'],_0x339891);UserProfileEvents[_0x1258('0x6')](_0x1235e5,_0x339891);_0x3ad6b0(null);};}for(var e in events){if(events[_0x1258('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1258('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 67df279..d63ed68 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 _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 +var _0xfcff=['color','tag','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','exports','models','filter','field','value','findAll','associatedResources','map','model','name','catch','resolve','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','VoiceChanSpy','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','agents','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','pauses','sounds','Sound','Tag','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','then','define','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','include','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','CmContact','Tags'];(function(_0x24946d,_0x10ca22){var _0x536210=function(_0x3ec3c3){while(--_0x3ec3c3){_0x24946d['push'](_0x24946d['shift']());}};_0x536210(++_0x10ca22);}(_0xfcff,0x17f));var _0xffcf=function(_0x49f307,_0x3c77e3){_0x49f307=_0x49f307-0x0;var _0x23932a=_0xfcff[_0x49f307];return _0x23932a;};'use strict';var _=require('lodash');var attributes=require(_0xffcf('0x0'));var squel=require('squel');module[_0xffcf('0x1')]=function(_0x419f12){var _0x3ac320=_0x419f12[_0xffcf('0x2')];function _0x42a764(_0x2bad22,_0x124aa8){return new Promise(function(_0x558f53,_0x3a0d4e){if(!_0x124aa8)return _0x558f53(null);var _0x549e25=_0x124aa8[_0xffcf('0x3')]?{[_0x124aa8[_0xffcf('0x3')][_0xffcf('0x4')]]:_0x124aa8[_0xffcf('0x3')][_0xffcf('0x5')]}:undefined;return _0x3ac320[_0x2bad22][_0xffcf('0x6')]({'where':_0x549e25,'raw':!![]})['then'](function(_0x4c6db2){_0x124aa8[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x4c6db2,'id');_0x558f53(_0x124aa8);})['catch'](function(_0x4b8092){_0x3a0d4e(_0x4b8092);});});}function _0x3c2135(_0x230fd8,_0x3d788f){return new Promise(function(_0x3927c5,_0x3edbcf){var _0x46ac20=_0x230fd8[_0xffcf('0x3')]?{[_0x230fd8[_0xffcf('0x3')][_0xffcf('0x4')]]:_0x230fd8[_0xffcf('0x3')]['value']}:undefined;return _0x3ac320[_0x230fd8[_0xffcf('0x9')]]['findAll']({'where':_0x46ac20,'raw':!![]})['then'](function(_0x29bb91){_0x3d788f[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x29bb91,function(_0x14212e){return _0x14212e[_0xffcf('0xa')];});_0x3927c5(_0x3d788f);})[_0xffcf('0xb')](function(_0x253126){_0x3edbcf(_0x253126);});});}function _0xd44f34(_0x5a01f3,_0x5c692a,_0x386427){if(!_0x5c692a)return Promise[_0xffcf('0xc')](null);return new Promise(function(_0x3ebc64,_0x7ec093){return _0x3ac320['UserProfileResource'][_0xffcf('0x6')]({'where':{'sectionId':_0x5c692a['id']},'raw':!![]})['then'](function(_0x1759bb){if(_0x5a01f3[_0xffcf('0x4')]&&_0x5a01f3[_0xffcf('0x4')]!=='id'){_0x5c692a['associatedResources']=_[_0xffcf('0x8')](_0x1759bb,function(_0x29b0e5){return _0x29b0e5[_0x5a01f3[_0xffcf('0x4')]];});}else{if(_0x386427==='AnalyticExtractedReport'){_0x5c692a[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x1759bb,function(_0x17bfdc){return{'id':_0x17bfdc[_0xffcf('0xd')],'type':_0x17bfdc[_0xffcf('0xe')]};});}else{_0x5c692a[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x1759bb,function(_0x236de6){return _0x236de6[_0xffcf('0xd')];});}}_0x3ebc64(_0x5c692a);})[_0xffcf('0xb')](function(_0x18e2f8){_0x7ec093(_0x18e2f8);});});}function _0x17385c(_0x20df11,_0x5f2fec){var _0x5c51e4={'parentSections':[]};switch(_0x20df11[_0xffcf('0xf')]()){case _0xffcf('0x10'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x12');break;case _0xffcf('0x13'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x14');break;case'squarerecordings':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x15');_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x17'),'field':_0xffcf('0xa'),'foreignKey':'projectName'}];break;case _0xffcf('0x18'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x19');break;case'contacts':_0x5c51e4[_0xffcf('0x11')]='CmContact';_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x1a'),'field':'id','foreignKey':_0xffcf('0x1b')}];break;case _0xffcf('0x1c'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x1d');break;case _0xffcf('0x1e'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x1f');break;case'globalcustomfields':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x20');break;case _0xffcf('0x21'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x22');break;case _0xffcf('0x23'):_0x5c51e4['childModel']=_0xffcf('0x24');break;case _0xffcf('0x25'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x26');break;case _0xffcf('0x27'):_0x5c51e4['childModel']=_0xffcf('0x28');break;case _0xffcf('0x29'):case _0xffcf('0x2a'):case'outboundroutes':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x2b');break;case _0xffcf('0x2c'):_0x5c51e4[_0xffcf('0x11')]='VoiceContext';break;case'voicemails':_0x5c51e4['childModel']=_0xffcf('0x2d');break;case _0xffcf('0x2e'):_0x5c51e4['childModel']=_0xffcf('0x2f');_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x30'),'field':'name','foreignKey':'membername','model':_0xffcf('0x31'),'filter':{'field':'role','value':[_0xffcf('0x32')]}},{'name':_0xffcf('0x33'),'field':_0xffcf('0xa'),'foreignKey':_0xffcf('0x34'),'model':'User','filter':{'field':_0xffcf('0x35'),'value':['telephone']}},{'name':_0xffcf('0x36'),'field':'name','foreignKey':_0xffcf('0x37'),'model':_0xffcf('0x38'),'filter':{'field':_0xffcf('0xe'),'value':[_0xffcf('0x39')]}},{'name':_0xffcf('0x3a'),'field':_0xffcf('0xa'),'foreignKey':_0xffcf('0x37'),'model':_0xffcf('0x38'),'filter':{'field':_0xffcf('0xe'),'value':['outbound']}}];break;case _0xffcf('0x3b'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x3c');break;case'chanspies':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x3d');break;case'voiceprefixes':_0x5c51e4[_0xffcf('0x11')]='VoicePrefix';break;case _0xffcf('0x3e'):_0x5c51e4[_0xffcf('0x11')]='Campaign';break;case'mailqueues':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x3f');break;case _0xffcf('0x40'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x41');break;case _0xffcf('0x42'):_0x5c51e4['childModel']=_0xffcf('0x43');break;case _0xffcf('0x44'):_0x5c51e4['childModel']=_0xffcf('0x45');break;case'openchannelaccounts':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x46');break;case _0xffcf('0x47'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x48');break;case'smsaccounts':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x49');break;case'whatsappqueues':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x4a');break;case _0xffcf('0x4b'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x4c');break;case _0xffcf('0x4d'):_0x5c51e4[_0xffcf('0x11')]='Team';break;case'voicequeues':case _0xffcf('0x4e'):_0x5c51e4[_0xffcf('0x11')]='VoiceQueue';if(_0x5f2fec){_0x5c51e4['parentSections']=[{'name':'VoiceQueues'},{'name':_0xffcf('0x3a')}];}break;case'users':case _0xffcf('0x4f'):case'telephones':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x31');if(_0x5f2fec){_0x5c51e4[_0xffcf('0x16')]=[{'name':'Users','filter':{'field':_0xffcf('0x35'),'value':[_0xffcf('0x50'),_0xffcf('0x51')]},'ignore':!![]},{'name':_0xffcf('0x30')},{'name':'Telephones'}];}break;case _0xffcf('0x52'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x53');break;case _0xffcf('0x54'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x55');break;case _0xffcf('0x56'):_0x5c51e4['childModel']=_0xffcf('0x57');break;case _0xffcf('0x58'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x59');break;case _0xffcf('0x5a'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x5b');break;case'zohoaccounts':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x5c');break;case'vtigeraccounts':_0x5c51e4[_0xffcf('0x11')]='User';break;case _0xffcf('0x5d'):_0x5c51e4['childModel']=_0xffcf('0x5e');break;case _0xffcf('0x5f'):_0x5c51e4['childModel']='Disposition';break;case _0xffcf('0x60'):_0x5c51e4[_0xffcf('0x11')]='Dashboard';break;case _0xffcf('0x61'):_0x5c51e4[_0xffcf('0x11')]='Interval';break;case _0xffcf('0x62'):_0x5c51e4[_0xffcf('0x11')]='Pause';break;case'scheduler':_0x5c51e4[_0xffcf('0x11')]='Schedule';break;case _0xffcf('0x63'):_0x5c51e4['childModel']=_0xffcf('0x64');break;case'tags':_0x5c51e4['childModel']=_0xffcf('0x65');break;case'templates':_0x5c51e4[_0xffcf('0x11')]='Template';break;case'triggers':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x66');break;case _0xffcf('0x67'):_0x5c51e4['childModel']=_0xffcf('0x68');break;case _0xffcf('0x69'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x6a');break;case _0xffcf('0x6b'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x6c');break;case _0xffcf('0x6d'):_0x5c51e4[_0xffcf('0x11')]='AnalyticExtractedReport';_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x6e'),'field':'id','foreignKey':_0xffcf('0x6f')}];break;case _0xffcf('0x70'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x71');break;}return _0x5c51e4;}function _0x2e08ef(_0x535f64,_0x4b9550){var _0x471839=_0x535f64[_0xffcf('0x72')](0x0)[_0xffcf('0x73')]()+_0x535f64['slice'](0x1);var _0x52993b={'type':_0x3ac320[_0xffcf('0x74')][_0xffcf('0x75')][_0xffcf('0x76')],'raw':!![]};return new Promise(function(_0x1501e0,_0x57a51e){var _0x272246=squel[_0xffcf('0x77')]()[_0xffcf('0x4')](_0xffcf('0x78')+_0x471839+_0xffcf('0x79'),'id')[_0xffcf('0x4')](_0xffcf('0x7a'))[_0xffcf('0x7b')](_0xffcf('0x7c')+_0x535f64+_0xffcf('0x7d'),'ui')[_0xffcf('0x7e')](_0xffcf('0x7f'),_0x4b9550['id']);return _0x3ac320[_0xffcf('0x80')][_0xffcf('0x81')](_0x272246[_0xffcf('0x82')](),_0x52993b)[_0xffcf('0x83')](function(_0x49aa0f){_0x4b9550[_0x471839+'OpenTabs']=_0x49aa0f;_0x1501e0(_0x49aa0f);})[_0xffcf('0xb')](function(_0x7cf145){_0x57a51e(_0x7cf145);});});}return _0x419f12[_0xffcf('0x84')]('UserProfile',attributes,{'tableName':_0xffcf('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x590759){var _0x4221e0=require('../../components/parsers/qs');var _0x477985={'raw':_0x590759[_0xffcf('0x81')]['raw'],'where':{}};var _0x68182c={};var _0x598b03={'count':0x0,'rows':[]};var _0x15f839=_0x590759[_0xffcf('0x81')][_0xffcf('0x86')];var _0x16af8a=_0x590759[_0xffcf('0x81')]['mergeResources']||![];var _0x6936f2=_0x17385c(_0x15f839,_0x16af8a);if(!_0x6936f2['childModel'])throw new Error(_0xffcf('0x87')+_0x15f839+'\x27');var _0x165f11=[{'name':_0x15f839}];if(!_[_0xffcf('0x88')](_0x6936f2[_0xffcf('0x16')]))_0x165f11=_0x6936f2['parentSections'];var _0x194bf4=[];for(var _0x9ee69a=0x0;_0x9ee69a<_0x165f11[_0xffcf('0x89')];_0x9ee69a++){_0x194bf4[_0xffcf('0x8a')](_0x3ac320[_0xffcf('0x8b')][_0xffcf('0x8c')]({'where':{'userProfileId':_0x590759[_0xffcf('0x8d')]['id'],'name':_0x165f11[_0x9ee69a][_0xffcf('0xa')]},'raw':!![]}));}return Promise[_0xffcf('0x8e')](_0x194bf4)[_0xffcf('0x83')](function(_0x900b68){var _0x40c6f6=_[_0xffcf('0x3')](_0x900b68,function(_0x53d61f){return _0x53d61f?_0x53d61f:undefined;});var _0x142239=_['filter'](_0x165f11,[_0xffcf('0x8f'),!![]]);var _0x1ee6c2=_[_0xffcf('0x88')](_0x40c6f6)&&_[_0xffcf('0x88')](_0x142239)?null:_['union'](_0x142239,_0x40c6f6);if(!_0x1ee6c2)return null;var _0x55c369=[];for(var _0x5c151a=0x0;_0x5c151a<_0x1ee6c2[_0xffcf('0x89')];_0x5c151a++){var _0x26a45b=_[_0xffcf('0x8c')](_0x165f11,function(_0x5b34c3){return _0x1ee6c2[_0x5c151a]?_0x5b34c3[_0xffcf('0xa')]===_0x1ee6c2[_0x5c151a]['name']:null;});if(_0x26a45b){if(_0x1ee6c2[_0x5c151a][_0xffcf('0x8f')]){_0x55c369['push'](_0x42a764(_0x6936f2[_0xffcf('0x11')],_0x1ee6c2[_0x5c151a]));}else{if(!_0x1ee6c2[_0x5c151a][_0xffcf('0x90')]){_0x55c369['push'](_0xd44f34(_0x26a45b,_0x1ee6c2[_0x5c151a],_0x6936f2[_0xffcf('0x11')]));}else{if(_0x26a45b[_0xffcf('0x9')]){_0x55c369['push'](_0x3c2135(_0x26a45b,_0x1ee6c2[_0x5c151a]));}}}}}return Promise['all'](_0x55c369);})[_0xffcf('0x83')](function(_0x427c01){var _0x2cb9a8=_0x427c01;var _0x3b4cf8=null;if(_0x2cb9a8){_0x3b4cf8=_0x2cb9a8[_0xffcf('0x89')]===0x1?_0x2cb9a8[0x0]:null;}if(!_0x3b4cf8&&!_0x2cb9a8)return _0x598b03;var _0x28d8d2=_0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0x91')];_0x68182c[_0xffcf('0x9')]=_[_0xffcf('0x92')](_0x28d8d2);_0x68182c['query']=_[_0xffcf('0x92')](_0x590759[_0xffcf('0x81')]);_0x68182c['filters']=_[_0xffcf('0x93')](_0x68182c[_0xffcf('0x9')],_0x68182c['query']);_0x477985[_0xffcf('0x94')]=_['intersection'](_0x68182c[_0xffcf('0x9')],_0x4221e0[_0xffcf('0x95')](_0x590759['query']['fields']));_0x477985['attributes']=_0x477985['attributes']['length']?_0x477985['attributes']:_0x68182c[_0xffcf('0x9')];if(!_0x590759['query'][_0xffcf('0x96')]('nolimit')){_0x477985['limit']=_0x4221e0[_0xffcf('0x97')](_0x590759[_0xffcf('0x81')]['limit']);_0x477985[_0xffcf('0x98')]=_0x4221e0[_0xffcf('0x98')](_0x590759[_0xffcf('0x81')][_0xffcf('0x98')]);}_0x477985[_0xffcf('0x99')]=_0x4221e0['sort'](_0x590759['query'][_0xffcf('0x9a')]);_0x477985['where']=_0x4221e0[_0xffcf('0x9b')](_[_0xffcf('0x9c')](_0x590759[_0xffcf('0x81')],_0x68182c[_0xffcf('0x9b')]));if(_0x590759[_0xffcf('0x81')]['filter']){_0x477985[_0xffcf('0x7e')]=_[_0xffcf('0x9d')](_0x477985[_0xffcf('0x7e')],{'$or':_[_0xffcf('0x8')](_0x28d8d2,function(_0x142f08){if(_0x142f08[_0xffcf('0xe')][_0xffcf('0x9e')]!==_0xffcf('0x9f')){var _0x16b875={};_0x16b875[_0x142f08[_0xffcf('0x4')]]={'$like':'%'+_0x590759[_0xffcf('0x81')][_0xffcf('0x3')]+'%'};return _0x16b875;}})});}var _0x24ff0c=[];var _0xf07489=null;var _0x231640={};if(_0x3b4cf8){_0xf07489=_[_0xffcf('0x8c')](_0x165f11,[_0xffcf('0xa'),_0x3b4cf8[_0xffcf('0xa')]]);if(_0xf07489['field']){_0x231640={};if(_0x6936f2['childModel']===_0xffcf('0xa0')){_0x231640[_0xf07489[_0xffcf('0xa1')]]=_[_0xffcf('0x8')](_0x3b4cf8[_0xffcf('0x7')],'id');}else{_0x231640[_0xf07489[_0xffcf('0xa1')]]=_0x3b4cf8['associatedResources'];}_0x24ff0c[_0xffcf('0x8a')](_0x231640);}else{_0x477985[_0xffcf('0x7e')]['id']=_0x3b4cf8['associatedResources'];}}else{for(var _0x296df7=0x0;_0x296df7<_0x2cb9a8[_0xffcf('0x89')];_0x296df7++){_0xf07489=_['find'](_0x165f11,[_0xffcf('0xa'),_0x2cb9a8[_0x296df7][_0xffcf('0xa')]]);if(_0xf07489[_0xffcf('0x4')]){_0x231640={};_0x231640[_0xf07489[_0xffcf('0xa1')]]=_0x2cb9a8[_0x296df7]['associatedResources'];_0x24ff0c[_0xffcf('0x8a')](_0x231640);}else{if(!_0x477985[_0xffcf('0x7e')]['id'])_0x477985['where']['id']=[];_0x2cb9a8[_0x296df7][_0xffcf('0x7')][_0xffcf('0xa2')](function(_0x2668fe){_0x477985[_0xffcf('0x7e')]['id'][_0xffcf('0x8a')](_0x2668fe);});}}}if(!_[_0xffcf('0x88')](_0x24ff0c)){_0x477985[_0xffcf('0x7e')]=_['merge'](_0x477985['where'],{'$and':{'$or':_0x24ff0c}});}_0x477985=_[_0xffcf('0x9d')]({},_0x477985,_0x590759[_0xffcf('0xa3')]);if(_0x3b4cf8&&!_0x3b4cf8[_0xffcf('0x90')]&&_0x6936f2['childModel']===_0xffcf('0xa0')){if(_0x590759[_0xffcf('0x81')]['includeAll']){_0x477985[_0xffcf('0xa4')]=[{'all':!![]}];}return _0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0x6')](_0x477985)[_0xffcf('0x83')](function(_0x370027){var _0x378977=[];_0x370027[_0xffcf('0xa2')](function(_0xd07bd0){var _0x5df169;switch(_0xd07bd0['reportType']){case'default':_0x5df169=_['find'](_0x3b4cf8['associatedResources'],function(_0x36511f){return _0x36511f['id']===_0xd07bd0['reportId']&&_0x36511f['type']===_0xffcf('0xa5');});break;case _0xffcf('0xa6'):_0x5df169=_[_0xffcf('0x8c')](_0x3b4cf8[_0xffcf('0x7')],function(_0x1f6c33){return _0x1f6c33['id']===_0xd07bd0['reportId']&&_0x1f6c33[_0xffcf('0xe')]===_0xffcf('0xa7');});break;}if(_0x5df169)_0x378977[_0xffcf('0x8a')](_0xd07bd0);});_0x598b03['count']=_0x378977[_0xffcf('0x89')];_0x598b03[_0xffcf('0xa8')]=_0x378977;return _0x598b03;});}else{if(!_[_0xffcf('0x88')](_0x590759[_0xffcf('0x81')][_0xffcf('0xa9')])){_0x477985[_0xffcf('0x7e')]['id']=_0x477985[_0xffcf('0x7e')]['id']?_[_0xffcf('0x93')](_0x477985[_0xffcf('0x7e')]['id'],_0x590759[_0xffcf('0x81')][_0xffcf('0xa9')]):_0x590759[_0xffcf('0x81')][_0xffcf('0xa9')];if(_0x590759[_0xffcf('0x81')]['customSorting']){_0x477985['order']=_0x590759[_0xffcf('0x81')][_0xffcf('0xaa')];}}if(_0x590759[_0xffcf('0x81')][_0xffcf('0xab')]){_0x477985[_0xffcf('0x7e')]=_[_0xffcf('0x9d')](_0x477985['where'],{'$and':_0x590759[_0xffcf('0x81')]['extraQueryConditions']});}return _0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0xac')]({'where':_0x477985[_0xffcf('0x7e')]})[_0xffcf('0x83')](function(_0xa917d7){_0x598b03[_0xffcf('0xac')]=_0xa917d7;if(_0x590759[_0xffcf('0x81')]['includeAll']){if(_0x6936f2['childModel']===_0xffcf('0xad')){_0x477985[_0xffcf('0xa4')]=[{'model':_0x3ac320[_0xffcf('0x65')],'as':_0xffcf('0xae'),'attributes':['id',_0xffcf('0xa'),'color'],'required':_0x590759['query']['tag']?!![]:![]},{'model':_0x3ac320[_0xffcf('0x65')],'as':'ThroughTags','attributes':['id','name',_0xffcf('0xaf')],'through':_0x590759['query'][_0xffcf('0xb0')]?{'attributes':[],'where':{'TagId':_0x590759[_0xffcf('0x81')]['tag']||undefined}}:{},'required':_0x590759['query']['tag']?!![]:![]}];}else{_0x477985[_0xffcf('0xa4')]=[{'all':!![]}];}}return _0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0x6')](_0x477985);})[_0xffcf('0x83')](function(_0x1e4223){_0x598b03[_0xffcf('0xa8')]=_0x1e4223;if(_0x15f839==='Agents'&&_0x590759[_0xffcf('0x81')][_0xffcf('0xb1')]===_0xffcf('0xb2')){var _0xb99881=[];for(var _0x7b495a=0x0;_0x7b495a<_0x598b03['rows'][_0xffcf('0x89')];_0x7b495a++){_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb3'),_0x598b03[_0xffcf('0xa8')][_0x7b495a]['dataValues']));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb4'),_0x598b03['rows'][_0x7b495a][_0xffcf('0xb5')]));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb6'),_0x598b03[_0xffcf('0xa8')][_0x7b495a][_0xffcf('0xb5')]));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb7'),_0x598b03[_0xffcf('0xa8')][_0x7b495a]['dataValues']));_0xb99881['push'](_0x2e08ef(_0xffcf('0xb8'),_0x598b03[_0xffcf('0xa8')][_0x7b495a]['dataValues']));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb9'),_0x598b03[_0xffcf('0xa8')][_0x7b495a][_0xffcf('0xb5')]));}return Promise[_0xffcf('0x8e')](_0xb99881)[_0xffcf('0x83')](function(){return _0x598b03;});}return _0x598b03;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9e70412..c2d8319 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 _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 +var _0xbc36=['register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./userProfile.socket'];(function(_0x85a333,_0x425aa7){var _0x36f553=function(_0x21d96b){while(--_0x21d96b){_0x85a333['push'](_0x85a333['shift']());}};_0x36f553(++_0x425aa7);}(_0xbc36,0x169));var _0x6bc3=function(_0x223ed6,_0x137718){_0x223ed6=_0x223ed6-0x0;var _0x12f224=_0xbc36[_0x223ed6];return _0x12f224;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var moment=require(_0x6bc3('0x1'));var BPromise=require(_0x6bc3('0x2'));var rs=require(_0x6bc3('0x3'));var fs=require('fs');var Redis=require(_0x6bc3('0x4'));var db=require(_0x6bc3('0x5'))['db'];var utils=require(_0x6bc3('0x6'));var logger=require(_0x6bc3('0x7'))(_0x6bc3('0x8'));var config=require(_0x6bc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bc3('0xa')][_0x6bc3('0xb')]({'port':0x232a});config['redis']=_[_0x6bc3('0xc')](config[_0x6bc3('0xd')],{'host':_0x6bc3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6bc3('0xd')]));require(_0x6bc3('0xf'))[_0x6bc3('0x10')](socket);function respondWithRpcPromise(_0x16ccf6,_0x558d65,_0x257cf7){return new BPromise(function(_0x1008f7,_0x39b63c){return client[_0x6bc3('0x11')](_0x16ccf6,_0x257cf7)[_0x6bc3('0x12')](function(_0x11cf76){logger[_0x6bc3('0x13')](_0x6bc3('0x14'),_0x558d65,_0x6bc3('0x15'));logger['debug'](_0x6bc3('0x16'),_0x558d65,'request\x20sent',JSON[_0x6bc3('0x17')](_0x11cf76));if(_0x11cf76['error']){if(_0x11cf76[_0x6bc3('0x18')][_0x6bc3('0x19')]===0x1f4){logger['error'](_0x6bc3('0x14'),_0x558d65,_0x11cf76['error']['message']);return _0x39b63c(_0x11cf76[_0x6bc3('0x18')][_0x6bc3('0x1a')]);}logger[_0x6bc3('0x18')](_0x6bc3('0x14'),_0x558d65,_0x11cf76[_0x6bc3('0x18')][_0x6bc3('0x1a')]);return _0x1008f7(_0x11cf76[_0x6bc3('0x18')]['message']);}else{logger[_0x6bc3('0x13')](_0x6bc3('0x14'),_0x558d65,'request\x20sent');_0x1008f7(_0x11cf76[_0x6bc3('0x1b')][_0x6bc3('0x1a')]);}})[_0x6bc3('0x1c')](function(_0x2ad222){logger[_0x6bc3('0x18')](_0x6bc3('0x14'),_0x558d65,_0x2ad222);_0x39b63c(_0x2ad222);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3a8984e..cffe40e 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 _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 +var _0x9124=['userProfile:','remove','update','removeListener','register','length'];(function(_0x20c82a,_0x2a4294){var _0x585004=function(_0xe317e8){while(--_0xe317e8){_0x20c82a['push'](_0x20c82a['shift']());}};_0x585004(++_0x2a4294);}(_0x9124,0x6d));var _0x4912=function(_0x44821e,_0x2075d6){_0x44821e=_0x44821e-0x0;var _0x4b08a2=_0x9124[_0x44821e];return _0x4b08a2;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x4912('0x0'),_0x4912('0x1')];function createListener(_0xb45099,_0x27ffe2){return function(_0x2f1b98){_0x27ffe2['emit'](_0xb45099,_0x2f1b98);};}function removeListener(_0x3cca1f,_0x4088ac){return function(){UserProfileEvents[_0x4912('0x2')](_0x3cca1f,_0x4088ac);};}exports[_0x4912('0x3')]=function(_0x1cac45){for(var _0x5d5aa1=0x0,_0x5df441=events[_0x4912('0x4')];_0x5d5aa1<_0x5df441;_0x5d5aa1++){var _0x5a0ac7=events[_0x5d5aa1];var _0x2e0e89=createListener(_0x4912('0x5')+_0x5a0ac7,_0x1cac45);UserProfileEvents['on'](_0x5a0ac7,_0x2e0e89);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7cb82e3..f69a517 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 _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 +var _0x9fc5=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x286410,_0x3944a7){var _0x390f3a=function(_0x75d153){while(--_0x75d153){_0x286410['push'](_0x286410['shift']());}};_0x390f3a(++_0x3944a7);}(_0x9fc5,0x84));var _0x59fc=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x9fc5[_0x141e03];return _0x2074e3;};'use strict';var multer=require('multer');var util=require(_0x59fc('0x0'));var path=require(_0x59fc('0x1'));var timeout=require(_0x59fc('0x2'));var express=require('express');var router=express[_0x59fc('0x3')]();var fs_extra=require(_0x59fc('0x4'));var auth=require(_0x59fc('0x5'));var interaction=require(_0x59fc('0x6'));var config=require(_0x59fc('0x7'));var controller=require('./userProfileResource.controller');router[_0x59fc('0x8')]('/',auth[_0x59fc('0x9')](),controller['index']);router[_0x59fc('0x8')](_0x59fc('0xa'),auth[_0x59fc('0x9')](),controller[_0x59fc('0xb')]);router[_0x59fc('0x8')](_0x59fc('0xc'),auth['isAuthenticated'](),controller[_0x59fc('0xd')]);router[_0x59fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x59fc('0xf')]);router[_0x59fc('0x10')](_0x59fc('0xc'),auth[_0x59fc('0x9')](),controller[_0x59fc('0x11')]);router[_0x59fc('0x12')](_0x59fc('0xc'),auth[_0x59fc('0x9')](),controller['destroy']);module[_0x59fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index c47db3d..3b663b6 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 _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 +var _0x3578=['STRING','sequelize','exports'];(function(_0x41b22a,_0xae2411){var _0x30841d=function(_0x5d017a){while(--_0x5d017a){_0x41b22a['push'](_0x41b22a['shift']());}};_0x30841d(++_0xae2411);}(_0x3578,0x184));var _0x8357=function(_0x48befb,_0x502bb7){_0x48befb=_0x48befb-0x0;var _0x45eb9b=_0x3578[_0x48befb];return _0x45eb9b;};'use strict';var Sequelize=require(_0x8357('0x0'));module[_0x8357('0x1')]={'name':{'type':Sequelize[_0x8357('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x8357('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 07a2f13..0888141 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 _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 +var _0x4888=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','UserProfileResource','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4888,0x198));var _0x8488=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x4888[_0x3ec122];return _0x4ecf41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));};exports[_0x8488('0x46')]=function(_0x313e00,_0x186747){return db[_0x8488('0x3a')]['describe']()[_0x8488('0x21')](respondWithResult(_0x186747,null))[_0x8488('0x3e')](handleError(_0x186747,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 43b52b4..109b78d 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 _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 +var _0x40b3=['lodash','api','moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId'];(function(_0x4ebc89,_0x163696){var _0x133a0c=function(_0x28fbed){while(--_0x28fbed){_0x4ebc89['push'](_0x4ebc89['shift']());}};_0x133a0c(++_0x163696);}(_0x40b3,0x1ee));var _0x340b=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x40b3[_0x4d9bb2];return _0x3179fe;};'use strict';var _=require(_0x340b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x340b('0x1'));var moment=require(_0x340b('0x2'));var BPromise=require(_0x340b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x340b('0x4'));var config=require(_0x340b('0x5'));var attributes=require(_0x340b('0x6'));module[_0x340b('0x7')]=function(_0x1f815c,_0x2f9947){return _0x1f815c[_0x340b('0x8')](_0x340b('0x9'),attributes,{'tableName':_0x340b('0xa'),'paranoid':![],'indexes':[{'name':_0x340b('0xb'),'fields':['resourceId',_0x340b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a6a707c..e3d0b5e 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 _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 +var _0x8c69=['then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5d7610,_0x2a3fca){var _0x4058ce=function(_0x438cf8){while(--_0x438cf8){_0x5d7610['push'](_0x5d7610['shift']());}};_0x4058ce(++_0x2a3fca);}(_0x8c69,0x8f));var _0x98c6=function(_0x5442af,_0x358aa8){_0x5442af=_0x5442af-0x0;var _0x22c0db=_0x8c69[_0x5442af];return _0x22c0db;};'use strict';var _=require(_0x98c6('0x0'));var util=require(_0x98c6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x98c6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x98c6('0x3'));var logger=require(_0x98c6('0x4'))(_0x98c6('0x5'));var config=require(_0x98c6('0x6'));var jayson=require(_0x98c6('0x7'));var client=jayson[_0x98c6('0x8')][_0x98c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4529f2,_0x52e755,_0x3f561f){return new BPromise(function(_0x2b1a41,_0x58c482){return client[_0x98c6('0xa')](_0x4529f2,_0x3f561f)[_0x98c6('0xb')](function(_0x2b2dd3){logger['info'](_0x98c6('0xc'),_0x52e755,'request\x20sent');logger[_0x98c6('0xd')](_0x98c6('0xe'),_0x52e755,'request\x20sent',JSON[_0x98c6('0xf')](_0x2b2dd3));if(_0x2b2dd3[_0x98c6('0x10')]){if(_0x2b2dd3[_0x98c6('0x10')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x52e755,_0x2b2dd3[_0x98c6('0x10')][_0x98c6('0x11')]);return _0x58c482(_0x2b2dd3['error']['message']);}logger[_0x98c6('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x52e755,_0x2b2dd3[_0x98c6('0x10')][_0x98c6('0x11')]);return _0x2b1a41(_0x2b2dd3['error']['message']);}else{logger[_0x98c6('0x12')](_0x98c6('0xc'),_0x52e755,_0x98c6('0x13'));_0x2b1a41(_0x2b2dd3[_0x98c6('0x14')][_0x98c6('0x11')]);}})[_0x98c6('0x15')](function(_0x3b95e3){logger['error'](_0x98c6('0xc'),_0x52e755,_0x3b95e3);_0x58c482(_0x3b95e3);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a3d8dd2..32d118c 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 _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 +var _0xa7c5=['/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x4dc35f,_0x377c51){var _0x1f8820=function(_0x37c340){while(--_0x37c340){_0x4dc35f['push'](_0x4dc35f['shift']());}};_0x1f8820(++_0x377c51);}(_0xa7c5,0x146));var _0x5a7c=function(_0x1bf779,_0x25d800){_0x1bf779=_0x1bf779-0x0;var _0xcdf3d7=_0xa7c5[_0x1bf779];return _0xcdf3d7;};'use strict';var multer=require(_0x5a7c('0x0'));var util=require(_0x5a7c('0x1'));var path=require(_0x5a7c('0x2'));var timeout=require(_0x5a7c('0x3'));var express=require('express');var router=express[_0x5a7c('0x4')]();var fs_extra=require(_0x5a7c('0x5'));var auth=require(_0x5a7c('0x6'));var interaction=require(_0x5a7c('0x7'));var config=require(_0x5a7c('0x8'));var controller=require(_0x5a7c('0x9'));router[_0x5a7c('0xa')]('/',auth[_0x5a7c('0xb')](),controller[_0x5a7c('0xc')]);router[_0x5a7c('0xa')](_0x5a7c('0xd'),auth['isAuthenticated'](),controller[_0x5a7c('0xe')]);router[_0x5a7c('0xa')]('/:id',auth[_0x5a7c('0xb')](),controller[_0x5a7c('0xf')]);router[_0x5a7c('0x10')]('/',auth['isAuthenticated'](),controller[_0x5a7c('0x11')]);router[_0x5a7c('0x12')](_0x5a7c('0x13'),auth['isAuthenticated'](),controller[_0x5a7c('0x14')]);router['delete'](_0x5a7c('0x13'),auth['isAuthenticated'](),controller[_0x5a7c('0x15')]);module[_0x5a7c('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 1fbac39..d936731 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_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 +var _0x5eb8=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x5dfd95,_0x2c4aea){var _0x2d2ff4=function(_0x535ae5){while(--_0x535ae5){_0x5dfd95['push'](_0x5dfd95['shift']());}};_0x2d2ff4(++_0x2c4aea);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x5eb8[_0x4c5c97];return _0xd5d2cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x85eb('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x85eb('0x0')],'set':function(_0x13b1df){this[_0x85eb('0x3')](_0x85eb('0x4'),_0x13b1df?_0x13b1df[_0x85eb('0x5')](''):[]);},'get':function(){return this[_0x85eb('0x6')](_0x85eb('0x4'))?this['getDataValue'](_0x85eb('0x4'))[_0x85eb('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 11468d2..a1592f3 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 _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 +var _0xd419=['where','merge','type','VIRTUAL','filter','include','catch','show','includeAll','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfileSection','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xd419,0x9d));var _0x9d41=function(_0x344995,_0x3bebe4){_0x344995=_0x344995-0x0;var _0x5b0c47=_0xd419[_0x344995];return _0x5b0c47;};'use strict';var emlformat=require(_0x9d41('0x0'));var rimraf=require(_0x9d41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d41('0x2'));var rp=require(_0x9d41('0x3'));var moment=require(_0x9d41('0x4'));var BPromise=require(_0x9d41('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d41('0x6'));var sox=require(_0x9d41('0x7'));var csv=require('to-csv');var ejs=require(_0x9d41('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d41('0x9'));var squel=require('squel');var crypto=require(_0x9d41('0xa'));var jsforce=require(_0x9d41('0xb'));var deskjs=require(_0x9d41('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9d41('0xd'));var Papa=require('papaparse');var Redis=require(_0x9d41('0xe'));var authService=require(_0x9d41('0xf'));var qs=require(_0x9d41('0x10'));var as=require(_0x9d41('0x11'));var hardwareService=require(_0x9d41('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9d41('0x13'));var config=require(_0x9d41('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d41('0x15'))['db'];function respondWithStatusCode(_0x24b29,_0x58d438){_0x58d438=_0x58d438||0xcc;return function(_0x495aee){if(_0x495aee){return _0x24b29['sendStatus'](_0x58d438);}return _0x24b29[_0x9d41('0x16')](_0x58d438)[_0x9d41('0x17')]();};}function respondWithResult(_0x190591,_0x1b5f0c){_0x1b5f0c=_0x1b5f0c||0xc8;return function(_0x3bfd20){if(_0x3bfd20){return _0x190591[_0x9d41('0x16')](_0x1b5f0c)[_0x9d41('0x18')](_0x3bfd20);}};}function respondWithFilteredResult(_0x4e41b7,_0x26f43f){return function(_0x57cc35){if(_0x57cc35){var _0xb25c77=typeof _0x26f43f['offset']===_0x9d41('0x19')&&typeof _0x26f43f[_0x9d41('0x1a')]===_0x9d41('0x19');var _0x1379ba=_0x57cc35[_0x9d41('0x1b')];var _0x5a4565=_0xb25c77?0x0:_0x26f43f[_0x9d41('0x1c')];var _0x382f90=_0xb25c77?_0x57cc35[_0x9d41('0x1b')]:_0x26f43f[_0x9d41('0x1c')]+_0x26f43f[_0x9d41('0x1a')];var _0x1385b1;if(_0x382f90>=_0x1379ba){_0x382f90=_0x1379ba;_0x1385b1=0xc8;}else{_0x1385b1=0xce;}_0x4e41b7[_0x9d41('0x16')](_0x1385b1);return _0x4e41b7[_0x9d41('0x1d')]('Content-Range',_0x5a4565+'-'+_0x382f90+'/'+_0x1379ba)[_0x9d41('0x18')](_0x57cc35);}return null;};}function patchUpdates(_0x1b5553){return function(_0xd7ffb6){try{jsonpatch['apply'](_0xd7ffb6,_0x1b5553,!![]);}catch(_0xfae6b3){return BPromise[_0x9d41('0x1e')](_0xfae6b3);}return _0xd7ffb6[_0x9d41('0x1f')]();};}function saveUpdates(_0x3b3f7c,_0x47c858){return function(_0x10d065){if(_0x10d065){return _0x10d065[_0x9d41('0x20')](_0x3b3f7c)[_0x9d41('0x21')](function(_0xf27fd4){return _0xf27fd4;});}return null;};}function removeEntity(_0x3d039a,_0x25cc79){return function(_0x19d403){if(_0x19d403){return _0x19d403[_0x9d41('0x22')]()[_0x9d41('0x21')](function(){_0x3d039a[_0x9d41('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b253,_0x49a71d){return function(_0x5e7213){if(!_0x5e7213){_0x46b253[_0x9d41('0x23')](0x194);}return _0x5e7213;};}function handleError(_0x80baae,_0x24c17b){_0x24c17b=_0x24c17b||0x1f4;return function(_0x3d13c5){logger[_0x9d41('0x24')](_0x3d13c5[_0x9d41('0x25')]);if(_0x3d13c5[_0x9d41('0x26')]){delete _0x3d13c5[_0x9d41('0x26')];}_0x80baae[_0x9d41('0x16')](_0x24c17b)['send'](_0x3d13c5);};}exports[_0x9d41('0x27')]=function(_0x571061,_0x3a90f4){var _0x28e580={},_0x13f5ce={},_0x13bea6={'count':0x0,'rows':[]};var _0x2fba15=_[_0x9d41('0x28')](db[_0x9d41('0x29')][_0x9d41('0x2a')],function(_0xc41963){return{'name':_0xc41963['fieldName'],'type':_0xc41963['type'][_0x9d41('0x2b')]};});_0x13f5ce['model']=_[_0x9d41('0x28')](_0x2fba15,'name');_0x13f5ce[_0x9d41('0x2c')]=_[_0x9d41('0x2d')](_0x571061[_0x9d41('0x2c')]);_0x13f5ce[_0x9d41('0x2e')]=_[_0x9d41('0x2f')](_0x13f5ce[_0x9d41('0x30')],_0x13f5ce[_0x9d41('0x2c')]);_0x28e580[_0x9d41('0x31')]=_[_0x9d41('0x2f')](_0x13f5ce[_0x9d41('0x30')],qs[_0x9d41('0x32')](_0x571061[_0x9d41('0x2c')][_0x9d41('0x32')]));_0x28e580[_0x9d41('0x31')]=_0x28e580[_0x9d41('0x31')][_0x9d41('0x33')]?_0x28e580['attributes']:_0x13f5ce[_0x9d41('0x30')];if(!_0x571061[_0x9d41('0x2c')][_0x9d41('0x34')](_0x9d41('0x35'))){_0x28e580[_0x9d41('0x1a')]=qs[_0x9d41('0x1a')](_0x571061[_0x9d41('0x2c')][_0x9d41('0x1a')]);_0x28e580[_0x9d41('0x1c')]=qs['offset'](_0x571061[_0x9d41('0x2c')][_0x9d41('0x1c')]);}_0x28e580['order']=qs[_0x9d41('0x36')](_0x571061['query'][_0x9d41('0x36')]);_0x28e580['where']=qs[_0x9d41('0x2e')](_[_0x9d41('0x37')](_0x571061[_0x9d41('0x2c')],_0x13f5ce[_0x9d41('0x2e')]),_0x2fba15);if(_0x571061[_0x9d41('0x2c')]['filter']){_0x28e580[_0x9d41('0x38')]=_[_0x9d41('0x39')](_0x28e580['where'],{'$or':_[_0x9d41('0x28')](_0x2fba15,function(_0xfbe768){if(_0xfbe768[_0x9d41('0x3a')]!==_0x9d41('0x3b')){var _0x5e4ba4={};_0x5e4ba4[_0xfbe768[_0x9d41('0x26')]]={'$like':'%'+_0x571061['query'][_0x9d41('0x3c')]+'%'};return _0x5e4ba4;}})});}_0x28e580=_[_0x9d41('0x39')]({},_0x28e580,_0x571061['options']);var _0xa3717c={'where':_0x28e580[_0x9d41('0x38')]};return db[_0x9d41('0x29')][_0x9d41('0x1b')](_0xa3717c)[_0x9d41('0x21')](function(_0x1b9b30){_0x13bea6[_0x9d41('0x1b')]=_0x1b9b30;if(_0x571061['query']['includeAll']){_0x28e580[_0x9d41('0x3d')]=[{'all':!![]}];}return db[_0x9d41('0x29')]['findAll'](_0x28e580);})[_0x9d41('0x21')](function(_0x5d2620){_0x13bea6['rows']=_0x5d2620;return _0x13bea6;})[_0x9d41('0x21')](respondWithFilteredResult(_0x3a90f4,_0x28e580))[_0x9d41('0x3e')](handleError(_0x3a90f4,null));};exports[_0x9d41('0x3f')]=function(_0x1c7f18,_0x478cac){var _0x5da61b={'raw':![],'where':{'id':_0x1c7f18['params']['id']}},_0x1a7ea1={};_0x1a7ea1['model']=_[_0x9d41('0x2d')](db['UserProfileSection'][_0x9d41('0x2a')]);_0x1a7ea1[_0x9d41('0x2c')]=_[_0x9d41('0x2d')](_0x1c7f18[_0x9d41('0x2c')]);_0x1a7ea1[_0x9d41('0x2e')]=_[_0x9d41('0x2f')](_0x1a7ea1[_0x9d41('0x30')],_0x1a7ea1['query']);_0x5da61b['attributes']=_[_0x9d41('0x2f')](_0x1a7ea1['model'],qs[_0x9d41('0x32')](_0x1c7f18['query']['fields']));_0x5da61b[_0x9d41('0x31')]=_0x5da61b[_0x9d41('0x31')]['length']?_0x5da61b[_0x9d41('0x31')]:_0x1a7ea1['model'];if(_0x1c7f18[_0x9d41('0x2c')][_0x9d41('0x40')]){_0x5da61b[_0x9d41('0x3d')]=[{'all':!![]}];}_0x5da61b=_['merge']({},_0x5da61b,_0x1c7f18[_0x9d41('0x41')]);return db[_0x9d41('0x29')]['find'](_0x5da61b)[_0x9d41('0x21')](handleEntityNotFound(_0x478cac,null))[_0x9d41('0x21')](respondWithResult(_0x478cac,null))[_0x9d41('0x3e')](handleError(_0x478cac,null));};exports['create']=function(_0x10c936,_0x7cf384){return db[_0x9d41('0x29')][_0x9d41('0x42')](_0x10c936[_0x9d41('0x43')],{})[_0x9d41('0x21')](respondWithResult(_0x7cf384,0xc9))['catch'](handleError(_0x7cf384,null));};exports[_0x9d41('0x20')]=function(_0x479397,_0x2a3b9d){if(_0x479397[_0x9d41('0x43')]['id']){delete _0x479397[_0x9d41('0x43')]['id'];}return db[_0x9d41('0x29')][_0x9d41('0x44')]({'where':{'id':_0x479397[_0x9d41('0x45')]['id']}})[_0x9d41('0x21')](handleEntityNotFound(_0x2a3b9d,null))[_0x9d41('0x21')](saveUpdates(_0x479397[_0x9d41('0x43')],null))['then'](respondWithResult(_0x2a3b9d,null))[_0x9d41('0x3e')](handleError(_0x2a3b9d,null));};exports[_0x9d41('0x22')]=function(_0x282fdd,_0x384979){return db['UserProfileSection'][_0x9d41('0x44')]({'where':{'id':_0x282fdd['params']['id']}})[_0x9d41('0x21')](handleEntityNotFound(_0x384979,null))[_0x9d41('0x21')](removeEntity(_0x384979,null))[_0x9d41('0x3e')](handleError(_0x384979,null));};exports[_0x9d41('0x46')]=function(_0x289e79,_0xeb562a){return db[_0x9d41('0x29')][_0x9d41('0x46')]()[_0x9d41('0x21')](respondWithResult(_0xeb562a,null))['catch'](handleError(_0xeb562a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 3eea0ca..a923b14 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 _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 +var _0x68a7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','userProfileId'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x68a7,0xb4));var _0x768a=function(_0x574aa3,_0x500410){_0x574aa3=_0x574aa3-0x0;var _0x56d2e0=_0x68a7[_0x574aa3];return _0x56d2e0;};'use strict';var _=require(_0x768a('0x0'));var util=require(_0x768a('0x1'));var logger=require(_0x768a('0x2'))(_0x768a('0x3'));var moment=require(_0x768a('0x4'));var BPromise=require(_0x768a('0x5'));var rp=require(_0x768a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x768a('0x7'));var config=require(_0x768a('0x8'));var attributes=require(_0x768a('0x9'));module[_0x768a('0xa')]=function(_0x23cdb2,_0xbcdaad){return _0x23cdb2[_0x768a('0xb')](_0x768a('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x768a('0xd'),'fields':['sectionId',_0x768a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 190315c..8d9a6f8 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 _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 +var _0xeab5=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x410147,_0x23d579){var _0x56e597=function(_0x3fe37f){while(--_0x3fe37f){_0x410147['push'](_0x410147['shift']());}};_0x56e597(++_0x23d579);}(_0xeab5,0xd4));var _0x5eab=function(_0x28abc4,_0x13b4c1){_0x28abc4=_0x28abc4-0x0;var _0x5f5ca6=_0xeab5[_0x28abc4];return _0x5f5ca6;};'use strict';var _=require(_0x5eab('0x0'));var util=require(_0x5eab('0x1'));var moment=require(_0x5eab('0x2'));var BPromise=require(_0x5eab('0x3'));var rs=require(_0x5eab('0x4'));var fs=require('fs');var Redis=require(_0x5eab('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5eab('0x6'));var config=require(_0x5eab('0x7'));var jayson=require(_0x5eab('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4777,_0x5647ec,_0x35b53c){return new BPromise(function(_0x20f6af,_0x3c67a5){return client[_0x5eab('0x9')](_0x4d4777,_0x35b53c)[_0x5eab('0xa')](function(_0x26ada0){logger[_0x5eab('0xb')](_0x5eab('0xc'),_0x5647ec,_0x5eab('0xd'));logger[_0x5eab('0xe')](_0x5eab('0xf'),_0x5647ec,_0x5eab('0xd'),JSON[_0x5eab('0x10')](_0x26ada0));if(_0x26ada0['error']){if(_0x26ada0['error'][_0x5eab('0x11')]===0x1f4){logger[_0x5eab('0x12')](_0x5eab('0xc'),_0x5647ec,_0x26ada0[_0x5eab('0x12')]['message']);return _0x3c67a5(_0x26ada0[_0x5eab('0x12')]['message']);}logger[_0x5eab('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x5647ec,_0x26ada0['error'][_0x5eab('0x13')]);return _0x20f6af(_0x26ada0['error']['message']);}else{logger[_0x5eab('0xb')](_0x5eab('0xc'),_0x5647ec,_0x5eab('0xd'));_0x20f6af(_0x26ada0['result']['message']);}})[_0x5eab('0x14')](function(_0x26504a){logger[_0x5eab('0x12')](_0x5eab('0xc'),_0x5647ec,_0x26504a);_0x3c67a5(_0x26504a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b184e5c..62fa98b 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 _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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x87bade,_0x28aa5c){var _0x8ce695=function(_0x318ed6){while(--_0x318ed6){_0x87bade['push'](_0x87bade['shift']());}};_0x8ce695(++_0x28aa5c);}(_0xe706,0xa3));var _0x6e70=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe706[_0x3ff085];return _0x2b68c3;};'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 525e58d..84f4134 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 _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 +var _0x6a26=['exports','INTEGER','sequelize'];(function(_0x4f56d0,_0xbfb7da){var _0x3b0c9d=function(_0x5057df){while(--_0x5057df){_0x4f56d0['push'](_0x4f56d0['shift']());}};_0x3b0c9d(++_0xbfb7da);}(_0x6a26,0x14f));var _0x66a2=function(_0x3d7169,_0x40db5e){_0x3d7169=_0x3d7169-0x0;var _0x39bc66=_0x6a26[_0x3d7169];return _0x39bc66;};'use strict';var Sequelize=require(_0x66a2('0x0'));module[_0x66a2('0x1')]={'penalty':{'type':Sequelize[_0x66a2('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 7ae71d3..02f41f3 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 _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 +var _0x4c60=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','./userSmsQueue.attributes','exports'];(function(_0x107ad7,_0x5a6dc5){var _0x324a92=function(_0x3b6e21){while(--_0x3b6e21){_0x107ad7['push'](_0x107ad7['shift']());}};_0x324a92(++_0x5a6dc5);}(_0x4c60,0xc1));var _0x04c6=function(_0x598063,_0x4552d0){_0x598063=_0x598063-0x0;var _0x330657=_0x4c60[_0x598063];return _0x330657;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'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 da755bb..c5224fb 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 _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 +var _0x30d5=['UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug'];(function(_0x2ce038,_0x20a76f){var _0x32976b=function(_0x3ccfb6){while(--_0x3ccfb6){_0x2ce038['push'](_0x2ce038['shift']());}};_0x32976b(++_0x20a76f);}(_0x30d5,0xa9));var _0x530d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x30d5[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x530d('0x0'));var moment=require(_0x530d('0x1'));var BPromise=require(_0x530d('0x2'));var rs=require(_0x530d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x530d('0x4'))['db'];var utils=require(_0x530d('0x5'));var logger=require('../../config/logger')(_0x530d('0x6'));var config=require('../../config/environment');var jayson=require(_0x530d('0x7'));var client=jayson[_0x530d('0x8')][_0x530d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43608a,_0x164615,_0x2559b0){return new BPromise(function(_0x490a56,_0x1dc69f){return client[_0x530d('0xa')](_0x43608a,_0x2559b0)[_0x530d('0xb')](function(_0x5e2990){logger[_0x530d('0xc')](_0x530d('0xd'),_0x164615,'request\x20sent');logger[_0x530d('0xe')](_0x530d('0xf'),_0x164615,_0x530d('0x10'),JSON[_0x530d('0x11')](_0x5e2990));if(_0x5e2990['error']){if(_0x5e2990[_0x530d('0x12')][_0x530d('0x13')]===0x1f4){logger['error'](_0x530d('0xd'),_0x164615,_0x5e2990[_0x530d('0x12')]['message']);return _0x1dc69f(_0x5e2990[_0x530d('0x12')]['message']);}logger[_0x530d('0x12')](_0x530d('0xd'),_0x164615,_0x5e2990[_0x530d('0x12')]['message']);return _0x490a56(_0x5e2990[_0x530d('0x12')][_0x530d('0x14')]);}else{logger[_0x530d('0xc')](_0x530d('0xd'),_0x164615,_0x530d('0x10'));_0x490a56(_0x5e2990[_0x530d('0x15')]['message']);}})[_0x530d('0x16')](function(_0x4e6dea){logger[_0x530d('0x12')](_0x530d('0xd'),_0x164615,_0x4e6dea);_0x1dc69f(_0x4e6dea);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 7288c1f..7655706 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 _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 +var _0x5975=['sequelize','exports','INTEGER'];(function(_0x458dd7,_0xe5602b){var _0x2a12f3=function(_0x547dee){while(--_0x547dee){_0x458dd7['push'](_0x458dd7['shift']());}};_0x2a12f3(++_0xe5602b);}(_0x5975,0xe1));var _0x5597=function(_0x70835e,_0xc6224b){_0x70835e=_0x70835e-0x0;var _0x3dd38f=_0x5975[_0x70835e];return _0x3dd38f;};'use strict';var Sequelize=require(_0x5597('0x0'));module[_0x5597('0x1')]={'UserId':{'type':Sequelize[_0x5597('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5597('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 816021f..6fa18ff 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(_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 +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x452961,_0x20ac26){var _0x2c4d19=function(_0x5b7607){while(--_0x5b7607){_0x452961['push'](_0x452961['shift']());}};_0x2c4d19(++_0x20ac26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 06be1e1..89dc05c 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x23f1ef,_0x565763){var _0x100409=function(_0x4c5a4b){while(--_0x4c5a4b){_0x23f1ef['push'](_0x23f1ef['shift']());}};_0x100409(++_0x565763);}(_0xe706,0xa3));var _0x6e70=function(_0x17e315,_0x361db6){_0x17e315=_0x17e315-0x0;var _0x3e7afb=_0xe706[_0x17e315];return _0x3e7afb;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b7df390..838b753 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 _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 +var _0xf481=['INTEGER','sequelize','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf481,0x18a));var _0x1f48=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xf481[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0x1f48('0x0'));module[_0x1f48('0x1')]={'penalty':{'type':Sequelize[_0x1f48('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 dc18e4f..99df4dd 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 _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 +var _0xb0ce=['path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3cca1d,_0xc1bf9){var _0x2b8761=function(_0x50898d){while(--_0x50898d){_0x3cca1d['push'](_0x3cca1d['shift']());}};_0x2b8761(++_0xc1bf9);}(_0xb0ce,0x10e));var _0xeb0c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb0ce[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xeb0c('0x0'));var util=require('util');var logger=require(_0xeb0c('0x1'))(_0xeb0c('0x2'));var moment=require(_0xeb0c('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb0c('0x4'));var fs=require('fs');var path=require(_0xeb0c('0x5'));var rimraf=require('rimraf');var config=require(_0xeb0c('0x6'));var attributes=require(_0xeb0c('0x7'));module[_0xeb0c('0x8')]=function(_0x485229,_0x2bc19d){return _0x485229['define'](_0xeb0c('0x9'),attributes,{'tableName':_0xeb0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 181ccf2..87cfed8 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 _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 +var _0xe52d=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x1ce446,_0x413ebf){var _0xdfc5ae=function(_0xb79181){while(--_0xb79181){_0x1ce446['push'](_0x1ce446['shift']());}};_0xdfc5ae(++_0x413ebf);}(_0xe52d,0x6d));var _0xde52=function(_0x3a1f69,_0x33f8b7){_0x3a1f69=_0x3a1f69-0x0;var _0xb5be23=_0xe52d[_0x3a1f69];return _0xb5be23;};'use strict';var _=require('lodash');var util=require(_0xde52('0x0'));var moment=require(_0xde52('0x1'));var BPromise=require(_0xde52('0x2'));var rs=require(_0xde52('0x3'));var fs=require('fs');var Redis=require(_0xde52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xde52('0x5'));var logger=require(_0xde52('0x6'))(_0xde52('0x7'));var config=require(_0xde52('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xde52('0x9')][_0xde52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d9eb6,_0x25d75b,_0x21fdcb){return new BPromise(function(_0x35cbdc,_0x39063b){return client['request'](_0x1d9eb6,_0x21fdcb)[_0xde52('0xb')](function(_0x303f6e){logger[_0xde52('0xc')](_0xde52('0xd'),_0x25d75b,_0xde52('0xe'));logger['debug'](_0xde52('0xf'),_0x25d75b,_0xde52('0xe'),JSON[_0xde52('0x10')](_0x303f6e));if(_0x303f6e[_0xde52('0x11')]){if(_0x303f6e[_0xde52('0x11')][_0xde52('0x12')]===0x1f4){logger[_0xde52('0x11')](_0xde52('0xd'),_0x25d75b,_0x303f6e[_0xde52('0x11')][_0xde52('0x13')]);return _0x39063b(_0x303f6e[_0xde52('0x11')]['message']);}logger[_0xde52('0x11')](_0xde52('0xd'),_0x25d75b,_0x303f6e[_0xde52('0x11')][_0xde52('0x13')]);return _0x35cbdc(_0x303f6e[_0xde52('0x11')][_0xde52('0x13')]);}else{logger[_0xde52('0xc')](_0xde52('0xd'),_0x25d75b,_0xde52('0xe'));_0x35cbdc(_0x303f6e[_0xde52('0x14')][_0xde52('0x13')]);}})[_0xde52('0x15')](function(_0x562715){logger[_0xde52('0x11')](_0xde52('0xd'),_0x25d75b,_0x562715);_0x39063b(_0x562715);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a001327..76899b5 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 _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 +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x19fd3e,_0x340446){var _0x31802e=function(_0x2911f6){while(--_0x2911f6){_0x19fd3e['push'](_0x19fd3e['shift']());}};_0x31802e(++_0x340446);}(_0xedd9,0xfc));var _0x9edd=function(_0x452dd8,_0x54746b){_0x452dd8=_0x452dd8-0x0;var _0x3ab92c=_0xedd9[_0x452dd8];return _0x3ab92c;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2e312f1..26d8023 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 _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 +var _0x4e99=['queue_interface','STRING','sequelize','exports','Required\x20by\x20Asterisk','INTEGER'];(function(_0x56e790,_0x5bec09){var _0x4fa9fa=function(_0x513862){while(--_0x513862){_0x56e790['push'](_0x56e790['shift']());}};_0x4fa9fa(++_0x5bec09);}(_0x4e99,0x110));var _0x94e9=function(_0x2f862e,_0xaa4c6a){_0x2f862e=_0x2f862e-0x0;var _0x592005=_0x4e99[_0x2f862e];return _0x592005;};'use strict';var Sequelize=require(_0x94e9('0x0'));module[_0x94e9('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x94e9('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x94e9('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94e9('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x94e9('0x5')],'allowNull':![],'unique':'queue_interface','comment':_0x94e9('0x2')},'penalty':{'type':Sequelize[_0x94e9('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x94e9('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5a1ede9..dfc9b76 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 _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 +var _0x18fd=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0x18fd,0x90));var _0xd18f=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x18fd[_0x2adfb1];return _0xa52d45;};'use strict';var EventEmitter=require(_0xd18f('0x0'));var UserVoiceQueueRt=require(_0xd18f('0x1'))['db'][_0xd18f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd18f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd18f('0x4'),'afterDestroy':_0xd18f('0x5')};function emitEvent(_0x5f01bc){return function(_0x5d6a18,_0x2f83a1,_0x467bf3){UserVoiceQueueRtEvents['emit'](_0x5f01bc+':'+_0x5d6a18['id'],_0x5d6a18);UserVoiceQueueRtEvents[_0xd18f('0x6')](_0x5f01bc,_0x5d6a18);_0x467bf3(null);};}for(var e in events){if(events[_0xd18f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xd18f('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 4ace60d..2328a8d 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 _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 +var _0xd4b4=['api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger'];(function(_0x341315,_0x62f2e1){var _0x4a1136=function(_0x2d9d14){while(--_0x2d9d14){_0x341315['push'](_0x341315['shift']());}};_0x4a1136(++_0x62f2e1);}(_0xd4b4,0x184));var _0x4d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4d4b('0x0'));var logger=require(_0x4d4b('0x1'))(_0x4d4b('0x2'));var moment=require(_0x4d4b('0x3'));var BPromise=require(_0x4d4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d4b('0x5'));var rimraf=require(_0x4d4b('0x6'));var config=require(_0x4d4b('0x7'));var attributes=require(_0x4d4b('0x8'));module[_0x4d4b('0x9')]=function(_0x2f5bf7,_0x4d5c4f){return _0x2f5bf7[_0x4d4b('0xa')](_0x4d4b('0xb'),attributes,{'tableName':_0x4d4b('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 8d6a569..ebb9779 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 _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 +var _0x069d=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize'];(function(_0x21e90d,_0x10e377){var _0x56e02b=function(_0x3c423f){while(--_0x3c423f){_0x21e90d['push'](_0x21e90d['shift']());}};_0x56e02b(++_0x10e377);}(_0x069d,0x75));var _0xd069=function(_0x3ea5e3,_0x300bb3){_0x3ea5e3=_0x3ea5e3-0x0;var _0x29dcec=_0x069d[_0x3ea5e3];return _0x29dcec;};'use strict';var _=require(_0xd069('0x0'));var util=require(_0xd069('0x1'));var moment=require('moment');var BPromise=require(_0xd069('0x2'));var rs=require(_0xd069('0x3'));var fs=require('fs');var Redis=require(_0xd069('0x4'));var db=require(_0xd069('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd069('0x6'))(_0xd069('0x7'));var config=require(_0xd069('0x8'));var jayson=require(_0xd069('0x9'));var client=jayson[_0xd069('0xa')][_0xd069('0xb')]({'port':0x232a});config[_0xd069('0xc')]=_[_0xd069('0xd')](config[_0xd069('0xc')],{'host':_0xd069('0xe'),'port':0x18eb});var socket=require(_0xd069('0xf'))(new Redis(config['redis']));require(_0xd069('0x10'))[_0xd069('0x11')](socket);function respondWithRpcPromise(_0x5d4457,_0x2c6f63,_0x21c428){return new BPromise(function(_0x329483,_0x375460){return client[_0xd069('0x12')](_0x5d4457,_0x21c428)[_0xd069('0x13')](function(_0x1630b9){logger['info'](_0xd069('0x14'),_0x2c6f63,_0xd069('0x15'));logger[_0xd069('0x16')](_0xd069('0x17'),_0x2c6f63,_0xd069('0x15'),JSON['stringify'](_0x1630b9));if(_0x1630b9[_0xd069('0x18')]){if(_0x1630b9['error'][_0xd069('0x19')]===0x1f4){logger[_0xd069('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c6f63,_0x1630b9[_0xd069('0x18')][_0xd069('0x1a')]);return _0x375460(_0x1630b9[_0xd069('0x18')][_0xd069('0x1a')]);}logger['error'](_0xd069('0x14'),_0x2c6f63,_0x1630b9[_0xd069('0x18')]['message']);return _0x329483(_0x1630b9[_0xd069('0x18')][_0xd069('0x1a')]);}else{logger[_0xd069('0x1b')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c6f63,'request\x20sent');_0x329483(_0x1630b9['result']['message']);}})[_0xd069('0x1c')](function(_0x49a462){logger['error'](_0xd069('0x14'),_0x2c6f63,_0x49a462);_0x375460(_0x49a462);});});}exports[_0xd069('0x1d')]=function(_0x1f8279){var _0x18f27b=this;return new Promise(function(_0x51aac0,_0x2042c1){return db[_0xd069('0x1e')]['findAll']({'raw':_0x1f8279[_0xd069('0x1f')]?_0x1f8279[_0xd069('0x1f')][_0xd069('0x20')]===undefined?!![]:![]:!![],'where':_0x1f8279[_0xd069('0x1f')]?_0x1f8279[_0xd069('0x1f')][_0xd069('0x21')]||null:null,'attributes':[[db[_0xd069('0x22')]['fn'](_0xd069('0x23'),db[_0xd069('0x22')]['fn']('IF',db[_0xd069('0x22')][_0xd069('0x24')](_0xd069('0x25')))),'outboundQueuePauses']]})[_0xd069('0x13')](function(_0x2d2728){logger['info'](_0xd069('0x1d'),_0x1f8279);logger[_0xd069('0x16')](_0xd069('0x1d'),_0x1f8279,JSON['stringify'](_0x2d2728));_0x51aac0(_0x2d2728);})[_0xd069('0x1c')](function(_0x5d16a9){logger[_0xd069('0x18')](_0xd069('0x1d'),_0x5d16a9['message'],_0x1f8279);_0x2042c1(_0x18f27b[_0xd069('0x18')](0x1f4,_0x5d16a9[_0xd069('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 89b634d..a467d23 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 _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 +var _0x5a5a=['emit','length','userVoiceQueueRt:','save','remove','update'];(function(_0x56a314,_0x26aed2){var _0x2b542e=function(_0x1aa53b){while(--_0x1aa53b){_0x56a314['push'](_0x56a314['shift']());}};_0x2b542e(++_0x26aed2);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x10dfdf,_0xd11233){_0x10dfdf=_0x10dfdf-0x0;var _0x2ff0c7=_0x5a5a[_0x10dfdf];return _0x2ff0c7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa5a5('0x0'),_0xa5a5('0x1'),_0xa5a5('0x2')];function createListener(_0x2552b1,_0x42cf19){return function(_0x50c2ad){_0x42cf19[_0xa5a5('0x3')](_0x2552b1,_0x50c2ad);};}function removeListener(_0x3307f1,_0x1fd3f0){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3307f1,_0x1fd3f0);};}exports['register']=function(_0x43943d){for(var _0x1fe96d=0x0,_0x5691f1=events[_0xa5a5('0x4')];_0x1fe96d<_0x5691f1;_0x1fe96d++){var _0xf2ea20=events[_0x1fe96d];var _0x1234c2=createListener(_0xa5a5('0x5')+_0xf2ea20,_0x43943d);UserVoiceQueueRtEvents['on'](_0xf2ea20,_0x1234c2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 38cda67..41a2b0e 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 _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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x29ec32,_0x292c7a){var _0x1a60a5=function(_0x10bf41){while(--_0x10bf41){_0x29ec32['push'](_0x29ec32['shift']());}};_0x1a60a5(++_0x292c7a);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 688bdb9..9f7ea6a 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0xde5f=['INTEGER','sequelize'];(function(_0x1e2f5b,_0x60bf47){var _0x2bb7bc=function(_0x1ddf91){while(--_0x1ddf91){_0x1e2f5b['push'](_0x1e2f5b['shift']());}};_0x2bb7bc(++_0x60bf47);}(_0xde5f,0x83));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfde5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xfde5('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 0ce3990..7f17a97 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 _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 +var _0x0042=['rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2ac46d,_0x30d6e0){var _0x30509e=function(_0x1873f1){while(--_0x1873f1){_0x2ac46d['push'](_0x2ac46d['shift']());}};_0x30509e(++_0x30d6e0);}(_0x0042,0x14a));var _0x2004=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x0042[_0x112fe3];return _0x1ec903;};'use strict';var _=require(_0x2004('0x0'));var util=require(_0x2004('0x1'));var logger=require(_0x2004('0x2'))(_0x2004('0x3'));var moment=require(_0x2004('0x4'));var BPromise=require('bluebird');var rp=require(_0x2004('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2004('0x6'));var config=require(_0x2004('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x2004('0x8')]=function(_0x5be9b1,_0x1d1107){return _0x5be9b1[_0x2004('0x9')](_0x2004('0xa'),attributes,{'tableName':_0x2004('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1cc65f4..7dd93a6 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 _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 +var _0xa429=['jayson/promise','client','http','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x5c81d1,_0x3e1d94){var _0x275777=function(_0x3db1e7){while(--_0x3db1e7){_0x5c81d1['push'](_0x5c81d1['shift']());}};_0x275777(++_0x3e1d94);}(_0xa429,0x189));var _0x9a42=function(_0x292f02,_0x5e8d21){_0x292f02=_0x292f02-0x0;var _0xa199c8=_0xa429[_0x292f02];return _0xa199c8;};'use strict';var _=require(_0x9a42('0x0'));var util=require('util');var moment=require(_0x9a42('0x1'));var BPromise=require(_0x9a42('0x2'));var rs=require(_0x9a42('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a42('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a42('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a42('0x6'));var client=jayson[_0x9a42('0x7')][_0x9a42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7f0a59,_0x46954,_0x51ce9e){return new BPromise(function(_0x282a93,_0x378a49){return client['request'](_0x7f0a59,_0x51ce9e)['then'](function(_0x241e96){logger[_0x9a42('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x46954,_0x9a42('0xa'));logger[_0x9a42('0xb')](_0x9a42('0xc'),_0x46954,_0x9a42('0xa'),JSON[_0x9a42('0xd')](_0x241e96));if(_0x241e96[_0x9a42('0xe')]){if(_0x241e96[_0x9a42('0xe')][_0x9a42('0xf')]===0x1f4){logger[_0x9a42('0xe')](_0x9a42('0x10'),_0x46954,_0x241e96[_0x9a42('0xe')]['message']);return _0x378a49(_0x241e96[_0x9a42('0xe')][_0x9a42('0x11')]);}logger[_0x9a42('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x46954,_0x241e96[_0x9a42('0xe')][_0x9a42('0x11')]);return _0x282a93(_0x241e96['error'][_0x9a42('0x11')]);}else{logger[_0x9a42('0x9')](_0x9a42('0x10'),_0x46954,'request\x20sent');_0x282a93(_0x241e96[_0x9a42('0x12')]['message']);}})['catch'](function(_0x2afd14){logger[_0x9a42('0xe')](_0x9a42('0x10'),_0x46954,_0x2afd14);_0x378a49(_0x2afd14);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e3716b0..8e496d2 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 _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 +var _0x8a1b=['get','index','/:id','isAuthenticated','show','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0xa89eba,_0x3c7334){var _0x4404cc=function(_0x3bbdba){while(--_0x3bbdba){_0xa89eba['push'](_0xa89eba['shift']());}};_0x4404cc(++_0x3c7334);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x46b090,_0x44800d){_0x46b090=_0x46b090-0x0;var _0x3e4f47=_0x8a1b[_0x46b090];return _0x3e4f47;};'use strict';var multer=require(_0xb8a1('0x0'));var util=require(_0xb8a1('0x1'));var path=require('path');var timeout=require(_0xb8a1('0x2'));var express=require(_0xb8a1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8a1('0x4'));var interaction=require(_0xb8a1('0x5'));var config=require(_0xb8a1('0x6'));var controller=require(_0xb8a1('0x7'));router[_0xb8a1('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8a1('0x9')]);router[_0xb8a1('0x8')](_0xb8a1('0xa'),auth[_0xb8a1('0xb')](),controller[_0xb8a1('0xc')]);router['post']('/',auth[_0xb8a1('0xb')](),controller['create']);router['put'](_0xb8a1('0xa'),auth[_0xb8a1('0xb')](),controller['update']);router[_0xb8a1('0xd')]('/:id',auth[_0xb8a1('0xb')](),controller[_0xb8a1('0xe')]);module[_0xb8a1('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5155edd..cb1fd99 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 _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 +var _0xba6e=['name','STRING','sequelize','exports'];(function(_0x1d5470,_0x1a0b8a){var _0x47923d=function(_0x2c1ca3){while(--_0x2c1ca3){_0x1d5470['push'](_0x1d5470['shift']());}};_0x47923d(++_0x1a0b8a);}(_0xba6e,0x12a));var _0xeba6=function(_0x1615de,_0x3294c8){_0x1615de=_0x1615de-0x0;var _0x5b8cdb=_0xba6e[_0x1615de];return _0x5b8cdb;};'use strict';var Sequelize=require(_0xeba6('0x0'));module[_0xeba6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xeba6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeba6('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 07eab79..d93c9bc 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 _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 +var _0xa29b=['hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x86cca5,_0x464179){var _0xb99e8a=function(_0x5e4ab9){while(--_0x5e4ab9){_0x86cca5['push'](_0x86cca5['shift']());}};_0xb99e8a(++_0x464179);}(_0xa29b,0x174));var _0xba29=function(_0x32c57d,_0x4b455a){_0x32c57d=_0x32c57d-0x0;var _0x353d7f=_0xa29b[_0x32c57d];return _0x353d7f;};'use strict';var emlformat=require(_0xba29('0x0'));var rimraf=require(_0xba29('0x1'));var zipdir=require(_0xba29('0x2'));var jsonpatch=require(_0xba29('0x3'));var rp=require(_0xba29('0x4'));var moment=require(_0xba29('0x5'));var BPromise=require(_0xba29('0x6'));var Mustache=require(_0xba29('0x7'));var util=require(_0xba29('0x8'));var path=require(_0xba29('0x9'));var sox=require(_0xba29('0xa'));var csv=require(_0xba29('0xb'));var ejs=require(_0xba29('0xc'));var fs=require('fs');var fs_extra=require(_0xba29('0xd'));var _=require(_0xba29('0xe'));var squel=require(_0xba29('0xf'));var crypto=require('crypto');var jsforce=require(_0xba29('0x10'));var deskjs=require(_0xba29('0x11'));var toCsv=require(_0xba29('0xb'));var querystring=require(_0xba29('0x12'));var Papa=require(_0xba29('0x13'));var Redis=require(_0xba29('0x14'));var authService=require(_0xba29('0x15'));var qs=require(_0xba29('0x16'));var as=require(_0xba29('0x17'));var hardwareService=require(_0xba29('0x18'));var logger=require('../../config/logger')(_0xba29('0x19'));var utils=require('../../config/utils');var config=require(_0xba29('0x1a'));var licenseUtil=require(_0xba29('0x1b'));var db=require(_0xba29('0x1c'))['db'];function respondWithStatusCode(_0x236378,_0x2d103d){_0x2d103d=_0x2d103d||0xcc;return function(_0x2c5d37){if(_0x2c5d37){return _0x236378[_0xba29('0x1d')](_0x2d103d);}return _0x236378[_0xba29('0x1e')](_0x2d103d)[_0xba29('0x1f')]();};}function respondWithResult(_0x42f3e1,_0x3a3d34){_0x3a3d34=_0x3a3d34||0xc8;return function(_0x1948b9){if(_0x1948b9){return _0x42f3e1['status'](_0x3a3d34)[_0xba29('0x20')](_0x1948b9);}};}function respondWithFilteredResult(_0x15ba0d,_0x292805){return function(_0x49817f){if(_0x49817f){var _0x4093d3=typeof _0x292805[_0xba29('0x21')]===_0xba29('0x22')&&typeof _0x292805[_0xba29('0x23')]===_0xba29('0x22');var _0x36dd81=_0x49817f[_0xba29('0x24')];var _0xf37d77=_0x4093d3?0x0:_0x292805[_0xba29('0x21')];var _0x3041e3=_0x4093d3?_0x49817f[_0xba29('0x24')]:_0x292805[_0xba29('0x21')]+_0x292805['limit'];var _0x4de53b;if(_0x3041e3>=_0x36dd81){_0x3041e3=_0x36dd81;_0x4de53b=0xc8;}else{_0x4de53b=0xce;}_0x15ba0d['status'](_0x4de53b);return _0x15ba0d['set'](_0xba29('0x25'),_0xf37d77+'-'+_0x3041e3+'/'+_0x36dd81)[_0xba29('0x20')](_0x49817f);}return null;};}function patchUpdates(_0x2833c5){return function(_0x2c5969){try{jsonpatch['apply'](_0x2c5969,_0x2833c5,!![]);}catch(_0x5cc556){return BPromise[_0xba29('0x26')](_0x5cc556);}return _0x2c5969[_0xba29('0x27')]();};}function saveUpdates(_0x408fa9,_0x4ce714){return function(_0x161e4d){if(_0x161e4d){return _0x161e4d[_0xba29('0x28')](_0x408fa9)[_0xba29('0x29')](function(_0x3e2ad3){return _0x3e2ad3;});}return null;};}function removeEntity(_0x26ce86,_0x30d888){return function(_0x5d9f95){if(_0x5d9f95){return _0x5d9f95[_0xba29('0x2a')]()['then'](function(){var _0xc89452=_0x5d9f95[_0xba29('0x2b')]({'plain':!![]});var _0x1cc9ea=_0xba29('0x2c');return db[_0xba29('0x2d')][_0xba29('0x2a')]({'where':{'type':_0x1cc9ea,'resourceId':_0xc89452['id']}})[_0xba29('0x29')](function(){return _0x5d9f95;});})[_0xba29('0x29')](function(){_0x26ce86['status'](0xcc)[_0xba29('0x1f')]();});}};}function handleEntityNotFound(_0x4610e4,_0x4404b0){return function(_0x3fef92){if(!_0x3fef92){_0x4610e4[_0xba29('0x1d')](0x194);}return _0x3fef92;};}function handleError(_0xa5e111,_0x2fe859){_0x2fe859=_0x2fe859||0x1f4;return function(_0x14b9ff){logger[_0xba29('0x2e')](_0x14b9ff[_0xba29('0x2f')]);if(_0x14b9ff[_0xba29('0x30')]){delete _0x14b9ff[_0xba29('0x30')];}_0xa5e111[_0xba29('0x1e')](_0x2fe859)[_0xba29('0x31')](_0x14b9ff);};}exports[_0xba29('0x32')]=function(_0x37104f,_0x5a08f9){var _0x1f1548={},_0x170cc5={},_0x13a0be={'count':0x0,'rows':[]};var _0x4f10df=_[_0xba29('0x33')](db[_0xba29('0x34')]['rawAttributes'],function(_0xb75da1){return{'name':_0xb75da1[_0xba29('0x35')],'type':_0xb75da1[_0xba29('0x36')]['key']};});_0x170cc5[_0xba29('0x37')]=_[_0xba29('0x33')](_0x4f10df,_0xba29('0x30'));_0x170cc5[_0xba29('0x38')]=_[_0xba29('0x39')](_0x37104f['query']);_0x170cc5[_0xba29('0x3a')]=_[_0xba29('0x3b')](_0x170cc5[_0xba29('0x37')],_0x170cc5[_0xba29('0x38')]);_0x1f1548['attributes']=_[_0xba29('0x3b')](_0x170cc5[_0xba29('0x37')],qs[_0xba29('0x3c')](_0x37104f[_0xba29('0x38')][_0xba29('0x3c')]));_0x1f1548['attributes']=_0x1f1548[_0xba29('0x3d')][_0xba29('0x3e')]?_0x1f1548[_0xba29('0x3d')]:_0x170cc5['model'];if(!_0x37104f[_0xba29('0x38')][_0xba29('0x3f')]('nolimit')){_0x1f1548[_0xba29('0x23')]=qs[_0xba29('0x23')](_0x37104f[_0xba29('0x38')]['limit']);_0x1f1548['offset']=qs['offset'](_0x37104f['query'][_0xba29('0x21')]);}_0x1f1548[_0xba29('0x40')]=qs[_0xba29('0x41')](_0x37104f[_0xba29('0x38')][_0xba29('0x41')]);_0x1f1548[_0xba29('0x42')]=qs[_0xba29('0x3a')](_[_0xba29('0x43')](_0x37104f[_0xba29('0x38')],_0x170cc5[_0xba29('0x3a')]),_0x4f10df);if(_0x37104f['query'][_0xba29('0x44')]){_0x1f1548[_0xba29('0x42')]=_['merge'](_0x1f1548[_0xba29('0x42')],{'$or':_[_0xba29('0x33')](_0x4f10df,function(_0x236c68){if(_0x236c68[_0xba29('0x36')]!==_0xba29('0x45')){var _0x5c59be={};_0x5c59be[_0x236c68[_0xba29('0x30')]]={'$like':'%'+_0x37104f[_0xba29('0x38')]['filter']+'%'};return _0x5c59be;}})});}_0x1f1548=_[_0xba29('0x46')]({},_0x1f1548,_0x37104f[_0xba29('0x47')]);var _0x17f8d8={'where':_0x1f1548['where']};return db['Variable'][_0xba29('0x24')](_0x17f8d8)[_0xba29('0x29')](function(_0x201579){_0x13a0be[_0xba29('0x24')]=_0x201579;if(_0x37104f['query'][_0xba29('0x48')]){_0x1f1548['include']=[{'all':!![]}];}return db[_0xba29('0x34')][_0xba29('0x49')](_0x1f1548);})[_0xba29('0x29')](function(_0x490e5a){_0x13a0be[_0xba29('0x4a')]=_0x490e5a;return _0x13a0be;})[_0xba29('0x29')](respondWithFilteredResult(_0x5a08f9,_0x1f1548))[_0xba29('0x4b')](handleError(_0x5a08f9,null));};exports[_0xba29('0x4c')]=function(_0x58d38f,_0x4f314e){var _0x26e4a7={'raw':!![],'where':{'id':_0x58d38f[_0xba29('0x4d')]['id']}},_0x426eb3={};_0x426eb3['model']=_[_0xba29('0x39')](db[_0xba29('0x34')][_0xba29('0x4e')]);_0x426eb3['query']=_[_0xba29('0x39')](_0x58d38f[_0xba29('0x38')]);_0x426eb3[_0xba29('0x3a')]=_[_0xba29('0x3b')](_0x426eb3[_0xba29('0x37')],_0x426eb3[_0xba29('0x38')]);_0x26e4a7[_0xba29('0x3d')]=_[_0xba29('0x3b')](_0x426eb3['model'],qs[_0xba29('0x3c')](_0x58d38f['query'][_0xba29('0x3c')]));_0x26e4a7[_0xba29('0x3d')]=_0x26e4a7[_0xba29('0x3d')][_0xba29('0x3e')]?_0x26e4a7[_0xba29('0x3d')]:_0x426eb3['model'];if(_0x58d38f['query']['includeAll']){_0x26e4a7['include']=[{'all':!![]}];}_0x26e4a7=_[_0xba29('0x46')]({},_0x26e4a7,_0x58d38f[_0xba29('0x47')]);return db[_0xba29('0x34')][_0xba29('0x4f')](_0x26e4a7)[_0xba29('0x29')](handleEntityNotFound(_0x4f314e,null))['then'](respondWithResult(_0x4f314e,null))[_0xba29('0x4b')](handleError(_0x4f314e,null));};exports[_0xba29('0x50')]=function(_0x94d81c,_0x2385b8){return db['Variable'][_0xba29('0x50')](_0x94d81c[_0xba29('0x51')],{})[_0xba29('0x29')](function(_0x3685db){var _0x1ce564=_0x94d81c[_0xba29('0x52')]['get']({'plain':!![]});if(!_0x1ce564)throw new Error(_0xba29('0x53'));if(_0x1ce564['role']===_0xba29('0x52')){var _0x4e19e9=_0x3685db[_0xba29('0x2b')]({'plain':!![]});var _0x4661be=_0xba29('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x4661be,'userProfileId':_0x1ce564[_0xba29('0x54')]},'raw':!![]})[_0xba29('0x29')](function(_0x1659d9){if(_0x1659d9&&_0x1659d9[_0xba29('0x55')]===0x0){return db[_0xba29('0x2d')]['create']({'name':_0x4e19e9['name'],'resourceId':_0x4e19e9['id'],'type':_0x1659d9[_0xba29('0x30')],'sectionId':_0x1659d9['id']},{})['then'](function(){return _0x3685db;});}else{return _0x3685db;}})['catch'](function(_0x2c48c5){logger['error'](_0xba29('0x56'),_0x2c48c5);throw _0x2c48c5;});}return _0x3685db;})['then'](respondWithResult(_0x2385b8,0xc9))['catch'](handleError(_0x2385b8,null));};exports[_0xba29('0x28')]=function(_0x4d7df3,_0x3e3366){if(_0x4d7df3[_0xba29('0x51')]['id']){delete _0x4d7df3['body']['id'];}return db['Variable']['find']({'where':{'id':_0x4d7df3[_0xba29('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e3366,null))[_0xba29('0x29')](saveUpdates(_0x4d7df3[_0xba29('0x51')],null))[_0xba29('0x29')](respondWithResult(_0x3e3366,null))[_0xba29('0x4b')](handleError(_0x3e3366,null));};exports['destroy']=function(_0x18a195,_0x37f87b){return db[_0xba29('0x34')]['find']({'where':{'id':_0x18a195['params']['id']}})[_0xba29('0x29')](handleEntityNotFound(_0x37f87b,null))[_0xba29('0x29')](removeEntity(_0x37f87b,null))['catch'](handleError(_0x37f87b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e071551..dac6ddc 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 _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 +var _0x1c61=['Variable','tools_variables','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0xe261ee,_0x2a2183){var _0x1e06b3=function(_0x41fdf6){while(--_0x41fdf6){_0xe261ee['push'](_0xe261ee['shift']());}};_0x1e06b3(++_0x2a2183);}(_0x1c61,0x9c));var _0x11c6=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x1c61[_0x502953];return _0x2fa32d;};'use strict';var _=require('lodash');var util=require(_0x11c6('0x0'));var logger=require('../../config/logger')(_0x11c6('0x1'));var moment=require(_0x11c6('0x2'));var BPromise=require(_0x11c6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11c6('0x4'));var rimraf=require(_0x11c6('0x5'));var config=require(_0x11c6('0x6'));var attributes=require('./variable.attributes');module[_0x11c6('0x7')]=function(_0x5e6c28,_0x4c86ca){return _0x5e6c28[_0x11c6('0x8')](_0x11c6('0x9'),attributes,{'tableName':_0x11c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 6fb9158..05f50d7 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_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 +var _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x49ed32,_0x573235){var _0x5f04c1=function(_0x35e88b){while(--_0x35e88b){_0x49ed32['push'](_0x49ed32['shift']());}};_0x5f04c1(++_0x573235);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4b84[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ac4cb04..e7b80ef 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 _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 +var _0x6861=['./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','/migrations','migrations','express','Router'];(function(_0xb260f8,_0xc008c5){var _0x63096d=function(_0x27fb13){while(--_0x27fb13){_0xb260f8['push'](_0xb260f8['shift']());}};_0x63096d(++_0xc008c5);}(_0x6861,0x10f));var _0x1686=function(_0x54c4f4,_0x186a48){_0x54c4f4=_0x54c4f4-0x0;var _0x30f393=_0x6861[_0x54c4f4];return _0x30f393;};'use strict';var express=require(_0x1686('0x0'));var router=express[_0x1686('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1686('0x2'));router[_0x1686('0x3')]('/',controller[_0x1686('0x4')]);router[_0x1686('0x3')](_0x1686('0x5'),auth[_0x1686('0x6')](),auth[_0x1686('0x7')](),controller['fetch']);router[_0x1686('0x3')](_0x1686('0x8'),auth[_0x1686('0x6')](),auth['canUpdate'](),controller[_0x1686('0x9')]);router[_0x1686('0x3')](_0x1686('0xa'),auth[_0x1686('0x6')](),auth[_0x1686('0x7')](),controller['pull']);router[_0x1686('0x3')]('/restart',auth[_0x1686('0x6')](),controller['restart']);router[_0x1686('0x3')](_0x1686('0xb'),controller[_0x1686('0xc')]);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 757868c..b9ef889 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 _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 +var _0x0616=['FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','version','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.','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','json','origin','error','info','git\x20fetch','status','reset','--hard'];(function(_0x2ce9c3,_0x20a165){var _0x109b3a=function(_0xfd90e2){while(--_0xfd90e2){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0x109b3a(++_0x20a165);}(_0x0616,0x18f));var _0x6061=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x0616[_0x11f0e3];return _0x2892e8;};'use strict';var Umzug=require(_0x6061('0x0'));var path=require(_0x6061('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6061('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x6061('0x3'))[_0x6061('0x4')];var db=require(_0x6061('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x6061('0x6'));var logger=require(_0x6061('0x7'))(_0x6061('0x8'));var git=require(_0x6061('0x9'))(config[_0x6061('0xa')]);exports[_0x6061('0xb')]=function(_0x3e796f,_0x43f3c5){var _0x1e429b={'current':module[_0x6061('0xc')]['version'],'phonebar':0x2};if(_0x3e796f[_0x6061('0xd')]&&_0x3e796f['query'][_0x6061('0xe')]){return git[_0x6061('0xf')]()[_0x6061('0x10')](function(_0x4fd0f7,_0x5cb1ea){_0x1e429b[_0x6061('0xe')]=(_0x4fd0f7?module[_0x6061('0xc')]['version']:_0x5cb1ea['latest'])||'2.0.0';return _0x43f3c5['status'](0xc8)[_0x6061('0x11')](_0x1e429b);});}else{return _0x43f3c5['status'](0xc8)[_0x6061('0x11')](_0x1e429b);}};exports[_0x6061('0xf')]=function(_0x421499,_0x15b388){return git[_0x6061('0xf')]([_0x6061('0x12'),'master'],function(_0x4b29d9){if(_0x4b29d9){logger[_0x6061('0x13')](_0x4b29d9);return _0x15b388['status'](0x1f4)['json'](_0x4b29d9);}logger[_0x6061('0x14')](_0x6061('0x15'));return _0x15b388[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x6061('0x17')]=function(_0x24b0b7,_0x2a7567){return git['reset']([_0x6061('0x18'),_0x6061('0x19')],function(_0x3cd135){if(_0x3cd135){logger[_0x6061('0x13')](_0x3cd135);return _0x2a7567['status'](0x1f4)[_0x6061('0x11')](_0x3cd135);}logger[_0x6061('0x14')](_0x6061('0x1a'));return _0x2a7567['status'](0xc8)[_0x6061('0x11')]({'output':_0x6061('0x1b')});});};exports[_0x6061('0x1c')]=function(_0x15ac7d,_0x58a7af){exec(_0x6061('0x1d'),function(_0x301e2d,_0x4b36f9,_0x3e506d){logger[_0x6061('0x14')](_0x4b36f9);logger[_0x6061('0x14')](_0x3e506d);if(_0x301e2d){logger[_0x6061('0x13')](_0x301e2d);return _0x58a7af[_0x6061('0x16')](0x1f4)[_0x6061('0x11')](_0x301e2d);}return _0x58a7af[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':_0x4b36f9});});};exports['restart']=function(_0x1562f1,_0xc12544){return pm2[_0x6061('0x1e')](_0x6061('0x1f'))[_0x6061('0x20')](function(_0x4a0242){logger[_0x6061('0x14')](_0x6061('0x21'),_0x4a0242);return _0xc12544[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':_0x6061('0x22')});})[_0x6061('0x23')](function(_0x211215){logger[_0x6061('0x13')](_0x211215);return _0xc12544[_0x6061('0x16')](0x1f4)[_0x6061('0x11')](_0x211215);});};exports['migrations']=function(_0x503bb0,_0x1a8ce8){var _0x22fd23=fs[_0x6061('0x24')](path[_0x6061('0x25')](config[_0x6061('0xa')],_0x6061('0x26'),_0x6061('0x27')));var _0x5b1fc7=[];for(var _0x354201=0x0;_0x354201<_0x22fd23[_0x6061('0x28')];_0x354201++){var _0x32a315=_0x22fd23[_0x354201][_0x6061('0x29')](_0x6061('0x2a'),'');if(compareVersions(module[_0x6061('0xc')][_0x6061('0x2b')],_0x32a315)===-0x1){_0x5b1fc7['push'](_0x32a315);}}if(_0x5b1fc7['length']){var _0x5efaa9=_0x5b1fc7[_0x6061('0x2c')](compareVersions);var _0xd1709=new Umzug({'storage':_0x6061('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0x6061('0x2e'),'columnName':_0x6061('0x2b')},'migrations':{'params':[db[_0x6061('0x2d')][_0x6061('0x2f')](),db[_0x6061('0x2d')][_0x6061('0x30')],function(){throw new Error(_0x6061('0x31'));}],'path':path['join'](config['root'],_0x6061('0x26'),_0x6061('0x27')),'pattern':/\.js$/}});_0xd1709['up']({'migrations':_['map'](_0x5efaa9,function(_0x3af7fb){return _0x3af7fb+_0x6061('0x2a');})})['then'](function(){return _0x1a8ce8[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x6061('0xc')]['version']+_0x6061('0x32')+_[_0x6061('0x33')](_0x5efaa9),'migrations':_[_0x6061('0x25')](_0x5efaa9)});})[_0x6061('0x23')](function(_0x194ce0){if(_0x194ce0 instanceof db['sequelize']['UniqueConstraintError']){return _0x1a8ce8[_0x6061('0x16')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1a8ce8[_0x6061('0x16')](0x1f4)[_0x6061('0x11')](_0x194ce0);}});}else{return _0x1a8ce8[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':_0x6061('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 720ae6b..afe0802 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 _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 +var _0x4788=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4788,0x110));var _0x8478=function(_0x12ca7a,_0x3295bf){_0x12ca7a=_0x12ca7a-0x0;var _0x2249df=_0x4788[_0x12ca7a];return _0x2249df;};'use strict';var multer=require(_0x8478('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8478('0x1'));var router=express[_0x8478('0x2')]();var fs_extra=require(_0x8478('0x3'));var auth=require(_0x8478('0x4'));var interaction=require(_0x8478('0x5'));var config=require(_0x8478('0x6'));var controller=require(_0x8478('0x7'));router[_0x8478('0x8')]('/',auth[_0x8478('0x9')](),controller[_0x8478('0xa')]);router[_0x8478('0x8')](_0x8478('0xb'),auth[_0x8478('0x9')](),controller[_0x8478('0xc')]);router[_0x8478('0x8')]('/:id',auth[_0x8478('0x9')](),controller[_0x8478('0xd')]);router[_0x8478('0xe')]('/',auth[_0x8478('0x9')](),controller[_0x8478('0xf')]);router[_0x8478('0x10')](_0x8478('0x11'),auth[_0x8478('0x9')](),controller['update']);router[_0x8478('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8478('0x13')]);module[_0x8478('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6111005..5e76c29 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 _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 +var _0x9ccd=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x11034c,_0x4248b9){var _0x37aa6a=function(_0x829549){while(--_0x829549){_0x11034c['push'](_0x11034c['shift']());}};_0x37aa6a(++_0x4248b9);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9cc('0x0'));module['exports']={'type':{'type':Sequelize[_0xd9cc('0x1')]},'uniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd9cc('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd9cc('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentconnectAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd9cc('0x2')]},'holdtime':{'type':Sequelize[_0xd9cc('0x3')]},'agentcomplete':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd9cc('0x3')]},'agentacw':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9cc('0x3')]},'reason':{'type':Sequelize[_0xd9cc('0x1')]},'lastevent':{'type':Sequelize[_0xd9cc('0x1')]},'channel':{'type':Sequelize[_0xd9cc('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd9cc('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd9cc('0x1')]},'connectedlinename':{'type':Sequelize[_0xd9cc('0x1')]},'language':{'type':Sequelize[_0xd9cc('0x1')]},'accountcode':{'type':Sequelize[_0xd9cc('0x1')]},'context':{'type':Sequelize[_0xd9cc('0x1')]},'exten':{'type':Sequelize[_0xd9cc('0x1')]},'priority':{'type':Sequelize[_0xd9cc('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd9cc('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd9cc('0x1')]},'destaccountcode':{'type':Sequelize[_0xd9cc('0x1')]},'destcontext':{'type':Sequelize[_0xd9cc('0x1')]},'destexten':{'type':Sequelize[_0xd9cc('0x1')]},'destpriority':{'type':Sequelize[_0xd9cc('0x1')]},'destuniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd9cc('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd9cc('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'agententerreason':{'type':Sequelize[_0xd9cc('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 1d2ad52..00a2968 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(_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 +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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 8d4f301..db2b2d0 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 _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 +var _0x2494=['api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','define','report_agent','uniqueid','destuniqueid','lodash','../../config/logger'];(function(_0x12992b,_0x42b21b){var _0xa9fdde=function(_0x94f16d){while(--_0x94f16d){_0x12992b['push'](_0x12992b['shift']());}};_0xa9fdde(++_0x42b21b);}(_0x2494,0x82));var _0x4249=function(_0x21da34,_0x4b35b7){_0x21da34=_0x21da34-0x0;var _0x2b2f06=_0x2494[_0x21da34];return _0x2b2f06;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[{'fields':[_0x4249('0xa'),_0x4249('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9c56b8b..fa99f5e 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 _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 +var _0xe23f=['debug','UpdateVoiceAgentReport','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw'];(function(_0x145815,_0xfe4fd2){var _0x1fa728=function(_0x13902e){while(--_0x13902e){_0x145815['push'](_0x145815['shift']());}};_0x1fa728(++_0xfe4fd2);}(_0xe23f,0x1d5));var _0xfe23=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe23f[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xfe23('0x0'));var util=require(_0xfe23('0x1'));var moment=require('moment');var BPromise=require(_0xfe23('0x2'));var rs=require(_0xfe23('0x3'));var fs=require('fs');var Redis=require(_0xfe23('0x4'));var db=require(_0xfe23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe23('0x6'))(_0xfe23('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfe23('0x8')][_0xfe23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29c9c8,_0x1c9022,_0x2f470b){return new BPromise(function(_0x2d14eb,_0x4d86d2){return client[_0xfe23('0xa')](_0x29c9c8,_0x2f470b)[_0xfe23('0xb')](function(_0x345a37){logger[_0xfe23('0xc')](_0xfe23('0xd'),_0x1c9022,_0xfe23('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1c9022,_0xfe23('0xe'),JSON[_0xfe23('0xf')](_0x345a37));if(_0x345a37['error']){if(_0x345a37['error'][_0xfe23('0x10')]===0x1f4){logger[_0xfe23('0x11')](_0xfe23('0xd'),_0x1c9022,_0x345a37['error'][_0xfe23('0x12')]);return _0x4d86d2(_0x345a37[_0xfe23('0x11')][_0xfe23('0x12')]);}logger[_0xfe23('0x11')](_0xfe23('0xd'),_0x1c9022,_0x345a37['error'][_0xfe23('0x12')]);return _0x2d14eb(_0x345a37[_0xfe23('0x11')][_0xfe23('0x12')]);}else{logger[_0xfe23('0xc')](_0xfe23('0xd'),_0x1c9022,_0xfe23('0xe'));_0x2d14eb(_0x345a37[_0xfe23('0x13')][_0xfe23('0x12')]);}})[_0xfe23('0x14')](function(_0x51c173){logger[_0xfe23('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x1c9022,_0x51c173);_0x4d86d2(_0x51c173);});});}exports[_0xfe23('0x15')]=function(_0x2b8530){var _0x4c694e=this;return new Promise(function(_0xa58ee6,_0x3d4255){return db[_0xfe23('0x16')][_0xfe23('0x17')](_0x2b8530[_0xfe23('0x18')],{'raw':_0x2b8530['options']?_0x2b8530['options'][_0xfe23('0x19')]===undefined?!![]:![]:!![]})[_0xfe23('0xb')](function(_0x2fed27){logger[_0xfe23('0xc')]('CreateVoiceAgentReport',_0x2b8530);logger[_0xfe23('0x1a')](_0xfe23('0x15'),_0x2b8530,JSON[_0xfe23('0xf')](_0x2fed27));_0xa58ee6(_0x2fed27);})['catch'](function(_0x415772){logger[_0xfe23('0x11')]('CreateVoiceAgentReport',_0x415772[_0xfe23('0x12')],_0x2b8530);_0x3d4255(_0x4c694e['error'](0x1f4,_0x415772[_0xfe23('0x12')]));});});};exports[_0xfe23('0x1b')]=function(_0x2c9bc9){var _0x2bc3b2=this;return new Promise(function(_0x8c32b9,_0x58bc49){return db[_0xfe23('0x16')][_0xfe23('0x1c')](_0x2c9bc9['body'],{'raw':_0x2c9bc9['options']?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9bc9[_0xfe23('0x1d')]?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x1e')]||null:null,'attributes':_0x2c9bc9['options']?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x1f')]||null:null,'limit':_0x2c9bc9['options']?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x20')]||null:null})[_0xfe23('0xb')](function(_0x34f853){logger[_0xfe23('0xc')](_0xfe23('0x1b'),_0x2c9bc9);logger['debug']('UpdateVoiceAgentReport',_0x2c9bc9,JSON['stringify'](_0x34f853));_0x8c32b9(_0x34f853);})[_0xfe23('0x14')](function(_0xd62a92){logger[_0xfe23('0x11')](_0xfe23('0x1b'),_0xd62a92['message'],_0x2c9bc9);_0x58bc49(_0x2bc3b2[_0xfe23('0x11')](0x1f4,_0xd62a92['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 05cf0cb..af5eb3c 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 _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 +var _0xe748=['/with-retry/:id','updateWithRetry','delete','destroy','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe748,0x1e4));var _0x8e74=function(_0x1e4b72,_0x271fa6){_0x1e4b72=_0x1e4b72-0x0;var _0x53a48e=_0xe748[_0x1e4b72];return _0x53a48e;};'use strict';var express=require('express');var router=express[_0x8e74('0x0')]();var auth=require(_0x8e74('0x1'));var controller=require(_0x8e74('0x2'));router[_0x8e74('0x3')]('/',auth[_0x8e74('0x4')](),controller[_0x8e74('0x5')]);router[_0x8e74('0x3')](_0x8e74('0x6'),auth[_0x8e74('0x4')](),controller[_0x8e74('0x7')]);router[_0x8e74('0x3')](_0x8e74('0x8'),auth[_0x8e74('0x4')](),controller[_0x8e74('0x9')]);router[_0x8e74('0xa')]('/',auth[_0x8e74('0x4')](),controller['create']);router[_0x8e74('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8e74('0xb')](_0x8e74('0xc'),auth[_0x8e74('0x4')](),controller[_0x8e74('0xd')]);router[_0x8e74('0xe')](_0x8e74('0x8'),auth[_0x8e74('0x4')](),controller[_0x8e74('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c901b1d..eb558bf 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 _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 +var _0x83d9=['DATE','INTEGER','exports','STRING','ENUM','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x3788c0,_0x4d393b){var _0x22d05b=function(_0x3fd26d){while(--_0x3fd26d){_0x3788c0['push'](_0x3788c0['shift']());}};_0x22d05b(++_0x4d393b);}(_0x83d9,0x134));var _0x983d=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x83d9[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');module[_0x983d('0x0')]={'uniqueid':{'type':Sequelize[_0x983d('0x1')]},'type':{'type':Sequelize[_0x983d('0x2')]('inbound','internal','outbound',_0x983d('0x3'),_0x983d('0x4'),_0x983d('0x5'))},'tag':{'type':Sequelize[_0x983d('0x1')]},'accountcode':{'type':Sequelize[_0x983d('0x1')]},'source':{'type':Sequelize[_0x983d('0x1')]},'destination':{'type':Sequelize[_0x983d('0x1')]},'destinationcontext':{'type':Sequelize[_0x983d('0x1')]},'callerid':{'type':Sequelize[_0x983d('0x1')]},'channel':{'type':Sequelize[_0x983d('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x983d('0x6')]},'starttime':{'type':Sequelize[_0x983d('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x983d('0x7')]},'endtime':{'type':Sequelize[_0x983d('0x7')]},'duration':{'type':Sequelize[_0x983d('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x983d('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x983d('0x1')]},'amaflags':{'type':Sequelize[_0x983d('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x983d('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x983d('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 25ce5b2..3d643f2 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 _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 +var _0xcefd=['send','map','VoiceCallReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','options','alias','User','rows','catch','params','rawAttributes','find','create','body','describe','update','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','promise-retry','status','json','offset','limit','undefined','count','Content-Range','destroy','then','end','sendStatus','error','name'];(function(_0x4c50da,_0x1b8eec){var _0x33add6=function(_0x278235){while(--_0x278235){_0x4c50da['push'](_0x4c50da['shift']());}};_0x33add6(++_0x1b8eec);}(_0xcefd,0x126));var _0xdcef=function(_0x25096c,_0x4b39ad){_0x25096c=_0x25096c-0x0;var _0x20319d=_0xcefd[_0x25096c];return _0x20319d;};'use strict';var _=require(_0xdcef('0x0'));var qs=require(_0xdcef('0x1'));var logger=require(_0xdcef('0x2'))('api');var db=require(_0xdcef('0x3'))['db'];const promiseRetry=require(_0xdcef('0x4'));function respondWithResult(_0x47794f,_0x4ad13c){_0x4ad13c=_0x4ad13c||0xc8;return function(_0x142261){if(_0x142261){return _0x47794f[_0xdcef('0x5')](_0x4ad13c)[_0xdcef('0x6')](_0x142261);}};}function respondWithFilteredResult(_0x47a1fd,_0x2043a4){return function(_0xcaa40a){if(_0xcaa40a){var _0x3fb1b7=typeof _0x2043a4[_0xdcef('0x7')]==='undefined'&&typeof _0x2043a4[_0xdcef('0x8')]===_0xdcef('0x9');var _0x2ad7b0=_0xcaa40a[_0xdcef('0xa')];var _0x5d601b=_0x3fb1b7?0x0:_0x2043a4[_0xdcef('0x7')];var _0x451606=_0x3fb1b7?_0xcaa40a[_0xdcef('0xa')]:_0x2043a4[_0xdcef('0x7')]+_0x2043a4[_0xdcef('0x8')];var _0x275513;if(_0x451606>=_0x2ad7b0){_0x451606=_0x2ad7b0;_0x275513=0xc8;}else{_0x275513=0xce;}_0x47a1fd['status'](_0x275513);return _0x47a1fd['set'](_0xdcef('0xb'),_0x5d601b+'-'+_0x451606+'/'+_0x2ad7b0)[_0xdcef('0x6')](_0xcaa40a);}return null;};}function saveUpdates(_0x5a9032){return function(_0x57d9b3){if(_0x57d9b3){return _0x57d9b3['update'](_0x5a9032)['then'](function(_0x1c2aae){return _0x1c2aae;});}return null;};}function removeEntity(_0x1dfbf1){return function(_0x28418f){if(_0x28418f){return _0x28418f[_0xdcef('0xc')]()[_0xdcef('0xd')](function(){_0x1dfbf1[_0xdcef('0x5')](0xcc)[_0xdcef('0xe')]();});}};}function handleEntityNotFound(_0x4227d8){return function(_0x5e8e31){if(!_0x5e8e31){_0x4227d8[_0xdcef('0xf')](0x194);}return _0x5e8e31;};}function handleError(_0x412680,_0x173fd8){_0x173fd8=_0x173fd8||0x1f4;return function(_0x5b7237){logger[_0xdcef('0x10')](_0x5b7237['stack']);if(_0x5b7237[_0xdcef('0x11')]){delete _0x5b7237[_0xdcef('0x11')];}_0x412680[_0xdcef('0x5')](_0x173fd8)[_0xdcef('0x12')](_0x5b7237);};}exports['index']=function(_0x4e320e,_0xe8e3a3){var _0x19283a={},_0x40e53e={},_0x3d5641={'count':0x0,'rows':[]};var _0x682052=_[_0xdcef('0x13')](db[_0xdcef('0x14')]['rawAttributes'],function(_0x417de7){return{'name':_0x417de7[_0xdcef('0x15')],'type':_0x417de7['type'][_0xdcef('0x16')]};});_0x40e53e[_0xdcef('0x17')]=_[_0xdcef('0x13')](_0x682052,_0xdcef('0x11'));_0x40e53e[_0xdcef('0x18')]=_[_0xdcef('0x19')](_0x4e320e[_0xdcef('0x18')]);_0x40e53e[_0xdcef('0x1a')]=_[_0xdcef('0x1b')](_0x40e53e[_0xdcef('0x17')],_0x40e53e[_0xdcef('0x18')]);_0x19283a[_0xdcef('0x1c')]=_[_0xdcef('0x1b')](_0x40e53e[_0xdcef('0x17')],qs['fields'](_0x4e320e[_0xdcef('0x18')][_0xdcef('0x1d')]));_0x19283a[_0xdcef('0x1c')]=_0x19283a[_0xdcef('0x1c')][_0xdcef('0x1e')]?_0x19283a[_0xdcef('0x1c')]:_0x40e53e[_0xdcef('0x17')];if(!_0x4e320e[_0xdcef('0x18')][_0xdcef('0x1f')](_0xdcef('0x20'))){_0x19283a['limit']=qs['limit'](_0x4e320e['query'][_0xdcef('0x8')]);_0x19283a[_0xdcef('0x7')]=qs[_0xdcef('0x7')](_0x4e320e[_0xdcef('0x18')][_0xdcef('0x7')]);}_0x19283a['order']=qs[_0xdcef('0x21')](_0x4e320e['query'][_0xdcef('0x21')]);_0x19283a[_0xdcef('0x22')]=qs[_0xdcef('0x1a')](_['pick'](_0x4e320e[_0xdcef('0x18')],_0x40e53e[_0xdcef('0x1a')]),_0x682052);if(_0x4e320e['query']['filter']){_0x19283a[_0xdcef('0x22')]=_[_0xdcef('0x23')](_0x19283a[_0xdcef('0x22')],{'$or':_[_0xdcef('0x13')](_0x682052,function(_0x3c1e51){if(_0x3c1e51[_0xdcef('0x24')]!=='VIRTUAL'){var _0xa099cf={};_0xa099cf[_0x3c1e51['name']]={'$like':'%'+_0x4e320e[_0xdcef('0x18')]['filter']+'%'};return _0xa099cf;}})});}_0x19283a=_['merge']({},_0x19283a,_0x4e320e[_0xdcef('0x25')]);var _0x307312={'where':_0x19283a[_0xdcef('0x22')]};return db[_0xdcef('0x14')]['count'](_0x307312)['then'](function(_0x4a0b37){_0x3d5641[_0xdcef('0xa')]=_0x4a0b37;if(_0x4e320e[_0xdcef('0x18')]['includeAll']){_0x19283a['include']=[{'attributes':['id',_0xdcef('0x11'),'fullname',_0xdcef('0x26')],'model':db[_0xdcef('0x27')],'as':_0xdcef('0x27')}];}return db[_0xdcef('0x14')]['findAll'](_0x19283a);})[_0xdcef('0xd')](function(_0x3f64f4){_0x3d5641[_0xdcef('0x28')]=_0x3f64f4;return _0x3d5641;})[_0xdcef('0xd')](respondWithFilteredResult(_0xe8e3a3,_0x19283a))[_0xdcef('0x29')](handleError(_0xe8e3a3,null));};exports['show']=function(_0x55d100,_0x41b760){var _0x395359={'raw':!![],'where':{'id':_0x55d100[_0xdcef('0x2a')]['id']}},_0x3b6cca={};_0x3b6cca[_0xdcef('0x17')]=_[_0xdcef('0x19')](db[_0xdcef('0x14')][_0xdcef('0x2b')]);_0x3b6cca[_0xdcef('0x18')]=_['keys'](_0x55d100[_0xdcef('0x18')]);_0x3b6cca[_0xdcef('0x1a')]=_[_0xdcef('0x1b')](_0x3b6cca['model'],_0x3b6cca[_0xdcef('0x18')]);_0x395359[_0xdcef('0x1c')]=_['intersection'](_0x3b6cca[_0xdcef('0x17')],qs['fields'](_0x55d100[_0xdcef('0x18')][_0xdcef('0x1d')]));_0x395359[_0xdcef('0x1c')]=_0x395359[_0xdcef('0x1c')][_0xdcef('0x1e')]?_0x395359[_0xdcef('0x1c')]:_0x3b6cca[_0xdcef('0x17')];if(_0x55d100[_0xdcef('0x18')]['includeAll']){_0x395359['include']=[{'all':!![]}];}_0x395359=_[_0xdcef('0x23')]({},_0x395359,_0x55d100[_0xdcef('0x25')]);return db[_0xdcef('0x14')][_0xdcef('0x2c')](_0x395359)['then'](handleEntityNotFound(_0x41b760,null))[_0xdcef('0xd')](respondWithResult(_0x41b760,null))[_0xdcef('0x29')](handleError(_0x41b760,null));};exports[_0xdcef('0x2d')]=function(_0xf89adc,_0x187abe){return db[_0xdcef('0x14')][_0xdcef('0x2d')](_0xf89adc[_0xdcef('0x2e')],{})[_0xdcef('0xd')](respondWithResult(_0x187abe,0xc9))[_0xdcef('0x29')](handleError(_0x187abe,null));};exports[_0xdcef('0xc')]=function(_0x333b3f,_0x3bcf49){return db[_0xdcef('0x14')][_0xdcef('0x2c')]({'where':{'id':_0x333b3f['params']['id']}})[_0xdcef('0xd')](handleEntityNotFound(_0x3bcf49,null))[_0xdcef('0xd')](removeEntity(_0x3bcf49,null))[_0xdcef('0x29')](handleError(_0x3bcf49,null));};exports[_0xdcef('0x2f')]=function(_0x45f71c,_0x45c1b6){return db[_0xdcef('0x14')][_0xdcef('0x2f')]()[_0xdcef('0xd')](respondWithResult(_0x45c1b6,null))[_0xdcef('0x29')](handleError(_0x45c1b6,null));};function findForUpdate(_0x31cdc5){return db[_0xdcef('0x14')]['find']({'where':{'uniqueid':_0x31cdc5[_0xdcef('0x2a')]['id'],'UserId':{'$or':[null,_0x31cdc5['user']['id']]}}});}exports[_0xdcef('0x30')]=function(_0x2febe5,_0x53be2e){if(_0x2febe5[_0xdcef('0x2e')][_0xdcef('0x31')]){delete _0x2febe5[_0xdcef('0x2e')]['uniqueid'];}return findForUpdate(_0x2febe5)[_0xdcef('0xd')](handleEntityNotFound(_0x53be2e,null))['then'](saveUpdates(_0x2febe5[_0xdcef('0x2e')],null))['then'](respondWithResult(_0x53be2e,null))['catch'](handleError(_0x53be2e,null));};exports[_0xdcef('0x32')]=function(_0x4a1aa1,_0x5df03e,_0x2a028c){if(_0x4a1aa1[_0xdcef('0x2e')][_0xdcef('0x31')]){delete _0x4a1aa1[_0xdcef('0x2e')][_0xdcef('0x31')];}promiseRetry(function(_0x1bf3e9){return findForUpdate(_0x4a1aa1)[_0xdcef('0xd')](function(_0x257023){if(_0x257023!==null){return _0x257023;}else{_0x1bf3e9(new Error(_0xdcef('0x33')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x4b4f5c){if(!_0x4b4f5c){return new Promise(function(_0x3e5694){_0x3e5694(handleEntityNotFound(_0x5df03e)());});}else{return _0x4b4f5c[_0xdcef('0x30')](_0x4a1aa1[_0xdcef('0x2e')])['then'](function(_0x5cb340){return respondWithResult(_0x5df03e)(_0x5cb340);});}},function(){handleEntityNotFound(_0x5df03e)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a036417..b80ce79 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 _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 +var _0x2504=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','report_call','uniqueid'];(function(_0x15fb14,_0x1792ca){var _0x5e4e0c=function(_0x531d85){while(--_0x531d85){_0x15fb14['push'](_0x15fb14['shift']());}};_0x5e4e0c(++_0x1792ca);}(_0x2504,0xee));var _0x4250=function(_0x3579c6,_0x15f2cc){_0x3579c6=_0x3579c6-0x0;var _0x4e99b3=_0x2504[_0x3579c6];return _0x4e99b3;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var logger=require(_0x4250('0x2'))(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var BPromise=require(_0x4250('0x5'));var rp=require(_0x4250('0x6'));var fs=require('fs');var path=require(_0x4250('0x7'));var rimraf=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var attributes=require(_0x4250('0xa'));module[_0x4250('0xb')]=function(_0x493da9,_0x473cb8){return _0x493da9['define']('VoiceCallReport',attributes,{'tableName':_0x4250('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4250('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 0345187..7a69711 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 _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 +var _0xe2bc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceCallReport','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird'];(function(_0x3dc1e9,_0x20484c){var _0x1a8e32=function(_0x3248a1){while(--_0x3248a1){_0x3dc1e9['push'](_0x3dc1e9['shift']());}};_0x1a8e32(++_0x20484c);}(_0xe2bc,0x196));var _0xce2b=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe2bc[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xce2b('0x0'));var util=require(_0xce2b('0x1'));var moment=require(_0xce2b('0x2'));var BPromise=require(_0xce2b('0x3'));var rs=require(_0xce2b('0x4'));var fs=require('fs');var Redis=require(_0xce2b('0x5'));var db=require(_0xce2b('0x6'))['db'];var utils=require(_0xce2b('0x7'));var logger=require(_0xce2b('0x8'))('rpc');var config=require(_0xce2b('0x9'));var jayson=require(_0xce2b('0xa'));var client=jayson[_0xce2b('0xb')][_0xce2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x194823,_0xc75057,_0x31c343){return new BPromise(function(_0x4fa3c4,_0x2e3771){return client[_0xce2b('0xd')](_0x194823,_0x31c343)['then'](function(_0x44573c){logger['info'](_0xce2b('0xe'),_0xc75057,'request\x20sent');logger[_0xce2b('0xf')](_0xce2b('0x10'),_0xc75057,_0xce2b('0x11'),JSON[_0xce2b('0x12')](_0x44573c));if(_0x44573c['error']){if(_0x44573c[_0xce2b('0x13')][_0xce2b('0x14')]===0x1f4){logger[_0xce2b('0x13')](_0xce2b('0xe'),_0xc75057,_0x44573c[_0xce2b('0x13')][_0xce2b('0x15')]);return _0x2e3771(_0x44573c[_0xce2b('0x13')][_0xce2b('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xc75057,_0x44573c[_0xce2b('0x13')][_0xce2b('0x15')]);return _0x4fa3c4(_0x44573c['error'][_0xce2b('0x15')]);}else{logger[_0xce2b('0x16')](_0xce2b('0xe'),_0xc75057,_0xce2b('0x11'));_0x4fa3c4(_0x44573c[_0xce2b('0x17')][_0xce2b('0x15')]);}})[_0xce2b('0x18')](function(_0x3be161){logger[_0xce2b('0x13')](_0xce2b('0xe'),_0xc75057,_0x3be161);_0x2e3771(_0x3be161);});});}exports['GetVoiceCallReport']=function(_0x84773d){var _0x15e57a=this;return new Promise(function(_0x38f5c9,_0x27cca7){return db[_0xce2b('0x19')][_0xce2b('0x1a')]({'raw':_0x84773d['options']?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1c')]===undefined?!![]:![]:!![],'where':_0x84773d[_0xce2b('0x1b')]?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1d')]||null:null,'attributes':_0x84773d['options']?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1e')]||null:null,'limit':_0x84773d[_0xce2b('0x1b')]?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1f')]||null:null,'include':_0x84773d[_0xce2b('0x1b')]?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x20')]?_['map'](_0x84773d[_0xce2b('0x1b')][_0xce2b('0x20')],function(_0x1a2275){return{'model':db[_0x1a2275['model']],'as':_0x1a2275['as'],'attributes':_0x1a2275[_0xce2b('0x1e')],'include':_0x1a2275[_0xce2b('0x20')]?_[_0xce2b('0x21')](_0x1a2275[_0xce2b('0x20')],function(_0x2e6d83){return{'model':db[_0x2e6d83[_0xce2b('0x22')]],'as':_0x2e6d83['as'],'attributes':_0x2e6d83[_0xce2b('0x1e')],'include':_0x2e6d83[_0xce2b('0x20')]?_[_0xce2b('0x21')](_0x2e6d83[_0xce2b('0x20')],function(_0x1394db){return{'model':db[_0x1394db[_0xce2b('0x22')]],'as':_0x1394db['as'],'attributes':_0x1394db['attributes']};}):[]};}):[]};}):[]:[]})[_0xce2b('0x23')](function(_0x2aef29){logger[_0xce2b('0x16')]('GetVoiceCallReport',_0x84773d);logger[_0xce2b('0xf')](_0xce2b('0x24'),_0x84773d,JSON[_0xce2b('0x12')](_0x2aef29));_0x38f5c9(_0x2aef29);})[_0xce2b('0x18')](function(_0x2bfbc7){logger[_0xce2b('0x13')](_0xce2b('0x24'),_0x2bfbc7['message'],_0x84773d);_0x27cca7(_0x15e57a['error'](0x1f4,_0x2bfbc7[_0xce2b('0x15')]));});});};exports[_0xce2b('0x25')]=function(_0x7eebcd){var _0x41048f=this;return new Promise(function(_0xb1d1f5,_0xf960fa){return db[_0xce2b('0x19')]['create'](_0x7eebcd[_0xce2b('0x26')],{'raw':_0x7eebcd['options']?_0x7eebcd[_0xce2b('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xce2b('0x23')](function(_0x3e8f9a){logger[_0xce2b('0x16')](_0xce2b('0x25'),_0x7eebcd);logger['debug'](_0xce2b('0x25'),_0x7eebcd,JSON[_0xce2b('0x12')](_0x3e8f9a));_0xb1d1f5(_0x3e8f9a);})[_0xce2b('0x18')](function(_0x56b22e){logger['error'](_0xce2b('0x25'),_0x56b22e[_0xce2b('0x15')],_0x7eebcd);_0xf960fa(_0x41048f[_0xce2b('0x13')](0x1f4,_0x56b22e['message']));});});};exports[_0xce2b('0x27')]=function(_0x530f32){var _0x5d76a7=this;return new Promise(function(_0x13dc61,_0x4d0b9d){return db[_0xce2b('0x19')][_0xce2b('0x28')](_0x530f32[_0xce2b('0x26')],{'raw':_0x530f32[_0xce2b('0x1b')]?_0x530f32[_0xce2b('0x1b')][_0xce2b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x530f32['options']?_0x530f32['options']['where']||null:null,'attributes':_0x530f32['options']?_0x530f32[_0xce2b('0x1b')][_0xce2b('0x1e')]||null:null,'limit':_0x530f32[_0xce2b('0x1b')]?_0x530f32[_0xce2b('0x1b')]['limit']||null:null})[_0xce2b('0x23')](function(_0x4be9b1){logger[_0xce2b('0x16')](_0xce2b('0x27'),_0x530f32);logger[_0xce2b('0xf')]('UpdateVoiceCallReport',_0x530f32,JSON[_0xce2b('0x12')](_0x4be9b1));_0x13dc61(_0x4be9b1);})[_0xce2b('0x18')](function(_0x18de35){logger['error'](_0xce2b('0x27'),_0x18de35[_0xce2b('0x15')],_0x530f32);_0x4d0b9d(_0x5d76a7['error'](0x1f4,_0x18de35['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 2dd7c6d..914e639 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 _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 +var _0x7539=['show','post','isAuthenticated','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x5a3db1,_0x363264){var _0x17107b=function(_0x502f49){while(--_0x502f49){_0x5a3db1['push'](_0x5a3db1['shift']());}};_0x17107b(++_0x363264);}(_0x7539,0x180));var _0x9753=function(_0x266570,_0x3ee6ac){_0x266570=_0x266570-0x0;var _0x4794c2=_0x7539[_0x266570];return _0x4794c2;};'use strict';var multer=require(_0x9753('0x0'));var util=require('util');var path=require(_0x9753('0x1'));var timeout=require(_0x9753('0x2'));var express=require(_0x9753('0x3'));var router=express[_0x9753('0x4')]();var fs_extra=require(_0x9753('0x5'));var auth=require(_0x9753('0x6'));var interaction=require(_0x9753('0x7'));var config=require(_0x9753('0x8'));var controller=require('./voiceChanSpy.controller');router[_0x9753('0x9')]('/',auth['isAuthenticated'](),controller[_0x9753('0xa')]);router[_0x9753('0x9')](_0x9753('0xb'),auth['isAuthenticated'](),controller[_0x9753('0xc')]);router[_0x9753('0xd')]('/',auth[_0x9753('0xe')](),controller['create']);router[_0x9753('0xf')](_0x9753('0xb'),auth[_0x9753('0xe')](),controller[_0x9753('0x10')]);router['delete']('/:id',auth[_0x9753('0xe')](),controller['destroy']);module[_0x9753('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 22cba64..72572c6 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 _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 +var _0x7f10=['sequelize','exports','STRING','name','setDataValue','options','getDataValue','split','BOOLEAN'];(function(_0x3fa215,_0x3a749a){var _0x2b7668=function(_0x36082a){while(--_0x36082a){_0x3fa215['push'](_0x3fa215['shift']());}};_0x2b7668(++_0x3a749a);}(_0x7f10,0x195));var _0x07f1=function(_0x9f8d7e,_0x2d74b2){_0x9f8d7e=_0x9f8d7e-0x0;var _0x87c913=_0x7f10[_0x9f8d7e];return _0x87c913;};'use strict';var Sequelize=require(_0x07f1('0x0'));module[_0x07f1('0x1')]={'name':{'type':Sequelize[_0x07f1('0x2')]},'prefix':{'type':Sequelize[_0x07f1('0x2')],'unique':_0x07f1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x07f1('0x2')],'set':function(_0x19b3cb){this[_0x07f1('0x4')]('options',_0x19b3cb?_0x19b3cb['join'](''):[]);},'get':function(){return this['getDataValue'](_0x07f1('0x5'))?this[_0x07f1('0x6')](_0x07f1('0x5'))[_0x07f1('0x7')](''):[];}},'auth':{'type':Sequelize[_0x07f1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x07f1('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x07f1('0x2')]},'description':{'type':Sequelize[_0x07f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 79f1f11..48b2736 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 _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 +var _0xcb91=['json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','VoiceChanSpy','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xcb91[_0x22ee1e];return _0x49a5c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){var _0x10a419=_0x55b232[_0x1cb9('0x24')]({'plain':!![]});var _0x69b4c8=_0x1cb9('0x25');return db[_0x1cb9('0x26')]['destroy']({'where':{'type':_0x69b4c8,'resourceId':_0x10a419['id']}})[_0x1cb9('0x22')](function(){return _0x55b232;});})[_0x1cb9('0x22')](function(){_0x27db16['status'](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x21effa,_0x41a9a0){return function(_0x1804fd){if(!_0x1804fd){_0x21effa[_0x1cb9('0x16')](0x194);}return _0x1804fd;};}function handleError(_0x21d6f5,_0x2e28fe){_0x2e28fe=_0x2e28fe||0x1f4;return function(_0xb644b3){logger[_0x1cb9('0x27')](_0xb644b3[_0x1cb9('0x28')]);if(_0xb644b3['name']){delete _0xb644b3[_0x1cb9('0x29')];}_0x21d6f5['status'](_0x2e28fe)[_0x1cb9('0x2a')](_0xb644b3);};}exports['index']=function(_0x278327,_0x41011c){var _0x3cd7f5={},_0x2038aa={},_0x561d89={'count':0x0,'rows':[]};var _0x1c701f=_['map'](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')],function(_0x4220d7){return{'name':_0x4220d7['fieldName'],'type':_0x4220d7[_0x1cb9('0x2d')]['key']};});_0x2038aa[_0x1cb9('0x2e')]=_['map'](_0x1c701f,_0x1cb9('0x29'));_0x2038aa[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x278327[_0x1cb9('0x2f')]);_0x2038aa['filters']=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],_0x2038aa[_0x1cb9('0x2f')]);_0x3cd7f5[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x3cd7f5[_0x1cb9('0x32')]=_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x3cd7f5[_0x1cb9('0x32')]:_0x2038aa['model'];if(!_0x278327['query'][_0x1cb9('0x35')](_0x1cb9('0x36'))){_0x3cd7f5[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x1c')]);_0x3cd7f5[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x278327['query'][_0x1cb9('0x1a')]);}_0x3cd7f5[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x278327['query'][_0x1cb9('0x38')]);_0x3cd7f5['where']=qs[_0x1cb9('0x39')](_['pick'](_0x278327[_0x1cb9('0x2f')],_0x2038aa[_0x1cb9('0x39')]),_0x1c701f);if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x3cd7f5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x3cd7f5[_0x1cb9('0x3b')],{'$or':_['map'](_0x1c701f,function(_0x4ca19e){if(_0x4ca19e[_0x1cb9('0x2d')]!==_0x1cb9('0x3d')){var _0x7a0d8b={};_0x7a0d8b[_0x4ca19e[_0x1cb9('0x29')]]={'$like':'%'+_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x7a0d8b;}})});}_0x3cd7f5=_[_0x1cb9('0x3c')]({},_0x3cd7f5,_0x278327['options']);var _0xbcaa32={'where':_0x3cd7f5['where']};return db['VoiceChanSpy']['count'](_0xbcaa32)[_0x1cb9('0x22')](function(_0x397ff9){_0x561d89[_0x1cb9('0x1d')]=_0x397ff9;if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x3cd7f5['include']=[{'all':!![]}];}return db[_0x1cb9('0x2b')]['findAll'](_0x3cd7f5);})[_0x1cb9('0x22')](function(_0x71db9d){_0x561d89[_0x1cb9('0x3f')]=_0x71db9d;return _0x561d89;})['then'](respondWithFilteredResult(_0x41011c,_0x3cd7f5))[_0x1cb9('0x40')](handleError(_0x41011c,null));};exports['show']=function(_0xda1a44,_0xbc36fc){var _0x51a898={'raw':![],'where':{'id':_0xda1a44[_0x1cb9('0x41')]['id']}},_0x5839aa={};_0x5839aa[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')]);_0x5839aa['query']=_[_0x1cb9('0x30')](_0xda1a44['query']);_0x5839aa['filters']=_['intersection'](_0x5839aa[_0x1cb9('0x2e')],_0x5839aa[_0x1cb9('0x2f')]);_0x51a898[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x5839aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x51a898[_0x1cb9('0x32')]=_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x51a898['attributes']:_0x5839aa[_0x1cb9('0x2e')];if(_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x51a898['include']=[{'all':!![]}];}_0x51a898=_[_0x1cb9('0x3c')]({},_0x51a898,_0xda1a44[_0x1cb9('0x42')]);return db[_0x1cb9('0x2b')][_0x1cb9('0x43')](_0x51a898)[_0x1cb9('0x22')](handleEntityNotFound(_0xbc36fc,null))['then'](respondWithResult(_0xbc36fc,null))[_0x1cb9('0x40')](handleError(_0xbc36fc,null));};exports['create']=function(_0x2eaa11,_0x4ac483){return db[_0x1cb9('0x2b')][_0x1cb9('0x44')](_0x2eaa11[_0x1cb9('0x45')],{})[_0x1cb9('0x22')](function(_0x56d0c5){var _0x298475=_0x2eaa11[_0x1cb9('0x46')][_0x1cb9('0x24')]({'plain':!![]});if(!_0x298475)throw new Error(_0x1cb9('0x47'));if(_0x298475[_0x1cb9('0x48')]===_0x1cb9('0x46')){var _0x17b92a=_0x56d0c5[_0x1cb9('0x24')]({'plain':!![]});var _0xbb500e=_0x1cb9('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xbb500e,'userProfileId':_0x298475[_0x1cb9('0x49')]},'raw':!![]})[_0x1cb9('0x22')](function(_0x19e83a){if(_0x19e83a&&_0x19e83a[_0x1cb9('0x4a')]===0x0){return db[_0x1cb9('0x26')][_0x1cb9('0x44')]({'name':_0x17b92a[_0x1cb9('0x29')],'resourceId':_0x17b92a['id'],'type':_0x19e83a[_0x1cb9('0x29')],'sectionId':_0x19e83a['id']},{})[_0x1cb9('0x22')](function(){return _0x56d0c5;});}else{return _0x56d0c5;}})[_0x1cb9('0x40')](function(_0x4a4b87){logger[_0x1cb9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a4b87);throw _0x4a4b87;});}return _0x56d0c5;})[_0x1cb9('0x22')](respondWithResult(_0x4ac483,0xc9))['catch'](handleError(_0x4ac483,null));};exports[_0x1cb9('0x21')]=function(_0x53c002,_0x5e5174){if(_0x53c002[_0x1cb9('0x45')]['id']){delete _0x53c002[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x2b')]['find']({'where':{'id':_0x53c002[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x5e5174,null))['then'](saveUpdates(_0x53c002['body'],null))[_0x1cb9('0x22')](respondWithResult(_0x5e5174,null))[_0x1cb9('0x40')](handleError(_0x5e5174,null));};exports[_0x1cb9('0x23')]=function(_0x2b3f2a,_0x3de325){return db[_0x1cb9('0x2b')][_0x1cb9('0x43')]({'where':{'id':_0x2b3f2a['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x3de325,null))[_0x1cb9('0x22')](removeEntity(_0x3de325,null))[_0x1cb9('0x40')](handleError(_0x3de325,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 495d655..8212711 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 _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 +var _0x964e=['agent','catch','exports','models','voice_chanspy','then','bulkCreate','destroy','VoiceExtension','lodash','util','bluebird','from-sip','%s%s','prefix','push','merge','Set','format','CDR(type)=%s','record','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll'];(function(_0x3b2879,_0x4071fa){var _0x4f46f0=function(_0x1dc691){while(--_0x1dc691){_0x3b2879['push'](_0x3b2879['shift']());}};_0x4f46f0(++_0x4071fa);}(_0x964e,0x171));var _0xe964=function(_0x30fb62,_0x47f647){_0x30fb62=_0x30fb62-0x0;var _0x13ef16=_0x964e[_0x30fb62];return _0x13ef16;};'use strict';var _=require(_0xe964('0x0'));var util=require(_0xe964('0x1'));var BPromise=require(_0xe964('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x26087e,_0x4a3fb3,_0x4eabc1){var _0x4d5c0a=0x1;var _0x5017f8=[];var _0x1b449f={'context':_0x4a3fb3['context']||_0xe964('0x3'),'exten':util['format'](_0xe964('0x4'),_0x26087e[_0xe964('0x5')],_0x4eabc1),'type':'system','isApp':![],'ChanSpyId':_0x26087e['id'],'UserId':_0x4a3fb3['id']};_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':_0xe964('0x8'),'appdata':util[_0xe964('0x9')](_0xe964('0xa'),'chanspy'),'priority':_0x4d5c0a++},_0x1b449f));if(_0x26087e[_0xe964('0xb')]){_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':'MixMonitor','appdata':util[_0xe964('0x9')](_0xe964('0xc'),_0x26087e['recordingFormat']),'priority':_0x4d5c0a++},_0x1b449f));}if(_0x26087e[_0xe964('0xd')]){_0x5017f8[_0xe964('0x6')](_['merge']({'app':_0xe964('0xe'),'appdata':_0x26087e[_0xe964('0xf')],'priority':_0x4d5c0a++},_0x1b449f));}_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':_0xe964('0x10'),'appdata':util[_0xe964('0x9')](_0xe964('0x11'),_0x4a3fb3[_0xe964('0x12')],_0x26087e[_0xe964('0x13')]?_0x26087e[_0xe964('0x13')][_0xe964('0x14')](''):''),'priority':_0x4d5c0a++},_0x1b449f));if(_0x26087e[_0xe964('0xb')]){_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':_0xe964('0x15'),'priority':_0x4d5c0a++},_0x1b449f));}return _0x5017f8;};var getChanSpyApplications=function(_0x32e3f1,_0x1bbd99){var _0x3d24eb=[];for(var _0x375972=0x0,_0x392bdc=0x1;_0x375972<_0x1bbd99[_0xe964('0x16')];_0x375972++,_0x392bdc=0x1){_0x3d24eb=_0x3d24eb['concat'](getUserApplications(_0x32e3f1,_0x1bbd99[_0x375972],_0x1bbd99[_0x375972][_0xe964('0x17')]));if(_0x1bbd99[_0x375972]['internal']!=_0x1bbd99[_0x375972]['name']){_0x3d24eb=_0x3d24eb[_0xe964('0x18')](getUserApplications(_0x32e3f1,_0x1bbd99[_0x375972],_0x1bbd99[_0x375972]['name']));}}return _0x3d24eb;};var getChanSpyPromise=function(_0x1a5538,_0x1b3afd){return new BPromise(function(_0x5f0a17,_0x544152){return _0x1a5538[_0xe964('0x19')][_0xe964('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0xe964('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x234a5c){if(_0x234a5c){return _0x5f0a17(getChanSpyApplications(_0x1b3afd,_0x234a5c));}return _0x5f0a17([]);})[_0xe964('0x1c')](function(_0x1001f0){_0x544152(_0x1001f0);});});};module[_0xe964('0x1d')]=function(_0xd3e70b,_0x4a7282){var _0x214083=_0xd3e70b[_0xe964('0x1e')];return _0xd3e70b['define']('VoiceChanSpy',attributes,{'tableName':_0xe964('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x36b5d0,_0xcdff5a,_0x15f7bc){return getChanSpyPromise(_0x214083,_0x36b5d0)[_0xe964('0x20')](function(_0x17db9c){if(_0x17db9c&&_0x17db9c[_0xe964('0x16')]){return _0x214083['VoiceExtension'][_0xe964('0x21')](_0x17db9c);}})[_0xe964('0x20')](function(){_0x15f7bc();})['catch'](function(_0x105bc2){_0x15f7bc(_0x105bc2);});},'afterUpdate':function(_0x5b480f,_0x2ec251,_0x1477fc){return _0x214083['VoiceExtension'][_0xe964('0x22')]({'where':{'ChanSpyId':_0x5b480f['id']}})[_0xe964('0x20')](function(){return getChanSpyPromise(_0x214083,_0x5b480f);})[_0xe964('0x20')](function(_0x43c97d){if(_0x43c97d&&_0x43c97d['length']){return _0x214083[_0xe964('0x23')][_0xe964('0x21')](_0x43c97d);}})[_0xe964('0x20')](function(){_0x1477fc();})[_0xe964('0x1c')](function(_0x103eb1){_0x1477fc(_0x103eb1);});},'afterDestroy':function(_0x4c28e1,_0x530d7d,_0x5404e5){return _0x214083['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x4c28e1['id']}})[_0xe964('0x20')](function(){_0x5404e5();})[_0xe964('0x1c')](function(_0x1a7eb4){_0x5404e5(_0x1a7eb4);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4d6a171..5471811 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 _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 +var _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xee5b,0x1f4));var _0xbee5=function(_0x30cce8,_0x469f47){_0x30cce8=_0x30cce8-0x0;var _0x10bc29=_0xee5b[_0x30cce8];return _0x10bc29;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 637b553..3265d30 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 _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 +var _0xea9f=['show','post','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0xea9f,0x125));var _0xfea9=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xea9f[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0xfea9('0x0'));var util=require('util');var path=require(_0xfea9('0x1'));var timeout=require(_0xfea9('0x2'));var express=require(_0xfea9('0x3'));var router=express[_0xfea9('0x4')]();var fs_extra=require(_0xfea9('0x5'));var auth=require(_0xfea9('0x6'));var interaction=require(_0xfea9('0x7'));var config=require(_0xfea9('0x8'));var controller=require(_0xfea9('0x9'));router['get']('/',auth[_0xfea9('0xa')](),controller['index']);router[_0xfea9('0xb')](_0xfea9('0xc'),auth[_0xfea9('0xa')](),controller[_0xfea9('0xd')]);router[_0xfea9('0xe')]('/',auth[_0xfea9('0xa')](),controller['create']);router['put'](_0xfea9('0xc'),auth[_0xfea9('0xa')](),controller[_0xfea9('0xf')]);router['delete'](_0xfea9('0xc'),auth[_0xfea9('0xa')](),controller[_0xfea9('0x10')]);module[_0xfea9('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 1094eaa..afebcd2 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 _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 +var _0x51bc=['exports','name','STRING','BOOLEAN','sequelize'];(function(_0x5531e9,_0x3e0c5b){var _0x6d67d0=function(_0x3a90f0){while(--_0x3a90f0){_0x5531e9['push'](_0x5531e9['shift']());}};_0x6d67d0(++_0x3e0c5b);}(_0x51bc,0x126));var _0xc51b=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x51bc[_0x2becba];return _0x90b5dd;};'use strict';var Sequelize=require(_0xc51b('0x0'));module[_0xc51b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc51b('0x2')},'description':{'type':Sequelize[_0xc51b('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc51b('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 b4ae876..0529534 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 _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 +var _0x2937=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','name','index','map','VoiceContext','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','body','findAll','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','create','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf'];(function(_0xa09a12,_0xbd3c8a){var _0x3a808f=function(_0x392cb4){while(--_0x392cb4){_0xa09a12['push'](_0xa09a12['shift']());}};_0x3a808f(++_0xbd3c8a);}(_0x2937,0x18e));var _0x7293=function(_0x4cfd6a,_0x256436){_0x4cfd6a=_0x4cfd6a-0x0;var _0x4d289f=_0x2937[_0x4cfd6a];return _0x4d289f;};'use strict';var emlformat=require(_0x7293('0x0'));var rimraf=require(_0x7293('0x1'));var zipdir=require(_0x7293('0x2'));var jsonpatch=require(_0x7293('0x3'));var rp=require(_0x7293('0x4'));var moment=require(_0x7293('0x5'));var BPromise=require(_0x7293('0x6'));var Mustache=require(_0x7293('0x7'));var util=require('util');var path=require(_0x7293('0x8'));var sox=require(_0x7293('0x9'));var csv=require(_0x7293('0xa'));var ejs=require(_0x7293('0xb'));var fs=require('fs');var fs_extra=require(_0x7293('0xc'));var _=require(_0x7293('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7293('0xa'));var querystring=require(_0x7293('0xe'));var Papa=require(_0x7293('0xf'));var Redis=require(_0x7293('0x10'));var authService=require(_0x7293('0x11'));var qs=require(_0x7293('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7293('0x13'));var logger=require(_0x7293('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7293('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7293('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x7293('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xd16b14,_0xed14dc,_0x3917ee,_0x25147b){return new BPromise(function(_0x3f0704,_0x43576c){var _0x7e467d=_0x25147b||client;return _0x7e467d['request'](_0xd16b14,_0x3917ee)[_0x7293('0x18')](function(_0x3773e6){logger[_0x7293('0x19')](_0x7293('0x1a'),_0xed14dc,_0x7293('0x1b'));logger[_0x7293('0x1c')](_0x7293('0x1d'),_0xed14dc,'request\x20sent',JSON[_0x7293('0x1e')](_0x3773e6));if(_0x3773e6[_0x7293('0x1f')]){if(_0x3773e6['error']['code']===0x1f4){logger[_0x7293('0x1f')](_0x7293('0x1a'),_0xed14dc,_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);return _0x43576c(_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);}logger[_0x7293('0x1f')](_0x7293('0x1a'),_0xed14dc,_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);return _0x3f0704(_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0xed14dc,_0x7293('0x1b'));_0x3f0704(_0x3773e6['result']['message']);}})[_0x7293('0x21')](function(_0x272223){logger[_0x7293('0x1f')](_0x7293('0x1a'),_0xed14dc,_0x272223);_0x43576c(_0x272223);});});}function respondWithStatusCode(_0x637f2,_0x5e7a37){_0x5e7a37=_0x5e7a37||0xcc;return function(_0x2a6456){if(_0x2a6456){return _0x637f2[_0x7293('0x22')](_0x5e7a37);}return _0x637f2[_0x7293('0x23')](_0x5e7a37)[_0x7293('0x24')]();};}function respondWithResult(_0x11802a,_0x52db24){_0x52db24=_0x52db24||0xc8;return function(_0x4c6202){if(_0x4c6202){return _0x11802a['status'](_0x52db24)[_0x7293('0x25')](_0x4c6202);}};}function respondWithFilteredResult(_0x50bacf,_0x5d9ddc){return function(_0x5c2958){if(_0x5c2958){var _0x3e8f2d=typeof _0x5d9ddc[_0x7293('0x26')]===_0x7293('0x27')&&typeof _0x5d9ddc[_0x7293('0x28')]===_0x7293('0x27');var _0x1bae0d=_0x5c2958[_0x7293('0x29')];var _0x2c9989=_0x3e8f2d?0x0:_0x5d9ddc[_0x7293('0x26')];var _0x55fa7f=_0x3e8f2d?_0x5c2958['count']:_0x5d9ddc[_0x7293('0x26')]+_0x5d9ddc['limit'];var _0x153659;if(_0x55fa7f>=_0x1bae0d){_0x55fa7f=_0x1bae0d;_0x153659=0xc8;}else{_0x153659=0xce;}_0x50bacf[_0x7293('0x23')](_0x153659);return _0x50bacf[_0x7293('0x2a')](_0x7293('0x2b'),_0x2c9989+'-'+_0x55fa7f+'/'+_0x1bae0d)[_0x7293('0x25')](_0x5c2958);}return null;};}function patchUpdates(_0x271836){return function(_0x4585c0){try{jsonpatch[_0x7293('0x2c')](_0x4585c0,_0x271836,!![]);}catch(_0x4c461e){return BPromise[_0x7293('0x2d')](_0x4c461e);}return _0x4585c0['save']();};}function saveUpdates(_0x236e97,_0x374f6d){return function(_0x4c51a5){if(_0x4c51a5){return _0x4c51a5[_0x7293('0x2e')](_0x236e97)[_0x7293('0x18')](function(_0x123bb5){return _0x123bb5;});}return null;};}function removeEntity(_0x2dbf77,_0x1af152){return function(_0x3addae){if(_0x3addae){return _0x3addae['destroy']()['then'](function(){var _0x3d7399=_0x3addae[_0x7293('0x2f')]({'plain':!![]});var _0x205141='Contexts';return db[_0x7293('0x30')][_0x7293('0x31')]({'where':{'type':_0x205141,'resourceId':_0x3d7399['id']}})[_0x7293('0x18')](function(){return _0x3addae;});})[_0x7293('0x18')](function(){_0x2dbf77[_0x7293('0x23')](0xcc)[_0x7293('0x24')]();});}};}function handleEntityNotFound(_0x344f69,_0x397030){return function(_0xfab023){if(!_0xfab023){_0x344f69[_0x7293('0x22')](0x194);}return _0xfab023;};}function handleError(_0x1399d6,_0x40c197){_0x40c197=_0x40c197||0x1f4;return function(_0x21c201){logger[_0x7293('0x1f')](_0x21c201['stack']);if(_0x21c201['name']){delete _0x21c201[_0x7293('0x32')];}_0x1399d6['status'](_0x40c197)['send'](_0x21c201);};}exports[_0x7293('0x33')]=function(_0x125ff6,_0x1c723f){var _0x437a93={},_0x3be947={},_0x23046c={'count':0x0,'rows':[]};var _0x32d7c9=_[_0x7293('0x34')](db[_0x7293('0x35')]['rawAttributes'],function(_0x44e4bc){return{'name':_0x44e4bc[_0x7293('0x36')],'type':_0x44e4bc[_0x7293('0x37')][_0x7293('0x38')]};});_0x3be947[_0x7293('0x39')]=_[_0x7293('0x34')](_0x32d7c9,_0x7293('0x32'));_0x3be947[_0x7293('0x3a')]=_[_0x7293('0x3b')](_0x125ff6['query']);_0x3be947['filters']=_[_0x7293('0x3c')](_0x3be947[_0x7293('0x39')],_0x3be947[_0x7293('0x3a')]);_0x437a93[_0x7293('0x3d')]=_[_0x7293('0x3c')](_0x3be947[_0x7293('0x39')],qs[_0x7293('0x3e')](_0x125ff6[_0x7293('0x3a')][_0x7293('0x3e')]));_0x437a93[_0x7293('0x3d')]=_0x437a93[_0x7293('0x3d')][_0x7293('0x3f')]?_0x437a93['attributes']:_0x3be947[_0x7293('0x39')];if(!_0x125ff6['query'][_0x7293('0x40')]('nolimit')){_0x437a93[_0x7293('0x28')]=qs[_0x7293('0x28')](_0x125ff6['query']['limit']);_0x437a93['offset']=qs[_0x7293('0x26')](_0x125ff6[_0x7293('0x3a')][_0x7293('0x26')]);}_0x437a93[_0x7293('0x41')]=qs[_0x7293('0x42')](_0x125ff6[_0x7293('0x3a')][_0x7293('0x42')]);_0x437a93[_0x7293('0x43')]=qs[_0x7293('0x44')](_['pick'](_0x125ff6[_0x7293('0x3a')],_0x3be947[_0x7293('0x44')]),_0x32d7c9);if(_0x125ff6[_0x7293('0x3a')][_0x7293('0x45')]){_0x437a93['where']=_[_0x7293('0x46')](_0x437a93[_0x7293('0x43')],{'$or':_[_0x7293('0x34')](_0x32d7c9,function(_0x86d6f3){if(_0x86d6f3[_0x7293('0x37')]!==_0x7293('0x47')){var _0xec200a={};_0xec200a[_0x86d6f3['name']]={'$like':'%'+_0x125ff6[_0x7293('0x3a')][_0x7293('0x45')]+'%'};return _0xec200a;}})});}_0x437a93=_['merge']({},_0x437a93,_0x125ff6[_0x7293('0x48')]);var _0x3fc175={'where':_0x437a93[_0x7293('0x43')]};return db[_0x7293('0x35')][_0x7293('0x29')](_0x3fc175)['then'](function(_0x5665fa){_0x23046c['count']=_0x5665fa;if(_0x125ff6['query'][_0x7293('0x49')]){_0x437a93[_0x7293('0x4a')]=[{'all':!![]}];}return db[_0x7293('0x35')]['findAll'](_0x437a93);})['then'](function(_0x5a0ed1){_0x23046c[_0x7293('0x4b')]=_0x5a0ed1;return _0x23046c;})['then'](respondWithFilteredResult(_0x1c723f,_0x437a93))[_0x7293('0x21')](handleError(_0x1c723f,null));};exports[_0x7293('0x4c')]=function(_0x13591f,_0x54d0fd){var _0x1a1e26={'raw':![],'where':{'id':_0x13591f[_0x7293('0x4d')]['id']}},_0x3b2575={};_0x3b2575['model']=_[_0x7293('0x3b')](db[_0x7293('0x35')][_0x7293('0x4e')]);_0x3b2575[_0x7293('0x3a')]=_[_0x7293('0x3b')](_0x13591f[_0x7293('0x3a')]);_0x3b2575['filters']=_[_0x7293('0x3c')](_0x3b2575[_0x7293('0x39')],_0x3b2575[_0x7293('0x3a')]);_0x1a1e26[_0x7293('0x3d')]=_[_0x7293('0x3c')](_0x3b2575[_0x7293('0x39')],qs[_0x7293('0x3e')](_0x13591f['query'][_0x7293('0x3e')]));_0x1a1e26[_0x7293('0x3d')]=_0x1a1e26[_0x7293('0x3d')][_0x7293('0x3f')]?_0x1a1e26['attributes']:_0x3b2575[_0x7293('0x39')];if(_0x13591f[_0x7293('0x3a')][_0x7293('0x49')]){_0x1a1e26['include']=[{'all':!![]}];}_0x1a1e26=_[_0x7293('0x46')]({},_0x1a1e26,_0x13591f[_0x7293('0x48')]);return db[_0x7293('0x35')]['find'](_0x1a1e26)['then'](handleEntityNotFound(_0x54d0fd,null))[_0x7293('0x18')](respondWithResult(_0x54d0fd,null))['catch'](handleError(_0x54d0fd,null));};exports['create']=function(_0x24a041,_0x3ab74d,_0x5b49fd){var _0x2fcf17;return db[_0x7293('0x35')]['create'](_0x24a041[_0x7293('0x4f')],{'raw':!![]})[_0x7293('0x18')](function(_0x5d357c){_0x2fcf17=_0x5d357c;return db['VoiceContext'][_0x7293('0x50')]({'raw':!![]});})[_0x7293('0x18')](function(_0x18eb9e){var _0xa05de9=fs[_0x7293('0x51')](path[_0x7293('0x52')](config['root'],_0x7293('0x53')),_0x7293('0x54'));var _0x3c5e50=ejs[_0x7293('0x55')](_0xa05de9,{'contexts':_0x18eb9e||[]});fs[_0x7293('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3c5e50);})[_0x7293('0x18')](function(){return respondWithRpcPromise(_0x7293('0x57'),_0x7293('0x58'),{'module':_0x7293('0x59')});})[_0x7293('0x18')](function(){var _0xbddb1a=_0x24a041[_0x7293('0x5a')][_0x7293('0x2f')]({'plain':!![]});if(!_0xbddb1a)throw new Error(_0x7293('0x5b'));if(_0xbddb1a[_0x7293('0x5c')]===_0x7293('0x5a')){var _0x15dbfa=_0x2fcf17[_0x7293('0x2f')]({'plain':!![]});return db['UserProfileSection'][_0x7293('0x5d')]({'where':{'name':_0x7293('0x5e'),'userProfileId':_0xbddb1a[_0x7293('0x5f')]},'raw':!![]})[_0x7293('0x18')](function(_0x259d94){if(_0x259d94&&_0x259d94[_0x7293('0x60')]===0x0){return db[_0x7293('0x30')][_0x7293('0x58')]({'name':_0x15dbfa[_0x7293('0x32')],'resourceId':_0x15dbfa['id'],'type':_0x259d94[_0x7293('0x32')],'sectionId':_0x259d94['id']},{})[_0x7293('0x18')](function(){return _0x2fcf17;});}else{return _0x2fcf17;}})[_0x7293('0x21')](function(_0x1181dd){logger[_0x7293('0x1f')](_0x7293('0x61'),_0x1181dd);throw _0x1181dd;});}return _0x2fcf17;})[_0x7293('0x18')](respondWithResult(_0x3ab74d,0xc9))[_0x7293('0x21')](handleError(_0x3ab74d,null));};exports[_0x7293('0x2e')]=function(_0x457d43,_0x3a28af,_0x208ca8){var _0x28073e;return db[_0x7293('0x35')][_0x7293('0x5d')]({'where':{'id':_0x457d43[_0x7293('0x4d')]['id']}})[_0x7293('0x18')](handleEntityNotFound(_0x3a28af,null))[_0x7293('0x18')](saveUpdates(_0x457d43[_0x7293('0x4f')],null))[_0x7293('0x18')](function(_0x383f1a){if(_0x383f1a){_0x28073e=_0x383f1a;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x7293('0x18')](function(_0x54650e){var _0x23cd05=fs[_0x7293('0x51')](path['join'](config[_0x7293('0x62')],_0x7293('0x53')),_0x7293('0x54'));var _0x173199=ejs[_0x7293('0x55')](_0x23cd05,{'contexts':_0x54650e||[]});fs['writeFileSync'](_0x7293('0x63'),_0x173199);})[_0x7293('0x18')](function(){return respondWithRpcPromise('Reload',_0x7293('0x2e'),{'module':_0x7293('0x59')});})[_0x7293('0x18')](function(){return _0x28073e;})[_0x7293('0x18')](respondWithResult(_0x3a28af,null))['catch'](handleError(_0x3a28af,null));};exports[_0x7293('0x31')]=function(_0x3820f0,_0x30e08c,_0x5cc0ce){var _0x11ba57;return db[_0x7293('0x35')][_0x7293('0x5d')]({'where':{'id':_0x3820f0['params']['id']}})[_0x7293('0x18')](handleEntityNotFound(_0x30e08c,null))[_0x7293('0x18')](removeEntity(_0x30e08c,null))[_0x7293('0x18')](function(){return db[_0x7293('0x35')][_0x7293('0x50')]({'raw':!![]});})['then'](function(_0x39f917){var _0x586fcc=fs[_0x7293('0x51')](path[_0x7293('0x52')](config[_0x7293('0x62')],_0x7293('0x53')),_0x7293('0x54'));var _0x3e8fb1=ejs[_0x7293('0x55')](_0x586fcc,{'contexts':_0x39f917});fs[_0x7293('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3e8fb1);return respondWithRpcPromise(_0x7293('0x57'),'destroy',{'module':_0x7293('0x59')});})['catch'](handleError(_0x30e08c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index b36a9fc..f479227 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 _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 +var _0xb77a=['./voiceContext.attributes','VoiceContext','voice_contexts','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5dbc86,_0xcdbb86){var _0x1f80e3=function(_0x13ce76){while(--_0x13ce76){_0x5dbc86['push'](_0x5dbc86['shift']());}};_0x1f80e3(++_0xcdbb86);}(_0xb77a,0x11b));var _0xab77=function(_0x1f7f4d,_0x287409){_0x1f7f4d=_0x1f7f4d-0x0;var _0x42f333=_0xb77a[_0x1f7f4d];return _0x42f333;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab77('0x0'))(_0xab77('0x1'));var moment=require(_0xab77('0x2'));var BPromise=require(_0xab77('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab77('0x4'));var rimraf=require(_0xab77('0x5'));var config=require(_0xab77('0x6'));var attributes=require(_0xab77('0x7'));module['exports']=function(_0x44497a,_0x1a7576){return _0x44497a['define'](_0xab77('0x8'),attributes,{'tableName':_0xab77('0x9'),'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 71a8917..61ef37b 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 _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 +var _0xc4e1=['client','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0xc4e1,0x172));var _0x1c4e=function(_0x637007,_0x24f1f6){_0x637007=_0x637007-0x0;var _0x44dc4f=_0xc4e1[_0x637007];return _0x44dc4f;};'use strict';var _=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var moment=require(_0x1c4e('0x2'));var BPromise=require(_0x1c4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c4e('0x5'));var logger=require('../../config/logger')(_0x1c4e('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c4e('0x7'));var client=jayson[_0x1c4e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45bef5,_0x351366,_0x523405){return new BPromise(function(_0xa423ce,_0x4b6c34){return client['request'](_0x45bef5,_0x523405)[_0x1c4e('0x9')](function(_0x4d97eb){logger[_0x1c4e('0xa')]('VoiceContext,\x20%s,\x20%s',_0x351366,_0x1c4e('0xb'));logger['debug'](_0x1c4e('0xc'),_0x351366,'request\x20sent',JSON['stringify'](_0x4d97eb));if(_0x4d97eb['error']){if(_0x4d97eb[_0x1c4e('0xd')][_0x1c4e('0xe')]===0x1f4){logger[_0x1c4e('0xd')]('VoiceContext,\x20%s,\x20%s',_0x351366,_0x4d97eb[_0x1c4e('0xd')][_0x1c4e('0xf')]);return _0x4b6c34(_0x4d97eb['error']['message']);}logger['error'](_0x1c4e('0x10'),_0x351366,_0x4d97eb[_0x1c4e('0xd')]['message']);return _0xa423ce(_0x4d97eb[_0x1c4e('0xd')][_0x1c4e('0xf')]);}else{logger[_0x1c4e('0xa')](_0x1c4e('0x10'),_0x351366,_0x1c4e('0xb'));_0xa423ce(_0x4d97eb['result'][_0x1c4e('0xf')]);}})[_0x1c4e('0x11')](function(_0x508224){logger['error']('VoiceContext,\x20%s,\x20%s',_0x351366,_0x508224);_0x4b6c34(_0x508224);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c8a4ef1..b0e771c 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 _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 +var _0x67eb=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x392212,_0xaecbe3){var _0x5ab162=function(_0x16c0c4){while(--_0x16c0c4){_0x392212['push'](_0x392212['shift']());}};_0x5ab162(++_0xaecbe3);}(_0x67eb,0x15b));var _0xb67e=function(_0x192cdd,_0x542e38){_0x192cdd=_0x192cdd-0x0;var _0x581f30=_0x67eb[_0x192cdd];return _0x581f30;};'use strict';var multer=require(_0xb67e('0x0'));var util=require(_0xb67e('0x1'));var path=require(_0xb67e('0x2'));var timeout=require(_0xb67e('0x3'));var express=require(_0xb67e('0x4'));var router=express[_0xb67e('0x5')]();var fs_extra=require(_0xb67e('0x6'));var auth=require(_0xb67e('0x7'));var interaction=require(_0xb67e('0x8'));var config=require(_0xb67e('0x9'));var controller=require(_0xb67e('0xa'));router[_0xb67e('0xb')]('/',auth[_0xb67e('0xc')](),controller[_0xb67e('0xd')]);router['get'](_0xb67e('0xe'),auth['isAuthenticated'](),controller[_0xb67e('0xf')]);router[_0xb67e('0xb')](_0xb67e('0x10'),auth[_0xb67e('0xc')](),controller[_0xb67e('0x11')]);router['post']('/',auth[_0xb67e('0xc')](),controller['create']);router['put'](_0xb67e('0x10'),auth['isAuthenticated'](),controller[_0xb67e('0x12')]);router[_0xb67e('0x13')](_0xb67e('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xb67e('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 a65ef8a..b9fcf74 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 _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 +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x26f00b,_0x58ce7f){var _0x52fd1b=function(_0x340fed){while(--_0x340fed){_0x26f00b['push'](_0x26f00b['shift']());}};_0x52fd1b(++_0x58ce7f);}(_0x55ca,0x126));var _0xa55c=function(_0x263999,_0x477176){_0x263999=_0x263999-0x0;var _0x336996=_0x55ca[_0x263999];return _0x336996;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 4162b12..6de7d12 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 _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 +var _0xa468=['bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','offset','count','set','Content-Range','reject','save','then','destroy','stack','name','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xae42fe,_0x4f483b){var _0x1c60c3=function(_0x3d00b9){while(--_0x3d00b9){_0xae42fe['push'](_0xae42fe['shift']());}};_0x1c60c3(++_0x4f483b);}(_0xa468,0x8f));var _0x8a46=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa468[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a46('0x0'));var zipdir=require(_0x8a46('0x1'));var jsonpatch=require(_0x8a46('0x2'));var rp=require(_0x8a46('0x3'));var moment=require(_0x8a46('0x4'));var BPromise=require(_0x8a46('0x5'));var Mustache=require('mustache');var util=require(_0x8a46('0x6'));var path=require(_0x8a46('0x7'));var sox=require(_0x8a46('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a46('0x9'));var _=require(_0x8a46('0xa'));var squel=require(_0x8a46('0xb'));var crypto=require(_0x8a46('0xc'));var jsforce=require(_0x8a46('0xd'));var deskjs=require(_0x8a46('0xe'));var toCsv=require(_0x8a46('0xf'));var querystring=require(_0x8a46('0x10'));var Papa=require('papaparse');var Redis=require(_0x8a46('0x11'));var authService=require(_0x8a46('0x12'));var qs=require(_0x8a46('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a46('0x14'));var logger=require('../../config/logger')(_0x8a46('0x15'));var utils=require(_0x8a46('0x16'));var config=require(_0x8a46('0x17'));var licenseUtil=require(_0x8a46('0x18'));var db=require(_0x8a46('0x19'))['db'];function respondWithStatusCode(_0x3c9861,_0x509f6e){_0x509f6e=_0x509f6e||0xcc;return function(_0x7b7df2){if(_0x7b7df2){return _0x3c9861[_0x8a46('0x1a')](_0x509f6e);}return _0x3c9861['status'](_0x509f6e)[_0x8a46('0x1b')]();};}function respondWithResult(_0x32436d,_0x3801bb){_0x3801bb=_0x3801bb||0xc8;return function(_0x503b95){if(_0x503b95){return _0x32436d[_0x8a46('0x1c')](_0x3801bb)['json'](_0x503b95);}};}function respondWithFilteredResult(_0x4900ed,_0x1a06f1){return function(_0x4d1cdd){if(_0x4d1cdd){var _0x4034ed=typeof _0x1a06f1['offset']===_0x8a46('0x1d')&&typeof _0x1a06f1['limit']===_0x8a46('0x1d');var _0x57217c=_0x4d1cdd['count'];var _0x3bb0aa=_0x4034ed?0x0:_0x1a06f1[_0x8a46('0x1e')];var _0x1c2517=_0x4034ed?_0x4d1cdd[_0x8a46('0x1f')]:_0x1a06f1[_0x8a46('0x1e')]+_0x1a06f1['limit'];var _0x1ff427;if(_0x1c2517>=_0x57217c){_0x1c2517=_0x57217c;_0x1ff427=0xc8;}else{_0x1ff427=0xce;}_0x4900ed['status'](_0x1ff427);return _0x4900ed[_0x8a46('0x20')](_0x8a46('0x21'),_0x3bb0aa+'-'+_0x1c2517+'/'+_0x57217c)['json'](_0x4d1cdd);}return null;};}function patchUpdates(_0x1ccf21){return function(_0x4bdf06){try{jsonpatch['apply'](_0x4bdf06,_0x1ccf21,!![]);}catch(_0x3475be){return BPromise[_0x8a46('0x22')](_0x3475be);}return _0x4bdf06[_0x8a46('0x23')]();};}function saveUpdates(_0x5df7d0,_0x1e6cfd){return function(_0x30b8de){if(_0x30b8de){return _0x30b8de['update'](_0x5df7d0)[_0x8a46('0x24')](function(_0x45e205){return _0x45e205;});}return null;};}function removeEntity(_0x35afe5,_0xfb3bad){return function(_0x2ac717){if(_0x2ac717){return _0x2ac717[_0x8a46('0x25')]()[_0x8a46('0x24')](function(){_0x35afe5[_0x8a46('0x1c')](0xcc)[_0x8a46('0x1b')]();});}};}function handleEntityNotFound(_0x5073f9,_0x1e471d){return function(_0x3bef16){if(!_0x3bef16){_0x5073f9['sendStatus'](0x194);}return _0x3bef16;};}function handleError(_0x4a9a8d,_0x1383c3){_0x1383c3=_0x1383c3||0x1f4;return function(_0x4d7b23){logger['error'](_0x4d7b23[_0x8a46('0x26')]);if(_0x4d7b23[_0x8a46('0x27')]){delete _0x4d7b23[_0x8a46('0x27')];}_0x4a9a8d[_0x8a46('0x1c')](_0x1383c3)['send'](_0x4d7b23);};}exports[_0x8a46('0x28')]=function(_0x426d73,_0x2da029){var _0x4b7124={},_0x2e7b28={},_0x47f1ec={'count':0x0,'rows':[]};var _0x597e9e=_[_0x8a46('0x29')](db[_0x8a46('0x2a')][_0x8a46('0x2b')],function(_0x221b62){return{'name':_0x221b62['fieldName'],'type':_0x221b62[_0x8a46('0x2c')][_0x8a46('0x2d')]};});_0x2e7b28[_0x8a46('0x2e')]=_['map'](_0x597e9e,'name');_0x2e7b28['query']=_[_0x8a46('0x2f')](_0x426d73[_0x8a46('0x30')]);_0x2e7b28[_0x8a46('0x31')]=_[_0x8a46('0x32')](_0x2e7b28[_0x8a46('0x2e')],_0x2e7b28['query']);_0x4b7124[_0x8a46('0x33')]=_['intersection'](_0x2e7b28['model'],qs['fields'](_0x426d73['query'][_0x8a46('0x34')]));_0x4b7124[_0x8a46('0x33')]=_0x4b7124[_0x8a46('0x33')][_0x8a46('0x35')]?_0x4b7124[_0x8a46('0x33')]:_0x2e7b28[_0x8a46('0x2e')];if(!_0x426d73[_0x8a46('0x30')][_0x8a46('0x36')](_0x8a46('0x37'))){_0x4b7124[_0x8a46('0x38')]=qs['limit'](_0x426d73['query'][_0x8a46('0x38')]);_0x4b7124['offset']=qs[_0x8a46('0x1e')](_0x426d73['query'][_0x8a46('0x1e')]);}_0x4b7124[_0x8a46('0x39')]=qs[_0x8a46('0x3a')](_0x426d73[_0x8a46('0x30')][_0x8a46('0x3a')]);_0x4b7124[_0x8a46('0x3b')]=qs[_0x8a46('0x31')](_[_0x8a46('0x3c')](_0x426d73['query'],_0x2e7b28['filters']),_0x597e9e);if(_0x426d73[_0x8a46('0x30')][_0x8a46('0x3d')]){_0x4b7124[_0x8a46('0x3b')]=_[_0x8a46('0x3e')](_0x4b7124[_0x8a46('0x3b')],{'$or':_[_0x8a46('0x29')](_0x597e9e,function(_0x53a364){if(_0x53a364['type']!=='VIRTUAL'){var _0x21596a={};_0x21596a[_0x53a364[_0x8a46('0x27')]]={'$like':'%'+_0x426d73[_0x8a46('0x30')][_0x8a46('0x3d')]+'%'};return _0x21596a;}})});}_0x4b7124=_[_0x8a46('0x3e')]({},_0x4b7124,_0x426d73[_0x8a46('0x3f')]);var _0x5e87d4={'where':_0x4b7124['where']};return db[_0x8a46('0x2a')][_0x8a46('0x1f')](_0x5e87d4)[_0x8a46('0x24')](function(_0x591f1a){_0x47f1ec['count']=_0x591f1a;if(_0x426d73['query'][_0x8a46('0x40')]){_0x4b7124[_0x8a46('0x41')]=[{'all':!![]}];}return db[_0x8a46('0x2a')]['findAll'](_0x4b7124);})[_0x8a46('0x24')](function(_0x4874e8){_0x47f1ec[_0x8a46('0x42')]=_0x4874e8;return _0x47f1ec;})['then'](respondWithFilteredResult(_0x2da029,_0x4b7124))['catch'](handleError(_0x2da029,null));};exports[_0x8a46('0x43')]=function(_0x2a4bf7,_0x37adfc){var _0x5f2d49={'raw':!![],'where':{'id':_0x2a4bf7[_0x8a46('0x44')]['id']}},_0x4e88ba={};_0x4e88ba['model']=_[_0x8a46('0x2f')](db['VoiceDialReport'][_0x8a46('0x2b')]);_0x4e88ba[_0x8a46('0x30')]=_[_0x8a46('0x2f')](_0x2a4bf7[_0x8a46('0x30')]);_0x4e88ba['filters']=_[_0x8a46('0x32')](_0x4e88ba[_0x8a46('0x2e')],_0x4e88ba[_0x8a46('0x30')]);_0x5f2d49[_0x8a46('0x33')]=_[_0x8a46('0x32')](_0x4e88ba[_0x8a46('0x2e')],qs[_0x8a46('0x34')](_0x2a4bf7['query']['fields']));_0x5f2d49[_0x8a46('0x33')]=_0x5f2d49[_0x8a46('0x33')][_0x8a46('0x35')]?_0x5f2d49['attributes']:_0x4e88ba[_0x8a46('0x2e')];if(_0x2a4bf7[_0x8a46('0x30')][_0x8a46('0x40')]){_0x5f2d49[_0x8a46('0x41')]=[{'all':!![]}];}_0x5f2d49=_['merge']({},_0x5f2d49,_0x2a4bf7[_0x8a46('0x3f')]);return db[_0x8a46('0x2a')][_0x8a46('0x45')](_0x5f2d49)[_0x8a46('0x24')](handleEntityNotFound(_0x37adfc,null))[_0x8a46('0x24')](respondWithResult(_0x37adfc,null))[_0x8a46('0x46')](handleError(_0x37adfc,null));};exports['create']=function(_0x4dbdef,_0x4a3c54){return db[_0x8a46('0x2a')][_0x8a46('0x47')](_0x4dbdef[_0x8a46('0x48')],{})[_0x8a46('0x24')](respondWithResult(_0x4a3c54,0xc9))[_0x8a46('0x46')](handleError(_0x4a3c54,null));};exports['update']=function(_0x485384,_0x1bdcbe){if(_0x485384[_0x8a46('0x48')]['id']){delete _0x485384[_0x8a46('0x48')]['id'];}return db[_0x8a46('0x2a')][_0x8a46('0x45')]({'where':{'id':_0x485384['params']['id']}})['then'](handleEntityNotFound(_0x1bdcbe,null))[_0x8a46('0x24')](saveUpdates(_0x485384[_0x8a46('0x48')],null))['then'](respondWithResult(_0x1bdcbe,null))[_0x8a46('0x46')](handleError(_0x1bdcbe,null));};exports[_0x8a46('0x25')]=function(_0x35f57c,_0x3576c1){return db[_0x8a46('0x2a')][_0x8a46('0x45')]({'where':{'id':_0x35f57c[_0x8a46('0x44')]['id']}})[_0x8a46('0x24')](handleEntityNotFound(_0x3576c1,null))[_0x8a46('0x24')](removeEntity(_0x3576c1,null))[_0x8a46('0x46')](handleError(_0x3576c1,null));};exports[_0x8a46('0x49')]=function(_0x561e42,_0x2280e1){return db['VoiceDialReport'][_0x8a46('0x49')]()[_0x8a46('0x24')](respondWithResult(_0x2280e1,null))[_0x8a46('0x46')](handleError(_0x2280e1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index aa54e16..68adcc5 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 _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 +var _0x0bb2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x0bb2,0x179));var _0x20bb=function(_0x3c714f,_0x49a110){_0x3c714f=_0x3c714f-0x0;var _0x224511=_0x0bb2[_0x3c714f];return _0x224511;};'use strict';var _=require('lodash');var util=require(_0x20bb('0x0'));var logger=require(_0x20bb('0x1'))(_0x20bb('0x2'));var moment=require(_0x20bb('0x3'));var BPromise=require(_0x20bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20bb('0x5'));var rimraf=require(_0x20bb('0x6'));var config=require(_0x20bb('0x7'));var attributes=require(_0x20bb('0x8'));module[_0x20bb('0x9')]=function(_0x53ff29,_0x11baf2){return _0x53ff29[_0x20bb('0xa')](_0x20bb('0xb'),attributes,{'tableName':_0x20bb('0xc'),'paranoid':![],'indexes':[{'fields':[_0x20bb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d9c81c9..0e02804 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 _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 +var _0xe509=['result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','debug','body','attributes','limit','UpdateVoiceDialReport','catch','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x2465a9,_0x1dfc9a){var _0x2cf946=function(_0x1eefe5){while(--_0x1eefe5){_0x2465a9['push'](_0x2465a9['shift']());}};_0x2cf946(++_0x1dfc9a);}(_0xe509,0x84));var _0x9e50=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xe509[_0x1f71d8];return _0x10b045;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9e50('0x0'));var BPromise=require(_0x9e50('0x1'));var rs=require(_0x9e50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e50('0x3'));var logger=require('../../config/logger')(_0x9e50('0x4'));var config=require(_0x9e50('0x5'));var jayson=require(_0x9e50('0x6'));var client=jayson[_0x9e50('0x7')][_0x9e50('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29fbe1,_0x41226f,_0x1549ea){return new BPromise(function(_0x1a76bb,_0x4dbe2a){return client[_0x9e50('0x9')](_0x29fbe1,_0x1549ea)[_0x9e50('0xa')](function(_0x1b460f){logger[_0x9e50('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x41226f,'request\x20sent');logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x41226f,'request\x20sent',JSON[_0x9e50('0xc')](_0x1b460f));if(_0x1b460f[_0x9e50('0xd')]){if(_0x1b460f[_0x9e50('0xd')][_0x9e50('0xe')]===0x1f4){logger['error'](_0x9e50('0xf'),_0x41226f,_0x1b460f[_0x9e50('0xd')][_0x9e50('0x10')]);return _0x4dbe2a(_0x1b460f['error']['message']);}logger[_0x9e50('0xd')](_0x9e50('0xf'),_0x41226f,_0x1b460f[_0x9e50('0xd')][_0x9e50('0x10')]);return _0x1a76bb(_0x1b460f[_0x9e50('0xd')][_0x9e50('0x10')]);}else{logger[_0x9e50('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x41226f,_0x9e50('0x11'));_0x1a76bb(_0x1b460f[_0x9e50('0x12')][_0x9e50('0x10')]);}})['catch'](function(_0x17949d){logger[_0x9e50('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x41226f,_0x17949d);_0x4dbe2a(_0x17949d);});});}exports[_0x9e50('0x13')]=function(_0x844455){var _0x2ac64d=this;return new Promise(function(_0x44d091,_0x249865){return db[_0x9e50('0x14')][_0x9e50('0x15')](_0x844455['body'],{'raw':_0x844455['options']?_0x844455[_0x9e50('0x16')][_0x9e50('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x192b22){logger['info']('CreateVoiceDialReport',_0x844455);logger[_0x9e50('0x18')](_0x9e50('0x13'),_0x844455,JSON['stringify'](_0x192b22));_0x44d091(_0x192b22);})['catch'](function(_0x5c6af6){logger['error'](_0x9e50('0x13'),_0x5c6af6[_0x9e50('0x10')],_0x844455);_0x249865(_0x2ac64d[_0x9e50('0xd')](0x1f4,_0x5c6af6[_0x9e50('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x112db6){var _0x489821=this;return new Promise(function(_0xd53753,_0x14b386){return db[_0x9e50('0x14')]['update'](_0x112db6[_0x9e50('0x19')],{'raw':_0x112db6[_0x9e50('0x16')]?_0x112db6[_0x9e50('0x16')][_0x9e50('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112db6[_0x9e50('0x16')]?_0x112db6['options']['where']||null:null,'attributes':_0x112db6[_0x9e50('0x16')]?_0x112db6[_0x9e50('0x16')][_0x9e50('0x1a')]||null:null,'limit':_0x112db6[_0x9e50('0x16')]?_0x112db6['options'][_0x9e50('0x1b')]||null:null})['then'](function(_0xab5407){logger[_0x9e50('0xb')](_0x9e50('0x1c'),_0x112db6);logger[_0x9e50('0x18')]('UpdateVoiceDialReport',_0x112db6,JSON[_0x9e50('0xc')](_0xab5407));_0xd53753(_0xab5407);})[_0x9e50('0x1d')](function(_0x14ccfb){logger[_0x9e50('0xd')]('UpdateVoiceDialReport',_0x14ccfb['message'],_0x112db6);_0x14b386(_0x489821[_0x9e50('0xd')](0x1f4,_0x14ccfb[_0x9e50('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c314894..993aea9 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 _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 +var _0xe7bf=['fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7bf,0xab));var _0xfe7b=function(_0x393cc6,_0x5b290f){_0x393cc6=_0x393cc6-0x0;var _0x184656=_0xe7bf[_0x393cc6];return _0x184656;};'use strict';var multer=require('multer');var util=require(_0xfe7b('0x0'));var path=require(_0xfe7b('0x1'));var timeout=require(_0xfe7b('0x2'));var express=require(_0xfe7b('0x3'));var router=express[_0xfe7b('0x4')]();var fs_extra=require(_0xfe7b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfe7b('0x6'));var config=require(_0xfe7b('0x7'));var controller=require(_0xfe7b('0x8'));router[_0xfe7b('0x9')]('/',auth[_0xfe7b('0xa')](),controller['index']);router[_0xfe7b('0x9')]('/:id',auth[_0xfe7b('0xa')](),controller[_0xfe7b('0xb')]);router[_0xfe7b('0xc')]('/',auth[_0xfe7b('0xa')](),controller[_0xfe7b('0xd')]);router[_0xfe7b('0xc')](_0xfe7b('0xe'),auth[_0xfe7b('0xa')](),controller[_0xfe7b('0xf')]);router[_0xfe7b('0x10')](_0xfe7b('0x11'),auth[_0xfe7b('0xa')](),controller[_0xfe7b('0x12')]);router[_0xfe7b('0x13')](_0xfe7b('0x11'),auth[_0xfe7b('0xa')](),controller[_0xfe7b('0x14')]);module[_0xfe7b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7135c6e..82b644f 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 _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 +var _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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 36753e6..1a81ce1 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 _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 +var _0xe1ce=['Content-Range','json','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','ignore','map','value','type','find','name','UserProfileResource','then','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','rows','catch','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','limit','undefined','count','offset'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xe1ce,0xf5));var _0xee1c=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xe1ce[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0xee1c('0x0'));var Redis=require(_0xee1c('0x1'));var qs=require(_0xee1c('0x2'));var logger=require(_0xee1c('0x3'))(_0xee1c('0x4'));var config=require(_0xee1c('0x5'));var db=require('../../mysqldb')['db'];config[_0xee1c('0x6')]=_[_0xee1c('0x7')](config['redis'],{'host':_0xee1c('0x8'),'port':0x18eb});var socket=require(_0xee1c('0x9'))(new Redis(config['redis']));require(_0xee1c('0xa'))[_0xee1c('0xb')](socket);function respondWithStatusCode(_0x24c2b1,_0x13d571){_0x13d571=_0x13d571||0xcc;return function(_0x24dd86){if(_0x24dd86){return _0x24c2b1[_0xee1c('0xc')](_0x13d571);}return _0x24c2b1[_0xee1c('0xd')](_0x13d571)[_0xee1c('0xe')]();};}function respondWithResult(_0x3820af,_0x4dd04c){_0x4dd04c=_0x4dd04c||0xc8;return function(_0x27ed01){if(_0x27ed01){return _0x3820af[_0xee1c('0xd')](_0x4dd04c)['json'](_0x27ed01);}};}function respondWithFilteredResult(_0x1a4de6,_0x31cc53){return function(_0x570604){if(_0x570604){var _0x344806=typeof _0x31cc53['offset']==='undefined'&&typeof _0x31cc53[_0xee1c('0xf')]===_0xee1c('0x10');var _0x506f74=_0x570604[_0xee1c('0x11')];var _0x3dcb97=_0x344806?0x0:_0x31cc53[_0xee1c('0x12')];var _0x9f0141=_0x344806?_0x570604['count']:_0x31cc53[_0xee1c('0x12')]+_0x31cc53[_0xee1c('0xf')];var _0x3846fa;if(_0x9f0141>=_0x506f74){_0x9f0141=_0x506f74;_0x3846fa=0xc8;}else{_0x3846fa=0xce;}_0x1a4de6[_0xee1c('0xd')](_0x3846fa);return _0x1a4de6['set'](_0xee1c('0x13'),_0x3dcb97+'-'+_0x9f0141+'/'+_0x506f74)[_0xee1c('0x14')](_0x570604);}return null;};}function removeEntity(_0x4709ed){return function(_0x49ce22){if(_0x49ce22){return _0x49ce22[_0xee1c('0x15')]()['then'](function(){var _0x5c2d21=_0x49ce22[_0xee1c('0x16')]({'plain':!![]});var _0x2650da=[{'name':_0xee1c('0x17'),'value':_0xee1c('0x18'),'ignore':![]},{'name':_0xee1c('0x19'),'value':_0xee1c('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0xee1c('0x1b'),'ignore':![]}];var _0x484ec1=_(_0x2650da)['filter'](_0xee1c('0x1c'))[_0xee1c('0x1d')](_0xee1c('0x1e'))['value']();if(_['includes'](_0x484ec1,_0x5c2d21[_0xee1c('0x1f')])){return;}var _0x28d380=_[_0xee1c('0x20')](_0x2650da,[_0xee1c('0x1e'),_0x5c2d21[_0xee1c('0x1f')]])[_0xee1c('0x21')];return db[_0xee1c('0x22')][_0xee1c('0x15')]({'where':{'type':_0x28d380,'resourceId':_0x5c2d21['id']}})[_0xee1c('0x23')](function(){return _0x49ce22;});})[_0xee1c('0x23')](function(){_0x4709ed[_0xee1c('0xd')](0xcc)[_0xee1c('0xe')]();});}};}function handleEntityNotFound(_0x5e3807){return function(_0x128bef){if(!_0x128bef){_0x5e3807[_0xee1c('0xc')](0x194);}return _0x128bef;};}function handleError(_0x44ad7d,_0x3adde9){_0x3adde9=_0x3adde9||0x1f4;return function(_0x1e8b4d){logger['error'](_0x1e8b4d['stack']);if(_0x1e8b4d[_0xee1c('0x21')]){delete _0x1e8b4d[_0xee1c('0x21')];}_0x44ad7d[_0xee1c('0xd')](_0x3adde9)['send'](_0x1e8b4d);};}exports[_0xee1c('0x24')]=function(_0x296919,_0x3970f5){var _0x28d393={},_0x585a3c={},_0x3c97c2={'count':0x0,'rows':[]};var _0x4d47aa=_[_0xee1c('0x1d')](db[_0xee1c('0x25')][_0xee1c('0x26')],function(_0x50d570){return{'name':_0x50d570['fieldName'],'type':_0x50d570[_0xee1c('0x1f')][_0xee1c('0x27')]};});_0x585a3c[_0xee1c('0x28')]=_[_0xee1c('0x1d')](_0x4d47aa,_0xee1c('0x21'));_0x585a3c[_0xee1c('0x29')]=_[_0xee1c('0x2a')](_0x296919[_0xee1c('0x29')]);_0x585a3c[_0xee1c('0x2b')]=_[_0xee1c('0x2c')](_0x585a3c[_0xee1c('0x28')],_0x585a3c[_0xee1c('0x29')]);_0x28d393[_0xee1c('0x2d')]=_[_0xee1c('0x2c')](_0x585a3c[_0xee1c('0x28')],qs[_0xee1c('0x2e')](_0x296919[_0xee1c('0x29')][_0xee1c('0x2e')]));_0x28d393[_0xee1c('0x2d')]=_0x28d393[_0xee1c('0x2d')][_0xee1c('0x2f')]?_0x28d393['attributes']:_0x585a3c[_0xee1c('0x28')];if(!_0x296919['query'][_0xee1c('0x30')](_0xee1c('0x31'))){_0x28d393['limit']=qs[_0xee1c('0xf')](_0x296919[_0xee1c('0x29')][_0xee1c('0xf')]);_0x28d393[_0xee1c('0x12')]=qs[_0xee1c('0x12')](_0x296919[_0xee1c('0x29')][_0xee1c('0x12')]);}_0x28d393[_0xee1c('0x32')]=qs[_0xee1c('0x33')](_0x296919[_0xee1c('0x29')][_0xee1c('0x33')]);_0x28d393['where']=qs[_0xee1c('0x2b')](_[_0xee1c('0x34')](_0x296919['query'],_0x585a3c['filters']),_0x4d47aa);if(_0x296919['query'][_0xee1c('0x35')]){_0x28d393['where']=_[_0xee1c('0x36')](_0x28d393[_0xee1c('0x37')],{'$or':_[_0xee1c('0x1d')](_0x4d47aa,function(_0x986b10){if(_0x986b10[_0xee1c('0x1f')]!=='VIRTUAL'){var _0x1a7bfc={};_0x1a7bfc[_0x986b10[_0xee1c('0x21')]]={'$like':'%'+_0x296919[_0xee1c('0x29')][_0xee1c('0x35')]+'%'};return _0x1a7bfc;}})});}_0x28d393=_[_0xee1c('0x36')]({},_0x28d393,_0x296919[_0xee1c('0x38')]);var _0xd309b8={'where':_0x28d393['where']};return db[_0xee1c('0x25')]['count'](_0xd309b8)[_0xee1c('0x23')](function(_0x39d936){_0x3c97c2[_0xee1c('0x11')]=_0x39d936;if(_0x296919[_0xee1c('0x29')][_0xee1c('0x39')]){_0x28d393[_0xee1c('0x3a')]=[{'all':!![]}];}return db[_0xee1c('0x25')]['findAll'](_0x28d393);})['then'](function(_0x4f23af){_0x3c97c2[_0xee1c('0x3b')]=_0x4f23af;return _0x3c97c2;})[_0xee1c('0x23')](respondWithFilteredResult(_0x3970f5,_0x28d393))[_0xee1c('0x3c')](handleError(_0x3970f5,null));};exports['show']=function(_0x4cd5cb,_0x2b17a0){var _0x53409c={'raw':![],'where':{'id':_0x4cd5cb[_0xee1c('0x3d')]['id']}},_0x19d261={};_0x19d261[_0xee1c('0x28')]=_[_0xee1c('0x2a')](db[_0xee1c('0x25')][_0xee1c('0x26')]);_0x19d261['query']=_['keys'](_0x4cd5cb[_0xee1c('0x29')]);_0x19d261['filters']=_[_0xee1c('0x2c')](_0x19d261[_0xee1c('0x28')],_0x19d261['query']);_0x53409c[_0xee1c('0x2d')]=_[_0xee1c('0x2c')](_0x19d261[_0xee1c('0x28')],qs[_0xee1c('0x2e')](_0x4cd5cb[_0xee1c('0x29')][_0xee1c('0x2e')]));_0x53409c[_0xee1c('0x2d')]=_0x53409c[_0xee1c('0x2d')]['length']?_0x53409c['attributes']:_0x19d261[_0xee1c('0x28')];if(_0x4cd5cb['query'][_0xee1c('0x39')]){_0x53409c[_0xee1c('0x3a')]=[{'all':!![]}];}_0x53409c=_[_0xee1c('0x36')]({},_0x53409c,_0x4cd5cb['options']);return db[_0xee1c('0x25')][_0xee1c('0x20')](_0x53409c)[_0xee1c('0x23')](handleEntityNotFound(_0x2b17a0,null))[_0xee1c('0x23')](respondWithResult(_0x2b17a0,null))[_0xee1c('0x3c')](handleError(_0x2b17a0,null));};exports[_0xee1c('0x15')]=function(_0x55702f,_0x18a930){return db['VoiceExtension'][_0xee1c('0x20')]({'where':{'id':_0x55702f['params']['id']}})[_0xee1c('0x23')](handleEntityNotFound(_0x18a930,null))[_0xee1c('0x23')](removeEntity(_0x18a930,null))['catch'](handleError(_0x18a930,null));};exports[_0xee1c('0x3e')]=function(_0x131674,_0xfb58f1){if(_0x131674[_0xee1c('0x3f')][_0xee1c('0x1f')]===_0xee1c('0x1a')&&!_[_0xee1c('0x40')](_0x131674[_0xee1c('0x3f')][_0xee1c('0x41')],'_')){_0x131674['body'][_0xee1c('0x41')]='_'[_0xee1c('0x42')](_0x131674[_0xee1c('0x3f')][_0xee1c('0x41')]);}return db[_0xee1c('0x25')]['create'](_0x131674[_0xee1c('0x3f')],{'raw':![]})[_0xee1c('0x23')](function(_0xcb8329){var _0x24a1fd=_0x131674[_0xee1c('0x43')]['get']({'plain':!![]});if(!_0x24a1fd)throw new Error(_0xee1c('0x44'));if(_0x24a1fd[_0xee1c('0x45')]===_0xee1c('0x43')){var _0x14edbc=_0xcb8329[_0xee1c('0x16')]({'plain':!![]});var _0x2d767c=[{'name':'InboundRoutes','value':_0xee1c('0x18')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0xee1c('0x1b')}];var _0x554514=_[_0xee1c('0x20')](_0x2d767c,[_0xee1c('0x1e'),_0x14edbc[_0xee1c('0x1f')]])[_0xee1c('0x21')];return db[_0xee1c('0x46')]['find']({'where':{'name':_0x554514,'userProfileId':_0x24a1fd[_0xee1c('0x47')]},'raw':!![]})['then'](function(_0x1bd9de){if(_0x1bd9de&&_0x1bd9de['autoAssociation']===0x0){return db[_0xee1c('0x22')][_0xee1c('0x3e')]({'name':_0x14edbc[_0xee1c('0x21')],'resourceId':_0x14edbc['id'],'type':_0x1bd9de[_0xee1c('0x21')],'sectionId':_0x1bd9de['id']},{})[_0xee1c('0x23')](function(){return _0xcb8329;});}else{return _0xcb8329;}})[_0xee1c('0x3c')](function(_0x1ce263){logger['error'](_0xee1c('0x48'),_0x1ce263);throw _0x1ce263;});}return _0xcb8329;})[_0xee1c('0x23')](respondWithResult(_0xfb58f1,0xc9))[_0xee1c('0x3c')](handleError(_0xfb58f1,null));};exports['update']=function(_0x456299,_0x223d48){if(_0x456299[_0xee1c('0x3f')]['id']){delete _0x456299[_0xee1c('0x3f')]['id'];}return db[_0xee1c('0x25')][_0xee1c('0x20')]({'where':{'id':_0x456299[_0xee1c('0x3d')]['id']}})[_0xee1c('0x23')](handleEntityNotFound(_0x223d48,null))[_0xee1c('0x23')](function(_0x59951a){if(_0x59951a){return db[_0xee1c('0x25')]['update'](_[_0xee1c('0x34')](_0x456299['body'],['exten',_0xee1c('0x49'),'description',_0xee1c('0x4a'),_0xee1c('0x4b'),_0xee1c('0x4c'),_0xee1c('0x4d')]),{'where':{'context':_0x59951a['context'],'exten':_0x59951a[_0xee1c('0x41')]},'individualHooks':!![]})['then'](function(_0x5017ca){return _0x5017ca;});}return null;})[_0xee1c('0x23')](respondWithStatusCode(_0x223d48,null))['catch'](handleError(_0x223d48,null));};exports[_0xee1c('0x4e')]=function(_0x47fa41,_0x81f257){var _0x598558=_0x47fa41['params']['id'];var _0x22e3b2=_0x47fa41[_0xee1c('0x3f')];var _0x333766=0xc8;var _0x25e710=null;return db[_0xee1c('0x4f')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xee1c('0x50')]['READ_COMMITTED']},function(_0x388ecf){return db['VoiceExtension'][_0xee1c('0x51')]({'where':{'id':_0x598558},'transaction':_0x388ecf})[_0xee1c('0x23')](function(_0x30f5e5){if(_0x30f5e5){return db[_0xee1c('0x25')][_0xee1c('0x15')]({'where':{'VoiceExtensionId':_0x598558},'transaction':_0x388ecf})['then'](function(){var _0xf80d5a=_[_0xee1c('0x1d')](_0x22e3b2,function(_0x1fadc4){_0x1fadc4['VoiceExtensionId']=_0x598558;_0x1fadc4[_0xee1c('0x52')]=!![];return _0x1fadc4;});return _0x30f5e5['createRouting'](_0xf80d5a);})['then'](function(_0x48045c){return db[_0xee1c('0x25')][_0xee1c('0x53')](_0x48045c,{'transaction':_0x388ecf});});}else{_0x333766=0x194;_0x25e710=[];}});})[_0xee1c('0x23')](function(){if(_0x333766!==0x194){return db[_0xee1c('0x25')][_0xee1c('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x598558},'order':_0xee1c('0x55')})[_0xee1c('0x23')](function(_0x8b4bd4){_0x25e710=_0x8b4bd4;});}})['catch'](function(_0x4a0427){_0x333766=0x1f4;logger['error'](_0x4a0427[_0xee1c('0x56')]);if(_0x4a0427[_0xee1c('0x21')]){delete _0x4a0427[_0xee1c('0x21')];}_0x25e710=_0x4a0427;})['finally'](function(){if(_0x25e710===null){_0x81f257[_0xee1c('0xc')](_0x333766);}else{if(_0x333766===0x1f4){_0x81f257[_0xee1c('0xd')](_0x333766)[_0xee1c('0x57')](_0x25e710);}else{_0x81f257[_0xee1c('0xd')](_0x333766)[_0xee1c('0x14')](_0x25e710);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index bfb0021..38c4bf7 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 _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 +var _0xb0bd=['remove','emit','hasOwnProperty','hook','events','VoiceExtension','setMaxListeners','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb0bd,0x164));var _0xdb0b=function(_0x2c8d76,_0x3c9f5a){_0x2c8d76=_0x2c8d76-0x0;var _0x333a23=_0xb0bd[_0x2c8d76];return _0x333a23;};'use strict';var EventEmitter=require(_0xdb0b('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xdb0b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdb0b('0x2')](0x0);var events={'afterCreate':_0xdb0b('0x3'),'afterUpdate':'update','afterDestroy':_0xdb0b('0x4')};function emitEvent(_0x918fbf){return function(_0x1cd3bc,_0x723506,_0x4b6514){VoiceExtensionEvents[_0xdb0b('0x5')](_0x918fbf+':'+_0x1cd3bc['id'],_0x1cd3bc);VoiceExtensionEvents[_0xdb0b('0x5')](_0x918fbf,_0x1cd3bc);_0x4b6514(null);};}for(var e in events){if(events[_0xdb0b('0x6')](e)){var event=events[e];VoiceExtension[_0xdb0b('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 462861b..2963cda 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 _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 +var _0xab5b=['catch','VoiceExtension','voice_extensions','get','then','concat','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','split','length','name','param','phone','prefix','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','includes','app','answer','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','priority','last'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xab5b,0x147));var _0xbab5=function(_0x44e5bf,_0x204cfc){_0x44e5bf=_0x44e5bf-0x0;var _0x572a20=_0xab5b[_0x44e5bf];return _0x572a20;};'use strict';var _=require('lodash');var attributes=require(_0xbab5('0x0'));module[_0xbab5('0x1')]=function(_0x58d745){var _0x164770=_0x58d745[_0xbab5('0x2')];function _0x5eda57(_0x3ea320){var _0x145c4b=0x2;var _0x35052c=[{'type':_0x3ea320[_0xbab5('0x3')],'app':_0xbab5('0x4'),'appdata':_0xbab5('0x5')+_0x3ea320['type'],'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320[_0xbab5('0x7')],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']}];if(_0x3ea320[_0xbab5('0x3')]===_0xbab5('0x8')){_0x35052c[_0xbab5('0x9')]({'type':_0xbab5('0x8'),'app':'Set','appdata':_0xbab5('0xa')+_0x3ea320['id'],'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320[_0xbab5('0x7')],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']});}_0x35052c[_0xbab5('0x9')]({'type':_0x3ea320[_0xbab5('0x3')],'app':'Set','appdata':_0xbab5('0xb'),'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320['exten'],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']},{'type':_0x3ea320[_0xbab5('0x3')],'app':'Set','appdata':_0xbab5('0xc'),'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320[_0xbab5('0x7')],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']},{'type':_0x3ea320['type'],'app':_0xbab5('0x4'),'appdata':_0xbab5('0xd'),'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320['exten'],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']});return _0x35052c;}function _0x1f4869(_0x35a57f){var _0xee47de=0x2;var _0x68bfd6=[{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':'CDR(type)=outbound','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0xf')+(_0x35a57f['cutdigits']?_0xbab5('0x10')+_0x35a57f[_0xbab5('0x11')]+'}':'${EXTEN}'),'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':'outbound','app':'Set','appdata':_0xbab5('0xa')+_0x35a57f['id'],'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':'outbound','app':'ExecIf','appdata':_0xbab5('0x12')+(_0xee47de+0x2)+_0xbab5('0x13')+(_0xee47de+0x1)+')','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0x35a57f['cutdigits']?_0xbab5('0x14')+_0x35a57f[_0xbab5('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x35a57f['context'],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0xc'),'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':'Set','appdata':_0xbab5('0xd'),'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0x15')+_0x35a57f['id'],'context':_0x35a57f['context'],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']}];if(_0x35a57f[_0xbab5('0x16')](_0xbab5('0x17'))&&_0x35a57f[_0xbab5('0x17')]!==_0xbab5('0x18')){_0x68bfd6[_0xbab5('0x9')]({'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0x19'),'context':_0x35a57f['context'],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0x1a')+_0x35a57f[_0xbab5('0x17')]||'wav','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']});}return _0x68bfd6;}function _0x2d34e1(_0x48450a,_0x540f8f){var _0x6375c6=[{'name':_0xbab5('0x1b'),'param':0x0},{'name':_0xbab5('0x1c'),'param':0x1},{'name':'options','param':0x2},{'name':_0xbab5('0x1d'),'param':0x3}];var _0x4ccc36={};var _0x2b9220=_0x540f8f[_0xbab5('0x1e')](',');var _0x2f3b91=[];for(var _0x207f1b=0x0;_0x207f1b<_0x6375c6[_0xbab5('0x1f')];_0x207f1b++){switch(_0x6375c6[_0x207f1b][_0xbab5('0x20')]){case _0xbab5('0x1b'):_0x4ccc36[_0xbab5('0x1b')]=_0x2b9220[_0x6375c6[_0x207f1b][_0xbab5('0x21')]][_0xbab5('0x1e')]('/')[0x1];_0x4ccc36[_0xbab5('0x22')]=_0x2b9220[_0x6375c6[_0x207f1b]['param']][_0xbab5('0x1e')]('/')[0x2];_0x4ccc36[_0xbab5('0x23')]=_0x4ccc36[_0xbab5('0x22')]?_0x4ccc36[_0xbab5('0x22')][_0xbab5('0x1e')]('$')[0x0]:undefined;_0x4ccc36[_0xbab5('0x22')]=_0x48450a[_0xbab5('0x11')]?(_0x4ccc36[_0xbab5('0x23')]||'')+_0xbab5('0x10')+_0x48450a[_0xbab5('0x11')]+'}':(_0x4ccc36[_0xbab5('0x23')]||'')+_0xbab5('0x24');_0x2f3b91[_0x6375c6[_0x207f1b][_0xbab5('0x21')]]=[_0xbab5('0x25'),_0x4ccc36['trunk'],_0x4ccc36[_0xbab5('0x22')]][_0xbab5('0x26')]('/');break;case'options':_0x4ccc36[_0xbab5('0x27')]=_0x2b9220[_0x6375c6[_0x207f1b]['param']];if(_0x48450a[_0xbab5('0x17')]!==_0xbab5('0x18')){if(_0x4ccc36[_0xbab5('0x27')][_0xbab5('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x4ccc36['options']+=_0xbab5('0x29');}}else{_0x4ccc36[_0xbab5('0x27')]=_0x4ccc36[_0xbab5('0x27')][_0xbab5('0x2a')](_0xbab5('0x29'),'');}_0x2f3b91[_0x6375c6[_0x207f1b][_0xbab5('0x21')]]=_0x4ccc36['options'];break;default:_0x2f3b91[_0x6375c6[_0x207f1b][_0xbab5('0x21')]]=_0x2b9220[_0x6375c6[_0x207f1b][_0xbab5('0x21')]];}}return _0x2f3b91[_0xbab5('0x26')](',');}function _0x5b25ca(_0x8d8a2c,_0x2e91fd,_0x2ef316){return new Promise(function(_0x1418a5,_0xfcc5c9){var _0xd715d3=[];if(_[_0xbab5('0x2b')](_0x2e91fd))return _0x1418a5(_0xd715d3);_0x164770[_0xbab5('0x2c')][_0xbab5('0x2d')]({'attributes':['id',_0xbab5('0x2e'),_0xbab5('0x2f')],'raw':!![]})['then'](function(_0x223d09){for(var _0x561bda=0x0,_0x23f1e7=0x0;_0x561bda<_0x2e91fd['length'];_0x561bda++,_0x23f1e7=0x0){var _0xc4b40=_0x2e91fd[_0x561bda];var _0x2c0578=[];var _0x105c61=[];delete _0xc4b40['id'];if(_0xc4b40[_0xbab5('0x2e')]!==_0xbab5('0x30')){_0xc4b40['intervals']=[_0xc4b40[_0xbab5('0x2e')]];}else{_0xc4b40[_0xbab5('0x31')]=_0xc4b40[_0xbab5('0x2f')]?_[_0xbab5('0x32')](_[_0xbab5('0x33')](_0x223d09,{'IntervalId':_0xc4b40[_0xbab5('0x2f')]}),_0xbab5('0x2e')):[];}_0xc4b40['context']=_0x8d8a2c[_0xbab5('0x6')];_0xc4b40[_0xbab5('0x7')]=_0x8d8a2c[_0xbab5('0x7')];if(_0xc4b40[_0xbab5('0x3')])_0xc4b40['type']=_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')]();if(_0x8d8a2c[_0xbab5('0x3')]===_0xbab5('0xe')){if(_0xc4b40[_0xbab5('0x16')](_0xbab5('0x35'))&&_0xc4b40[_0xbab5('0x35')]&&_0xc4b40[_0xbab5('0x35')]!=='--'){_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40['type'][_0xbab5('0x34')](),'app':_0xbab5('0x4'),'appdata':'CDR(tag)='+_0xc4b40['tag'],'context':_0x8d8a2c[_0xbab5('0x6')],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}_0x2c0578['push']({'type':_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')](),'app':'ExecIf','appdata':_0xbab5('0x36')+(_0xc4b40[_0xbab5('0x37')]?_0xbab5('0x38')+_0xc4b40[_0xbab5('0x37')]+')':_0xbab5('0x39')),'context':_0x8d8a2c[_0xbab5('0x6')],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40['intervals'][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}else{if(_0xc4b40[_0xbab5('0x16')]('answer')){if(['queue','playback'][_0xbab5('0x3a')](_0xc4b40[_0xbab5('0x3b')][_0xbab5('0x34')]())&&_0xc4b40['appType']!=='custom'){if(_0xc4b40[_0xbab5('0x3c')]){_0x2c0578['push']({'type':_0xc4b40['type']['toLowerCase'](),'app':_0xbab5('0x3d'),'appdata':_0xbab5('0x3e'),'context':_0x8d8a2c['context'],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40[_0xbab5('0x31')]['length']+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});_0x2c0578['push']({'type':_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')](),'app':_0xbab5('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x8d8a2c['context'],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40[_0xbab5('0x31')]['length']+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}else{_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40[_0xbab5('0x3')]['toLowerCase'](),'app':_0xbab5('0x3d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x8d8a2c[_0xbab5('0x6')],'exten':_0x8d8a2c['exten'],'priority':_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40['type']['toLowerCase'](),'app':'Set','appdata':_0xbab5('0x3f'),'context':_0x8d8a2c['context'],'exten':_0x8d8a2c['exten'],'priority':_0xc4b40[_0xbab5('0x31')]['length']+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}}}}for(var _0x36eb15=0x0;_0x36eb15<_0xc4b40['intervals'][_0xbab5('0x1f')];_0x36eb15++){var _0x3080e0=_0x2ef316+_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')];var _0x2ad590=_0x36eb15===_0xc4b40[_0xbab5('0x31')]['length']-0x1?_0x2ef316+_0x2c0578[_0xbab5('0x1f')]+_0x105c61['length']+0x2:_0x2ef316+_0x36eb15+0x1;_0x2c0578[_0xbab5('0x40')](_0x36eb15,0x0,{'type':_0x8d8a2c[_0xbab5('0x3')],'app':_0xbab5('0x41'),'appdata':_0xc4b40[_0xbab5('0x31')][_0x36eb15]+'?'+_0x8d8a2c[_0xbab5('0x6')]+',${EXTEN},'+_0x3080e0+':'+_0x8d8a2c['context']+_0xbab5('0x42')+_0x2ad590,'exten':_0x8d8a2c[_0xbab5('0x7')],'context':_0x8d8a2c[_0xbab5('0x6')],'priority':_0x2ef316+_0x36eb15,'VoiceExtensionId':_0x8d8a2c['id']});}if(_0xc4b40[_0xbab5('0x43')]===_0xbab5('0x44')){_0xc4b40[_0xbab5('0x45')]=_0x2d34e1(_0x8d8a2c,_0xc4b40['appdata']);}if(_0xc4b40['appType']===_0xbab5('0x46')){_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')](),'app':_0xbab5('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x8d8a2c['context'],'exten':_0x8d8a2c['exten'],'priority':_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}_0xc4b40[_0xbab5('0x47')]=_0x2c0578[_0xbab5('0x1f')]?_[_0xbab5('0x48')](_0x2c0578)['priority']+0x1:_0x2ef316;_0xd715d3=_['concat'](_0xd715d3,_0x2c0578,[_0xc4b40],_0x105c61);_0x2ef316=_[_0xbab5('0x48')](_0xd715d3)[_0xbab5('0x47')]+0x1;}return _0x1418a5(_0xd715d3);})[_0xbab5('0x49')](function(_0x359e4f){_0xfcc5c9(_0x359e4f);});});}return _0x58d745['define'](_0xbab5('0x4a'),attributes,{'tableName':_0xbab5('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44b268){var _0x1995ee=this[_0xbab5('0x4c')]({'plain':!![]});var _0x49c4af=_0x1995ee[_0xbab5('0x3')]===_0xbab5('0xe')?_0x1f4869(_0x1995ee):_0x5eda57(_0x1995ee);return _0x5b25ca(_0x1995ee,_0x44b268,_[_0xbab5('0x48')](_0x49c4af)[_0xbab5('0x47')]+0x1)[_0xbab5('0x4d')](function(_0x757d7f){var _0xc5802=_[_0xbab5('0x4e')](_0x49c4af,_0x757d7f);_0xc5802['push']({'type':_0x1995ee['type'],'app':_0xbab5('0x4f'),'exten':_0x1995ee['exten'],'context':_0x1995ee['context'],'priority':_[_0xbab5('0x48')](_0xc5802)[_0xbab5('0x47')]+0x1,'VoiceExtensionId':_0x1995ee['id']});return _0xc5802;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2d83b44..b03b47c 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 _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 +var _0x5aaa=['request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x2827c8,_0x42d8b9){var _0x2640b8=function(_0x1b924b){while(--_0x1b924b){_0x2827c8['push'](_0x2827c8['shift']());}};_0x2640b8(++_0x42d8b9);}(_0x5aaa,0xff));var _0xa5aa=function(_0x2953f1,_0x1a925d){_0x2953f1=_0x2953f1-0x0;var _0x3c194c=_0x5aaa[_0x2953f1];return _0x3c194c;};'use strict';var _=require(_0xa5aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5aa('0x1'))['db'];var utils=require(_0xa5aa('0x2'));var logger=require(_0xa5aa('0x3'))('rpc');var config=require(_0xa5aa('0x4'));var jayson=require(_0xa5aa('0x5'));var client=jayson['client'][_0xa5aa('0x6')]({'port':0x232a});config[_0xa5aa('0x7')]=_[_0xa5aa('0x8')](config[_0xa5aa('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5aa('0x7')]));require(_0xa5aa('0x9'))[_0xa5aa('0xa')](socket);function respondWithRpcPromise(_0x5bb8cd,_0x51b854,_0x5769ca){return new BPromise(function(_0x119692,_0x5e23f2){return client[_0xa5aa('0xb')](_0x5bb8cd,_0x5769ca)[_0xa5aa('0xc')](function(_0x2b4b12){logger[_0xa5aa('0xd')](_0xa5aa('0xe'),_0x51b854,'request\x20sent');logger[_0xa5aa('0xf')](_0xa5aa('0x10'),_0x51b854,_0xa5aa('0x11'),JSON[_0xa5aa('0x12')](_0x2b4b12));if(_0x2b4b12['error']){if(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x14')]===0x1f4){logger[_0xa5aa('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x51b854,_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);return _0x5e23f2(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);}logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x2b4b12[_0xa5aa('0x13')]['message']);return _0x119692(_0x2b4b12[_0xa5aa('0x13')]['message']);}else{logger['info'](_0xa5aa('0xe'),_0x51b854,_0xa5aa('0x11'));_0x119692(_0x2b4b12[_0xa5aa('0x16')][_0xa5aa('0x15')]);}})[_0xa5aa('0x17')](function(_0x3977f2){logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x3977f2);_0x5e23f2(_0x3977f2);});});}exports['GetVoiceExtension']=function(_0x127eb7){var _0x1eede0=this;return new Promise(function(_0x554433,_0x1e0604){return db[_0xa5aa('0x18')]['findAll']({'raw':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1b')]||null:null,'attributes':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1c')]||null:null,'limit':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7['options'][_0xa5aa('0x1d')]||null:null,'include':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1e')]?_[_0xa5aa('0x1f')](_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1e')],function(_0x28dc46){return{'model':db[_0x28dc46[_0xa5aa('0x20')]],'as':_0x28dc46['as'],'attributes':_0x28dc46[_0xa5aa('0x1c')],'include':_0x28dc46[_0xa5aa('0x1e')]?_[_0xa5aa('0x1f')](_0x28dc46[_0xa5aa('0x1e')],function(_0x247f69){return{'model':db[_0x247f69[_0xa5aa('0x20')]],'as':_0x247f69['as'],'attributes':_0x247f69[_0xa5aa('0x1c')],'include':_0x247f69[_0xa5aa('0x1e')]?_['map'](_0x247f69['include'],function(_0x565f64){return{'model':db[_0x565f64['model']],'as':_0x565f64['as'],'attributes':_0x565f64[_0xa5aa('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bb923){logger['info'](_0xa5aa('0x21'),_0x127eb7);logger[_0xa5aa('0xf')](_0xa5aa('0x21'),_0x127eb7,JSON[_0xa5aa('0x12')](_0x4bb923));_0x554433(_0x4bb923);})['catch'](function(_0x4ab988){logger[_0xa5aa('0x13')]('GetVoiceExtension',_0x4ab988[_0xa5aa('0x15')],_0x127eb7);_0x1e0604(_0x1eede0[_0xa5aa('0x13')](0x1f4,_0x4ab988['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index edcdcce..85db215 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 _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 +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x1b33bd,_0x3fa103){var _0x556c93=function(_0x128e79){while(--_0x128e79){_0x1b33bd['push'](_0x1b33bd['shift']());}};_0x556c93(++_0x3fa103);}(_0x0295,0x1f0));var _0x5029=function(_0x477598,_0x4dab5c){_0x477598=_0x477598-0x0;var _0x4c7ffb=_0x0295[_0x477598];return _0x4c7ffb;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index b8dd985..7e3bcb3 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 _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 +var _0xed1c=['get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller'];(function(_0x19c1f4,_0x3a9e79){var _0x2a6b81=function(_0x532585){while(--_0x532585){_0x19c1f4['push'](_0x19c1f4['shift']());}};_0x2a6b81(++_0x3a9e79);}(_0xed1c,0xe4));var _0xced1=function(_0x5bd77f,_0x7ddf87){_0x5bd77f=_0x5bd77f-0x0;var _0x576de5=_0xed1c[_0x5bd77f];return _0x576de5;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/',auth['isAuthenticated'](),controller[_0xced1('0xe')]);router['put'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);router[_0xced1('0x10')](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);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 406a1c4..0e550ff 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 _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 +var _0x3179=['STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports'];(function(_0x46aad3,_0x5c363f){var _0x20e425=function(_0x3980d2){while(--_0x3980d2){_0x46aad3['push'](_0x46aad3['shift']());}};_0x20e425(++_0x5c363f);}(_0x3179,0x1ca));var _0x9317=function(_0x3ae71b,_0x24338f){_0x3ae71b=_0x3ae71b-0x0;var _0x518d80=_0x3179[_0x3ae71b];return _0x518d80;};'use strict';var Sequelize=require(_0x9317('0x0'));module[_0x9317('0x1')]={'customer_id':{'type':Sequelize[_0x9317('0x2')]},'context':{'type':Sequelize[_0x9317('0x2')],'defaultValue':_0x9317('0x3'),'unique':_0x9317('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x9317('0x2')]},'fullname':{'type':Sequelize[_0x9317('0x2')]},'email':{'type':Sequelize[_0x9317('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3ddf35){this[_0x9317('0x5')](_0x9317('0x6'),typeof _0x3ddf35===_0x9317('0x7')&&_0x3ddf35[_0x9317('0x8')]()?_0x3ddf35[_0x9317('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x9317('0x2')],'defaultValue':_0x9317('0x9')},'attach':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9317('0x2')]},'callback':{'type':Sequelize[_0x9317('0x2')]},'review':{'type':Sequelize['ENUM'](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9317('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9317('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9317('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9317('0xa')]('yes','no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'stamp':{'type':_0x9317('0xd')},'emailsubject':{'type':Sequelize[_0x9317('0x2')]},'emailbody':{'type':Sequelize[_0x9317('0x2')]},'maxsecs':{'type':Sequelize[_0x9317('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9317('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9317('0xf')],'get':function(){return this[_0x9317('0x10')](_0x9317('0x11'))+_0x9317('0x12')+this['getDataValue'](_0x9317('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b4dc916..84be1ec 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 _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 +var _0xb688=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','nolimit','filter','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','get','Voicemails','end','error','name','send','index','map','VoiceMail'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb688,0xcf));var _0x8b68=function(_0x1286e6,_0x5adbd6){_0x1286e6=_0x1286e6-0x0;var _0x201da3=_0xb688[_0x1286e6];return _0x201da3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){var _0x4ca77d=_0x59bb8a[_0x8b68('0x27')]({'plain':!![]});var _0x3cf8d2=_0x8b68('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cf8d2,'resourceId':_0x4ca77d['id']}})['then'](function(){return _0x59bb8a;});})[_0x8b68('0x25')](function(){_0x32ddc5[_0x8b68('0x1c')](0xcc)[_0x8b68('0x29')]();});}};}function handleEntityNotFound(_0x583476,_0x3311c7){return function(_0x53aaa2){if(!_0x53aaa2){_0x583476['sendStatus'](0x194);}return _0x53aaa2;};}function handleError(_0x3865ea,_0x59b3ce){_0x59b3ce=_0x59b3ce||0x1f4;return function(_0x26cad7){logger[_0x8b68('0x2a')](_0x26cad7['stack']);if(_0x26cad7['name']){delete _0x26cad7[_0x8b68('0x2b')];}_0x3865ea[_0x8b68('0x1c')](_0x59b3ce)[_0x8b68('0x2c')](_0x26cad7);};}exports[_0x8b68('0x2d')]=function(_0x210926,_0x2ad2df){var _0x460c37={},_0x5b7ed1={},_0x3b6d1b={'count':0x0,'rows':[]};var _0x50a1e9=_[_0x8b68('0x2e')](db[_0x8b68('0x2f')]['rawAttributes'],function(_0x216aa6){return{'name':_0x216aa6[_0x8b68('0x30')],'type':_0x216aa6[_0x8b68('0x31')]['key']};});_0x5b7ed1['model']=_[_0x8b68('0x2e')](_0x50a1e9,_0x8b68('0x2b'));_0x5b7ed1[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x210926[_0x8b68('0x32')]);_0x5b7ed1[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],_0x5b7ed1[_0x8b68('0x32')]);_0x460c37[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x210926[_0x8b68('0x32')][_0x8b68('0x38')]));_0x460c37[_0x8b68('0x37')]=_0x460c37[_0x8b68('0x37')][_0x8b68('0x39')]?_0x460c37[_0x8b68('0x37')]:_0x5b7ed1[_0x8b68('0x36')];if(!_0x210926[_0x8b68('0x32')][_0x8b68('0x3a')]('nolimit')){_0x460c37['limit']=qs[_0x8b68('0x1f')](_0x210926[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x460c37[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x210926[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x460c37[_0x8b68('0x3b')]=qs['sort'](_0x210926[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x460c37[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x210926[_0x8b68('0x32')],_0x5b7ed1[_0x8b68('0x34')]),_0x50a1e9);if(_0x210926[_0x8b68('0x32')]['filter']){_0x460c37[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x460c37[_0x8b68('0x3d')],{'$or':_[_0x8b68('0x2e')](_0x50a1e9,function(_0x3ecc60){if(_0x3ecc60[_0x8b68('0x31')]!==_0x8b68('0x40')){var _0x50a9c6={};_0x50a9c6[_0x3ecc60[_0x8b68('0x2b')]]={'$like':'%'+_0x210926[_0x8b68('0x32')]['filter']+'%'};return _0x50a9c6;}})});}_0x460c37=_[_0x8b68('0x3f')]({},_0x460c37,_0x210926[_0x8b68('0x41')]);var _0x50b2f1={'where':_0x460c37['where']};return db['VoiceMail']['count'](_0x50b2f1)[_0x8b68('0x25')](function(_0x23d24a){_0x3b6d1b['count']=_0x23d24a;if(_0x210926[_0x8b68('0x32')]['includeAll']){_0x460c37[_0x8b68('0x42')]=[{'all':!![]}];}return db[_0x8b68('0x2f')]['findAll'](_0x460c37);})[_0x8b68('0x25')](function(_0x5ae345){_0x3b6d1b['rows']=_0x5ae345;return _0x3b6d1b;})['then'](respondWithFilteredResult(_0x2ad2df,_0x460c37))[_0x8b68('0x43')](handleError(_0x2ad2df,null));};exports[_0x8b68('0x44')]=function(_0x3ba80e,_0xa70f60){var _0x50e425={'raw':!![],'where':{'id':_0x3ba80e['params']['id']}},_0x20162a={};_0x20162a[_0x8b68('0x36')]=_[_0x8b68('0x33')](db['VoiceMail'][_0x8b68('0x45')]);_0x20162a[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ba80e[_0x8b68('0x32')]);_0x20162a['filters']=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],_0x20162a[_0x8b68('0x32')]);_0x50e425[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x50e425[_0x8b68('0x37')]=_0x50e425[_0x8b68('0x37')][_0x8b68('0x39')]?_0x50e425[_0x8b68('0x37')]:_0x20162a[_0x8b68('0x36')];if(_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x46')]){_0x50e425['include']=[{'all':!![]}];}_0x50e425=_[_0x8b68('0x3f')]({},_0x50e425,_0x3ba80e[_0x8b68('0x41')]);return db['VoiceMail'][_0x8b68('0x47')](_0x50e425)['then'](handleEntityNotFound(_0xa70f60,null))['then'](respondWithResult(_0xa70f60,null))['catch'](handleError(_0xa70f60,null));};exports[_0x8b68('0x48')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2f')]['create'](_0x35874b['body'],{})[_0x8b68('0x25')](function(_0x163fd5){var _0x1e900f=_0x35874b['user'][_0x8b68('0x27')]({'plain':!![]});if(!_0x1e900f)throw new Error(_0x8b68('0x49'));if(_0x1e900f['role']===_0x8b68('0x4a')){var _0xacac82=_0x163fd5['get']({'plain':!![]});var _0x18a9ae=_0x8b68('0x28');return db['UserProfileSection'][_0x8b68('0x47')]({'where':{'name':_0x18a9ae,'userProfileId':_0x1e900f[_0x8b68('0x4b')]},'raw':!![]})['then'](function(_0x543d74){if(_0x543d74&&_0x543d74['autoAssociation']===0x0){return db[_0x8b68('0x4c')][_0x8b68('0x48')]({'name':_0xacac82[_0x8b68('0x2b')],'resourceId':_0xacac82['id'],'type':_0x543d74[_0x8b68('0x2b')],'sectionId':_0x543d74['id']},{})['then'](function(){return _0x163fd5;});}else{return _0x163fd5;}})['catch'](function(_0x4492fd){logger[_0x8b68('0x2a')](_0x8b68('0x4d'),_0x4492fd);throw _0x4492fd;});}return _0x163fd5;})['then'](respondWithResult(_0x34047c,0xc9))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports[_0x8b68('0x24')]=function(_0x3f9d34,_0x4dda69){if(_0x3f9d34[_0x8b68('0x4e')]['id']){delete _0x3f9d34['body']['id'];}return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x3f9d34['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x4dda69,null))[_0x8b68('0x25')](saveUpdates(_0x3f9d34[_0x8b68('0x4e')],null))[_0x8b68('0x25')](respondWithResult(_0x4dda69,null))[_0x8b68('0x43')](handleError(_0x4dda69,null));};exports['destroy']=function(_0x241166,_0x3f3e43){return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x241166[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x3f3e43,null))[_0x8b68('0x25')](removeEntity(_0x3f3e43,null))[_0x8b68('0x43')](handleError(_0x3f3e43,null));};exports['getMessages']=function(_0x3f423e,_0x1a85da,_0x1e8694){return db[_0x8b68('0x2f')][_0x8b68('0x50')]({'where':{'id':_0x3f423e[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x1a85da,null))[_0x8b68('0x25')](function(_0x6d63cb){var _0x271dbe;var _0x368c86={},_0x42871e={};_0x42871e[_0x8b68('0x36')]=_[_0x8b68('0x33')](db[_0x8b68('0x51')][_0x8b68('0x45')]);_0x42871e[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3f423e[_0x8b68('0x32')]);_0x42871e[_0x8b68('0x34')]=_['intersection'](_0x42871e[_0x8b68('0x36')],_0x42871e['query']);_0x368c86['attributes']=_[_0x8b68('0x35')](_0x42871e['model'],qs[_0x8b68('0x38')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x368c86['attributes']=_0x368c86[_0x8b68('0x37')][_0x8b68('0x39')]?_0x368c86[_0x8b68('0x37')]:_0x42871e[_0x8b68('0x36')];if(!_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3a')](_0x8b68('0x52'))){_0x368c86['limit']=qs['limit'](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x368c86[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x368c86[_0x8b68('0x3b')]=qs[_0x8b68('0x3c')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x368c86[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x3f423e[_0x8b68('0x32')],_0x42871e[_0x8b68('0x34')]));if(_0x3f423e[_0x8b68('0x32')][_0x8b68('0x53')]){_0x368c86[_0x8b68('0x3d')]=_['merge'](_0x368c86['where'],{'$or':_[_0x8b68('0x2e')](_0x368c86[_0x8b68('0x37')],function(_0x5bd581){var _0x48d57a={};_0x48d57a[_0x5bd581]={'$like':'%'+_0x3f423e['query'][_0x8b68('0x53')]+'%'};return _0x48d57a;})});}_0x368c86[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x368c86[_0x8b68('0x3d')],{'mailboxuser':_0x6d63cb[_0x8b68('0x54')]});_0x368c86=_['merge']({},_0x368c86,_0x3f423e[_0x8b68('0x41')]);return db[_0x8b68('0x51')]['findAndCountAll'](_0x368c86)[_0x8b68('0x25')](respondWithFilteredResult(_0x1a85da,_0x368c86));})['catch'](handleError(_0x1a85da,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 19710d6..23f3201 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 _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 +var _0xad4d=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','context','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x373202,_0x1a1fd4){var _0x5e90ab=function(_0x20da9b){while(--_0x20da9b){_0x373202['push'](_0x373202['shift']());}};_0x5e90ab(++_0x1a1fd4);}(_0xad4d,0x16f));var _0xdad4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xad4d[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xdad4('0x0'));var util=require('util');var logger=require(_0xdad4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdad4('0x2'));var fs=require('fs');var path=require(_0xdad4('0x3'));var rimraf=require(_0xdad4('0x4'));var config=require(_0xdad4('0x5'));var attributes=require(_0xdad4('0x6'));module[_0xdad4('0x7')]=function(_0x3cfa5d,_0x23c099){return _0x3cfa5d[_0xdad4('0x8')](_0xdad4('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xdad4('0xa'),'fields':['mailbox',_0xdad4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c2553c7..139a36c 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 _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 +var _0xb677=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util'];(function(_0x458b15,_0x8dcc1d){var _0x3aee0c=function(_0x5d0af8){while(--_0x5d0af8){_0x458b15['push'](_0x458b15['shift']());}};_0x3aee0c(++_0x8dcc1d);}(_0xb677,0x83));var _0x7b67=function(_0x35dd06,_0x24cf34){_0x35dd06=_0x35dd06-0x0;var _0x2db3fd=_0xb677[_0x35dd06];return _0x2db3fd;};'use strict';var _=require('lodash');var util=require(_0x7b67('0x0'));var moment=require('moment');var BPromise=require(_0x7b67('0x1'));var rs=require(_0x7b67('0x2'));var fs=require('fs');var Redis=require(_0x7b67('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b67('0x4'));var config=require(_0x7b67('0x5'));var jayson=require(_0x7b67('0x6'));var client=jayson[_0x7b67('0x7')][_0x7b67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2905cd,_0x2fff04,_0x538c31){return new BPromise(function(_0x18cdf1,_0x96fdee){return client[_0x7b67('0x9')](_0x2905cd,_0x538c31)[_0x7b67('0xa')](function(_0x1d0de4){logger[_0x7b67('0xb')]('VoiceMail,\x20%s,\x20%s',_0x2fff04,_0x7b67('0xc'));logger[_0x7b67('0xd')](_0x7b67('0xe'),_0x2fff04,_0x7b67('0xc'),JSON[_0x7b67('0xf')](_0x1d0de4));if(_0x1d0de4['error']){if(_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x11')]===0x1f4){logger[_0x7b67('0x10')](_0x7b67('0x12'),_0x2fff04,_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x13')]);return _0x96fdee(_0x1d0de4['error'][_0x7b67('0x13')]);}logger[_0x7b67('0x10')](_0x7b67('0x12'),_0x2fff04,_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x13')]);return _0x18cdf1(_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x13')]);}else{logger[_0x7b67('0xb')](_0x7b67('0x12'),_0x2fff04,_0x7b67('0xc'));_0x18cdf1(_0x1d0de4[_0x7b67('0x14')]['message']);}})[_0x7b67('0x15')](function(_0x5f349e){logger[_0x7b67('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2fff04,_0x5f349e);_0x96fdee(_0x5f349e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index ad28c9f..af4cfc9 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 _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 +var _0xedc7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xedc7,0x1a4));var _0x7edc=function(_0x46bf73,_0x266046){_0x46bf73=_0x46bf73-0x0;var _0x5c1dc6=_0xedc7[_0x46bf73];return _0x5c1dc6;};'use strict';var multer=require(_0x7edc('0x0'));var util=require(_0x7edc('0x1'));var path=require(_0x7edc('0x2'));var timeout=require(_0x7edc('0x3'));var express=require(_0x7edc('0x4'));var router=express[_0x7edc('0x5')]();var fs_extra=require(_0x7edc('0x6'));var auth=require(_0x7edc('0x7'));var interaction=require(_0x7edc('0x8'));var config=require(_0x7edc('0x9'));var controller=require(_0x7edc('0xa'));router[_0x7edc('0xb')]('/',auth[_0x7edc('0xc')](),controller[_0x7edc('0xd')]);router[_0x7edc('0xb')](_0x7edc('0xe'),auth[_0x7edc('0xc')](),controller['show']);router[_0x7edc('0xb')](_0x7edc('0xf'),auth[_0x7edc('0xc')](),controller['download']);router[_0x7edc('0x10')]('/',auth[_0x7edc('0xc')](),controller[_0x7edc('0x11')]);router[_0x7edc('0x12')](_0x7edc('0xe'),auth['isAuthenticated'](),controller[_0x7edc('0x13')]);router['delete'](_0x7edc('0xe'),auth[_0x7edc('0xc')](),controller[_0x7edc('0x14')]);module[_0x7edc('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 929e5cb..a59b4b2 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 _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 +var _0x155b=['INTEGER','STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x155b,0x185));var _0xb155=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x155b[_0x1ca29f];return _0x576c3b;};'use strict';var Sequelize=require('sequelize');module[_0xb155('0x0')]={'name':{'type':Sequelize[_0xb155('0x1')],'get':function(_0xb5becc){return this[_0xb155('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb155('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xb155('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xb155('0x6'),'defaultValue':Sequelize['literal'](_0xb155('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 93f537c..c922fdc 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 _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 +var _0xce6f=['create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length'];(function(_0x373d4f,_0x33e53d){var _0x54054d=function(_0x389988){while(--_0x389988){_0x373d4f['push'](_0x373d4f['shift']());}};_0x54054d(++_0x33e53d);}(_0xce6f,0x15d));var _0xfce6=function(_0x5d6ecb,_0x45140a){_0x5d6ecb=_0x5d6ecb-0x0;var _0x3f6324=_0xce6f[_0x5d6ecb];return _0x3f6324;};'use strict';var emlformat=require(_0xfce6('0x0'));var rimraf=require(_0xfce6('0x1'));var zipdir=require(_0xfce6('0x2'));var jsonpatch=require(_0xfce6('0x3'));var rp=require(_0xfce6('0x4'));var moment=require('moment');var BPromise=require(_0xfce6('0x5'));var Mustache=require('mustache');var util=require(_0xfce6('0x6'));var path=require(_0xfce6('0x7'));var sox=require(_0xfce6('0x8'));var csv=require(_0xfce6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfce6('0xa'));var _=require('lodash');var squel=require(_0xfce6('0xb'));var crypto=require('crypto');var jsforce=require(_0xfce6('0xc'));var deskjs=require(_0xfce6('0xd'));var toCsv=require(_0xfce6('0x9'));var querystring=require('querystring');var Papa=require(_0xfce6('0xe'));var Redis=require(_0xfce6('0xf'));var authService=require(_0xfce6('0x10'));var qs=require(_0xfce6('0x11'));var as=require(_0xfce6('0x12'));var hardwareService=require(_0xfce6('0x13'));var logger=require('../../config/logger')(_0xfce6('0x14'));var utils=require(_0xfce6('0x15'));var config=require(_0xfce6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3db79c,_0x2807d3){_0x2807d3=_0x2807d3||0xcc;return function(_0x4d14d8){if(_0x4d14d8){return _0x3db79c[_0xfce6('0x17')](_0x2807d3);}return _0x3db79c[_0xfce6('0x18')](_0x2807d3)[_0xfce6('0x19')]();};}function respondWithResult(_0x1b8869,_0x360750){_0x360750=_0x360750||0xc8;return function(_0x3b0874){if(_0x3b0874){return _0x1b8869[_0xfce6('0x18')](_0x360750)[_0xfce6('0x1a')](_0x3b0874);}};}function respondWithFilteredResult(_0x4b69ee,_0x1eefe7){return function(_0x280f67){if(_0x280f67){var _0x179064=typeof _0x1eefe7[_0xfce6('0x1b')]===_0xfce6('0x1c')&&typeof _0x1eefe7['limit']===_0xfce6('0x1c');var _0x294870=_0x280f67[_0xfce6('0x1d')];var _0x35b662=_0x179064?0x0:_0x1eefe7[_0xfce6('0x1b')];var _0x4285f8=_0x179064?_0x280f67[_0xfce6('0x1d')]:_0x1eefe7[_0xfce6('0x1b')]+_0x1eefe7[_0xfce6('0x1e')];var _0x17dd88;if(_0x4285f8>=_0x294870){_0x4285f8=_0x294870;_0x17dd88=0xc8;}else{_0x17dd88=0xce;}_0x4b69ee['status'](_0x17dd88);return _0x4b69ee[_0xfce6('0x1f')](_0xfce6('0x20'),_0x35b662+'-'+_0x4285f8+'/'+_0x294870)[_0xfce6('0x1a')](_0x280f67);}return null;};}function patchUpdates(_0x3d70f2){return function(_0x19594f){try{jsonpatch[_0xfce6('0x21')](_0x19594f,_0x3d70f2,!![]);}catch(_0x28073b){return BPromise['reject'](_0x28073b);}return _0x19594f[_0xfce6('0x22')]();};}function saveUpdates(_0x15b875,_0x2b5aed){return function(_0x5ced53){if(_0x5ced53){return _0x5ced53[_0xfce6('0x23')](_0x15b875)['then'](function(_0x2fe21a){return _0x2fe21a;});}return null;};}function removeEntity(_0x1696f2,_0x303b8c){return function(_0x43268d){if(_0x43268d){return _0x43268d[_0xfce6('0x24')]()[_0xfce6('0x25')](function(){_0x1696f2[_0xfce6('0x18')](0xcc)[_0xfce6('0x19')]();});}};}function handleEntityNotFound(_0x1a133c,_0x1835b2){return function(_0x218dcb){if(!_0x218dcb){_0x1a133c[_0xfce6('0x17')](0x194);}return _0x218dcb;};}function handleError(_0x152cd2,_0x318b3a){_0x318b3a=_0x318b3a||0x1f4;return function(_0x5ac371){logger[_0xfce6('0x26')](_0x5ac371[_0xfce6('0x27')]);if(_0x5ac371[_0xfce6('0x28')]){delete _0x5ac371[_0xfce6('0x28')];}_0x152cd2['status'](_0x318b3a)[_0xfce6('0x29')](_0x5ac371);};}exports['index']=function(_0x34e77e,_0x1a6e8e){var _0x889917={},_0x18c581={},_0x58cdbf={'count':0x0,'rows':[]};var _0xb71100=_[_0xfce6('0x2a')](db[_0xfce6('0x2b')][_0xfce6('0x2c')],function(_0x361c5b){return{'name':_0x361c5b[_0xfce6('0x2d')],'type':_0x361c5b[_0xfce6('0x2e')][_0xfce6('0x2f')]};});_0x18c581[_0xfce6('0x30')]=_['differenceBy'](_[_0xfce6('0x2a')](_0xb71100,_0xfce6('0x28')),['name']);_0x18c581[_0xfce6('0x31')]=_['keys'](_0x34e77e['query']);_0x18c581[_0xfce6('0x32')]=_[_0xfce6('0x33')](_0x18c581[_0xfce6('0x30')],_0x18c581['query']);_0x889917[_0xfce6('0x34')]=_[_0xfce6('0x33')](_0x18c581['model'],qs[_0xfce6('0x35')](_0x34e77e[_0xfce6('0x31')][_0xfce6('0x35')]));_0x889917[_0xfce6('0x34')]=_0x889917[_0xfce6('0x34')]['length']?_0x889917[_0xfce6('0x34')]:_0x18c581[_0xfce6('0x30')];if(!_0x34e77e[_0xfce6('0x31')][_0xfce6('0x36')]('nolimit')){_0x889917[_0xfce6('0x1e')]=qs[_0xfce6('0x1e')](_0x34e77e[_0xfce6('0x31')]['limit']);_0x889917[_0xfce6('0x1b')]=qs[_0xfce6('0x1b')](_0x34e77e[_0xfce6('0x31')][_0xfce6('0x1b')]);}_0x889917[_0xfce6('0x37')]=qs['sort'](_0x34e77e['query'][_0xfce6('0x38')]);_0x889917[_0xfce6('0x39')]=qs[_0xfce6('0x32')](_['pick'](_0x34e77e[_0xfce6('0x31')],_0x18c581[_0xfce6('0x32')]),_0xb71100);if(_0x34e77e[_0xfce6('0x31')][_0xfce6('0x3a')]){_0x889917[_0xfce6('0x39')]=_[_0xfce6('0x3b')](_0x889917['where'],{'$or':_[_0xfce6('0x2a')](_0xb71100,function(_0x31b5df){if(_0x31b5df[_0xfce6('0x2e')]!==_0xfce6('0x3c')){var _0x51c78a={};_0x51c78a[_0x31b5df['name']]={'$like':'%'+_0x34e77e['query']['filter']+'%'};return _0x51c78a;}})});}_0x889917=_[_0xfce6('0x3b')]({},_0x889917,_0x34e77e[_0xfce6('0x3d')]);var _0x5e32b0={'where':_0x889917[_0xfce6('0x39')]};return db[_0xfce6('0x2b')][_0xfce6('0x1d')](_0x5e32b0)[_0xfce6('0x25')](function(_0x553f02){_0x58cdbf[_0xfce6('0x1d')]=_0x553f02;if(_0x34e77e['query'][_0xfce6('0x3e')]){_0x889917[_0xfce6('0x3f')]=[{'all':!![]}];}return db[_0xfce6('0x2b')][_0xfce6('0x40')](_0x889917);})[_0xfce6('0x25')](function(_0x27abf2){_0x58cdbf[_0xfce6('0x41')]=_0x27abf2;return _0x58cdbf;})[_0xfce6('0x25')](respondWithFilteredResult(_0x1a6e8e,_0x889917))[_0xfce6('0x42')](handleError(_0x1a6e8e,null));};exports[_0xfce6('0x43')]=function(_0x5f1277,_0x2730e2){var _0xa0ff38={'raw':!![],'where':{'id':_0x5f1277[_0xfce6('0x44')]['id']}},_0x3f40d8={};_0x3f40d8[_0xfce6('0x30')]=_[_0xfce6('0x45')](db['VoiceMailMessage'][_0xfce6('0x2c')]);_0x3f40d8[_0xfce6('0x31')]=_[_0xfce6('0x45')](_0x5f1277[_0xfce6('0x31')]);_0x3f40d8['filters']=_[_0xfce6('0x33')](_0x3f40d8[_0xfce6('0x30')],_0x3f40d8[_0xfce6('0x31')]);_0xa0ff38['attributes']=_[_0xfce6('0x33')](_0x3f40d8['model'],qs[_0xfce6('0x35')](_0x5f1277['query'][_0xfce6('0x35')]));_0xa0ff38[_0xfce6('0x34')]=_0xa0ff38[_0xfce6('0x34')][_0xfce6('0x46')]?_0xa0ff38[_0xfce6('0x34')]:_0x3f40d8[_0xfce6('0x30')];if(_0x5f1277[_0xfce6('0x31')][_0xfce6('0x3e')]){_0xa0ff38[_0xfce6('0x3f')]=[{'all':!![]}];}_0xa0ff38=_['merge']({},_0xa0ff38,_0x5f1277[_0xfce6('0x3d')]);return db[_0xfce6('0x2b')]['find'](_0xa0ff38)[_0xfce6('0x25')](handleEntityNotFound(_0x2730e2,null))[_0xfce6('0x25')](respondWithResult(_0x2730e2,null))[_0xfce6('0x42')](handleError(_0x2730e2,null));};exports[_0xfce6('0x47')]=function(_0x24356d,_0x81df70){return db[_0xfce6('0x2b')][_0xfce6('0x47')](_0x24356d[_0xfce6('0x48')],{})[_0xfce6('0x25')](respondWithResult(_0x81df70,0xc9))[_0xfce6('0x42')](handleError(_0x81df70,null));};exports['update']=function(_0x213b2f,_0x1b1a74){if(_0x213b2f[_0xfce6('0x48')]['id']){delete _0x213b2f[_0xfce6('0x48')]['id'];}return db[_0xfce6('0x2b')][_0xfce6('0x49')]({'where':{'id':_0x213b2f[_0xfce6('0x44')]['id']}})[_0xfce6('0x25')](handleEntityNotFound(_0x1b1a74,null))[_0xfce6('0x25')](saveUpdates(_0x213b2f['body'],null))[_0xfce6('0x25')](respondWithResult(_0x1b1a74,null))[_0xfce6('0x42')](handleError(_0x1b1a74,null));};exports[_0xfce6('0x24')]=function(_0x2e2f8c,_0xfea60){return db[_0xfce6('0x2b')][_0xfce6('0x49')]({'where':{'id':_0x2e2f8c['params']['id']}})['then'](handleEntityNotFound(_0xfea60,null))['then'](removeEntity(_0xfea60,null))[_0xfce6('0x42')](handleError(_0xfea60,null));};exports[_0xfce6('0x4a')]=function(_0x3471f8,_0x1b8162,_0xd0a6af){return db[_0xfce6('0x2b')][_0xfce6('0x49')]({'where':{'id':_0x3471f8[_0xfce6('0x44')]['id']},'attributes':['id',_0xfce6('0x4b'),_0xfce6('0x4c')]})[_0xfce6('0x25')](handleEntityNotFound(_0x1b8162,null))[_0xfce6('0x25')](function(_0x41b0ce){if(_0x41b0ce){if(!_0x41b0ce[_0xfce6('0x4b')]){throw new db[(_0xfce6('0x4d'))][(_0xfce6('0x4e'))](_0xfce6('0x4f'));}var _0xaa6309={'Content-Type':'audio/wav','Content-Disposition':_0xfce6('0x50')};if(_0x41b0ce['msg_id']){_0xaa6309[_0xfce6('0x51')]=_0xfce6('0x52')+_0x41b0ce[_0xfce6('0x4c')]+_0xfce6('0x53');}_0x1b8162[_0xfce6('0x1f')](_0xaa6309);return _0x1b8162['send'](new Buffer(_0x41b0ce[_0xfce6('0x4b')]));}})[_0xfce6('0x42')](handleError(_0x1b8162,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4738d09..c012c41 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 _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 +var _0xc432=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x59e10e,_0x3c4734){var _0x2babd7=function(_0x2bd451){while(--_0x2bd451){_0x59e10e['push'](_0x59e10e['shift']());}};_0x2babd7(++_0x3c4734);}(_0xc432,0x15f));var _0x2c43=function(_0x4d30ec,_0x692b10){_0x4d30ec=_0x4d30ec-0x0;var _0x3717b6=_0xc432[_0x4d30ec];return _0x3717b6;};'use strict';var _=require(_0x2c43('0x0'));var util=require('util');var logger=require(_0x2c43('0x1'))(_0x2c43('0x2'));var moment=require(_0x2c43('0x3'));var BPromise=require(_0x2c43('0x4'));var rp=require(_0x2c43('0x5'));var fs=require('fs');var path=require(_0x2c43('0x6'));var rimraf=require(_0x2c43('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c43('0x8'));module['exports']=function(_0x834adf,_0x3b693c){return _0x834adf['define'](_0x2c43('0x9'),attributes,{'tableName':_0x2c43('0xa'),'paranoid':![],'indexes':[{'name':_0x2c43('0xb'),'fields':[_0x2c43('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0fc6fcc..f0ea43e 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 _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 +var _0x392f=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x392f,0x163));var _0xf392=function(_0x3f758f,_0x302451){_0x3f758f=_0x3f758f-0x0;var _0x26e4ae=_0x392f[_0x3f758f];return _0x26e4ae;};'use strict';var _=require(_0xf392('0x0'));var util=require(_0xf392('0x1'));var moment=require(_0xf392('0x2'));var BPromise=require(_0xf392('0x3'));var rs=require(_0xf392('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf392('0x5'));var logger=require('../../config/logger')(_0xf392('0x6'));var config=require(_0xf392('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf392('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21e3dc,_0x599fd8,_0x211737){return new BPromise(function(_0x394ab6,_0x4b2933){return client[_0xf392('0x9')](_0x21e3dc,_0x211737)[_0xf392('0xa')](function(_0x2360a6){logger[_0xf392('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x599fd8,'request\x20sent');logger[_0xf392('0xc')](_0xf392('0xd'),_0x599fd8,_0xf392('0xe'),JSON['stringify'](_0x2360a6));if(_0x2360a6[_0xf392('0xf')]){if(_0x2360a6['error'][_0xf392('0x10')]===0x1f4){logger['error'](_0xf392('0x11'),_0x599fd8,_0x2360a6[_0xf392('0xf')]['message']);return _0x4b2933(_0x2360a6[_0xf392('0xf')][_0xf392('0x12')]);}logger[_0xf392('0xf')](_0xf392('0x11'),_0x599fd8,_0x2360a6['error']['message']);return _0x394ab6(_0x2360a6[_0xf392('0xf')][_0xf392('0x12')]);}else{logger[_0xf392('0xb')](_0xf392('0x11'),_0x599fd8,_0xf392('0xe'));_0x394ab6(_0x2360a6[_0xf392('0x13')][_0xf392('0x12')]);}})[_0xf392('0x14')](function(_0x42a61e){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x599fd8,_0x42a61e);_0x4b2933(_0x42a61e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 2629fcc..e4cb179 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 _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 +var _0xe260=['/:id/sounds/:id2','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','put','/:id','update','delete','destroy'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe260,0x1e5));var _0x0e26=function(_0xd945e9,_0x1613fb){_0xd945e9=_0xd945e9-0x0;var _0x1cc918=_0xe260[_0xd945e9];return _0x1cc918;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0e26('0x0'));var express=require(_0x0e26('0x1'));var router=express[_0x0e26('0x2')]();var fs_extra=require(_0x0e26('0x3'));var auth=require(_0x0e26('0x4'));var interaction=require(_0x0e26('0x5'));var config=require(_0x0e26('0x6'));var controller=require(_0x0e26('0x7'));router[_0x0e26('0x8')]('/',auth[_0x0e26('0x9')](),controller[_0x0e26('0xa')]);router[_0x0e26('0x8')]('/:id',auth[_0x0e26('0x9')](),controller[_0x0e26('0xb')]);router[_0x0e26('0x8')](_0x0e26('0xc'),auth['isAuthenticated'](),controller[_0x0e26('0xd')]);router[_0x0e26('0xe')]('/',auth[_0x0e26('0x9')](),controller[_0x0e26('0xf')]);router[_0x0e26('0xe')](_0x0e26('0xc'),auth['isAuthenticated'](),controller['addSound']);router[_0x0e26('0x10')](_0x0e26('0x11'),auth[_0x0e26('0x9')](),controller[_0x0e26('0x12')]);router[_0x0e26('0x13')](_0x0e26('0x11'),auth[_0x0e26('0x9')](),controller[_0x0e26('0x14')]);router[_0x0e26('0x13')](_0x0e26('0x15'),auth[_0x0e26('0x9')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c24a92d..fd3debc 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 _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 +var _0xcca5=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','sequelize','exports','STRING'];(function(_0x425143,_0x3b3a64){var _0x5bba0a=function(_0xaafdb9){while(--_0xaafdb9){_0x425143['push'](_0x425143['shift']());}};_0x5bba0a(++_0x3b3a64);}(_0xcca5,0x171));var _0x5cca=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0xcca5[_0x28e2cd];return _0x11fd46;};'use strict';var Sequelize=require(_0x5cca('0x0'));module[_0x5cca('0x1')]={'name':{'type':Sequelize[_0x5cca('0x2')],'allowNull':![],'unique':_0x5cca('0x3')},'mode':{'type':Sequelize[_0x5cca('0x4')](_0x5cca('0x5'),_0x5cca('0x6'),_0x5cca('0x7'),_0x5cca('0x8'),_0x5cca('0x9'),_0x5cca('0xa')),'allowNull':!![],'defaultValue':_0x5cca('0x6')},'directory':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![],'defaultValue':_0x5cca('0xb')},'format':{'type':Sequelize[_0x5cca('0x2')],'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 203ad70..ebe42cc 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 _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 +var _0x773d=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','length','include','find','catch','body','params','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','extname','symlinkSync','ValidationError','removeSound','id2','getSounds','eml-format','rimraf','zip-dir'];(function(_0x4e11fc,_0x2602e){var _0x398c4f=function(_0xa9e3dc){while(--_0xa9e3dc){_0x4e11fc['push'](_0x4e11fc['shift']());}};_0x398c4f(++_0x2602e);}(_0x773d,0x159));var _0xd773=function(_0x1decc0,_0x2b7dc6){_0x1decc0=_0x1decc0-0x0;var _0x23b8a7=_0x773d[_0x1decc0];return _0x23b8a7;};'use strict';var emlformat=require(_0xd773('0x0'));var rimraf=require(_0xd773('0x1'));var zipdir=require(_0xd773('0x2'));var jsonpatch=require(_0xd773('0x3'));var rp=require(_0xd773('0x4'));var moment=require(_0xd773('0x5'));var BPromise=require(_0xd773('0x6'));var Mustache=require(_0xd773('0x7'));var util=require(_0xd773('0x8'));var path=require(_0xd773('0x9'));var sox=require(_0xd773('0xa'));var csv=require(_0xd773('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd773('0xc'));var _=require('lodash');var squel=require(_0xd773('0xd'));var crypto=require(_0xd773('0xe'));var jsforce=require(_0xd773('0xf'));var deskjs=require(_0xd773('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd773('0x11'));var Redis=require(_0xd773('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd773('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd773('0x14'));var logger=require(_0xd773('0x15'))(_0xd773('0x16'));var utils=require(_0xd773('0x17'));var config=require(_0xd773('0x18'));var licenseUtil=require(_0xd773('0x19'));var db=require(_0xd773('0x1a'))['db'];function respondWithStatusCode(_0x31a1e8,_0x3f29a4){_0x3f29a4=_0x3f29a4||0xcc;return function(_0x31a3ba){if(_0x31a3ba){return _0x31a1e8[_0xd773('0x1b')](_0x3f29a4);}return _0x31a1e8['status'](_0x3f29a4)[_0xd773('0x1c')]();};}function respondWithResult(_0x329b22,_0x3636e5){_0x3636e5=_0x3636e5||0xc8;return function(_0x43c60b){if(_0x43c60b){return _0x329b22[_0xd773('0x1d')](_0x3636e5)[_0xd773('0x1e')](_0x43c60b);}};}function respondWithFilteredResult(_0xabcec6,_0x1a1954){return function(_0x4f4a54){if(_0x4f4a54){var _0x36683b=typeof _0x1a1954[_0xd773('0x1f')]==='undefined'&&typeof _0x1a1954[_0xd773('0x20')]===_0xd773('0x21');var _0x3848e7=_0x4f4a54['count'];var _0x3f54d6=_0x36683b?0x0:_0x1a1954[_0xd773('0x1f')];var _0x22b6f7=_0x36683b?_0x4f4a54['count']:_0x1a1954[_0xd773('0x1f')]+_0x1a1954[_0xd773('0x20')];var _0x4041e0;if(_0x22b6f7>=_0x3848e7){_0x22b6f7=_0x3848e7;_0x4041e0=0xc8;}else{_0x4041e0=0xce;}_0xabcec6['status'](_0x4041e0);return _0xabcec6[_0xd773('0x22')]('Content-Range',_0x3f54d6+'-'+_0x22b6f7+'/'+_0x3848e7)['json'](_0x4f4a54);}return null;};}function patchUpdates(_0x28d899){return function(_0x138418){try{jsonpatch[_0xd773('0x23')](_0x138418,_0x28d899,!![]);}catch(_0x4def8a){return BPromise[_0xd773('0x24')](_0x4def8a);}return _0x138418[_0xd773('0x25')]();};}function saveUpdates(_0x471c2a,_0x4ef4b5){return function(_0x55f22b){if(_0x55f22b){return _0x55f22b[_0xd773('0x26')](_0x471c2a)[_0xd773('0x27')](function(_0x38c007){return _0x38c007;});}return null;};}function removeEntity(_0xdacc29,_0x53261e){return function(_0x4dda7b){if(_0x4dda7b){return _0x4dda7b[_0xd773('0x28')]()['then'](function(){var _0x358df3=_0x4dda7b[_0xd773('0x29')]({'plain':!![]});var _0x399183=_0xd773('0x2a');return db[_0xd773('0x2b')]['destroy']({'where':{'type':_0x399183,'resourceId':_0x358df3['id']}})[_0xd773('0x27')](function(){return _0x4dda7b;});})[_0xd773('0x27')](function(){_0xdacc29[_0xd773('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c6d2a,_0x14612c){return function(_0x35359){if(!_0x35359){_0x4c6d2a[_0xd773('0x1b')](0x194);}return _0x35359;};}function handleError(_0x33fa3c,_0x389aac){_0x389aac=_0x389aac||0x1f4;return function(_0x3067a4){logger[_0xd773('0x2c')](_0x3067a4[_0xd773('0x2d')]);if(_0x3067a4[_0xd773('0x2e')]){delete _0x3067a4['name'];}_0x33fa3c['status'](_0x389aac)['send'](_0x3067a4);};}exports[_0xd773('0x2f')]=function(_0xdcd737,_0xb4dc0f){var _0x104f9e={},_0x3d3943={},_0x58e166={'count':0x0,'rows':[]};var _0xea5016=_[_0xd773('0x30')](db[_0xd773('0x31')][_0xd773('0x32')],function(_0x259cc8){return{'name':_0x259cc8[_0xd773('0x33')],'type':_0x259cc8[_0xd773('0x34')]['key']};});_0x3d3943[_0xd773('0x35')]=_[_0xd773('0x30')](_0xea5016,_0xd773('0x2e'));_0x3d3943[_0xd773('0x36')]=_[_0xd773('0x37')](_0xdcd737['query']);_0x3d3943[_0xd773('0x38')]=_[_0xd773('0x39')](_0x3d3943[_0xd773('0x35')],_0x3d3943[_0xd773('0x36')]);_0x104f9e[_0xd773('0x3a')]=_[_0xd773('0x39')](_0x3d3943['model'],qs[_0xd773('0x3b')](_0xdcd737[_0xd773('0x36')][_0xd773('0x3b')]));_0x104f9e['attributes']=_0x104f9e[_0xd773('0x3a')]['length']?_0x104f9e[_0xd773('0x3a')]:_0x3d3943[_0xd773('0x35')];if(!_0xdcd737[_0xd773('0x36')][_0xd773('0x3c')](_0xd773('0x3d'))){_0x104f9e[_0xd773('0x20')]=qs[_0xd773('0x20')](_0xdcd737[_0xd773('0x36')]['limit']);_0x104f9e[_0xd773('0x1f')]=qs[_0xd773('0x1f')](_0xdcd737[_0xd773('0x36')][_0xd773('0x1f')]);}_0x104f9e[_0xd773('0x3e')]=qs['sort'](_0xdcd737[_0xd773('0x36')]['sort']);delete _0xdcd737[_0xd773('0x36')][_0xd773('0x3f')];_0x104f9e[_0xd773('0x40')]=qs['filters'](_[_0xd773('0x41')](_0xdcd737[_0xd773('0x36')],_0x3d3943[_0xd773('0x38')]),_0xea5016);if(_0xdcd737['query'][_0xd773('0x42')]){_0x104f9e[_0xd773('0x40')]=_[_0xd773('0x43')](_0x104f9e[_0xd773('0x40')],{'$or':_[_0xd773('0x30')](_0xea5016,function(_0x53ccef){if(_0x53ccef[_0xd773('0x34')]!==_0xd773('0x44')){var _0x41de26={};_0x41de26[_0x53ccef[_0xd773('0x2e')]]={'$like':'%'+_0xdcd737[_0xd773('0x36')][_0xd773('0x42')]+'%'};return _0x41de26;}})});}_0x104f9e=_[_0xd773('0x43')]({},_0x104f9e,_0xdcd737[_0xd773('0x45')]);var _0x421ca2={'where':_0x104f9e[_0xd773('0x40')]};return db['VoiceMusicOnHold'][_0xd773('0x46')](_0x421ca2)[_0xd773('0x27')](function(_0xf5e10f){_0x58e166[_0xd773('0x46')]=_0xf5e10f;if(_0xdcd737[_0xd773('0x36')][_0xd773('0x47')]){_0x104f9e['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xd773('0x48')](_0x104f9e);})[_0xd773('0x27')](function(_0x5d79e5){_0x58e166[_0xd773('0x49')]=_0x5d79e5;return _0x58e166;})[_0xd773('0x27')](respondWithFilteredResult(_0xb4dc0f,_0x104f9e))['catch'](handleError(_0xb4dc0f,null));};exports[_0xd773('0x4a')]=function(_0x37c87f,_0x438350){var _0x267955={'raw':![],'where':{'id':_0x37c87f['params']['id']}},_0x41ceca={};_0x41ceca[_0xd773('0x35')]=_['keys'](db[_0xd773('0x31')][_0xd773('0x32')]);_0x41ceca[_0xd773('0x36')]=_[_0xd773('0x37')](_0x37c87f[_0xd773('0x36')]);_0x41ceca['filters']=_[_0xd773('0x39')](_0x41ceca['model'],_0x41ceca[_0xd773('0x36')]);_0x267955[_0xd773('0x3a')]=_[_0xd773('0x39')](_0x41ceca['model'],qs[_0xd773('0x3b')](_0x37c87f[_0xd773('0x36')][_0xd773('0x3b')]));_0x267955['attributes']=_0x267955[_0xd773('0x3a')][_0xd773('0x4b')]?_0x267955[_0xd773('0x3a')]:_0x41ceca[_0xd773('0x35')];if(_0x37c87f[_0xd773('0x36')][_0xd773('0x47')]){_0x267955[_0xd773('0x4c')]=[{'all':!![]}];}_0x267955=_[_0xd773('0x43')]({},_0x267955,_0x37c87f[_0xd773('0x45')]);return db[_0xd773('0x31')][_0xd773('0x4d')](_0x267955)[_0xd773('0x27')](handleEntityNotFound(_0x438350,null))[_0xd773('0x27')](respondWithResult(_0x438350,null))[_0xd773('0x4e')](handleError(_0x438350,null));};exports[_0xd773('0x26')]=function(_0x390e1e,_0x142ebb){if(_0x390e1e['body']['id']){delete _0x390e1e[_0xd773('0x4f')]['id'];}return db[_0xd773('0x31')][_0xd773('0x4d')]({'where':{'id':_0x390e1e[_0xd773('0x50')]['id']}})[_0xd773('0x27')](handleEntityNotFound(_0x142ebb,null))[_0xd773('0x27')](saveUpdates(_0x390e1e[_0xd773('0x4f')],null))[_0xd773('0x27')](respondWithResult(_0x142ebb,null))[_0xd773('0x4e')](handleError(_0x142ebb,null));};exports[_0xd773('0x51')]=function(_0x165cec,_0x18798a,_0x141a4f){return db[_0xd773('0x52')][_0xd773('0x53')](function(_0x3bae42){if(_0x165cec[_0xd773('0x4f')][_0xd773('0x54')]==='files'){_0x165cec['body'][_0xd773('0x55')]=path[_0xd773('0x56')](config[_0xd773('0x57')],_0xd773('0x58'),_0x165cec[_0xd773('0x4f')]['name']);}return db[_0xd773('0x31')][_0xd773('0x51')](_0x165cec[_0xd773('0x4f')],{'transaction':_0x3bae42})[_0xd773('0x27')](function(_0x1f2833){if(_0x165cec[_0xd773('0x4f')][_0xd773('0x54')]===_0xd773('0x59')){fs['mkdirSync'](_0x1f2833[_0xd773('0x55')],parseInt('0777',0x8));}var _0x55d863=_0x165cec[_0xd773('0x5a')][_0xd773('0x29')]({'plain':!![]});if(!_0x55d863)throw new Error(_0xd773('0x5b'));if(_0x55d863[_0xd773('0x5c')]===_0xd773('0x5a')){var _0x3c0989=_0x1f2833[_0xd773('0x29')]({'plain':!![]});return db[_0xd773('0x5d')][_0xd773('0x4d')]({'where':{'name':_0xd773('0x2a'),'userProfileId':_0x55d863[_0xd773('0x5e')]},'raw':!![]})[_0xd773('0x27')](function(_0x266c9c){if(_0x266c9c&&_0x266c9c['autoAssociation']===0x0){return db[_0xd773('0x2b')]['create']({'name':_0x3c0989['name'],'resourceId':_0x3c0989['id'],'type':_0x266c9c['name'],'sectionId':_0x266c9c['id']},{})['then'](function(){return _0x1f2833;});}else{return _0x1f2833;}})['catch'](function(_0x58f9da){logger[_0xd773('0x2c')](_0xd773('0x5f'),_0x58f9da);});}return _0x1f2833;});})['then'](respondWithResult(_0x18798a,0xc9))['catch'](handleError(_0x18798a,null));};exports[_0xd773('0x28')]=function(_0x3b526a,_0x3e63d5,_0x360b4c){var _0x5e0add;return db[_0xd773('0x31')][_0xd773('0x4d')]({'where':{'id':_0x3b526a[_0xd773('0x50')]['id']}})[_0xd773('0x27')](function(_0x4976b7){if(_0x4976b7){return db[_0xd773('0x52')][_0xd773('0x53')](function(_0x3c79af){return _0x4976b7[_0xd773('0x28')]({'transaction':_0x3c79af,'raw':!![]})[_0xd773('0x27')](function(_0xc17399){if(_0xc17399[_0xd773('0x55')]){fs[_0xd773('0x60')](_0xc17399['directory'])[_0xd773('0x61')](function(_0x10a53d){fs[_0xd773('0x62')](path[_0xd773('0x56')](_0xc17399[_0xd773('0x55')],_0x10a53d));});fs[_0xd773('0x63')](_0xc17399[_0xd773('0x55')]);}return _0xc17399;});})['catch'](function(_0x45effb){throw new db[(_0xd773('0x64'))]['ValidationError'](_0x45effb[_0xd773('0x65')]);});}})[_0xd773('0x27')](handleEntityNotFound(_0x3e63d5,null))[_0xd773('0x27')](removeEntity(_0x3e63d5,null))[_0xd773('0x4e')](handleError(_0x3e63d5,null));};exports['addSound']=function(_0xb40497,_0x7022e5,_0x2c2c05){return db[_0xd773('0x52')][_0xd773('0x53')](function(_0x1c594a){var _0x2d7170;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xb40497[_0xd773('0x50')]['id']}})['then'](function(_0x59ce36){if(_0x59ce36){_0x2d7170=_0x59ce36;return _0x59ce36[_0xd773('0x66')](_0xb40497[_0xd773('0x4f')]['id'],{'transaction':_0x1c594a});}})[_0xd773('0x27')](function(_0x3864ec){if(_0x3864ec){return db[_0xd773('0x67')][_0xd773('0x68')]({'where':{'id':_0xb40497[_0xd773('0x4f')]['id']},'attributes':['id','name',_0xd773('0x69'),_0xd773('0x6a'),_0xd773('0x6b')],'raw':!![]});}})[_0xd773('0x27')](function(_0x8c2589){if(_0x8c2589){var _0x511a8c=path['join'](config['root'],_0xd773('0x6c'),util['format'](_0xd773('0x6d'),path['basename'](_0x8c2589[_0xd773('0x69')],path[_0xd773('0x6e')](_0x8c2589['save_name'])),_0x8c2589['converted_format']));var _0x1d40cb=path[_0xd773('0x56')](config['root'],_0xd773('0x58'),_0x2d7170[_0xd773('0x2e')],util['format'](_0xd773('0x6d'),_0x8c2589[_0xd773('0x2e')],_0x8c2589[_0xd773('0x6a')]));fs[_0xd773('0x6f')](_0x511a8c,_0x1d40cb);return _0x8c2589;}})['catch'](function(_0x3941e6){throw new db['Sequelize'][(_0xd773('0x70'))](_0x3941e6[_0xd773('0x65')]);});})['then'](handleEntityNotFound(_0x7022e5,null))['then'](respondWithResult(_0x7022e5,0xc9))['catch'](handleError(_0x7022e5,null));};exports[_0xd773('0x71')]=function(_0x382a1a,_0x21a59e,_0x4f0f54){return db['sequelize'][_0xd773('0x53')](function(_0x37dacd){var _0x3b3988;return db[_0xd773('0x31')][_0xd773('0x68')]({'where':{'id':_0x382a1a[_0xd773('0x50')]['id']}})[_0xd773('0x27')](handleEntityNotFound(_0x21a59e,null))[_0xd773('0x27')](function(_0x17e515){if(_0x17e515){_0x3b3988=_0x17e515;return _0x17e515[_0xd773('0x71')](_0x382a1a[_0xd773('0x50')][_0xd773('0x72')]);}})[_0xd773('0x27')](function(_0x1fd0e1){if(_0x1fd0e1){return db[_0xd773('0x67')][_0xd773('0x68')]({'where':{'id':_0x382a1a['params'][_0xd773('0x72')]},'attributes':['id',_0xd773('0x2e'),_0xd773('0x69'),'converted_format','createdAt'],'raw':!![]});}})[_0xd773('0x27')](function(_0x5344f0){if(_0x5344f0){fs[_0xd773('0x62')](path[_0xd773('0x56')](_0x3b3988[_0xd773('0x55')],util['format'](_0xd773('0x6d'),_0x5344f0[_0xd773('0x2e')],_0x5344f0[_0xd773('0x6a')])));return _0x5344f0;}})[_0xd773('0x4e')](function(_0x4264a5){throw new db[(_0xd773('0x64'))]['ValidationError'](_0x4264a5[_0xd773('0x65')]);});})[_0xd773('0x27')](handleEntityNotFound(_0x21a59e,null))[_0xd773('0x27')](respondWithStatusCode(_0x21a59e,0xcc))[_0xd773('0x4e')](handleError(_0x21a59e,null));};exports['getSounds']=function(_0x5e3e45,_0x5d87a6,_0x16be6d){var _0x15078e={};var _0x3b01c8={};var _0x33588b;var _0x4ed705;return db[_0xd773('0x31')][_0xd773('0x68')]({'where':{'id':_0x5e3e45[_0xd773('0x50')]['id']}})[_0xd773('0x27')](handleEntityNotFound(_0x5d87a6,null))[_0xd773('0x27')](function(_0xef2a41){if(_0xef2a41){_0x33588b=_0xef2a41;_0x3b01c8[_0xd773('0x35')]=_['keys'](db[_0xd773('0x67')][_0xd773('0x32')]);_0x3b01c8[_0xd773('0x36')]=_[_0xd773('0x37')](_0x5e3e45[_0xd773('0x36')]);_0x3b01c8[_0xd773('0x38')]=_[_0xd773('0x39')](_0x3b01c8[_0xd773('0x35')],_0x3b01c8[_0xd773('0x36')]);_0x15078e[_0xd773('0x3a')]=_[_0xd773('0x39')](_0x3b01c8[_0xd773('0x35')],qs[_0xd773('0x3b')](_0x5e3e45['query'][_0xd773('0x3b')]));_0x15078e['attributes']=_0x15078e[_0xd773('0x3a')][_0xd773('0x4b')]?_0x15078e[_0xd773('0x3a')]:_0x3b01c8['model'];_0x15078e[_0xd773('0x3e')]=qs[_0xd773('0x3f')](_0x5e3e45[_0xd773('0x36')][_0xd773('0x3f')]);_0x15078e['where']=qs[_0xd773('0x38')](_[_0xd773('0x41')](_0x5e3e45[_0xd773('0x36')],_0x3b01c8['filters']));if(_0x5e3e45[_0xd773('0x36')][_0xd773('0x42')]){_0x15078e['where']=_[_0xd773('0x43')](_0x15078e[_0xd773('0x40')],{'$or':_[_0xd773('0x30')](_0x15078e[_0xd773('0x3a')],function(_0xf6fce7){var _0x5dbea3={};_0x5dbea3[_0xf6fce7]={'$like':'%'+_0x5e3e45['query']['filter']+'%'};return _0x5dbea3;})});}_0x15078e=_['merge']({},_0x15078e,_0x5e3e45['options']);return _0x33588b['getSounds'](_0x15078e);}})[_0xd773('0x27')](function(_0x5563e3){if(_0x5563e3){_0x4ed705=_0x5563e3[_0xd773('0x4b')];if(!_0x5e3e45[_0xd773('0x36')][_0xd773('0x3c')](_0xd773('0x3d'))){_0x15078e[_0xd773('0x20')]=qs[_0xd773('0x20')](_0x5e3e45[_0xd773('0x36')][_0xd773('0x20')]);_0x15078e[_0xd773('0x1f')]=qs[_0xd773('0x1f')](_0x5e3e45[_0xd773('0x36')]['offset']);}return _0x33588b[_0xd773('0x73')](_0x15078e);}})['then'](function(_0x40ea4b){if(_0x40ea4b){return _0x40ea4b?{'count':_0x4ed705,'rows':_0x40ea4b}:null;}})['then'](respondWithResult(_0x5d87a6,null))[_0xd773('0x4e')](handleError(_0x5d87a6,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index fc6a933..1778695 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 _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 +var _0xd42d=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','rimraf','./voiceMusicOnHold.attributes'];(function(_0x8a4021,_0x12244b){var _0x38c47f=function(_0x26b2e4){while(--_0x26b2e4){_0x8a4021['push'](_0x8a4021['shift']());}};_0x38c47f(++_0x12244b);}(_0xd42d,0x72));var _0xdd42=function(_0xbcb6,_0x8e00a9){_0xbcb6=_0xbcb6-0x0;var _0x58899b=_0xd42d[_0xbcb6];return _0x58899b;};'use strict';var _=require(_0xdd42('0x0'));var util=require(_0xdd42('0x1'));var logger=require(_0xdd42('0x2'))(_0xdd42('0x3'));var moment=require('moment');var BPromise=require(_0xdd42('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd42('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd42('0x6'));module[_0xdd42('0x7')]=function(_0x441795,_0x322db7){return _0x441795[_0xdd42('0x8')](_0xdd42('0x9'),attributes,{'tableName':_0xdd42('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index c2e4f29..b54d40e 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_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 +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x29ff94,_0x2165e0){var _0x860794=function(_0x4d41cd){while(--_0x4d41cd){_0x29ff94['push'](_0x29ff94['shift']());}};_0x860794(++_0x2165e0);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7915e93..39c04aa 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 _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 +var _0xe893=['addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','/:id/teams','getTeams','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe893,0xbe));var _0x3e89=function(_0x21a9cf,_0x51f954){_0x21a9cf=_0x21a9cf-0x0;var _0x5d4ba7=_0xe893[_0x21a9cf];return _0x5d4ba7;};'use strict';var multer=require('multer');var util=require(_0x3e89('0x0'));var path=require(_0x3e89('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e89('0x2'));var router=express[_0x3e89('0x3')]();var fs_extra=require(_0x3e89('0x4'));var auth=require(_0x3e89('0x5'));var interaction=require(_0x3e89('0x6'));var config=require('../../config/environment');var controller=require(_0x3e89('0x7'));router[_0x3e89('0x8')]('/',auth[_0x3e89('0x9')](),controller['index']);router[_0x3e89('0x8')](_0x3e89('0xa'),auth[_0x3e89('0x9')](),controller[_0x3e89('0xb')]);router['get'](_0x3e89('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3e89('0xd'),auth[_0x3e89('0x9')](),controller['getAgents']);router['get'](_0x3e89('0xe'),auth['isAuthenticated'](),controller[_0x3e89('0xf')]);router[_0x3e89('0x10')]('/',auth['isAuthenticated'](),controller[_0x3e89('0x11')]);router[_0x3e89('0x10')](_0x3e89('0xd'),auth['isAuthenticated'](),controller[_0x3e89('0x12')]);router[_0x3e89('0x10')](_0x3e89('0xe'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x13')]);router[_0x3e89('0x14')](_0x3e89('0xc'),auth['isAuthenticated'](),controller[_0x3e89('0x15')]);router[_0x3e89('0x16')]('/:id',auth[_0x3e89('0x9')](),controller[_0x3e89('0x17')]);router[_0x3e89('0x16')](_0x3e89('0xd'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x18')]);router[_0x3e89('0x16')](_0x3e89('0xe'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f391877..7bc862b 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 _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 +var _0x6285=['name','VIRTUAL','system-','getDataValue','exports','STRING'];(function(_0x1b810b,_0x324c7e){var _0x4f8e61=function(_0x46c93f){while(--_0x46c93f){_0x1b810b['push'](_0x1b810b['shift']());}};_0x4f8e61(++_0x324c7e);}(_0x6285,0xc4));var _0x5628=function(_0x2d2a36,_0x2f839){_0x2d2a36=_0x2d2a36-0x0;var _0x1f570a=_0x6285[_0x2d2a36];return _0x1f570a;};'use strict';var Sequelize=require('sequelize');module[_0x5628('0x0')]={'name':{'type':Sequelize[_0x5628('0x1')],'allowNull':![],'unique':_0x5628('0x2')},'prefix':{'type':Sequelize[_0x5628('0x3')],'get':function(_0x1e973b){return _0x5628('0x4')+this[_0x5628('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x5628('0x1')]},'callerIdAll':{'type':Sequelize[_0x5628('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index eb5abb3..6862804 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 _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 +var _0xb574=['count','set','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','VoicePrefix','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','destroy','params','describe','sequelize','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','goto','charAt','body','system-','addAgents','spread','ids','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','forEach','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xb574,0x106));var _0x4b57=function(_0x53bfc0,_0x3109f0){_0x53bfc0=_0x53bfc0-0x0;var _0x19a511=_0xb574[_0x53bfc0];return _0x19a511;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];config[_0x4b57('0x16')]=_[_0x4b57('0x17')](config[_0x4b57('0x16')],{'host':_0x4b57('0x18'),'port':0x18eb});var socket=require(_0x4b57('0x19'))(new Redis(config[_0x4b57('0x16')]));require(_0x4b57('0x1a'))[_0x4b57('0x1b')](socket);function respondWithStatusCode(_0x4e15be,_0x4a58dc){_0x4a58dc=_0x4a58dc||0xcc;return function(_0x236c95){if(_0x236c95){return _0x4e15be[_0x4b57('0x1c')](_0x4a58dc);}return _0x4e15be[_0x4b57('0x1d')](_0x4a58dc)['end']();};}function respondWithResult(_0x284640,_0x48bd13){_0x48bd13=_0x48bd13||0xc8;return function(_0x159ce5){if(_0x159ce5){return _0x284640[_0x4b57('0x1d')](_0x48bd13)[_0x4b57('0x1e')](_0x159ce5);}};}function respondWithFilteredResult(_0x10eda5,_0x20cf5e){return function(_0xfb71cc){if(_0xfb71cc){var _0x4ede42=typeof _0x20cf5e[_0x4b57('0x1f')]===_0x4b57('0x20')&&typeof _0x20cf5e[_0x4b57('0x21')]===_0x4b57('0x20');var _0x4baaeb=_0xfb71cc[_0x4b57('0x22')];var _0x1ca49e=_0x4ede42?0x0:_0x20cf5e[_0x4b57('0x1f')];var _0x2682d6=_0x4ede42?_0xfb71cc[_0x4b57('0x22')]:_0x20cf5e[_0x4b57('0x1f')]+_0x20cf5e['limit'];var _0x4b504b;if(_0x2682d6>=_0x4baaeb){_0x2682d6=_0x4baaeb;_0x4b504b=0xc8;}else{_0x4b504b=0xce;}_0x10eda5[_0x4b57('0x1d')](_0x4b504b);return _0x10eda5[_0x4b57('0x23')]('Content-Range',_0x1ca49e+'-'+_0x2682d6+'/'+_0x4baaeb)[_0x4b57('0x1e')](_0xfb71cc);}return null;};}function patchUpdates(_0x4a34b2){return function(_0x286c7d){try{jsonpatch[_0x4b57('0x24')](_0x286c7d,_0x4a34b2,!![]);}catch(_0x56f017){return BPromise[_0x4b57('0x25')](_0x56f017);}return _0x286c7d[_0x4b57('0x26')]();};}function saveUpdates(_0x4d07c9,_0x3e7b96){return function(_0x12dedf){if(_0x12dedf){return _0x12dedf[_0x4b57('0x27')](_0x4d07c9)[_0x4b57('0x28')](function(_0x540eff){return _0x540eff;});}return null;};}function removeEntity(_0x156962,_0x51d0c3){return function(_0x131dab){if(_0x131dab){return _0x131dab['destroy']()[_0x4b57('0x28')](function(){var _0x2dc9d8=_0x131dab[_0x4b57('0x29')]({'plain':!![]});var _0x6584c4=_0x4b57('0x2a');return db[_0x4b57('0x2b')]['destroy']({'where':{'type':_0x6584c4,'resourceId':_0x2dc9d8['id']}})['then'](function(){return _0x131dab;});})[_0x4b57('0x28')](function(){_0x156962['status'](0xcc)[_0x4b57('0x2c')]();});}};}function handleEntityNotFound(_0x458f70,_0x874cf7){return function(_0x3af22f){if(!_0x3af22f){_0x458f70[_0x4b57('0x1c')](0x194);}return _0x3af22f;};}function handleError(_0x2c20d2,_0x49ba89){_0x49ba89=_0x49ba89||0x1f4;return function(_0xab365c){logger[_0x4b57('0x2d')](_0xab365c[_0x4b57('0x2e')]);if(_0xab365c[_0x4b57('0x2f')]){delete _0xab365c['name'];}_0x2c20d2[_0x4b57('0x1d')](_0x49ba89)[_0x4b57('0x30')](_0xab365c);};}exports['index']=function(_0xbfb420,_0xa5b5dc){var _0x4726a6={},_0x255c7d={},_0x492de8={'count':0x0,'rows':[]};var _0x5742a0=_['map'](db[_0x4b57('0x31')][_0x4b57('0x32')],function(_0xccc679){return{'name':_0xccc679[_0x4b57('0x33')],'type':_0xccc679[_0x4b57('0x34')]['key']};});_0x255c7d[_0x4b57('0x35')]=_[_0x4b57('0x36')](_0x5742a0,_0x4b57('0x2f'));_0x255c7d['query']=_[_0x4b57('0x37')](_0xbfb420[_0x4b57('0x38')]);_0x255c7d[_0x4b57('0x39')]=_['intersection'](_0x255c7d[_0x4b57('0x35')],_0x255c7d[_0x4b57('0x38')]);_0x4726a6['attributes']=_[_0x4b57('0x3a')](_0x255c7d[_0x4b57('0x35')],qs[_0x4b57('0x3b')](_0xbfb420[_0x4b57('0x38')][_0x4b57('0x3b')]));_0x4726a6[_0x4b57('0x3c')]=_0x4726a6['attributes'][_0x4b57('0x3d')]?_0x4726a6[_0x4b57('0x3c')]:_0x255c7d[_0x4b57('0x35')];if(!_0xbfb420[_0x4b57('0x38')][_0x4b57('0x3e')](_0x4b57('0x3f'))){_0x4726a6[_0x4b57('0x21')]=qs['limit'](_0xbfb420['query'][_0x4b57('0x21')]);_0x4726a6[_0x4b57('0x1f')]=qs[_0x4b57('0x1f')](_0xbfb420['query'][_0x4b57('0x1f')]);}_0x4726a6[_0x4b57('0x40')]=qs[_0x4b57('0x41')](_0xbfb420[_0x4b57('0x38')]['sort']);_0x4726a6[_0x4b57('0x42')]=qs[_0x4b57('0x39')](_[_0x4b57('0x43')](_0xbfb420[_0x4b57('0x38')],_0x255c7d['filters']),_0x5742a0);if(_0xbfb420['query']['filter']){_0x4726a6[_0x4b57('0x42')]=_[_0x4b57('0x44')](_0x4726a6[_0x4b57('0x42')],{'$or':_[_0x4b57('0x36')](_0x5742a0,function(_0x5f4971){if(_0x5f4971[_0x4b57('0x34')]!==_0x4b57('0x45')){var _0x286606={};_0x286606[_0x5f4971[_0x4b57('0x2f')]]={'$like':'%'+_0xbfb420[_0x4b57('0x38')][_0x4b57('0x46')]+'%'};return _0x286606;}})});}_0x4726a6=_[_0x4b57('0x44')]({},_0x4726a6,_0xbfb420[_0x4b57('0x47')]);var _0x1e222b={'where':_0x4726a6['where']};return db[_0x4b57('0x31')][_0x4b57('0x22')](_0x1e222b)[_0x4b57('0x28')](function(_0x5b2f50){_0x492de8[_0x4b57('0x22')]=_0x5b2f50;if(_0xbfb420['query'][_0x4b57('0x48')]){_0x4726a6[_0x4b57('0x49')]=[{'all':!![]}];}return db[_0x4b57('0x31')][_0x4b57('0x4a')](_0x4726a6);})[_0x4b57('0x28')](function(_0x477352){_0x492de8[_0x4b57('0x4b')]=_0x477352;return _0x492de8;})[_0x4b57('0x28')](respondWithFilteredResult(_0xa5b5dc,_0x4726a6))[_0x4b57('0x4c')](handleError(_0xa5b5dc,null));};exports[_0x4b57('0x4d')]=function(_0x9864b8,_0x423144){var _0x3a87a1={'raw':![],'where':{'id':_0x9864b8['params']['id']}},_0x4fbed3={};_0x4fbed3[_0x4b57('0x35')]=_[_0x4b57('0x37')](db[_0x4b57('0x31')][_0x4b57('0x32')]);_0x4fbed3['query']=_[_0x4b57('0x37')](_0x9864b8[_0x4b57('0x38')]);_0x4fbed3['filters']=_[_0x4b57('0x3a')](_0x4fbed3['model'],_0x4fbed3[_0x4b57('0x38')]);_0x3a87a1['attributes']=_['intersection'](_0x4fbed3[_0x4b57('0x35')],qs[_0x4b57('0x3b')](_0x9864b8['query'][_0x4b57('0x3b')]));_0x3a87a1[_0x4b57('0x3c')]=_0x3a87a1[_0x4b57('0x3c')][_0x4b57('0x3d')]?_0x3a87a1[_0x4b57('0x3c')]:_0x4fbed3[_0x4b57('0x35')];if(_0x9864b8['query'][_0x4b57('0x48')]){_0x3a87a1[_0x4b57('0x49')]=[{'all':!![]}];}_0x3a87a1=_['merge']({},_0x3a87a1,_0x9864b8[_0x4b57('0x47')]);return db[_0x4b57('0x31')][_0x4b57('0x4e')](_0x3a87a1)['then'](handleEntityNotFound(_0x423144,null))[_0x4b57('0x28')](respondWithResult(_0x423144,null))['catch'](handleError(_0x423144,null));};exports[_0x4b57('0x4f')]=function(_0xfbe7ed,_0x2ae205){return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0xfbe7ed[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x2ae205,null))[_0x4b57('0x28')](removeEntity(_0x2ae205,null))['catch'](handleError(_0x2ae205,null));};exports[_0x4b57('0x51')]=function(_0x19349b,_0x3ad98f){return db['VoicePrefix'][_0x4b57('0x51')]()[_0x4b57('0x28')](respondWithResult(_0x3ad98f,null))[_0x4b57('0x4c')](handleError(_0x3ad98f,null));};exports['create']=function(_0x1579d1,_0x3d2336){var _0x343cec;return db[_0x4b57('0x52')][_0x4b57('0x53')](function(_0xb7c37c){return db[_0x4b57('0x31')]['create'](_0x1579d1['body'],{'transaction':_0xb7c37c})[_0x4b57('0x28')](function(_0x61a1ae){_0x343cec=_0x61a1ae[_0x4b57('0x29')]({'plain':!![]});return db[_0x4b57('0x54')]['find']({'where':{'id':_0x343cec[_0x4b57('0x55')]},'raw':!![]})[_0x4b57('0x28')](function(_0x41529e){return createVoicePrefixExtensions(_0x343cec,_0x41529e,_0xb7c37c);});});})[_0x4b57('0x28')](function(){var _0x4857c3=_0x1579d1['user'][_0x4b57('0x29')]({'plain':!![]});if(!_0x4857c3)throw new Error(_0x4b57('0x56'));if(_0x4857c3['role']==='user'){var _0x451737=_0x343cec;return db['UserProfileSection'][_0x4b57('0x4e')]({'where':{'name':_0x4b57('0x2a'),'userProfileId':_0x4857c3[_0x4b57('0x57')]},'raw':!![]})[_0x4b57('0x28')](function(_0x37d420){if(_0x37d420&&_0x37d420['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x451737['name'],'resourceId':_0x451737['id'],'type':_0x37d420[_0x4b57('0x2f')],'sectionId':_0x37d420['id']},{})[_0x4b57('0x28')](function(){return _0x343cec;});}else{return _0x343cec;}})['catch'](function(_0x34aa23){logger[_0x4b57('0x2d')](_0x4b57('0x58'),_0x34aa23);throw _0x34aa23;});}return _0x343cec;})[_0x4b57('0x28')](respondWithResult(_0x3d2336,null))[_0x4b57('0x4c')](handleError(_0x3d2336,null));};function Extension(_0x1fcc10,_0xf1bf63,_0x40cab4,_0x2c5289){this['context']=_0x4b57('0x59');this['exten']=_0x1fcc10;this[_0x4b57('0x5a')]=_0x40cab4;this[_0x4b57('0x34')]='system';this[_0x4b57('0x5b')]=_0x4b57('0x5c');this[_0x4b57('0x5d')]=_0xf1bf63;this[_0x4b57('0x5e')]=_0x2c5289;}function createVoicePrefixExtensions(_0x36f154,_0xc24706,_0xb58059){return new BPromise(function(_0xbe6f94,_0x3ed705){var _0x8851dd=new Extension(formatPrefixName(_0x36f154[_0x4b57('0x5f')]),0x1,_0x4b57('0x60'),'Voice\x20Prefix');_0x8851dd[_0x4b57('0x61')]=_0x36f154['id'];return db[_0x4b57('0x54')]['create'](_0x8851dd,{'transaction':_0xb58059})[_0x4b57('0x28')](function(_0x564792){var _0x566fec=_0x564792['get']({'plain':!![]});var _0x1004ac=_['map'](addVoicePrefixExtensions(_0x36f154,_0xc24706),function(_0x310db6){_0x310db6[_0x4b57('0x55')]=_0x566fec['id'];_0x310db6['VoicePrefixId']=_0x36f154['id'];return _0x310db6;});return db['VoiceExtension'][_0x4b57('0x62')](_0x1004ac,{'transaction':_0xb58059})[_0x4b57('0x28')](function(_0x431f24){if(!_0x431f24){return _0x3ed705('Extensions\x20creation\x20failed');}else{return _0xbe6f94(_0x431f24);}})[_0x4b57('0x4c')](function(_0x3619a1){return _0x3ed705(_0x3619a1);});});;});};function addVoicePrefixExtensions(_0x5f372d,_0x20172a){var _0x119933=[];var _0x5a0c38=formatPrefixName(_0x5f372d[_0x4b57('0x5f')]);_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x2,_0x4b57('0x64'),_0x4b57('0x65')+_0x5f372d[_0x4b57('0x2f')]));if(_0x5f372d[_0x4b57('0x66')]){_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x3,'Set','PREFIX-CALLERIDALL='+_0x5f372d[_0x4b57('0x66')]));}else{_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x3,'NoOp','No\x20callerid\x20available'));}_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x4,_0x4b57('0x67'),_0x20172a['context']+','+'${EXTEN:'+(0x8+_0x5f372d['name'][_0x4b57('0x3d')])+'}'+','+0x1));return _0x119933;}function formatPrefixName(_0x438f3e){var _0x243f4d='_';for(var _0x5976ce=0x0;_0x5976ce<_0x438f3e['length'];_0x5976ce++){if(_0x438f3e['charAt'](_0x5976ce)=='-'){_0x243f4d+=_0x438f3e[_0x4b57('0x68')](_0x5976ce);}else{_0x243f4d+='['+_0x438f3e['charAt'](_0x5976ce)+']';}}_0x243f4d+='.';return _0x243f4d;}exports[_0x4b57('0x27')]=function(_0x502313,_0x13c680,_0x425fe0){var _0x29b8ac=_0x502313[_0x4b57('0x69')];_0x29b8ac['prefix']=_0x4b57('0x6a')+_0x29b8ac['name']+'-';return db['sequelize'][_0x4b57('0x53')](function(_0x2a5bbd){return db['VoicePrefix'][_0x4b57('0x27')](_0x29b8ac,{'where':{'id':_0x29b8ac['id']},'transaction':_0x2a5bbd})[_0x4b57('0x28')](function(){return db[_0x4b57('0x54')][_0x4b57('0x4f')]({'where':{'VoicePrefixId':_0x29b8ac['id']},'transaction':_0x2a5bbd})[_0x4b57('0x28')](function(){return db[_0x4b57('0x54')]['find']({'where':{'id':_0x29b8ac[_0x4b57('0x55')]},'raw':!![]})[_0x4b57('0x28')](function(_0x3db213){return createVoicePrefixExtensions(_0x29b8ac,_0x3db213,_0x2a5bbd);});});});})[_0x4b57('0x28')](function(){return db[_0x4b57('0x31')]['findById'](_0x29b8ac['id']);})[_0x4b57('0x28')](respondWithResult(_0x13c680,null))[_0x4b57('0x4c')](handleError(_0x13c680,null));};exports[_0x4b57('0x6b')]=function(_0x24bd50,_0x5565f4,_0x4b17c3){return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0x24bd50[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x5565f4,null))[_0x4b57('0x28')](function(_0x5c1679){if(_0x5c1679){return _0x5c1679[_0x4b57('0x6b')](_0x24bd50[_0x4b57('0x69')]['ids'],_['omit'](_0x24bd50[_0x4b57('0x69')],['ids','id'])||{})[_0x4b57('0x6c')](function(_0x428450){for(var _0x374d6f=0x0;_0x374d6f<_0x24bd50[_0x4b57('0x69')][_0x4b57('0x6d')]['length'];_0x374d6f+=0x1){socket[_0x4b57('0x6e')](_0x4b57('0x6f'),{'UserId':Number(_0x24bd50[_0x4b57('0x69')]['ids'][_0x374d6f]),'VoicePrefixId':Number(_0x24bd50['params']['id'])});}return _0x428450;});}})[_0x4b57('0x28')](respondWithResult(_0x5565f4,null))[_0x4b57('0x4c')](handleError(_0x5565f4,null));};exports['removeAgents']=function(_0x1ceb74,_0x1148ff,_0x5d4ff9){return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0x1ceb74['params']['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x1148ff,null))[_0x4b57('0x28')](function(_0x36ab03){if(_0x36ab03){return _0x36ab03['removeAgents'](_0x1ceb74[_0x4b57('0x38')][_0x4b57('0x6d')])[_0x4b57('0x28')](function(){if(_[_0x4b57('0x70')](_0x1ceb74[_0x4b57('0x38')][_0x4b57('0x6d')])){for(var _0x3d15eb=0x0;_0x3d15eb<_0x1ceb74['query'][_0x4b57('0x6d')][_0x4b57('0x3d')];_0x3d15eb+=0x1){socket['emit'](_0x4b57('0x71'),{'UserId':Number(_0x1ceb74[_0x4b57('0x38')]['ids'][_0x3d15eb]),'VoicePrefixId':Number(_0x1ceb74[_0x4b57('0x50')]['id'])});}}else{socket[_0x4b57('0x6e')](_0x4b57('0x71'),{'UserId':Number(_0x1ceb74[_0x4b57('0x38')][_0x4b57('0x6d')]),'VoicePrefixId':Number(_0x1ceb74[_0x4b57('0x50')]['id'])});}});}})[_0x4b57('0x28')](respondWithStatusCode(_0x1148ff,null))[_0x4b57('0x4c')](handleError(_0x1148ff,null));};exports[_0x4b57('0x72')]=function(_0x830213,_0x87a28b,_0x3ab6b0){var _0x1dbfb8={};var _0x11f513={};var _0x185dab;var _0x4468fb;return db[_0x4b57('0x31')][_0x4b57('0x73')]({'where':{'id':_0x830213[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x87a28b,null))[_0x4b57('0x28')](function(_0x20da30){if(_0x20da30){_0x185dab=_0x20da30;_0x11f513[_0x4b57('0x35')]=_[_0x4b57('0x37')](db[_0x4b57('0x74')]['rawAttributes']);_0x11f513['query']=_['keys'](_0x830213['query']);_0x11f513[_0x4b57('0x39')]=_[_0x4b57('0x3a')](_0x11f513['model'],_0x11f513[_0x4b57('0x38')]);_0x1dbfb8[_0x4b57('0x3c')]=_['intersection'](_0x11f513[_0x4b57('0x35')],qs[_0x4b57('0x3b')](_0x830213['query']['fields']));_0x1dbfb8[_0x4b57('0x3c')]=_0x1dbfb8[_0x4b57('0x3c')][_0x4b57('0x3d')]?_0x1dbfb8[_0x4b57('0x3c')]:_0x11f513[_0x4b57('0x35')];_0x1dbfb8[_0x4b57('0x40')]=qs[_0x4b57('0x41')](_0x830213['query']['sort']);_0x1dbfb8[_0x4b57('0x42')]=qs[_0x4b57('0x39')](_[_0x4b57('0x43')](_0x830213[_0x4b57('0x38')],_0x11f513[_0x4b57('0x39')]));if(_0x830213[_0x4b57('0x38')][_0x4b57('0x46')]){_0x1dbfb8[_0x4b57('0x42')]=_[_0x4b57('0x44')](_0x1dbfb8['where'],{'$or':_[_0x4b57('0x36')](_0x1dbfb8[_0x4b57('0x3c')],function(_0x3dacb2){var _0x62df8b={};_0x62df8b[_0x3dacb2]={'$like':'%'+_0x830213['query']['filter']+'%'};return _0x62df8b;})});}_0x1dbfb8=_[_0x4b57('0x44')]({},_0x1dbfb8,_0x830213[_0x4b57('0x47')]);return _0x185dab['getAgents'](_0x1dbfb8);}})[_0x4b57('0x28')](function(_0x71a944){if(_0x71a944){_0x4468fb=_0x71a944['length'];if(!_0x830213[_0x4b57('0x38')]['hasOwnProperty']('nolimit')){_0x1dbfb8[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x830213[_0x4b57('0x38')][_0x4b57('0x21')]);_0x1dbfb8[_0x4b57('0x1f')]=qs['offset'](_0x830213[_0x4b57('0x38')][_0x4b57('0x1f')]);}return _0x185dab[_0x4b57('0x72')](_0x1dbfb8);}})[_0x4b57('0x28')](function(_0x14c1d6){if(_0x14c1d6){return _0x14c1d6?{'count':_0x4468fb,'rows':_0x14c1d6}:null;}})[_0x4b57('0x28')](respondWithResult(_0x87a28b,null))[_0x4b57('0x4c')](handleError(_0x87a28b,null));};exports['getTeams']=function(_0xe1bf71,_0x5ea27c,_0x35a29b){var _0x181029={};var _0x3b5100={};var _0x53b4a5;var _0x5357a3;return db[_0x4b57('0x31')][_0x4b57('0x73')]({'where':{'id':_0xe1bf71[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ea27c,null))[_0x4b57('0x28')](function(_0x455949){if(_0x455949){_0x53b4a5=_0x455949;_0x3b5100['model']=_[_0x4b57('0x37')](db[_0x4b57('0x75')][_0x4b57('0x32')]);_0x3b5100[_0x4b57('0x38')]=_[_0x4b57('0x37')](_0xe1bf71[_0x4b57('0x38')]);_0x3b5100[_0x4b57('0x39')]=_[_0x4b57('0x3a')](_0x3b5100['model'],_0x3b5100[_0x4b57('0x38')]);_0x181029[_0x4b57('0x3c')]=_[_0x4b57('0x3a')](_0x3b5100['model'],qs[_0x4b57('0x3b')](_0xe1bf71['query']['fields']));_0x181029[_0x4b57('0x3c')]=_0x181029[_0x4b57('0x3c')][_0x4b57('0x3d')]?_0x181029[_0x4b57('0x3c')]:_0x3b5100[_0x4b57('0x35')];_0x181029[_0x4b57('0x40')]=qs[_0x4b57('0x41')](_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x41')]);_0x181029['where']=qs[_0x4b57('0x39')](_['pick'](_0xe1bf71[_0x4b57('0x38')],_0x3b5100['filters']));if(_0xe1bf71['query'][_0x4b57('0x46')]){_0x181029[_0x4b57('0x42')]=_[_0x4b57('0x44')](_0x181029[_0x4b57('0x42')],{'$or':_[_0x4b57('0x36')](_0x181029[_0x4b57('0x3c')],function(_0x30e3ab){var _0xca5674={};_0xca5674[_0x30e3ab]={'$like':'%'+_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x46')]+'%'};return _0xca5674;})});}_0x181029=_[_0x4b57('0x44')]({},_0x181029,_0xe1bf71[_0x4b57('0x47')]);return _0x53b4a5[_0x4b57('0x76')](_0x181029);}})[_0x4b57('0x28')](function(_0x52d476){if(_0x52d476){_0x5357a3=_0x52d476[_0x4b57('0x3d')];if(!_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x3e')]('nolimit')){_0x181029[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x21')]);_0x181029[_0x4b57('0x1f')]=qs['offset'](_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x1f')]);}return _0x53b4a5[_0x4b57('0x76')](_0x181029);}})[_0x4b57('0x28')](function(_0x1c63c1){if(_0x1c63c1){return _0x1c63c1?{'count':_0x5357a3,'rows':_0x1c63c1}:null;}})[_0x4b57('0x28')](respondWithResult(_0x5ea27c,null))[_0x4b57('0x4c')](handleError(_0x5ea27c,null));};exports[_0x4b57('0x77')]=function(_0x20560b,_0x535ccc,_0x320a0a){var _0x2a2689=_0x20560b[_0x4b57('0x69')][_0x4b57('0x6d')];var _0x19e09a;return db[_0x4b57('0x75')][_0x4b57('0x4a')]({'where':{'id':_0x2a2689},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b57('0x78'),'attributes':['id',_0x4b57('0x2f'),_0x4b57('0x79'),_0x4b57('0x7a'),_0x4b57('0x7b')],'raw':!![]}]})[_0x4b57('0x28')](function(_0x4c7fa8){if(_0x4c7fa8){_0x19e09a=_0x4c7fa8;var _0x46e1b0=_[_0x4b57('0x7c')](_0x4c7fa8,function(_0x448b3d){var _0x287c29=_0x448b3d[_0x4b57('0x29')]({'plain':!![]});return _0x287c29[_0x4b57('0x78')];});return db['VoicePrefix'][_0x4b57('0x4e')]({'where':{'id':_0x20560b[_0x4b57('0x50')]['id']}})['then'](function(_0x60d8d0){return db[_0x4b57('0x52')][_0x4b57('0x53')](function(_0x34d45d){return _0x60d8d0[_0x4b57('0x77')](_0x2a2689,{'transaction':_0x34d45d})[_0x4b57('0x28')](function(){return BPromise[_0x4b57('0x7d')](_0x19e09a,function(_0x50bbdc){return db[_0x4b57('0x7e')]['upsert']({'TeamId':_0x50bbdc['id'],'VoicePrefixId':_0x20560b[_0x4b57('0x50')]['id']},{'transaction':_0x34d45d});});})[_0x4b57('0x28')](function(){return BPromise[_0x4b57('0x7d')](_0x46e1b0,function(_0x46037e){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x46037e['id'],'VoicePrefixId':_0x20560b['params']['id']},'transaction':_0x34d45d});});})['then'](function(){_0x46e1b0[_0x4b57('0x7f')](function(_0x2e0bf0){socket['emit'](_0x4b57('0x6f'),{'UserId':_0x2e0bf0['id'],'VoicePrefixId':_0x60d8d0['id']});});});});});}})[_0x4b57('0x28')](respondWithStatusCode(_0x535ccc,null))[_0x4b57('0x4c')](handleError(_0x535ccc,null));};exports['removeTeams']=function(_0x5c4333,_0x4fff4a,_0x515113){return db[_0x4b57('0x75')][_0x4b57('0x4a')]({'where':{'id':_0x5c4333[_0x4b57('0x38')][_0x4b57('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x4b57('0x74')],'as':_0x4b57('0x78'),'attributes':['id'],'raw':!![]}]})[_0x4b57('0x28')](handleEntityNotFound(_0x4fff4a,null))[_0x4b57('0x28')](function(_0xa1ce41){var _0x191975=_['map'](_0xa1ce41,'id');var _0xd16e62=[];var _0x2115cf=[];var _0x4555dc=squel[_0x4b57('0x80')]();_0x4555dc[_0x4b57('0x81')](_0x4b57('0x82'))[_0x4b57('0x83')]('team_has_voice_prefixes','tq')[_0x4b57('0x84')](_0x4b57('0x85'),'ut',_0x4b57('0x86'))['where'](_0x4b57('0x87'),_0x5c4333[_0x4b57('0x50')]['id']);for(var _0x9eb896=0x0;_0x9eb896<_0xa1ce41[_0x4b57('0x3d')];_0x9eb896+=0x1){let _0x1f930b=_0xa1ce41[_0x9eb896];for(var _0x19d369=0x0;_0x19d369<_0x1f930b[_0x4b57('0x78')][_0x4b57('0x3d')];_0x19d369+=0x1){let _0x1e7f07=_0x1f930b[_0x4b57('0x78')][_0x19d369];var _0x51c328=_0x4555dc[_0x4b57('0x88')]();_0x51c328[_0x4b57('0x42')](_0x4b57('0x89'),_0x1e7f07['id']);_0x2115cf[_0x4b57('0x63')](db[_0x4b57('0x52')][_0x4b57('0x38')](_0x51c328[_0x4b57('0x8a')](),{'type':db[_0x4b57('0x52')][_0x4b57('0x8b')][_0x4b57('0x8c')]})[_0x4b57('0x28')](function(_0x307e53){if(_0x307e53['length']===0x1){return _0x1e7f07['id'];}else{var _0x365017=_[_0x4b57('0x8d')](_['map'](_0x307e53,_0x4b57('0x8e')),function(_0x5569e4){return _[_0x4b57('0x8f')](_0x191975,_0x5569e4);});if(_0x365017){return _0x1e7f07['id'];}}}));}}return BPromise[_0x4b57('0x90')](_0x2115cf)[_0x4b57('0x28')](function(_0x3b3373){_0xd16e62=_(_0xd16e62)['union'](_0x3b3373)[_0x4b57('0x91')]()[_0x4b57('0x92')]();return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0x5c4333[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](function(_0x6083ae){return db['sequelize'][_0x4b57('0x53')](function(_0x29f8a1){return _0x6083ae[_0x4b57('0x93')](_0x5c4333['query']['ids'],{'transaction':_0x29f8a1})[_0x4b57('0x28')](function(){if(!_['isEmpty'](_0xd16e62)){return _0x6083ae['removeAgents'](_0xd16e62,{'transaction':_0x29f8a1});}})[_0x4b57('0x28')](function(){_0xd16e62[_0x4b57('0x7f')](function(_0x592b7d){socket[_0x4b57('0x6e')](_0x4b57('0x71'),{'UserId':_0x592b7d,'VoicePrefixId':_0x6083ae['id']});});});});});});})['then'](respondWithStatusCode(_0x4fff4a,null))['catch'](handleError(_0x4fff4a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3497502..17bdb6a 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 _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 +var _0x921e=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4bc78a,_0x17a88e){var _0x18698e=function(_0x9d14df){while(--_0x9d14df){_0x4bc78a['push'](_0x4bc78a['shift']());}};_0x18698e(++_0x17a88e);}(_0x921e,0x1df));var _0xe921=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x921e[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xe921('0x0'));var VoicePrefix=require(_0xe921('0x1'))['db'][_0xe921('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe921('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe921('0x4'),'afterDestroy':'remove'};function emitEvent(_0x240322){return function(_0x316879,_0xf3df68,_0x30e481){VoicePrefixEvents[_0xe921('0x5')](_0x240322+':'+_0x316879['id'],_0x316879);VoicePrefixEvents[_0xe921('0x5')](_0x240322,_0x316879);_0x30e481(null);};}for(var e in events){if(events[_0xe921('0x6')](e)){var event=events[e];VoicePrefix[_0xe921('0x7')](e,emitEvent(event));}}module[_0xe921('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 01628be..6d9faa4 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 _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 +var _0xdebb=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_prefixes','util','../../config/logger','api','moment'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xdebb,0xa4));var _0xbdeb=function(_0x45b786,_0x35192d){_0x45b786=_0x45b786-0x0;var _0x421457=_0xdebb[_0x45b786];return _0x421457;};'use strict';var _=require('lodash');var util=require(_0xbdeb('0x0'));var logger=require(_0xbdeb('0x1'))(_0xbdeb('0x2'));var moment=require(_0xbdeb('0x3'));var BPromise=require(_0xbdeb('0x4'));var rp=require(_0xbdeb('0x5'));var fs=require('fs');var path=require(_0xbdeb('0x6'));var rimraf=require(_0xbdeb('0x7'));var config=require(_0xbdeb('0x8'));var attributes=require('./voicePrefix.attributes');module[_0xbdeb('0x9')]=function(_0x21fd63,_0x27f29d){return _0x21fd63[_0xbdeb('0xa')]('VoicePrefix',attributes,{'tableName':_0xbdeb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index dcb8ba5..f400c50 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 _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 +var _0x0024=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x0024,0xa8));var _0x4002=function(_0x4dc8fc,_0x27d9a5){_0x4dc8fc=_0x4dc8fc-0x0;var _0x18d77f=_0x0024[_0x4dc8fc];return _0x18d77f;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var moment=require('moment');var BPromise=require(_0x4002('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4002('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4002('0x3'))(_0x4002('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4002('0x5')][_0x4002('0x6')]({'port':0x232a});config[_0x4002('0x7')]=_[_0x4002('0x8')](config['redis'],{'host':_0x4002('0x9'),'port':0x18eb});var socket=require(_0x4002('0xa'))(new Redis(config[_0x4002('0x7')]));require(_0x4002('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f32c7,_0x21c971,_0x26fd5d){return new BPromise(function(_0x397864,_0x12c368){return client[_0x4002('0xc')](_0x5f32c7,_0x26fd5d)['then'](function(_0x53c0ef){logger['info'](_0x4002('0xd'),_0x21c971,_0x4002('0xe'));logger[_0x4002('0xf')](_0x4002('0x10'),_0x21c971,'request\x20sent',JSON[_0x4002('0x11')](_0x53c0ef));if(_0x53c0ef[_0x4002('0x12')]){if(_0x53c0ef[_0x4002('0x12')][_0x4002('0x13')]===0x1f4){logger[_0x4002('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x12c368(_0x53c0ef[_0x4002('0x12')][_0x4002('0x14')]);}logger[_0x4002('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x397864(_0x53c0ef['error'][_0x4002('0x14')]);}else{logger[_0x4002('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x4002('0xe'));_0x397864(_0x53c0ef['result']['message']);}})['catch'](function(_0x22820f){logger[_0x4002('0x12')](_0x4002('0xd'),_0x21c971,_0x22820f);_0x12c368(_0x22820f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index ef9fcee..f95e9ff 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 _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 +var _0x4fef=['save','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x42a2e7,_0x1953c0){var _0x96be3d=function(_0x32e98e){while(--_0x32e98e){_0x42a2e7['push'](_0x42a2e7['shift']());}};_0x96be3d(++_0x1953c0);}(_0x4fef,0x10f));var _0xf4fe=function(_0x1f8eaa,_0x30f70c){_0x1f8eaa=_0x1f8eaa-0x0;var _0x36685c=_0x4fef[_0x1f8eaa];return _0x36685c;};'use strict';var VoicePrefixEvents=require(_0xf4fe('0x0'));var events=[_0xf4fe('0x1'),'remove',_0xf4fe('0x2')];function createListener(_0x5a2bd0,_0x40f4b2){return function(_0x14bf18){_0x40f4b2[_0xf4fe('0x3')](_0x5a2bd0,_0x14bf18);};}function removeListener(_0x1e5ec2,_0x5c5dbb){return function(){VoicePrefixEvents[_0xf4fe('0x4')](_0x1e5ec2,_0x5c5dbb);};}exports[_0xf4fe('0x5')]=function(_0x27c6c9){for(var _0x522427=0x0,_0x363096=events[_0xf4fe('0x6')];_0x522427<_0x363096;_0x522427++){var _0x4805b0=events[_0x522427];var _0x23b761=createListener(_0xf4fe('0x7')+_0x4805b0,_0x27c6c9);VoicePrefixEvents['on'](_0x4805b0,_0x23b761);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6ddaea8..a8e1fb3 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_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 +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(_0x2d6d08,_0x4c8f0c){var _0x4b8145=function(_0x309466){while(--_0x309466){_0x2d6d08['push'](_0x2d6d08['shift']());}};_0x4b8145(++_0x4c8f0c);}(_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['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index fa07101..eb08ac7 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 _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 +var _0x8735=['wrandom','setDataValue','strategy','type','getDataValue','dialMethod','preview','booked','rrmemory','roundrobin','INTEGER','yes','all','once','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','power','predictive','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','linear'];(function(_0x4b10d8,_0xbfb76){var _0x9f5151=function(_0x1c3f21){while(--_0x1c3f21){_0x4b10d8['push'](_0x4b10d8['shift']());}};_0x9f5151(++_0xbfb76);}(_0x8735,0x135));var _0x5873=function(_0x48681c,_0xa05edb){_0x48681c=_0x48681c-0x0;var _0x3dfdf1=_0x8735[_0x48681c];return _0x3dfdf1;};'use strict';var Sequelize=require('sequelize');module[_0x5873('0x0')]={'name':{'type':Sequelize[_0x5873('0x1')],'allowNull':![],'unique':_0x5873('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x4'),_0x5873('0x5')),'allowNull':![],'defaultValue':_0x5873('0x4')},'musiconhold':{'type':Sequelize[_0x5873('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x5873('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5873('0x3')]('rr',_0x5873('0x6'),_0x5873('0x7'),_0x5873('0x8'),_0x5873('0x9'),'rrmemory',_0x5873('0xa'),_0x5873('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0xf28823){this[_0x5873('0xc')](_0x5873('0xd'),_0xf28823?_0xf28823:'rrmemory');},'get':function(){var _0x86f515=this['getDataValue'](_0x5873('0xe'));var _0x41e681=this[_0x5873('0xf')](_0x5873('0x10'));var _0x1e54cd=this[_0x5873('0xf')](_0x5873('0xd'));if(_0x86f515===_0x5873('0x5')){if(_0x41e681===_0x5873('0x11')){return null;}if(_0x41e681===_0x5873('0x12')&&![_0x5873('0x13'),_0x5873('0x14')]['includes'](_0x1e54cd)){this[_0x5873('0xc')]('strategy',_0x5873('0x13'));}}return _0x1e54cd;}},'servicelevel':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5873('0x15')](0xb)},'timeout':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5873('0x1')]},'weight':{'type':Sequelize[_0x5873('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':_0x5873('0x16')},'autopause':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no',_0x5873('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5873('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5873('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5873('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x5873('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5873('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5873('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x5873('0x16'),'no'),'defaultValue':_0x5873('0x16')},'announce_holdtime':{'type':Sequelize[_0x5873('0x3')]('yes','no',_0x5873('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x5873('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5873('0x1')]},'queue_youarenext':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5873('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x5873('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x5873('0x1')]},'queue_less_than':{'type':Sequelize[_0x5873('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x5d855d){this['setDataValue']('periodic_announce',_0x5d855d?_0x5d855d['join'](','):[]);},'get':function(){return this[_0x5873('0xf')](_0x5873('0x19'))?this[_0x5873('0xf')]('periodic_announce')[_0x5873('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x5873('0x16'),'set':function(_0x15df1d){this[_0x5873('0xc')](_0x5873('0x1b'),_0x15df1d?_0x15df1d['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x5873('0x1b'))?this['getDataValue'](_0x5873('0x1b'))[_0x5873('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5873('0x1')],'defaultValue':'no','set':function(_0x458488){this[_0x5873('0xc')](_0x5873('0x1c'),_0x458488?_0x458488[_0x5873('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0x5873('0x1c'))?this[_0x5873('0xf')](_0x5873('0x1c'))[_0x5873('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x5873('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5873('0x1')]},'description':{'type':Sequelize[_0x5873('0x1')]},'acw':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':0x0,'set':function(_0x2e060d){this[_0x5873('0xc')]('acw',_0x2e060d);if(_0x2e060d){if(this['getDataValue'](_0x5873('0x1f'))<0x2){this[_0x5873('0xc')](_0x5873('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x5873('0x11'),'progressive',_0x5873('0x20'),_0x5873('0x21'),_0x5873('0x12')),'defaultValue':_0x5873('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x5873('0x15')](0x4)[_0x5873('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5873('0x24')},'dialLimitQueue':{'type':Sequelize[_0x5873('0x15')](0x4)[_0x5873('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5873('0x25')},'dialPowerLevel':{'type':Sequelize[_0x5873('0x26')](0x2)[_0x5873('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5873('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x28'),_0x5873('0x29')),'defaultValue':_0x5873('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5873('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5873('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5873('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5873('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x5873('0x1')],'defaultValue':_0x5873('0x2c'),'comment':_0x5873('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x2e')},'dialQueueProject':{'type':Sequelize[_0x5873('0x1')],'comment':_0x5873('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'comment':_0x5873('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5873('0x34')},'dialTimezone':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5873('0x1')],'defaultValue':_0x5873('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5873('0x36'),_0x5873('0x37'),_0x5873('0x38')),'defaultValue':_0x5873('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5873('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x5873('0x15')](0x9)[_0x5873('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5873('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x5873('0x15')](0x9)[_0x5873('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5873('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5873('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5873('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5873('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5873('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5873('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5873('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5873('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':0x0,'comment':_0x5873('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x42'),_0x5873('0x43')),'defaultValue':_0x5873('0x42')},'dialQueueProject2':{'type':Sequelize[_0x5873('0x1')],'comment':_0x5873('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5873('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5873('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5873('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5873('0x4d'),'set':function(_0x1d569e){if(!_0x1d569e)this[_0x5873('0xc')](_0x5873('0x4e'),null);this[_0x5873('0xc')](_0x5873('0x4f'),_0x1d569e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index beebb64..9781b79 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 _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 +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x279964,_0x176d33){var _0x3a43e3=function(_0x17d457){while(--_0x17d457){_0x279964['push'](_0x279964['shift']());}};_0x3a43e3(++_0x176d33);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index da32cd5..83a43d9 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 _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 +var _0xead1=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5766b8,_0x3f562d){var _0x214b9f=function(_0x5ce922){while(--_0x5ce922){_0x5766b8['push'](_0x5766b8['shift']());}};_0x214b9f(++_0x3f562d);}(_0xead1,0x128));var _0x1ead=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xead1[_0x3e112d];return _0x531c31;};'use strict';var EventEmitter=require(_0x1ead('0x0'));var VoiceQueue=require(_0x1ead('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1ead('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ead('0x3'),'afterDestroy':_0x1ead('0x4')};function emitEvent(_0x4e3c1a){return function(_0x1cb84b,_0xc3097c,_0x4de671){VoiceQueueEvents[_0x1ead('0x5')](_0x4e3c1a+':'+_0x1cb84b['id'],_0x1cb84b);VoiceQueueEvents[_0x1ead('0x5')](_0x4e3c1a,_0x1cb84b);_0x4de671(null);};}for(var e in events){if(events[_0x1ead('0x6')](e)){var event=events[e];VoiceQueue[_0x1ead('0x7')](e,emitEvent(event));}}module[_0x1ead('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 362438b..5667d99 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_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 +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x37858a,_0x3b523f){var _0x1ff350=function(_0x13f59c){while(--_0x13f59c){_0x37858a['push'](_0x37858a['shift']());}};_0x1ff350(++_0x3b523f);}(_0x3e74,0x175));var _0x43e7=function(_0xea6fdf,_0x8ece6){_0xea6fdf=_0xea6fdf-0x0;var _0x50b946=_0x3e74[_0xea6fdf];return _0x50b946;};'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/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index acccfd7..af246d9 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 _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 +var _0x3e98=['model','attributes','GetVoiceQueue','ShowVoiceQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','include','map'];(function(_0x4d3577,_0x36df4f){var _0x29d8b6=function(_0x4f7fb1){while(--_0x4f7fb1){_0x4d3577['push'](_0x4d3577['shift']());}};_0x29d8b6(++_0x36df4f);}(_0x3e98,0x79));var _0x83e9=function(_0x1801e6,_0x3814c2){_0x1801e6=_0x1801e6-0x0;var _0x465eaa=_0x3e98[_0x1801e6];return _0x465eaa;};'use strict';var _=require(_0x83e9('0x0'));var util=require('util');var moment=require(_0x83e9('0x1'));var BPromise=require(_0x83e9('0x2'));var rs=require(_0x83e9('0x3'));var fs=require('fs');var Redis=require(_0x83e9('0x4'));var db=require(_0x83e9('0x5'))['db'];var utils=require(_0x83e9('0x6'));var logger=require(_0x83e9('0x7'))(_0x83e9('0x8'));var config=require('../../config/environment');var jayson=require(_0x83e9('0x9'));var client=jayson[_0x83e9('0xa')][_0x83e9('0xb')]({'port':0x232a});config[_0x83e9('0xc')]=_[_0x83e9('0xd')](config['redis'],{'host':_0x83e9('0xe'),'port':0x18eb});var socket=require(_0x83e9('0xf'))(new Redis(config[_0x83e9('0xc')]));require(_0x83e9('0x10'))[_0x83e9('0x11')](socket);function respondWithRpcPromise(_0x345589,_0x413edb,_0x58caab){return new BPromise(function(_0x152272,_0x7395a1){return client['request'](_0x345589,_0x58caab)[_0x83e9('0x12')](function(_0x11966d){logger[_0x83e9('0x13')](_0x83e9('0x14'),_0x413edb,_0x83e9('0x15'));logger[_0x83e9('0x16')](_0x83e9('0x17'),_0x413edb,_0x83e9('0x15'),JSON[_0x83e9('0x18')](_0x11966d));if(_0x11966d['error']){if(_0x11966d[_0x83e9('0x19')][_0x83e9('0x1a')]===0x1f4){logger['error'](_0x83e9('0x14'),_0x413edb,_0x11966d[_0x83e9('0x19')][_0x83e9('0x1b')]);return _0x7395a1(_0x11966d[_0x83e9('0x19')]['message']);}logger[_0x83e9('0x19')](_0x83e9('0x14'),_0x413edb,_0x11966d['error'][_0x83e9('0x1b')]);return _0x152272(_0x11966d[_0x83e9('0x19')][_0x83e9('0x1b')]);}else{logger[_0x83e9('0x13')](_0x83e9('0x14'),_0x413edb,_0x83e9('0x15'));_0x152272(_0x11966d[_0x83e9('0x1c')]['message']);}})['catch'](function(_0x15c6d1){logger[_0x83e9('0x19')](_0x83e9('0x14'),_0x413edb,_0x15c6d1);_0x7395a1(_0x15c6d1);});});}exports['GetVoiceQueue']=function(_0x5c3860){var _0x4b0d28=this;return new Promise(function(_0x5ba315,_0x2b3e9d){return db['VoiceQueue'][_0x83e9('0x1d')]({'raw':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')][_0x83e9('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')][_0x83e9('0x20')]||null:null,'attributes':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')]['attributes']||null:null,'limit':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')]['limit']||null:null,'include':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')][_0x83e9('0x21')]?_[_0x83e9('0x22')](_0x5c3860['options'][_0x83e9('0x21')],function(_0x1282f0){return{'model':db[_0x1282f0[_0x83e9('0x23')]],'as':_0x1282f0['as'],'attributes':_0x1282f0[_0x83e9('0x24')],'include':_0x1282f0[_0x83e9('0x21')]?_['map'](_0x1282f0[_0x83e9('0x21')],function(_0x620471){return{'model':db[_0x620471[_0x83e9('0x23')]],'as':_0x620471['as'],'attributes':_0x620471['attributes'],'include':_0x620471[_0x83e9('0x21')]?_['map'](_0x620471[_0x83e9('0x21')],function(_0x5b5c70){return{'model':db[_0x5b5c70[_0x83e9('0x23')]],'as':_0x5b5c70['as'],'attributes':_0x5b5c70['attributes']};}):[]};}):[]};}):[]:[]})[_0x83e9('0x12')](function(_0x4889ce){logger[_0x83e9('0x13')](_0x83e9('0x25'),_0x5c3860);logger['debug']('GetVoiceQueue',_0x5c3860,JSON[_0x83e9('0x18')](_0x4889ce));_0x5ba315(_0x4889ce);})['catch'](function(_0x51b639){logger[_0x83e9('0x19')](_0x83e9('0x25'),_0x51b639[_0x83e9('0x1b')],_0x5c3860);_0x2b3e9d(_0x4b0d28[_0x83e9('0x19')](0x1f4,_0x51b639[_0x83e9('0x1b')]));});});};exports[_0x83e9('0x26')]=function(_0xcb5892){var _0x53b72c=this;return new Promise(function(_0x5c173a,_0x5f4cfb){return db['VoiceQueue']['find']({'raw':_0xcb5892['options']?_0xcb5892[_0x83e9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xcb5892[_0x83e9('0x1e')]?_0xcb5892[_0x83e9('0x1e')][_0x83e9('0x20')]||null:null,'attributes':_0xcb5892[_0x83e9('0x1e')]?_0xcb5892[_0x83e9('0x1e')][_0x83e9('0x24')]||null:null,'include':_0xcb5892[_0x83e9('0x1e')]?_0xcb5892['options'][_0x83e9('0x21')]?_['map'](_0xcb5892['options'][_0x83e9('0x21')],function(_0x30a28f){return{'model':db[_0x30a28f[_0x83e9('0x23')]],'as':_0x30a28f['as'],'attributes':_0x30a28f[_0x83e9('0x24')],'include':_0x30a28f[_0x83e9('0x21')]?_[_0x83e9('0x22')](_0x30a28f[_0x83e9('0x21')],function(_0x5bb3fc){return{'model':db[_0x5bb3fc[_0x83e9('0x23')]],'as':_0x5bb3fc['as'],'attributes':_0x5bb3fc['attributes'],'include':_0x5bb3fc[_0x83e9('0x21')]?_[_0x83e9('0x22')](_0x5bb3fc['include'],function(_0x4fa790){return{'model':db[_0x4fa790[_0x83e9('0x23')]],'as':_0x4fa790['as'],'attributes':_0x4fa790[_0x83e9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x83e9('0x12')](function(_0xa478e1){logger[_0x83e9('0x13')](_0x83e9('0x26'),_0xcb5892);logger[_0x83e9('0x16')](_0x83e9('0x26'),_0xcb5892,JSON['stringify'](_0xa478e1));_0x5c173a(_0xa478e1);})['catch'](function(_0x3f4292){logger['error'](_0x83e9('0x26'),_0x3f4292[_0x83e9('0x1b')],_0xcb5892);_0x5f4cfb(_0x53b72c['error'](0x1f4,_0x3f4292[_0x83e9('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 45af057..566cfae 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 _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 +var _0x4231=['length','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x5c03a4,_0x38d38e){var _0x1b5c9c=function(_0x73e85){while(--_0x73e85){_0x5c03a4['push'](_0x5c03a4['shift']());}};_0x1b5c9c(++_0x38d38e);}(_0x4231,0xcc));var _0x1423=function(_0x40cd61,_0x36162c){_0x40cd61=_0x40cd61-0x0;var _0x120ce8=_0x4231[_0x40cd61];return _0x120ce8;};'use strict';var VoiceQueueEvents=require(_0x1423('0x0'));var events=[_0x1423('0x1'),_0x1423('0x2'),_0x1423('0x3')];function createListener(_0x59036d,_0x2d63a9){return function(_0x4544a6){_0x2d63a9['emit'](_0x59036d,_0x4544a6);};}function removeListener(_0x15cabf,_0x40219d){return function(){VoiceQueueEvents[_0x1423('0x4')](_0x15cabf,_0x40219d);};}exports[_0x1423('0x5')]=function(_0x40df4d){for(var _0x3d6577=0x0,_0xae5c7b=events[_0x1423('0x6')];_0x3d6577<_0xae5c7b;_0x3d6577++){var _0x1ff3e5=events[_0x3d6577];var _0x43de0a=createListener('voiceQueue:'+_0x1ff3e5,_0x40df4d);VoiceQueueEvents['on'](_0x1ff3e5,_0x43de0a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index dd10e91..99fcd9d 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 _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 +var _0x1144=['/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','path','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x50d851,_0x127682){var _0x553ded=function(_0x2f6b27){while(--_0x2f6b27){_0x50d851['push'](_0x50d851['shift']());}};_0x553ded(++_0x127682);}(_0x1144,0x1eb));var _0x4114=function(_0x40ea3e,_0x1744ed){_0x40ea3e=_0x40ea3e-0x0;var _0x5ed6ba=_0x1144[_0x40ea3e];return _0x5ed6ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4114('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4114('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x4114('0x2'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x4114('0x3')]('/',auth[_0x4114('0x4')](),controller['index']);router['get'](_0x4114('0x5'),auth[_0x4114('0x4')](),controller[_0x4114('0x6')]);router[_0x4114('0x3')](_0x4114('0x7'),auth[_0x4114('0x4')](),controller[_0x4114('0x8')]);router[_0x4114('0x3')]('/:id',auth[_0x4114('0x4')](),controller[_0x4114('0x9')]);router[_0x4114('0xa')]('/',auth[_0x4114('0x4')](),controller[_0x4114('0xb')]);router[_0x4114('0xc')](_0x4114('0xd'),auth[_0x4114('0x4')](),controller[_0x4114('0xe')]);router[_0x4114('0xf')](_0x4114('0xd'),auth[_0x4114('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index de47b46..dac369e 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 _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 +var _0x99ac=['sequelize','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5d3d29,_0x42ac07){var _0x1e69bf=function(_0x55321a){while(--_0x55321a){_0x5d3d29['push'](_0x5d3d29['shift']());}};_0x1e69bf(++_0x42ac07);}(_0x99ac,0xa8));var _0xc99a=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x99ac[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xc99a('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xc99a('0x1')]},'uniqueid':{'type':Sequelize[_0xc99a('0x1')]},'calleridnum':{'type':Sequelize[_0xc99a('0x1')]},'calleridname':{'type':Sequelize[_0xc99a('0x1')]},'queue':{'type':Sequelize[_0xc99a('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xc99a('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xc99a('0x2')],'set':function(_0x388499){var _0x3e9285=moment(_0x388499);var _0x55971b=moment(this['getDataValue'](_0xc99a('0x3')))['format'](_0xc99a('0x4'));var _0x58ca2f=_0x3e9285[_0xc99a('0x5')](_0x55971b,_0xc99a('0x6'));this['setDataValue']('queuecallerleaveAt',_0x388499);this[_0xc99a('0x7')]('holdtime',_0x58ca2f||null);}},'position':{'type':Sequelize[_0xc99a('0x8')]},'count':{'type':Sequelize[_0xc99a('0x8')]},'queuecallerabandon':{'type':Sequelize[_0xc99a('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc99a('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc99a('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xc99a('0x1')],'comment':_0xc99a('0xa')},'originalposition':{'type':Sequelize[_0xc99a('0x8')]},'channel':{'type':Sequelize[_0xc99a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc99a('0x1')]},'connectedlinename':{'type':Sequelize[_0xc99a('0x1')]},'accountcode':{'type':Sequelize[_0xc99a('0x1')]},'context':{'type':Sequelize[_0xc99a('0x1')]},'exten':{'type':Sequelize[_0xc99a('0x1')]},'priority':{'type':Sequelize[_0xc99a('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc99a('0x1')]},'transfer':{'type':Sequelize[_0xc99a('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc99a('0x1')],'comment':_0xc99a('0xb')},'transferexten':{'type':Sequelize[_0xc99a('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc99a('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc99a('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xc99a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b3648a3..094623e 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 _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 +var _0x9c6f=['type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','VoiceQueueReport','includeAll','include','findAll','catch','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','filter','rows','eml-format','zip-dir','request-promise','moment','bluebird','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','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName'];(function(_0x1a325d,_0x10fe61){var _0x481d1e=function(_0x2b9e21){while(--_0x2b9e21){_0x1a325d['push'](_0x1a325d['shift']());}};_0x481d1e(++_0x10fe61);}(_0x9c6f,0x1af));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf9c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9c6('0x2'));var moment=require(_0xf9c6('0x3'));var BPromise=require(_0xf9c6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf9c6('0x5'));var csv=require(_0xf9c6('0x6'));var ejs=require(_0xf9c6('0x7'));var fs=require('fs');var fs_extra=require(_0xf9c6('0x8'));var _=require(_0xf9c6('0x9'));var squel=require(_0xf9c6('0xa'));var crypto=require(_0xf9c6('0xb'));var jsforce=require(_0xf9c6('0xc'));var deskjs=require(_0xf9c6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf9c6('0xe'));var Redis=require(_0xf9c6('0xf'));var authService=require(_0xf9c6('0x10'));var qs=require(_0xf9c6('0x11'));var as=require(_0xf9c6('0x12'));var hardwareService=require(_0xf9c6('0x13'));var logger=require('../../config/logger')(_0xf9c6('0x14'));var utils=require('../../config/utils');var config=require(_0xf9c6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9c6('0x16'))['db'];config[_0xf9c6('0x17')]=_[_0xf9c6('0x18')](config[_0xf9c6('0x17')],{'host':_0xf9c6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf9c6('0x1a'))['register'](socket);function respondWithStatusCode(_0x7c80e8,_0x230a89){_0x230a89=_0x230a89||0xcc;return function(_0x4cb4a2){if(_0x4cb4a2){return _0x7c80e8[_0xf9c6('0x1b')](_0x230a89);}return _0x7c80e8['status'](_0x230a89)[_0xf9c6('0x1c')]();};}function respondWithResult(_0x33bd86,_0x27d902){_0x27d902=_0x27d902||0xc8;return function(_0x12fcd9){if(_0x12fcd9){return _0x33bd86[_0xf9c6('0x1d')](_0x27d902)[_0xf9c6('0x1e')](_0x12fcd9);}};}function respondWithFilteredResult(_0x50c620,_0x449726){return function(_0x22cd69){if(_0x22cd69){var _0x234c17=typeof _0x449726[_0xf9c6('0x1f')]===_0xf9c6('0x20')&&typeof _0x449726[_0xf9c6('0x21')]===_0xf9c6('0x20');var _0x3a524b=_0x22cd69[_0xf9c6('0x22')];var _0x190eaf=_0x234c17?0x0:_0x449726[_0xf9c6('0x1f')];var _0x10d775=_0x234c17?_0x22cd69[_0xf9c6('0x22')]:_0x449726[_0xf9c6('0x1f')]+_0x449726[_0xf9c6('0x21')];var _0x3618c1;if(_0x10d775>=_0x3a524b){_0x10d775=_0x3a524b;_0x3618c1=0xc8;}else{_0x3618c1=0xce;}_0x50c620['status'](_0x3618c1);return _0x50c620[_0xf9c6('0x23')](_0xf9c6('0x24'),_0x190eaf+'-'+_0x10d775+'/'+_0x3a524b)[_0xf9c6('0x1e')](_0x22cd69);}return null;};}function patchUpdates(_0x114545){return function(_0x12df15){try{jsonpatch[_0xf9c6('0x25')](_0x12df15,_0x114545,!![]);}catch(_0x1d45e1){return BPromise[_0xf9c6('0x26')](_0x1d45e1);}return _0x12df15[_0xf9c6('0x27')]();};}function saveUpdates(_0x164331,_0x59e6a1){return function(_0x4b6bdf){if(_0x4b6bdf){return _0x4b6bdf[_0xf9c6('0x28')](_0x164331)[_0xf9c6('0x29')](function(_0x5e4a48){return _0x5e4a48;});}return null;};}function removeEntity(_0x1012e1,_0x5bb07b){return function(_0x7c2df8){if(_0x7c2df8){return _0x7c2df8[_0xf9c6('0x2a')]()[_0xf9c6('0x29')](function(){_0x1012e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d517,_0x45986d){return function(_0x43e658){if(!_0x43e658){_0x12d517['sendStatus'](0x194);}return _0x43e658;};}function handleError(_0x213006,_0x5eb074){_0x5eb074=_0x5eb074||0x1f4;return function(_0x88e1bf){logger['error'](_0x88e1bf[_0xf9c6('0x2b')]);if(_0x88e1bf[_0xf9c6('0x2c')]){delete _0x88e1bf['name'];}_0x213006[_0xf9c6('0x1d')](_0x5eb074)[_0xf9c6('0x2d')](_0x88e1bf);};}exports[_0xf9c6('0x2e')]=function(_0x500b5e,_0x1c3556){var _0x45b528={},_0x109cdb={},_0x566959={'count':0x0,'rows':[]};var _0x43aa1b=_['map'](db['VoiceQueueReport'][_0xf9c6('0x2f')],function(_0x5e6443){return{'name':_0x5e6443[_0xf9c6('0x30')],'type':_0x5e6443[_0xf9c6('0x31')]['key']};});_0x109cdb[_0xf9c6('0x32')]=_[_0xf9c6('0x33')](_0x43aa1b,_0xf9c6('0x2c'));_0x109cdb[_0xf9c6('0x34')]=_[_0xf9c6('0x35')](_0x500b5e['query']);_0x109cdb[_0xf9c6('0x36')]=_[_0xf9c6('0x37')](_0x109cdb[_0xf9c6('0x32')],_0x109cdb[_0xf9c6('0x34')]);_0x45b528[_0xf9c6('0x38')]=_['intersection'](_0x109cdb[_0xf9c6('0x32')],qs[_0xf9c6('0x39')](_0x500b5e['query'][_0xf9c6('0x39')]));_0x45b528[_0xf9c6('0x38')]=_0x45b528['attributes'][_0xf9c6('0x3a')]?_0x45b528[_0xf9c6('0x38')]:_0x109cdb[_0xf9c6('0x32')];if(!_0x500b5e['query']['hasOwnProperty'](_0xf9c6('0x3b'))){_0x45b528[_0xf9c6('0x21')]=qs[_0xf9c6('0x21')](_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x21')]);_0x45b528[_0xf9c6('0x1f')]=qs[_0xf9c6('0x1f')](_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x1f')]);}_0x45b528[_0xf9c6('0x3c')]=qs[_0xf9c6('0x3d')](_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x3d')]);_0x45b528[_0xf9c6('0x3e')]=qs[_0xf9c6('0x36')](_[_0xf9c6('0x3f')](_0x500b5e[_0xf9c6('0x34')],_0x109cdb[_0xf9c6('0x36')]),_0x43aa1b);if(_0x500b5e['query']['filter']){_0x45b528[_0xf9c6('0x3e')]=_['merge'](_0x45b528[_0xf9c6('0x3e')],{'$or':_[_0xf9c6('0x33')](_0x43aa1b,function(_0x147e89){if(_0x147e89['type']!=='VIRTUAL'){var _0x24aeca={};_0x24aeca[_0x147e89[_0xf9c6('0x2c')]]={'$like':'%'+_0x500b5e[_0xf9c6('0x34')]['filter']+'%'};return _0x24aeca;}})});}_0x45b528=_[_0xf9c6('0x40')]({},_0x45b528,_0x500b5e[_0xf9c6('0x41')]);var _0x3445a4={'where':_0x45b528['where']};return db[_0xf9c6('0x42')][_0xf9c6('0x22')](_0x3445a4)[_0xf9c6('0x29')](function(_0x13a250){_0x566959[_0xf9c6('0x22')]=_0x13a250;if(_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x43')]){_0x45b528[_0xf9c6('0x44')]=[{'all':!![]}];}return db[_0xf9c6('0x42')][_0xf9c6('0x45')](_0x45b528);})[_0xf9c6('0x29')](function(_0x445432){_0x566959['rows']=_0x445432;return _0x566959;})[_0xf9c6('0x29')](respondWithFilteredResult(_0x1c3556,_0x45b528))[_0xf9c6('0x46')](handleError(_0x1c3556,null));};exports['show']=function(_0x514066,_0x2cc178){var _0x26694c={'raw':![],'where':{'id':_0x514066[_0xf9c6('0x47')]['id']}},_0x20cec7={};_0x20cec7[_0xf9c6('0x32')]=_[_0xf9c6('0x35')](db[_0xf9c6('0x42')][_0xf9c6('0x2f')]);_0x20cec7[_0xf9c6('0x34')]=_[_0xf9c6('0x35')](_0x514066[_0xf9c6('0x34')]);_0x20cec7[_0xf9c6('0x36')]=_[_0xf9c6('0x37')](_0x20cec7['model'],_0x20cec7['query']);_0x26694c[_0xf9c6('0x38')]=_[_0xf9c6('0x37')](_0x20cec7[_0xf9c6('0x32')],qs[_0xf9c6('0x39')](_0x514066[_0xf9c6('0x34')][_0xf9c6('0x39')]));_0x26694c[_0xf9c6('0x38')]=_0x26694c['attributes'][_0xf9c6('0x3a')]?_0x26694c[_0xf9c6('0x38')]:_0x20cec7['model'];if(_0x514066[_0xf9c6('0x34')][_0xf9c6('0x43')]){_0x26694c[_0xf9c6('0x44')]=[{'all':!![]}];}_0x26694c=_[_0xf9c6('0x40')]({},_0x26694c,_0x514066[_0xf9c6('0x41')]);return db[_0xf9c6('0x42')][_0xf9c6('0x48')](_0x26694c)[_0xf9c6('0x29')](handleEntityNotFound(_0x2cc178,null))[_0xf9c6('0x29')](respondWithResult(_0x2cc178,null))[_0xf9c6('0x46')](handleError(_0x2cc178,null));};exports[_0xf9c6('0x49')]=function(_0x40ad64,_0x59a58f){return db[_0xf9c6('0x42')][_0xf9c6('0x49')](_0x40ad64[_0xf9c6('0x4a')],{})[_0xf9c6('0x29')](respondWithResult(_0x59a58f,0xc9))[_0xf9c6('0x46')](handleError(_0x59a58f,null));};exports[_0xf9c6('0x28')]=function(_0x2a9651,_0x1f5038){if(_0x2a9651[_0xf9c6('0x4a')]['id']){delete _0x2a9651['body']['id'];}return db['VoiceQueueReport'][_0xf9c6('0x48')]({'where':{'id':_0x2a9651[_0xf9c6('0x47')]['id']}})[_0xf9c6('0x29')](handleEntityNotFound(_0x1f5038,null))[_0xf9c6('0x29')](saveUpdates(_0x2a9651['body'],null))['then'](respondWithResult(_0x1f5038,null))['catch'](handleError(_0x1f5038,null));};exports[_0xf9c6('0x2a')]=function(_0xd40197,_0x276528){return db[_0xf9c6('0x42')]['find']({'where':{'id':_0xd40197[_0xf9c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x276528,null))[_0xf9c6('0x29')](removeEntity(_0x276528,null))[_0xf9c6('0x46')](handleError(_0x276528,null));};exports[_0xf9c6('0x4b')]=function(_0x115866,_0x2aed88){return db[_0xf9c6('0x42')][_0xf9c6('0x4b')]()[_0xf9c6('0x29')](respondWithResult(_0x2aed88,null))[_0xf9c6('0x46')](handleError(_0x2aed88,null));};exports[_0xf9c6('0x4c')]=function(_0x51246e,_0x1c9836){var _0x17a473={},_0x683bba={},_0x377f4b={'count':0x0,'rows':[]};_0x683bba[_0xf9c6('0x32')]=_[_0xf9c6('0x35')](db[_0xf9c6('0x42')][_0xf9c6('0x2f')]);_0x683bba[_0xf9c6('0x34')]=_[_0xf9c6('0x35')](_0x51246e[_0xf9c6('0x34')]);_0x683bba[_0xf9c6('0x36')]=_['intersection'](_0x683bba[_0xf9c6('0x32')],_0x683bba[_0xf9c6('0x34')]);_0x17a473[_0xf9c6('0x38')]=_[_0xf9c6('0x37')](_0x683bba[_0xf9c6('0x32')],qs[_0xf9c6('0x39')](_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x39')]));_0x17a473[_0xf9c6('0x38')]=_0x17a473[_0xf9c6('0x38')][_0xf9c6('0x3a')]?_0x17a473['attributes']:_0x683bba['model'];if(!_0x51246e['query'][_0xf9c6('0x4d')]('nolimit')){_0x17a473[_0xf9c6('0x21')]=qs['limit'](_0x51246e['query']['limit']);_0x17a473[_0xf9c6('0x1f')]=qs[_0xf9c6('0x1f')](_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x1f')]);}_0x17a473['order']=qs['sort'](_0x51246e['query'][_0xf9c6('0x3d')]);_0x17a473[_0xf9c6('0x3e')]=qs['filters'](_['pick'](_0x51246e['query'],_0x683bba[_0xf9c6('0x36')]));if(_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x4e')]){_0x17a473[_0xf9c6('0x3e')]=_['merge'](_0x17a473[_0xf9c6('0x3e')],{'$or':_[_0xf9c6('0x33')](_0x17a473['attributes'],function(_0x3aa64c){var _0xedd4ee={};_0xedd4ee[_0x3aa64c]={'$like':'%'+_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x4e')]+'%'};return _0xedd4ee;})});}_0x17a473=_['merge']({},_0x17a473,_0x51246e['options']);var _0x25b767={'where':_0x17a473['where']};return db[_0xf9c6('0x42')][_0xf9c6('0x22')](_0x25b767)[_0xf9c6('0x29')](function(_0x415daa){_0x377f4b[_0xf9c6('0x22')]=_0x415daa;if(_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x43')]){_0x17a473[_0xf9c6('0x44')]=[{'all':!![]}];}return db[_0xf9c6('0x42')]['findAll'](_0x17a473);})['then'](function(_0x4e1136){_0x377f4b[_0xf9c6('0x4f')]=_0x4e1136;return _0x377f4b;})['then'](respondWithFilteredResult(_0x1c9836,_0x17a473,_0xf9c6('0x4c')))[_0xf9c6('0x46')](handleError(_0x1c9836,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ca5ab03..17b499b 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 _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 +var _0xfe78=['events','VoiceQueueReport','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x2af782,_0x1e8532){var _0x4f2ea6=function(_0x40ed58){while(--_0x40ed58){_0x2af782['push'](_0x2af782['shift']());}};_0x4f2ea6(++_0x1e8532);}(_0xfe78,0x90));var _0x8fe7=function(_0xb604d9,_0x2ca058){_0xb604d9=_0xb604d9-0x0;var _0x2c7828=_0xfe78[_0xb604d9];return _0x2c7828;};'use strict';var EventEmitter=require(_0x8fe7('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x8fe7('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8fe7('0x2')](0x0);var events={'afterCreate':_0x8fe7('0x3'),'afterUpdate':_0x8fe7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bc072){return function(_0x109487,_0x52f633,_0x240539){VoiceQueueReportEvents['emit'](_0x4bc072+':'+_0x109487['id'],_0x109487);VoiceQueueReportEvents['emit'](_0x4bc072,_0x109487);_0x240539(null);};}for(var e in events){if(events[_0x8fe7('0x5')](e)){var event=events[e];VoiceQueueReport[_0x8fe7('0x6')](e,emitEvent(event));}}module[_0x8fe7('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8a05c1f..1969001 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 _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 +var _0x72b3=['bluebird','request-promise','path','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','api','moment'];(function(_0x197174,_0x54f21c){var _0x1978b7=function(_0x4a54c9){while(--_0x4a54c9){_0x197174['push'](_0x197174['shift']());}};_0x1978b7(++_0x54f21c);}(_0x72b3,0x1aa));var _0x372b=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x72b3[_0x2bfe52];return _0x1cf649;};'use strict';var _=require(_0x372b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x372b('0x1'));var moment=require(_0x372b('0x2'));var BPromise=require(_0x372b('0x3'));var rp=require(_0x372b('0x4'));var fs=require('fs');var path=require(_0x372b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x372b('0x6')]=function(_0x50a3c0,_0x49e115){return _0x50a3c0['define'](_0x372b('0x7'),attributes,{'tableName':_0x372b('0x8'),'paranoid':![],'indexes':[{'fields':[_0x372b('0x9')]},{'fields':[_0x372b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c0bddcb..9b8d429 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 _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 +var _0x92ba=['attributes','include','map','model','info','catch','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','body','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92ba,0xaa));var _0xa92b=function(_0x40bf47,_0x56966){_0x40bf47=_0x40bf47-0x0;var _0x311180=_0x92ba[_0x40bf47];return _0x311180;};'use strict';var _=require(_0xa92b('0x0'));var util=require('util');var moment=require(_0xa92b('0x1'));var BPromise=require(_0xa92b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa92b('0x3'))['db'];var utils=require(_0xa92b('0x4'));var logger=require(_0xa92b('0x5'))(_0xa92b('0x6'));var config=require(_0xa92b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa92b('0x8')][_0xa92b('0x9')]({'port':0x232a});config[_0xa92b('0xa')]=_[_0xa92b('0xb')](config['redis'],{'host':_0xa92b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa92b('0xa')]));require(_0xa92b('0xd'))[_0xa92b('0xe')](socket);function respondWithRpcPromise(_0x5681d3,_0x3cd748,_0x469dc2){return new BPromise(function(_0x2ca693,_0x29e7af){return client[_0xa92b('0xf')](_0x5681d3,_0x469dc2)[_0xa92b('0x10')](function(_0x1f0199){logger['info'](_0xa92b('0x11'),_0x3cd748,_0xa92b('0x12'));logger[_0xa92b('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3cd748,'request\x20sent',JSON[_0xa92b('0x14')](_0x1f0199));if(_0x1f0199[_0xa92b('0x15')]){if(_0x1f0199[_0xa92b('0x15')][_0xa92b('0x16')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x3cd748,_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);return _0x29e7af(_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);}logger[_0xa92b('0x15')](_0xa92b('0x11'),_0x3cd748,_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);return _0x2ca693(_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);}else{logger['info'](_0xa92b('0x11'),_0x3cd748,_0xa92b('0x12'));_0x2ca693(_0x1f0199[_0xa92b('0x18')][_0xa92b('0x17')]);}})['catch'](function(_0x18b6c7){logger[_0xa92b('0x15')](_0xa92b('0x11'),_0x3cd748,_0x18b6c7);_0x29e7af(_0x18b6c7);});});}exports[_0xa92b('0x19')]=function(_0x4c96c9){var _0x47dfbb=this;return new Promise(function(_0x559bcd,_0x579c80){return db[_0xa92b('0x1a')]['findAll']({'raw':_0x4c96c9[_0xa92b('0x1b')]?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c96c9['options']?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1d')]||null:null,'attributes':_0x4c96c9[_0xa92b('0x1b')]?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1e')]||null:null,'limit':_0x4c96c9[_0xa92b('0x1b')]?_0x4c96c9[_0xa92b('0x1b')]['limit']||null:null,'include':_0x4c96c9['options']?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1f')]?_[_0xa92b('0x20')](_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1f')],function(_0x239f82){return{'model':db[_0x239f82[_0xa92b('0x21')]],'as':_0x239f82['as'],'attributes':_0x239f82[_0xa92b('0x1e')],'include':_0x239f82[_0xa92b('0x1f')]?_[_0xa92b('0x20')](_0x239f82[_0xa92b('0x1f')],function(_0x85008c){return{'model':db[_0x85008c[_0xa92b('0x21')]],'as':_0x85008c['as'],'attributes':_0x85008c['attributes'],'include':_0x85008c[_0xa92b('0x1f')]?_['map'](_0x85008c[_0xa92b('0x1f')],function(_0x132882){return{'model':db[_0x132882[_0xa92b('0x21')]],'as':_0x132882['as'],'attributes':_0x132882['attributes']};}):[]};}):[]};}):[]:[]})[_0xa92b('0x10')](function(_0x45038a){logger[_0xa92b('0x22')](_0xa92b('0x19'),_0x4c96c9);logger['debug'](_0xa92b('0x19'),_0x4c96c9,JSON[_0xa92b('0x14')](_0x45038a));_0x559bcd(_0x45038a);})[_0xa92b('0x23')](function(_0x312b2d){logger[_0xa92b('0x15')](_0xa92b('0x19'),_0x312b2d['message'],_0x4c96c9);_0x579c80(_0x47dfbb[_0xa92b('0x15')](0x1f4,_0x312b2d[_0xa92b('0x17')]));});});};exports[_0xa92b('0x24')]=function(_0x3a4400){var _0x550ab2=this;return new Promise(function(_0x346931,_0x467a60){return db[_0xa92b('0x1a')][_0xa92b('0x25')](_0x3a4400['body'],{'raw':_0x3a4400[_0xa92b('0x1b')]?_0x3a4400['options'][_0xa92b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3fe4b4){logger[_0xa92b('0x22')](_0xa92b('0x24'),_0x3a4400);logger[_0xa92b('0x13')](_0xa92b('0x24'),_0x3a4400,JSON[_0xa92b('0x14')](_0x3fe4b4));_0x346931(_0x3fe4b4);})['catch'](function(_0x29389a){logger[_0xa92b('0x15')](_0xa92b('0x24'),_0x29389a['message'],_0x3a4400);_0x467a60(_0x550ab2['error'](0x1f4,_0x29389a['message']));});});};exports[_0xa92b('0x26')]=function(_0x4f57a2){var _0x4ccf40=this;return new Promise(function(_0x42a371,_0x3713d5){return db['VoiceQueueReport']['update'](_0x4f57a2[_0xa92b('0x27')],{'raw':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2[_0xa92b('0x1b')][_0xa92b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2[_0xa92b('0x1b')][_0xa92b('0x1d')]||null:null,'attributes':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2['options'][_0xa92b('0x1e')]||null:null,'limit':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2[_0xa92b('0x1b')]['limit']||null:null})[_0xa92b('0x10')](function(_0x3c5452){logger[_0xa92b('0x22')](_0xa92b('0x26'),_0x4f57a2);logger[_0xa92b('0x13')](_0xa92b('0x26'),_0x4f57a2,JSON['stringify'](_0x3c5452));_0x42a371(_0x3c5452);})[_0xa92b('0x23')](function(_0x43b6b1){logger['error'](_0xa92b('0x26'),_0x43b6b1[_0xa92b('0x17')],_0x4f57a2);_0x3713d5(_0x4ccf40['error'](0x1f4,_0x43b6b1[_0xa92b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ed55199..31582ac 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 _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 +var _0x74eb=['./voiceQueueReport.events','save','remove','emit','register'];(function(_0x5f2661,_0x4bb742){var _0x1a99b2=function(_0x366858){while(--_0x366858){_0x5f2661['push'](_0x5f2661['shift']());}};_0x1a99b2(++_0x4bb742);}(_0x74eb,0x13b));var _0xb74e=function(_0x2644fd,_0x4d79b2){_0x2644fd=_0x2644fd-0x0;var _0x41e462=_0x74eb[_0x2644fd];return _0x41e462;};'use strict';var VoiceQueueReportEvents=require(_0xb74e('0x0'));var events=[_0xb74e('0x1'),_0xb74e('0x2'),'update'];function createListener(_0x16f1d5,_0x228930){return function(_0x466de6){_0x228930[_0xb74e('0x3')](_0x16f1d5,_0x466de6);};}function removeListener(_0x11701d,_0x459811){return function(){VoiceQueueReportEvents['removeListener'](_0x11701d,_0x459811);};}exports[_0xb74e('0x4')]=function(_0x4f49f9){for(var _0x329dc1=0x0,_0x4307f8=events['length'];_0x329dc1<_0x4307f8;_0x329dc1++){var _0x2d0773=events[_0x329dc1];var _0x56483b=createListener('voiceQueueReport:'+_0x2d0773,_0x4f49f9);VoiceQueueReportEvents['on'](_0x2d0773,_0x56483b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d3e15e6..ab6e73b 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 _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 +var _0xec90=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x36b0c6,_0x582dac){var _0x1f51f5=function(_0x126cf8){while(--_0x126cf8){_0x36b0c6['push'](_0x36b0c6['shift']());}};_0x1f51f5(++_0x582dac);}(_0xec90,0x1a3));var _0x0ec9=function(_0x3a93b5,_0x2145bc){_0x3a93b5=_0x3a93b5-0x0;var _0x10cded=_0xec90[_0x3a93b5];return _0x10cded;};'use strict';var multer=require(_0x0ec9('0x0'));var util=require(_0x0ec9('0x1'));var path=require(_0x0ec9('0x2'));var timeout=require(_0x0ec9('0x3'));var express=require(_0x0ec9('0x4'));var router=express[_0x0ec9('0x5')]();var fs_extra=require(_0x0ec9('0x6'));var auth=require(_0x0ec9('0x7'));var interaction=require(_0x0ec9('0x8'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x0ec9('0x9')]('/',auth[_0x0ec9('0xa')](),controller['index']);router[_0x0ec9('0x9')](_0x0ec9('0xb'),auth[_0x0ec9('0xa')](),controller[_0x0ec9('0xc')]);router[_0x0ec9('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ec9('0xe')]);router[_0x0ec9('0xf')](_0x0ec9('0xb'),auth[_0x0ec9('0xa')](),controller[_0x0ec9('0x10')]);router[_0x0ec9('0x11')](_0x0ec9('0xb'),auth[_0x0ec9('0xa')](),controller[_0x0ec9('0x12')]);module[_0x0ec9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a8843ac..8bf3647 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 _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 +var _0x719c=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x2c6e82,_0x158dee){var _0x37df51=function(_0x19af99){while(--_0x19af99){_0x2c6e82['push'](_0x2c6e82['shift']());}};_0x37df51(++_0x158dee);}(_0x719c,0x1c4));var _0xc719=function(_0x153a02,_0x8f3af9){_0x153a02=_0x153a02-0x0;var _0x1f9522=_0x719c[_0x153a02];return _0x1f9522;};'use strict';var Sequelize=require(_0xc719('0x0'));var moment=require(_0xc719('0x1'));module[_0xc719('0x2')]={'time':{'type':Sequelize[_0xc719('0x3')]},'callid':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc719('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xc719('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 932fc24..c3ccb02 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 _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 +var _0xc34d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','VoiceQueuesLog','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc34d,0x108));var _0xdc34=function(_0x29ee5c,_0x176a4d){_0x29ee5c=_0x29ee5c-0x0;var _0x36c927=_0xc34d[_0x29ee5c];return _0x36c927;};'use strict';var emlformat=require(_0xdc34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc34('0x1'));var jsonpatch=require(_0xdc34('0x2'));var rp=require(_0xdc34('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdc34('0x4'));var util=require(_0xdc34('0x5'));var path=require(_0xdc34('0x6'));var sox=require(_0xdc34('0x7'));var csv=require(_0xdc34('0x8'));var ejs=require(_0xdc34('0x9'));var fs=require('fs');var fs_extra=require(_0xdc34('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdc34('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdc34('0xc'));var Papa=require(_0xdc34('0xd'));var Redis=require(_0xdc34('0xe'));var authService=require(_0xdc34('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdc34('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc34('0x11'))(_0xdc34('0x12'));var utils=require(_0xdc34('0x13'));var config=require(_0xdc34('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc34('0x15'))['db'];function respondWithStatusCode(_0x5bb745,_0x276c29){_0x276c29=_0x276c29||0xcc;return function(_0xa72c){if(_0xa72c){return _0x5bb745[_0xdc34('0x16')](_0x276c29);}return _0x5bb745[_0xdc34('0x17')](_0x276c29)[_0xdc34('0x18')]();};}function respondWithResult(_0x432bf5,_0x6720af){_0x6720af=_0x6720af||0xc8;return function(_0x58db1c){if(_0x58db1c){return _0x432bf5[_0xdc34('0x17')](_0x6720af)[_0xdc34('0x19')](_0x58db1c);}};}function respondWithFilteredResult(_0x4a9843,_0x229c9c){return function(_0x37de30){if(_0x37de30){var _0x579beb=typeof _0x229c9c[_0xdc34('0x1a')]===_0xdc34('0x1b')&&typeof _0x229c9c[_0xdc34('0x1c')]==='undefined';var _0x248b04=_0x37de30[_0xdc34('0x1d')];var _0x12b4bd=_0x579beb?0x0:_0x229c9c[_0xdc34('0x1a')];var _0x1fc144=_0x579beb?_0x37de30[_0xdc34('0x1d')]:_0x229c9c[_0xdc34('0x1a')]+_0x229c9c[_0xdc34('0x1c')];var _0x4d3b35;if(_0x1fc144>=_0x248b04){_0x1fc144=_0x248b04;_0x4d3b35=0xc8;}else{_0x4d3b35=0xce;}_0x4a9843[_0xdc34('0x17')](_0x4d3b35);return _0x4a9843['set'](_0xdc34('0x1e'),_0x12b4bd+'-'+_0x1fc144+'/'+_0x248b04)[_0xdc34('0x19')](_0x37de30);}return null;};}function patchUpdates(_0xe66232){return function(_0x262a01){try{jsonpatch['apply'](_0x262a01,_0xe66232,!![]);}catch(_0xe10aff){return BPromise['reject'](_0xe10aff);}return _0x262a01['save']();};}function saveUpdates(_0x50c250,_0x3fe8d4){return function(_0x4fb2ce){if(_0x4fb2ce){return _0x4fb2ce[_0xdc34('0x1f')](_0x50c250)[_0xdc34('0x20')](function(_0x47e8ba){return _0x47e8ba;});}return null;};}function removeEntity(_0x343466,_0x5871c6){return function(_0x2bbc14){if(_0x2bbc14){return _0x2bbc14[_0xdc34('0x21')]()[_0xdc34('0x20')](function(){_0x343466[_0xdc34('0x17')](0xcc)[_0xdc34('0x18')]();});}};}function handleEntityNotFound(_0x5e6256,_0x90ae59){return function(_0xf24266){if(!_0xf24266){_0x5e6256[_0xdc34('0x16')](0x194);}return _0xf24266;};}function handleError(_0x3daadc,_0x123e68){_0x123e68=_0x123e68||0x1f4;return function(_0x44afa8){logger[_0xdc34('0x22')](_0x44afa8[_0xdc34('0x23')]);if(_0x44afa8[_0xdc34('0x24')]){delete _0x44afa8[_0xdc34('0x24')];}_0x3daadc['status'](_0x123e68)[_0xdc34('0x25')](_0x44afa8);};}exports[_0xdc34('0x26')]=function(_0x57a2e8,_0x3ef55e){var _0x3bbaef={},_0x145920={},_0x62d718={'count':0x0,'rows':[]};var _0x3885e7=_[_0xdc34('0x27')](db['VoiceQueuesLog'][_0xdc34('0x28')],function(_0x1a99e2){return{'name':_0x1a99e2['fieldName'],'type':_0x1a99e2[_0xdc34('0x29')][_0xdc34('0x2a')]};});_0x145920['model']=_[_0xdc34('0x27')](_0x3885e7,'name');_0x145920[_0xdc34('0x2b')]=_['keys'](_0x57a2e8[_0xdc34('0x2b')]);_0x145920['filters']=_['intersection'](_0x145920[_0xdc34('0x2c')],_0x145920[_0xdc34('0x2b')]);_0x3bbaef[_0xdc34('0x2d')]=_[_0xdc34('0x2e')](_0x145920[_0xdc34('0x2c')],qs[_0xdc34('0x2f')](_0x57a2e8['query'][_0xdc34('0x2f')]));_0x3bbaef[_0xdc34('0x2d')]=_0x3bbaef[_0xdc34('0x2d')]['length']?_0x3bbaef['attributes']:_0x145920['model'];if(!_0x57a2e8['query'][_0xdc34('0x30')](_0xdc34('0x31'))){_0x3bbaef[_0xdc34('0x1c')]=qs[_0xdc34('0x1c')](_0x57a2e8[_0xdc34('0x2b')]['limit']);_0x3bbaef[_0xdc34('0x1a')]=qs[_0xdc34('0x1a')](_0x57a2e8[_0xdc34('0x2b')][_0xdc34('0x1a')]);}_0x3bbaef[_0xdc34('0x32')]=qs['sort'](_0x57a2e8[_0xdc34('0x2b')][_0xdc34('0x33')]);_0x3bbaef[_0xdc34('0x34')]=qs['filters'](_[_0xdc34('0x35')](_0x57a2e8[_0xdc34('0x2b')],_0x145920[_0xdc34('0x36')]),_0x3885e7);if(_0x57a2e8[_0xdc34('0x2b')][_0xdc34('0x37')]){_0x3bbaef['where']=_['merge'](_0x3bbaef[_0xdc34('0x34')],{'$or':_['map'](_0x3885e7,function(_0x471468){if(_0x471468['type']!==_0xdc34('0x38')){var _0x3511c8={};_0x3511c8[_0x471468['name']]={'$like':'%'+_0x57a2e8['query'][_0xdc34('0x37')]+'%'};return _0x3511c8;}})});}_0x3bbaef=_[_0xdc34('0x39')]({},_0x3bbaef,_0x57a2e8[_0xdc34('0x3a')]);var _0x4b4c7b={'where':_0x3bbaef[_0xdc34('0x34')]};return db[_0xdc34('0x3b')][_0xdc34('0x1d')](_0x4b4c7b)[_0xdc34('0x20')](function(_0x20c30d){_0x62d718[_0xdc34('0x1d')]=_0x20c30d;if(_0x57a2e8['query']['includeAll']){_0x3bbaef['include']=[{'all':!![]}];}return db[_0xdc34('0x3b')][_0xdc34('0x3c')](_0x3bbaef);})[_0xdc34('0x20')](function(_0x4e6507){_0x62d718[_0xdc34('0x3d')]=_0x4e6507;return _0x62d718;})['then'](respondWithFilteredResult(_0x3ef55e,_0x3bbaef))[_0xdc34('0x3e')](handleError(_0x3ef55e,null));};exports[_0xdc34('0x3f')]=function(_0x46805c,_0x48dac4){var _0x12c61f={'raw':!![],'where':{'id':_0x46805c[_0xdc34('0x40')]['id']}},_0x28db5c={};_0x28db5c[_0xdc34('0x2c')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x28db5c[_0xdc34('0x2b')]=_[_0xdc34('0x41')](_0x46805c[_0xdc34('0x2b')]);_0x28db5c[_0xdc34('0x36')]=_[_0xdc34('0x2e')](_0x28db5c[_0xdc34('0x2c')],_0x28db5c[_0xdc34('0x2b')]);_0x12c61f[_0xdc34('0x2d')]=_['intersection'](_0x28db5c[_0xdc34('0x2c')],qs[_0xdc34('0x2f')](_0x46805c['query'][_0xdc34('0x2f')]));_0x12c61f[_0xdc34('0x2d')]=_0x12c61f[_0xdc34('0x2d')][_0xdc34('0x42')]?_0x12c61f['attributes']:_0x28db5c[_0xdc34('0x2c')];if(_0x46805c[_0xdc34('0x2b')]['includeAll']){_0x12c61f['include']=[{'all':!![]}];}_0x12c61f=_['merge']({},_0x12c61f,_0x46805c[_0xdc34('0x3a')]);return db[_0xdc34('0x3b')][_0xdc34('0x43')](_0x12c61f)[_0xdc34('0x20')](handleEntityNotFound(_0x48dac4,null))['then'](respondWithResult(_0x48dac4,null))[_0xdc34('0x3e')](handleError(_0x48dac4,null));};exports[_0xdc34('0x44')]=function(_0x36ed2a,_0x11d502){return db[_0xdc34('0x3b')][_0xdc34('0x44')](_0x36ed2a[_0xdc34('0x45')],{})[_0xdc34('0x20')](respondWithResult(_0x11d502,0xc9))[_0xdc34('0x3e')](handleError(_0x11d502,null));};exports[_0xdc34('0x1f')]=function(_0x438ca1,_0x3ce726){if(_0x438ca1[_0xdc34('0x45')]['id']){delete _0x438ca1[_0xdc34('0x45')]['id'];}return db[_0xdc34('0x3b')]['find']({'where':{'id':_0x438ca1['params']['id']}})[_0xdc34('0x20')](handleEntityNotFound(_0x3ce726,null))['then'](saveUpdates(_0x438ca1[_0xdc34('0x45')],null))[_0xdc34('0x20')](respondWithResult(_0x3ce726,null))[_0xdc34('0x3e')](handleError(_0x3ce726,null));};exports[_0xdc34('0x21')]=function(_0x19aaaa,_0x2216e5){return db[_0xdc34('0x3b')][_0xdc34('0x43')]({'where':{'id':_0x19aaaa[_0xdc34('0x40')]['id']}})['then'](handleEntityNotFound(_0x2216e5,null))[_0xdc34('0x20')](removeEntity(_0x2216e5,null))[_0xdc34('0x3e')](handleError(_0x2216e5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cadac19..d9ea3fa 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 _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 +var _0x6812=['dtm','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6812,0x121));var _0x2681=function(_0x2964e6,_0x2717b6){_0x2964e6=_0x2964e6-0x0;var _0x1c56b6=_0x6812[_0x2964e6];return _0x1c56b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2681('0x0'));var moment=require('moment');var BPromise=require(_0x2681('0x1'));var rp=require(_0x2681('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2681('0x3'));var config=require(_0x2681('0x4'));var attributes=require(_0x2681('0x5'));module['exports']=function(_0x482c52,_0x507a2c){return _0x482c52[_0x2681('0x6')](_0x2681('0x7'),attributes,{'tableName':_0x2681('0x8'),'paranoid':![],'indexes':[{'name':_0x2681('0x9'),'fields':[_0x2681('0xa'),_0x2681('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0a750b0..68e1f1e 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 _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 +var _0x587e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x587e,0xa3));var _0xe587=function(_0x35035f,_0x3fdcd2){_0x35035f=_0x35035f-0x0;var _0x2d9248=_0x587e[_0x35035f];return _0x2d9248;};'use strict';var _=require(_0xe587('0x0'));var util=require(_0xe587('0x1'));var moment=require(_0xe587('0x2'));var BPromise=require(_0xe587('0x3'));var rs=require(_0xe587('0x4'));var fs=require('fs');var Redis=require(_0xe587('0x5'));var db=require(_0xe587('0x6'))['db'];var utils=require(_0xe587('0x7'));var logger=require('../../config/logger')(_0xe587('0x8'));var config=require(_0xe587('0x9'));var jayson=require(_0xe587('0xa'));var client=jayson[_0xe587('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc299d,_0x12f259,_0x17cfdc){return new BPromise(function(_0x59f7fb,_0x508a0c){return client['request'](_0xbc299d,_0x17cfdc)[_0xe587('0xc')](function(_0x4daed1){logger[_0xe587('0xd')](_0xe587('0xe'),_0x12f259,_0xe587('0xf'));logger[_0xe587('0x10')](_0xe587('0x11'),_0x12f259,_0xe587('0xf'),JSON['stringify'](_0x4daed1));if(_0x4daed1['error']){if(_0x4daed1[_0xe587('0x12')][_0xe587('0x13')]===0x1f4){logger[_0xe587('0x12')](_0xe587('0xe'),_0x12f259,_0x4daed1[_0xe587('0x12')]['message']);return _0x508a0c(_0x4daed1[_0xe587('0x12')][_0xe587('0x14')]);}logger[_0xe587('0x12')](_0xe587('0xe'),_0x12f259,_0x4daed1[_0xe587('0x12')][_0xe587('0x14')]);return _0x59f7fb(_0x4daed1[_0xe587('0x12')][_0xe587('0x14')]);}else{logger[_0xe587('0xd')](_0xe587('0xe'),_0x12f259,_0xe587('0xf'));_0x59f7fb(_0x4daed1[_0xe587('0x15')][_0xe587('0x14')]);}})[_0xe587('0x16')](function(_0x14d8a1){logger[_0xe587('0x12')](_0xe587('0xe'),_0x12f259,_0x14d8a1);_0x508a0c(_0x14d8a1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a7bbcc9..c61cc48 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 _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 +var _0x4c1f=['download','downloads','/:id/transcribe','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/download'];(function(_0x2fce18,_0x42cde1){var _0x363744=function(_0x275f4c){while(--_0x275f4c){_0x2fce18['push'](_0x2fce18['shift']());}};_0x363744(++_0x42cde1);}(_0x4c1f,0xc0));var _0xf4c1=function(_0x57d88f,_0x5f5922){_0x57d88f=_0x57d88f-0x0;var _0x22bf96=_0x4c1f[_0x57d88f];return _0x22bf96;};'use strict';var multer=require(_0xf4c1('0x0'));var util=require(_0xf4c1('0x1'));var path=require(_0xf4c1('0x2'));var timeout=require(_0xf4c1('0x3'));var express=require(_0xf4c1('0x4'));var router=express['Router']();var fs_extra=require(_0xf4c1('0x5'));var auth=require(_0xf4c1('0x6'));var interaction=require(_0xf4c1('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xf4c1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf4c1('0x9'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0xb')]);router['get'](_0xf4c1('0xc'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0xd')]);router[_0xf4c1('0x8')](_0xf4c1('0xe'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0xf')]);router[_0xf4c1('0x8')]('/:id/downloads',controller[_0xf4c1('0x10')]);router['get'](_0xf4c1('0x11'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xf4c1('0x12')]('/',auth[_0xf4c1('0xa')](),controller[_0xf4c1('0x13')]);router['post'](_0xf4c1('0x11'),auth[_0xf4c1('0xa')](),controller['runTranscribe']);router[_0xf4c1('0x14')](_0xf4c1('0xc'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0x15')]);router['delete'](_0xf4c1('0xc'),auth[_0xf4c1('0xa')](),controller['destroy']);module[_0xf4c1('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 87e903f..84a2a67 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(_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 +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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 d907147..e8feb6a 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 _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 +var _0x6b0d=['path','to-csv','ejs','fs-extra','lodash','squel','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','VoiceRecording','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','show','keys','length','create','body','catch','find','params','describe','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','filename','unlink','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xb68002,_0x305f05){var _0x34ef54=function(_0x56f747){while(--_0x56f747){_0xb68002['push'](_0xb68002['shift']());}};_0x34ef54(++_0x305f05);}(_0x6b0d,0x1aa));var _0xd6b0=function(_0x1b089e,_0x2c21a3){_0x1b089e=_0x1b089e-0x0;var _0xd5329b=_0x6b0d[_0x1b089e];return _0xd5329b;};'use strict';var emlformat=require(_0xd6b0('0x0'));var rimraf=require(_0xd6b0('0x1'));var zipdir=require(_0xd6b0('0x2'));var jsonpatch=require(_0xd6b0('0x3'));var rp=require(_0xd6b0('0x4'));var moment=require(_0xd6b0('0x5'));var BPromise=require(_0xd6b0('0x6'));var Mustache=require(_0xd6b0('0x7'));var util=require(_0xd6b0('0x8'));var path=require(_0xd6b0('0x9'));var sox=require('sox');var csv=require(_0xd6b0('0xa'));var ejs=require(_0xd6b0('0xb'));var fs=require('fs');var fs_extra=require(_0xd6b0('0xc'));var _=require(_0xd6b0('0xd'));var squel=require(_0xd6b0('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd6b0('0xa'));var querystring=require(_0xd6b0('0xf'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xd6b0('0x10'));var Redis=require(_0xd6b0('0x11'));var authService=require(_0xd6b0('0x12'));var qs=require(_0xd6b0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6b0('0x14'))('api');var utils=require(_0xd6b0('0x15'));var config=require(_0xd6b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6b0('0x17'))['db'];function respondWithStatusCode(_0x56abaf,_0x13cea9){_0x13cea9=_0x13cea9||0xcc;return function(_0x14d783){if(_0x14d783){return _0x56abaf[_0xd6b0('0x18')](_0x13cea9);}return _0x56abaf[_0xd6b0('0x19')](_0x13cea9)['end']();};}function respondWithResult(_0x3f9912,_0x4bac71){_0x4bac71=_0x4bac71||0xc8;return function(_0x553a6a){if(_0x553a6a){return _0x3f9912['status'](_0x4bac71)[_0xd6b0('0x1a')](_0x553a6a);}};}function respondWithFilteredResult(_0x2ccfb6,_0x174885){return function(_0x14efcd){if(_0x14efcd){var _0x5e10ef=typeof _0x174885[_0xd6b0('0x1b')]===_0xd6b0('0x1c')&&typeof _0x174885['limit']==='undefined';var _0x1c3d5a=_0x14efcd[_0xd6b0('0x1d')];var _0x35c51e=_0x5e10ef?0x0:_0x174885[_0xd6b0('0x1b')];var _0x10a725=_0x5e10ef?_0x14efcd[_0xd6b0('0x1d')]:_0x174885[_0xd6b0('0x1b')]+_0x174885[_0xd6b0('0x1e')];var _0x396c7f;if(_0x10a725>=_0x1c3d5a){_0x10a725=_0x1c3d5a;_0x396c7f=0xc8;}else{_0x396c7f=0xce;}_0x2ccfb6[_0xd6b0('0x19')](_0x396c7f);return _0x2ccfb6['set'](_0xd6b0('0x1f'),_0x35c51e+'-'+_0x10a725+'/'+_0x1c3d5a)['json'](_0x14efcd);}return null;};}function patchUpdates(_0x593322){return function(_0x5801eb){try{jsonpatch[_0xd6b0('0x20')](_0x5801eb,_0x593322,!![]);}catch(_0x4e5215){return BPromise[_0xd6b0('0x21')](_0x4e5215);}return _0x5801eb['save']();};}function saveUpdates(_0x96e85c,_0x23ff01){return function(_0x4a54ee){if(_0x4a54ee){return _0x4a54ee[_0xd6b0('0x22')](_0x96e85c)[_0xd6b0('0x23')](function(_0x1245fe){return _0x1245fe;});}return null;};}function removeEntity(_0xfee94b,_0x10ae3c){return function(_0x3242be){if(_0x3242be){return _0x3242be[_0xd6b0('0x24')]()[_0xd6b0('0x23')](function(){_0xfee94b[_0xd6b0('0x19')](0xcc)[_0xd6b0('0x25')]();});}};}function handleEntityNotFound(_0x5241e4,_0x3ca6d0){return function(_0x2dc820){if(!_0x2dc820){_0x5241e4['sendStatus'](0x194);}return _0x2dc820;};}function handleError(_0x5da699,_0x563e5e){_0x563e5e=_0x563e5e||0x1f4;return function(_0x52433e){logger[_0xd6b0('0x26')](_0x52433e['stack']);if(_0x52433e[_0xd6b0('0x27')]){delete _0x52433e[_0xd6b0('0x27')];}_0x5da699[_0xd6b0('0x19')](_0x563e5e)[_0xd6b0('0x28')](_0x52433e);};}exports[_0xd6b0('0x29')]=function(_0x9c9b9b,_0x566214){var _0x140665={},_0x32592d={},_0xd8dbe8={'count':0x0,'rows':[]};var _0x503bf3=_[_0xd6b0('0x2a')](db[_0xd6b0('0x2b')][_0xd6b0('0x2c')],function(_0x1c1c7f){return{'name':_0x1c1c7f['fieldName'],'type':_0x1c1c7f[_0xd6b0('0x2d')]['key']};});_0x32592d['model']=_['differenceBy'](_[_0xd6b0('0x2a')](_0x503bf3,_0xd6b0('0x27')),['format']);_0x32592d[_0xd6b0('0x2e')]=_['keys'](_0x9c9b9b['query']);_0x32592d[_0xd6b0('0x2f')]=_[_0xd6b0('0x30')](_0x32592d[_0xd6b0('0x31')],_0x32592d[_0xd6b0('0x2e')]);_0x140665[_0xd6b0('0x32')]=_[_0xd6b0('0x30')](_0x32592d['model'],qs[_0xd6b0('0x33')](_0x9c9b9b['query'][_0xd6b0('0x33')]));_0x140665[_0xd6b0('0x32')]=_0x140665['attributes']['length']?_0x140665[_0xd6b0('0x32')]:_0x32592d[_0xd6b0('0x31')];if(!_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x34')](_0xd6b0('0x35'))){_0x140665[_0xd6b0('0x1e')]=qs[_0xd6b0('0x1e')](_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x1e')]);_0x140665[_0xd6b0('0x1b')]=qs['offset'](_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x1b')]);}_0x140665[_0xd6b0('0x36')]=qs[_0xd6b0('0x37')](_0x9c9b9b[_0xd6b0('0x2e')]['sort']);_0x140665['where']=qs[_0xd6b0('0x2f')](_[_0xd6b0('0x38')](_0x9c9b9b[_0xd6b0('0x2e')],_0x32592d['filters']),_0x503bf3);if(_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x39')]){_0x140665['where']=_[_0xd6b0('0x3a')](_0x140665[_0xd6b0('0x3b')],{'$or':_['map'](_0x503bf3,function(_0xb495d8){if(_0xb495d8['type']!==_0xd6b0('0x3c')){var _0x328925={};_0x328925[_0xb495d8['name']]={'$like':'%'+_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x39')]+'%'};return _0x328925;}})});}_0x140665=_[_0xd6b0('0x3a')]({},_0x140665,_0x9c9b9b[_0xd6b0('0x3d')]);var _0x193e22={'where':_0x140665[_0xd6b0('0x3b')]};return db[_0xd6b0('0x2b')]['count'](_0x193e22)[_0xd6b0('0x23')](function(_0x3c92df){_0xd8dbe8['count']=_0x3c92df;if(_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x3e')]){_0x140665[_0xd6b0('0x3f')]=[{'all':!![]}];}return db[_0xd6b0('0x2b')]['findAll'](_0x140665);})[_0xd6b0('0x23')](function(_0x534720){_0xd8dbe8['rows']=_0x534720;return _0xd8dbe8;})['then'](respondWithFilteredResult(_0x566214,_0x140665))['catch'](handleError(_0x566214,null));};exports[_0xd6b0('0x40')]=function(_0x3ccc18,_0x4bc725){var _0x4385a7={'raw':![],'where':{'id':_0x3ccc18['params']['id']}},_0x1a4ff6={};_0x1a4ff6['model']=_[_0xd6b0('0x41')](db[_0xd6b0('0x2b')][_0xd6b0('0x2c')]);_0x1a4ff6[_0xd6b0('0x2e')]=_[_0xd6b0('0x41')](_0x3ccc18[_0xd6b0('0x2e')]);_0x1a4ff6[_0xd6b0('0x2f')]=_['intersection'](_0x1a4ff6[_0xd6b0('0x31')],_0x1a4ff6['query']);_0x4385a7[_0xd6b0('0x32')]=_['intersection'](_0x1a4ff6['model'],qs[_0xd6b0('0x33')](_0x3ccc18[_0xd6b0('0x2e')][_0xd6b0('0x33')]));_0x4385a7['attributes']=_0x4385a7[_0xd6b0('0x32')][_0xd6b0('0x42')]?_0x4385a7[_0xd6b0('0x32')]:_0x1a4ff6[_0xd6b0('0x31')];if(_0x3ccc18[_0xd6b0('0x2e')][_0xd6b0('0x3e')]){_0x4385a7['include']=[{'all':!![]}];}_0x4385a7=_['merge']({},_0x4385a7,_0x3ccc18['options']);return db['VoiceRecording']['find'](_0x4385a7)[_0xd6b0('0x23')](handleEntityNotFound(_0x4bc725,null))[_0xd6b0('0x23')](respondWithResult(_0x4bc725,null))['catch'](handleError(_0x4bc725,null));};exports[_0xd6b0('0x43')]=function(_0x2911c3,_0x218169){return db['VoiceRecording'][_0xd6b0('0x43')](_0x2911c3[_0xd6b0('0x44')],{})['then'](respondWithResult(_0x218169,0xc9))[_0xd6b0('0x45')](handleError(_0x218169,null));};exports[_0xd6b0('0x22')]=function(_0x484908,_0x4fbca1){if(_0x484908[_0xd6b0('0x44')]['id']){delete _0x484908[_0xd6b0('0x44')]['id'];}return db[_0xd6b0('0x2b')][_0xd6b0('0x46')]({'where':{'id':_0x484908[_0xd6b0('0x47')]['id']}})[_0xd6b0('0x23')](handleEntityNotFound(_0x4fbca1,null))['then'](saveUpdates(_0x484908[_0xd6b0('0x44')],null))[_0xd6b0('0x23')](respondWithResult(_0x4fbca1,null))[_0xd6b0('0x45')](handleError(_0x4fbca1,null));};exports[_0xd6b0('0x48')]=function(_0xd3a3,_0x2e457f){return db['VoiceRecording'][_0xd6b0('0x48')]()['then'](respondWithResult(_0x2e457f,null))[_0xd6b0('0x45')](handleError(_0x2e457f,null));};exports['download']=function(_0x512163,_0x4baef0,_0x9811ed){var _0x46e550=require(_0xd6b0('0x49'));var _0x1ccdf5=![];var _0x4eeb1e={};if(_0x512163['query'][_0xd6b0('0x2d')]&&_0x512163[_0xd6b0('0x2e')][_0xd6b0('0x2d')]==='uniqueid'){_0x4eeb1e[_0xd6b0('0x4a')]=_0x512163[_0xd6b0('0x47')]['id'];}else{_0x4eeb1e['id']=_0x512163[_0xd6b0('0x47')]['id'];}return db[_0xd6b0('0x2b')][_0xd6b0('0x46')]({'where':_0x4eeb1e,'attributes':['id',_0xd6b0('0x4b')],'raw':!![]})[_0xd6b0('0x23')](handleEntityNotFound(_0x4baef0,null))[_0xd6b0('0x23')](function(_0x4eb641){if(_0x4eb641){var _0x5e39da=_0x4eb641['value'];var _0x2aa640=util[_0xd6b0('0x4c')]('%s.cypher',_0x5e39da);if(fs[_0xd6b0('0x4d')](_0x2aa640)){_0x1ccdf5=!![];return _0x46e550[_0xd6b0('0x4e')](_0x2aa640,_0x5e39da,config[_0xd6b0('0x4f')][_0xd6b0('0x50')])[_0xd6b0('0x23')](function(){return _0x4eb641;});}return _0x4eb641;}})[_0xd6b0('0x23')](function(_0x34fe90){if(_0x34fe90){var _0x4d047b=_0x34fe90['value'];if(!fs[_0xd6b0('0x4d')](_0x4d047b)){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x34fe90['filename']){return _0x4baef0[_0xd6b0('0x53')](_0x4d047b,_0x34fe90[_0xd6b0('0x54')]+path['extname'](_0x4d047b),function(){if(_0x1ccdf5){fs[_0xd6b0('0x55')](_0x4d047b);}});}else{return _0x4baef0[_0xd6b0('0x53')](_0x4d047b,function(_0x3f957f){if(_0x1ccdf5){fs[_0xd6b0('0x55')](_0x4d047b);}});}}})[_0xd6b0('0x45')](function(_0x3e0495){if(_0x3e0495['message']===_0xd6b0('0x56')){_0x4baef0['status'](0x194)[_0xd6b0('0x28')]('Not\x20found');}else{return handleError(_0x4baef0,null);}});};exports[_0xd6b0('0x57')]=function(_0x31b0a3,_0x54733b,_0xb9344){var _0x43c372=require(_0xd6b0('0x49'));var _0x1d97b2=![];var _0x12aa55={'$and':[db[_0xd6b0('0x58')][_0xd6b0('0x3b')](db[_0xd6b0('0x58')]['fn'](_0xd6b0('0x59'),db['sequelize']['col'](_0xd6b0('0x4a'))),_0x31b0a3[_0xd6b0('0x2e')][_0xd6b0('0x5a')])]};if(_0x31b0a3[_0xd6b0('0x2e')][_0xd6b0('0x2d')]&&_0x31b0a3['query'][_0xd6b0('0x2d')]==='uniqueid'){_0x12aa55[_0xd6b0('0x5b')]['push']({'uniqueid':_0x31b0a3[_0xd6b0('0x47')]['id']});}else{_0x12aa55[_0xd6b0('0x5b')][_0xd6b0('0x5c')]({'id':_0x31b0a3['params']['id']});}return db[_0xd6b0('0x2b')][_0xd6b0('0x46')]({'where':_0x12aa55,'attributes':['id',_0xd6b0('0x4b')],'raw':!![]})[_0xd6b0('0x23')](handleEntityNotFound(_0x54733b,null))[_0xd6b0('0x23')](function(_0x36f68b){if(_0x36f68b){var _0x4a97e1=util['format'](_0xd6b0('0x5d'),_0x36f68b[_0xd6b0('0x4b')]);if(fs['existsSync'](_0x4a97e1)){_0x1d97b2=!![];return _0x43c372[_0xd6b0('0x4e')](_0x4a97e1,_0x36f68b[_0xd6b0('0x4b')],config[_0xd6b0('0x4f')]['recording'])[_0xd6b0('0x23')](function(){return _0x36f68b;});}return _0x36f68b;}})[_0xd6b0('0x23')](function(_0x50ddc2){if(_0x50ddc2){if(!fs['existsSync'](_0x50ddc2['value'])){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))](_0xd6b0('0x56'));}if(_0x50ddc2[_0xd6b0('0x54')]){return _0x54733b[_0xd6b0('0x53')](_0x50ddc2[_0xd6b0('0x4b')],_0x50ddc2[_0xd6b0('0x54')]+path['extname'](_0x50ddc2[_0xd6b0('0x4b')]),function(){if(_0x1d97b2){fs[_0xd6b0('0x55')](_0x50ddc2[_0xd6b0('0x4b')]);}});}else{return _0x54733b[_0xd6b0('0x53')](_0x50ddc2[_0xd6b0('0x4b')],function(_0xb5f601){if(_0x1d97b2){fs['unlink'](_0x50ddc2[_0xd6b0('0x4b')]);}});}}})[_0xd6b0('0x45')](handleError(_0x54733b,null));};exports[_0xd6b0('0x24')]=function(_0x499a74,_0x2e93cc){return db['VoiceRecording']['find']({'where':{'id':_0x499a74['params']['id']}})[_0xd6b0('0x23')](function(_0x5480a9){if(_[_0xd6b0('0x5e')](_0x5480a9)){throw new ReferenceError(_0xd6b0('0x5f'));}return _0x5480a9;})[_0xd6b0('0x23')](function(_0x382324){var _0x33a340=_0x382324[_0xd6b0('0x4b')];logger['info'](_0xd6b0('0x60'),_0x33a340);if(!_[_0xd6b0('0x5e')](_0x382324[_0xd6b0('0x4b')])&&fs[_0xd6b0('0x4d')](_0x33a340)){logger[_0xd6b0('0x61')](_0xd6b0('0x62')+_0x33a340+_0xd6b0('0x63'));fs['unlinkSync'](_0x33a340);}_0x33a340=_0x33a340+'.cypher';if(!_[_0xd6b0('0x5e')](_0x382324[_0xd6b0('0x4b')])&&fs['existsSync'](_0x33a340)){logger['info'](_0xd6b0('0x62')+_0x33a340+_0xd6b0('0x63'));fs[_0xd6b0('0x64')](_0x33a340);}return _0x382324;})[_0xd6b0('0x23')](function(_0x107cf2){if(!_0x107cf2)throw new InternalError();return _0x107cf2[_0xd6b0('0x24')]();})[_0xd6b0('0x23')](function(){_0x2e93cc[_0xd6b0('0x19')](0xcc)[_0xd6b0('0x25')]();})[_0xd6b0('0x45')](handleError(_0x2e93cc,null));};function getBucketslist(_0xc57b28,_0x2e34e7,_0x5d2e36){return new Promise(function(_0x19bae6,_0x1856bc){var _0x39dd79=new AWS['S3']({'accessKeyId':_0x2e34e7,'secretAccessKey':_0xc57b28,'region':_0x5d2e36});_0x39dd79[_0xd6b0('0x65')]({},function(_0x5789c0,_0x1b5247){if(_0x5789c0){return _0x1856bc(_0x5789c0);}else{return _0x19bae6(_0x1b5247);}});});}function createBucket(_0x56ec55,_0x4b6651,_0x37a90a,_0x262334){return new Promise(function(_0x317e52,_0x2f9ea){var _0x4e6ff4=new AWS['S3']({'accessKeyId':_0x4b6651,'secretAccessKey':_0x56ec55,'region':_0x37a90a});_0x4e6ff4[_0xd6b0('0x66')]({'Bucket':_0x262334},function(_0x2a6621,_0x72781c){if(_0x2a6621){return _0x2f9ea(_0x2a6621);}else{return _0x317e52(_0x72781c);}});});}function uploadFile(_0x1f3278,_0x2a7544,_0x5b0f8f,_0x2cc2a6,_0x403b65,_0x4729c6){return new Promise(function(_0x277025,_0x220015){var _0x44830e=new AWS['S3']({'accessKeyId':_0x2a7544,'secretAccessKey':_0x1f3278,'region':_0x5b0f8f});_0x44830e[_0xd6b0('0x67')]({'Bucket':_0x2cc2a6,'Key':_0x403b65,'Body':_0x4729c6},function(_0x54a139,_0x589dbc){if(_0x54a139){return _0x220015(_0x54a139);}else{return _0x277025(_0x589dbc);}});});}function startTranscribe(_0x3896c6,_0x8bdb94,_0x57d6fe,_0x53472f,_0x667c99,_0x1f7252){return new Promise(function(_0x53f27a,_0x354900){var _0x5ddd21=new AWS['TranscribeService']({'accessKeyId':_0x8bdb94,'secretAccessKey':_0x3896c6,'region':_0x57d6fe});_0x5ddd21[_0xd6b0('0x68')]({'TranscriptionJobName':_0x53472f,'LanguageCode':_0x667c99,'Media':{'MediaFileUri':_0x1f7252}},function(_0xfe0b3f,_0x352b16){if(_0xfe0b3f){return _0x354900(_0xfe0b3f);}else{return _0x53f27a(_0x352b16);}});});}function transcribe(_0x24cd43,_0x285715,_0x5d2528,_0x345a64,_0x1e8dc5,_0xe5435,_0xdc987b){return new Promise(function(_0x3e4986,_0x41180c){var _0x23f0d0={};logger[_0xd6b0('0x61')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x24cd43,_0x1e8dc5));return uploadFile(_0x285715,_0x5d2528,_0x345a64,_0x1e8dc5,path[_0xd6b0('0x69')](_0xe5435),fs[_0xd6b0('0x6a')](_0xe5435))[_0xd6b0('0x23')](function(_0x349b11){logger['info'](util['format'](_0xd6b0('0x6b'),_0x24cd43,_0x1e8dc5,_0x349b11[_0xd6b0('0x6c')]));_0x23f0d0[_0xd6b0('0x6d')]=_0x349b11[_0xd6b0('0x6e')];_0x23f0d0[_0xd6b0('0x6f')]=_0x349b11[_0xd6b0('0x6c')];logger[_0xd6b0('0x61')](util['format'](_0xd6b0('0x70'),_0x24cd43));return startTranscribe(_0x285715,_0x5d2528,_0x345a64,uuidv4(),_0xdc987b,_0x349b11[_0xd6b0('0x6c')]);})[_0xd6b0('0x23')](function(_0x46d68d){logger[_0xd6b0('0x61')](util[_0xd6b0('0x4c')](_0xd6b0('0x71'),_0x24cd43,_0x46d68d[_0xd6b0('0x72')]['TranscriptionJobName']));_0x23f0d0[_0xd6b0('0x73')]=_0x46d68d[_0xd6b0('0x72')]['TranscriptionJobName'];_0x23f0d0['transcribeStatus']=_0x46d68d[_0xd6b0('0x72')][_0xd6b0('0x74')];return _0x3e4986(_0x23f0d0);})[_0xd6b0('0x45')](function(_0x1a3ab5){return _0x41180c(_0x1a3ab5);});});}exports[_0xd6b0('0x75')]=function(_0x38e23c,_0x18b5d4,_0x1d78f3){var _0x19cd05;var _0x2e30b9;var _0x3b0709;var _0x4bf3e3=require('../../components/encryptor');return db[_0xd6b0('0x2b')][_0xd6b0('0x76')]({'where':{'id':_0x38e23c[_0xd6b0('0x47')]['id']}})[_0xd6b0('0x23')](function(_0x36873c){if(_0x36873c){var _0x528106=util[_0xd6b0('0x4c')](_0xd6b0('0x5d'),_0x36873c[_0xd6b0('0x4b')]);if(fs['existsSync'](_0x528106)){cypher=!![];return _0x4bf3e3[_0xd6b0('0x4e')](_0x528106,_0x36873c[_0xd6b0('0x4b')],config[_0xd6b0('0x4f')][_0xd6b0('0x50')])[_0xd6b0('0x23')](function(){return _0x36873c;});}return _0x36873c;}})[_0xd6b0('0x23')](function(_0x67c449){if(!_0x67c449){throw new db[(_0xd6b0('0x51'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x2e30b9=_0x67c449;return db[_0xd6b0('0x77')][_0xd6b0('0x76')]({'where':{'id':0x1}});})[_0xd6b0('0x23')](handleEntityNotFound(_0x18b5d4,null))[_0xd6b0('0x23')](function(_0xfd857d){if(_0xfd857d){_0x19cd05=_0xfd857d;if(!_0x19cd05[_0xd6b0('0x78')]||!_0x19cd05[_0xd6b0('0x79')]||!_0x19cd05[_0xd6b0('0x7a')]||!_0x19cd05[_0xd6b0('0x7b')]||!_0x19cd05[_0xd6b0('0x6d')]){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))](_0xd6b0('0x7c'));}if(_0x38e23c[_0xd6b0('0x44')]['runSentiment']&&(!_0x19cd05[_0xd6b0('0x7d')]||!_0x19cd05[_0xd6b0('0x7e')]||!_0x19cd05[_0xd6b0('0x7f')]||!_0x19cd05[_0xd6b0('0x7b')]||!_0x19cd05[_0xd6b0('0x6d')])){throw new db[(_0xd6b0('0x51'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xd6b0('0x80')]['findOne']({'where':{'id':_0x19cd05[_0xd6b0('0x79')]}});}})[_0xd6b0('0x23')](function(_0x17b063){if(!_0x17b063){throw new db[(_0xd6b0('0x51'))]['ValidationError'](_0xd6b0('0x81'));}if(!_0x17b063[_0xd6b0('0x82')]||!_0x17b063[_0xd6b0('0x83')]){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))]('Cloud\x20Provider\x20not\x20configured');}_0x3b0709=_0x17b063;return getBucketslist(_0x3b0709[_0xd6b0('0x82')],_0x3b0709[_0xd6b0('0x83')],_0x19cd05[_0xd6b0('0x7a')]);})[_0xd6b0('0x23')](function(_0x1feda7){if(_0x1feda7&&_0x1feda7[_0xd6b0('0x84')]){var _0x2523cd=_[_0xd6b0('0x46')](_0x1feda7[_0xd6b0('0x84')],function(_0x3bb276){return _0x3bb276[_0xd6b0('0x85')]===_0x19cd05[_0xd6b0('0x6d')];});if(!_0x2523cd){logger[_0xd6b0('0x61')](util[_0xd6b0('0x4c')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x38e23c[_0xd6b0('0x47')]['id'],_0x19cd05[_0xd6b0('0x6d')]));return createBucket(_0x3b0709['data1'],_0x3b0709[_0xd6b0('0x83')],_0x19cd05[_0xd6b0('0x7a')],_0x19cd05[_0xd6b0('0x6d')]);}logger['info'](util[_0xd6b0('0x4c')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x38e23c[_0xd6b0('0x47')]['id'],_0x19cd05[_0xd6b0('0x6d')]));return;}})[_0xd6b0('0x23')](function(_0x35c1d2){if(_0x2e30b9[_0xd6b0('0x86')]===_0xd6b0('0x87')){return transcribe(_0x38e23c[_0xd6b0('0x47')]['id'],_0x3b0709['data1'],_0x3b0709['data2'],_0x19cd05[_0xd6b0('0x7a')],_0x19cd05[_0xd6b0('0x6d')],_0x2e30b9[_0xd6b0('0x4b')],_0x19cd05[_0xd6b0('0x7b')]);}else{logger[_0xd6b0('0x61')](util['format'](_0xd6b0('0x88'),_0x38e23c['params']['id']));return{'transcribeStatus':_0xd6b0('0x89')};}})[_0xd6b0('0x23')](function(_0x4540cd){if(_0x4540cd){_0x4540cd[_0xd6b0('0x8a')]=_0x38e23c['body'][_0xd6b0('0x8b')];return _0x2e30b9['updateAttributes'](_0x4540cd);}})[_0xd6b0('0x23')](respondWithResult(_0x18b5d4,null))[_0xd6b0('0x45')](handleError(_0x18b5d4,null));};function writeFile(_0x4a69c4,_0x53c277){return new Promise(function(_0x5d498d,_0x2d10cb){fs['writeFile'](_0x53c277,_0x4a69c4,function(_0x222a85,_0x577575){if(_0x222a85){return _0x2d10cb(_0x222a85);}else{return _0x5d498d(_0x577575);}});});}exports['downloadTranscribe']=function(_0x8ddef0,_0x2252f8,_0x18128f){return db[_0xd6b0('0x2b')][_0xd6b0('0x76')]({'where':{'id':_0x8ddef0[_0xd6b0('0x47')]['id']}})['then'](handleEntityNotFound(_0x2252f8))[_0xd6b0('0x23')](function(_0x4488e4){if(_0x4488e4&&_0x4488e4['fileText']){var _0x2bf09a=_0x4488e4[_0xd6b0('0x8c')];var _0x26073a=config[_0xd6b0('0x8d')]+_0xd6b0('0x8e')+_0x4488e4['id']+_0xd6b0('0x8f');if(fs[_0xd6b0('0x4d')](_0x26073a)){return _0x26073a;}return writeFile(_0x2bf09a,_0x26073a)[_0xd6b0('0x23')](function(){return _0x26073a;});}else{throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))](_0xd6b0('0x90'));}})['then'](function(_0x31e0f1){return _0x2252f8[_0xd6b0('0x53')](_0x31e0f1);})[_0xd6b0('0x45')](handleError(_0x2252f8));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d08f65f..af2dc9a 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 _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 +var _0xb4e6=['./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x241d2d,_0xf2d330){var _0x21c5bd=function(_0x36f23c){while(--_0x36f23c){_0x241d2d['push'](_0x241d2d['shift']());}};_0x21c5bd(++_0xf2d330);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0xb4e6[_0x15fc7a];return _0x3aa9f4;};'use strict';var attributes=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]=function(_0x3c385b,_0x9babca){return _0x3c385b[_0x6b4e('0x2')](_0x6b4e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x6b4e('0x4'),'fields':['uniqueid']},{'name':_0x6b4e('0x5'),'fields':[_0x6b4e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d0f951d..d5b9909 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 _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 +var _0x6a55=['callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateVoiceRecording','update','body','options','where','limit','findOne'];(function(_0x5d570d,_0x2aeca4){var _0x485ea0=function(_0x1ec20c){while(--_0x1ec20c){_0x5d570d['push'](_0x5d570d['shift']());}};_0x485ea0(++_0x2aeca4);}(_0x6a55,0xdb));var _0x56a5=function(_0x4ca796,_0x10dc47){_0x4ca796=_0x4ca796-0x0;var _0x171f87=_0x6a55[_0x4ca796];return _0x171f87;};'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);});});}exports[_0x56a5('0x13')]=function(_0x28fe74){var _0x1ba472=this;return new Promise(function(_0x143f3d,_0x1dddec){return db['VoiceRecording'][_0x56a5('0x14')](_0x28fe74[_0x56a5('0x15')],{'raw':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x17')]||null:null,'attributes':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['attributes']||null:null,'limit':_0x28fe74['options']?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x18')]||null:null})['then'](function(_0x1556eb){logger[_0x56a5('0x8')](_0x56a5('0x13'),_0x28fe74);logger[_0x56a5('0xb')](_0x56a5('0x13'),_0x28fe74,JSON[_0x56a5('0xd')](_0x1556eb));_0x143f3d(_0x1556eb);})[_0x56a5('0x12')](function(_0x8431df){logger[_0x56a5('0xf')](_0x56a5('0x13'),_0x8431df[_0x56a5('0x10')],_0x28fe74);_0x1dddec(_0x1ba472[_0x56a5('0xf')](0x1f4,_0x8431df[_0x56a5('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5c76a7){var _0x2d8e68=this;return new Promise(function(_0x42cd45,_0x2706f9){var _0x43a815=require('../../components/encryptor');var _0x18e863;return db['Setting'][_0x56a5('0x19')]({'attributes':['id',_0x56a5('0x1a')],'where':{'id':0x1},'raw':!![]})[_0x56a5('0x7')](function(_0x284ee5){_0x18e863=_0x284ee5;return db['VoiceRecording'][_0x56a5('0x1b')](_0x5c76a7[_0x56a5('0x15')]);})[_0x56a5('0x7')](function(_0x51ef6f){if(_0x18e863[_0x56a5('0x1a')]&&fs[_0x56a5('0x1c')](_0x51ef6f[_0x56a5('0x1d')])){var _0x214649=util[_0x56a5('0x1e')]('%s.cypher',_0x51ef6f[_0x56a5('0x1d')]);return _0x43a815[_0x56a5('0x1f')](_0x51ef6f[_0x56a5('0x1d')],_0x214649,config[_0x56a5('0x20')][_0x56a5('0x21')])['then'](function(){fs['unlink'](_0x51ef6f[_0x56a5('0x1d')]);logger[_0x56a5('0x8')](_0x56a5('0x22'));return _0x51ef6f;});}return _0x51ef6f;})['then'](function(_0x1de021){logger[_0x56a5('0x8')]('CreateVoiceRecording',_0x5c76a7);logger['debug']('CreateVoiceRecording',_0x5c76a7,JSON['stringify'](_0x1de021));_0x42cd45(_0x1de021);})[_0x56a5('0x12')](function(_0x29c8f1){logger[_0x56a5('0xf')]('CreateVoiceRecording',_0x29c8f1[_0x56a5('0x10')],_0x5c76a7);_0x2706f9(_0x2d8e68['error'](0x1f4,_0x29c8f1[_0x56a5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6d066d1..85e07ff 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 _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 +var _0x4381=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceTransferReport.controller','index','get','/describe','isAuthenticated'];(function(_0x2db7b1,_0x52d9e5){var _0x5d0af4=function(_0x1351f1){while(--_0x1351f1){_0x2db7b1['push'](_0x2db7b1['shift']());}};_0x5d0af4(++_0x52d9e5);}(_0x4381,0x11a));var _0x1438=function(_0xe9aede,_0x1da244){_0xe9aede=_0xe9aede-0x0;var _0x23b020=_0x4381[_0xe9aede];return _0x23b020;};'use strict';var multer=require(_0x1438('0x0'));var util=require(_0x1438('0x1'));var path=require(_0x1438('0x2'));var timeout=require(_0x1438('0x3'));var express=require(_0x1438('0x4'));var router=express[_0x1438('0x5')]();var fs_extra=require(_0x1438('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1438('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1438('0x8')]);router[_0x1438('0x9')](_0x1438('0xa'),auth[_0x1438('0xb')](),controller['describe']);router[_0x1438('0x9')](_0x1438('0xc'),auth['isAuthenticated'](),controller[_0x1438('0xd')]);router[_0x1438('0xe')]('/',auth[_0x1438('0xb')](),controller[_0x1438('0xf')]);router[_0x1438('0x10')]('/:id',auth[_0x1438('0xb')](),controller[_0x1438('0x11')]);router[_0x1438('0x12')]('/:id',auth[_0x1438('0xb')](),controller[_0x1438('0x13')]);module[_0x1438('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 299a589..0716091 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 _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 +var _0xff8e=['STRING','sequelize','moment','exports','blind'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0xff8e,0xd3));var _0xeff8=function(_0x59fa9d,_0x1f5959){_0x59fa9d=_0x59fa9d-0x0;var _0x214753=_0xff8e[_0x59fa9d];return _0x214753;};'use strict';var Sequelize=require(_0xeff8('0x0'));var moment=require(_0xeff8('0x1'));module[_0xeff8('0x2')]={'type':{'type':Sequelize['ENUM'](_0xeff8('0x3'),'attended')},'result':{'type':Sequelize[_0xeff8('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xeff8('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xeff8('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xeff8('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xeff8('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xeff8('0x4')]},'transfereechannel':{'type':Sequelize[_0xeff8('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xeff8('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xeff8('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xeff8('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xeff8('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xeff8('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xeff8('0x4')]},'extension':{'type':Sequelize[_0xeff8('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e72d61c..32c8f16 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 _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 +var _0x69b8=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','count','includeAll','include','rows','catch','params','rawAttributes','options','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','undefined','limit','offset','set','Content-Range','json','apply','save','then','destroy','end','sendStatus','error','stack','send','index','VoiceTransferReport','key','model','map','keys','query','filters','intersection','attributes'];(function(_0x24a0c3,_0x5411c1){var _0x1b0829=function(_0x2ba89e){while(--_0x2ba89e){_0x24a0c3['push'](_0x24a0c3['shift']());}};_0x1b0829(++_0x5411c1);}(_0x69b8,0xf2));var _0x869b=function(_0x4539b6,_0x1643c9){_0x4539b6=_0x4539b6-0x0;var _0x5bb0c4=_0x69b8[_0x4539b6];return _0x5bb0c4;};'use strict';var emlformat=require(_0x869b('0x0'));var rimraf=require(_0x869b('0x1'));var zipdir=require(_0x869b('0x2'));var jsonpatch=require(_0x869b('0x3'));var rp=require(_0x869b('0x4'));var moment=require(_0x869b('0x5'));var BPromise=require(_0x869b('0x6'));var Mustache=require('mustache');var util=require(_0x869b('0x7'));var path=require(_0x869b('0x8'));var sox=require(_0x869b('0x9'));var csv=require(_0x869b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x869b('0xb'));var _=require(_0x869b('0xc'));var squel=require(_0x869b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x869b('0xa'));var querystring=require(_0x869b('0xe'));var Papa=require(_0x869b('0xf'));var Redis=require(_0x869b('0x10'));var authService=require(_0x869b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x869b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x869b('0x13'))(_0x869b('0x14'));var utils=require(_0x869b('0x15'));var config=require(_0x869b('0x16'));var licenseUtil=require(_0x869b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x261a88,_0x2a5fac){_0x2a5fac=_0x2a5fac||0xcc;return function(_0x2a08c3){if(_0x2a08c3){return _0x261a88['sendStatus'](_0x2a5fac);}return _0x261a88[_0x869b('0x18')](_0x2a5fac)['end']();};}function respondWithResult(_0x32c173,_0x457c11){_0x457c11=_0x457c11||0xc8;return function(_0x5c4ba8){if(_0x5c4ba8){return _0x32c173[_0x869b('0x18')](_0x457c11)['json'](_0x5c4ba8);}};}function respondWithFilteredResult(_0x2c4f65,_0x14cbd9){return function(_0x1fd100){if(_0x1fd100){var _0x49f191=typeof _0x14cbd9['offset']===_0x869b('0x19')&&typeof _0x14cbd9[_0x869b('0x1a')]===_0x869b('0x19');var _0x129737=_0x1fd100['count'];var _0x7716b2=_0x49f191?0x0:_0x14cbd9[_0x869b('0x1b')];var _0xf954=_0x49f191?_0x1fd100['count']:_0x14cbd9[_0x869b('0x1b')]+_0x14cbd9['limit'];var _0x2d0b2d;if(_0xf954>=_0x129737){_0xf954=_0x129737;_0x2d0b2d=0xc8;}else{_0x2d0b2d=0xce;}_0x2c4f65[_0x869b('0x18')](_0x2d0b2d);return _0x2c4f65[_0x869b('0x1c')](_0x869b('0x1d'),_0x7716b2+'-'+_0xf954+'/'+_0x129737)[_0x869b('0x1e')](_0x1fd100);}return null;};}function patchUpdates(_0x5e27be){return function(_0x17c8ca){try{jsonpatch[_0x869b('0x1f')](_0x17c8ca,_0x5e27be,!![]);}catch(_0xf5bb5c){return BPromise['reject'](_0xf5bb5c);}return _0x17c8ca[_0x869b('0x20')]();};}function saveUpdates(_0x4bc014,_0x23ecf5){return function(_0x2d1c00){if(_0x2d1c00){return _0x2d1c00['update'](_0x4bc014)[_0x869b('0x21')](function(_0x3747e8){return _0x3747e8;});}return null;};}function removeEntity(_0x2bae83,_0x1b672a){return function(_0x1bcaa6){if(_0x1bcaa6){return _0x1bcaa6[_0x869b('0x22')]()[_0x869b('0x21')](function(){_0x2bae83[_0x869b('0x18')](0xcc)[_0x869b('0x23')]();});}};}function handleEntityNotFound(_0x29c992,_0x34ed4f){return function(_0x215f15){if(!_0x215f15){_0x29c992[_0x869b('0x24')](0x194);}return _0x215f15;};}function handleError(_0x27d29f,_0x67e5ef){_0x67e5ef=_0x67e5ef||0x1f4;return function(_0x5567de){logger[_0x869b('0x25')](_0x5567de[_0x869b('0x26')]);if(_0x5567de['name']){delete _0x5567de['name'];}_0x27d29f['status'](_0x67e5ef)[_0x869b('0x27')](_0x5567de);};}exports[_0x869b('0x28')]=function(_0x38e7e1,_0x19a324){var _0x8b4663={},_0x156713={},_0x919ca7={'count':0x0,'rows':[]};var _0x3b7270=_['map'](db[_0x869b('0x29')]['rawAttributes'],function(_0x13c1b2){return{'name':_0x13c1b2['fieldName'],'type':_0x13c1b2['type'][_0x869b('0x2a')]};});_0x156713[_0x869b('0x2b')]=_[_0x869b('0x2c')](_0x3b7270,'name');_0x156713['query']=_[_0x869b('0x2d')](_0x38e7e1[_0x869b('0x2e')]);_0x156713[_0x869b('0x2f')]=_[_0x869b('0x30')](_0x156713[_0x869b('0x2b')],_0x156713[_0x869b('0x2e')]);_0x8b4663[_0x869b('0x31')]=_['intersection'](_0x156713[_0x869b('0x2b')],qs[_0x869b('0x32')](_0x38e7e1['query'][_0x869b('0x32')]));_0x8b4663['attributes']=_0x8b4663[_0x869b('0x31')][_0x869b('0x33')]?_0x8b4663[_0x869b('0x31')]:_0x156713['model'];if(!_0x38e7e1[_0x869b('0x2e')][_0x869b('0x34')](_0x869b('0x35'))){_0x8b4663['limit']=qs[_0x869b('0x1a')](_0x38e7e1[_0x869b('0x2e')][_0x869b('0x1a')]);_0x8b4663[_0x869b('0x1b')]=qs[_0x869b('0x1b')](_0x38e7e1['query'][_0x869b('0x1b')]);}_0x8b4663[_0x869b('0x36')]=qs[_0x869b('0x37')](_0x38e7e1[_0x869b('0x2e')][_0x869b('0x37')]);_0x8b4663[_0x869b('0x38')]=qs[_0x869b('0x2f')](_[_0x869b('0x39')](_0x38e7e1[_0x869b('0x2e')],_0x156713[_0x869b('0x2f')]),_0x3b7270);if(_0x38e7e1['query']['filter']){_0x8b4663[_0x869b('0x38')]=_[_0x869b('0x3a')](_0x8b4663[_0x869b('0x38')],{'$or':_[_0x869b('0x2c')](_0x3b7270,function(_0x14d135){if(_0x14d135[_0x869b('0x3b')]!=='VIRTUAL'){var _0x3d7e5b={};_0x3d7e5b[_0x14d135['name']]={'$like':'%'+_0x38e7e1['query'][_0x869b('0x3c')]+'%'};return _0x3d7e5b;}})});}_0x8b4663=_[_0x869b('0x3a')]({},_0x8b4663,_0x38e7e1['options']);var _0x2dbdb2={'where':_0x8b4663['where']};return db[_0x869b('0x29')][_0x869b('0x3d')](_0x2dbdb2)['then'](function(_0x2ab98f){_0x919ca7[_0x869b('0x3d')]=_0x2ab98f;if(_0x38e7e1[_0x869b('0x2e')][_0x869b('0x3e')]){_0x8b4663[_0x869b('0x3f')]=[{'all':!![]}];}return db[_0x869b('0x29')]['findAll'](_0x8b4663);})[_0x869b('0x21')](function(_0x2ef265){_0x919ca7[_0x869b('0x40')]=_0x2ef265;return _0x919ca7;})['then'](respondWithFilteredResult(_0x19a324,_0x8b4663))[_0x869b('0x41')](handleError(_0x19a324,null));};exports['show']=function(_0x235234,_0x544735){var _0x3176e4={'raw':!![],'where':{'id':_0x235234[_0x869b('0x42')]['id']}},_0x4e1565={};_0x4e1565[_0x869b('0x2b')]=_[_0x869b('0x2d')](db[_0x869b('0x29')][_0x869b('0x43')]);_0x4e1565[_0x869b('0x2e')]=_[_0x869b('0x2d')](_0x235234['query']);_0x4e1565[_0x869b('0x2f')]=_['intersection'](_0x4e1565[_0x869b('0x2b')],_0x4e1565['query']);_0x3176e4[_0x869b('0x31')]=_[_0x869b('0x30')](_0x4e1565[_0x869b('0x2b')],qs[_0x869b('0x32')](_0x235234['query'][_0x869b('0x32')]));_0x3176e4[_0x869b('0x31')]=_0x3176e4['attributes'][_0x869b('0x33')]?_0x3176e4[_0x869b('0x31')]:_0x4e1565[_0x869b('0x2b')];if(_0x235234['query']['includeAll']){_0x3176e4[_0x869b('0x3f')]=[{'all':!![]}];}_0x3176e4=_[_0x869b('0x3a')]({},_0x3176e4,_0x235234[_0x869b('0x44')]);return db['VoiceTransferReport'][_0x869b('0x45')](_0x3176e4)[_0x869b('0x21')](handleEntityNotFound(_0x544735,null))[_0x869b('0x21')](respondWithResult(_0x544735,null))[_0x869b('0x41')](handleError(_0x544735,null));};exports['create']=function(_0x34536d,_0x168568){return db[_0x869b('0x29')]['create'](_0x34536d[_0x869b('0x46')],{})['then'](respondWithResult(_0x168568,0xc9))[_0x869b('0x41')](handleError(_0x168568,null));};exports[_0x869b('0x47')]=function(_0x121471,_0x30cc0e){if(_0x121471[_0x869b('0x46')]['id']){delete _0x121471['body']['id'];}return db[_0x869b('0x29')][_0x869b('0x45')]({'where':{'id':_0x121471['params']['id']}})[_0x869b('0x21')](handleEntityNotFound(_0x30cc0e,null))[_0x869b('0x21')](saveUpdates(_0x121471[_0x869b('0x46')],null))['then'](respondWithResult(_0x30cc0e,null))[_0x869b('0x41')](handleError(_0x30cc0e,null));};exports[_0x869b('0x22')]=function(_0x28f7d3,_0x5be757){return db[_0x869b('0x29')][_0x869b('0x45')]({'where':{'id':_0x28f7d3[_0x869b('0x42')]['id']}})[_0x869b('0x21')](handleEntityNotFound(_0x5be757,null))[_0x869b('0x21')](removeEntity(_0x5be757,null))[_0x869b('0x41')](handleError(_0x5be757,null));};exports[_0x869b('0x48')]=function(_0x3cc9e8,_0x39592f){return db[_0x869b('0x29')][_0x869b('0x48')]()['then'](respondWithResult(_0x39592f,null))[_0x869b('0x41')](handleError(_0x39592f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 8a526de..0a653e2 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 _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 +var _0xfd64=['path','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfd64,0x66));var _0x4fd6=function(_0x36409d,_0x563892){_0x36409d=_0x36409d-0x0;var _0x567b1d=_0xfd64[_0x36409d];return _0x567b1d;};'use strict';var _=require(_0x4fd6('0x0'));var util=require(_0x4fd6('0x1'));var logger=require(_0x4fd6('0x2'))(_0x4fd6('0x3'));var moment=require(_0x4fd6('0x4'));var BPromise=require(_0x4fd6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fd6('0x6'));var rimraf=require('rimraf');var config=require(_0x4fd6('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x4fd6('0x8')]=function(_0x38cefc,_0x1c7144){return _0x38cefc[_0x4fd6('0x9')](_0x4fd6('0xa'),attributes,{'tableName':_0x4fd6('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 db246c0..89fecfb 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 _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 +var _0x042e=['jayson/promise','client','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','result','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x146c7f,_0x29ac20){var _0x5d578a=function(_0x517200){while(--_0x517200){_0x146c7f['push'](_0x146c7f['shift']());}};_0x5d578a(++_0x29ac20);}(_0x042e,0x96));var _0xe042=function(_0x2538e7,_0x4adf9d){_0x2538e7=_0x2538e7-0x0;var _0x4df5db=_0x042e[_0x2538e7];return _0x4df5db;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe042('0x0'));var BPromise=require('bluebird');var rs=require(_0xe042('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe042('0x2'))['db'];var utils=require(_0xe042('0x3'));var logger=require(_0xe042('0x4'))(_0xe042('0x5'));var config=require('../../config/environment');var jayson=require(_0xe042('0x6'));var client=jayson[_0xe042('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cee72,_0x3b2c00,_0x38c97a){return new BPromise(function(_0xc4ca5d,_0x10ebbc){return client[_0xe042('0x8')](_0x1cee72,_0x38c97a)[_0xe042('0x9')](function(_0x1bad89){logger[_0xe042('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x3b2c00,'request\x20sent');logger[_0xe042('0xb')](_0xe042('0xc'),_0x3b2c00,'request\x20sent',JSON[_0xe042('0xd')](_0x1bad89));if(_0x1bad89['error']){if(_0x1bad89[_0xe042('0xe')][_0xe042('0xf')]===0x1f4){logger['error'](_0xe042('0x10'),_0x3b2c00,_0x1bad89[_0xe042('0xe')]['message']);return _0x10ebbc(_0x1bad89[_0xe042('0xe')]['message']);}logger[_0xe042('0xe')](_0xe042('0x10'),_0x3b2c00,_0x1bad89[_0xe042('0xe')][_0xe042('0x11')]);return _0xc4ca5d(_0x1bad89[_0xe042('0xe')][_0xe042('0x11')]);}else{logger[_0xe042('0xa')](_0xe042('0x10'),_0x3b2c00,_0xe042('0x12'));_0xc4ca5d(_0x1bad89[_0xe042('0x13')][_0xe042('0x11')]);}})['catch'](function(_0x554643){logger[_0xe042('0xe')](_0xe042('0x10'),_0x3b2c00,_0x554643);_0x10ebbc(_0x554643);});});}exports['CreateVoiceTransferReport']=function(_0x246fa6){var _0x154fef=this;return new Promise(function(_0x3be828,_0x4bb1d5){return db[_0xe042('0x14')]['create'](_0x246fa6[_0xe042('0x15')],{'raw':_0x246fa6[_0xe042('0x16')]?_0x246fa6[_0xe042('0x16')][_0xe042('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5a7d1f){logger[_0xe042('0xa')]('CreateVoiceTransferReport',_0x246fa6);logger[_0xe042('0xb')](_0xe042('0x18'),_0x246fa6,JSON[_0xe042('0xd')](_0x5a7d1f));_0x3be828(_0x5a7d1f);})[_0xe042('0x19')](function(_0x3e2949){logger['error'](_0xe042('0x18'),_0x3e2949['message'],_0x246fa6);_0x4bb1d5(_0x154fef[_0xe042('0xe')](0x1f4,_0x3e2949[_0xe042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d1f3129..f10be3a 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 _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 +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb43b,0x1b2));var _0xbb43=function(_0x41abd6,_0x443e05){_0x41abd6=_0x41abd6-0x0;var _0xdb89be=_0xb43b[_0x41abd6];return _0xdb89be;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2b0f89e..867a9ae 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 _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 +var _0xe284=['originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate'];(function(_0x5d2f52,_0x56463d){var _0xf1022a=function(_0x36c40a){while(--_0x36c40a){_0x5d2f52['push'](_0x5d2f52['shift']());}};_0xf1022a(++_0x56463d);}(_0xe284,0x1c8));var _0x4e28=function(_0x1e1943,_0x1a6d54){_0x1e1943=_0x1e1943-0x0;var _0x4989a9=_0xe284[_0x1e1943];return _0x4989a9;};'use strict';var path=require(_0x4e28('0x0'));var fs=require('fs');var _=require(_0x4e28('0x1'));var db=require(_0x4e28('0x2'))['db'];var config=require(_0x4e28('0x3'));var util=require(_0x4e28('0x4'));var BPromise=require(_0x4e28('0x5'));var jayson=require(_0x4e28('0x6'));var amiClient=jayson[_0x4e28('0x7')]['http']({'port':0x232a});var logger=require(_0x4e28('0x8'))(_0x4e28('0x9'));var Redis=require(_0x4e28('0xa'));config[_0x4e28('0xb')]=_[_0x4e28('0xc')](config[_0x4e28('0xb')],{'host':_0x4e28('0xd'),'port':0x18eb});var io=require(_0x4e28('0xe'))(new Redis(config[_0x4e28('0xb')]));var Schema=require(_0x4e28('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4e28('0x10')]},'callNumber':{'type':_0x4e28('0x11'),'required':[!![],_0x4e28('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4e28('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':'string','required':[!![],_0x4e28('0x14')]},'transferNumber':{'type':_0x4e28('0x11'),'required':[!![],_0x4e28('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]}});function emit(_0xfa59b4,_0x4f442f,_0x1950e9){logger[_0x4e28('0x16')](_0xfa59b4,_0x4f442f,JSON[_0x4e28('0x17')](_0x1950e9));io['to'](_0xfa59b4)[_0x4e28('0x18')](_0x4f442f,_0x1950e9);}function handleError(_0x2ba6e7){return function(_0x308889){console['log'](_0x4e28('0x19'),_0x308889,_0x308889 instanceof RangeError);logger['error'](_0x308889[_0x4e28('0x1a')]);if(_0x308889 instanceof RangeError){if(_0x308889['name']){delete _0x308889[_0x4e28('0x1b')];}_0x2ba6e7[_0x4e28('0x1c')](0x194)[_0x4e28('0x1d')](_0x308889);}else{if(_0x308889[_0x4e28('0x1b')]){delete _0x308889[_0x4e28('0x1b')];}_0x2ba6e7[_0x4e28('0x1c')](0x1f4)[_0x4e28('0x1d')](_0x308889);}};}function checkError(){return function(_0x592ae9){if(!_0x592ae9){throw new RangeError(_0x4e28('0x1e'));}return _0x592ae9;};}function respondWithRpcPromise(_0x496b9f,_0x4435e9){return new BPromise(function(_0x1c1a56,_0x4c4eb2){var _0xda53ff=amiClient;return _0xda53ff[_0x4e28('0x1f')](_0x496b9f,_0x4435e9)[_0x4e28('0x20')](function(_0x415a84){if(_0x415a84[_0x4e28('0x21')]){if(_0x415a84['error'][_0x4e28('0x22')]===0x1f4){return _0x4c4eb2(_0x415a84[_0x4e28('0x21')][_0x4e28('0x23')]);}return _0x1c1a56(_0x415a84['error'][_0x4e28('0x23')]);}else{_0x1c1a56(_0x415a84[_0x4e28('0x24')]);}})[_0x4e28('0x25')](function(_0x7390b3){_0x4c4eb2(_0x7390b3);});});}function getAgent(_0x2f4502){return db[_0x4e28('0x26')][_0x4e28('0x27')]({'where':{'id':_0x2f4502,'role':_0x4e28('0x28')}})['then'](checkError());}function getAgentCheckSession(_0x25f1a1,_0x47a3b2){return new BPromise(function(_0x247e63,_0x1555af){var _0x4fa9c1=respondWithRpcPromise(_0x4e28('0x29'));var _0x3283b6=getAgent(_0x25f1a1);Promise['all']([_0x4fa9c1,_0x3283b6])[_0x4e28('0x20')](function(_0x12c46f){var _0x47a21c=_0x12c46f[0x0];var _0x2ee4e4=_0x12c46f[0x1];var _0x1f12d9=_[_0x4e28('0x2a')](_0x47a21c['rows'],function(_0x33847d){return _0x33847d[_0x4e28('0x2b')]==_0x2ee4e4['id']&&_0x33847d[_0x4e28('0x2c')]==_0x47a3b2;});if(_0x1f12d9[_0x4e28('0x2d')]==0x1){_0x247e63(_0x2ee4e4);}else{_0x1555af(new RangeError(_0x4e28('0x2e')+_0x47a3b2+_0x4e28('0x2f')));}});});}exports[_0x4e28('0x30')]=function(_0x306b64,_0x256db9){logger['info'](_0x4e28('0x31'),_0x306b64[_0x4e28('0x32')]);var _0x300062=originateValidation[_0x4e28('0xf')](_0x306b64[_0x4e28('0x32')]);if(_0x300062[_0x4e28('0x2d')]>0x0){return _0x256db9[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x300062);}var _0x16dccb=_0x306b64[_0x4e28('0x32')][_0x4e28('0x34')];var _0x3d297e=_0x306b64[_0x4e28('0x32')][_0x4e28('0x35')];var _0x3a2d9f=_0x306b64['body'][_0x4e28('0x36')];var _0x3167c3=_0x306b64[_0x4e28('0x32')][_0x4e28('0x37')];return getAgent(_0x16dccb)[_0x4e28('0x20')](function(_0x4b042d){logger[_0x4e28('0x16')](_0x4e28('0x38'),_0x4b042d['name']);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x4b042d['name']),_0x4e28('0x3b'),{'callNumber':_0x3d297e,'callerId':_0x3a2d9f,'callbackUrl':_0x3167c3});return _0x256db9[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x3c')});})[_0x4e28('0x25')](handleError(_0x256db9));};exports[_0x4e28('0x3d')]=function(_0x1822d4,_0x28dd5a){logger[_0x4e28('0x16')](_0x4e28('0x3e'),_0x1822d4[_0x4e28('0x32')]);var _0x5b752d=hangupValidation[_0x4e28('0xf')](_0x1822d4['body']);if(_0x5b752d[_0x4e28('0x2d')]>0x0){return _0x28dd5a[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x5b752d);}var _0x16fc02=_0x1822d4[_0x4e28('0x32')][_0x4e28('0x34')];var _0x55aac0=_0x1822d4['body'][_0x4e28('0x2c')];return getAgent(_0x16fc02)[_0x4e28('0x20')](function(_0x49cbf9){logger[_0x4e28('0x16')]('entityFound:',_0x49cbf9[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x49cbf9[_0x4e28('0x1b')]),_0x4e28('0x3f'),{'sessionId':_0x55aac0});return _0x28dd5a[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x40')});})[_0x4e28('0x25')](handleError(_0x28dd5a));};exports[_0x4e28('0x41')]=function(_0xddf2ec,_0x2796d8){logger[_0x4e28('0x16')](_0x4e28('0x42'),_0xddf2ec[_0x4e28('0x32')]);var _0x29ddab=answerValidation['validate'](_0xddf2ec[_0x4e28('0x32')]);if(_0x29ddab[_0x4e28('0x2d')]>0x0){return _0x2796d8[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x29ddab);}var _0x3fb833=_0xddf2ec['body'][_0x4e28('0x34')];var _0x1e788f=_0xddf2ec[_0x4e28('0x32')]['sessionId'];return getAgent(_0x3fb833)[_0x4e28('0x20')](function(_0x4bfae6){logger[_0x4e28('0x16')](_0x4e28('0x38'),_0x4bfae6['name']);emit(util[_0x4e28('0x39')]('user:%s',_0x4bfae6[_0x4e28('0x1b')]),_0x4e28('0x43'),{'sessionId':_0x1e788f});return _0x2796d8[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x44')});})[_0x4e28('0x25')](handleError(_0x2796d8));};exports[_0x4e28('0x45')]=function(_0x4169d6,_0x376f76){logger[_0x4e28('0x16')](_0x4e28('0x46'),_0x4169d6['body']);var _0x28f5de=holdValidation[_0x4e28('0xf')](_0x4169d6[_0x4e28('0x32')]);if(_0x28f5de[_0x4e28('0x2d')]>0x0){return _0x376f76['status'](0x190)[_0x4e28('0x33')](_0x28f5de);}var _0x18cd16=_0x4169d6['body'][_0x4e28('0x34')];var _0x517e31=_0x4169d6[_0x4e28('0x32')][_0x4e28('0x2c')];return getAgent(_0x18cd16)[_0x4e28('0x20')](function(_0x2a178f){logger['info'](_0x4e28('0x38'),_0x2a178f[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')]('user:%s',_0x2a178f[_0x4e28('0x1b')]),_0x4e28('0x47'),{'sessionId':_0x517e31});return _0x376f76[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x48')});})[_0x4e28('0x25')](handleError(_0x376f76));};exports[_0x4e28('0x49')]=function(_0x44e978,_0x35c507){logger['info']('unhold\x20fired:',_0x44e978[_0x4e28('0x32')]);var _0x892cb1=unholdValidation[_0x4e28('0xf')](_0x44e978[_0x4e28('0x32')]);if(_0x892cb1[_0x4e28('0x2d')]>0x0){return _0x35c507[_0x4e28('0x1c')](0x190)['json'](_0x892cb1);}var _0x12fa57=_0x44e978[_0x4e28('0x32')]['userId'];var _0x106db1=_0x44e978[_0x4e28('0x32')]['sessionId'];return getAgent(_0x12fa57)[_0x4e28('0x20')](function(_0x32c036){logger['info']('entityFound:',_0x32c036['name']);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x32c036['name']),_0x4e28('0x4a'),{'sessionId':_0x106db1});return _0x35c507[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x4b')});})[_0x4e28('0x25')](handleError(_0x35c507));};exports[_0x4e28('0x4c')]=function(_0x5239ab,_0x499c45){logger[_0x4e28('0x16')](_0x4e28('0x4d'),_0x499c45['body']);var _0x27b071=callsValidation[_0x4e28('0xf')](_0x5239ab[_0x4e28('0x32')]);if(_0x27b071['length']>0x0){return _0x499c45[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x27b071);}var _0x4d268d=_0x5239ab['body']['userId'];var _0x3e4533=respondWithRpcPromise('VoiceChannels');var _0x2a6301=getAgent(_0x4d268d);return Promise['all']([_0x3e4533,_0x2a6301])[_0x4e28('0x20')](function(_0x5523aa){var _0x2011f0=_0x5523aa[0x0];var _0x511b9d=_0x5523aa[0x1];var _0x2482e5=_[_0x4e28('0x2a')](_0x2011f0[_0x4e28('0x4e')],function(_0x47d8ad){return _0x47d8ad[_0x4e28('0x2b')]==_0x511b9d['id'];});return _0x499c45[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'count':_0x2482e5['length'],'rows':_0x2482e5});})[_0x4e28('0x25')](handleError(_0x499c45));};exports['conference']=function(_0x58f015,_0xe16cc6){logger[_0x4e28('0x16')](_0x4e28('0x4f'),_0x58f015[_0x4e28('0x32')]);var _0x387b66=conferenceValidation[_0x4e28('0xf')](_0x58f015['body']);if(_0x387b66['length']>0x0){return _0xe16cc6['status'](0x190)[_0x4e28('0x33')](_0x387b66);}var _0x3fe20d=_0x58f015['body'][_0x4e28('0x34')];return getAgent(_0x3fe20d)['then'](function(_0x3430d4){logger['info'](_0x4e28('0x38'),_0x3430d4[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x3430d4[_0x4e28('0x1b')]),_0x4e28('0x50'));return _0xe16cc6[_0x4e28('0x1c')](0xc8)['json']({'error':![],'message':_0x4e28('0x51')});})[_0x4e28('0x25')](handleError(_0xe16cc6));};exports['transfer']=function(_0x1e99ba,_0x107a17){logger[_0x4e28('0x16')](_0x4e28('0x52'),_0x1e99ba[_0x4e28('0x32')]);var _0x1cd285=transferValidation['validate'](_0x1e99ba['body']);if(_0x1cd285[_0x4e28('0x2d')]>0x0){return _0x107a17['status'](0x190)[_0x4e28('0x33')](_0x1cd285);}var _0x27a848=_0x1e99ba['body'][_0x4e28('0x34')];var _0x5045e7=_0x1e99ba[_0x4e28('0x32')][_0x4e28('0x2c')];var _0x395b1f=_0x1e99ba[_0x4e28('0x32')][_0x4e28('0x53')];return getAgent(_0x27a848)['then'](function(_0x243a8f){logger[_0x4e28('0x16')](_0x4e28('0x38'),_0x243a8f[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x243a8f['name']),_0x4e28('0x54'),{'sessionId':_0x5045e7,'transferNumber':_0x395b1f});return _0x107a17[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x55')});})[_0x4e28('0x25')](handleError(_0x107a17));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 1513527..88bbbdf 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 _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 +var _0xcf2e=['connect-timeout','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAgents','addApplications','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x5ac1ea,_0xc4362b){var _0x6e545d=function(_0x42b9af){while(--_0x42b9af){_0x5ac1ea['push'](_0x5ac1ea['shift']());}};_0x6e545d(++_0xc4362b);}(_0xcf2e,0x18a));var _0xecf2=function(_0x37153e,_0x15c383){_0x37153e=_0x37153e-0x0;var _0x3d2981=_0xcf2e[_0x37153e];return _0x3d2981;};'use strict';var multer=require(_0xecf2('0x0'));var util=require(_0xecf2('0x1'));var path=require('path');var timeout=require(_0xecf2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xecf2('0x3'));var interaction=require(_0xecf2('0x4'));var config=require('../../config/environment');var controller=require(_0xecf2('0x5'));router[_0xecf2('0x6')]('/',auth[_0xecf2('0x7')](),controller[_0xecf2('0x8')]);router[_0xecf2('0x6')](_0xecf2('0x9'),auth[_0xecf2('0x7')](),controller['describe']);router['get'](_0xecf2('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xecf2('0xb'),auth[_0xecf2('0x7')](),controller[_0xecf2('0xc')]);router['get'](_0xecf2('0xd'),auth[_0xecf2('0x7')](),controller[_0xecf2('0xe')]);router[_0xecf2('0x6')](_0xecf2('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0xecf2('0x6')](_0xecf2('0x10'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x11')]);router['post']('/',auth[_0xecf2('0x7')](),controller['create']);router[_0xecf2('0x12')](_0xecf2('0xb'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x13')]);router['post'](_0xecf2('0xd'),auth[_0xecf2('0x7')](),controller['addAnswer']);router[_0xecf2('0x12')]('/:id/users',auth[_0xecf2('0x7')](),controller[_0xecf2('0x14')]);router[_0xecf2('0x12')](_0xecf2('0x10'),auth['isAuthenticated'](),controller[_0xecf2('0x15')]);router[_0xecf2('0x12')]('/:id/notify',controller[_0xecf2('0x16')]);router['post'](_0xecf2('0x17'),auth['isAuthenticated'](),controller[_0xecf2('0x18')]);router[_0xecf2('0x19')](_0xecf2('0xa'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1a')]);router[_0xecf2('0x1b')](_0xecf2('0xa'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1c')]);router[_0xecf2('0x1b')](_0xecf2('0xb'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1d')]);router['delete'](_0xecf2('0xd'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1e')]);router[_0xecf2('0x1b')]('/:id/users',auth[_0xecf2('0x7')](),controller[_0xecf2('0x1f')]);module[_0xecf2('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ec9b4de..5b0b1ae 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 _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 +var _0x8d40=['mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue'];(function(_0x2e96a6,_0x3f9579){var _0x363593=function(_0x48d13c){while(--_0x48d13c){_0x2e96a6['push'](_0x2e96a6['shift']());}};_0x363593(++_0x3f9579);}(_0x8d40,0x9b));var _0x08d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d40[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x08d4('0x0'));var rs=require('randomstring');module[_0x08d4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x08d4('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x08d4('0x3')]();}},'phone':{'type':Sequelize[_0x08d4('0x2')]},'type':{'type':Sequelize[_0x08d4('0x4')](_0x08d4('0x5'),_0x08d4('0x6'))},'accountSid':{'type':Sequelize[_0x08d4('0x2')]},'baseUrl':{'type':Sequelize[_0x08d4('0x2')]},'authToken':{'type':Sequelize[_0x08d4('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x08d4('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x08d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08d4('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x08d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x08d4('0x8')],'comment':_0x08d4('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x462c43){if(!_0x462c43){this['setDataValue'](_0x08d4('0xb'),null);}this[_0x08d4('0xc')](_0x08d4('0xd'),_0x462c43);}},'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 6f57a0f..f5b7bee 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 _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 +var _0x89f5=['nolimit','removeAnswers','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','receiveMessage','entity\x20found','debug','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','send','index','WhatsappAccount','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','Pause','mandatoryDispositionPause','rawAttributes','includeAll','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89f5,0x118));var _0x589f=function(_0x1e107b,_0x2849cf){_0x1e107b=_0x1e107b-0x0;var _0x19ebec=_0x89f5[_0x1e107b];return _0x19ebec;};'use strict';var emlformat=require(_0x589f('0x0'));var rimraf=require(_0x589f('0x1'));var zipdir=require(_0x589f('0x2'));var jsonpatch=require(_0x589f('0x3'));var rp=require('request-promise');var moment=require(_0x589f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x589f('0x5'));var path=require(_0x589f('0x6'));var sox=require(_0x589f('0x7'));var csv=require(_0x589f('0x8'));var ejs=require(_0x589f('0x9'));var fs=require('fs');var fs_extra=require(_0x589f('0xa'));var _=require(_0x589f('0xb'));var squel=require(_0x589f('0xc'));var crypto=require(_0x589f('0xd'));var jsforce=require(_0x589f('0xe'));var deskjs=require(_0x589f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x589f('0x10'));var Redis=require(_0x589f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x589f('0x12'));var as=require(_0x589f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x589f('0x14'))(_0x589f('0x15'));var utils=require(_0x589f('0x16'));var config=require(_0x589f('0x17'));var licenseUtil=require(_0x589f('0x18'));var db=require('../../mysqldb')['db'];config[_0x589f('0x19')]=_[_0x589f('0x1a')](config[_0x589f('0x19')],{'host':_0x589f('0x1b'),'port':0x18eb});var socket=require(_0x589f('0x1c'))(new Redis(config[_0x589f('0x19')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x589f('0x1d'));var client=jayson['client'][_0x589f('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x15475c,_0x451dee,_0x1366bb,_0xa48556){return new BPromise(function(_0x283772,_0x2ac926){var _0x47ec3c=_0xa48556||client;return _0x47ec3c[_0x589f('0x1f')](_0x15475c,_0x1366bb)[_0x589f('0x20')](function(_0x1cd752){logger[_0x589f('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x451dee,'request\x20sent');logger['debug'](_0x589f('0x22'),_0x451dee,_0x589f('0x23'),JSON[_0x589f('0x24')](_0x1cd752));if(_0x1cd752[_0x589f('0x25')]){if(_0x1cd752[_0x589f('0x25')][_0x589f('0x26')]===0x1f4){logger[_0x589f('0x25')](_0x589f('0x27'),_0x451dee,_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);return _0x2ac926(_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);}logger['error'](_0x589f('0x27'),_0x451dee,_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);return _0x283772(_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);}else{logger[_0x589f('0x21')](_0x589f('0x27'),_0x451dee,_0x589f('0x23'));_0x283772(_0x1cd752[_0x589f('0x29')][_0x589f('0x28')]);}})[_0x589f('0x2a')](function(_0x52a065){logger[_0x589f('0x25')](_0x589f('0x27'),_0x451dee,_0x52a065);_0x2ac926(_0x52a065);});});}function respondWithStatusCode(_0x5bb8ac,_0x25e999){_0x25e999=_0x25e999||0xcc;return function(_0x352648){if(_0x352648){return _0x5bb8ac[_0x589f('0x2b')](_0x25e999);}return _0x5bb8ac[_0x589f('0x2c')](_0x25e999)[_0x589f('0x2d')]();};}function respondWithResult(_0x2dc5ba,_0x268c1b){_0x268c1b=_0x268c1b||0xc8;return function(_0x43b340){if(_0x43b340){return _0x2dc5ba[_0x589f('0x2c')](_0x268c1b)[_0x589f('0x2e')](_0x43b340);}};}function respondWithFilteredResult(_0x48b0c2,_0x360495){return function(_0x316859){if(_0x316859){var _0x388c50=typeof _0x360495[_0x589f('0x2f')]===_0x589f('0x30')&&typeof _0x360495[_0x589f('0x31')]===_0x589f('0x30');var _0x40b0ab=_0x316859['count'];var _0x39b288=_0x388c50?0x0:_0x360495['offset'];var _0x1ceca3=_0x388c50?_0x316859[_0x589f('0x32')]:_0x360495[_0x589f('0x2f')]+_0x360495[_0x589f('0x31')];var _0x38cd4d;if(_0x1ceca3>=_0x40b0ab){_0x1ceca3=_0x40b0ab;_0x38cd4d=0xc8;}else{_0x38cd4d=0xce;}_0x48b0c2['status'](_0x38cd4d);return _0x48b0c2['set'](_0x589f('0x33'),_0x39b288+'-'+_0x1ceca3+'/'+_0x40b0ab)['json'](_0x316859);}return null;};}function patchUpdates(_0x4b2155){return function(_0x3ec884){try{jsonpatch[_0x589f('0x34')](_0x3ec884,_0x4b2155,!![]);}catch(_0x292b9e){return BPromise[_0x589f('0x35')](_0x292b9e);}return _0x3ec884[_0x589f('0x36')]();};}function saveUpdates(_0x58a909,_0x324789){return function(_0x12a6aa){if(_0x12a6aa){return _0x12a6aa[_0x589f('0x37')](_0x58a909)['then'](function(_0xbe754c){return _0xbe754c;});}return null;};}function removeEntity(_0x24ba47,_0x3d5394){return function(_0x38b1b9){if(_0x38b1b9){return _0x38b1b9[_0x589f('0x38')]()[_0x589f('0x20')](function(){var _0x44686c=_0x38b1b9[_0x589f('0x39')]({'plain':!![]});var _0x59e973=_0x589f('0x3a');return db['UserProfileResource'][_0x589f('0x38')]({'where':{'type':_0x59e973,'resourceId':_0x44686c['id']}})[_0x589f('0x20')](function(){return _0x38b1b9;});})[_0x589f('0x20')](function(){_0x24ba47['status'](0xcc)[_0x589f('0x2d')]();});}};}function handleEntityNotFound(_0x2590b0,_0x419413){return function(_0x12cf87){if(!_0x12cf87){_0x2590b0['sendStatus'](0x194);}return _0x12cf87;};}function handleError(_0xe9f759,_0xe2c4c7){_0xe2c4c7=_0xe2c4c7||0x1f4;return function(_0x4d0839){logger['error'](_0x4d0839[_0x589f('0x3b')]);if(_0x4d0839[_0x589f('0x3c')]){delete _0x4d0839['name'];}_0xe9f759['status'](_0xe2c4c7)[_0x589f('0x3d')](_0x4d0839);};}exports[_0x589f('0x3e')]=function(_0x4590fa,_0x13400e){var _0xa81305={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4a700d={},_0x37d0e7={'count':0x0,'rows':[]};var _0x54b857=_['map'](db[_0x589f('0x3f')]['rawAttributes'],function(_0x26d684){return{'name':_0x26d684[_0x589f('0x40')],'type':_0x26d684[_0x589f('0x41')][_0x589f('0x42')]};});_0x4a700d[_0x589f('0x43')]=_[_0x589f('0x44')](_0x54b857,_0x589f('0x3c'));_0x4a700d['query']=_[_0x589f('0x45')](_0x4590fa['query']);_0x4a700d[_0x589f('0x46')]=_['intersection'](_0x4a700d['model'],_0x4a700d[_0x589f('0x47')]);_0xa81305[_0x589f('0x48')]=_[_0x589f('0x49')](_0x4a700d[_0x589f('0x43')],qs[_0x589f('0x4a')](_0x4590fa['query']['fields']));_0xa81305[_0x589f('0x48')]=_0xa81305['attributes'][_0x589f('0x4b')]?_0xa81305['attributes']:_0x4a700d[_0x589f('0x43')];if(!_0x4590fa[_0x589f('0x47')][_0x589f('0x4c')]('nolimit')){_0xa81305[_0x589f('0x31')]=qs['limit'](_0x4590fa[_0x589f('0x47')][_0x589f('0x31')]);_0xa81305[_0x589f('0x2f')]=qs[_0x589f('0x2f')](_0x4590fa[_0x589f('0x47')]['offset']);}_0xa81305[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x4590fa[_0x589f('0x47')][_0x589f('0x4e')]);_0xa81305[_0x589f('0x4f')]=qs['filters'](_[_0x589f('0x50')](_0x4590fa[_0x589f('0x47')],_0x4a700d[_0x589f('0x46')]),_0x54b857);if(_0x4590fa['query'][_0x589f('0x51')]){_0xa81305[_0x589f('0x4f')]=_['merge'](_0xa81305[_0x589f('0x4f')],{'$or':_[_0x589f('0x44')](_0x54b857,function(_0x244c47){if(_0x244c47[_0x589f('0x41')]!=='VIRTUAL'){var _0x42910b={};_0x42910b[_0x244c47[_0x589f('0x3c')]]={'$like':'%'+_0x4590fa[_0x589f('0x47')]['filter']+'%'};return _0x42910b;}})});}_0xa81305=_[_0x589f('0x52')]({},_0xa81305,_0x4590fa[_0x589f('0x53')]);var _0x2dc894={'where':_0xa81305[_0x589f('0x4f')]};return db['WhatsappAccount']['count'](_0x2dc894)[_0x589f('0x20')](function(_0x2ab358){_0x37d0e7[_0x589f('0x32')]=_0x2ab358;if(_0x4590fa[_0x589f('0x47')]['includeAll']){_0xa81305[_0x589f('0x54')]=[{'all':!![]}];}return db[_0x589f('0x3f')][_0x589f('0x55')](_0xa81305);})['then'](function(_0x343f76){_0x37d0e7[_0x589f('0x56')]=_0x343f76;return _0x37d0e7;})['then'](respondWithFilteredResult(_0x13400e,_0xa81305))[_0x589f('0x2a')](handleError(_0x13400e,null));};exports['show']=function(_0x38b711,_0x3dc44f){var _0x18b52a={'raw':![],'where':{'id':_0x38b711[_0x589f('0x57')]['id']},'include':[{'model':db[_0x589f('0x58')],'as':_0x589f('0x59')}]},_0x42fa89={};_0x42fa89[_0x589f('0x43')]=_[_0x589f('0x45')](db[_0x589f('0x3f')][_0x589f('0x5a')]);_0x42fa89[_0x589f('0x47')]=_['keys'](_0x38b711[_0x589f('0x47')]);_0x42fa89['filters']=_[_0x589f('0x49')](_0x42fa89[_0x589f('0x43')],_0x42fa89[_0x589f('0x47')]);_0x18b52a['attributes']=_[_0x589f('0x49')](_0x42fa89['model'],qs[_0x589f('0x4a')](_0x38b711[_0x589f('0x47')][_0x589f('0x4a')]));_0x18b52a['attributes']=_0x18b52a[_0x589f('0x48')][_0x589f('0x4b')]?_0x18b52a['attributes']:_0x42fa89[_0x589f('0x43')];if(_0x38b711[_0x589f('0x47')][_0x589f('0x5b')]){_0x18b52a[_0x589f('0x54')]=[{'all':!![]}];}_0x18b52a=_[_0x589f('0x52')]({},_0x18b52a,_0x38b711[_0x589f('0x53')]);return db['WhatsappAccount']['find'](_0x18b52a)['then'](handleEntityNotFound(_0x3dc44f,null))['then'](respondWithResult(_0x3dc44f,null))['catch'](handleError(_0x3dc44f,null));};exports['create']=function(_0x1d44a5,_0x31b44f){return db['WhatsappAccount'][_0x589f('0x5c')](_0x1d44a5[_0x589f('0x5d')],{})[_0x589f('0x20')](function(_0x95356e){var _0x5b8da6=_0x1d44a5[_0x589f('0x5e')]['get']({'plain':!![]});if(!_0x5b8da6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b8da6['role']===_0x589f('0x5e')){var _0x21cf76=_0x95356e[_0x589f('0x39')]({'plain':!![]});var _0x3c614f=_0x589f('0x3a');return db[_0x589f('0x5f')][_0x589f('0x60')]({'where':{'name':_0x3c614f,'userProfileId':_0x5b8da6[_0x589f('0x61')]},'raw':!![]})[_0x589f('0x20')](function(_0x3fa938){if(_0x3fa938&&_0x3fa938[_0x589f('0x62')]===0x0){return db[_0x589f('0x63')]['create']({'name':_0x21cf76[_0x589f('0x3c')],'resourceId':_0x21cf76['id'],'type':_0x3fa938[_0x589f('0x3c')],'sectionId':_0x3fa938['id']},{})[_0x589f('0x20')](function(){return _0x95356e;});}else{return _0x95356e;}})['catch'](function(_0x117d27){logger[_0x589f('0x25')](_0x589f('0x64'),_0x117d27);throw _0x117d27;});}return _0x95356e;})[_0x589f('0x20')](respondWithResult(_0x31b44f,0xc9))[_0x589f('0x2a')](handleError(_0x31b44f,null));};exports[_0x589f('0x37')]=function(_0x43b5be,_0x4217c3){if(_0x43b5be[_0x589f('0x5d')]['id']){delete _0x43b5be[_0x589f('0x5d')]['id'];}return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x43b5be[_0x589f('0x57')]['id']},'include':[{'model':db[_0x589f('0x58')],'as':_0x589f('0x59')}]})[_0x589f('0x20')](handleEntityNotFound(_0x4217c3,null))[_0x589f('0x20')](saveUpdates(_0x43b5be[_0x589f('0x5d')],null))['then'](respondWithResult(_0x4217c3,null))['catch'](handleError(_0x4217c3,null));};exports[_0x589f('0x38')]=function(_0x2ab7d6,_0x51a0d6){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x2ab7d6[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x51a0d6,null))[_0x589f('0x20')](removeEntity(_0x51a0d6,null))[_0x589f('0x2a')](handleError(_0x51a0d6,null));};exports[_0x589f('0x65')]=function(_0xd11d20,_0x2b3044){return db[_0x589f('0x3f')][_0x589f('0x65')]()[_0x589f('0x20')](respondWithResult(_0x2b3044,null))[_0x589f('0x2a')](handleError(_0x2b3044,null));};exports[_0x589f('0x66')]=function(_0x3a7b89,_0x336ed4,_0x4f7f65){if(_0x3a7b89[_0x589f('0x5d')]['id']){delete _0x3a7b89[_0x589f('0x5d')]['id'];}return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x3a7b89[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x336ed4,null))['then'](function(_0x5a3c98){if(_0x5a3c98){_0x3a7b89[_0x589f('0x5d')][_0x589f('0x67')]=_0x5a3c98['id'];return db['Disposition'][_0x589f('0x5c')](_0x3a7b89[_0x589f('0x5d')]);}})[_0x589f('0x20')](respondWithResult(_0x336ed4,null))[_0x589f('0x2a')](handleError(_0x336ed4,null));};exports[_0x589f('0x68')]=function(_0x1bc5b4,_0x2cc457,_0x1dd128){var _0x2c6013={'raw':![],'where':{}};var _0x2772f8={};var _0x37801b={'count':0x0,'rows':[]};return db[_0x589f('0x3f')][_0x589f('0x69')]({'where':{'id':_0x1bc5b4[_0x589f('0x57')]['id']}})['then'](handleEntityNotFound(_0x2cc457,null))[_0x589f('0x20')](function(_0x45da04){if(_0x45da04){_0x2772f8[_0x589f('0x43')]=_[_0x589f('0x45')](db['Disposition'][_0x589f('0x5a')]);_0x2772f8[_0x589f('0x47')]=_[_0x589f('0x45')](_0x1bc5b4[_0x589f('0x47')]);_0x2772f8[_0x589f('0x46')]=_[_0x589f('0x49')](_0x2772f8[_0x589f('0x43')],_0x2772f8[_0x589f('0x47')]);_0x2c6013[_0x589f('0x48')]=_[_0x589f('0x49')](_0x2772f8['model'],qs['fields'](_0x1bc5b4[_0x589f('0x47')][_0x589f('0x4a')]));_0x2c6013[_0x589f('0x48')]=_0x2c6013['attributes'][_0x589f('0x4b')]?_0x2c6013['attributes']:_0x2772f8['model'];if(!_0x1bc5b4[_0x589f('0x47')][_0x589f('0x4c')]('nolimit')){_0x2c6013[_0x589f('0x31')]=qs[_0x589f('0x31')](_0x1bc5b4[_0x589f('0x47')]['limit']);_0x2c6013[_0x589f('0x2f')]=qs['offset'](_0x1bc5b4['query']['offset']);}_0x2c6013[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x1bc5b4[_0x589f('0x47')][_0x589f('0x4e')]);_0x2c6013[_0x589f('0x4f')]=qs[_0x589f('0x46')](_[_0x589f('0x50')](_0x1bc5b4[_0x589f('0x47')],_0x2772f8[_0x589f('0x46')]));_0x2c6013[_0x589f('0x4f')]['WhatsappAccountId']=_0x45da04['id'];if(_0x1bc5b4[_0x589f('0x47')][_0x589f('0x51')]){_0x2c6013['where']=_['merge'](_0x2c6013['where'],{'$or':_['map'](_0x2c6013[_0x589f('0x48')],function(_0xc25d3e){var _0x24f7ce={};_0x24f7ce[_0xc25d3e]={'$like':'%'+_0x1bc5b4[_0x589f('0x47')][_0x589f('0x51')]+'%'};return _0x24f7ce;})});}_0x2c6013=_[_0x589f('0x52')]({},_0x2c6013,_0x1bc5b4[_0x589f('0x53')]);return db[_0x589f('0x6a')][_0x589f('0x32')]({'where':_0x2c6013[_0x589f('0x4f')]})[_0x589f('0x20')](function(_0x462e19){_0x37801b[_0x589f('0x32')]=_0x462e19;if(_0x1bc5b4[_0x589f('0x47')][_0x589f('0x5b')]){_0x2c6013[_0x589f('0x54')]=[{'all':!![]}];}return db[_0x589f('0x6a')][_0x589f('0x55')](_0x2c6013);})[_0x589f('0x20')](function(_0x51f68d){_0x37801b[_0x589f('0x56')]=_0x51f68d;return _0x37801b;});}})[_0x589f('0x20')](respondWithFilteredResult(_0x2cc457,_0x2c6013))[_0x589f('0x2a')](handleError(_0x2cc457,null));};exports[_0x589f('0x6b')]=function(_0x1bbae1,_0x38944e,_0x199448){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x1bbae1[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x38944e,null))[_0x589f('0x20')](function(_0x4830e3){if(_0x4830e3){return _0x4830e3[_0x589f('0x6b')](_0x1bbae1[_0x589f('0x47')][_0x589f('0x6c')]);}})['then'](respondWithStatusCode(_0x38944e,null))[_0x589f('0x2a')](handleError(_0x38944e,null));};exports[_0x589f('0x6d')]=function(_0x3dd068,_0x287d65,_0x42ba04){if(_0x3dd068['body']['id']){delete _0x3dd068['body']['id'];}return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x3dd068[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x287d65,null))[_0x589f('0x20')](function(_0x3232ed){if(_0x3232ed){_0x3dd068['body']['WhatsappAccountId']=_0x3232ed['id'];return db[_0x589f('0x6e')][_0x589f('0x5c')](_0x3dd068[_0x589f('0x5d')]);}})[_0x589f('0x20')](respondWithResult(_0x287d65,null))['catch'](handleError(_0x287d65,null));};exports[_0x589f('0x6f')]=function(_0x4e4371,_0x383937,_0x192f21){var _0x468bf2={'raw':![],'where':{}};var _0x388f59={};var _0x54dc65={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x589f('0x69')]({'where':{'id':_0x4e4371[_0x589f('0x57')]['id']}})['then'](handleEntityNotFound(_0x383937,null))[_0x589f('0x20')](function(_0x4981b7){if(_0x4981b7){_0x388f59[_0x589f('0x43')]=_[_0x589f('0x45')](db[_0x589f('0x6e')][_0x589f('0x5a')]);_0x388f59['query']=_[_0x589f('0x45')](_0x4e4371[_0x589f('0x47')]);_0x388f59[_0x589f('0x46')]=_[_0x589f('0x49')](_0x388f59[_0x589f('0x43')],_0x388f59[_0x589f('0x47')]);_0x468bf2[_0x589f('0x48')]=_[_0x589f('0x49')](_0x388f59[_0x589f('0x43')],qs[_0x589f('0x4a')](_0x4e4371[_0x589f('0x47')]['fields']));_0x468bf2['attributes']=_0x468bf2[_0x589f('0x48')][_0x589f('0x4b')]?_0x468bf2[_0x589f('0x48')]:_0x388f59[_0x589f('0x43')];if(!_0x4e4371[_0x589f('0x47')][_0x589f('0x4c')](_0x589f('0x70'))){_0x468bf2[_0x589f('0x31')]=qs[_0x589f('0x31')](_0x4e4371['query'][_0x589f('0x31')]);_0x468bf2['offset']=qs['offset'](_0x4e4371[_0x589f('0x47')][_0x589f('0x2f')]);}_0x468bf2[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x4e4371[_0x589f('0x47')]['sort']);_0x468bf2['where']=qs[_0x589f('0x46')](_[_0x589f('0x50')](_0x4e4371[_0x589f('0x47')],_0x388f59[_0x589f('0x46')]));_0x468bf2[_0x589f('0x4f')][_0x589f('0x67')]=_0x4981b7['id'];if(_0x4e4371[_0x589f('0x47')][_0x589f('0x51')]){_0x468bf2['where']=_[_0x589f('0x52')](_0x468bf2[_0x589f('0x4f')],{'$or':_[_0x589f('0x44')](_0x468bf2[_0x589f('0x48')],function(_0x2ce375){var _0x28bc3d={};_0x28bc3d[_0x2ce375]={'$like':'%'+_0x4e4371[_0x589f('0x47')]['filter']+'%'};return _0x28bc3d;})});}_0x468bf2=_[_0x589f('0x52')]({},_0x468bf2,_0x4e4371[_0x589f('0x53')]);return db[_0x589f('0x6e')][_0x589f('0x32')]({'where':_0x468bf2[_0x589f('0x4f')]})[_0x589f('0x20')](function(_0x282ce4){_0x54dc65[_0x589f('0x32')]=_0x282ce4;if(_0x4e4371[_0x589f('0x47')]['includeAll']){_0x468bf2[_0x589f('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x589f('0x55')](_0x468bf2);})[_0x589f('0x20')](function(_0x1fa7be){_0x54dc65[_0x589f('0x56')]=_0x1fa7be;return _0x54dc65;});}})[_0x589f('0x20')](respondWithFilteredResult(_0x383937,_0x468bf2))[_0x589f('0x2a')](handleError(_0x383937,null));};exports['removeAnswers']=function(_0x5b99c3,_0xd17186,_0x50d6ec){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x5b99c3[_0x589f('0x57')]['id']}})['then'](handleEntityNotFound(_0xd17186,null))[_0x589f('0x20')](function(_0x251e24){if(_0x251e24){return _0x251e24[_0x589f('0x71')](_0x5b99c3['query']['ids']);}})[_0x589f('0x20')](respondWithStatusCode(_0xd17186,null))[_0x589f('0x2a')](handleError(_0xd17186,null));};exports['addAgents']=function(_0x4d335c,_0x2ee51d,_0x52a7d8){return db['WhatsappAccount'][_0x589f('0x60')]({'where':{'id':_0x4d335c[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x2ee51d,null))[_0x589f('0x20')](function(_0x344171){if(_0x344171){return _0x344171['addAgents'](_0x4d335c[_0x589f('0x5d')][_0x589f('0x6c')],_[_0x589f('0x72')](_0x4d335c[_0x589f('0x5d')],[_0x589f('0x6c'),'id'])||{})['spread'](function(_0x3b1054){for(var _0x4a4847=0x0;_0x4a4847<_0x4d335c[_0x589f('0x5d')]['ids']['length'];_0x4a4847+=0x1){socket[_0x589f('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x4d335c[_0x589f('0x5d')]['ids'][_0x4a4847]),'WhatsappAccountId':Number(_0x4d335c[_0x589f('0x57')]['id'])});}return _0x3b1054;});}})[_0x589f('0x20')](respondWithResult(_0x2ee51d,null))[_0x589f('0x2a')](handleError(_0x2ee51d,null));};exports[_0x589f('0x74')]=function(_0x4b1864,_0xf085ec,_0xabf27a){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x4b1864['params']['id']}})[_0x589f('0x20')](handleEntityNotFound(_0xf085ec,null))[_0x589f('0x20')](function(_0x5197de){if(_0x5197de){return _0x5197de[_0x589f('0x74')](_0x4b1864['query'][_0x589f('0x6c')])[_0x589f('0x20')](function(){if(_['isArray'](_0x4b1864[_0x589f('0x47')][_0x589f('0x6c')])){for(var _0x57e173=0x0;_0x57e173<_0x4b1864[_0x589f('0x47')][_0x589f('0x6c')][_0x589f('0x4b')];_0x57e173+=0x1){socket['emit'](_0x589f('0x75'),{'UserId':Number(_0x4b1864[_0x589f('0x47')]['ids'][_0x57e173]),'WhatsappAccountId':Number(_0x4b1864[_0x589f('0x57')]['id'])});}}else{socket[_0x589f('0x73')](_0x589f('0x75'),{'UserId':Number(_0x4b1864[_0x589f('0x47')][_0x589f('0x6c')]),'WhatsappAccountId':Number(_0x4b1864[_0x589f('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0xf085ec,null))[_0x589f('0x2a')](handleError(_0xf085ec,null));};exports[_0x589f('0x76')]=function(_0x10f03a,_0x2a23ec,_0x16335e){var _0x129e9d={};var _0x4e7e38={};var _0x1db3d3;var _0x530f71;return db[_0x589f('0x3f')][_0x589f('0x69')]({'where':{'id':_0x10f03a[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x2a23ec,null))['then'](function(_0x24415f){if(_0x24415f){_0x1db3d3=_0x24415f;_0x4e7e38[_0x589f('0x43')]=_['keys'](db[_0x589f('0x77')]['rawAttributes']);_0x4e7e38[_0x589f('0x47')]=_[_0x589f('0x45')](_0x10f03a[_0x589f('0x47')]);_0x4e7e38[_0x589f('0x46')]=_['intersection'](_0x4e7e38[_0x589f('0x43')],_0x4e7e38[_0x589f('0x47')]);_0x129e9d[_0x589f('0x48')]=_['intersection'](_0x4e7e38[_0x589f('0x43')],qs[_0x589f('0x4a')](_0x10f03a[_0x589f('0x47')][_0x589f('0x4a')]));_0x129e9d['attributes']=_0x129e9d[_0x589f('0x48')]['length']?_0x129e9d[_0x589f('0x48')]:_0x4e7e38[_0x589f('0x43')];_0x129e9d[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x10f03a['query'][_0x589f('0x4e')]);_0x129e9d[_0x589f('0x4f')]=qs['filters'](_[_0x589f('0x50')](_0x10f03a[_0x589f('0x47')],_0x4e7e38[_0x589f('0x46')]));if(_0x10f03a[_0x589f('0x47')][_0x589f('0x51')]){_0x129e9d['where']=_[_0x589f('0x52')](_0x129e9d['where'],{'$or':_[_0x589f('0x44')](_0x129e9d['attributes'],function(_0x3f79c6){var _0x120c1e={};_0x120c1e[_0x3f79c6]={'$like':'%'+_0x10f03a[_0x589f('0x47')]['filter']+'%'};return _0x120c1e;})});}_0x129e9d=_['merge']({},_0x129e9d,_0x10f03a[_0x589f('0x53')]);return _0x1db3d3['getAgents'](_0x129e9d);}})[_0x589f('0x20')](function(_0x135bba){if(_0x135bba){_0x530f71=_0x135bba[_0x589f('0x4b')];if(!_0x10f03a[_0x589f('0x47')][_0x589f('0x4c')](_0x589f('0x70'))){_0x129e9d[_0x589f('0x31')]=qs['limit'](_0x10f03a[_0x589f('0x47')][_0x589f('0x31')]);_0x129e9d[_0x589f('0x2f')]=qs[_0x589f('0x2f')](_0x10f03a[_0x589f('0x47')][_0x589f('0x2f')]);}return _0x1db3d3[_0x589f('0x76')](_0x129e9d);}})[_0x589f('0x20')](function(_0x24ffb2){if(_0x24ffb2){return _0x24ffb2?{'count':_0x530f71,'rows':_0x24ffb2}:null;}})[_0x589f('0x20')](respondWithResult(_0x2a23ec,null))[_0x589f('0x2a')](handleError(_0x2a23ec,null));};exports[_0x589f('0x78')]=function(_0x29a935,_0x56d1dd){var _0xa249cf=_0x29a935['params']['id'];var _0x2e08f8=_0x29a935[_0x589f('0x5d')];var _0x730c85=0xc8;var _0x2dd339=null;return db[_0x589f('0x79')][_0x589f('0x7a')]({'isolationLevel':db[_0x589f('0x79')]['Transaction'][_0x589f('0x7b')][_0x589f('0x7c')]},function(_0x1d2bbb){return db[_0x589f('0x3f')][_0x589f('0x69')]({'where':{'id':_0xa249cf},'transaction':_0x1d2bbb})['then'](function(_0xde659){if(_0xde659){return db[_0x589f('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0xa249cf},'transaction':_0x1d2bbb})[_0x589f('0x20')](function(){var _0x8a3ae7=_['map'](_0x2e08f8,function(_0x3aef6f){_0x3aef6f[_0x589f('0x67')]=_0xa249cf;return _0x3aef6f;});return db[_0x589f('0x7d')][_0x589f('0x7e')](_0x8a3ae7,{'transaction':_0x1d2bbb});});}else{_0x730c85=0x194;_0x2dd339=[];}});})['then'](function(){if(_0x730c85!==0x194){return db[_0x589f('0x7d')][_0x589f('0x7f')]({'where':{'WhatsappAccountId':_0xa249cf},'order':_0x589f('0x80')})[_0x589f('0x20')](function(_0x3a45df){_0x2dd339=_0x3a45df;});}})['catch'](function(_0x5846ae){_0x730c85=0x1f4;logger[_0x589f('0x25')](_0x5846ae[_0x589f('0x3b')]);if(_0x5846ae['name']){delete _0x5846ae[_0x589f('0x3c')];}_0x2dd339=_0x5846ae;})[_0x589f('0x81')](function(){if(_0x2dd339===null){_0x56d1dd[_0x589f('0x2b')](_0x730c85);}else{if(_0x730c85===0x1f4){_0x56d1dd[_0x589f('0x2c')](_0x730c85)['send'](_0x2dd339);}else{_0x56d1dd[_0x589f('0x2c')](_0x730c85)[_0x589f('0x2e')](_0x2dd339);}}});};exports['getApplications']=function(_0x10c2dd,_0x5c47a7,_0x4b49da){var _0x387bf0={};var _0x74b195={};var _0x4a0e7f;var _0x55f198;return db[_0x589f('0x3f')]['findOne']({'where':{'id':_0x10c2dd[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x5c47a7,null))[_0x589f('0x20')](function(_0x2ec975){if(_0x2ec975){_0x4a0e7f=_0x2ec975;_0x74b195['model']=_[_0x589f('0x45')](db[_0x589f('0x7d')][_0x589f('0x5a')]);_0x74b195[_0x589f('0x47')]=_[_0x589f('0x45')](_0x10c2dd[_0x589f('0x47')]);_0x74b195[_0x589f('0x46')]=_[_0x589f('0x49')](_0x74b195[_0x589f('0x43')],_0x74b195[_0x589f('0x47')]);_0x387bf0[_0x589f('0x48')]=_[_0x589f('0x49')](_0x74b195['model'],qs[_0x589f('0x4a')](_0x10c2dd[_0x589f('0x47')]['fields']));_0x387bf0[_0x589f('0x48')]=_0x387bf0[_0x589f('0x48')][_0x589f('0x4b')]?_0x387bf0['attributes']:_0x74b195[_0x589f('0x43')];_0x387bf0[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x10c2dd['query'][_0x589f('0x4e')]);_0x387bf0['where']=qs[_0x589f('0x46')](_['pick'](_0x10c2dd[_0x589f('0x47')],_0x74b195['filters']));if(_0x10c2dd[_0x589f('0x47')]['filter']){_0x387bf0[_0x589f('0x4f')]=_['merge'](_0x387bf0[_0x589f('0x4f')],{'$or':_[_0x589f('0x44')](_0x387bf0[_0x589f('0x48')],function(_0x480051){var _0x2168fc={};_0x2168fc[_0x480051]={'$like':'%'+_0x10c2dd[_0x589f('0x47')][_0x589f('0x51')]+'%'};return _0x2168fc;})});}_0x387bf0=_[_0x589f('0x52')]({},_0x387bf0,_0x10c2dd[_0x589f('0x53')]);return _0x4a0e7f['getApplications'](_0x387bf0);}})[_0x589f('0x20')](function(_0x30847b){if(_0x30847b){_0x55f198=_0x30847b[_0x589f('0x4b')];if(!_0x10c2dd[_0x589f('0x47')]['hasOwnProperty'](_0x589f('0x70'))){_0x387bf0[_0x589f('0x31')]=qs['limit'](_0x10c2dd[_0x589f('0x47')][_0x589f('0x31')]);_0x387bf0[_0x589f('0x2f')]=qs[_0x589f('0x2f')](_0x10c2dd[_0x589f('0x47')][_0x589f('0x2f')]);}return _0x4a0e7f[_0x589f('0x82')](_0x387bf0);}})['then'](function(_0x2bdce7){if(_0x2bdce7){return _0x2bdce7?{'count':_0x55f198,'rows':_0x2bdce7}:null;}})['then'](respondWithResult(_0x5c47a7,null))[_0x589f('0x2a')](handleError(_0x5c47a7,null));};exports[_0x589f('0x83')]=function(_0x451ade,_0x21ef19,_0x357cf9){var _0x55b086={'channel':_0x589f('0x84')};var _0x28f99=[];var _0x1d0b55=[];var _0xf9a37d={};return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x451ade['params']['id']},'include':[{'model':db[_0x589f('0x7d')],'as':_0x589f('0x85')}]})['then'](handleEntityNotFound(_0x21ef19,null))[_0x589f('0x20')](function(_0x243f16){_0x55b086[_0x589f('0x86')]=_0x243f16;if(_0x55b086[_0x589f('0x86')]&&_0x55b086['account']['type']==='sinch'&&_0x451ade[_0x589f('0x5d')][_0x589f('0x87')]){if(_0x451ade['body'][_0x589f('0x87')][_0x589f('0x4b')]===0x0)return;if(_0x451ade[_0x589f('0x5d')][_0x589f('0x87')][0x0][_0x589f('0x88')]!==_0x589f('0x89'))return;return db[_0x589f('0x8a')][_0x589f('0x37')]({'read':!![],'readAt':_0x451ade[_0x589f('0x5d')][_0x589f('0x87')][0x0][_0x589f('0x8b')]},{'where':{'messageId':_0x451ade['body'][_0x589f('0x87')][0x0][_0x589f('0x8c')]},'individualHooks':!![]})[_0x589f('0x20')](function(_0x43fb69){return _0x21ef19[_0x589f('0x2c')](0xc8)['json'](_0x43fb69);});}_0x55b086[_0x589f('0x8d')]=_[_0x589f('0x8e')](_0x243f16[_0x589f('0x85')],[_0x589f('0x80')],[_0x589f('0x8f')]);if(_0x55b086[_0x589f('0x86')]['Applications']){delete _0x55b086[_0x589f('0x86')][_0x589f('0x85')];}return db[_0x589f('0x90')][_0x589f('0x65')]()[_0x589f('0x20')](function(_0x11bcda){if(!_0x11bcda){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))](_0x589f('0x93'));}_0x28f99=_[_0x589f('0x94')](_[_0x589f('0x45')](_0x11bcda),[_0x589f('0x95'),_0x589f('0x96')]);_0x1d0b55=_[_0x589f('0x94')](_[_0x589f('0x45')](_0x11bcda),[_0x589f('0x95'),_0x589f('0x96'),_0x589f('0x97'),_0x589f('0x98')]);_0x55b086[_0x589f('0x5d')]={'mapKey':'mobile'};if(_0x55b086[_0x589f('0x86')]&&_0x55b086[_0x589f('0x86')][_0x589f('0x41')]===_0x589f('0x99')){_0x55b086[_0x589f('0x5d')][_0x589f('0x9a')]=_0x451ade[_0x589f('0x5d')]['From']['replace'](_0x589f('0x9b'),'');_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9c')];_0x55b086[_0x589f('0x5d')][_0x589f('0x9d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9e')];}if(_0x55b086[_0x589f('0x86')]&&_0x55b086[_0x589f('0x86')][_0x589f('0x41')]==='sinch'){_0x55b086[_0x589f('0x5d')]['from']=_0x451ade[_0x589f('0x5d')][_0x589f('0x9f')][0x0][_0x589f('0x9a')];_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9f')][0x0][_0x589f('0x28')][_0x589f('0x5d')];_0x55b086[_0x589f('0x5d')][_0x589f('0x9d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9f')][0x0][_0x589f('0x8c')];}if(_0x55b086[_0x589f('0x5d')]['id']){delete _0x55b086[_0x589f('0x5d')]['id'];}if(_[_0x589f('0xa0')](_0x55b086[_0x589f('0x5d')][_0x589f('0x9a')])){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))](_0x589f('0xa1'));}if(_[_0x589f('0xa0')](_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')])||_0x55b086['body'][_0x589f('0x5d')]===''){throw new db['Sequelize'][(_0x589f('0x92'))](_0x589f('0xa2'));}if(_[_0x589f('0xa0')](_0x55b086[_0x589f('0x5d')][_0x589f('0xa3')])){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1d0b55);}if(!_[_0x589f('0xa4')](_0x1d0b55,_0x55b086[_0x589f('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x589f('0x92'))](_0x589f('0xa5')+_0x1d0b55);}_0xf9a37d[_0x55b086[_0x589f('0x5d')][_0x589f('0xa3')]]=_0x55b086['body'][_0x589f('0x9a')];return db[_0x589f('0xa6')][_0x589f('0x60')]({'where':{'id':_0x55b086[_0x589f('0x86')][_0x589f('0x98')]},'include':[{'model':db[_0x589f('0x90')],'as':_0x589f('0xa7'),'where':_0xf9a37d,'limit':0x1,'order':[[_0x589f('0x96'),_0x589f('0xa8')]]}]});})[_0x589f('0x20')](handleEntityNotFound(_0x21ef19,null))[_0x589f('0x20')](function(_0x2e630f){if(_0x2e630f){_0x55b086[_0x589f('0xa9')]=_[_0x589f('0x72')](_0x2e630f,[_0x589f('0xa7')]);if(_0x2e630f[_0x589f('0xa7')]['length']){return _0x2e630f[_0x589f('0xa7')][0x0];}var _0x1c82bf=_[_0x589f('0x1a')](_0x55b086[_0x589f('0x5d')],{'firstName':_0x55b086[_0x589f('0x5d')][_0x589f('0x9a')],'ListId':_0x2e630f['id']});_0x1c82bf[_0x55b086[_0x589f('0x5d')][_0x589f('0xa3')]]=_0x55b086[_0x589f('0x5d')]['from'];return db[_0x589f('0x90')]['create'](_0x1c82bf,{'fields':_0x28f99,'raw':!![]});}})[_0x589f('0x20')](handleEntityNotFound(_0x21ef19,null))['then'](function(_0x433076){if(_0x433076){_0x55b086['contact']=_0x433076;var _0x370718={'ContactId':_0x433076['id'],'phone':_0x55b086['body'][_0x589f('0x9a')],'WhatsappAccountId':_0x451ade['params']['id']};var _0xe410f8={'ContactId':_0x433076['id'],'WhatsappAccountId':_0x451ade[_0x589f('0x57')]['id'],'closed':![]};return db[_0x589f('0xaa')][_0x589f('0x60')]({'where':_0xe410f8})[_0x589f('0x20')](function(_0x5c3167){if(_0x5c3167){return[_0x5c3167,![]];}return db['WhatsappInteraction'][_0x589f('0x5c')](_0x370718)[_0x589f('0x20')](function(_0x73169e){return[_0x73169e,!![]];});});}})[_0x589f('0xab')](function(_0x652c57,_0x4c8f82){_0x55b086[_0x589f('0xac')]=_0x652c57[_0x589f('0x39')]({'plain':!![]});_0x55b086[_0x589f('0xac')][_0x589f('0xad')]=![];if(_0x4c8f82){if(_0x55b086[_0x589f('0x86')]['autoclose']){_0x55b086['applications']['push']({'id':0x0,'priority':_0x55b086[_0x589f('0x8d')][_0x589f('0x4b')]+0x1,'app':_0x589f('0xae'),'appdata':_0x589f('0xaf'),'interval':_0x589f('0xb0')});}_0x55b086[_0x589f('0xac')][_0x589f('0xad')]=!![];}return db['WhatsappMessage'][_0x589f('0x5c')]({'phone':_0x55b086[_0x589f('0x5d')]['from'],'messageId':_0x55b086[_0x589f('0x5d')]['messageId'],'body':_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')],'WhatsappAccountId':_0x451ade[_0x589f('0x57')]['id'],'WhatsappInteractionId':_0x652c57['id'],'direction':'in','ContactId':_0x652c57[_0x589f('0xb1')],'AttachmentId':_0x55b086[_0x589f('0x5d')][_0x589f('0xb2')]});})['then'](function(_0x1bf8f4){_0x55b086[_0x589f('0x28')]=_0x1bf8f4;if(!_0x55b086['interaction'][_0x589f('0xb3')])return;return db[_0x589f('0x77')][_0x589f('0x60')]({'attributes':['id','name'],'where':{'id':_0x55b086['interaction'][_0x589f('0xb3')]}});})[_0x589f('0x20')](function(_0x51cf1f){if(_0x51cf1f){_0x55b086['applications'][_0x589f('0xb4')]({'id':0x0,'priority':0x0,'app':_0x589f('0xb5'),'appdata':_0x51cf1f[_0x589f('0x3c')]+','+(_0x55b086[_0x589f('0x86')][_0x589f('0xb6')]||0xa),'interval':_0x589f('0xb0')});}if(!_0x55b086[_0x589f('0xac')][_0x589f('0xb7')])return;return db[_0x589f('0xb8')][_0x589f('0x60')]({'attributes':['id',_0x589f('0x3c')],'where':{'id':_0x55b086[_0x589f('0xac')][_0x589f('0xb7')]}});})[_0x589f('0x20')](function(_0x1570b3){if(_0x1570b3){_0x55b086[_0x589f('0x8d')][_0x589f('0xb4')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1570b3['name']+','+(_0x55b086['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x589f('0xb0')});}return respondWithRpcPromise('Start','startRouting',_0x55b086);})['then'](function(_0x51e2ca){if(_0x51e2ca){var _0x1ab0da=0xc8;var _0x575722=_0x589f('0xb9');logger[_0x589f('0x21')](_0x589f('0x22'),_0x575722,_0x1ab0da,_0x589f('0xba'));logger[_0x589f('0xbb')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x575722,_0x1ab0da,_0x589f('0xba'),JSON[_0x589f('0x24')](_0x51e2ca));if(_0x55b086['account'][_0x589f('0x41')]==='twilio'){return _0x21ef19['status'](_0x1ab0da)['set']('Content-Type',_0x589f('0xbc'))[_0x589f('0x3d')](_0x589f('0xbd'));}else{return _0x21ef19[_0x589f('0x2c')](_0x1ab0da)[_0x589f('0x2e')](_0x51e2ca);}}});})[_0x589f('0x2a')](handleError(_0x21ef19,null));};exports[_0x589f('0x3d')]=function(_0x5657ed,_0x487c30,_0x5b0fa8){var _0x42d38f,_0x1651b7,_0x43159e;if(_[_0x589f('0xa0')](_0x5657ed['body'][_0x589f('0x5d')])||_0x5657ed[_0x589f('0x5d')]['body']===''){throw new db[(_0x589f('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x589f('0xa0')](_0x5657ed['body']['to'])){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))](_0x589f('0xbe'));}_0x42d38f=_0x5657ed[_0x589f('0x5d')]['to'];return db[_0x589f('0x3f')]['find']({'where':{'id':_0x5657ed[_0x589f('0x57')]['id']},'include':[{'model':db[_0x589f('0xa6')],'as':'List','include':[{'model':db[_0x589f('0x90')],'as':_0x589f('0xa7'),'where':{'mobile':_0x42d38f},'limit':0x1,'order':[['updatedAt',_0x589f('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x487c30,null))[_0x589f('0x20')](function(_0x45e3fd){if(_0x45e3fd&&_0x45e3fd[_0x589f('0xbf')]){_0x1651b7=_0x45e3fd[_0x589f('0x39')]({'plain':!![]});if(_0x1651b7[_0x589f('0xbf')]&&_0x1651b7[_0x589f('0xbf')][_0x589f('0xa7')]['length']){return _0x1651b7[_0x589f('0xbf')][_0x589f('0xa7')][0x0];}return db['CmContact']['create'](_['defaults'](_0x5657ed[_0x589f('0x5d')],{'firstName':_0x42d38f,'mobile':_0x42d38f,'phone':_0x42d38f,'ListId':_0x1651b7[_0x589f('0x98')]}));}})[_0x589f('0x20')](handleEntityNotFound(_0x487c30,null))['then'](function(_0x3e9aa2){if(_0x3e9aa2){_0x43159e=_0x3e9aa2;return db['WhatsappInteraction'][_0x589f('0x60')]({'where':{'ContactId':_0x43159e['id'],'closed':![],'WhatsappAccountId':_0x1651b7['id']}})[_0x589f('0x20')](function(_0x53a848){if(_0x53a848){return[_0x53a848,![]];}return db['WhatsappInteraction'][_0x589f('0x5c')]({'UserId':_0x5657ed[_0x589f('0x5e')]['id'],'ContactId':_0x43159e['id'],'WhatsappAccountId':_0x1651b7['id'],'phone':_0x42d38f,'firstMsgDirection':_0x589f('0xc0'),'Messages':[_['merge'](_0x5657ed[_0x589f('0x5d')],{'read':![],'body':_0x5657ed[_0x589f('0x5d')]['body'],'phone':_0x42d38f,'WhatsappAccountId':_0x1651b7['id'],'UserId':_0x5657ed[_0x589f('0x5e')]['id'],'ContactId':_0x43159e['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x589f('0xc1')}]})[_0x589f('0x20')](function(_0x529627){return[_0x529627,!![]];});});}})[_0x589f('0xab')](function(_0x52794e,_0x3bd0c0){if(_0x3bd0c0){return _0x52794e;}return db[_0x589f('0x8a')]['create'](_[_0x589f('0x52')](_0x5657ed[_0x589f('0x5d')],{'read':![],'body':_0x5657ed[_0x589f('0x5d')][_0x589f('0x5d')],'phone':_0x42d38f,'WhatsappAccountId':_0x1651b7['id'],'WhatsappInteractionId':_0x52794e['id'],'UserId':_0x5657ed[_0x589f('0x5e')]['id'],'ContactId':_0x43159e['id']}))[_0x589f('0x20')](function(_0x4baa73){_0x52794e[_0x589f('0xc2')][_0x589f('0xc1')]=[];_0x52794e[_0x589f('0xc2')][_0x589f('0xc1')][_0x589f('0xc3')](_0x4baa73[_0x589f('0xc2')]);return _0x52794e;});})[_0x589f('0x20')](respondWithResult(_0x487c30,null))[_0x589f('0x2a')](handleError(_0x487c30,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 936742b..0b7f73d 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 _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 +var _0xfc5d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3a9818,_0x4b500f){var _0x33ab1e=function(_0x58f4a4){while(--_0x58f4a4){_0x3a9818['push'](_0x3a9818['shift']());}};_0x33ab1e(++_0x4b500f);}(_0xfc5d,0xd7));var _0xdfc5=function(_0x48d669,_0x2cddd4){_0x48d669=_0x48d669-0x0;var _0xa92ebb=_0xfc5d[_0x48d669];return _0xa92ebb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xdfc5('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdfc5('0x1')](0x0);var events={'afterCreate':_0xdfc5('0x2'),'afterUpdate':_0xdfc5('0x3'),'afterDestroy':_0xdfc5('0x4')};function emitEvent(_0x11892c){return function(_0x226af7,_0x3e8952,_0x5d6c41){WhatsappAccountEvents[_0xdfc5('0x5')](_0x11892c+':'+_0x226af7['id'],_0x226af7);WhatsappAccountEvents[_0xdfc5('0x5')](_0x11892c,_0x226af7);_0x5d6c41(null);};}for(var e in events){if(events[_0xdfc5('0x6')](e)){var event=events[e];WhatsappAccount[_0xdfc5('0x7')](e,emitEvent(event));}}module[_0xdfc5('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1187680..b8786d6 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 _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 +var _0x6857=['request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3704c3,_0x53caaa){var _0xb1a8a=function(_0x41f8ed){while(--_0x41f8ed){_0x3704c3['push'](_0x3704c3['shift']());}};_0xb1a8a(++_0x53caaa);}(_0x6857,0x82));var _0x7685=function(_0x23b415,_0x361b54){_0x23b415=_0x23b415-0x0;var _0x43b347=_0x6857[_0x23b415];return _0x43b347;};'use strict';var _=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7685('0x2'));var fs=require('fs');var path=require(_0x7685('0x3'));var rimraf=require(_0x7685('0x4'));var config=require(_0x7685('0x5'));var attributes=require(_0x7685('0x6'));module[_0x7685('0x7')]=function(_0x45b799,_0x3d2fc6){return _0x45b799[_0x7685('0x8')](_0x7685('0x9'),attributes,{'tableName':_0x7685('0xa'),'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 cca025e..4ecd49c 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 _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 +var _0xaaba=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','model','map','then','lodash'];(function(_0x327375,_0x3f57be){var _0x12e6f3=function(_0x2581dd){while(--_0x2581dd){_0x327375['push'](_0x327375['shift']());}};_0x12e6f3(++_0x3f57be);}(_0xaaba,0x10f));var _0xaaab=function(_0x19651b,_0x3c150c){_0x19651b=_0x19651b-0x0;var _0x36d098=_0xaaba[_0x19651b];return _0x36d098;};'use strict';var _=require(_0xaaab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaaab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaab('0x2'));var db=require(_0xaaab('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaaab('0x4'));var config=require(_0xaaab('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xaaab('0x6')][_0xaaab('0x7')]({'port':0x232a});config[_0xaaab('0x8')]=_[_0xaaab('0x9')](config[_0xaaab('0x8')],{'host':_0xaaab('0xa'),'port':0x18eb});var socket=require(_0xaaab('0xb'))(new Redis(config[_0xaaab('0x8')]));require(_0xaaab('0xc'))[_0xaaab('0xd')](socket);function respondWithRpcPromise(_0x199860,_0xe72180,_0x3994f1){return new BPromise(function(_0x4ac286,_0x28d698){return client[_0xaaab('0xe')](_0x199860,_0x3994f1)['then'](function(_0x59c604){logger[_0xaaab('0xf')](_0xaaab('0x10'),_0xe72180,_0xaaab('0x11'));logger[_0xaaab('0x12')](_0xaaab('0x13'),_0xe72180,'request\x20sent',JSON['stringify'](_0x59c604));if(_0x59c604[_0xaaab('0x14')]){if(_0x59c604[_0xaaab('0x14')][_0xaaab('0x15')]===0x1f4){logger['error'](_0xaaab('0x10'),_0xe72180,_0x59c604[_0xaaab('0x14')]['message']);return _0x28d698(_0x59c604['error'][_0xaaab('0x16')]);}logger[_0xaaab('0x14')](_0xaaab('0x10'),_0xe72180,_0x59c604[_0xaaab('0x14')][_0xaaab('0x16')]);return _0x4ac286(_0x59c604['error'][_0xaaab('0x16')]);}else{logger[_0xaaab('0xf')](_0xaaab('0x10'),_0xe72180,'request\x20sent');_0x4ac286(_0x59c604['result'][_0xaaab('0x16')]);}})[_0xaaab('0x17')](function(_0x173548){logger['error'](_0xaaab('0x10'),_0xe72180,_0x173548);_0x28d698(_0x173548);});});}exports[_0xaaab('0x18')]=function(_0x47fa68){var _0x57fc4b=this;return new Promise(function(_0x57f3fb,_0x424cb8){return db[_0xaaab('0x19')]['find']({'raw':_0x47fa68[_0xaaab('0x1a')]?_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1b')]===undefined?!![]:![]:!![],'where':_0x47fa68[_0xaaab('0x1a')]?_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1c')]||null:null,'attributes':_0x47fa68['options']?_0x47fa68['options'][_0xaaab('0x1d')]||null:null,'include':_0x47fa68[_0xaaab('0x1a')]?_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1e')]?_['map'](_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1e')],function(_0x2b1c0a){return{'model':db[_0x2b1c0a[_0xaaab('0x1f')]],'as':_0x2b1c0a['as'],'attributes':_0x2b1c0a[_0xaaab('0x1d')],'include':_0x2b1c0a[_0xaaab('0x1e')]?_[_0xaaab('0x20')](_0x2b1c0a[_0xaaab('0x1e')],function(_0x175921){return{'model':db[_0x175921[_0xaaab('0x1f')]],'as':_0x175921['as'],'attributes':_0x175921[_0xaaab('0x1d')],'include':_0x175921[_0xaaab('0x1e')]?_[_0xaaab('0x20')](_0x175921[_0xaaab('0x1e')],function(_0x1d30f1){return{'model':db[_0x1d30f1[_0xaaab('0x1f')]],'as':_0x1d30f1['as'],'attributes':_0x1d30f1['attributes']};}):[]};}):[]};}):[]:[]})[_0xaaab('0x21')](function(_0x265f17){logger['info'](_0xaaab('0x18'),_0x47fa68);logger[_0xaaab('0x12')](_0xaaab('0x18'),_0x47fa68,JSON['stringify'](_0x265f17));_0x57f3fb(_0x265f17);})[_0xaaab('0x17')](function(_0x5c31db){logger[_0xaaab('0x14')](_0xaaab('0x18'),_0x5c31db[_0xaaab('0x16')],_0x47fa68);_0x424cb8(_0x57fc4b[_0xaaab('0x14')](0x1f4,_0x5c31db['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7eba681..3cd849a 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 _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 +var _0x5e97=['update','emit','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x4c356d,_0x421ada){var _0x163889=function(_0x38f7bf){while(--_0x38f7bf){_0x4c356d['push'](_0x4c356d['shift']());}};_0x163889(++_0x421ada);}(_0x5e97,0x155));var _0x75e9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5e97[_0x2dafbe];return _0x58a45a;};'use strict';var WhatsappAccountEvents=require(_0x75e9('0x0'));var events=[_0x75e9('0x1'),'remove',_0x75e9('0x2')];function createListener(_0x15946e,_0x51596f){return function(_0xa5dea0){_0x51596f[_0x75e9('0x3')](_0x15946e,_0xa5dea0);};}function removeListener(_0x2222a7,_0x32341a){return function(){WhatsappAccountEvents['removeListener'](_0x2222a7,_0x32341a);};}exports[_0x75e9('0x4')]=function(_0x45bc15){for(var _0x39574f=0x0,_0x366a14=events[_0x75e9('0x5')];_0x39574f<_0x366a14;_0x39574f++){var _0x41fdb2=events[_0x39574f];var _0x7072e7=createListener(_0x75e9('0x6')+_0x41fdb2,_0x45bc15);WhatsappAccountEvents['on'](_0x41fdb2,_0x7072e7);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5960bfb..237d0b0 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 _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 +var _0x99c7=['./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x70ebc,_0x268bac){var _0x5a195c=function(_0x1a6da8){while(--_0x1a6da8){_0x70ebc['push'](_0x70ebc['shift']());}};_0x5a195c(++_0x268bac);}(_0x99c7,0xc8));var _0x799c=function(_0x35fde0,_0x10ef93){_0x35fde0=_0x35fde0-0x0;var _0x5e321b=_0x99c7[_0x35fde0];return _0x5e321b;};'use strict';var multer=require(_0x799c('0x0'));var util=require(_0x799c('0x1'));var path=require(_0x799c('0x2'));var timeout=require(_0x799c('0x3'));var express=require(_0x799c('0x4'));var router=express[_0x799c('0x5')]();var fs_extra=require(_0x799c('0x6'));var auth=require(_0x799c('0x7'));var interaction=require(_0x799c('0x8'));var config=require(_0x799c('0x9'));var controller=require(_0x799c('0xa'));router[_0x799c('0xb')]('/',auth[_0x799c('0xc')](),controller[_0x799c('0xd')]);router[_0x799c('0xb')]('/:id',auth[_0x799c('0xc')](),controller[_0x799c('0xe')]);router[_0x799c('0xf')]('/',auth[_0x799c('0xc')](),controller[_0x799c('0x10')]);router[_0x799c('0x11')](_0x799c('0x12'),auth[_0x799c('0xc')](),controller[_0x799c('0x13')]);router['delete'](_0x799c('0x12'),auth[_0x799c('0xc')](),controller[_0x799c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 55e0391..6f39b17 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 _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 +var _0x60ae=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x6bf8f4,_0x203808){var _0x25b4f6=function(_0x58f1ca){while(--_0x58f1ca){_0x6bf8f4['push'](_0x6bf8f4['shift']());}};_0x25b4f6(++_0x203808);}(_0x60ae,0x83));var _0xe60a=function(_0x314397,_0x550526){_0x314397=_0x314397-0x0;var _0x1ec45e=_0x60ae[_0x314397];return _0x1ec45e;};'use strict';var Sequelize=require(_0xe60a('0x0'));module[_0xe60a('0x1')]={'priority':{'type':Sequelize[_0xe60a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe60a('0x3')],'allowNull':![],'defaultValue':_0xe60a('0x4')},'appdata':{'type':Sequelize[_0xe60a('0x5')]()},'description':{'type':Sequelize[_0xe60a('0x3')]},'interval':{'type':Sequelize[_0xe60a('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ee92556..fe66deb 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 _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 +var _0x677a=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','WhatsappApplication','includeAll','include','findAll','catch','params','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x5a8f7a,_0x553e68){var _0x4775ce=function(_0x11414f){while(--_0x11414f){_0x5a8f7a['push'](_0x5a8f7a['shift']());}};_0x4775ce(++_0x553e68);}(_0x677a,0xd6));var _0xa677=function(_0x42bdba,_0x42f841){_0x42bdba=_0x42bdba-0x0;var _0x11be7f=_0x677a[_0x42bdba];return _0x11be7f;};'use strict';var emlformat=require(_0xa677('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa677('0x1'));var jsonpatch=require(_0xa677('0x2'));var rp=require(_0xa677('0x3'));var moment=require(_0xa677('0x4'));var BPromise=require(_0xa677('0x5'));var Mustache=require('mustache');var util=require(_0xa677('0x6'));var path=require(_0xa677('0x7'));var sox=require(_0xa677('0x8'));var csv=require(_0xa677('0x9'));var ejs=require(_0xa677('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa677('0xb'));var squel=require(_0xa677('0xc'));var crypto=require(_0xa677('0xd'));var jsforce=require(_0xa677('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa677('0xf'));var Redis=require('ioredis');var authService=require(_0xa677('0x10'));var qs=require(_0xa677('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa677('0x12'));var logger=require(_0xa677('0x13'))(_0xa677('0x14'));var utils=require(_0xa677('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa677('0x16'));var db=require(_0xa677('0x17'))['db'];function respondWithStatusCode(_0xb1d2b6,_0x14cd10){_0x14cd10=_0x14cd10||0xcc;return function(_0x4f1ca4){if(_0x4f1ca4){return _0xb1d2b6[_0xa677('0x18')](_0x14cd10);}return _0xb1d2b6['status'](_0x14cd10)[_0xa677('0x19')]();};}function respondWithResult(_0x2e5b2a,_0x155021){_0x155021=_0x155021||0xc8;return function(_0x4c68b4){if(_0x4c68b4){return _0x2e5b2a[_0xa677('0x1a')](_0x155021)[_0xa677('0x1b')](_0x4c68b4);}};}function respondWithFilteredResult(_0x268fa5,_0x4ffe4c){return function(_0x1feb0e){if(_0x1feb0e){var _0x230363=typeof _0x4ffe4c[_0xa677('0x1c')]===_0xa677('0x1d')&&typeof _0x4ffe4c[_0xa677('0x1e')]===_0xa677('0x1d');var _0x5957cb=_0x1feb0e[_0xa677('0x1f')];var _0x5db4d2=_0x230363?0x0:_0x4ffe4c['offset'];var _0x4e6b3d=_0x230363?_0x1feb0e[_0xa677('0x1f')]:_0x4ffe4c[_0xa677('0x1c')]+_0x4ffe4c[_0xa677('0x1e')];var _0x30fbfd;if(_0x4e6b3d>=_0x5957cb){_0x4e6b3d=_0x5957cb;_0x30fbfd=0xc8;}else{_0x30fbfd=0xce;}_0x268fa5['status'](_0x30fbfd);return _0x268fa5[_0xa677('0x20')](_0xa677('0x21'),_0x5db4d2+'-'+_0x4e6b3d+'/'+_0x5957cb)[_0xa677('0x1b')](_0x1feb0e);}return null;};}function patchUpdates(_0x44de05){return function(_0x3ffc76){try{jsonpatch[_0xa677('0x22')](_0x3ffc76,_0x44de05,!![]);}catch(_0x5cbea0){return BPromise[_0xa677('0x23')](_0x5cbea0);}return _0x3ffc76['save']();};}function saveUpdates(_0x470e0a,_0x1c63e8){return function(_0x45eb0f){if(_0x45eb0f){return _0x45eb0f['update'](_0x470e0a)[_0xa677('0x24')](function(_0x31acd3){return _0x31acd3;});}return null;};}function removeEntity(_0x395d33,_0x1c59e4){return function(_0x4e8e9e){if(_0x4e8e9e){return _0x4e8e9e[_0xa677('0x25')]()[_0xa677('0x24')](function(){_0x395d33['status'](0xcc)[_0xa677('0x19')]();});}};}function handleEntityNotFound(_0xe54876,_0x40cb21){return function(_0x3bb824){if(!_0x3bb824){_0xe54876[_0xa677('0x18')](0x194);}return _0x3bb824;};}function handleError(_0x3fcb1e,_0x54d892){_0x54d892=_0x54d892||0x1f4;return function(_0x34dee4){logger[_0xa677('0x26')](_0x34dee4[_0xa677('0x27')]);if(_0x34dee4[_0xa677('0x28')]){delete _0x34dee4[_0xa677('0x28')];}_0x3fcb1e[_0xa677('0x1a')](_0x54d892)['send'](_0x34dee4);};}exports[_0xa677('0x29')]=function(_0x124d7f,_0x4606f2){var _0x592718={},_0x2d1e6b={},_0x32c1b8={'count':0x0,'rows':[]};var _0x141767=_[_0xa677('0x2a')](db['WhatsappApplication'][_0xa677('0x2b')],function(_0x1f7811){return{'name':_0x1f7811[_0xa677('0x2c')],'type':_0x1f7811['type'][_0xa677('0x2d')]};});_0x2d1e6b[_0xa677('0x2e')]=_[_0xa677('0x2a')](_0x141767,_0xa677('0x28'));_0x2d1e6b[_0xa677('0x2f')]=_[_0xa677('0x30')](_0x124d7f[_0xa677('0x2f')]);_0x2d1e6b[_0xa677('0x31')]=_['intersection'](_0x2d1e6b[_0xa677('0x2e')],_0x2d1e6b['query']);_0x592718[_0xa677('0x32')]=_[_0xa677('0x33')](_0x2d1e6b[_0xa677('0x2e')],qs[_0xa677('0x34')](_0x124d7f[_0xa677('0x2f')][_0xa677('0x34')]));_0x592718[_0xa677('0x32')]=_0x592718[_0xa677('0x32')][_0xa677('0x35')]?_0x592718['attributes']:_0x2d1e6b[_0xa677('0x2e')];if(!_0x124d7f['query'][_0xa677('0x36')](_0xa677('0x37'))){_0x592718[_0xa677('0x1e')]=qs[_0xa677('0x1e')](_0x124d7f['query'][_0xa677('0x1e')]);_0x592718[_0xa677('0x1c')]=qs[_0xa677('0x1c')](_0x124d7f['query']['offset']);}_0x592718[_0xa677('0x38')]=qs[_0xa677('0x39')](_0x124d7f[_0xa677('0x2f')]['sort']);_0x592718['where']=qs[_0xa677('0x31')](_[_0xa677('0x3a')](_0x124d7f[_0xa677('0x2f')],_0x2d1e6b[_0xa677('0x31')]),_0x141767);if(_0x124d7f['query'][_0xa677('0x3b')]){_0x592718[_0xa677('0x3c')]=_['merge'](_0x592718['where'],{'$or':_[_0xa677('0x2a')](_0x141767,function(_0x2a98b5){if(_0x2a98b5['type']!==_0xa677('0x3d')){var _0x56b4e9={};_0x56b4e9[_0x2a98b5[_0xa677('0x28')]]={'$like':'%'+_0x124d7f[_0xa677('0x2f')]['filter']+'%'};return _0x56b4e9;}})});}_0x592718=_[_0xa677('0x3e')]({},_0x592718,_0x124d7f[_0xa677('0x3f')]);var _0x23ae91={'where':_0x592718[_0xa677('0x3c')]};return db[_0xa677('0x40')][_0xa677('0x1f')](_0x23ae91)[_0xa677('0x24')](function(_0x240c7b){_0x32c1b8[_0xa677('0x1f')]=_0x240c7b;if(_0x124d7f['query'][_0xa677('0x41')]){_0x592718[_0xa677('0x42')]=[{'all':!![]}];}return db[_0xa677('0x40')][_0xa677('0x43')](_0x592718);})['then'](function(_0x5ef1b8){_0x32c1b8['rows']=_0x5ef1b8;return _0x32c1b8;})[_0xa677('0x24')](respondWithFilteredResult(_0x4606f2,_0x592718))[_0xa677('0x44')](handleError(_0x4606f2,null));};exports['show']=function(_0x3052f7,_0x2bcb96){var _0x29ab9c={'raw':!![],'where':{'id':_0x3052f7[_0xa677('0x45')]['id']}},_0x592626={};_0x592626[_0xa677('0x2e')]=_[_0xa677('0x30')](db[_0xa677('0x40')][_0xa677('0x2b')]);_0x592626[_0xa677('0x2f')]=_[_0xa677('0x30')](_0x3052f7[_0xa677('0x2f')]);_0x592626[_0xa677('0x31')]=_[_0xa677('0x33')](_0x592626[_0xa677('0x2e')],_0x592626[_0xa677('0x2f')]);_0x29ab9c[_0xa677('0x32')]=_['intersection'](_0x592626['model'],qs[_0xa677('0x34')](_0x3052f7[_0xa677('0x2f')][_0xa677('0x34')]));_0x29ab9c[_0xa677('0x32')]=_0x29ab9c[_0xa677('0x32')][_0xa677('0x35')]?_0x29ab9c[_0xa677('0x32')]:_0x592626['model'];if(_0x3052f7[_0xa677('0x2f')]['includeAll']){_0x29ab9c[_0xa677('0x42')]=[{'all':!![]}];}_0x29ab9c=_[_0xa677('0x3e')]({},_0x29ab9c,_0x3052f7[_0xa677('0x3f')]);return db[_0xa677('0x40')][_0xa677('0x46')](_0x29ab9c)[_0xa677('0x24')](handleEntityNotFound(_0x2bcb96,null))[_0xa677('0x24')](respondWithResult(_0x2bcb96,null))[_0xa677('0x44')](handleError(_0x2bcb96,null));};exports[_0xa677('0x47')]=function(_0x16a934,_0x59a882){return db['WhatsappApplication'][_0xa677('0x47')](_0x16a934[_0xa677('0x48')],{})[_0xa677('0x24')](respondWithResult(_0x59a882,0xc9))[_0xa677('0x44')](handleError(_0x59a882,null));};exports[_0xa677('0x49')]=function(_0x39cbb1,_0x50d1f6){if(_0x39cbb1[_0xa677('0x48')]['id']){delete _0x39cbb1['body']['id'];}return db[_0xa677('0x40')][_0xa677('0x46')]({'where':{'id':_0x39cbb1['params']['id']}})['then'](handleEntityNotFound(_0x50d1f6,null))[_0xa677('0x24')](saveUpdates(_0x39cbb1[_0xa677('0x48')],null))['then'](respondWithResult(_0x50d1f6,null))[_0xa677('0x44')](handleError(_0x50d1f6,null));};exports[_0xa677('0x25')]=function(_0x282b62,_0xe5d6b2){return db[_0xa677('0x40')][_0xa677('0x46')]({'where':{'id':_0x282b62[_0xa677('0x45')]['id']}})[_0xa677('0x24')](handleEntityNotFound(_0xe5d6b2,null))[_0xa677('0x24')](removeEntity(_0xe5d6b2,null))[_0xa677('0x44')](handleError(_0xe5d6b2,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1e02e5e..32b2188 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 _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 +var _0xdb94=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications'];(function(_0x429ff3,_0x47b6e8){var _0x4fe775=function(_0x15ba6e){while(--_0x15ba6e){_0x429ff3['push'](_0x429ff3['shift']());}};_0x4fe775(++_0x47b6e8);}(_0xdb94,0xe5));var _0x4db9=function(_0x2255e9,_0x59129d){_0x2255e9=_0x2255e9-0x0;var _0x297b6a=_0xdb94[_0x2255e9];return _0x297b6a;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var logger=require(_0x4db9('0x1'))('api');var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var fs=require('fs');var path=require(_0x4db9('0x5'));var rimraf=require(_0x4db9('0x6'));var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x1d21a8,_0xc76bc1){return _0x1d21a8[_0x4db9('0x8')](_0x4db9('0x9'),attributes,{'tableName':_0x4db9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4db9('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b066d94..7913438 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 _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 +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(_0x5605f3,_0x45a175){var _0x6a5837=function(_0x323b62){while(--_0x323b62){_0x5605f3['push'](_0x5605f3['shift']());}};_0x6a5837(++_0x45a175);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3281b3,_0xaa6ceb){_0x3281b3=_0x3281b3-0x0;var _0xfa0bec=_0x6f0d[_0x3281b3];return _0xfa0bec;};'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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 21de43d..b134a98 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 _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 +var _0x5fc3=['whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x1f42f4,_0x378821){var _0x316529=function(_0x5717c1){while(--_0x5717c1){_0x1f42f4['push'](_0x1f42f4['shift']());}};_0x316529(++_0x378821);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x5fc3[_0xd816e2];return _0x1f5924;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/messages',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['download']);router[_0x35fc('0x10')]('/',auth[_0x35fc('0xa')](),controller['create']);router['post'](_0x35fc('0x11'),auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x10')](_0x35fc('0x13'),auth[_0x35fc('0xa')](),interaction[_0x35fc('0x14')]('whatsapp','whatsappinteraction:addtags'),controller['addTags']);router['put'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),interaction[_0x35fc('0x14')](_0x35fc('0x15'),_0x35fc('0x16')),controller[_0x35fc('0x17')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),interaction['tracked'](_0x35fc('0x15'),_0x35fc('0x18')),controller[_0x35fc('0x19')]);router['delete'](_0x35fc('0x13'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index cdfc062..96c30d3 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 _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 +var _0x1681=['exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1168('0x0')]={'closed':{'type':Sequelize[_0x1168('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1168('0x2')]},'disposition':{'type':Sequelize[_0x1168('0x3')]},'secondDisposition':{'type':Sequelize[_0x1168('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1168('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1168('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1168('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1168('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1168('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1168('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ce55d31..09b383f 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 _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 +var _0x6a6e=['update','then','error','stack','name','send','index','WhatsappInteraction','rawAttributes','type','key','findAll','query','user','show','params','model','keys','intersection','attributes','fields','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','filters','length','nolimit','order','pick','WhatsappInteractionId','filter','where','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','server','files','format','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','read','Owner','fullname','get','Whatsapp','Account','N.A.','closed','closedAt','disposition','Messages','basename','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','root','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x44540d,_0x361ed2){_0x44540d=_0x44540d-0x0;var _0x3cb1e3=_0x6a6e[_0x44540d];return _0x3cb1e3;};'use strict';var rimraf=require(_0xe6a6('0x0'));var zipdir=require(_0xe6a6('0x1'));var moment=require('moment');var BPromise=require(_0xe6a6('0x2'));var util=require(_0xe6a6('0x3'));var path=require(_0xe6a6('0x4'));var ejs=require(_0xe6a6('0x5'));var fs=require('fs');var _=require(_0xe6a6('0x6'));var Redis=require(_0xe6a6('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xe6a6('0x8'));var logger=require(_0xe6a6('0x9'))(_0xe6a6('0xa'));var config=require(_0xe6a6('0xb'));var db=require(_0xe6a6('0xc'))['db'];config[_0xe6a6('0xd')]=_[_0xe6a6('0xe')](config[_0xe6a6('0xd')],{'host':_0xe6a6('0xf'),'port':0x18eb});var socket=require(_0xe6a6('0x10'))(new Redis(config[_0xe6a6('0xd')]));require(_0xe6a6('0x11'))[_0xe6a6('0x12')](socket);function respondWithStatusCode(_0x5594e3,_0x40c667){_0x40c667=_0x40c667||0xcc;return function(_0x20448a){if(_0x20448a){return _0x5594e3[_0xe6a6('0x13')](_0x40c667);}return _0x5594e3[_0xe6a6('0x14')](_0x40c667)[_0xe6a6('0x15')]();};}function respondWithResult(_0x1459a3,_0x44cbb6){_0x44cbb6=_0x44cbb6||0xc8;return function(_0x22dda5){if(_0x22dda5){return _0x1459a3[_0xe6a6('0x14')](_0x44cbb6)[_0xe6a6('0x16')](_0x22dda5);}};}function respondWithFilteredResult(_0x4d7adf,_0x3173b9){return function(_0x301501){if(_0x301501){var _0x4379fc=typeof _0x3173b9[_0xe6a6('0x17')]===_0xe6a6('0x18')&&typeof _0x3173b9['limit']==='undefined';var _0x11e531=_0x301501[_0xe6a6('0x19')];var _0x44c86b=_0x4379fc?0x0:_0x3173b9[_0xe6a6('0x17')];var _0x537aee=_0x4379fc?_0x301501['count']:_0x3173b9[_0xe6a6('0x17')]+_0x3173b9[_0xe6a6('0x1a')];var _0x39c473;if(_0x537aee>=_0x11e531){_0x537aee=_0x11e531;_0x39c473=0xc8;}else{_0x39c473=0xce;}_0x4d7adf['status'](_0x39c473);return _0x4d7adf[_0xe6a6('0x1b')](_0xe6a6('0x1c'),_0x44c86b+'-'+_0x537aee+'/'+_0x11e531)[_0xe6a6('0x16')](_0x301501);}return null;};}function saveUpdates(_0x121e42){return function(_0x4f358a){if(_0x4f358a){return _0x4f358a[_0xe6a6('0x1d')](_0x121e42)['then'](function(_0x384de8){return _0x384de8;});}return null;};}function removeEntity(_0x572427){return function(_0x11e4e8){if(_0x11e4e8){return _0x11e4e8['destroy']()[_0xe6a6('0x1e')](function(){_0x572427[_0xe6a6('0x14')](0xcc)[_0xe6a6('0x15')]();});}};}function handleEntityNotFound(_0x37e788){return function(_0x1c5cb0){if(!_0x1c5cb0){_0x37e788['sendStatus'](0x194);}return _0x1c5cb0;};}function handleError(_0x5e653f,_0x12f755){_0x12f755=_0x12f755||0x1f4;return function(_0x21b019){logger[_0xe6a6('0x1f')](_0x21b019[_0xe6a6('0x20')]);if(_0x21b019[_0xe6a6('0x21')]){delete _0x21b019['name'];}_0x5e653f[_0xe6a6('0x14')](_0x12f755)[_0xe6a6('0x22')](_0x21b019);};}exports[_0xe6a6('0x23')]=function(_0x2ce74c,_0x15f2e3){var _0x1db065={};var _0x5c2996=_['map'](db[_0xe6a6('0x24')][_0xe6a6('0x25')],function(_0x18b917){return{'name':_0x18b917['fieldName'],'type':_0x18b917[_0xe6a6('0x26')][_0xe6a6('0x27')]};});_0x1db065=qs['getOptions'](_0x5c2996,_0x2ce74c);return interaction[_0xe6a6('0x28')]('whatsapp',_0x2ce74c[_0xe6a6('0x29')],_0x2ce74c[_0xe6a6('0x2a')],_0x1db065,_0x5c2996)[_0xe6a6('0x1e')](respondWithFilteredResult(_0x15f2e3,_0x1db065))['catch'](handleError(_0x15f2e3,null));};exports[_0xe6a6('0x2b')]=function(_0x2ce97b,_0x5c1130){var _0x1c6da7={'raw':![],'where':{'id':_0x2ce97b[_0xe6a6('0x2c')]['id']}},_0x559cd8={};_0x559cd8[_0xe6a6('0x2d')]=_[_0xe6a6('0x2e')](db[_0xe6a6('0x24')][_0xe6a6('0x25')]);_0x559cd8[_0xe6a6('0x29')]=_['keys'](_0x2ce97b[_0xe6a6('0x29')]);_0x559cd8['filters']=_[_0xe6a6('0x2f')](_0x559cd8[_0xe6a6('0x2d')],_0x559cd8[_0xe6a6('0x29')]);_0x1c6da7[_0xe6a6('0x30')]=_[_0xe6a6('0x2f')](_0x559cd8['model'],qs[_0xe6a6('0x31')](_0x2ce97b[_0xe6a6('0x29')][_0xe6a6('0x31')]));_0x1c6da7[_0xe6a6('0x30')]=_0x1c6da7['attributes']['length']?_0x1c6da7[_0xe6a6('0x30')]:_0x559cd8[_0xe6a6('0x2d')];if(_0x2ce97b[_0xe6a6('0x29')]['includeAll']){_0x1c6da7[_0xe6a6('0x32')]=[{'all':!![]}];}_0x1c6da7=_[_0xe6a6('0x33')]({},_0x1c6da7,_0x2ce97b[_0xe6a6('0x34')]);return db['WhatsappInteraction'][_0xe6a6('0x35')](_0x1c6da7)[_0xe6a6('0x1e')](handleEntityNotFound(_0x5c1130,null))[_0xe6a6('0x1e')](respondWithResult(_0x5c1130,null))[_0xe6a6('0x36')](handleError(_0x5c1130,null));};exports['create']=function(_0x1a1c66,_0x5cc726){return db[_0xe6a6('0x24')][_0xe6a6('0x37')](_0x1a1c66[_0xe6a6('0x38')],{})[_0xe6a6('0x1e')](respondWithResult(_0x5cc726,0xc9))[_0xe6a6('0x36')](handleError(_0x5cc726,null));};exports[_0xe6a6('0x1d')]=function(_0xfbc52d,_0x9cd09a){if(_0xfbc52d[_0xe6a6('0x38')]['id']){delete _0xfbc52d['body']['id'];}return db[_0xe6a6('0x24')]['find']({'where':{'id':_0xfbc52d[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x9cd09a,null))[_0xe6a6('0x1e')](saveUpdates(_0xfbc52d[_0xe6a6('0x38')],null))['then'](respondWithResult(_0x9cd09a,null))[_0xe6a6('0x36')](handleError(_0x9cd09a,null));};exports['destroy']=function(_0x3ba239,_0x454abc){return db['WhatsappInteraction'][_0xe6a6('0x35')]({'where':{'id':_0x3ba239[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x454abc,null))['then'](removeEntity(_0x454abc,null))[_0xe6a6('0x36')](handleError(_0x454abc,null));};exports['describe']=function(_0x14292a,_0x35c183){return db[_0xe6a6('0x24')][_0xe6a6('0x39')]()[_0xe6a6('0x1e')](respondWithResult(_0x35c183,null))[_0xe6a6('0x36')](handleError(_0x35c183,null));};exports[_0xe6a6('0x3a')]=function(_0x33adde,_0x50ed89){return db['WhatsappMessage'][_0xe6a6('0x35')]({'where':{'id':_0x33adde['params']['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x50ed89,null))[_0xe6a6('0x1e')](function(_0x291763){if(_0x291763){return _0x291763[_0xe6a6('0x3a')](_0x33adde[_0xe6a6('0x38')][_0xe6a6('0x3b')],_[_0xe6a6('0x3c')](_0x33adde[_0xe6a6('0x38')],[_0xe6a6('0x3b'),'id'])||{});}})[_0xe6a6('0x1e')](respondWithResult(_0x50ed89,null))['catch'](handleError(_0x50ed89,null));};exports[_0xe6a6('0x3d')]=function(_0xd8edcc,_0x58166e){var _0x5e586e={'raw':![],'where':{}};var _0x251678={};var _0x43feaa={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe6a6('0x3e')]({'where':{'id':_0xd8edcc[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x58166e,null))['then'](function(_0x5e7403){if(_0x5e7403){_0x251678[_0xe6a6('0x2d')]=_[_0xe6a6('0x2e')](db[_0xe6a6('0x3f')][_0xe6a6('0x25')]);_0x251678[_0xe6a6('0x29')]=_[_0xe6a6('0x2e')](_0xd8edcc[_0xe6a6('0x29')]);_0x251678[_0xe6a6('0x40')]=_[_0xe6a6('0x2f')](_0x251678[_0xe6a6('0x2d')],_0x251678[_0xe6a6('0x29')]);_0x5e586e[_0xe6a6('0x30')]=_['intersection'](_0x251678[_0xe6a6('0x2d')],qs[_0xe6a6('0x31')](_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x31')]));_0x5e586e[_0xe6a6('0x30')]=_0x5e586e[_0xe6a6('0x30')][_0xe6a6('0x41')]?_0x5e586e['attributes']:_0x251678[_0xe6a6('0x2d')];if(!_0xd8edcc[_0xe6a6('0x29')]['hasOwnProperty'](_0xe6a6('0x42'))){_0x5e586e[_0xe6a6('0x1a')]=qs[_0xe6a6('0x1a')](_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x1a')]);_0x5e586e[_0xe6a6('0x17')]=qs[_0xe6a6('0x17')](_0xd8edcc[_0xe6a6('0x29')]['offset']);}_0x5e586e[_0xe6a6('0x43')]=qs['sort'](_0xd8edcc[_0xe6a6('0x29')]['sort']);_0x5e586e['where']=qs[_0xe6a6('0x40')](_[_0xe6a6('0x44')](_0xd8edcc[_0xe6a6('0x29')],_0x251678[_0xe6a6('0x40')]));_0x5e586e['where'][_0xe6a6('0x45')]=_0x5e7403['id'];if(_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x46')]){_0x5e586e[_0xe6a6('0x47')]=_[_0xe6a6('0x33')](_0x5e586e[_0xe6a6('0x47')],{'$or':_[_0xe6a6('0x48')](_0x5e586e['attributes'],function(_0xb171ff){var _0x27847e={};_0x27847e[_0xb171ff]={'$like':'%'+_0xd8edcc['query']['filter']+'%'};return _0x27847e;})});}if(_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x49')]){var _0x3f9f61=_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x49')][_0xe6a6('0x4a')](',');var _0x39df14={};_0x39df14[_0x3f9f61[0x0]]={'$gte':moment(_0x3f9f61[0x1])['format'](_0xe6a6('0x4b'))};_0x5e586e[_0xe6a6('0x47')]=_[_0xe6a6('0x33')](_0x5e586e[_0xe6a6('0x47')],_0x39df14);}_0x5e586e=_[_0xe6a6('0x33')]({},_0x5e586e,_0xd8edcc[_0xe6a6('0x34')]);return db[_0xe6a6('0x3f')]['count']({'where':_0x5e586e[_0xe6a6('0x47')]})[_0xe6a6('0x1e')](function(_0x1b88f0){_0x43feaa[_0xe6a6('0x19')]=_0x1b88f0;if(_0xd8edcc[_0xe6a6('0x29')]['includeAll']){_0x5e586e[_0xe6a6('0x32')]=[{'all':!![]}];}return db[_0xe6a6('0x3f')][_0xe6a6('0x28')](_0x5e586e);})[_0xe6a6('0x1e')](function(_0x426835){_0x43feaa[_0xe6a6('0x4c')]=_0x426835;return _0x43feaa;});}})[_0xe6a6('0x1e')](respondWithFilteredResult(_0x58166e,_0x5e586e))[_0xe6a6('0x36')](handleError(_0x58166e,null));};exports[_0xe6a6('0x4d')]=function(_0x3ad7fb,_0x1afa49){return db[_0xe6a6('0x24')][_0xe6a6('0x35')]({'where':{'id':_0x3ad7fb[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x1afa49,null))[_0xe6a6('0x1e')](function(_0x165901){if(_0x165901){return _0x165901[_0xe6a6('0x4e')](_0x3ad7fb[_0xe6a6('0x38')][_0xe6a6('0x3b')],_[_0xe6a6('0x3c')](_0x3ad7fb['body'],[_0xe6a6('0x3b'),'id'])||{})[_0xe6a6('0x4f')](function(){return db[_0xe6a6('0x50')][_0xe6a6('0x28')]({'attributes':['id',_0xe6a6('0x21'),_0xe6a6('0x51')],'where':{'id':_0x3ad7fb[_0xe6a6('0x38')][_0xe6a6('0x3b')]}});})[_0xe6a6('0x1e')](function(_0x20563d){socket[_0xe6a6('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x3ad7fb['params']['id']),'tags':_0x20563d||[]});return{'id':Number(_0x3ad7fb[_0xe6a6('0x2c')]['id']),'tags':_0x20563d||[]};});}})[_0xe6a6('0x1e')](respondWithResult(_0x1afa49,null))['catch'](handleError(_0x1afa49,null));};exports[_0xe6a6('0x53')]=function(_0x320307,_0x1c1721){return db[_0xe6a6('0x24')][_0xe6a6('0x35')]({'where':{'id':_0x320307[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x1c1721,null))['then'](function(_0x128cf7){if(_0x128cf7){return _0x128cf7[_0xe6a6('0x53')](_0x320307[_0xe6a6('0x29')][_0xe6a6('0x3b')]);}})[_0xe6a6('0x1e')](respondWithStatusCode(_0x1c1721,null))[_0xe6a6('0x36')](handleError(_0x1c1721,null));};exports[_0xe6a6('0x54')]=function(_0x13fc6f,_0x1704e9){var _0x9e6ba4=moment()[_0xe6a6('0x55')]()[_0xe6a6('0x56')]();var _0x546503=path[_0xe6a6('0x57')](config['root'],_0xe6a6('0x58'),'files','tmp');var _0x448e02=path[_0xe6a6('0x57')](config['root'],_0xe6a6('0x58'),_0xe6a6('0x59'),'attachments');var _0x277fec=path['join'](_0x546503,_0x9e6ba4);var _0x17584e=util[_0xe6a6('0x5a')](_0xe6a6('0x5b'),_0x13fc6f[_0xe6a6('0x2c')]['id'],_0x9e6ba4);var _0x18e9c3=path[_0xe6a6('0x57')](_0x546503,_0x17584e);var _0x5c090e=[];_0x5c090e['push']({'model':db[_0xe6a6('0x5c')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5c090e[_0xe6a6('0x5d')]({'model':db[_0xe6a6('0x5e')],'as':'Contact','attributes':['id',_0xe6a6('0x5f'),_0xe6a6('0x60')],'raw':!![]});if(_0x13fc6f[_0xe6a6('0x29')][_0xe6a6('0x61')]){_0x5c090e[_0xe6a6('0x5d')]({'model':db[_0xe6a6('0x62')],'as':_0xe6a6('0x62'),'raw':!![]});}var _0x182dce=[{'model':db[_0xe6a6('0x3f')],'as':'Messages','attributes':['id',_0xe6a6('0x38'),_0xe6a6('0x63'),_0xe6a6('0x64'),_0xe6a6('0x65'),_0xe6a6('0x66')],'include':_0x5c090e}];_0x182dce[_0xe6a6('0x5d')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0xe6a6('0x21')]});_0x182dce[_0xe6a6('0x5d')]({'model':db[_0xe6a6('0x5c')],'as':_0xe6a6('0x67'),'attributes':['id',_0xe6a6('0x68')]});return db[_0xe6a6('0x24')][_0xe6a6('0x35')]({'where':{'id':_0x13fc6f['params']['id']},'include':_0x182dce})[_0xe6a6('0x1e')](handleEntityNotFound(_0x1704e9,null))[_0xe6a6('0x1e')](function(_0x18ee6f){if(_0x18ee6f){var _0x79638e=_0x18ee6f[_0xe6a6('0x69')]({'plain':!![]});fs['mkdirSync'](_0x277fec);var _0x59197e={'channel':_0xe6a6('0x6a'),'account':_0x79638e[_0xe6a6('0x6b')][_0xe6a6('0x21')],'agent':_0x79638e[_0xe6a6('0x67')]?_0x79638e[_0xe6a6('0x67')]['fullname']:_0xe6a6('0x6c'),'createdAt':moment(_0x79638e[_0xe6a6('0x63')])['format'](_0xe6a6('0x4b'))['toString'](),'closedAt':_0x79638e[_0xe6a6('0x6d')]?moment(_0x79638e[_0xe6a6('0x6e')])[_0xe6a6('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe6a6('0x56')]():'','disposition':_0x79638e[_0xe6a6('0x6f')],'messages':_(_0x79638e[_0xe6a6('0x70')])[_0xe6a6('0x46')]({'secret':![]})['map'](function(_0x5e4694){if(_0x5e4694[_0xe6a6('0x62')]){var _0x4fc699=path['join'](_0x448e02,_0x5e4694[_0xe6a6('0x62')][_0xe6a6('0x71')]);if(fs['existsSync'](_0x4fc699)){fs[_0xe6a6('0x72')](_0x4fc699)[_0xe6a6('0x73')](fs[_0xe6a6('0x74')](path['join'](_0x277fec,_0x5e4694[_0xe6a6('0x62')][_0xe6a6('0x71')])));}}return{'date':moment(_0x5e4694[_0xe6a6('0x63')])[_0xe6a6('0x5a')](_0xe6a6('0x4b'))[_0xe6a6('0x56')](),'sender':_0x5e4694['direction']===_0xe6a6('0x75')?_0x5e4694['User']?_0x5e4694[_0xe6a6('0x5c')][_0xe6a6('0x68')]:_0xe6a6('0x76'):_0x5e4694['Contact'][_0xe6a6('0x5f')]+(_0x5e4694[_0xe6a6('0x77')]['lastName']?'\x20'+_0x5e4694[_0xe6a6('0x77')][_0xe6a6('0x60')]:''),'body':_0x5e4694[_0xe6a6('0x62')]?_0x5e4694['Attachment'][_0xe6a6('0x71')]:_0x5e4694[_0xe6a6('0x38')],'direction':_0x5e4694[_0xe6a6('0x64')]==='out'?'A':'C','secret':_0x5e4694['secret'],'read':_0x5e4694[_0xe6a6('0x66')],'attachment':_0x5e4694['Attachment']};})['value']()};return ejs[_0xe6a6('0x78')](path['join'](config[_0xe6a6('0x79')],_0xe6a6('0x58'),'views',_0xe6a6('0x7a')),{'interaction':_0x59197e})[_0xe6a6('0x1e')](function(_0x5317e3){var _0x3fee86=path[_0xe6a6('0x57')](_0x277fec,'transcript-'+_0x79638e['id']+'-'+_0x9e6ba4+_0xe6a6('0x7b'));var _0x5214bd={'path':_0x3fee86,'channel':_0xe6a6('0x6a'),'interactionId':_0x79638e['id']};return pdf[_0xe6a6('0x7c')](_0x5317e3,_0x5214bd);})[_0xe6a6('0x1e')](function(){return new BPromise(function(_0x3db7f8,_0x26a5e4){zipdir(_0x277fec,{'saveTo':_0x18e9c3},function(_0x50b491,_0x40d110){if(_0x50b491)return _0x26a5e4(_0x50b491);return _0x3db7f8(_0x40d110);});})['then'](function(){return new BPromise(function(_0x4b2f99,_0x598a95){rimraf(_0x277fec,function(_0x44800f){if(_0x44800f)_0x598a95(_0x44800f);return _0x4b2f99();});});})[_0xe6a6('0x1e')](function(){return _0x1704e9[_0xe6a6('0x54')](_0x18e9c3,_0x17584e,function(_0x1bac1d){if(_0x1bac1d){console[_0xe6a6('0x7d')](_0xe6a6('0x7e'),_0x1bac1d);}else{fs[_0xe6a6('0x7f')](_0x18e9c3);}});});});}else{return _0x1704e9[_0xe6a6('0x13')](0xc8);}})['catch'](handleError(_0x1704e9,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 98e0838..5484fe3 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 _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 +var _0x7914=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x26dcae,_0x5be1cd){var _0x28fde8=function(_0x2e5b42){while(--_0x2e5b42){_0x26dcae['push'](_0x26dcae['shift']());}};_0x28fde8(++_0x5be1cd);}(_0x7914,0x107));var _0x4791=function(_0x12f026,_0x32fdc3){_0x12f026=_0x12f026-0x0;var _0x50efff=_0x7914[_0x12f026];return _0x50efff;};'use strict';var EventEmitter=require(_0x4791('0x0'));var WhatsappInteraction=require(_0x4791('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4791('0x1'))['db'][_0x4791('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4791('0x3')](0x0);var events={'afterCreate':_0x4791('0x4'),'afterUpdate':_0x4791('0x5'),'afterDestroy':_0x4791('0x6')};function emitEvent(_0x46c4f4){return function(_0x45f27a,_0x6eac92,_0x3ec3ea){_0x45f27a['getUsers']({'attributes':['id'],'raw':!![]})[_0x4791('0x7')](function(_0x559fc1){_0x45f27a[_0x4791('0x8')](_0x4791('0x9'),_0x559fc1[_0x4791('0xa')](function(_0x2d1b96){return{'id':_0x2d1b96['id']};}));return WhatsappMessage[_0x4791('0xb')]({'where':{'WhatsappInteractionId':_0x45f27a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4791('0x7')](function(_0x438679){_0x45f27a[_0x4791('0x8')]('unreadMessages',_0x438679[_0x4791('0xc')]);WhatsappInteractionEvents[_0x4791('0xd')](_0x46c4f4+':'+_0x45f27a['id'],_0x45f27a);WhatsappInteractionEvents[_0x4791('0xd')](_0x46c4f4,_0x45f27a);_0x3ec3ea(null);})[_0x4791('0xe')](_0x3ec3ea(null));};}for(var e in events){if(events[_0x4791('0xf')](e)){var event=events[e];WhatsappInteraction[_0x4791('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 700fe52..3644e62 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 _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 +var _0xd2b0=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','lodash','../../config/logger','moment','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0xb69e5c,_0x294db7){var _0x594bc6=function(_0x429a24){while(--_0x429a24){_0xb69e5c['push'](_0xb69e5c['shift']());}};_0x594bc6(++_0x294db7);}(_0xd2b0,0x13a));var _0x0d2b=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xd2b0[_0x47408e];return _0x1636bc;};'use strict';var _=require(_0x0d2b('0x0'));var util=require('util');var logger=require(_0x0d2b('0x1'))('api');var moment=require(_0x0d2b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d2b('0x3'));var config=require(_0x0d2b('0x4'));var attributes=require(_0x0d2b('0x5'));module[_0x0d2b('0x6')]=function(_0xefacf5,_0x2d329b){return _0xefacf5[_0x0d2b('0x7')](_0x0d2b('0x8'),attributes,{'tableName':_0x0d2b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x282fec,_0x972db3,_0x2e0958){if(_0x282fec[_0x0d2b('0xa')](_0x0d2b('0xb'))){_0x282fec[_0x0d2b('0xc')]=moment()[_0x0d2b('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2e0958(null,_0x282fec);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 71e57fc..02e421e 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 _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 +var _0x24fd=['addTags','omit','ids','spread','AddTags','catch','util','ioredis','../../mysqldb','client','http','defaults','localhost','redis','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','find'];(function(_0x4fd544,_0x407d08){var _0x200dd2=function(_0x2f4e1b){while(--_0x2f4e1b){_0x4fd544['push'](_0x4fd544['shift']());}};_0x200dd2(++_0x407d08);}(_0x24fd,0x126));var _0xd24f=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x24fd[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var util=require(_0xd24f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd24f('0x1'));var db=require(_0xd24f('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd24f('0x3')][_0xd24f('0x4')]({'port':0x232a});config['redis']=_[_0xd24f('0x5')](config['redis'],{'host':_0xd24f('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd24f('0x7')]));require(_0xd24f('0x8'))[_0xd24f('0x9')](socket);function respondWithRpcPromise(_0x267755,_0x5156de,_0x5c759d){return new BPromise(function(_0x5c3257,_0xe1a0ac){return client['request'](_0x267755,_0x5c759d)[_0xd24f('0xa')](function(_0x5bf1f6){logger['info'](_0xd24f('0xb'),_0x5156de,_0xd24f('0xc'));logger[_0xd24f('0xd')](_0xd24f('0xe'),_0x5156de,_0xd24f('0xc'),JSON['stringify'](_0x5bf1f6));if(_0x5bf1f6['error']){if(_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x10')]===0x1f4){logger['error'](_0xd24f('0xb'),_0x5156de,_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);return _0xe1a0ac(_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);}logger[_0xd24f('0xf')](_0xd24f('0xb'),_0x5156de,_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);return _0x5c3257(_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);}else{logger[_0xd24f('0x12')](_0xd24f('0xb'),_0x5156de,'request\x20sent');_0x5c3257(_0x5bf1f6['result'][_0xd24f('0x11')]);}})['catch'](function(_0x198aa4){logger['error'](_0xd24f('0xb'),_0x5156de,_0x198aa4);_0xe1a0ac(_0x198aa4);});});}exports['UpdateWhatsappInteraction']=function(_0x5c92a6){var _0x20e730=this;return new Promise(function(_0x5a5473,_0x36e19f){return db['WhatsappInteraction'][_0xd24f('0x13')](_0x5c92a6[_0xd24f('0x14')],{'raw':_0x5c92a6[_0xd24f('0x15')]?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c92a6['options']?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x17')]||null:null,'attributes':_0x5c92a6[_0xd24f('0x15')]?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x18')]||null:null,'limit':_0x5c92a6['options']?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x19')]||null:null})[_0xd24f('0xa')](function(_0x12feec){logger['info']('UpdateWhatsappInteraction',_0x5c92a6);logger[_0xd24f('0xd')](_0xd24f('0x1a'),_0x5c92a6,JSON[_0xd24f('0x1b')](_0x12feec));_0x5a5473(_0x12feec);})['catch'](function(_0x10ac9c){logger[_0xd24f('0xf')](_0xd24f('0x1a'),_0x10ac9c[_0xd24f('0x11')],_0x5c92a6);_0x36e19f(_0x20e730[_0xd24f('0xf')](0x1f4,_0x10ac9c['message']));});});};exports[_0xd24f('0x1c')]=function(_0x557f5d){return new Promise(function(_0x2e4907,_0x267d6e){return db['WhatsappInteraction'][_0xd24f('0x1d')]({'where':_0x557f5d[_0xd24f('0x15')]?_0x557f5d[_0xd24f('0x15')]['where']||null:null})[_0xd24f('0xa')](function(_0x26aa32){if(_0x26aa32){return _0x26aa32[_0xd24f('0x1e')](_0x557f5d[_0xd24f('0x14')]['ids'],_[_0xd24f('0x1f')](_0x557f5d[_0xd24f('0x14')],[_0xd24f('0x20'),'id'])||{});}})[_0xd24f('0x21')](function(_0x10116f){logger[_0xd24f('0x12')]('AddTags',_0x557f5d);logger[_0xd24f('0xd')](_0xd24f('0x22'),_0x557f5d,JSON['stringify'](_0x10116f));_0x2e4907(_0x10116f);})[_0xd24f('0x23')](function(_0x12c9ff){logger[_0xd24f('0xf')](_0xd24f('0x22'),_0x12c9ff['message'],_0x557f5d);_0x267d6e(_this[_0xd24f('0xf')](0x1f4,_0x12c9ff[_0xd24f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 475b1f9..144ab2a 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 _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 +var _0xb1d7=['remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x1cff5c,_0xcd81ed){var _0xdb32c1=function(_0x38b288){while(--_0x38b288){_0x1cff5c['push'](_0x1cff5c['shift']());}};_0xdb32c1(++_0xcd81ed);}(_0xb1d7,0x7e));var _0x7b1d=function(_0x15cf3c,_0x1ec9f2){_0x15cf3c=_0x15cf3c-0x0;var _0x3b8451=_0xb1d7[_0x15cf3c];return _0x3b8451;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x7b1d('0x0'),_0x7b1d('0x1')];function createListener(_0x4126ed,_0x3029c2){return function(_0x3e9909){_0x3029c2[_0x7b1d('0x2')](_0x4126ed,_0x3e9909);};}function removeListener(_0x1856ea,_0x2143a5){return function(){WhatsappInteractionEvents[_0x7b1d('0x3')](_0x1856ea,_0x2143a5);};}exports[_0x7b1d('0x4')]=function(_0x53842f){for(var _0x4568b5=0x0,_0x1099c1=events[_0x7b1d('0x5')];_0x4568b5<_0x1099c1;_0x4568b5++){var _0x50b6c6=events[_0x4568b5];var _0x2b3b06=createListener(_0x7b1d('0x6')+_0x50b6c6,_0x53842f);WhatsappInteractionEvents['on'](_0x50b6c6,_0x2b3b06);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 132e706..c5d3039 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 _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 +var _0x6208=['post','tracked','whatsapp','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x432792,_0x6a452a){var _0x27d7e8=function(_0x31df16){while(--_0x31df16){_0x432792['push'](_0x432792['shift']());}};_0x27d7e8(++_0x6a452a);}(_0x6208,0xf6));var _0x8620=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x6208[_0x59e862];return _0x1a25ee;};'use strict';var multer=require(_0x8620('0x0'));var util=require('util');var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require(_0x8620('0x3'));var router=express[_0x8620('0x4')]();var fs_extra=require(_0x8620('0x5'));var auth=require(_0x8620('0x6'));var interaction=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var controller=require('./whatsappMessage.controller');router[_0x8620('0x9')]('/',auth[_0x8620('0xa')](),controller[_0x8620('0xb')]);router[_0x8620('0x9')](_0x8620('0xc'),auth['isAuthenticated'](),controller[_0x8620('0xd')]);router[_0x8620('0x9')]('/:id',auth[_0x8620('0xa')](),controller['show']);router[_0x8620('0xe')]('/',auth[_0x8620('0xa')](),interaction[_0x8620('0xf')](_0x8620('0x10'),'whatsappmessage:create'),controller[_0x8620('0x11')]);router[_0x8620('0xe')]('/:id/status',controller[_0x8620('0x12')]);router[_0x8620('0x13')]('/:id',auth[_0x8620('0xa')](),controller['update']);router[_0x8620('0x13')](_0x8620('0x14'),auth[_0x8620('0xa')](),controller[_0x8620('0x15')]);router[_0x8620('0x13')](_0x8620('0x16'),auth[_0x8620('0xa')](),controller[_0x8620('0x17')]);router[_0x8620('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8620('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 0497495..70e5244 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 _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 +var _0x77d9=['STRING','DATE','TEXT','BOOLEAN','ENUM','out'];(function(_0x5ba74f,_0x200bf4){var _0x534d79=function(_0x50521a){while(--_0x50521a){_0x5ba74f['push'](_0x5ba74f['shift']());}};_0x534d79(++_0x200bf4);}(_0x77d9,0x159));var _0x977d=function(_0xe1b102,_0x542a72){_0xe1b102=_0xe1b102-0x0;var _0xed6dcc=_0x77d9[_0xe1b102];return _0xed6dcc;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x977d('0x0')],'defaultValue':![]},'direction':{'type':Sequelize[_0x977d('0x1')]('in','out'),'defaultValue':_0x977d('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x977d('0x3')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x977d('0x4')]},'secret':{'type':Sequelize[_0x977d('0x0')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x977d('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6d5b7bd..4bf5ad3 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 _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 +var _0x872d=['findAll','rows','show','params','rawAttributes','include','create','body','update','find','describe','accept','whatsapp','reject','UserId','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','whatsapp-interactions','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappMessage','includeAll'];(function(_0x539c90,_0x3087ac){var _0x3656c9=function(_0x5bf35e){while(--_0x5bf35e){_0x539c90['push'](_0x539c90['shift']());}};_0x3656c9(++_0x3087ac);}(_0x872d,0x116));var _0xd872=function(_0x5c5b53,_0x5c8b34){_0x5c5b53=_0x5c5b53-0x0;var _0x549078=_0x872d[_0x5c5b53];return _0x549078;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0xd872('0x0'));var interactionService=require('../../components/interaction/service');var qs=require(_0xd872('0x1'));var logger=require(_0xd872('0x2'))(_0xd872('0x3'));var config=require(_0xd872('0x4'));var db=require(_0xd872('0x5'))['db'];config[_0xd872('0x6')]=_[_0xd872('0x7')](config['redis'],{'host':_0xd872('0x8'),'port':0x18eb});var socket=require(_0xd872('0x9'))(new Redis(config[_0xd872('0x6')]));require(_0xd872('0xa'))[_0xd872('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd872('0xc')][_0xd872('0xd')]({'port':0x232c});var client9002=jayson[_0xd872('0xc')]['http']({'port':0x232a});var interaction_log=require(_0xd872('0x2'))(_0xd872('0xe'));function respondWithRpcPromise(_0x86c3b,_0x4740ac,_0x179784,_0x6a54e8){return new Promise(function(_0x9782cb,_0x784504){var _0x43c25b=_0x6a54e8||client;return _0x43c25b['request'](_0x86c3b,_0x179784)['then'](function(_0x2db58a){logger['info'](_0xd872('0xf'),_0x4740ac,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4740ac,_0xd872('0x10'),JSON[_0xd872('0x11')](_0x2db58a));if(_0x2db58a[_0xd872('0x12')]){if(_0x2db58a[_0xd872('0x12')]['code']===0x1f4){logger[_0xd872('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x4740ac,_0x2db58a[_0xd872('0x12')][_0xd872('0x13')]);return _0x784504(_0x2db58a['error']['message']);}logger[_0xd872('0x12')](_0xd872('0xf'),_0x4740ac,_0x2db58a[_0xd872('0x12')][_0xd872('0x13')]);return _0x9782cb(_0x2db58a[_0xd872('0x12')][_0xd872('0x13')]);}else{logger[_0xd872('0x14')](_0xd872('0xf'),_0x4740ac,_0xd872('0x10'));_0x9782cb(_0x2db58a[_0xd872('0x15')]['message']);}})[_0xd872('0x16')](function(_0xcad24f){logger[_0xd872('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x4740ac,_0xcad24f);_0x784504(_0xcad24f);});});}function respondWithResult(_0x391520,_0x3abe88){_0x3abe88=_0x3abe88||0xc8;return function(_0x34d768){if(_0x34d768){return _0x391520[_0xd872('0x17')](_0x3abe88)[_0xd872('0x18')](_0x34d768);}};}function respondWithFilteredResult(_0x533866,_0x4a935b){return function(_0x387042){if(_0x387042){var _0x4cdcac=typeof _0x4a935b[_0xd872('0x19')]===_0xd872('0x1a')&&typeof _0x4a935b[_0xd872('0x1b')]===_0xd872('0x1a');var _0x48b65f=_0x387042[_0xd872('0x1c')];var _0x4a0a4c=_0x4cdcac?0x0:_0x4a935b['offset'];var _0x461a93=_0x4cdcac?_0x387042[_0xd872('0x1c')]:_0x4a935b[_0xd872('0x19')]+_0x4a935b[_0xd872('0x1b')];var _0x81e98a;if(_0x461a93>=_0x48b65f){_0x461a93=_0x48b65f;_0x81e98a=0xc8;}else{_0x81e98a=0xce;}_0x533866[_0xd872('0x17')](_0x81e98a);return _0x533866[_0xd872('0x1d')](_0xd872('0x1e'),_0x4a0a4c+'-'+_0x461a93+'/'+_0x48b65f)[_0xd872('0x18')](_0x387042);}return null;};}function saveUpdates(_0x13de12){return function(_0x566eff){if(_0x566eff){return _0x566eff['update'](_0x13de12)[_0xd872('0x1f')](function(_0x104cbd){return _0x104cbd;});}return null;};}function removeEntity(_0x28b6c3){return function(_0x3ba643){if(_0x3ba643){return _0x3ba643[_0xd872('0x20')]()['then'](function(){_0x28b6c3[_0xd872('0x17')](0xcc)[_0xd872('0x21')]();});}};}function handleEntityNotFound(_0x2b2bb8){return function(_0x5cdef7){if(!_0x5cdef7){_0x2b2bb8['sendStatus'](0x194);}return _0x5cdef7;};}function handleError(_0xb8a1b8,_0x152d9a){_0x152d9a=_0x152d9a||0x1f4;return function(_0x16d728){logger[_0xd872('0x12')](_0x16d728[_0xd872('0x22')]);if(_0x16d728[_0xd872('0x23')]){delete _0x16d728[_0xd872('0x23')];}_0xb8a1b8['status'](_0x152d9a)[_0xd872('0x24')](_0x16d728);};}exports[_0xd872('0x25')]=function(_0x1f21e0,_0x2fa246){var _0x1c19a9={},_0x4fdf8c={},_0x49781b={'count':0x0,'rows':[]};var _0x530f98=_[_0xd872('0x26')](db['WhatsappMessage']['rawAttributes'],function(_0x4b6c72){return{'name':_0x4b6c72['fieldName'],'type':_0x4b6c72['type'][_0xd872('0x27')]};});_0x4fdf8c[_0xd872('0x28')]=_[_0xd872('0x26')](_0x530f98,_0xd872('0x23'));_0x4fdf8c[_0xd872('0x29')]=_[_0xd872('0x2a')](_0x1f21e0[_0xd872('0x29')]);_0x4fdf8c[_0xd872('0x2b')]=_[_0xd872('0x2c')](_0x4fdf8c[_0xd872('0x28')],_0x4fdf8c[_0xd872('0x29')]);_0x1c19a9[_0xd872('0x2d')]=_[_0xd872('0x2c')](_0x4fdf8c[_0xd872('0x28')],qs[_0xd872('0x2e')](_0x1f21e0['query'][_0xd872('0x2e')]));_0x1c19a9[_0xd872('0x2d')]=_0x1c19a9[_0xd872('0x2d')][_0xd872('0x2f')]?_0x1c19a9[_0xd872('0x2d')]:_0x4fdf8c['model'];if(!_0x1f21e0[_0xd872('0x29')][_0xd872('0x30')](_0xd872('0x31'))){_0x1c19a9[_0xd872('0x1b')]=qs[_0xd872('0x1b')](_0x1f21e0[_0xd872('0x29')][_0xd872('0x1b')]);_0x1c19a9['offset']=qs[_0xd872('0x19')](_0x1f21e0[_0xd872('0x29')]['offset']);}_0x1c19a9[_0xd872('0x32')]=qs[_0xd872('0x33')](_0x1f21e0[_0xd872('0x29')]['sort']);_0x1c19a9[_0xd872('0x34')]=qs[_0xd872('0x2b')](_[_0xd872('0x35')](_0x1f21e0[_0xd872('0x29')],_0x4fdf8c[_0xd872('0x2b')]),_0x530f98);if(_0x1f21e0['query'][_0xd872('0x36')]){_0x1c19a9[_0xd872('0x34')]=_[_0xd872('0x37')](_0x1c19a9[_0xd872('0x34')],{'$or':_[_0xd872('0x26')](_0x530f98,function(_0x43199e){if(_0x43199e[_0xd872('0x38')]!==_0xd872('0x39')){var _0x5b6149={};_0x5b6149[_0x43199e[_0xd872('0x23')]]={'$like':'%'+_0x1f21e0['query'][_0xd872('0x36')]+'%'};return _0x5b6149;}})});}_0x1c19a9=_[_0xd872('0x37')]({},_0x1c19a9,_0x1f21e0[_0xd872('0x3a')]);var _0x4472d8={'where':_0x1c19a9[_0xd872('0x34')]};return db[_0xd872('0x3b')]['count'](_0x4472d8)[_0xd872('0x1f')](function(_0x2587f7){_0x49781b[_0xd872('0x1c')]=_0x2587f7;if(_0x1f21e0['query'][_0xd872('0x3c')]){_0x1c19a9['include']=[{'all':!![]}];}return db[_0xd872('0x3b')][_0xd872('0x3d')](_0x1c19a9);})[_0xd872('0x1f')](function(_0x4a7fd5){_0x49781b[_0xd872('0x3e')]=_0x4a7fd5;return _0x49781b;})[_0xd872('0x1f')](respondWithFilteredResult(_0x2fa246,_0x1c19a9))[_0xd872('0x16')](handleError(_0x2fa246,null));};exports[_0xd872('0x3f')]=function(_0x75deb9,_0x50cde3){var _0x4f8d0c={'raw':!![],'where':{'id':_0x75deb9[_0xd872('0x40')]['id']}},_0xca0550={};_0xca0550[_0xd872('0x28')]=_[_0xd872('0x2a')](db[_0xd872('0x3b')][_0xd872('0x41')]);_0xca0550['query']=_[_0xd872('0x2a')](_0x75deb9['query']);_0xca0550['filters']=_[_0xd872('0x2c')](_0xca0550[_0xd872('0x28')],_0xca0550[_0xd872('0x29')]);_0x4f8d0c[_0xd872('0x2d')]=_[_0xd872('0x2c')](_0xca0550[_0xd872('0x28')],qs[_0xd872('0x2e')](_0x75deb9[_0xd872('0x29')][_0xd872('0x2e')]));_0x4f8d0c[_0xd872('0x2d')]=_0x4f8d0c[_0xd872('0x2d')]['length']?_0x4f8d0c[_0xd872('0x2d')]:_0xca0550['model'];if(_0x75deb9[_0xd872('0x29')]['includeAll']){_0x4f8d0c[_0xd872('0x42')]=[{'all':!![]}];}_0x4f8d0c=_[_0xd872('0x37')]({},_0x4f8d0c,_0x75deb9['options']);return db[_0xd872('0x3b')]['find'](_0x4f8d0c)[_0xd872('0x1f')](handleEntityNotFound(_0x50cde3,null))[_0xd872('0x1f')](respondWithResult(_0x50cde3,null))[_0xd872('0x16')](handleError(_0x50cde3,null));};exports[_0xd872('0x43')]=function(_0x42689f,_0x5c7e57){return db[_0xd872('0x3b')][_0xd872('0x43')](_0x42689f[_0xd872('0x44')],{})[_0xd872('0x1f')](respondWithResult(_0x5c7e57,0xc9))[_0xd872('0x16')](handleError(_0x5c7e57,null));};exports[_0xd872('0x45')]=function(_0x3de605,_0x1bf72c){if(_0x3de605[_0xd872('0x44')]['id']){delete _0x3de605[_0xd872('0x44')]['id'];}return db['WhatsappMessage'][_0xd872('0x46')]({'where':{'id':_0x3de605[_0xd872('0x40')]['id']}})[_0xd872('0x1f')](handleEntityNotFound(_0x1bf72c,null))[_0xd872('0x1f')](saveUpdates(_0x3de605[_0xd872('0x44')],null))['then'](respondWithResult(_0x1bf72c,null))[_0xd872('0x16')](handleError(_0x1bf72c,null));};exports[_0xd872('0x20')]=function(_0x4e415a,_0x13c6bc){return db[_0xd872('0x3b')]['find']({'where':{'id':_0x4e415a[_0xd872('0x40')]['id']}})['then'](handleEntityNotFound(_0x13c6bc,null))[_0xd872('0x1f')](removeEntity(_0x13c6bc,null))[_0xd872('0x16')](handleError(_0x13c6bc,null));};exports[_0xd872('0x47')]=function(_0x296a41,_0x34a572){return db[_0xd872('0x3b')][_0xd872('0x47')]()[_0xd872('0x1f')](respondWithResult(_0x34a572,null))[_0xd872('0x16')](handleError(_0x34a572,null));};exports[_0xd872('0x48')]=function(_0x1f1d0b,_0x40f087){var _0x3c69be=_0xd872('0x49');return interactionService['acceptMessage'](_0x1f1d0b,_0x3c69be)[_0xd872('0x1f')](respondWithResult(_0x40f087,null))[_0xd872('0x16')](handleError(_0x40f087,null));};exports[_0xd872('0x4a')]=function(_0x1da5ae,_0x48ba15){var _0x4d14b7={'agent':{},'channel':_0xd872('0x49')};if(_0x1da5ae[_0xd872('0x44')]['id']){delete _0x1da5ae['body']['id'];}_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')]=_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')]||_0x1da5ae['user']['id'];_0x4d14b7['agent']['id']=_0x1da5ae['body'][_0xd872('0x4b')];return db[_0xd872('0x3b')][_0xd872('0x46')]({'where':{'id':_0x1da5ae[_0xd872('0x40')]['id'],'UserId':null}})[_0xd872('0x1f')](handleEntityNotFound(_0x48ba15,null))['then'](function(_0x3037ca){if(_0x3037ca){_0x4d14b7[_0xd872('0x13')]=_0x3037ca[_0xd872('0x4c')]({'plain':!![]});return db[_0xd872('0x4d')][_0xd872('0x46')]({'where':{'id':_0x3037ca[_0xd872('0x4e')]}});}return null;})['then'](handleEntityNotFound(_0x48ba15,null))['then'](function(_0x1add3d){if(_0x1add3d){_0x4d14b7[_0xd872('0x4f')]=_0x1add3d['get']({'plain':!![]});interaction_log['info'](_0xd872('0x50'),_0x1da5ae[_0xd872('0x51')]['id'],_0x1da5ae['user'][_0xd872('0x23')],_0x1da5ae['user'][_0xd872('0x52')],_0x4d14b7[_0xd872('0x4f')]['id'],_0x1da5ae[_0xd872('0x44')]?JSON[_0xd872('0x11')](_0x1da5ae['body']):_0xd872('0x53'));return respondWithRpcPromise(_0xd872('0x54'),_0xd872('0x55'),_0x4d14b7);}return null;})[_0xd872('0x1f')](function(_0x596d19){var _0x2d9cf6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x596d19['message'][_0xd872('0x56')];return db[_0xd872('0x57')][_0xd872('0x29')](_0x2d9cf6,{'type':db[_0xd872('0x58')][_0xd872('0x59')][_0xd872('0x5a')],'raw':!![]})[_0xd872('0x1f')](function(_0x158f52){return _0x158f52;});})['then'](function(_0x4e869f){if(_0x4e869f){_0x4d14b7['message'][_0xd872('0x5b')]=_0x4e869f[0x0];if(!_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')])return;return db[_0xd872('0x5c')]['find']({'where':{'id':_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')],'role':_0xd872('0x5d')},'attributes':['id',_0xd872('0x23'),'fullname','email',_0xd872('0x5e')],'raw':!![]});}return null;})[_0xd872('0x1f')](function(_0x4f0428){if(!_0x4f0428)return null;_0x4d14b7[_0xd872('0x13')][_0xd872('0x5d')]=_0x4f0428;return _0x4d14b7;})[_0xd872('0x1f')](function(_0x4e073a){if(_0x4e073a){_0x4e073a[_0xd872('0x13')][_0xd872('0x5f')]=util[_0xd872('0x60')](_0xd872('0x61'),_0x1da5ae[_0xd872('0x51')][_0xd872('0x23')]);_0x4e073a[_0xd872('0x13')][_0xd872('0x62')]=_0x4d14b7['channel'];_0x4e073a[_0xd872('0x13')][_0xd872('0x63')]=_0x4d14b7[_0xd872('0x62')];_0x4e073a['message'][_0xd872('0x64')]=_0xd872('0x4a');respondWithRpcPromise('EventManager',_0xd872('0x65'),{'event':_0xd872('0x66'),'message':_0x4e073a['message']},client9002);return _0x4d14b7;}return null;})[_0xd872('0x1f')](respondWithResult(_0x48ba15,null))[_0xd872('0x16')](handleError(_0x48ba15,null));};exports[_0xd872('0x17')]=function(_0x12779d,_0xd2b3b4){if(_0x12779d['body']['id']){delete _0x12779d[_0xd872('0x44')]['id'];}var _0x1d9ffe;return db[_0xd872('0x3b')][_0xd872('0x46')]({'where':{'id':_0x12779d[_0xd872('0x40')]['id']}})[_0xd872('0x1f')](handleEntityNotFound(_0xd2b3b4,null))[_0xd872('0x1f')](function(_0x2ca832){if(_0x2ca832){_0x1d9ffe=_0x2ca832;return db[_0xd872('0x67')][_0xd872('0x46')]({'where':{'id':_0x2ca832[_0xd872('0x68')]}});}})[_0xd872('0x1f')](handleEntityNotFound(_0xd2b3b4,null))['then'](function(_0x4a68bb){if(_0x4a68bb){logger[_0xd872('0x69')](_0xd872('0x6a'),_0xd872('0x17'),'received\x20delivery\x20report\x20from',_0x4a68bb['type'],util[_0xd872('0x6b')](_0x12779d[_0xd872('0x44')],{'showHidden':![],'depth':null}));switch(_0x4a68bb[_0xd872('0x38')]){case'twilio':if(_0x12779d['body']['MessageSid']&&_0x12779d['body']['MessageSid']===_0x1d9ffe[_0xd872('0x6c')]&&_0x12779d['body'][_0xd872('0x6d')]&&_0x12779d[_0xd872('0x44')][_0xd872('0x6d')]===_0xd872('0x6e')){return _0x1d9ffe[_0xd872('0x45')]({'read':!![]});}else{logger[_0xd872('0x12')](_0xd872('0x6f'),_0xd872('0x17'),_0xd872('0x70'),util['inspect'](_0x12779d[_0xd872('0x44')],{'showHidden':![],'depth':null}));}break;}return _0x1d9ffe;}})[_0xd872('0x1f')](respondWithResult(_0xd2b3b4,null))['catch'](handleError(_0xd2b3b4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d962410..f8e348d 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 _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 +var _0x594d=['setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x5b23c9,_0x501087){var _0x3ebbc7=function(_0x1e2bcf){while(--_0x1e2bcf){_0x5b23c9['push'](_0x5b23c9['shift']());}};_0x3ebbc7(++_0x501087);}(_0x594d,0x92));var _0xd594=function(_0x3195a1,_0x412b38){_0x3195a1=_0x3195a1-0x0;var _0x114330=_0x594d[_0x3195a1];return _0x114330;};'use strict';var EventEmitter=require(_0xd594('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd594('0x1')](0x0);var events={'afterCreate':_0xd594('0x2'),'afterUpdate':_0xd594('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10f523){return function(_0x40d8fa,_0x10155d,_0x7f4ec6){WhatsappMessageEvents['emit'](_0x10f523+':'+_0x40d8fa['id'],_0x40d8fa);WhatsappMessageEvents[_0xd594('0x4')](_0x10f523,_0x40d8fa);_0x7f4ec6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xd594('0x5')](e,emitEvent(event));}}module[_0xd594('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 1a6fb0c..5e9821d 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 _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 +var _0xe95f=['catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then'];(function(_0x37957c,_0x2be9fa){var _0x34a50e=function(_0x5cc0c7){while(--_0x5cc0c7){_0x37957c['push'](_0x37957c['shift']());}};_0x34a50e(++_0x2be9fa);}(_0xe95f,0x64));var _0xfe95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe95f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe95('0x0'));var util=require(_0xfe95('0x1'));var logger=require(_0xfe95('0x2'))(_0xfe95('0x3'));var moment=require(_0xfe95('0x4'));var BPromise=require(_0xfe95('0x5'));var rp=require(_0xfe95('0x6'));var fetch=require(_0xfe95('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe95('0x8'));var config=require(_0xfe95('0x9'));var attributes=require(_0xfe95('0xa'));module[_0xfe95('0xb')]=function(_0x406773,_0x45490a){return _0x406773['define'](_0xfe95('0xc'),attributes,{'tableName':_0xfe95('0xd'),'paranoid':![],'indexes':[{'name':_0xfe95('0xe'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xfe95('0xf')],'type':_0xfe95('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b10aa,_0x2a2cea,_0x258cdf){var _0x2ff69e=_0x406773[_0xfe95('0x11')];var _0x133fe0=_0x4b10aa[_0xfe95('0x12')]({'plain':!![]});if(_0x133fe0[_0xfe95('0x13')][_0xfe95('0x14')]()==='in'||_0x133fe0[_0xfe95('0x13')][_0xfe95('0x14')]()===_0xfe95('0x15')&&!_0x133fe0[_0xfe95('0x16')]&&!_[_0xfe95('0x17')](_0x133fe0[_0xfe95('0x18')])){_0x2ff69e['WhatsappInteraction'][_0xfe95('0x19')]({'where':{'id':_0x133fe0[_0xfe95('0x1a')]}})[_0xfe95('0x1b')](function(_0x3e83d8){if(_0x3e83d8){_0x3e83d8['update']({'lastMsgAt':_0x133fe0['createdAt'],'lastMsgDirection':_0x133fe0[_0xfe95('0x13')]['toLowerCase']()});}})[_0xfe95('0x1c')](function(_0x53d837){console[_0xfe95('0x1d')](_0x53d837);});}if(_0x133fe0[_0xfe95('0x13')]==='out'&&!_0x133fe0[_0xfe95('0x16')]){var _0x5b68b5;_0x2ff69e[_0xfe95('0x1e')][_0xfe95('0x1f')]({'where':{'id':_0x133fe0[_0xfe95('0x20')]},'raw':!![]})[_0xfe95('0x1b')](function(_0x2a59f2){_0x5b68b5=_0x2a59f2;if(_0x5b68b5&&_0x5b68b5['type']){switch(_0x5b68b5[_0xfe95('0x21')]){case _0xfe95('0x22'):var _0x25f8ba=require(_0xfe95('0x22'));if(_0x5b68b5[_0xfe95('0x23')]&&_0x5b68b5[_0xfe95('0x24')]&&_0x5b68b5[_0xfe95('0x25')]){var _0x10c6f8=new _0x25f8ba(_0x5b68b5['accountSid'],_0x5b68b5[_0xfe95('0x24')]);_0x10c6f8[_0xfe95('0x26')]['create']({'body':_0x133fe0[_0xfe95('0xf')],'to':_0xfe95('0x27')+_0x133fe0[_0xfe95('0x25')],'from':_0xfe95('0x27')+_0x5b68b5[_0xfe95('0x25')],'statusCallback':_0x5b68b5[_0xfe95('0x28')]+_0xfe95('0x29')+_0x133fe0['id']+_0xfe95('0x2a')+_0x5b68b5[_0xfe95('0x2b')]})['then'](function(_0x4418c0){if(_0x4418c0[_0xfe95('0x2c')]){return _0x4b10aa[_0xfe95('0x2d')]({'messageId':_0x4418c0[_0xfe95('0x2c')]});}})[_0xfe95('0x1c')](function(_0x83c53f){logger[_0xfe95('0x1d')](_0xfe95('0x2e'),_0xfe95('0x2f'),'twilio',util[_0xfe95('0x30')](_0x83c53f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfe95('0x2e'),'afterCreate','twilio',_0xfe95('0x31'));}break;case _0xfe95('0x32'):var _0x23caba=_0x5b68b5['accountSid'];var _0x59a69d=_0x5b68b5[_0xfe95('0x24')];var _0x2e9d7f=_0x5b68b5[_0xfe95('0x33')]+_0xfe95('0x34')+_0x23caba+_0xfe95('0x35');var _0x52623e={'to':[_0x133fe0[_0xfe95('0x25')]],'message':{'type':_0xfe95('0x36'),'text':_0x133fe0[_0xfe95('0xf')]}};var _0x286ccc={'method':_0xfe95('0x37'),'uri':_0x2e9d7f,'headers':{'Authorization':'Bearer\x20'+_0x59a69d,'Content-Type':_0xfe95('0x38')},'body':_0x52623e,'json':!![]};rp(_0x286ccc)[_0xfe95('0x1b')](function(_0x40c3cf){if(_0x40c3cf[_0xfe95('0x39')][0x0][_0xfe95('0x3a')]){return _0x4b10aa[_0xfe95('0x2d')]({'messageId':_0x40c3cf[_0xfe95('0x39')][0x0][_0xfe95('0x3a')]});}})[_0xfe95('0x1c')](function(_0xc3f3f8){logger[_0xfe95('0x3b')](_0xfe95('0x3c'),_0xc3f3f8);});break;}}})[_0xfe95('0x3d')](function(){_0x258cdf();});}else{_0x258cdf();}}},'charset':_0xfe95('0x3e'),'collate':_0xfe95('0x3f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e063a03..e722536 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 _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 +var _0xe509=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','debug','lodash'];(function(_0x3d3317,_0x8bf60){var _0x46494e=function(_0x20f6df){while(--_0x20f6df){_0x3d3317['push'](_0x3d3317['shift']());}};_0x46494e(++_0x8bf60);}(_0xe509,0xa9));var _0x9e50=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0xe509[_0x151418];return _0x40e29a;};'use strict';var _=require(_0x9e50('0x0'));var util=require(_0x9e50('0x1'));var moment=require('moment');var BPromise=require(_0x9e50('0x2'));var rs=require(_0x9e50('0x3'));var fs=require('fs');var Redis=require(_0x9e50('0x4'));var db=require(_0x9e50('0x5'))['db'];var utils=require(_0x9e50('0x6'));var logger=require('../../config/logger')(_0x9e50('0x7'));var config=require(_0x9e50('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e50('0x9')][_0x9e50('0xa')]({'port':0x232a});config[_0x9e50('0xb')]=_[_0x9e50('0xc')](config['redis'],{'host':_0x9e50('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e50('0xb')]));require(_0x9e50('0xe'))[_0x9e50('0xf')](socket);function respondWithRpcPromise(_0x4c35a7,_0x3e2a51,_0x58d485){return new BPromise(function(_0x110313,_0x708825){return client[_0x9e50('0x10')](_0x4c35a7,_0x58d485)[_0x9e50('0x11')](function(_0x5cfabb){logger[_0x9e50('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x3e2a51,_0x9e50('0x13'));logger['debug'](_0x9e50('0x14'),_0x3e2a51,_0x9e50('0x13'),JSON[_0x9e50('0x15')](_0x5cfabb));if(_0x5cfabb[_0x9e50('0x16')]){if(_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x17')]===0x1f4){logger[_0x9e50('0x16')](_0x9e50('0x18'),_0x3e2a51,_0x5cfabb['error'][_0x9e50('0x19')]);return _0x708825(_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x19')]);}logger['error'](_0x9e50('0x18'),_0x3e2a51,_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x19')]);return _0x110313(_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x19')]);}else{logger[_0x9e50('0x12')](_0x9e50('0x18'),_0x3e2a51,_0x9e50('0x13'));_0x110313(_0x5cfabb[_0x9e50('0x1a')][_0x9e50('0x19')]);}})[_0x9e50('0x1b')](function(_0xfff9c8){logger['error'](_0x9e50('0x18'),_0x3e2a51,_0xfff9c8);_0x708825(_0xfff9c8);});});}exports[_0x9e50('0x1c')]=function(_0x36e0bd){var _0x526b17=this;return new Promise(function(_0x13c1d3,_0x2db2bd){return db[_0x9e50('0x1d')]['create'](_0x36e0bd[_0x9e50('0x1e')],{'raw':_0x36e0bd[_0x9e50('0x1f')]?_0x36e0bd[_0x9e50('0x1f')][_0x9e50('0x20')]===undefined?!![]:![]:!![]})[_0x9e50('0x11')](function(_0x23556e){logger[_0x9e50('0x12')]('CreateWhatsappMessage',_0x36e0bd);logger[_0x9e50('0x21')](_0x9e50('0x1c'),_0x36e0bd,JSON[_0x9e50('0x15')](_0x23556e));_0x13c1d3(_0x23556e);})[_0x9e50('0x1b')](function(_0x3b90c7){logger['error']('CreateWhatsappMessage',_0x3b90c7[_0x9e50('0x19')],_0x36e0bd);_0x2db2bd(_0x526b17[_0x9e50('0x16')](0x1f4,_0x3b90c7[_0x9e50('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 81b5bd8..044e9f7 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 _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 +var _0x3bcd=['removeListener','register','length','whatsappMessage:','save','emit'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x3bcd,0x82));var _0xd3bc=function(_0x3aa779,_0x4a18c5){_0x3aa779=_0x3aa779-0x0;var _0x2fd150=_0x3bcd[_0x3aa779];return _0x2fd150;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd3bc('0x0'),'remove','update'];function createListener(_0x355bb8,_0x5dfeb9){return function(_0x2e7876){_0x5dfeb9[_0xd3bc('0x1')](_0x355bb8,_0x2e7876);};}function removeListener(_0x1346dc,_0x109b97){return function(){WhatsappMessageEvents[_0xd3bc('0x2')](_0x1346dc,_0x109b97);};}exports[_0xd3bc('0x3')]=function(_0x2555da){for(var _0x1b152e=0x0,_0x30fa92=events[_0xd3bc('0x4')];_0x1b152e<_0x30fa92;_0x1b152e++){var _0x44412f=events[_0x1b152e];var _0x4b731e=createListener(_0xd3bc('0x5')+_0x44412f,_0x2555da);WhatsappMessageEvents['on'](_0x44412f,_0x4b731e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c166212..165b0fb 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 _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 +var _0xa096=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','express','../../components/interaction/service','./whatsappQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa096,0xd7));var _0x6a09=function(_0x193b59,_0x1d3454){_0x193b59=_0x193b59-0x0;var _0x339e71=_0xa096[_0x193b59];return _0x339e71;};'use strict';var multer=require('multer');var util=require(_0x6a09('0x0'));var path=require(_0x6a09('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a09('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a09('0x3'));var config=require('../../config/environment');var controller=require(_0x6a09('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x6a09('0x5')]);router[_0x6a09('0x6')](_0x6a09('0x7'),auth[_0x6a09('0x8')](),controller[_0x6a09('0x9')]);router['get'](_0x6a09('0xa'),auth[_0x6a09('0x8')](),controller['show']);router[_0x6a09('0x6')](_0x6a09('0xb'),auth[_0x6a09('0x8')](),controller[_0x6a09('0xc')]);router[_0x6a09('0x6')](_0x6a09('0xd'),auth[_0x6a09('0x8')](),controller[_0x6a09('0xe')]);router[_0x6a09('0x6')](_0x6a09('0xf'),auth[_0x6a09('0x8')](),controller[_0x6a09('0x10')]);router['post']('/',auth[_0x6a09('0x8')](),controller['create']);router[_0x6a09('0x11')]('/:id/teams',auth[_0x6a09('0x8')](),controller[_0x6a09('0x12')]);router[_0x6a09('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x6a09('0x13')]);router[_0x6a09('0x14')]('/:id',auth[_0x6a09('0x8')](),controller[_0x6a09('0x15')]);router[_0x6a09('0x16')](_0x6a09('0xa'),auth['isAuthenticated'](),controller[_0x6a09('0x17')]);router[_0x6a09('0x16')]('/:id/teams',auth[_0x6a09('0x8')](),controller[_0x6a09('0x18')]);router[_0x6a09('0x16')](_0x6a09('0xf'),auth[_0x6a09('0x8')](),controller[_0x6a09('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 54781d0..bba53ca 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 _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 +var _0xb11e=['exports','STRING','name','INTEGER','beepall','roundrobin','sequelize'];(function(_0x53b72f,_0x3b97fa){var _0x201bea=function(_0x56ec1c){while(--_0x56ec1c){_0x53b72f['push'](_0x53b72f['shift']());}};_0x201bea(++_0x3b97fa);}(_0xb11e,0x7d));var _0xeb11=function(_0x1203d3,_0x197267){_0x1203d3=_0x1203d3-0x0;var _0x33d44c=_0xb11e[_0x1203d3];return _0x33d44c;};'use strict';var Sequelize=require(_0xeb11('0x0'));module[_0xeb11('0x1')]={'name':{'type':Sequelize[_0xeb11('0x2')],'unique':_0xeb11('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xeb11('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xeb11('0x5'),_0xeb11('0x6'))},'description':{'type':Sequelize[_0xeb11('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2b20c66..2c405fb 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 _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 +var _0x51d3=['addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','removeAgents','addAgents','omit','userWhatsappQueue:remove','getAgents','pick','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./whatsappQueue.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','stack','name','send','index','map','WhatsappQueue','fieldName','getOptions','include','query','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','filter','where','options','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','getTeams','Team'];(function(_0x3718b8,_0xf154fc){var _0x268f84=function(_0x2ed965){while(--_0x2ed965){_0x3718b8['push'](_0x3718b8['shift']());}};_0x268f84(++_0xf154fc);}(_0x51d3,0x188));var _0x351d=function(_0x59103d,_0x203fea){_0x59103d=_0x59103d-0x0;var _0x3ba108=_0x51d3[_0x59103d];return _0x3ba108;};'use strict';var BPromise=require(_0x351d('0x0'));var util=require(_0x351d('0x1'));var _=require(_0x351d('0x2'));var squel=require(_0x351d('0x3'));var Redis=require('ioredis');var qs=require(_0x351d('0x4'));var logger=require(_0x351d('0x5'))(_0x351d('0x6'));var config=require('../../config/environment');var db=require(_0x351d('0x7'))['db'];config[_0x351d('0x8')]=_['defaults'](config[_0x351d('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x351d('0x8')]));require(_0x351d('0x9'))[_0x351d('0xa')](socket);function respondWithStatusCode(_0x34a9f6,_0x3a2649){_0x3a2649=_0x3a2649||0xcc;return function(_0x437d62){if(_0x437d62){return _0x34a9f6['sendStatus'](_0x3a2649);}return _0x34a9f6['status'](_0x3a2649)[_0x351d('0xb')]();};}function respondWithResult(_0x15fe14,_0x71149d){_0x71149d=_0x71149d||0xc8;return function(_0x4e0176){if(_0x4e0176){return _0x15fe14[_0x351d('0xc')](_0x71149d)[_0x351d('0xd')](_0x4e0176);}};}function respondWithFilteredResult(_0x42c146,_0x1b984a){return function(_0x43ffea){if(_0x43ffea){var _0x401929=typeof _0x1b984a['offset']===_0x351d('0xe')&&typeof _0x1b984a[_0x351d('0xf')]===_0x351d('0xe');var _0x23174a=_0x43ffea[_0x351d('0x10')];var _0x2432e6=_0x401929?0x0:_0x1b984a[_0x351d('0x11')];var _0x2bcf72=_0x401929?_0x43ffea[_0x351d('0x10')]:_0x1b984a[_0x351d('0x11')]+_0x1b984a[_0x351d('0xf')];var _0x274426;if(_0x2bcf72>=_0x23174a){_0x2bcf72=_0x23174a;_0x274426=0xc8;}else{_0x274426=0xce;}_0x42c146[_0x351d('0xc')](_0x274426);return _0x42c146[_0x351d('0x12')](_0x351d('0x13'),_0x2432e6+'-'+_0x2bcf72+'/'+_0x23174a)[_0x351d('0xd')](_0x43ffea);}return null;};}function saveUpdates(_0x39ea49){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0x351d('0x14')](_0x39ea49)['then'](function(_0x270cae){return _0x270cae;});}return null;};}function removeEntity(_0x438745){return function(_0x21e500){if(_0x21e500){return _0x21e500[_0x351d('0x15')]()[_0x351d('0x16')](function(){var _0xc0eb59=_0x21e500[_0x351d('0x17')]({'plain':!![]});var _0x5ae01e=_0x351d('0x18');return db[_0x351d('0x19')][_0x351d('0x15')]({'where':{'type':_0x5ae01e,'resourceId':_0xc0eb59['id']}})['then'](function(){return _0x21e500;});})[_0x351d('0x16')](function(){_0x438745[_0x351d('0xc')](0xcc)[_0x351d('0xb')]();});}};}function handleEntityNotFound(_0x27e819){return function(_0x5ccfa4){if(!_0x5ccfa4){_0x27e819[_0x351d('0x1a')](0x194);}return _0x5ccfa4;};}function handleError(_0x41c44e,_0x29d662){_0x29d662=_0x29d662||0x1f4;return function(_0x548db8){logger['error'](_0x548db8[_0x351d('0x1b')]);if(_0x548db8[_0x351d('0x1c')]){delete _0x548db8[_0x351d('0x1c')];}_0x41c44e[_0x351d('0xc')](_0x29d662)[_0x351d('0x1d')](_0x548db8);};}exports[_0x351d('0x1e')]=function(_0x1cb1a9,_0x422ea3){var _0xb37a1c={};var _0x5e8d54={'count':0x0,'rows':[]};var _0x3ee4a7=_[_0x351d('0x1f')](db[_0x351d('0x20')]['rawAttributes'],function(_0xf1d4d){return{'name':_0xf1d4d[_0x351d('0x21')],'type':_0xf1d4d['type']['key']};});_0xb37a1c=qs[_0x351d('0x22')](_0x3ee4a7,_0x1cb1a9);var _0xc8ded5={'where':_0xb37a1c['where']};return db[_0x351d('0x20')][_0x351d('0x10')](_0xc8ded5)['then'](function(_0x211186){_0x5e8d54[_0x351d('0x10')]=_0x211186;_0xb37a1c[_0x351d('0x23')]=qs[_0x351d('0x23')](_0x1cb1a9[_0x351d('0x24')]);return db[_0x351d('0x20')]['findAll'](_0xb37a1c);})[_0x351d('0x16')](function(_0x566797){_0x5e8d54[_0x351d('0x25')]=_0x566797;return _0x5e8d54;})[_0x351d('0x16')](respondWithFilteredResult(_0x422ea3,_0xb37a1c))['catch'](handleError(_0x422ea3,null));};exports[_0x351d('0x26')]=function(_0x3e5965,_0x334ff9){var _0x12f3c1={'raw':!![],'where':{'id':_0x3e5965['params']['id']}},_0xf0054a={};_0xf0054a[_0x351d('0x27')]=_[_0x351d('0x28')](db[_0x351d('0x20')][_0x351d('0x29')]);_0xf0054a[_0x351d('0x24')]=_[_0x351d('0x28')](_0x3e5965[_0x351d('0x24')]);_0xf0054a[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0xf0054a[_0x351d('0x27')],_0xf0054a['query']);_0x12f3c1[_0x351d('0x2c')]=_[_0x351d('0x2b')](_0xf0054a[_0x351d('0x27')],qs[_0x351d('0x2d')](_0x3e5965[_0x351d('0x24')]['fields']));_0x12f3c1[_0x351d('0x2c')]=_0x12f3c1['attributes'][_0x351d('0x2e')]?_0x12f3c1[_0x351d('0x2c')]:_0xf0054a[_0x351d('0x27')];if(_0x3e5965[_0x351d('0x24')][_0x351d('0x2f')]){_0x12f3c1[_0x351d('0x23')]=[{'all':!![]}];}_0x12f3c1=_[_0x351d('0x30')]({},_0x12f3c1,_0x3e5965['options']);return db[_0x351d('0x20')][_0x351d('0x31')](_0x12f3c1)[_0x351d('0x16')](handleEntityNotFound(_0x334ff9,null))['then'](respondWithResult(_0x334ff9,null))['catch'](handleError(_0x334ff9,null));};exports['create']=function(_0x34092e,_0x2f54e1){return db[_0x351d('0x20')][_0x351d('0x32')](_0x34092e['body'],{})['then'](function(_0x1d14af){var _0x1ae5ad=_0x34092e[_0x351d('0x33')][_0x351d('0x17')]({'plain':!![]});if(!_0x1ae5ad)throw new Error(_0x351d('0x34'));if(_0x1ae5ad[_0x351d('0x35')]==='user'){var _0x345d55=_0x1d14af[_0x351d('0x17')]({'plain':!![]});var _0x53bcef=_0x351d('0x18');return db[_0x351d('0x36')][_0x351d('0x31')]({'where':{'name':_0x53bcef,'userProfileId':_0x1ae5ad[_0x351d('0x37')]},'raw':!![]})[_0x351d('0x16')](function(_0x4a35ca){if(_0x4a35ca&&_0x4a35ca[_0x351d('0x38')]===0x0){return db[_0x351d('0x19')][_0x351d('0x32')]({'name':_0x345d55[_0x351d('0x1c')],'resourceId':_0x345d55['id'],'type':_0x4a35ca['name'],'sectionId':_0x4a35ca['id']},{})[_0x351d('0x16')](function(){return _0x1d14af;});}else{return _0x1d14af;}})[_0x351d('0x39')](function(_0x3f0a3b){logger[_0x351d('0x3a')](_0x351d('0x3b'),_0x3f0a3b);throw _0x3f0a3b;});}return _0x1d14af;})[_0x351d('0x16')](respondWithResult(_0x2f54e1,0xc9))[_0x351d('0x39')](handleError(_0x2f54e1,null));};exports['update']=function(_0x1a2af0,_0xd30782){if(_0x1a2af0[_0x351d('0x3c')]['id']){delete _0x1a2af0[_0x351d('0x3c')]['id'];}return db[_0x351d('0x20')][_0x351d('0x31')]({'where':{'id':_0x1a2af0[_0x351d('0x3d')]['id']}})['then'](handleEntityNotFound(_0xd30782,null))[_0x351d('0x16')](saveUpdates(_0x1a2af0[_0x351d('0x3c')],null))[_0x351d('0x16')](respondWithResult(_0xd30782,null))['catch'](handleError(_0xd30782,null));};exports[_0x351d('0x15')]=function(_0x4b344f,_0x2ae1b3){return db['WhatsappQueue'][_0x351d('0x31')]({'where':{'id':_0x4b344f[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x2ae1b3,null))[_0x351d('0x16')](removeEntity(_0x2ae1b3,null))[_0x351d('0x39')](handleError(_0x2ae1b3,null));};exports[_0x351d('0x3e')]=function(_0x99cb3b,_0x10cd8b){return db[_0x351d('0x20')][_0x351d('0x3e')]()[_0x351d('0x16')](respondWithResult(_0x10cd8b,null))['catch'](handleError(_0x10cd8b,null));};exports[_0x351d('0x3f')]=function(_0x1fc61b,_0x3715db){var _0x21cde4={'raw':!![],'where':{}},_0x46948a={},_0x2aafcc;return db[_0x351d('0x20')][_0x351d('0x40')]({'where':{'id':_0x1fc61b[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x3715db,null))[_0x351d('0x16')](function(_0x5e9df5){if(_0x5e9df5){_0x2aafcc=_0x5e9df5[_0x351d('0x17')]({'plain':!![]});_0x46948a[_0x351d('0x27')]=_['keys'](db[_0x351d('0x41')][_0x351d('0x29')]);_0x46948a[_0x351d('0x24')]=_[_0x351d('0x28')](_0x1fc61b[_0x351d('0x24')]);_0x46948a[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0x46948a[_0x351d('0x27')],_0x46948a[_0x351d('0x24')]);_0x21cde4['attributes']=_['intersection'](_0x46948a[_0x351d('0x27')],qs['fields'](_0x1fc61b[_0x351d('0x24')][_0x351d('0x2d')]));_0x21cde4['attributes']=_0x21cde4[_0x351d('0x2c')][_0x351d('0x2e')]?_0x21cde4[_0x351d('0x2c')]:_0x46948a[_0x351d('0x27')];if(!_0x1fc61b['query'][_0x351d('0x42')](_0x351d('0x43'))){_0x21cde4[_0x351d('0xf')]=qs['limit'](_0x1fc61b[_0x351d('0x24')][_0x351d('0xf')]);_0x21cde4[_0x351d('0x11')]=qs[_0x351d('0x11')](_0x1fc61b[_0x351d('0x24')][_0x351d('0x11')]);}_0x21cde4[_0x351d('0x44')]=qs['sort'](_0x1fc61b[_0x351d('0x24')][_0x351d('0x45')]);_0x21cde4['where']=qs[_0x351d('0x2a')](_['pick'](_0x1fc61b[_0x351d('0x24')],_0x46948a[_0x351d('0x2a')]));_0x21cde4['where']['WhatsappQueueId']=_0x5e9df5['id'];if(_0x1fc61b['query'][_0x351d('0x46')]){_0x21cde4['where']=_[_0x351d('0x30')](_0x21cde4[_0x351d('0x47')],{'$or':_[_0x351d('0x1f')](_0x21cde4[_0x351d('0x2c')],function(_0x4bbba1){var _0x17209d={};_0x17209d[_0x4bbba1]={'$like':'%'+_0x1fc61b['query'][_0x351d('0x46')]+'%'};return _0x17209d;})});}_0x21cde4=_[_0x351d('0x30')]({},_0x21cde4,_0x1fc61b[_0x351d('0x48')]);return db[_0x351d('0x41')][_0x351d('0x49')](_0x21cde4);}})[_0x351d('0x16')](function(_0x32064c){if(_0x32064c){return db[_0x351d('0x4a')][_0x351d('0x4b')]({'where':{'id':_['map'](_0x32064c,_0x351d('0x4c')),'role':_0x351d('0x4d')},'attributes':['id','name',_0x351d('0x4e'),_0x351d('0x4f'),_0x351d('0x50')]});}})[_0x351d('0x16')](function(_0x4f0233){if(_0x4f0233){return{'count':_0x4f0233[_0x351d('0x10')],'rows':_[_0x351d('0x1f')](_0x4f0233[_0x351d('0x25')],function(_0x4e8e37){return{'membername':_0x4e8e37[_0x351d('0x1c')],'UserId':_0x4e8e37['id'],'queue_name':_0x2aafcc['name'],'WhatsappQueueId':_0x2aafcc['id'],'interface':util[_0x351d('0x51')]('%s/%s','SIP',_0x4e8e37[_0x351d('0x1c')]),'penalty':0x0,'paused':_0x4e8e37[_0x351d('0x4e')],'createdAt':_0x4e8e37[_0x351d('0x50')],'updatedAt':_0x4e8e37[_0x351d('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x351d('0x16')](respondWithFilteredResult(_0x3715db,_0x21cde4))[_0x351d('0x39')](handleError(_0x3715db,null));};exports[_0x351d('0x52')]=function(_0xdcd757,_0x5a8724){var _0x888cb4={};var _0x2da2f0={};var _0x27986b;var _0x4cdaaa;return db['WhatsappQueue'][_0x351d('0x40')]({'where':{'id':_0xdcd757[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x5a8724,null))[_0x351d('0x16')](function(_0x22309e){if(_0x22309e){_0x27986b=_0x22309e;_0x2da2f0[_0x351d('0x27')]=_['keys'](db[_0x351d('0x53')][_0x351d('0x29')]);_0x2da2f0[_0x351d('0x24')]=_[_0x351d('0x28')](_0xdcd757[_0x351d('0x24')]);_0x2da2f0[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0x2da2f0['model'],_0x2da2f0[_0x351d('0x24')]);_0x888cb4[_0x351d('0x2c')]=_[_0x351d('0x2b')](_0x2da2f0[_0x351d('0x27')],qs[_0x351d('0x2d')](_0xdcd757['query']['fields']));_0x888cb4[_0x351d('0x2c')]=_0x888cb4[_0x351d('0x2c')]['length']?_0x888cb4[_0x351d('0x2c')]:_0x2da2f0[_0x351d('0x27')];_0x888cb4[_0x351d('0x44')]=qs[_0x351d('0x45')](_0xdcd757[_0x351d('0x24')][_0x351d('0x45')]);_0x888cb4[_0x351d('0x47')]=qs['filters'](_['pick'](_0xdcd757['query'],_0x2da2f0[_0x351d('0x2a')]));if(_0xdcd757['query'][_0x351d('0x46')]){_0x888cb4[_0x351d('0x47')]=_[_0x351d('0x30')](_0x888cb4[_0x351d('0x47')],{'$or':_['map'](_0x888cb4[_0x351d('0x2c')],function(_0x1d3952){var _0x156931={};_0x156931[_0x1d3952]={'$like':'%'+_0xdcd757[_0x351d('0x24')][_0x351d('0x46')]+'%'};return _0x156931;})});}_0x888cb4=_[_0x351d('0x30')]({},_0x888cb4,_0xdcd757['options']);return _0x27986b[_0x351d('0x52')](_0x888cb4);}})[_0x351d('0x16')](function(_0x503b66){if(_0x503b66){_0x4cdaaa=_0x503b66[_0x351d('0x2e')];if(!_0xdcd757['query'][_0x351d('0x42')](_0x351d('0x43'))){_0x888cb4['limit']=qs['limit'](_0xdcd757['query'][_0x351d('0xf')]);_0x888cb4['offset']=qs[_0x351d('0x11')](_0xdcd757[_0x351d('0x24')][_0x351d('0x11')]);}return _0x27986b[_0x351d('0x52')](_0x888cb4);}})[_0x351d('0x16')](function(_0x243bd2){if(_0x243bd2){return _0x243bd2?{'count':_0x4cdaaa,'rows':_0x243bd2}:null;}})[_0x351d('0x16')](respondWithResult(_0x5a8724,null))['catch'](handleError(_0x5a8724,null));};exports[_0x351d('0x54')]=function(_0x1ca16a,_0x15475e){var _0xba4a91=_0x1ca16a[_0x351d('0x3c')][_0x351d('0x55')];return db[_0x351d('0x53')][_0x351d('0x49')]({'where':{'id':_0xba4a91},'attributes':['id'],'include':[{'model':db[_0x351d('0x4a')],'as':_0x351d('0x56'),'attributes':['id',_0x351d('0x1c'),_0x351d('0x57'),_0x351d('0x58'),'interface'],'raw':!![]}]})[_0x351d('0x16')](function(_0xbf5469){if(_0xbf5469){var _0x2a546a=_[_0x351d('0x59')](_0xbf5469,function(_0x2f61cd){var _0x1593d8=_0x2f61cd['get']({'plain':!![]});return _0x1593d8['Agents'];});return db[_0x351d('0x20')]['find']({'where':{'id':_0x1ca16a[_0x351d('0x3d')]['id']}})['then'](function(_0x9097e4){return db[_0x351d('0x5a')][_0x351d('0x5b')](function(_0x1d12e3){return _0x9097e4[_0x351d('0x54')](_0xba4a91,{'transaction':_0x1d12e3})[_0x351d('0x16')](function(){return BPromise['each'](_0x2a546a,function(_0x1250df){return db[_0x351d('0x41')][_0x351d('0x5c')]({'where':{'UserId':_0x1250df['id'],'WhatsappQueueId':_0x1ca16a[_0x351d('0x3d')]['id']},'transaction':_0x1d12e3});});})[_0x351d('0x16')](function(){_0x2a546a[_0x351d('0x5d')](function(_0x461695){socket[_0x351d('0x5e')](_0x351d('0x5f'),{'UserId':_0x461695['id'],'WhatsappQueueId':_0x9097e4['id']});});});});});}})[_0x351d('0x16')](respondWithStatusCode(_0x15475e,null))[_0x351d('0x39')](handleError(_0x15475e,null));};exports[_0x351d('0x60')]=function(_0x52f2cc,_0x4d4615){return db[_0x351d('0x53')]['findAll']({'where':{'id':_0x52f2cc[_0x351d('0x24')][_0x351d('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x351d('0x56'),'attributes':['id'],'raw':!![]}]})[_0x351d('0x16')](handleEntityNotFound(_0x4d4615,null))[_0x351d('0x16')](function(_0xf9d645){var _0x851732=_[_0x351d('0x1f')](_0xf9d645,'id');var _0x3a151b=[];var _0x5ee8b0=[];var _0x42cb7c=squel[_0x351d('0x61')]();_0x42cb7c[_0x351d('0x62')](_0x351d('0x63'))['from']('team_has_whatsapp_queues','tq')[_0x351d('0x64')](_0x351d('0x65'),'ut',_0x351d('0x66'))[_0x351d('0x47')]('WhatsappQueueId\x20=\x20?',_0x52f2cc[_0x351d('0x3d')]['id']);for(var _0x1620eb=0x0;_0x1620eb<_0xf9d645[_0x351d('0x2e')];_0x1620eb+=0x1){let _0x2b4d38=_0xf9d645[_0x1620eb];for(var _0x5c3c2f=0x0;_0x5c3c2f<_0x2b4d38[_0x351d('0x56')]['length'];_0x5c3c2f+=0x1){let _0x248b3b=_0x2b4d38['Agents'][_0x5c3c2f];var _0x4d70aa=_0x42cb7c[_0x351d('0x67')]();_0x4d70aa[_0x351d('0x47')](_0x351d('0x68'),_0x248b3b['id']);_0x5ee8b0['push'](db[_0x351d('0x5a')][_0x351d('0x24')](_0x4d70aa[_0x351d('0x69')](),{'type':db[_0x351d('0x5a')][_0x351d('0x6a')][_0x351d('0x6b')]})[_0x351d('0x16')](function(_0x446beb){if(_0x446beb[_0x351d('0x2e')]===0x1){return _0x248b3b['id'];}else{var _0x27440a=_['every'](_['map'](_0x446beb,_0x351d('0x6c')),function(_0x3872eb){return _[_0x351d('0x6d')](_0x851732,_0x3872eb);});if(_0x27440a){return _0x248b3b['id'];}}}));}}return BPromise[_0x351d('0x6e')](_0x5ee8b0)[_0x351d('0x16')](function(_0x1af5db){_0x3a151b=_(_0x3a151b)[_0x351d('0x6f')](_0x1af5db)['compact']()[_0x351d('0x70')]();return db[_0x351d('0x20')][_0x351d('0x31')]({'where':{'id':_0x52f2cc[_0x351d('0x3d')]['id']}})['then'](function(_0x34b436){return db[_0x351d('0x5a')][_0x351d('0x5b')](function(_0x56f2f8){return _0x34b436[_0x351d('0x60')](_0x52f2cc['query'][_0x351d('0x55')],{'transaction':_0x56f2f8})[_0x351d('0x16')](function(){if(!_['isEmpty'](_0x3a151b)){return _0x34b436[_0x351d('0x71')](_0x3a151b,{'transaction':_0x56f2f8});}})[_0x351d('0x16')](function(){_0x3a151b[_0x351d('0x5d')](function(_0x51c8f8){socket[_0x351d('0x5e')]('userWhatsappQueue:remove',{'UserId':_0x51c8f8,'WhatsappQueueId':_0x34b436['id']});});});});});});})['then'](respondWithStatusCode(_0x4d4615,null))['catch'](handleError(_0x4d4615,null));};exports[_0x351d('0x72')]=function(_0x3f2ce3,_0x4f6f56){return db['WhatsappQueue'][_0x351d('0x31')]({'where':{'id':_0x3f2ce3[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x4f6f56,null))[_0x351d('0x16')](function(_0x3b7b6c){if(_0x3b7b6c){return _0x3b7b6c[_0x351d('0x72')](_0x3f2ce3['body']['ids'],_[_0x351d('0x73')](_0x3f2ce3[_0x351d('0x3c')],[_0x351d('0x55'),'id'])||{})['spread'](function(_0x36076d){for(var _0x8e6251=0x0;_0x8e6251<_0x3f2ce3[_0x351d('0x3c')][_0x351d('0x55')][_0x351d('0x2e')];_0x8e6251+=0x1){socket[_0x351d('0x5e')](_0x351d('0x5f'),{'UserId':Number(_0x3f2ce3[_0x351d('0x3c')]['ids'][_0x8e6251]),'WhatsappQueueId':Number(_0x3f2ce3['params']['id'])});}return _0x36076d;});}})[_0x351d('0x16')](respondWithResult(_0x4f6f56,null))[_0x351d('0x39')](handleError(_0x4f6f56,null));};exports[_0x351d('0x71')]=function(_0x57bd4e,_0x4ae87e){return db[_0x351d('0x20')][_0x351d('0x31')]({'where':{'id':_0x57bd4e[_0x351d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4ae87e,null))[_0x351d('0x16')](function(_0xc9cf3c){if(_0xc9cf3c){return _0xc9cf3c[_0x351d('0x71')](_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')])['then'](function(){if(_['isArray'](_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')])){for(var _0x3bee4a=0x0;_0x3bee4a<_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')]['length'];_0x3bee4a+=0x1){socket[_0x351d('0x5e')](_0x351d('0x74'),{'UserId':Number(_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')][_0x3bee4a]),'WhatsappQueueId':Number(_0x57bd4e[_0x351d('0x3d')]['id'])});}}else{socket[_0x351d('0x5e')](_0x351d('0x74'),{'UserId':Number(_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')]),'WhatsappQueueId':Number(_0x57bd4e[_0x351d('0x3d')]['id'])});}});}})[_0x351d('0x16')](respondWithStatusCode(_0x4ae87e,null))[_0x351d('0x39')](handleError(_0x4ae87e,null));};exports[_0x351d('0x75')]=function(_0x5649a8,_0x1efad3){var _0x5fa3ab={};var _0x47a566={};var _0x54b76b;var _0x2cbc53;return db[_0x351d('0x20')][_0x351d('0x40')]({'where':{'id':_0x5649a8['params']['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x1efad3,null))[_0x351d('0x16')](function(_0x226a46){if(_0x226a46){_0x54b76b=_0x226a46;_0x47a566[_0x351d('0x27')]=_[_0x351d('0x28')](db[_0x351d('0x4a')][_0x351d('0x29')]);_0x47a566[_0x351d('0x24')]=_[_0x351d('0x28')](_0x5649a8[_0x351d('0x24')]);_0x47a566[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0x47a566[_0x351d('0x27')],_0x47a566[_0x351d('0x24')]);_0x5fa3ab['attributes']=_[_0x351d('0x2b')](_0x47a566[_0x351d('0x27')],qs[_0x351d('0x2d')](_0x5649a8[_0x351d('0x24')]['fields']));_0x5fa3ab['attributes']=_0x5fa3ab[_0x351d('0x2c')][_0x351d('0x2e')]?_0x5fa3ab['attributes']:_0x47a566[_0x351d('0x27')];_0x5fa3ab[_0x351d('0x44')]=qs[_0x351d('0x45')](_0x5649a8['query'][_0x351d('0x45')]);_0x5fa3ab[_0x351d('0x47')]=qs[_0x351d('0x2a')](_[_0x351d('0x76')](_0x5649a8['query'],_0x47a566[_0x351d('0x2a')]));if(_0x5649a8[_0x351d('0x24')][_0x351d('0x46')]){_0x5fa3ab[_0x351d('0x47')]=_['merge'](_0x5fa3ab[_0x351d('0x47')],{'$or':_[_0x351d('0x1f')](_0x5fa3ab['attributes'],function(_0x13f6a8){var _0x3ef007={};_0x3ef007[_0x13f6a8]={'$like':'%'+_0x5649a8[_0x351d('0x24')][_0x351d('0x46')]+'%'};return _0x3ef007;})});}_0x5fa3ab=_[_0x351d('0x30')]({},_0x5fa3ab,_0x5649a8[_0x351d('0x48')]);return _0x54b76b[_0x351d('0x75')](_0x5fa3ab);}})[_0x351d('0x16')](function(_0x2d718e){if(_0x2d718e){_0x2cbc53=_0x2d718e[_0x351d('0x2e')];if(!_0x5649a8['query']['hasOwnProperty'](_0x351d('0x43'))){_0x5fa3ab[_0x351d('0xf')]=qs[_0x351d('0xf')](_0x5649a8[_0x351d('0x24')]['limit']);_0x5fa3ab[_0x351d('0x11')]=qs['offset'](_0x5649a8[_0x351d('0x24')][_0x351d('0x11')]);}return _0x54b76b[_0x351d('0x75')](_0x5fa3ab);}})[_0x351d('0x16')](function(_0x62f5b0){if(_0x62f5b0){return _0x62f5b0?{'count':_0x2cbc53,'rows':_0x62f5b0}:null;}})[_0x351d('0x16')](respondWithResult(_0x1efad3,null))[_0x351d('0x39')](handleError(_0x1efad3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 1cd41fe..9407a8c 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 _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 +var _0xcba0=['../../mysqldb','save','remove','hasOwnProperty','exports','events'];(function(_0xa9aa2d,_0x233ded){var _0x5d253e=function(_0x407637){while(--_0x407637){_0xa9aa2d['push'](_0xa9aa2d['shift']());}};_0x5d253e(++_0x233ded);}(_0xcba0,0x1a3));var _0x0cba=function(_0x54a2f2,_0x59258f){_0x54a2f2=_0x54a2f2-0x0;var _0x24ebec=_0xcba0[_0x54a2f2];return _0x24ebec;};'use strict';var EventEmitter=require(_0x0cba('0x0'));var WhatsappQueue=require(_0x0cba('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0cba('0x2'),'afterUpdate':'update','afterDestroy':_0x0cba('0x3')};function emitEvent(_0x2b73de){return function(_0x484cb0,_0x1e90e7,_0x59c0b0){WhatsappQueueEvents['emit'](_0x2b73de+':'+_0x484cb0['id'],_0x484cb0);WhatsappQueueEvents['emit'](_0x2b73de,_0x484cb0);_0x59c0b0(null);};}for(var e in events){if(events[_0x0cba('0x4')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x0cba('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9f20107..c2160d8 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 _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 +var _0x8c4b=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c4b,0xea));var _0xb8c4=function(_0x293023,_0x4ac622){_0x293023=_0x293023-0x0;var _0x49751d=_0x8c4b[_0x293023];return _0x49751d;};'use strict';var _=require('lodash');var util=require(_0xb8c4('0x0'));var logger=require(_0xb8c4('0x1'))(_0xb8c4('0x2'));var moment=require(_0xb8c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8c4('0x4'));var fs=require('fs');var path=require(_0xb8c4('0x5'));var rimraf=require('rimraf');var config=require(_0xb8c4('0x6'));var attributes=require(_0xb8c4('0x7'));module[_0xb8c4('0x8')]=function(_0x56b44b,_0x342230){return _0x56b44b[_0xb8c4('0x9')](_0xb8c4('0xa'),attributes,{'tableName':_0xb8c4('0xb'),'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 98dce78..8e25711 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 _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 +var _0x5dc0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','model','attributes','map','then','ShowWhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1c75e0,_0x4ee297){var _0x5beb72=function(_0x4f50a1){while(--_0x4f50a1){_0x1c75e0['push'](_0x1c75e0['shift']());}};_0x5beb72(++_0x4ee297);}(_0x5dc0,0xcc));var _0x05dc=function(_0x5be7ad,_0x3ced91){_0x5be7ad=_0x5be7ad-0x0;var _0x497c61=_0x5dc0[_0x5be7ad];return _0x497c61;};'use strict';var _=require(_0x05dc('0x0'));var util=require(_0x05dc('0x1'));var moment=require(_0x05dc('0x2'));var BPromise=require(_0x05dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05dc('0x4'));var db=require(_0x05dc('0x5'))['db'];var utils=require(_0x05dc('0x6'));var logger=require(_0x05dc('0x7'))(_0x05dc('0x8'));var config=require(_0x05dc('0x9'));var jayson=require(_0x05dc('0xa'));var client=jayson['client'][_0x05dc('0xb')]({'port':0x232a});config[_0x05dc('0xc')]=_[_0x05dc('0xd')](config[_0x05dc('0xc')],{'host':_0x05dc('0xe'),'port':0x18eb});var socket=require(_0x05dc('0xf'))(new Redis(config['redis']));require(_0x05dc('0x10'))[_0x05dc('0x11')](socket);function respondWithRpcPromise(_0x3f1b76,_0x1436d2,_0x73a43e){return new BPromise(function(_0x4ca50f,_0x3fa260){return client[_0x05dc('0x12')](_0x3f1b76,_0x73a43e)['then'](function(_0x5ad956){logger[_0x05dc('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x1436d2,_0x05dc('0x14'));logger[_0x05dc('0x15')](_0x05dc('0x16'),_0x1436d2,'request\x20sent',JSON[_0x05dc('0x17')](_0x5ad956));if(_0x5ad956[_0x05dc('0x18')]){if(_0x5ad956[_0x05dc('0x18')][_0x05dc('0x19')]===0x1f4){logger[_0x05dc('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x1436d2,_0x5ad956[_0x05dc('0x18')][_0x05dc('0x1a')]);return _0x3fa260(_0x5ad956['error'][_0x05dc('0x1a')]);}logger[_0x05dc('0x18')](_0x05dc('0x1b'),_0x1436d2,_0x5ad956[_0x05dc('0x18')][_0x05dc('0x1a')]);return _0x4ca50f(_0x5ad956[_0x05dc('0x18')][_0x05dc('0x1a')]);}else{logger[_0x05dc('0x13')](_0x05dc('0x1b'),_0x1436d2,_0x05dc('0x14'));_0x4ca50f(_0x5ad956['result'][_0x05dc('0x1a')]);}})[_0x05dc('0x1c')](function(_0x5d3dc5){logger[_0x05dc('0x18')](_0x05dc('0x1b'),_0x1436d2,_0x5d3dc5);_0x3fa260(_0x5d3dc5);});});}exports[_0x05dc('0x1d')]=function(_0x38f2e5){var _0x16b721=this;return new Promise(function(_0x10f58e,_0x35be17){return db[_0x05dc('0x1e')]['findAll']({'raw':_0x38f2e5['options']?_0x38f2e5[_0x05dc('0x1f')][_0x05dc('0x20')]===undefined?!![]:![]:!![],'where':_0x38f2e5[_0x05dc('0x1f')]?_0x38f2e5['options'][_0x05dc('0x21')]||null:null,'attributes':_0x38f2e5[_0x05dc('0x1f')]?_0x38f2e5[_0x05dc('0x1f')]['attributes']||null:null,'limit':_0x38f2e5['options']?_0x38f2e5[_0x05dc('0x1f')][_0x05dc('0x22')]||null:null,'include':_0x38f2e5['options']?_0x38f2e5['options'][_0x05dc('0x23')]?_['map'](_0x38f2e5[_0x05dc('0x1f')]['include'],function(_0x99b952){return{'model':db[_0x99b952[_0x05dc('0x24')]],'as':_0x99b952['as'],'attributes':_0x99b952[_0x05dc('0x25')],'include':_0x99b952[_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x99b952[_0x05dc('0x23')],function(_0x51713a){return{'model':db[_0x51713a[_0x05dc('0x24')]],'as':_0x51713a['as'],'attributes':_0x51713a['attributes'],'include':_0x51713a[_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x51713a['include'],function(_0x388fb9){return{'model':db[_0x388fb9['model']],'as':_0x388fb9['as'],'attributes':_0x388fb9[_0x05dc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x05dc('0x27')](function(_0x40430c){logger[_0x05dc('0x13')](_0x05dc('0x1d'),_0x38f2e5);logger[_0x05dc('0x15')](_0x05dc('0x1d'),_0x38f2e5,JSON[_0x05dc('0x17')](_0x40430c));_0x10f58e(_0x40430c);})['catch'](function(_0x83003d){logger[_0x05dc('0x18')](_0x05dc('0x1d'),_0x83003d[_0x05dc('0x1a')],_0x38f2e5);_0x35be17(_0x16b721[_0x05dc('0x18')](0x1f4,_0x83003d[_0x05dc('0x1a')]));});});};exports[_0x05dc('0x28')]=function(_0x2608a0){var _0x4378b9=this;return new Promise(function(_0x755a96,_0x2f6bc0){return db[_0x05dc('0x1e')][_0x05dc('0x29')]({'raw':_0x2608a0[_0x05dc('0x1f')]?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x20')]===undefined?!![]:![]:!![],'where':_0x2608a0[_0x05dc('0x1f')]?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x21')]||null:null,'attributes':_0x2608a0['options']?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x25')]||null:null,'include':_0x2608a0[_0x05dc('0x1f')]?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x2608a0[_0x05dc('0x1f')]['include'],function(_0x2ca114){return{'model':db[_0x2ca114[_0x05dc('0x24')]],'as':_0x2ca114['as'],'attributes':_0x2ca114[_0x05dc('0x25')],'include':_0x2ca114[_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x2ca114[_0x05dc('0x23')],function(_0x3bb165){return{'model':db[_0x3bb165[_0x05dc('0x24')]],'as':_0x3bb165['as'],'attributes':_0x3bb165[_0x05dc('0x25')],'include':_0x3bb165['include']?_[_0x05dc('0x26')](_0x3bb165[_0x05dc('0x23')],function(_0x545848){return{'model':db[_0x545848[_0x05dc('0x24')]],'as':_0x545848['as'],'attributes':_0x545848['attributes']};}):[]};}):[]};}):[]:[]})[_0x05dc('0x27')](function(_0x5ddbdb){logger[_0x05dc('0x13')](_0x05dc('0x28'),_0x2608a0);logger[_0x05dc('0x15')](_0x05dc('0x28'),_0x2608a0,JSON[_0x05dc('0x17')](_0x5ddbdb));_0x755a96(_0x5ddbdb);})[_0x05dc('0x1c')](function(_0x1a4af5){logger[_0x05dc('0x18')](_0x05dc('0x28'),_0x1a4af5[_0x05dc('0x1a')],_0x2608a0);_0x2f6bc0(_0x4378b9[_0x05dc('0x18')](0x1f4,_0x1a4af5[_0x05dc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d365ecb..c120032 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 _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 +var _0xc80a=['register','length','save','remove','update','emit','removeListener'];(function(_0x375e92,_0x5965d4){var _0x2ddeeb=function(_0x4bba14){while(--_0x4bba14){_0x375e92['push'](_0x375e92['shift']());}};_0x2ddeeb(++_0x5965d4);}(_0xc80a,0x6b));var _0xac80=function(_0x2c8972,_0x1aff63){_0x2c8972=_0x2c8972-0x0;var _0x5d1e22=_0xc80a[_0x2c8972];return _0x5d1e22;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xac80('0x0'),_0xac80('0x1'),_0xac80('0x2')];function createListener(_0x54cf6c,_0x164ec5){return function(_0x1f53b8){_0x164ec5[_0xac80('0x3')](_0x54cf6c,_0x1f53b8);};}function removeListener(_0x30c196,_0x1cac8d){return function(){WhatsappQueueEvents[_0xac80('0x4')](_0x30c196,_0x1cac8d);};}exports[_0xac80('0x5')]=function(_0x9de8a7){for(var _0x266e7a=0x0,_0x11e4cf=events[_0xac80('0x6')];_0x266e7a<_0x11e4cf;_0x266e7a++){var _0x2ae1b0=events[_0x266e7a];var _0x4c818b=createListener('whatsappQueue:'+_0x2ae1b0,_0x9de8a7);WhatsappQueueEvents['on'](_0x2ae1b0,_0x4c818b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 4e59e43..01c59a5 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 _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 +var _0xd86c=['express','fs-extra','../../config/environment','./whatsappQueueReport.controller','index','get','/describe','describe','isAuthenticated','post','put','/:id','update','delete','multer','util','path','connect-timeout'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xd86c,0xb0));var _0xcd86=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xd86c[_0x35af23];return _0x340506;};'use strict';var multer=require(_0xcd86('0x0'));var util=require(_0xcd86('0x1'));var path=require(_0xcd86('0x2'));var timeout=require(_0xcd86('0x3'));var express=require(_0xcd86('0x4'));var router=express['Router']();var fs_extra=require(_0xcd86('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd86('0x6'));var controller=require(_0xcd86('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd86('0x8')]);router[_0xcd86('0x9')](_0xcd86('0xa'),auth['isAuthenticated'](),controller[_0xcd86('0xb')]);router['get']('/:id',auth[_0xcd86('0xc')](),controller['show']);router[_0xcd86('0xd')]('/',auth[_0xcd86('0xc')](),controller['create']);router[_0xcd86('0xe')](_0xcd86('0xf'),auth['isAuthenticated'](),controller[_0xcd86('0x10')]);router[_0xcd86('0x11')](_0xcd86('0xf'),auth[_0xcd86('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d79ec07..5769126 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(_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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3109f5,_0x21bc95){var _0x409a59=function(_0x14991c){while(--_0x14991c){_0x3109f5['push'](_0x3109f5['shift']());}};_0x409a59(++_0x21bc95);}(_0x7a54,0x106));var _0x47a5=function(_0x4256b6,_0x3fa25a){_0x4256b6=_0x4256b6-0x0;var _0x170960=_0x7a54[_0x4256b6];return _0x170960;};'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 a253340..75bd480 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 _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 +var _0x3423=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','keys','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2561ca,_0x2bf01c){var _0x3a6490=function(_0x15b9a2){while(--_0x15b9a2){_0x2561ca['push'](_0x2561ca['shift']());}};_0x3a6490(++_0x2bf01c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=typeof _0x19bd71[_0x3342('0x19')]==='undefined'&&typeof _0x19bd71['limit']===_0x3342('0x1a');var _0x143cf1=_0x49afe3[_0x3342('0x1b')];var _0x2075cb=_0x40d609?0x0:_0x19bd71[_0x3342('0x19')];var _0x156c24=_0x40d609?_0x49afe3[_0x3342('0x1b')]:_0x19bd71[_0x3342('0x19')]+_0x19bd71[_0x3342('0x1c')];var _0x4f4c2a;if(_0x156c24>=_0x143cf1){_0x156c24=_0x143cf1;_0x4f4c2a=0xc8;}else{_0x4f4c2a=0xce;}_0x3e44f3[_0x3342('0x17')](_0x4f4c2a);return _0x3e44f3[_0x3342('0x1d')](_0x3342('0x1e'),_0x2075cb+'-'+_0x156c24+'/'+_0x143cf1)['json'](_0x49afe3);}return null;};}function patchUpdates(_0x3cb86f){return function(_0x463324){try{jsonpatch['apply'](_0x463324,_0x3cb86f,!![]);}catch(_0xe774b7){return BPromise[_0x3342('0x1f')](_0xe774b7);}return _0x463324['save']();};}function saveUpdates(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x20')](_0x4e1b19)[_0x3342('0x21')](function(_0x2dbad1){return _0x2dbad1;});}return null;};}function removeEntity(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(_0x26eb87){return _0x26eb87[_0x3342('0x22')]()['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51cf45,_0x986ab0){return function(_0x52ba65){if(!_0x52ba65){_0x51cf45['sendStatus'](0x194);}return _0x52ba65;};}function handleError(_0x247ee4,_0x58f0f5){_0x58f0f5=_0x58f0f5||0x1f4;return function(_0x37df78){logger['error'](_0x37df78['stack']);if(_0x37df78['name']){delete _0x37df78[_0x3342('0x23')];}_0x247ee4[_0x3342('0x17')](_0x58f0f5)[_0x3342('0x24')](_0x37df78);};}exports['index']=function(_0xc275a1,_0x1275e2){var _0x1cc542={},_0x272a52={},_0x4fbfb7={'count':0x0,'rows':[]};var _0x27e25b=_[_0x3342('0x25')](db[_0x3342('0x26')][_0x3342('0x27')],function(_0xf82530){return{'name':_0xf82530[_0x3342('0x28')],'type':_0xf82530[_0x3342('0x29')]['key']};});_0x272a52[_0x3342('0x2a')]=_['map'](_0x27e25b,_0x3342('0x23'));_0x272a52[_0x3342('0x2b')]=_['keys'](_0xc275a1[_0x3342('0x2b')]);_0x272a52[_0x3342('0x2c')]=_[_0x3342('0x2d')](_0x272a52[_0x3342('0x2a')],_0x272a52['query']);_0x1cc542[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x272a52[_0x3342('0x2a')],qs[_0x3342('0x2f')](_0xc275a1[_0x3342('0x2b')][_0x3342('0x2f')]));_0x1cc542[_0x3342('0x2e')]=_0x1cc542[_0x3342('0x2e')][_0x3342('0x30')]?_0x1cc542[_0x3342('0x2e')]:_0x272a52[_0x3342('0x2a')];if(!_0xc275a1[_0x3342('0x2b')]['hasOwnProperty']('nolimit')){_0x1cc542[_0x3342('0x1c')]=qs['limit'](_0xc275a1[_0x3342('0x2b')][_0x3342('0x1c')]);_0x1cc542[_0x3342('0x19')]=qs[_0x3342('0x19')](_0xc275a1[_0x3342('0x2b')][_0x3342('0x19')]);}_0x1cc542[_0x3342('0x31')]=qs['sort'](_0xc275a1[_0x3342('0x2b')][_0x3342('0x32')]);_0x1cc542[_0x3342('0x33')]=qs[_0x3342('0x2c')](_[_0x3342('0x34')](_0xc275a1['query'],_0x272a52[_0x3342('0x2c')]),_0x27e25b);if(_0xc275a1['query'][_0x3342('0x35')]){_0x1cc542[_0x3342('0x33')]=_[_0x3342('0x36')](_0x1cc542[_0x3342('0x33')],{'$or':_['map'](_0x27e25b,function(_0x370cfa){if(_0x370cfa['type']!==_0x3342('0x37')){var _0x128657={};_0x128657[_0x370cfa[_0x3342('0x23')]]={'$like':'%'+_0xc275a1[_0x3342('0x2b')][_0x3342('0x35')]+'%'};return _0x128657;}})});}_0x1cc542=_[_0x3342('0x36')]({},_0x1cc542,_0xc275a1[_0x3342('0x38')]);var _0x52cdc0={'where':_0x1cc542[_0x3342('0x33')]};return db[_0x3342('0x26')]['count'](_0x52cdc0)[_0x3342('0x21')](function(_0x1f336c){_0x4fbfb7['count']=_0x1f336c;if(_0xc275a1[_0x3342('0x2b')][_0x3342('0x39')]){_0x1cc542['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x1cc542);})[_0x3342('0x21')](function(_0x41e727){_0x4fbfb7['rows']=_0x41e727;return _0x4fbfb7;})[_0x3342('0x21')](respondWithFilteredResult(_0x1275e2,_0x1cc542))[_0x3342('0x3a')](handleError(_0x1275e2,null));};exports[_0x3342('0x3b')]=function(_0x17fd01,_0x126ee4){var _0x308363={'raw':!![],'where':{'id':_0x17fd01[_0x3342('0x3c')]['id']}},_0x34de7b={};_0x34de7b['model']=_['keys'](db[_0x3342('0x26')][_0x3342('0x27')]);_0x34de7b[_0x3342('0x2b')]=_[_0x3342('0x3d')](_0x17fd01[_0x3342('0x2b')]);_0x34de7b[_0x3342('0x2c')]=_['intersection'](_0x34de7b[_0x3342('0x2a')],_0x34de7b[_0x3342('0x2b')]);_0x308363[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x34de7b[_0x3342('0x2a')],qs[_0x3342('0x2f')](_0x17fd01['query'][_0x3342('0x2f')]));_0x308363['attributes']=_0x308363[_0x3342('0x2e')][_0x3342('0x30')]?_0x308363[_0x3342('0x2e')]:_0x34de7b[_0x3342('0x2a')];if(_0x17fd01['query'][_0x3342('0x39')]){_0x308363[_0x3342('0x3e')]=[{'all':!![]}];}_0x308363=_['merge']({},_0x308363,_0x17fd01[_0x3342('0x38')]);return db[_0x3342('0x26')][_0x3342('0x3f')](_0x308363)[_0x3342('0x21')](handleEntityNotFound(_0x126ee4,null))['then'](respondWithResult(_0x126ee4,null))[_0x3342('0x3a')](handleError(_0x126ee4,null));};exports[_0x3342('0x40')]=function(_0x56b465,_0x1fc491){return db['WhatsappQueueReport']['create'](_0x56b465[_0x3342('0x41')],{})[_0x3342('0x21')](respondWithResult(_0x1fc491,0xc9))[_0x3342('0x3a')](handleError(_0x1fc491,null));};exports[_0x3342('0x20')]=function(_0x23925e,_0x171387){if(_0x23925e[_0x3342('0x41')]['id']){delete _0x23925e['body']['id'];}return db['WhatsappQueueReport'][_0x3342('0x3f')]({'where':{'id':_0x23925e['params']['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x171387,null))['then'](saveUpdates(_0x23925e['body'],null))['then'](respondWithResult(_0x171387,null))[_0x3342('0x3a')](handleError(_0x171387,null));};exports[_0x3342('0x22')]=function(_0x29ccb6,_0x186a2a){return db['WhatsappQueueReport'][_0x3342('0x3f')]({'where':{'id':_0x29ccb6[_0x3342('0x3c')]['id']}})['then'](handleEntityNotFound(_0x186a2a,null))[_0x3342('0x21')](removeEntity(_0x186a2a,null))[_0x3342('0x3a')](handleError(_0x186a2a,null));};exports[_0x3342('0x42')]=function(_0x4c0dc0,_0x189b68){return db[_0x3342('0x26')][_0x3342('0x42')]()[_0x3342('0x21')](respondWithResult(_0x189b68,null))[_0x3342('0x3a')](handleError(_0x189b68,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8396b9f..223487e 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 _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 +var _0x9b6f=['exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x258717,_0x31ea23){var _0x21e418=function(_0x4fca35){while(--_0x4fca35){_0x258717['push'](_0x258717['shift']());}};_0x21e418(++_0x31ea23);}(_0x9b6f,0x163));var _0xf9b6=function(_0x53ed8a,_0x404ca5){_0x53ed8a=_0x53ed8a-0x0;var _0x2fccb7=_0x9b6f[_0x53ed8a];return _0x2fccb7;};'use strict';var _=require(_0xf9b6('0x0'));var util=require(_0xf9b6('0x1'));var logger=require(_0xf9b6('0x2'))(_0xf9b6('0x3'));var moment=require(_0xf9b6('0x4'));var BPromise=require(_0xf9b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9b6('0x6'));var rimraf=require('rimraf');var config=require(_0xf9b6('0x7'));var attributes=require(_0xf9b6('0x8'));module[_0xf9b6('0x9')]=function(_0x4cb4bc,_0xb53121){return _0x4cb4bc[_0xf9b6('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0xf9b6('0xb'),'paranoid':![],'indexes':[{'name':_0xf9b6('0xc'),'fields':[_0xf9b6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 88f9702..05d65f5 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 _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 +var _0x3c57=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','UpdateWhatsappQueueReport','update','raw','where'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0x3c57,0x187));var _0x73c5=function(_0x30dffd,_0x332b43){_0x30dffd=_0x30dffd-0x0;var _0x5877f8=_0x3c57[_0x30dffd];return _0x5877f8;};'use strict';var _=require(_0x73c5('0x0'));var util=require(_0x73c5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x73c5('0x2'));var fs=require('fs');var Redis=require(_0x73c5('0x3'));var db=require(_0x73c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x73c5('0x5'))(_0x73c5('0x6'));var config=require('../../config/environment');var jayson=require(_0x73c5('0x7'));var client=jayson[_0x73c5('0x8')][_0x73c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5925c1,_0x354e5c,_0x4145e8){return new BPromise(function(_0x5c6c5d,_0x10414c){return client[_0x73c5('0xa')](_0x5925c1,_0x4145e8)[_0x73c5('0xb')](function(_0x2cf139){logger[_0x73c5('0xc')](_0x73c5('0xd'),_0x354e5c,_0x73c5('0xe'));logger[_0x73c5('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x354e5c,_0x73c5('0xe'),JSON[_0x73c5('0x10')](_0x2cf139));if(_0x2cf139[_0x73c5('0x11')]){if(_0x2cf139[_0x73c5('0x11')][_0x73c5('0x12')]===0x1f4){logger[_0x73c5('0x11')](_0x73c5('0xd'),_0x354e5c,_0x2cf139[_0x73c5('0x11')][_0x73c5('0x13')]);return _0x10414c(_0x2cf139[_0x73c5('0x11')]['message']);}logger[_0x73c5('0x11')](_0x73c5('0xd'),_0x354e5c,_0x2cf139['error'][_0x73c5('0x13')]);return _0x5c6c5d(_0x2cf139[_0x73c5('0x11')][_0x73c5('0x13')]);}else{logger['info'](_0x73c5('0xd'),_0x354e5c,_0x73c5('0xe'));_0x5c6c5d(_0x2cf139[_0x73c5('0x14')][_0x73c5('0x13')]);}})['catch'](function(_0x34652d){logger[_0x73c5('0x11')](_0x73c5('0xd'),_0x354e5c,_0x34652d);_0x10414c(_0x34652d);});});}exports[_0x73c5('0x15')]=function(_0x192c53){var _0x260422=this;return new Promise(function(_0x2391da,_0x17ab6b){return db[_0x73c5('0x16')][_0x73c5('0x17')](_0x192c53['body'],{'raw':_0x192c53[_0x73c5('0x18')]?_0x192c53['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x42769e){logger[_0x73c5('0xc')]('CreateWhatsappQueueReport',_0x192c53);logger[_0x73c5('0xf')](_0x73c5('0x15'),_0x192c53,JSON[_0x73c5('0x10')](_0x42769e));_0x2391da(_0x42769e);})['catch'](function(_0x2708a3){logger[_0x73c5('0x11')](_0x73c5('0x15'),_0x2708a3['message'],_0x192c53);_0x17ab6b(_0x260422['error'](0x1f4,_0x2708a3[_0x73c5('0x13')]));});});};exports[_0x73c5('0x19')]=function(_0x37133e){var _0x1efef5=this;return new Promise(function(_0x3ed78b,_0x1ce775){return db[_0x73c5('0x16')][_0x73c5('0x1a')](_0x37133e['body'],{'raw':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')][_0x73c5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')][_0x73c5('0x1c')]||null:null,'attributes':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')]['attributes']||null:null,'limit':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')]['limit']||null:null})[_0x73c5('0xb')](function(_0x2c37e8){logger[_0x73c5('0xc')](_0x73c5('0x19'),_0x37133e);logger['debug'](_0x73c5('0x19'),_0x37133e,JSON[_0x73c5('0x10')](_0x2c37e8));_0x3ed78b(_0x2c37e8);})[_0x73c5('0x1d')](function(_0x939643){logger[_0x73c5('0x11')](_0x73c5('0x19'),_0x939643[_0x73c5('0x13')],_0x37133e);_0x1ce775(_0x1efef5['error'](0x1f4,_0x939643['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 52562ba..2d4e0ee 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 _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 +var _0xbc59=['../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x38d8e2,_0x48603c){var _0x5afbee=function(_0x2eca5e){while(--_0x2eca5e){_0x38d8e2['push'](_0x38d8e2['shift']());}};_0x5afbee(++_0x48603c);}(_0xbc59,0x162));var _0x9bc5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc59[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9bc5('0x0'));var util=require(_0x9bc5('0x1'));var path=require(_0x9bc5('0x2'));var timeout=require(_0x9bc5('0x3'));var express=require(_0x9bc5('0x4'));var router=express[_0x9bc5('0x5')]();var fs_extra=require(_0x9bc5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9bc5('0x7'));var config=require('../../config/environment');var controller=require(_0x9bc5('0x8'));router[_0x9bc5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9bc5('0x9')]('/describe',auth[_0x9bc5('0xa')](),controller[_0x9bc5('0xb')]);router[_0x9bc5('0x9')](_0x9bc5('0xc'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0xd')]);router[_0x9bc5('0xe')]('/',auth[_0x9bc5('0xa')](),controller['create']);router[_0x9bc5('0xf')](_0x9bc5('0xc'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0x10')]);router[_0x9bc5('0x11')](_0x9bc5('0xc'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 7143d5b..231f471 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 _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 +var _0x94e6=['ENUM','account','agent','queue','DATE','sequelize','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x94e6,0x194));var _0x694e=function(_0x379cd0,_0x1a7776){_0x379cd0=_0x379cd0-0x0;var _0x415097=_0x94e6[_0x379cd0];return _0x415097;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x694e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x694e('0x2')](_0x694e('0x3'),_0x694e('0x4'),_0x694e('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x694e('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5aa6808..d5d717e 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 _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 +var _0x7eee=['../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','end','error','stack','name','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','keys','length','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x277d53,_0x2ce9ce){var _0x2f1272=function(_0x2951c3){while(--_0x2951c3){_0x277d53['push'](_0x277d53['shift']());}};_0x2f1272(++_0x2ce9ce);}(_0x7eee,0x14c));var _0xe7ee=function(_0x24749c,_0x1bcb74){_0x24749c=_0x24749c-0x0;var _0x210f5d=_0x7eee[_0x24749c];return _0x210f5d;};'use strict';var emlformat=require(_0xe7ee('0x0'));var rimraf=require(_0xe7ee('0x1'));var zipdir=require(_0xe7ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7ee('0x3'));var moment=require(_0xe7ee('0x4'));var BPromise=require(_0xe7ee('0x5'));var Mustache=require(_0xe7ee('0x6'));var util=require(_0xe7ee('0x7'));var path=require('path');var sox=require(_0xe7ee('0x8'));var csv=require(_0xe7ee('0x9'));var ejs=require(_0xe7ee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe7ee('0xc'));var deskjs=require(_0xe7ee('0xd'));var toCsv=require(_0xe7ee('0x9'));var querystring=require('querystring');var Papa=require(_0xe7ee('0xe'));var Redis=require(_0xe7ee('0xf'));var authService=require(_0xe7ee('0x10'));var qs=require(_0xe7ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe7ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe7ee('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5699ab,_0x7820ef){_0x7820ef=_0x7820ef||0xcc;return function(_0x1e8786){if(_0x1e8786){return _0x5699ab[_0xe7ee('0x14')](_0x7820ef);}return _0x5699ab[_0xe7ee('0x15')](_0x7820ef)['end']();};}function respondWithResult(_0x35d606,_0x450808){_0x450808=_0x450808||0xc8;return function(_0x144335){if(_0x144335){return _0x35d606['status'](_0x450808)[_0xe7ee('0x16')](_0x144335);}};}function respondWithFilteredResult(_0x53cdfb,_0x2e7999){return function(_0xb0638){if(_0xb0638){var _0x3615f5=typeof _0x2e7999[_0xe7ee('0x17')]===_0xe7ee('0x18')&&typeof _0x2e7999[_0xe7ee('0x19')]===_0xe7ee('0x18');var _0x5e4638=_0xb0638['count'];var _0x2d3198=_0x3615f5?0x0:_0x2e7999[_0xe7ee('0x17')];var _0x38b598=_0x3615f5?_0xb0638[_0xe7ee('0x1a')]:_0x2e7999[_0xe7ee('0x17')]+_0x2e7999['limit'];var _0x1a090e;if(_0x38b598>=_0x5e4638){_0x38b598=_0x5e4638;_0x1a090e=0xc8;}else{_0x1a090e=0xce;}_0x53cdfb[_0xe7ee('0x15')](_0x1a090e);return _0x53cdfb['set'](_0xe7ee('0x1b'),_0x2d3198+'-'+_0x38b598+'/'+_0x5e4638)['json'](_0xb0638);}return null;};}function patchUpdates(_0x14a514){return function(_0x3c11bf){try{jsonpatch[_0xe7ee('0x1c')](_0x3c11bf,_0x14a514,!![]);}catch(_0x5ed89d){return BPromise[_0xe7ee('0x1d')](_0x5ed89d);}return _0x3c11bf[_0xe7ee('0x1e')]();};}function saveUpdates(_0x11ae63,_0x22401b){return function(_0x3811dc){if(_0x3811dc){return _0x3811dc[_0xe7ee('0x1f')](_0x11ae63)['then'](function(_0x3095d3){return _0x3095d3;});}return null;};}function removeEntity(_0x530b3c,_0x2b0888){return function(_0xce11c8){if(_0xce11c8){return _0xce11c8['destroy']()['then'](function(){_0x530b3c[_0xe7ee('0x15')](0xcc)[_0xe7ee('0x20')]();});}};}function handleEntityNotFound(_0x5885d2,_0x2505b7){return function(_0x3f9af2){if(!_0x3f9af2){_0x5885d2[_0xe7ee('0x14')](0x194);}return _0x3f9af2;};}function handleError(_0x2a562e,_0x4c847a){_0x4c847a=_0x4c847a||0x1f4;return function(_0x3a7c5c){logger[_0xe7ee('0x21')](_0x3a7c5c[_0xe7ee('0x22')]);if(_0x3a7c5c[_0xe7ee('0x23')]){delete _0x3a7c5c[_0xe7ee('0x23')];}_0x2a562e['status'](_0x4c847a)['send'](_0x3a7c5c);};}exports['index']=function(_0x20cb05,_0x25ce52){var _0x1cc914={},_0x3a165c={},_0x3f20c8={'count':0x0,'rows':[]};var _0x38ca6d=_[_0xe7ee('0x24')](db[_0xe7ee('0x25')][_0xe7ee('0x26')],function(_0x736e4c){return{'name':_0x736e4c[_0xe7ee('0x27')],'type':_0x736e4c[_0xe7ee('0x28')][_0xe7ee('0x29')]};});_0x3a165c[_0xe7ee('0x2a')]=_[_0xe7ee('0x24')](_0x38ca6d,_0xe7ee('0x23'));_0x3a165c[_0xe7ee('0x2b')]=_['keys'](_0x20cb05['query']);_0x3a165c[_0xe7ee('0x2c')]=_[_0xe7ee('0x2d')](_0x3a165c['model'],_0x3a165c['query']);_0x1cc914[_0xe7ee('0x2e')]=_['intersection'](_0x3a165c['model'],qs[_0xe7ee('0x2f')](_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x2f')]));_0x1cc914[_0xe7ee('0x2e')]=_0x1cc914[_0xe7ee('0x2e')]['length']?_0x1cc914['attributes']:_0x3a165c[_0xe7ee('0x2a')];if(!_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x30')]('nolimit')){_0x1cc914[_0xe7ee('0x19')]=qs[_0xe7ee('0x19')](_0x20cb05[_0xe7ee('0x2b')]['limit']);_0x1cc914[_0xe7ee('0x17')]=qs[_0xe7ee('0x17')](_0x20cb05['query'][_0xe7ee('0x17')]);}_0x1cc914[_0xe7ee('0x31')]=qs[_0xe7ee('0x32')](_0x20cb05[_0xe7ee('0x2b')]['sort']);_0x1cc914[_0xe7ee('0x33')]=qs[_0xe7ee('0x2c')](_[_0xe7ee('0x34')](_0x20cb05['query'],_0x3a165c['filters']),_0x38ca6d);if(_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x35')]){_0x1cc914[_0xe7ee('0x33')]=_[_0xe7ee('0x36')](_0x1cc914['where'],{'$or':_[_0xe7ee('0x24')](_0x38ca6d,function(_0x268ade){if(_0x268ade[_0xe7ee('0x28')]!==_0xe7ee('0x37')){var _0x3d6882={};_0x3d6882[_0x268ade[_0xe7ee('0x23')]]={'$like':'%'+_0x20cb05['query'][_0xe7ee('0x35')]+'%'};return _0x3d6882;}})});}_0x1cc914=_[_0xe7ee('0x36')]({},_0x1cc914,_0x20cb05[_0xe7ee('0x38')]);var _0x4c1844={'where':_0x1cc914[_0xe7ee('0x33')]};return db[_0xe7ee('0x25')][_0xe7ee('0x1a')](_0x4c1844)[_0xe7ee('0x39')](function(_0x67b047){_0x3f20c8[_0xe7ee('0x1a')]=_0x67b047;if(_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x3a')]){_0x1cc914[_0xe7ee('0x3b')]=[{'all':!![]}];}return db[_0xe7ee('0x25')][_0xe7ee('0x3c')](_0x1cc914);})[_0xe7ee('0x39')](function(_0x53ebc7){_0x3f20c8[_0xe7ee('0x3d')]=_0x53ebc7;return _0x3f20c8;})[_0xe7ee('0x39')](respondWithFilteredResult(_0x25ce52,_0x1cc914))[_0xe7ee('0x3e')](handleError(_0x25ce52,null));};exports['show']=function(_0x275640,_0x4342fd){var _0x2b821c={'raw':!![],'where':{'id':_0x275640['params']['id']}},_0x4afe03={};_0x4afe03[_0xe7ee('0x2a')]=_[_0xe7ee('0x3f')](db[_0xe7ee('0x25')]['rawAttributes']);_0x4afe03['query']=_['keys'](_0x275640['query']);_0x4afe03[_0xe7ee('0x2c')]=_[_0xe7ee('0x2d')](_0x4afe03[_0xe7ee('0x2a')],_0x4afe03[_0xe7ee('0x2b')]);_0x2b821c[_0xe7ee('0x2e')]=_[_0xe7ee('0x2d')](_0x4afe03[_0xe7ee('0x2a')],qs[_0xe7ee('0x2f')](_0x275640[_0xe7ee('0x2b')][_0xe7ee('0x2f')]));_0x2b821c[_0xe7ee('0x2e')]=_0x2b821c[_0xe7ee('0x2e')][_0xe7ee('0x40')]?_0x2b821c['attributes']:_0x4afe03[_0xe7ee('0x2a')];if(_0x275640[_0xe7ee('0x2b')][_0xe7ee('0x3a')]){_0x2b821c[_0xe7ee('0x3b')]=[{'all':!![]}];}_0x2b821c=_['merge']({},_0x2b821c,_0x275640[_0xe7ee('0x38')]);return db[_0xe7ee('0x25')]['find'](_0x2b821c)['then'](handleEntityNotFound(_0x4342fd,null))[_0xe7ee('0x39')](respondWithResult(_0x4342fd,null))[_0xe7ee('0x3e')](handleError(_0x4342fd,null));};exports[_0xe7ee('0x41')]=function(_0x5d8f18,_0x497343){return db[_0xe7ee('0x25')]['create'](_0x5d8f18[_0xe7ee('0x42')],{})[_0xe7ee('0x39')](respondWithResult(_0x497343,0xc9))[_0xe7ee('0x3e')](handleError(_0x497343,null));};exports['update']=function(_0x4cadaa,_0x4452a6){if(_0x4cadaa[_0xe7ee('0x42')]['id']){delete _0x4cadaa['body']['id'];}return db[_0xe7ee('0x25')][_0xe7ee('0x43')]({'where':{'id':_0x4cadaa[_0xe7ee('0x44')]['id']}})[_0xe7ee('0x39')](handleEntityNotFound(_0x4452a6,null))[_0xe7ee('0x39')](saveUpdates(_0x4cadaa[_0xe7ee('0x42')],null))['then'](respondWithResult(_0x4452a6,null))[_0xe7ee('0x3e')](handleError(_0x4452a6,null));};exports['destroy']=function(_0x26e57b,_0x5a63c1){return db[_0xe7ee('0x25')]['find']({'where':{'id':_0x26e57b[_0xe7ee('0x44')]['id']}})[_0xe7ee('0x39')](handleEntityNotFound(_0x5a63c1,null))[_0xe7ee('0x39')](removeEntity(_0x5a63c1,null))['catch'](handleError(_0x5a63c1,null));};exports[_0xe7ee('0x45')]=function(_0x362f98,_0x1c880c){return db[_0xe7ee('0x25')][_0xe7ee('0x45')]()['then'](respondWithResult(_0x1c880c,null))[_0xe7ee('0x3e')](handleError(_0x1c880c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d638f7f..e7151a0 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 _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 +var _0x5279=['api','moment','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x3614e8,_0x489e37){var _0x29a5b5=function(_0x2a2bdc){while(--_0x2a2bdc){_0x3614e8['push'](_0x3614e8['shift']());}};_0x29a5b5(++_0x489e37);}(_0x5279,0x1ea));var _0x9527=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x5279[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var logger=require('../../config/logger')(_0x9527('0x2'));var moment=require(_0x9527('0x3'));var BPromise=require('bluebird');var rp=require(_0x9527('0x4'));var fs=require('fs');var path=require(_0x9527('0x5'));var rimraf=require(_0x9527('0x6'));var config=require('../../config/environment');var attributes=require(_0x9527('0x7'));module[_0x9527('0x8')]=function(_0x481015,_0x5a9978){return _0x481015[_0x9527('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x9527('0xa'),'paranoid':![],'indexes':[{'name':_0x9527('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6ef0b39..e93b91c 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 _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 +var _0x89c2=['client','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23a191,_0x352efa){var _0x1e9b62=function(_0x56a2f3){while(--_0x56a2f3){_0x23a191['push'](_0x23a191['shift']());}};_0x1e9b62(++_0x352efa);}(_0x89c2,0x80));var _0x289c=function(_0x1c7fee,_0x431afa){_0x1c7fee=_0x1c7fee-0x0;var _0x239281=_0x89c2[_0x1c7fee];return _0x239281;};'use strict';var _=require(_0x289c('0x0'));var util=require(_0x289c('0x1'));var moment=require(_0x289c('0x2'));var BPromise=require(_0x289c('0x3'));var rs=require(_0x289c('0x4'));var fs=require('fs');var Redis=require(_0x289c('0x5'));var db=require(_0x289c('0x6'))['db'];var utils=require(_0x289c('0x7'));var logger=require(_0x289c('0x8'))(_0x289c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x289c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101264,_0x2f3c14,_0x51ff59){return new BPromise(function(_0x2e925b,_0x58b8a3){return client[_0x289c('0xb')](_0x101264,_0x51ff59)['then'](function(_0x5ad7ce){logger[_0x289c('0xc')](_0x289c('0xd'),_0x2f3c14,_0x289c('0xe'));logger[_0x289c('0xf')](_0x289c('0x10'),_0x2f3c14,_0x289c('0xe'),JSON[_0x289c('0x11')](_0x5ad7ce));if(_0x5ad7ce[_0x289c('0x12')]){if(_0x5ad7ce[_0x289c('0x12')][_0x289c('0x13')]===0x1f4){logger[_0x289c('0x12')](_0x289c('0xd'),_0x2f3c14,_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);return _0x58b8a3(_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);}logger[_0x289c('0x12')](_0x289c('0xd'),_0x2f3c14,_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);return _0x2e925b(_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);}else{logger[_0x289c('0xc')](_0x289c('0xd'),_0x2f3c14,_0x289c('0xe'));_0x2e925b(_0x5ad7ce[_0x289c('0x15')][_0x289c('0x14')]);}})[_0x289c('0x16')](function(_0x268b35){logger[_0x289c('0x12')](_0x289c('0xd'),_0x2f3c14,_0x268b35);_0x58b8a3(_0x268b35);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 31c6437..4bda579 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xc999=['filter','status','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','Offline\x20apps:'];(function(_0x40a869,_0x3aed54){var _0x535bd4=function(_0x5f0b95){while(--_0x5f0b95){_0x40a869['push'](_0x40a869['shift']());}};_0x535bd4(++_0x3aed54);}(_0xc999,0x176));var _0x9c99=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0xc999[_0x56138f];return _0x1acaf7;};'use strict';var _=require('lodash');var db=require(_0x9c99('0x0'))['db'];var seedDb=require(_0x9c99('0x1'));var checkLicense=require(_0x9c99('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0x9c99('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x9c99('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x9c99('0x5'));var transcribe=require(_0x9c99('0x6'));var provider=require(_0x9c99('0x7'));function main(){return db['sequelize'][_0x9c99('0x8')]()[_0x9c99('0x9')](function(){if(config[_0x9c99('0xa')]){return seedDb[_0x9c99('0xb')]();}})[_0x9c99('0x9')](function(){return checkLicense[_0x9c99('0xb')]();})['then'](function(){return rpc[_0x9c99('0xc')]();})[_0x9c99('0x9')](function(_0x1e34b5){logger[_0x9c99('0xd')](_0x1e34b5);return chat['start']();})[_0x9c99('0x9')](function(){return whatsapp[_0x9c99('0xe')]();})[_0x9c99('0x9')](function(){return schedule['start']();})[_0x9c99('0x9')](function(){return transcribe['start']();})['then'](function(){return provider[_0x9c99('0xe')]();})[_0x9c99('0x9')](function(_0x2d4c9a){logger[_0x9c99('0xd')](_0x2d4c9a);return pm2['start'](pm2Config);})[_0x9c99('0x9')](function(_0x5bc391){var _0x5db87b=_0x5bc391['filter'](function(_0xedd35){return typeof _0xedd35[_0x9c99('0xf')]==='number'&&_0xedd35[_0x9c99('0xf')]>=0x0;});if(_0x5db87b['length']>0x0){throw new Error(_0x5db87b['length']+_0x9c99('0x10')+_[_0x9c99('0x11')](_0x5db87b,function(_0x5c0023){return'\x22'+_0x5c0023[_0x9c99('0x12')][_0x9c99('0x13')]+'\x22';}));}logger['info'](_0x9c99('0x14'),_[_0x9c99('0x11')](_['filter'](_0x5bc391,{'status':'online'}),'name')['join']());logger[_0x9c99('0xd')](_0x9c99('0x15'),_[_0x9c99('0x11')](_[_0x9c99('0x16')](_0x5bc391,function(_0x3628ba){return _0x3628ba[_0x9c99('0x17')]!=='online';}),_0x9c99('0x13'))[_0x9c99('0x18')]()||_0x9c99('0x19'));console[_0x9c99('0x1a')](_0x9c99('0x1b'));})[_0x9c99('0x1c')](function(_0x35e342){console[_0x9c99('0x1a')](_0x9c99('0x1d'),_0x35e342);logger[_0x9c99('0x1e')](_0x9c99('0x1f'),_0x35e342);process[_0x9c99('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index f195314..ca71e9f 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 _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 +var _0x3032=['find','sub','Setting','findOne','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','email','userpic','md5secret','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','query','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','then','authenticate','json','Bearer','Unknown\x20authorization\x20format','getUuid','apikey'];(function(_0x39733b,_0x40e4f0){var _0x1e5113=function(_0x3f3aaa){while(--_0x3f3aaa){_0x39733b['push'](_0x39733b['shift']());}};_0x1e5113(++_0x40e4f0);}(_0x3032,0x1d6));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0x2303('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2303('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x2303('0x2'));var _=require(_0x2303('0x3'));var jwt=require(_0x2303('0x4'));var expressJwt=require(_0x2303('0x5'));var compose=require(_0x2303('0x6'));var basicAuth=require(_0x2303('0x7'));var crypto=require(_0x2303('0x8'));var BPromise=require(_0x2303('0x9'));var util=require(_0x2303('0xa'));var moment=require(_0x2303('0xb'));var validateJwt=expressJwt({'secret':config[_0x2303('0xc')]['session']});var userAttributes=['id',_0x2303('0xd'),_0x2303('0xe'),_0x2303('0xf'),_0x2303('0x10'),_0x2303('0x11'),_0x2303('0x12'),'permissions',_0x2303('0x13'),'voicePause',_0x2303('0x14'),'mailPause',_0x2303('0x15'),_0x2303('0x16'),_0x2303('0x17'),_0x2303('0x18'),_0x2303('0x19'),'lastLoginAt',_0x2303('0x1a'),_0x2303('0x1b'),_0x2303('0x1c'),_0x2303('0x1d'),_0x2303('0x1e'),_0x2303('0x1f'),'phoneBarAutoAnswerDelay',_0x2303('0x20'),_0x2303('0x21'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0x2303('0x22'),_0x2303('0x23'),_0x2303('0x24'),_0x2303('0x25'),'hotdesk',_0x2303('0x26'),_0x2303('0x27'),'privacyEnabled',_0x2303('0x28'),'wssPort',_0x2303('0x29'),_0x2303('0x2a'),_0x2303('0x2b'),_0x2303('0x2c'),'selectRecallMeCampaign',_0x2303('0x2d'),_0x2303('0x2e'),_0x2303('0x2f'),_0x2303('0x30'),_0x2303('0x31'),_0x2303('0x32'),'openchannelAutoanswer',_0x2303('0x33'),_0x2303('0x34'),_0x2303('0x35'),_0x2303('0x36'),_0x2303('0x37'),_0x2303('0x38')];exports['isChatInteractionAuthorized']=function(){return this[_0x2303('0x39')](!![])[_0x2303('0x3a')](function(_0x45f3ff,_0x895ce0,_0x559e11){if(_0x45f3ff[_0x2303('0x3b')]){_0x559e11();}else{return db[_0x2303('0x3c')]['findOne']({'where':{'id':_0x45f3ff[_0x2303('0x3d')]['id']},'attributes':['id',_0x2303('0x3e'),_0x2303('0x3f')],'raw':!![]})['then'](function(_0x14fb59){if(_0x14fb59&&_0x14fb59['closed']&&!_0x45f3ff[_0x2303('0x40')]['forceDownload']){return _0x895ce0[_0x2303('0x41')](_0x14fb59[_0x2303('0x3f')]===_0x2303('0x42')?0x195:0x193)['json']({'message':_0x14fb59['disposition']===_0x2303('0x42')?_0x2303('0x43'):_0x2303('0x44')});}else{_0x559e11();}})[_0x2303('0x45')](function(_0x2196ee){_0x559e11(_0x2196ee);});}});};exports[_0x2303('0x39')]=function isAuthenticated(_0x2162d0){return compose()[_0x2303('0x3a')](function(_0x16a9e1,_0x45aaf3,_0x5a3b03){var _0x56bb61;if(_0x16a9e1[_0x2303('0x46')][_0x2303('0x47')]){if(_[_0x2303('0x48')](_0x16a9e1['headers'][_0x2303('0x47')],_0x2303('0x49'))){var _0x381be8=basicAuth(_0x16a9e1);db[_0x2303('0x4a')]['find']({'where':{'name':_0x381be8[_0x2303('0xf')]}})[_0x2303('0x4b')](function(_0x58efda){if(!_0x58efda||!_0x58efda[_0x2303('0x4c')](_0x381be8['pass'])){return _0x45aaf3[_0x2303('0x41')](0x191)[_0x2303('0x4d')]({'message':'Wrong\x20credentials.'});}_0x16a9e1[_0x2303('0x3b')]={'id':_0x58efda['id']};_0x5a3b03();})[_0x2303('0x45')](function(_0x555fe3){_0x5a3b03(_0x555fe3);});}else if(_[_0x2303('0x48')](_0x16a9e1[_0x2303('0x46')][_0x2303('0x47')],_0x2303('0x4e'))){validateJwt(_0x16a9e1,_0x45aaf3,_0x5a3b03);}else{if(_0x2162d0){_0x5a3b03();}else{return _0x45aaf3[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x4f')});}}}else if(_0x16a9e1[_0x2303('0x40')]['apikey']){try{var _0x1dc557={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2303('0x50')]()};verifyJwt(_0x16a9e1[_0x2303('0x40')][_0x2303('0x51')],_0x1dc557)['then'](function(_0x214de5){return db['User'][_0x2303('0x52')]({'where':{'id':_0x214de5[_0x2303('0x53')]}})[_0x2303('0x4b')](function(_0x34ca99){_0x56bb61=_0x34ca99;return db[_0x2303('0x54')][_0x2303('0x55')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})['then'](function(_0x43696a){if(!_0x56bb61||!_[_0x2303('0x56')](_0x56bb61[_0x2303('0x57')],_0x214de5['nonce'])){return _0x45aaf3['status'](0x191)['json']({'message':_0x2303('0x58')});}if(_0x56bb61['disabled']){return _0x45aaf3[_0x2303('0x41')](0x191)[_0x2303('0x4d')]({'message':_0x2303('0x59')});}if(_0x56bb61[_0x2303('0x5a')]){if(_0x43696a[_0x2303('0x5b')]>0x0){if(moment(_0x56bb61[_0x2303('0x5c')])[_0x2303('0x5d')](_0x43696a[_0x2303('0x5b')],_0x2303('0x5e'))>moment()){return _0x45aaf3['status'](0x191)[_0x2303('0x4d')]({'message':_0x2303('0x59')});}}else{return _0x45aaf3[_0x2303('0x41')](0x191)[_0x2303('0x4d')]({'message':_0x2303('0x59')});}}_0x16a9e1[_0x2303('0x3b')]={'id':_0x56bb61['id']};_0x5a3b03();});})[_0x2303('0x45')](function(){return _0x45aaf3[_0x2303('0x41')](0x191)['json']({'message':_0x2303('0x59')});});}catch(_0x5ea3cb){_0x5a3b03(_0x5ea3cb);}}else if(_0x2162d0){_0x5a3b03();}else{return _0x45aaf3[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x4f')});}})[_0x2303('0x3a')](function(_0x17c883,_0x2ada25,_0x2ef53b){if(_0x17c883[_0x2303('0x3b')]){db['User'][_0x2303('0x52')]({'where':{'id':_0x17c883[_0x2303('0x3b')]['id']},'attributes':userAttributes})[_0x2303('0x4b')](function(_0x4a228f){if(!_0x4a228f){return _0x2ada25[_0x2303('0x41')](0x194)['json']({'message':_0x2303('0x5f')});}_0x17c883['user']=_0x4a228f;_0x2ef53b();})['catch'](function(_0x33b03f){_0x2ef53b(_0x33b03f);});}else if(_0x2162d0){_0x2ef53b();}else{return _0x2ada25[_0x2303('0x41')](0x194)[_0x2303('0x4d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2303('0x60')]=function canUpdate(){return compose()[_0x2303('0x3a')](function(_0x3fd51b,_0x167c36,_0xb4825d){return licenseUtil[_0x2303('0x61')]()['then'](function(_0x55d262){if(_0x55d262['update']){_0xb4825d();}else{return _0x167c36[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x62')});}})[_0x2303('0x45')](function(_0x507e85){_0xb4825d(_0x507e85);});});};exports[_0x2303('0x63')]=function isWebrtcLicence(){return compose()[_0x2303('0x3a')](function(_0x43d65e,_0x139dea,_0x4d8933){return licenseUtil[_0x2303('0x61')]()[_0x2303('0x4b')](function(_0x295ead){if(_0x295ead['webrtc']){_0x4d8933();}else{return _0x139dea[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x62')});}})['catch'](function(_0x569404){_0x4d8933(_0x569404);});});};exports[_0x2303('0x64')]=function(_0x3f98ff,_0x196ce5,_0x4c6cb7){_0x3f98ff['isMiddleware']=!![];return _0x4c6cb7();};exports[_0x2303('0x65')]=function signToken(_0x158dcc){return signJwt(_0x158dcc);};exports[_0x2303('0x66')]=function(_0x5db98f,_0xbf4d56){if(!_0x5db98f[_0x2303('0x3b')]){return _0xbf4d56[_0x2303('0x41')](0x194)[_0x2303('0x4d')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x35e5e3={'payload':{'id':_0x5db98f[_0x2303('0x3b')]['id'],'role':_0x5db98f[_0x2303('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x35e5e3)[_0x2303('0x4b')](function(_0x494629){_0xbf4d56[_0x2303('0x67')](_0x2303('0x68'),_0x494629);_0xbf4d56[_0x2303('0x69')](_0x2303('0x6a'));})[_0x2303('0x45')](function(_0x59db94){return _0xbf4d56[_0x2303('0x41')](0x1f4)[_0x2303('0x6b')](_0x59db94);});};exports[_0x2303('0x6c')]=function(_0x258245){if(_[_0x2303('0x6d')](_0x258245[_0x2303('0x57')])||_[_0x2303('0x6d')](_0x258245[_0x2303('0x6e')])){return null;}else{return createJwt(_0x258245);}};exports[_0x2303('0x6f')]=function(_0x4e2cf1){_0x4e2cf1['apiKeyNonce']=generateNonce();_0x4e2cf1[_0x2303('0x6e')]=generateIssuedAt();return createJwt(_0x4e2cf1);};exports[_0x2303('0x70')]=function(_0x1f4ebe,_0x51efad){var _0x1d7a22=_0x1f4ebe[_0x2303('0x40')][_0x2303('0x51')];if(_0x1d7a22){var _0x5cdee2={'nonce':_0x51efad[_0x2303('0x57')],'iat':_0x51efad['apiKeyIat'],'audience':hardwareConf[_0x2303('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1d7a22,_0x5cdee2)[_0x2303('0x4b')](function(){return generateApiKey(_0x51efad);});}else{throw{'message':_0x2303('0x71')};}};exports['validatePasswordPattern']=function(_0x7ec490){var _0x412aa5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x412aa5[_0x2303('0x72')](_0x7ec490))throw new db['Sequelize'][(_0x2303('0x73'))](_0x2303('0x74'));return;};exports['validatePasswordHistory']=function(_0x164011,_0x23f6e4,_0x9a5404){var _0x1827ef=encryptor['decryptString'](_0x23f6e4)[_0x2303('0x75')](',');for(var _0x368bb2=0x0;_0x368bb2<_0x9a5404;_0x368bb2++){if(!_0x1827ef[_0x368bb2])break;if(_0x164011[_0x2303('0x76')]()===_0x1827ef[_0x368bb2][_0x2303('0x76')]()){var _0x4f9452=util[_0x2303('0x77')](_0x2303('0x78'),_0x9a5404);if(_0x9a5404===0x1){_0x4f9452='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2303('0x79'))]['ValidationError'](_0x4f9452);}}return;};exports[_0x2303('0x7a')]=function(_0x107fa6,_0x1a3e13){var _0x24d23d=_0x1a3e13?encryptor[_0x2303('0x7b')](_0x1a3e13)[_0x2303('0x75')](','):[];if(_0x24d23d['length']===0x5){_0x24d23d[_0x2303('0x7c')](-0x1,0x1);}_0x24d23d[_0x2303('0x7d')](_0x107fa6);return encryptor[_0x2303('0x7e')](_0x24d23d[_0x2303('0x7f')](','));};function signJwt(_0x2086ea){var _0x5bd5ad=BPromise[_0x2303('0x80')](jwt[_0x2303('0x81')],{'context':jwt});var _0x49df3f=_0x2086ea[_0x2303('0x82')]||config[_0x2303('0xc')][_0x2303('0x83')];return new BPromise(function(_0x4f4348,_0x30b3c3){_0x5bd5ad(_0x2086ea[_0x2303('0x84')],_0x49df3f,_0x2086ea['options'])['then'](function(_0x41d19e){_0x4f4348(_0x41d19e);})[_0x2303('0x45')](function(_0x5741c5){_0x30b3c3(_0x5741c5);});});}function verifyJwt(_0x5a6bf2,_0x3c073d,_0x3854f9){var _0x296f4e=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0xd4144c=_0x3854f9||config[_0x2303('0xc')][_0x2303('0x83')];return new BPromise(function(_0x2a5bad,_0x275a2a){_0x296f4e(_0x5a6bf2,_0xd4144c,_0x3c073d)[_0x2303('0x4b')](function(_0x5dcfe8){_0x2a5bad(_0x5dcfe8);})[_0x2303('0x45')](function(_0x30d2b5){_0x275a2a(_0x30d2b5);});});}function generateNonce(){return crypto[_0x2303('0x85')](0x10)[_0x2303('0x86')](_0x2303('0x87'));}function generateIssuedAt(){return Math[_0x2303('0x88')](Date[_0x2303('0x89')]()/0x3e8)[_0x2303('0x86')]();}function createJwt(_0x16a4ce){var _0x2e3c4d={'payload':{'iat':_0x16a4ce[_0x2303('0x6e')],'nonce':_0x16a4ce[_0x2303('0x57')]},'options':{'algorithm':'HS512','subject':_0x16a4ce['id']['toString'](),'issuer':hardwareConf[_0x2303('0x50')](),'audience':hardwareConf[_0x2303('0x50')]()}};return signJwt(_0x2e3c4d)['then'](function(_0x3e7e6a){return{'iat':_0x16a4ce[_0x2303('0x6e')],'nonce':_0x16a4ce[_0x2303('0x57')],'token':_0x3e7e6a};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 99013dc..f2e9b67 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 _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 +var _0x9f9f=['countFilteredContacts','count','User','buildContactsQuery','fields','rows','catch','describe','CmContact','startsWith','map','findOne','all','length','type','keys','lodash','./sql-utils','../../mysqldb','findAll','resolve','search','parseQueryParameters','then','where','default','user','clause','checkListsRestrictions','ids','tag'];(function(_0xde085d,_0x573b71){var _0x1fee75=function(_0x518a2f){while(--_0x518a2f){_0xde085d['push'](_0xde085d['shift']());}};_0x1fee75(++_0x573b71);}(_0x9f9f,0xe9));var _0xf9f9=function(_0x571884,_0x2e5542){_0x571884=_0x571884-0x0;var _0xaf29f5=_0x9f9f[_0x571884];return _0xaf29f5;};'use strict';var _=require(_0xf9f9('0x0'));var sqlUtils=require(_0xf9f9('0x1'));var db=require(_0xf9f9('0x2'))['db'];exports[_0xf9f9('0x3')]=function(_0x33bb96,_0x42dd3f,_0x47ad98,_0x349805){var _0x238101={'count':0x0,'rows':[]};var _0x2a3b3f=sqlUtils['skipContactsQuery'](_0x42dd3f,_0x33bb96);if(_0x2a3b3f){return Promise['resolve'](_0x238101);}var _0x3bac84=sqlUtils['getContactsSubquery']();var _0x2a8a2f={};var _0x392df3=![];var _0x59d1ed=![];return Promise[_0xf9f9('0x4')]()['then'](function(){if(_0x33bb96[_0xf9f9('0x5')]){return sqlUtils['parseAdvancedSearchFilter'](_0x33bb96['search'],_0x349805);}else{return sqlUtils[_0xf9f9('0x6')](_0x33bb96,_0x349805);}})[_0xf9f9('0x7')](function(_0x11519d){_0x3bac84[_0xf9f9('0x8')](_0x11519d[_0xf9f9('0x9')]);_0x3bac84[_0xf9f9('0x8')](_0x11519d['fields']);_0x3bac84[_0xf9f9('0x8')](_0x11519d['filter']);_0x3bac84[_0xf9f9('0x8')](_0x11519d[_0xf9f9('0xa')][_0xf9f9('0xb')]);_0x2a8a2f=_0x11519d['tags'];_0x59d1ed=_0x11519d['user']['skip'];return sqlUtils[_0xf9f9('0xc')](_0x42dd3f,_0x33bb96,_0x59d1ed);})[_0xf9f9('0x7')](function(_0x1cbf51){_0x3bac84[_0xf9f9('0x8')](_0x1cbf51);var _0x2c66e9=_0x33bb96[_0xf9f9('0x5')]?_0x2a8a2f[_0xf9f9('0xd')]:_0x33bb96[_0xf9f9('0xe')];_0x392df3=_0x2c66e9?!![]:![];return sqlUtils[_0xf9f9('0xf')](_0x3bac84,_0x2c66e9);})[_0xf9f9('0x7')](function(_0x224b02){_0x238101[_0xf9f9('0x10')]=_0x224b02;if(_0x238101[_0xf9f9('0x10')]===0x0){return;}if(_0x33bb96[_0xf9f9('0x11')]){_0x59d1ed=!![];}return sqlUtils[_0xf9f9('0x12')](_0x3bac84,_0x33bb96[_0xf9f9('0x13')],_0x47ad98,_0x392df3,_0x2a8a2f[_0xf9f9('0xb')],_0x59d1ed);})[_0xf9f9('0x7')](function(_0x45b81c){if(!_0x45b81c){return[];}return sqlUtils['getFilteredContacts'](_0x45b81c,_0x33bb96,_0x47ad98);})[_0xf9f9('0x7')](function(_0xa32b0c){_0x238101[_0xf9f9('0x14')]=_0xa32b0c;return _0x238101;})[_0xf9f9('0x15')](function(_0x5dd4e1){throw _0x5dd4e1;});};exports[_0xf9f9('0x16')]=function(){var _0x4cec16={};var _0x489454=[];return db[_0xf9f9('0x17')][_0xf9f9('0x16')]()['then'](function(_0x31fc82){_0x4cec16=_0x31fc82;var _0x1b4aeb=Object['keys'](_0x4cec16)['filter'](function(_0x486343){return _[_0xf9f9('0x18')](_0x486343,'cf_')?_0x486343:undefined;});var _0x2b4c2e=_0x1b4aeb[_0xf9f9('0x19')](function(_0x4dead7){return db['CmCustomField'][_0xf9f9('0x1a')]({'where':{'id':_0x4dead7['slice'](0x3)},'raw':!![]});});return Promise[_0xf9f9('0x1b')](_0x2b4c2e);})[_0xf9f9('0x7')](function(_0x41be58){for(var _0x2691eb=0x0;_0x2691eb<_0x41be58[_0xf9f9('0x1c')];_0x2691eb++){if(_0x41be58[_0x2691eb]){var _0x4729cf='cf_'+_0x41be58[_0x2691eb]['id'];_0x4cec16[_0x4729cf]['fieldType']=_0x41be58[_0x2691eb][_0xf9f9('0x1d')];}}_0x489454=_[_0xf9f9('0x19')](Object[_0xf9f9('0x1e')](_0x4cec16),function(_0x45cf74){return{'name':_0x45cf74,'type':_0x4cec16[_0x45cf74]['type']};});return _0x489454;})[_0xf9f9('0x15')](function(_0x39a638){throw _0x39a638;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 0e138fc..75d98cf 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 _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 +var _0x1ccb=['TagIds','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','name','dateOfBirth','castTo','buildExpression','type','value','Tag','split','map','tags','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','and','\x20=\x20?','resolve','then','clause','filter','role','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','order','DESC','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','COUNT(*)','exports','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','search','ListId','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt'];(function(_0x5e761b,_0x355e38){var _0x98502c=function(_0x4e52d5){while(--_0x4e52d5){_0x5e761b['push'](_0x5e761b['shift']());}};_0x98502c(++_0x355e38);}(_0x1ccb,0x105));var _0xb1cc=function(_0x5a2cd9,_0x98dcd2){_0x5a2cd9=_0x5a2cd9-0x0;var _0x306d2f=_0x1ccb[_0x5a2cd9];return _0x306d2f;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0xb1cc('0x0'));var qs=require(_0xb1cc('0x1'));var utils=require(_0xb1cc('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x30cb74,_0x438aac){var _0x44f519=![];if(_0x30cb74['role']===_0xb1cc('0x3')&&!_0x438aac[_0xb1cc('0x4')]&&!_0x438aac[_0xb1cc('0x5')]&&_0x438aac['autocomplete']!=='true'){_0x44f519=!![];}return _0x44f519;}function getContactsSubquery(){return squel[_0xb1cc('0x6')]()[_0xb1cc('0x7')](_0xb1cc('0x8'),'c')[_0xb1cc('0x9')](_0xb1cc('0xa'));}function applyJoinClauses(_0x2946ef,_0x33d3a3){var _0x536511=_0x33d3a3?'c':_0xb1cc('0xb');_0x2946ef[_0xb1cc('0xc')](_0xb1cc('0xd'),'uc','uc.CmContactId\x20=\x20'+_0x536511+_0xb1cc('0xe'))[_0xb1cc('0xc')](_0xb1cc('0xf'),'ct',_0xb1cc('0x10')+_0x536511+_0xb1cc('0xe'))[_0xb1cc('0xc')](_0xb1cc('0x11'),'t',_0xb1cc('0x12'));return _0x2946ef;}function addFieldsToQuery(_0xdd2823,_0xa67a05,_0x5710b9,_0x2669e0,_0x2c0205){var _0x4b660c=_0x2c0205?'c':_0xb1cc('0xb');if(!_0xa67a05){_0xa67a05=['id','firstName',_0xb1cc('0x13'),_0xb1cc('0x14'),_0xb1cc('0x15'),_0xb1cc('0x16'),_0xb1cc('0x17'),_0xb1cc('0x5'),'CompanyId',_0xb1cc('0x18'),_0xb1cc('0x19'),_0xb1cc('0x1a'),_0xb1cc('0x1b')];}else if(!_0xa67a05['includes']('id')){_0xa67a05['push']('id');}var _0x196cd5=_0x5710b9&&_0x2c0205||!_0x5710b9&&!_0x2c0205;if(_0x2669e0){_0x196cd5=_0x2669e0&&_0x2c0205||!_0x2669e0&&!_0x2c0205;}_0xa67a05[_0xb1cc('0x1c')](function(_0x2f5b44){if(_0x2f5b44==='TagIds'){if(_0x196cd5){_0xdd2823[_0xb1cc('0x1d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2f5b44);}else if(_0x5710b9||_0x2669e0){_0xdd2823[_0xb1cc('0x1d')](_0x4b660c+'.'+_0x2f5b44);}}else{_0xdd2823[_0xb1cc('0x1d')](_0x4b660c+'.'+_0x2f5b44);}});return _0xdd2823;}function getSqlClauses(){var _0x540c6d={'default':squel['expr'](),'fields':squel[_0xb1cc('0x1e')](),'filter':squel[_0xb1cc('0x1e')](),'tags':{'clause':squel[_0xb1cc('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x540c6d;}function parseTagParameter(_0x4810a0){var _0x1a30ed=squel['expr']();if(_0x4810a0){var _0x2e3091=utils[_0xb1cc('0x1f')](_0x4810a0);_0x2e3091[_0xb1cc('0x1c')](function(_0x54b6e9){_0x1a30ed['or'](_0xb1cc('0x20'),'%,'+_0x54b6e9+',%');});}return _0x1a30ed;}function parseSearchFilter(_0x384608){var _0x12c42b=squel[_0xb1cc('0x1e')]();if(_0x384608){var _0xf24fea=_0x384608[_0xb1cc('0x21')]('\x5c','\x5c\x5c')[_0xb1cc('0x21')](/'/g,'\x27\x27');var _0xc8678b=qs['escapeLIKESpecialChars'](_0xf24fea);if(_0xf24fea['split']('\x20')['length']>0x1){_0x12c42b['or'](_0xb1cc('0x22'),qs['getFullTextValue'](_0xf24fea,!![]),null);}else{if(qs[_0xb1cc('0x23')](_0xf24fea)){_0x12c42b['or']('c.id\x20LIKE\x20?',_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x24'),_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x25'),_0xc8678b+'%');_0x12c42b['or']('c.fax\x20LIKE\x20?',_0xc8678b+'%');}else if(qs[_0xb1cc('0x26')](_0xf24fea)){_0x12c42b['or'](_0xb1cc('0x27'),_0xc8678b+'%');}else{_0x12c42b['or'](_0xb1cc('0x28'),'%'+_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x29'),'%'+_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x27'),'%'+_0xc8678b+'%');}}}return _0x12c42b;}function parseAdvancedSearchFilter(_0x3686ec,_0x8e4515){var _0x1b82c5=getSqlClauses();var _0x13aacc=as[_0xb1cc('0x2a')](_0x3686ec);var _0xfb5388=_0x13aacc[_0xb1cc('0x2b')];for(var _0x5258a4=0x0;_0x5258a4<_0x13aacc[_0xb1cc('0x2c')][_0xb1cc('0x2d')];_0x5258a4++){var _0x36c35f=_0x13aacc[_0xb1cc('0x2c')][_0x5258a4];var _0x2fde65='c';var _0x5501f3=_['find'](_0x8e4515,[_0xb1cc('0x2e'),_0x36c35f[_0xb1cc('0x1d')]]);if(_0x5501f3){if(_0x36c35f[_0xb1cc('0x1d')]===_0xb1cc('0x2f')||_0x5501f3['fieldType']==='datetime'){_0x36c35f[_0xb1cc('0x30')]='DATE';}var _0x29714c=as[_0xb1cc('0x31')](_0x2fde65,_0x5501f3[_0xb1cc('0x32')],_0x36c35f);_0x1b82c5['default'][_0xfb5388](_0x29714c['text'],_0x29714c['value']['start'],_0x29714c[_0xb1cc('0x33')]['end']);}else{if(_0x36c35f[_0xb1cc('0x1d')]===_0xb1cc('0x34')){var _0x4e734b=_0x36c35f['value'][_0xb1cc('0x35')](',')[_0xb1cc('0x36')](function(_0x19d90d){return Number(_0x19d90d);});var _0xd7c8ab=parseTagParameter(_0x4e734b);_0x1b82c5[_0xb1cc('0x37')]['clause']['and'](_0xd7c8ab);_0x1b82c5[_0xb1cc('0x37')]['ids']=_0x4e734b;}else if(_0x36c35f[_0xb1cc('0x1d')]===_0xb1cc('0x38')){_0x1b82c5[_0xb1cc('0x39')]['clause']['and'](_0xb1cc('0x3a'),_0x36c35f['value']);_0x1b82c5['user'][_0xb1cc('0x3b')]=!![];}}}return _0x1b82c5;}function parseModelFields(_0x49f7cd,_0xfd8a3f){var _0x1a4d47=squel[_0xb1cc('0x1e')]();var _0x17242a=_(_0x49f7cd)[_0xb1cc('0x3c')]()[_0xb1cc('0x36')](function(_0x904907){return _[_0xb1cc('0x3d')](_0xfd8a3f,['name',_0x904907])?_0x904907:undefined;})[_0xb1cc('0x3e')]()[_0xb1cc('0x33')]();if(_0x49f7cd[_0xb1cc('0x3f')]){_0x17242a[_0xb1cc('0x40')]('Contact');}if(_0x49f7cd[_0xb1cc('0x38')]){_0x17242a['push'](_0xb1cc('0x38'));}if(_0x17242a[_0xb1cc('0x2d')]>0x0){_0x17242a['forEach'](function(_0xebb88f){if(_0xebb88f===_0xb1cc('0x5')){_0x1a4d47['and'](_0xb1cc('0x41'),[][_0xb1cc('0x42')](_0x49f7cd[_0xebb88f]));}else if(_0xebb88f==='Contact'){var _0x46ba81='%'+_0x49f7cd[_0xebb88f]+'%';_0x1a4d47[_0xb1cc('0x43')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x46ba81);}else if(_0xebb88f===_0xb1cc('0x38')){_0x1a4d47['and'](_0xb1cc('0x3a'),_0x49f7cd[_0xebb88f]);}else{_0x1a4d47[_0xb1cc('0x43')]('c.'+_0xebb88f+_0xb1cc('0x44'),_0x49f7cd[_0xebb88f]);}});}return _0x1a4d47;}function parseQueryParameters(_0x3cee56,_0x3e73f7){var _0x4d570d=getSqlClauses();return Promise[_0xb1cc('0x45')]()[_0xb1cc('0x46')](function(){return parseModelFields(_0x3cee56,_0x3e73f7);})[_0xb1cc('0x46')](function(_0x46a742){_0x4d570d['fields'][_0xb1cc('0x43')](_0x46a742);return parseTagParameter(_0x3cee56['tag']);})[_0xb1cc('0x46')](function(_0x1cebf5){_0x4d570d[_0xb1cc('0x37')][_0xb1cc('0x47')][_0xb1cc('0x43')](_0x1cebf5);return parseSearchFilter(_0x3cee56['filter']);})[_0xb1cc('0x46')](function(_0x1f8568){_0x4d570d[_0xb1cc('0x48')]=_0x1f8568;return _0x4d570d;});}function checkListsRestrictions(_0x144036,_0x82776d,_0x115868){var _0xfb0b60=squel[_0xb1cc('0x1e')]();return Promise[_0xb1cc('0x45')]()['then'](function(){if(_0x82776d[_0xb1cc('0x4')]&&_0x144036[_0xb1cc('0x49')]==='agent'&&!_0x115868){return _0x144036[_0xb1cc('0x4a')]({'attributes':['id'],'raw':!![]});}})[_0xb1cc('0x46')](function(_0x5c580a){if(_0x5c580a){if(_0x5c580a['length']===0x0){_0xfb0b60[_0xb1cc('0x43')](_0xb1cc('0x4b'));}else{_0xfb0b60[_0xb1cc('0x43')](_0xb1cc('0x41'),_['map'](_0x5c580a,'id'));}}})['then'](function(){return _0xfb0b60;});}function buildContactsQuery(_0x15d070,_0x321cc8,_0x1f5df8,_0x2be644,_0x38ee09,_0x23bef8){if(_0x321cc8){_0x321cc8=_0x1f5df8['attributes'];}_0x15d070=addFieldsToQuery(_0x15d070,_0x321cc8,_0x2be644,_0x23bef8,!![]);var _0x21b3a8=squel[_0xb1cc('0x6')]();_0x21b3a8=addFieldsToQuery(_0x21b3a8,_0x321cc8,_0x2be644,_0x23bef8,![]);if(_0x2be644||_0x23bef8){_0x15d070=applyJoinClauses(_0x15d070,!![]);_0x15d070[_0xb1cc('0x4c')](_0xb1cc('0x4d'));if(_0x1f5df8[_0xb1cc('0x4e')]){_0x21b3a8[_0xb1cc('0x4e')](_0x1f5df8[_0xb1cc('0x4e')]);}if(_0x1f5df8[_0xb1cc('0x4f')]){_0x21b3a8[_0xb1cc('0x4f')](_0x1f5df8[_0xb1cc('0x4f')]);}}else{_0x21b3a8=applyJoinClauses(_0x21b3a8,![]);_0x21b3a8['group']('subqry.id');if(_0x1f5df8[_0xb1cc('0x4e')]){_0x15d070[_0xb1cc('0x4e')](_0x1f5df8[_0xb1cc('0x4e')]);}if(_0x1f5df8[_0xb1cc('0x4f')]){_0x15d070[_0xb1cc('0x4f')](_0x1f5df8[_0xb1cc('0x4f')]);}}_0x21b3a8['having'](_0x38ee09);if(_0x1f5df8[_0xb1cc('0x50')]){_0x1f5df8[_0xb1cc('0x50')][_0xb1cc('0x1c')](function(_0x8dbe5c){_0x15d070['order']('c.'+_0x8dbe5c[0x0],_0x8dbe5c[0x1]==='DESC'?![]:!![]);_0x21b3a8[_0xb1cc('0x50')]('subqry.'+_0x8dbe5c[0x0],_0x8dbe5c[0x1]===_0xb1cc('0x51')?![]:!![]);});}_0x21b3a8[_0xb1cc('0x7')](_0x15d070,_0xb1cc('0xb'));return _0x21b3a8;}function getFilteredContacts(_0x4682da){var _0x4a5ac2=[];return db[_0xb1cc('0x34')][_0xb1cc('0x52')]({'attributes':['id',_0xb1cc('0x2e'),_0xb1cc('0x53')],'raw':!![]})[_0xb1cc('0x46')](function(_0x2506ae){_0x4a5ac2=_[_0xb1cc('0x54')](_0x2506ae,'id');var _0x48ff1e={'type':db['Sequelize'][_0xb1cc('0x55')][_0xb1cc('0x56')],'model':db[_0xb1cc('0x57')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb1cc('0x58')]['query'](_0x4682da[_0xb1cc('0x59')](),_0x48ff1e);})['then'](function(_0x2ac3e7){_0x2ac3e7[_0xb1cc('0x1c')](function(_0x15988a){if(_0x15988a['TagIds']){_0x15988a[_0xb1cc('0x5a')]=[];_0x15988a[_0xb1cc('0x1b')][_0xb1cc('0x35')](',')[_0xb1cc('0x1c')](function(_0xb93ce6){_0x15988a[_0xb1cc('0x5a')][_0xb1cc('0x40')](_0x4a5ac2[_0xb93ce6]);});}delete _0x15988a['TagIds'];});return _0x2ac3e7;});}function countFilteredContacts(_0x37b8d3,_0x3c5802){var _0x17566b=_0x37b8d3[_0xb1cc('0x5b')]();_0x17566b[_0xb1cc('0x1d')]('COUNT(*)');_0x17566b=applyJoinClauses(_0x17566b,!![]);_0x37b8d3[_0xb1cc('0x4c')](_0xb1cc('0x4d'));var _0x41f7db=utils['getSelectedTags'](_0x3c5802);if(!_[_0xb1cc('0x5c')](_0x41f7db)){_0x17566b[_0xb1cc('0x9')](_0xb1cc('0x5d'),_0x41f7db);}var _0x49945c={'type':db['Sequelize'][_0xb1cc('0x55')][_0xb1cc('0x56')],'raw':!![]};return db[_0xb1cc('0x58')]['query'](_0x17566b[_0xb1cc('0x59')](),_0x49945c)['then'](function(_0x25cb31){return _0x25cb31[0x0][_0xb1cc('0x5e')];});}module[_0xb1cc('0x5f')]={'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 23d1d79..e55195e 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 _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 +var _0xd8a4=['final','binary','write','close','unlink','decryptFile','createWriteStream','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','algorithm','encrypt','join','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','end'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0xd8a4,0x99));var _0x4d8a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd8a4[_0x2dafbe];return _0x58a45a;};'use strict';var crypto=require(_0x4d8a('0x0'));var fs=require('fs');var BPromise=require(_0x4d8a('0x1'));var _=require(_0x4d8a('0x2'));var config=require('../../config/environment');var logger=require(_0x4d8a('0x3'))(_0x4d8a('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4d8a('0x5')][_0x4d8a('0x6')],'algorithm':_0x4d8a('0x7')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config['encrypt'][_0x4d8a('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4d8a('0x9')]['algorithm']);if(isSupported){fileOptions[_0x4d8a('0x8')]=config[_0x4d8a('0x9')][_0x4d8a('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4d8a('0xa')](',\x20');logger['error'](config['encrypt'][_0x4d8a('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5a4bac){return AES_SUPPORTED_RX[_0x4d8a('0xb')](_0x5a4bac);}function getSupportedCiphers(){return crypto[_0x4d8a('0xc')]()[_0x4d8a('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x5169ec){return getSupportedCiphers()[_0x4d8a('0xe')](_0x5169ec)>-0x1;}function combineOptions(_0x425bdb){var _0x50905e={};for(var _0x4a22d4 in fileOptions){if(fileOptions[_0x4d8a('0xf')](_0x4a22d4)){_0x50905e[_0x4a22d4]=fileOptions[_0x4a22d4];}}if(_0x425bdb){for(var _0x17156a in _0x425bdb){if(_0x425bdb[_0x4d8a('0xf')](_0x17156a)){_0x50905e[_0x17156a]=_0x425bdb[_0x17156a];}}}return _0x50905e;}exports[_0x4d8a('0x10')]=function(_0x1b5fd3,_0x535ff9,_0x12b9b2,_0x31b033){return new BPromise(function(_0x42803b,_0x127e83){_0x31b033=combineOptions(_0x31b033);var _0x2ded65=new Buffer(_0x12b9b2);var _0x20dac1=fs[_0x4d8a('0x11')](_0x1b5fd3);var _0x5d8ef6=fs['createWriteStream'](_0x535ff9);var _0x4f2790=crypto[_0x4d8a('0x12')](_0x31b033[_0x4d8a('0x8')],_0x2ded65);_0x20dac1['on'](_0x4d8a('0x13'),function(_0x1c807a){var _0x5bb090=new Buffer(_0x4f2790[_0x4d8a('0x14')](_0x1c807a),'binary');_0x5d8ef6['write'](_0x5bb090);});_0x20dac1['on'](_0x4d8a('0x15'),function(){try{var _0x23dda8=new Buffer(_0x4f2790[_0x4d8a('0x16')]('binary'),_0x4d8a('0x17'));_0x5d8ef6[_0x4d8a('0x18')](_0x23dda8);_0x5d8ef6[_0x4d8a('0x15')]();_0x5d8ef6['on'](_0x4d8a('0x19'),function(){return _0x42803b(_0x535ff9);});}catch(_0x27a8cb){fs[_0x4d8a('0x1a')](_0x535ff9);return _0x127e83(_0x27a8cb);}});});};exports[_0x4d8a('0x1b')]=function(_0x5d5f3e,_0x58a4bc,_0x569544,_0x9c08c2){return new BPromise(function(_0x5f0be9,_0x4c54c2){_0x9c08c2=combineOptions(_0x9c08c2);var _0x319ce5=new Buffer(_0x569544);var _0x1c34b0=fs[_0x4d8a('0x11')](_0x5d5f3e);var _0x151319=fs[_0x4d8a('0x1c')](_0x58a4bc);var _0x2e6a3b=crypto[_0x4d8a('0x1d')](_0x9c08c2['algorithm'],_0x319ce5);_0x1c34b0['on'](_0x4d8a('0x13'),function(_0x16c030){var _0x558479=new Buffer(_0x2e6a3b[_0x4d8a('0x14')](_0x16c030),_0x4d8a('0x17'));_0x151319[_0x4d8a('0x18')](_0x558479);});_0x1c34b0['on'](_0x4d8a('0x15'),function(){try{var _0x1c266a=new Buffer(_0x2e6a3b[_0x4d8a('0x16')](_0x4d8a('0x17')),_0x4d8a('0x17'));_0x151319['write'](_0x1c266a);_0x151319[_0x4d8a('0x15')]();_0x151319['on']('close',function(){return _0x5f0be9(_0x58a4bc);});}catch(_0x36b570){fs[_0x4d8a('0x1a')](_0x58a4bc);return _0x4c54c2(_0x36b570);}});});};exports[_0x4d8a('0x1e')]=function(_0x2b0ad0,_0x32d335,_0x59efb1){var _0x148b6e=_0x59efb1||stringOptions['algorithm'];var _0x46062a=_0x32d335||stringOptions[_0x4d8a('0x1f')];var _0x2418f2=crypto[_0x4d8a('0x12')](_0x148b6e,_0x46062a);var _0x4e9062=_0x2418f2[_0x4d8a('0x14')](_0x2b0ad0,_0x4d8a('0x20'),_0x4d8a('0x21'));_0x4e9062+=_0x2418f2['final'](_0x4d8a('0x21'));return _0x4e9062;};exports[_0x4d8a('0x22')]=function(_0x76c2c1,_0x10b626,_0x4fd43c){var _0x5bd68b=_0x4fd43c||stringOptions[_0x4d8a('0x8')];var _0x552b1f=_0x10b626||stringOptions['secret'];var _0x4db48c=crypto[_0x4d8a('0x1d')](_0x5bd68b,_0x552b1f);var _0x21c768=_0x4db48c[_0x4d8a('0x14')](_0x76c2c1,'base64','utf8');_0x21c768+=_0x4db48c['final']('utf8');return _0x21c768;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index cb4de2f..82b53d8 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 _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 +var _0xfb53=['argv','update','info','format','CSV','find','split','splitSizeCsv','then','sequelize','QueryTypes','SELECT','num','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip\x20finished','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','bluebird','rimraf','../../mysqldb','../../config/logger','analytics'];(function(_0x5bf8b5,_0x38ff2a){var _0x2991cd=function(_0x2f19a8){while(--_0x2f19a8){_0x5bf8b5['push'](_0x5bf8b5['shift']());}};_0x2991cd(++_0x38ff2a);}(_0xfb53,0xcf));var _0x3fb5=function(_0x12f1fc,_0x49ff81){_0x12f1fc=_0x12f1fc-0x0;var _0x9e308e=_0xfb53[_0x12f1fc];return _0x9e308e;};'use strict';var util=require(_0x3fb5('0x0'));var path=require(_0x3fb5('0x1'));var _=require(_0x3fb5('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x3fb5('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x3fb5('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3fb5('0x5'))['dbH'];var logger=require(_0x3fb5('0x6'))(_0x3fb5('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3fb5('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x33b2c5,_0x39ec3a){var _0x37ba04={'status':_0x33b2c5};var _0x283831={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x39ec3a){_0x37ba04['savename']=_0x39ec3a;}return db['AnalyticExtractedReport'][_0x3fb5('0x9')](_0x37ba04,_0x283831);}function main(){var _0xe219dc=0x1388;var _0x151d3b;logger[_0x3fb5('0xa')](util[_0x3fb5('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3fb5('0xc')));return db['Setting'][_0x3fb5('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3fb5('0xe'),_0x3fb5('0xf')]})['then'](function(_0x1cac24){if(_0x1cac24){_0x151d3b=_0x1cac24;_0xe219dc=_0x151d3b[_0x3fb5('0xf')]||0x1388;}})[_0x3fb5('0x10')](function(){return dbH[_0x3fb5('0x11')]['query'](util[_0x3fb5('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3fb5('0x11')][_0x3fb5('0x12')][_0x3fb5('0x13')]});})['then'](function(_0x16443d){if(!_0x16443d[0x0][_0x3fb5('0x14')]){return analyticExtractedReport('Empty');}var _0x4fbeb7=[];var _0x18b81a=0x0;if(_0x151d3b['split']){if(_0x16443d&&_0x16443d[_0x3fb5('0x15')]){var _0x517b6c=_['range'](_0x16443d[0x0][_0x3fb5('0x14')]/_0xe219dc);var _0x102092=Number[_0x3fb5('0x16')](_0x16443d[0x0][_0x3fb5('0x14')]/_0xe219dc)?_0x16443d[0x0][_0x3fb5('0x14')]%_0xe219dc:0x0;_0x517b6c[_0x3fb5('0x17')](function(_0x5eae03){if(_0x5eae03>0x0){_0x18b81a+=_0xe219dc;}_0x4fbeb7['push'](dbH[_0x3fb5('0x11')][_0x3fb5('0x18')](util[_0x3fb5('0xb')](_0x3fb5('0x19'),QUERY,_0xe219dc,_0x18b81a),{'type':dbH['sequelize'][_0x3fb5('0x12')][_0x3fb5('0x13')]}));});if(_0x102092>0x0){_0x18b81a+=_0xe219dc;_0x4fbeb7['push'](dbH[_0x3fb5('0x11')][_0x3fb5('0x18')](util[_0x3fb5('0xb')](_0x3fb5('0x19'),QUERY,_0x102092,_0x18b81a),{'type':dbH[_0x3fb5('0x11')][_0x3fb5('0x12')][_0x3fb5('0x13')]}));}}}else{_0x4fbeb7[_0x3fb5('0x1a')](dbH[_0x3fb5('0x11')][_0x3fb5('0x18')](QUERY,{'type':dbH[_0x3fb5('0x11')][_0x3fb5('0x12')][_0x3fb5('0x13')]}));}var _0xed8c44=path[_0x3fb5('0x1b')](PATH);var _0x405b9b=path[_0x3fb5('0x1c')](PATH,'.csv');var _0x4a3f75=_0x151d3b[_0x3fb5('0xe')]&&_0x4fbeb7['length']>0x1;var _0x5ce569=[];if(!fs[_0x3fb5('0x1d')](path[_0x3fb5('0x1e')](_0xed8c44,_0x405b9b))&&_0x4a3f75){fs[_0x3fb5('0x1f')](path[_0x3fb5('0x1e')](_0xed8c44,_0x405b9b));}return BPromise[_0x3fb5('0x20')](_0x4fbeb7,function(_0x336fc1){_0x5ce569[_0x3fb5('0x1a')](_0x336fc1);})[_0x3fb5('0x10')](function(){for(var _0x39ac8d=0x0;_0x39ac8d<_0x5ce569[_0x3fb5('0x15')];_0x39ac8d+=0x1){var _0x3b5a16;var _0x2e4df8=_0x5ce569[_0x39ac8d];if(_0x4a3f75){_0x3b5a16=path['join'](_0xed8c44,_0x405b9b,util['format'](_0x3fb5('0x21'),_0x405b9b,_0x39ac8d,_0x3fb5('0x22')));}else{_0x3b5a16=path['join'](_0xed8c44,util[_0x3fb5('0xb')]('%s.%s',_0x405b9b,_0x3fb5('0x22')));}fs['writeFileSync'](_0x3b5a16,csv(_0x2e4df8));}})['then'](function(){if(_0x4a3f75){return new Promise(function(_0x451240){zipdir(path['join'](_0xed8c44,_0x405b9b),{'saveTo':path[_0x3fb5('0x1e')](_0xed8c44,util[_0x3fb5('0xb')](_0x3fb5('0x23'),_0x405b9b,'zip'))},function(_0x5d9da9,_0x3abdd7){rimraf(path[_0x3fb5('0x1e')](_0xed8c44,_0x405b9b),function(){});_0x451240(_0x3fb5('0x24'));});});}})[_0x3fb5('0x10')](function(){logger[_0x3fb5('0xa')](util[_0x3fb5('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3fb5('0xc')));return analyticExtractedReport('Completed',_0x4a3f75?util[_0x3fb5('0xb')](_0x3fb5('0x23'),_0x405b9b,_0x4a3f75?_0x3fb5('0x25'):'csv'):null);});})[_0x3fb5('0x26')](function(_0xe15701){logger[_0x3fb5('0xa')](util[_0x3fb5('0xb')](_0x3fb5('0x27'),EXTRACTED_REPORT_ID,_0x3fb5('0xc')),util[_0x3fb5('0x28')](_0xe15701,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3fb5('0x29'));})['finally'](function(){process[_0x3fb5('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3970b7e..7901279 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 _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 +var _0x2380=['%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','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','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','error','end','createPdfFromHTML','path','lodash','moment','zip-dir','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','pageBreak','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','split','then','splitSizePdf','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all'];(function(_0x220bc4,_0x2b0008){var _0x3f41ad=function(_0x5f57b6){while(--_0x5f57b6){_0x220bc4['push'](_0x220bc4['shift']());}};_0x3f41ad(++_0x2b0008);}(_0x2380,0xce));var _0x0238=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2380[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x0238('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x0238('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x0238('0x2'));var rimraf=require('rimraf');var JSDOM=require(_0x0238('0x3'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x0238('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0238('0x5'))[_0x0238('0x6')];var logger=require(_0x0238('0x7'))(_0x0238('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0238('0x9')][0x3];var PATH=process[_0x0238('0x9')][0x4];var NAME=process[_0x0238('0x9')][0x5];var FORMAT=_0x0238('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xb78593,_0x11c708){var _0x383a37={'status':_0xb78593};var _0x53f8f3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11c708){_0x383a37[_0x0238('0xb')]=_0x11c708;}return db[_0x0238('0xc')][_0x0238('0xd')](_0x383a37,_0x53f8f3);}function getHeaders(_0x15fc29){return _[_0x0238('0xe')](_0x15fc29,function(_0x2d26f2){return{'text':_0x2d26f2,'style':_0x0238('0xf')};});}function getRows(_0x36dabf,_0x2cc9e3){return _[_0x0238('0xe')](_0x2cc9e3,function(_0x3950f5){return _(_0x3950f5)[_0x0238('0x10')](_0x36dabf)[_0x0238('0xe')](function(_0x256733){return _0x256733?_[_0x0238('0x11')](_0x256733):'';})[_0x0238('0x12')]();});}function createTable(_0x2ef300,_0x329842){var _0x1b977a={'widths':_[_0x0238('0x13')](Array(_0x2ef300['length']),0x91),'heights':function(_0x43471c){return _0x43471c===0x0?_0x0238('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xa19e2=getHeaders(_0x2ef300);_0x1b977a[_0x0238('0x15')][_0x0238('0x16')](_0xa19e2);var _0x3b8042=getRows(_0x2ef300,_0x329842);_0x1b977a['body']=_0x1b977a['body'][_0x0238('0x17')](_0x3b8042);return _0x1b977a;}function createTables(_0x4eca6c){var _0x4b82d5=[];var _0xee8e46=_[_0x0238('0x18')](Object[_0x0238('0x19')](_0x4eca6c[0x0]),0x5);_0xee8e46['forEach'](function(_0x4f6532){_0x4b82d5['push'](createTable(_0x4f6532,_0x4eca6c));});return _0x4b82d5;}function getPDFDocDefinition(_0xb9d01a){var _0x45a6dd=util[_0x0238('0x1a')](_0x0238('0x1b'),NAME,EXTRACTED_REPORT[_0x0238('0x1c')],moment(EXTRACTED_REPORT[_0x0238('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x0238('0x1a')](FORMAT));var _0x551d40=[];for(var _0x509b33=0x0;_0x509b33<_0xb9d01a[_0x0238('0x1e')];_0x509b33++){var _0x58bc6f=[];if(_0x509b33===0x0){_0x58bc6f[_0x0238('0x16')]({'text':_0x45a6dd,'style':'header'});}var _0x12ae58={'table':_0xb9d01a[_0x509b33]};if(_0x509b33>0x0){_0x12ae58[_0x0238('0x1f')]='before';_0x12ae58['margin']=[0x0,0x46,0x0,0x0];}_0x58bc6f['push'](_0x12ae58);_0x551d40[_0x0238('0x16')](_0x58bc6f);}return{'pageSize':'A4','pageOrientation':_0x0238('0x20'),'content':_0x551d40,'footer':function(_0x1178c7,_0x21e69a){return{'text':_0x1178c7[_0x0238('0x11')]()+_0x0238('0x21')+_0x21e69a,'style':_0x0238('0x22')};},'defaultStyle':{'font':_0x0238('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x0238('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x71dcf7){var _0x2aa6c0=0x1388;var _0x4917fa;if(!_0x71dcf7[0x0][_0x0238('0x25')]){return analyticExtractedReport(_0x0238('0x26'));}return db[_0x0238('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0238('0x28'),'splitSizePdf']})[_0x0238('0x29')](function(_0x52208c){if(_0x52208c){_0x4917fa=_0x52208c;_0x2aa6c0=_0x4917fa[_0x0238('0x2a')]||0x3e8;}})[_0x0238('0x29')](function(){var _0x3e88cc=[];var _0x334fac=0x0;if(_0x4917fa[_0x0238('0x28')]){if(_0x71dcf7&&_0x71dcf7['length']){var _0x59942d=_[_0x0238('0x2b')](_0x71dcf7[0x0][_0x0238('0x25')]/_0x2aa6c0);var _0x290485=Number[_0x0238('0x2c')](_0x71dcf7[0x0][_0x0238('0x25')]/_0x2aa6c0)?_0x71dcf7[0x0][_0x0238('0x25')]%_0x2aa6c0:0x0;_0x59942d[_0x0238('0x2d')](function(_0x592eac){if(_0x592eac>0x0){_0x334fac+=_0x2aa6c0;}_0x3e88cc['push'](dbH['sequelize'][_0x0238('0x2e')](util['format'](_0x0238('0x2f'),QUERY,_0x2aa6c0,_0x334fac),{'type':dbH[_0x0238('0x30')]['QueryTypes'][_0x0238('0x31')]}));});if(_0x290485>0x0){_0x334fac+=_0x2aa6c0;_0x3e88cc['push'](dbH['sequelize'][_0x0238('0x2e')](util['format'](_0x0238('0x2f'),QUERY,_0x290485,_0x334fac),{'type':dbH[_0x0238('0x30')]['QueryTypes'][_0x0238('0x31')]}));}}}else{_0x3e88cc[_0x0238('0x16')](dbH[_0x0238('0x30')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x0238('0x31')]}));}var _0x138de1=path[_0x0238('0x32')](PATH);var _0x51be9a=path[_0x0238('0x33')](PATH,_0x0238('0x34'));var _0x4e4f0c=_0x4917fa['split']&&_0x3e88cc[_0x0238('0x1e')]>0x1;var _0x103977=[];if(!fs[_0x0238('0x35')](path[_0x0238('0x36')](_0x138de1,_0x51be9a))&&_0x4e4f0c){fs['mkdirSync'](path['join'](_0x138de1,_0x51be9a));}return BPromise[_0x0238('0x37')](_0x3e88cc,function(_0x56e740){_0x103977[_0x0238('0x16')](_0x56e740);})[_0x0238('0x29')](function(){var _0x25647b=[];for(var _0x565093=0x0;_0x565093<_0x103977['length'];_0x565093+=0x1){var _0x412c69=_0x103977[_0x565093];var _0x1a8f2e=createTables(_[_0x0238('0x38')](_0x412c69));var _0x413772;var _0x13c2c0=getPDFDocDefinition(_0x1a8f2e);var _0x1efe52=getPDFPrinter();var _0x287fae=_0x1efe52[_0x0238('0x39')](_0x13c2c0);if(_0x4e4f0c){_0x413772=path['join'](_0x138de1,_0x51be9a,util[_0x0238('0x1a')](_0x0238('0x3a'),_0x51be9a,_0x565093,_0x0238('0x3b')));}else{_0x413772=path['join'](_0x138de1,util[_0x0238('0x1a')]('%s.%s',_0x51be9a,_0x0238('0x3b')));}_0x25647b[_0x0238('0x16')](writePDFDocument(_0x287fae,_0x413772));}return Promise[_0x0238('0x3c')](_0x25647b);})['then'](function(){if(_0x4e4f0c){return new Promise(function(_0x398a4e){zipdir(path[_0x0238('0x36')](_0x138de1,_0x51be9a),{'saveTo':path[_0x0238('0x36')](_0x138de1,util[_0x0238('0x1a')](_0x0238('0x3d'),_0x51be9a,_0x0238('0x3e')))},function(){rimraf(path[_0x0238('0x36')](_0x138de1,_0x51be9a),function(){});_0x398a4e(_0x0238('0x3f'));});});}})[_0x0238('0x29')](function(){if(!_0x4e4f0c)return;rimraf(path[_0x0238('0x36')](_0x138de1,_0x51be9a),function(){});})['then'](function(){logger[_0x0238('0x40')](util[_0x0238('0x1a')](_0x0238('0x41'),EXTRACTED_REPORT_ID,_0x0238('0x42')));return analyticExtractedReport(_0x0238('0x43'),_0x4e4f0c?util[_0x0238('0x1a')](_0x0238('0x3d'),_0x51be9a,_0x4e4f0c?_0x0238('0x3e'):_0x0238('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x0238('0x40')](util[_0x0238('0x1a')](_0x0238('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x0238('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0238('0x29')](function(_0x44a345){EXTRACTED_REPORT=_0x44a345;return dbH[_0x0238('0x30')][_0x0238('0x2e')](util[_0x0238('0x1a')](_0x0238('0x45'),QUERY),{'type':dbH[_0x0238('0x30')]['QueryTypes'][_0x0238('0x31')]});})[_0x0238('0x29')](extractReport)[_0x0238('0x46')](function(_0xea47cc){logger[_0x0238('0x40')](util['format'](_0x0238('0x47'),EXTRACTED_REPORT_ID,'PDF'),util[_0x0238('0x48')](_0xea47cc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0238('0x49'));})['finally'](function(){process[_0x0238('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x44c880=new PdfPrinter({'Arial':{'normal':__dirname+_0x0238('0x4b'),'bold':__dirname+_0x0238('0x4c'),'italics':__dirname+_0x0238('0x4d'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x44c880;}function getPDFDocDefinitionFromHTML(_0x3f2e8b,_0x4c96b2){var _0x5cf2d4=util[_0x0238('0x1a')](_0x0238('0x4e'),_0x4c96b2[_0x0238('0x4f')],_0x4c96b2[_0x0238('0x50')]);var _0x4b3967=moment()['format'](_0x0238('0x51'))[_0x0238('0x11')]();var _0x506cfc=htmlToPdfmake(_0x3f2e8b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x506cfc],'defaultStyle':{'font':_0x0238('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x0238('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x0238('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0238('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x10443f,_0x55b9d7){return[{'text':util[_0x0238('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5cf2d4,_0x10443f,_0x55b9d7,_0x4b3967),'style':_0x0238('0x22')}];}};}function writePDFDocument(_0xff4d46,_0x11e3b4){return new Promise(function(_0x2468ff,_0x3a3ef5){var _0x4fbc91=_0xff4d46[_0x0238('0x53')](fs[_0x0238('0x54')](_0x11e3b4));_0x4fbc91['on']('finish',function(){_0x2468ff('finish');});_0x4fbc91['on'](_0x0238('0x55'),function(_0x3effe5){_0x3a3ef5(_0x3effe5);});_0xff4d46[_0x0238('0x56')]();});}exports[_0x0238('0x57')]=function(_0x1ae4e0,_0x58d96b){var _0xcd8ba1=getPDFPrinter();var _0x5c8e13=getPDFDocDefinitionFromHTML(_0x1ae4e0,_0x58d96b);var _0x543cbf=_0xcd8ba1[_0x0238('0x39')](_0x5c8e13);return writePDFDocument(_0x543cbf,_0x58d96b[_0x0238('0x58')])['catch'](function(_0x5d0aed){throw _0x5d0aed;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index cd2c6e2..c17af57 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 _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 +var _0xfaa6=['../../mysqldb','dbH','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','binary','XLSX','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xfaa6,0xbd));var _0x6faa=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xfaa6[_0x469ac7];return _0x22f3b0;};'use strict';var util=require(_0x6faa('0x0'));var path=require(_0x6faa('0x1'));var _=require(_0x6faa('0x2'));var fs=require('fs');var json2xls=require(_0x6faa('0x3'));var BPromise=require(_0x6faa('0x4'));var zipdir=require(_0x6faa('0x5'));var rimraf=require(_0x6faa('0x6'));var db=require(_0x6faa('0x7'))['db'];var dbH=require(_0x6faa('0x7'))[_0x6faa('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6faa('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6faa('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x325fc7,_0x27195c){var _0x874022={'status':_0x325fc7};var _0x23311b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27195c){_0x874022['savename']=_0x27195c;}return db[_0x6faa('0xa')][_0x6faa('0xb')](_0x874022,_0x23311b);}function main(){var _0x3af018=0x1388;var _0x31fc9a;logger[_0x6faa('0xc')](util[_0x6faa('0xd')](_0x6faa('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x6faa('0xf')][_0x6faa('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6faa('0x11'),'splitSizeXlsx']})[_0x6faa('0x12')](function(_0x2d06c1){if(_0x2d06c1){_0x31fc9a=_0x2d06c1;_0x3af018=_0x31fc9a[_0x6faa('0x13')]||0x1388;}})[_0x6faa('0x12')](function(){return dbH[_0x6faa('0x14')][_0x6faa('0x15')](util[_0x6faa('0xd')](_0x6faa('0x16'),QUERY),{'type':dbH[_0x6faa('0x14')]['QueryTypes']['SELECT']});})[_0x6faa('0x12')](function(_0xe102e8){if(!_0xe102e8[0x0][_0x6faa('0x17')]){return analyticExtractedReport(_0x6faa('0x18'));}var _0x38b5f9=[];var _0x38f4dd=0x0;if(_0x31fc9a[_0x6faa('0x11')]){if(_0xe102e8&&_0xe102e8['length']){var _0x59c342=_['range'](_0xe102e8[0x0]['num']/_0x3af018);var _0x4b9320=Number[_0x6faa('0x19')](_0xe102e8[0x0][_0x6faa('0x17')]/_0x3af018)?_0xe102e8[0x0][_0x6faa('0x17')]%_0x3af018:0x0;_0x59c342['forEach'](function(_0x24b19f){if(_0x24b19f>0x0){_0x38f4dd+=_0x3af018;}_0x38b5f9[_0x6faa('0x1a')](dbH[_0x6faa('0x14')]['query'](util['format'](_0x6faa('0x1b'),QUERY,_0x3af018,_0x38f4dd),{'type':dbH[_0x6faa('0x14')][_0x6faa('0x1c')][_0x6faa('0x1d')]}));});if(_0x4b9320>0x0){_0x38f4dd+=_0x3af018;_0x38b5f9[_0x6faa('0x1a')](dbH[_0x6faa('0x14')][_0x6faa('0x15')](util[_0x6faa('0xd')](_0x6faa('0x1b'),QUERY,_0x4b9320,_0x38f4dd),{'type':dbH[_0x6faa('0x14')][_0x6faa('0x1c')][_0x6faa('0x1d')]}));}}}else{_0x38b5f9[_0x6faa('0x1a')](dbH[_0x6faa('0x14')][_0x6faa('0x15')](QUERY,{'type':dbH[_0x6faa('0x14')][_0x6faa('0x1c')][_0x6faa('0x1d')]}));}var _0x3b0fae=path[_0x6faa('0x1e')](PATH);var _0x22965f=path[_0x6faa('0x1f')](PATH,_0x6faa('0x20'));var _0x2c6687=_0x31fc9a['split']&&_0x38b5f9[_0x6faa('0x21')]>0x1;var _0x48aad8=[];if(!fs[_0x6faa('0x22')](path[_0x6faa('0x23')](_0x3b0fae,_0x22965f))&&_0x2c6687){fs[_0x6faa('0x24')](path[_0x6faa('0x23')](_0x3b0fae,_0x22965f));}return BPromise[_0x6faa('0x25')](_0x38b5f9,function(_0x4c2e2c){_0x48aad8['push'](_0x4c2e2c);})[_0x6faa('0x12')](function(){for(var _0xf20193=0x0;_0xf20193<_0x48aad8[_0x6faa('0x21')];_0xf20193+=0x1){var _0x2cf427;var _0x19f768=_0x48aad8[_0xf20193];if(_0x2c6687){_0x2cf427=path[_0x6faa('0x23')](_0x3b0fae,_0x22965f,util[_0x6faa('0xd')](_0x6faa('0x26'),_0x22965f,_0xf20193,'xlsx'));}else{_0x2cf427=path[_0x6faa('0x23')](_0x3b0fae,util[_0x6faa('0xd')](_0x6faa('0x27'),_0x22965f,'xlsx'));}fs[_0x6faa('0x28')](_0x2cf427,json2xls(_0x19f768),_0x6faa('0x29'));}})[_0x6faa('0x12')](function(){if(_0x2c6687){return new Promise(function(_0x255caa){zipdir(path[_0x6faa('0x23')](_0x3b0fae,_0x22965f),{'saveTo':path[_0x6faa('0x23')](_0x3b0fae,util[_0x6faa('0xd')](_0x6faa('0x27'),_0x22965f,'zip'))},function(_0x1b7778,_0x1b740e){rimraf(path[_0x6faa('0x23')](_0x3b0fae,_0x22965f),function(){});_0x255caa('zip\x20finished');});});}})[_0x6faa('0x12')](function(){logger[_0x6faa('0xc')](util[_0x6faa('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6faa('0x2a')));return analyticExtractedReport('Completed',_0x2c6687?util[_0x6faa('0xd')](_0x6faa('0x27'),_0x22965f,_0x2c6687?'zip':_0x6faa('0x2b')):null);});})['catch'](function(_0x34e20c){logger[_0x6faa('0xc')](util[_0x6faa('0xd')](_0x6faa('0x2c'),EXTRACTED_REPORT_ID,_0x6faa('0x2a')),util[_0x6faa('0x2d')](_0x34e20c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6faa('0x2e'));})[_0x6faa('0x2f')](function(){process[_0x6faa('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ee39009..0c109b0 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 _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 +var _0x422c=['custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','filter','intervals','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x422c,0xa0));var _0xc422=function(_0x1ded7e,_0x3ef2b0){_0x1ded7e=_0x1ded7e-0x0;var _0x4b3b7e=_0x422c[_0x1ded7e];return _0x4b3b7e;};'use strict';var _=require(_0xc422('0x0'));var util=require(_0xc422('0x1'));function rewrite(_0x125065,_0x14d9b1){var _0xa4b705=this;return _0x125065[_0xc422('0x2')][_0xc422('0x3')][_0xc422('0x4')]({'raw':!![]})[_0xc422('0x5')](function(_0x42ea0b){_0xa4b705['intervals']=_0x42ea0b;return _0x125065[_0xc422('0x2')][_0xc422('0x6')]['findAll']({'where':{'IntervalId':_0x14d9b1[_0xc422('0x7')]},'raw':!![]});})[_0xc422('0x5')](function(_0x5320bf){return _0x125065[_0xc422('0x2')][_0xc422('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xc422('0x8')](_0x5320bf,_0xc422('0x9')))}},'order':[{'raw':_0xc422('0xa')}],'raw':!![]});})[_0xc422('0x5')](function(_0x31abd4){var _0x12dca0=_['filter'](_0x31abd4,{'priority':'1'});var _0x2c5ba6=_['filter'](_0x31abd4,{'isApp':0x1});var _0x3fd1b6=_[_0xc422('0xb')](_0x2c5ba6,_0xc422('0x9'));var _0x2c7a3b=[_0xc422('0xc'),_0xc422('0xd')];var _0x39835e=[];var _0x56b095=[];for(var _0x221ef5 in _0x3fd1b6){if(_0x3fd1b6[_0xc422('0xe')](_0x221ef5)){_0xa4b705[_0xc422('0xf')]=0x2;_0xa4b705['extensions']=[];_0xa4b705[_0xc422('0x10')]=_[_0xc422('0x11')](_0x12dca0,{'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')]});_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0]['type'],'app':_0xc422('0x14'),'appdata':util[_0xc422('0x15')](_0xc422('0x16'),_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')]),'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});if(_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')]===_0xc422('0x1a')){_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Set','appdata':'CDR(routeid)='+_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')],'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}else if(_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')]==='outbound'){if(_0xa4b705['extension']){_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x1b')+(_0xa4b705[_0xc422('0x10')][_0xc422('0x1c')]?_0xc422('0x1d')+_0xa4b705[_0xc422('0x10')][_0xc422('0x1c')]+'}':'${EXTEN}'),'context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Set','appdata':_0xc422('0x1e')+_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')],'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});var _0x292d5a=_0xa4b705['priority']++;_0xa4b705[_0xc422('0x12')]['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x20')+(_0x292d5a+0x2)+_0xc422('0x21')+(_0x292d5a+0x1)+')','context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0x292d5a,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});if(_0xa4b705['extension']){_0xa4b705[_0xc422('0x12')]['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xa4b705[_0xc422('0x10')]['cutdigits']?_0xc422('0x22')+_0xa4b705[_0xc422('0x10')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705['priority']++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0]['VoiceExtensionId']});}_0xa4b705[_0xc422('0x12')]['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x23')+_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')],'context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0]['exten'],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});if(_0xa4b705[_0xc422('0x10')]&&_0xa4b705[_0xc422('0x10')][_0xc422('0xe')](_0xc422('0x24'))&&_0xa4b705[_0xc422('0x10')]['recordingFormat']!==_0xc422('0x25')){_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705['priority']++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0]['type'],'app':_0xc422('0x14'),'appdata':_0xc422('0x26')+_0xa4b705[_0xc422('0x10')][_0xc422('0x24')]||_0xc422('0x27'),'context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}}_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x28'),'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0]['exten'],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0xa4b705['extensions']['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Set','appdata':_0xc422('0x29'),'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705['priority']++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0]['VoiceExtensionId']});for(var _0x349c19=0x0,_0x17f76e=0x0;_0x349c19<_0x3fd1b6[_0x221ef5][_0xc422('0x2a')];_0x349c19+=0x1,_0x17f76e=0x0){var _0xe9f8b1=_0x3fd1b6[_0x221ef5][_0x349c19];if(_0xe9f8b1[_0xc422('0x17')]){_0xe9f8b1['type']=_0xe9f8b1[_0xc422('0x17')][_0xc422('0x2b')]();}var _0x1276c2=[];var _0x459e78=[];delete _0xe9f8b1['id'];delete _0xe9f8b1[_0xc422('0x2c')];delete _0xe9f8b1[_0xc422('0x2d')];var _0x37bfa8=_0xe9f8b1['interval']!==_0xc422('0x2e')?[_0xe9f8b1[_0xc422('0x2f')]]:_0xe9f8b1[_0xc422('0x7')]?_['map'](_[_0xc422('0x30')](_0xa4b705[_0xc422('0x31')],{'IntervalId':_0xe9f8b1[_0xc422('0x7')]}),'interval'):[];if(_0xe9f8b1[_0xc422('0xe')]('tag')){if(_0xe9f8b1[_0xc422('0x32')]&&_0xe9f8b1['tag']!=='--'){_0x1276c2['push']({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x33')+_0xe9f8b1[_0xc422('0x32')],'context':_0xe9f8b1['context'],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705['priority']+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}}if(_0xe9f8b1[_0xc422('0x17')]===_0xc422('0x34')&&_0xe9f8b1[_0xc422('0xe')]('callerID')){if(_0xe9f8b1[_0xc422('0x35')]){_0x1276c2['push']({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x36')+_0xe9f8b1[_0xc422('0x35')]+')','context':_0xe9f8b1['context'],'exten':_0xe9f8b1['exten'],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}else{_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x37'),'context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1['exten'],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}}if(_0xe9f8b1[_0xc422('0xe')](_0xc422('0x38'))){if(_0x2c7a3b[_0xc422('0x39')](_0xe9f8b1['app'][_0xc422('0x2b')]())>=0x0&&_0xe9f8b1[_0xc422('0x3a')]!==_0xc422('0x3b')){if(_0xe9f8b1[_0xc422('0x38')]){_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1['type'],'app':'ExecIf','appdata':_0xc422('0x3c'),'context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1['VoiceExtensionId']});}else{_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x3d'),'context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});_0x1276c2['push']({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xe9f8b1['context'],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705['priority']+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}}}for(var _0x173259=0x0;_0x173259<_0x37bfa8[_0xc422('0x2a')];_0x173259+=0x1){var _0x4cea26=_0xa4b705[_0xc422('0xf')]+_0x37bfa8[_0xc422('0x2a')];var _0x2089ad=_0x173259===_0x37bfa8['length']-0x1?_0xa4b705['priority']+_0x1276c2['length']+_0x459e78[_0xc422('0x2a')]+0x2:_0xa4b705[_0xc422('0xf')]+_0x173259+0x1;_0x1276c2[_0xc422('0x3e')](_0x173259,0x0,{'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x3f'),'appdata':_0x37bfa8[_0x173259]+'?'+_0xe9f8b1['context']+_0xc422('0x40')+_0x4cea26+':'+_0xe9f8b1[_0xc422('0x18')]+',${EXTEN},'+_0x2089ad,'exten':_0xe9f8b1['exten'],'context':_0xe9f8b1[_0xc422('0x18')],'priority':_0xa4b705[_0xc422('0xf')]+_0x173259,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}_0xe9f8b1[_0xc422('0xf')]=_0x1276c2[_0xc422('0x2a')]?_[_0xc422('0x41')](_0x1276c2)[_0xc422('0xf')]+0x1:_0xa4b705['priority'];_0xa4b705[_0xc422('0xf')]=(_0x459e78[_0xc422('0x2a')]?_[_0xc422('0x41')](_0x459e78)[_0xc422('0xf')]:_0xe9f8b1[_0xc422('0xf')])+0x1;_0xa4b705[_0xc422('0x12')]=_[_0xc422('0x42')](_0xa4b705[_0xc422('0x12')],_0x1276c2,[_0xe9f8b1],_0x459e78);}_0xa4b705['extensions'][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Hangup','exten':_0x3fd1b6[_0x221ef5][0x0]['exten'],'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'priority':_0xa4b705[_0xc422('0xf')],'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0x39835e[_0xc422('0x13')](_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]);_0x56b095=_[_0xc422('0x42')](_0x56b095,_0xa4b705['extensions']);}}return _0x125065[_0xc422('0x43')](function(_0xe100fb){return _0x125065['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x39835e}},'transaction':_0xe100fb})[_0xc422('0x5')](function(_0x25762d){return _0x125065[_0xc422('0x2')]['VoiceExtension'][_0xc422('0x44')](_[_0xc422('0x45')](_0x56b095,'priority'),{'transaction':_0xe100fb});});});})[_0xc422('0x46')](function(_0x35a7bd){console[_0xc422('0x47')](_0x35a7bd);});}exports[_0xc422('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 00c4b48..8439813 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 _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 +var _0x3409=['cm_hopper','phone','scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','calleridnum','id\x20IN\x20?','cm_hopper_black','fromQuery','str','findAll','dialCheckDuplicateType','CmList','Lists','get','sequelize','VoiceQueueId','query','all','VoiceQueue','outbound','BlackLists','Campaign','always','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','into'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x3409,0x1f1));var _0x9340=function(_0x1086ea,_0x35841d){_0x1086ea=_0x1086ea-0x0;var _0x4d617a=_0x3409[_0x1086ea];return _0x4d617a;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x9340('0x0'));var Papa=require(_0x9340('0x1'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x9340('0x2'));var logger=require(_0x9340('0x3'))(_0x9340('0x4'));config[_0x9340('0x5')]=_[_0x9340('0x6')](config[_0x9340('0x5')],{'host':_0x9340('0x7'),'port':0x18eb});var socket=require(_0x9340('0x8'))(new Redis(config[_0x9340('0x5')]));require(_0x9340('0x9'))[_0x9340('0xa')](socket);try{if(!process[_0x9340('0xb')][0x2]||process[_0x9340('0xb')][0x2]==='undefined'||process[_0x9340('0xb')][0x2]===_0x9340('0xc')){throw new Error(_0x9340('0xd'));}var FILEPATH=process[_0x9340('0xb')][0x2];if(!process[_0x9340('0xb')][0x3]||process['argv'][0x3]==='undefined'||process[_0x9340('0xb')][0x3]===_0x9340('0xc')||!process[_0x9340('0xb')][0x4]||process[_0x9340('0xb')][0x4]===_0x9340('0xe')||process[_0x9340('0xb')][0x4]===_0x9340('0xc')){throw new Error(_0x9340('0xf'));}var FIELDS=_[_0x9340('0x10')](process[_0x9340('0xb')][0x3][_0x9340('0x11')](','),process['argv'][0x4]['split'](','));if(!process[_0x9340('0xb')][0x5]||process['argv'][0x5]===_0x9340('0xe')||process[_0x9340('0xb')][0x5]===_0x9340('0xc')){throw new Error(_0x9340('0x12'));}var LISTID=process[_0x9340('0xb')][0x5];var COMPANYID=process[_0x9340('0xb')][0x6]&&process['argv'][0x6]!==_0x9340('0xe')&&process['argv'][0x6]!=='null'?process[_0x9340('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x9340('0xb')][0x7]!==_0x9340('0xe')&&process['argv'][0x7]!==_0x9340('0xc')?process['argv'][0x7]:null;if(!process[_0x9340('0xb')][0x8]||process[_0x9340('0xb')][0x8]===_0x9340('0xe')||process[_0x9340('0xb')][0x8]===_0x9340('0xc')){throw new Error(_0x9340('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x451173){logger['error'](_0x451173);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(_0x57bcfe,_0x384500,_0x22a9a9,_0x4bbe54){var _0x463d54={'message':_0x384500};_0x463d54[_0x57bcfe]=!![];if(_0x22a9a9){_0x463d54['contact']=_0x22a9a9;}if(_0x4bbe54){_0x463d54[_0x9340('0x14')]=_0x4bbe54;}return _0x463d54;}function isEmail(_0x2f8b3a){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))*$/[_0x9340('0x15')](_0x2f8b3a);}function checkRow(_0x50ca8c,_0x1fb502,_0xe36545){return new BPromise(function(_0x51d03c,_0x2f485b){if(_[_0x9340('0x16')](_0x50ca8c)){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x9340('0x18'),null,_0xe36545));}if(_0x50ca8c[_0x9340('0x19')]&&_0x50ca8c[_0x9340('0x19')]['length']){var _0x4cff36=_[_0x9340('0x1a')](_0x50ca8c[_0x9340('0x19')],_0x9340('0x1b'))[_0x9340('0x1c')](';');return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x4cff36,null,_0xe36545));}var _0xae827b={};for(var _0x372f89 in FIELDS){if(FIELDS[_0x9340('0x1d')](_0x372f89)&&FIELDS[_0x372f89]){_0xae827b[_0x372f89]=_0x50ca8c[_0x9340('0x1e')][0x0][FIELDS[_0x372f89]]||_0x50ca8c[_0x9340('0x1e')][0x0]['\ufeff'+FIELDS[_0x372f89]];}}if(!_0xae827b[_0x9340('0x1f')]){return _0x2f485b(handleCheckRowError('error',_0x9340('0x20'),null,_0xe36545));}if(!_0xae827b['phone']){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x9340('0x21'),null,_0xe36545));}if(_0xae827b['birthDate']){var _0x1f50a0=moment(_0xae827b['birthDate'],_0x9340('0x22'));if(!_0x1f50a0['isValid']()){return _0x2f485b(handleCheckRowError('error',_0x9340('0x23'),null,_0xe36545));}}if(_0xae827b[_0x9340('0x24')]){if(!isEmail(_0xae827b[_0x9340('0x24')])){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0xe36545));}}_0xae827b[_0x9340('0x25')]=LISTID;_0xae827b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9340('0x26')]&&_0x1fb502){var _0x1a0fef={};for(var _0x2fbd4c=0x0,_0x34ad97=DUPLICATES['length'];_0x2fbd4c<_0x34ad97;_0x2fbd4c+=0x1){_0x1a0fef[DUPLICATES[_0x2fbd4c]]=_0xae827b[DUPLICATES[_0x2fbd4c]];}var _0x4a9694=_[_0x9340('0x27')](_0x1fb502,_0x1a0fef);if(_0x4a9694){return _0x2f485b(handleCheckRowError(_0x9340('0x28'),_0x9340('0x29'),_0x4a9694,_0xe36545));}}return db[_0x9340('0x2a')][_0x9340('0x2b')](_0xae827b,{'raw':!![],'hooks':![],'fields':_[_0x9340('0x2c')](_0xae827b)})[_0x9340('0x2d')](function(_0x4b5af6){if(DUPLICATES&&DUPLICATES[_0x9340('0x26')]&&_0x1fb502){_0x1fb502[_0x9340('0x2e')](_['pick'](_0xae827b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4b5af6['id'];return _0x51d03c();})[_0x9340('0x2f')](function(_0x34f567){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x9340('0x30')+(_0x34f567[_0x9340('0x1b')]||JSON['stringify'](_0x34f567)),null,_0xe36545));});});}function checkHopper(){function _0x53c95b(){return function(_0x2c2848){logger[_0x9340('0x17')](_0x9340('0x31'),_0x9340('0x32'),util[_0x9340('0x33')](_0x2c2848,{'showHidden':![],'depth':null}));};}var _0x4e82ee=function(_0x29c50b,_0x309270){var _0x5ef8ab=squel['insert']()[_0x9340('0x34')](_0x9340('0x35'))['fromQuery']([_0x9340('0x36'),_0x9340('0x37'),_0x9340('0x38'),_0x9340('0x25'),_0x309270,_0x9340('0x39'),_0x9340('0x3a')],squel[_0x9340('0x3b')]()['field']('phone',_0x9340('0x36'))['field'](_0x9340('0x3c'),_0x9340('0x37'))[_0x9340('0x3d')]('id','ContactId')[_0x9340('0x3d')](LISTID[_0x9340('0x3e')](),_0x9340('0x25'))['field'](_0x29c50b['id'][_0x9340('0x3e')](),_0x309270)[_0x9340('0x3d')](_0x9340('0x3c'),_0x9340('0x39'))[_0x9340('0x3d')]('NOW()',_0x9340('0x3a'))[_0x9340('0x3f')](_0x9340('0x40'))[_0x9340('0x41')](_0x9340('0x42'))[_0x9340('0x41')](_0x9340('0x43'),LISTID['toString']())['where'](_0x9340('0x44'))['where'](_0x9340('0x45'),squel[_0x9340('0x3b')]()[_0x9340('0x3d')]('phone')['from'](_0x9340('0x35'))[_0x9340('0x41')](_0x309270+_0x9340('0x46'),_0x29c50b['id'][_0x9340('0x3e')]())))[_0x9340('0x3e')]();return _0x5ef8ab;};var _0x1779ae=function(_0x1cca0e,_0xd2dfe1){var _0x4148e6=squel[_0x9340('0x47')]()['into']('cm_hopper')['fromQuery']([_0x9340('0x36'),_0x9340('0x37'),_0x9340('0x38'),_0x9340('0x25'),_0xd2dfe1,_0x9340('0x39'),_0x9340('0x3a')],squel[_0x9340('0x3b')]()['field'](_0x9340('0x36'),'phone')[_0x9340('0x3d')]('NOW()',_0x9340('0x37'))[_0x9340('0x3d')]('id',_0x9340('0x38'))[_0x9340('0x3d')](LISTID[_0x9340('0x3e')](),_0x9340('0x25'))[_0x9340('0x3d')](_0x1cca0e['id']['toString'](),_0xd2dfe1)[_0x9340('0x3d')]('NOW()',_0x9340('0x39'))['field']('NOW()',_0x9340('0x3a'))[_0x9340('0x3f')]('cm_contacts')[_0x9340('0x41')](_0x9340('0x42'))[_0x9340('0x41')](_0x9340('0x43'),LISTID[_0x9340('0x3e')]())[_0x9340('0x41')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x9340('0x41')](_0x9340('0x44'))[_0x9340('0x41')](_0x9340('0x45'),squel['select']()[_0x9340('0x3d')](_0x9340('0x48'))[_0x9340('0x3f')]('cm_hopper_final')[_0x9340('0x41')](_0xd2dfe1+_0x9340('0x46'),_0x1cca0e['id']['toString']()))[_0x9340('0x41')](_0x9340('0x45'),squel[_0x9340('0x3b')]()[_0x9340('0x3d')]('phone')['from'](_0x9340('0x35'))[_0x9340('0x41')](_0xd2dfe1+_0x9340('0x46'),_0x1cca0e['id'][_0x9340('0x3e')]())))['toString']();return _0x4148e6;};function _0xf86423(_0x4aa628,_0x3729f8){var _0x3f69f2=squel[_0x9340('0x47')]()[_0x9340('0x34')]('cm_hopper')['fromQuery'](['phone',_0x9340('0x37'),_0x9340('0x38'),_0x9340('0x25'),_0x3729f8,_0x9340('0x39'),'updatedAt'],squel[_0x9340('0x3b')]()[_0x9340('0x3d')](_0x9340('0x36'),_0x9340('0x36'))['field'](_0x9340('0x3c'),_0x9340('0x37'))['field']('id',_0x9340('0x38'))['field'](LISTID[_0x9340('0x3e')](),_0x9340('0x25'))[_0x9340('0x3d')](_0x4aa628['id'][_0x9340('0x3e')](),_0x3729f8)[_0x9340('0x3d')](_0x9340('0x3c'),_0x9340('0x39'))['field']('NOW()',_0x9340('0x3a'))[_0x9340('0x3f')]('cm_contacts')[_0x9340('0x41')](_0x9340('0x42'))[_0x9340('0x41')]('ListId\x20=\x20?',LISTID[_0x9340('0x3e')]())[_0x9340('0x41')](_0x9340('0x49'),squel['str'](hopperContacts))[_0x9340('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x9340('0x3e')]();return _0x3f69f2;}function _0x188c84(_0x2eaee1,_0x290f74){var _0x127c78=squel[_0x9340('0x47')]()[_0x9340('0x34')](_0x9340('0x4a'))[_0x9340('0x4b')]([_0x9340('0x36'),_0x9340('0x38'),_0x9340('0x25'),_0x290f74,'createdAt',_0x9340('0x3a')],squel[_0x9340('0x3b')]()['field'](_0x9340('0x36'),_0x9340('0x36'))[_0x9340('0x3d')]('id','ContactId')[_0x9340('0x3d')](LISTID[_0x9340('0x3e')](),'ListId')[_0x9340('0x3d')](_0x2eaee1['id'][_0x9340('0x3e')](),_0x290f74)[_0x9340('0x3d')](_0x9340('0x3c'),_0x9340('0x39'))[_0x9340('0x3d')](_0x9340('0x3c'),'updatedAt')['from']('cm_contacts')['where'](_0x9340('0x42'))[_0x9340('0x41')](_0x9340('0x43'),LISTID[_0x9340('0x3e')]())[_0x9340('0x41')](_0x9340('0x49'),squel[_0x9340('0x4c')](hopperContacts))[_0x9340('0x41')](_0x9340('0x44')))[_0x9340('0x3e')]();return _0x127c78;}return db['VoiceQueue'][_0x9340('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x9340('0x4e')],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x50'),'where':{'id':LISTID}}]})[_0x9340('0x2d')](function(_0xbe23dd){var _0x56a7ba=[];if(_0xbe23dd){var _0x42060d;for(var _0x5935b3=0x0,_0x6162fc;_0x5935b3<_0xbe23dd[_0x9340('0x26')];_0x5935b3+=0x1){_0x6162fc=_0xbe23dd[_0x5935b3][_0x9340('0x51')]({'plain':!![]});switch(_0x6162fc['dialCheckDuplicateType']){case'always':_0x56a7ba[_0x9340('0x2e')](db[_0x9340('0x52')]['query'](_0x1779ae(_0x6162fc,_0x9340('0x53')))[_0x9340('0x2d')](function(){})[_0x9340('0x2f')](_0x53c95b()));break;case'onlyIfOpen':_0x56a7ba[_0x9340('0x2e')](db[_0x9340('0x52')]['query'](_0x4e82ee(_0x6162fc,_0x9340('0x53')))['then'](function(){})['catch'](_0x53c95b()));break;default:_0x56a7ba[_0x9340('0x2e')](db['sequelize'][_0x9340('0x54')](_0xf86423(_0x6162fc,_0x9340('0x53')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));}}}return _0x56a7ba;})[_0x9340('0x55')]()[_0x9340('0x2d')](function(){return db[_0x9340('0x56')][_0x9340('0x4d')]({'where':{'type':_0x9340('0x57')},'attributes':['id'],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x22d739){var _0x4d3ad1=[];if(_0x22d739){var _0x318255;for(var _0x4e842e=0x0,_0x21219e;_0x4e842e<_0x22d739[_0x9340('0x26')];_0x4e842e+=0x1){_0x21219e=_0x22d739[_0x4e842e][_0x9340('0x51')]({'plain':!![]});_0x4d3ad1[_0x9340('0x2e')](db[_0x9340('0x52')][_0x9340('0x54')](_0x188c84(_0x21219e,'VoiceQueueId'))[_0x9340('0x2d')](function(){})[_0x9340('0x2f')](_0x53c95b()));}}return _0x4d3ad1;})[_0x9340('0x55')]();})['then'](function(){return db[_0x9340('0x59')]['findAll']({'attributes':['id',_0x9340('0x4e')],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x50'),'where':{'id':LISTID}}]})[_0x9340('0x2d')](function(_0x18cedc){var _0x426903=[];if(_0x18cedc){for(var _0x89b151=0x0,_0x3c7fec;_0x89b151<_0x18cedc[_0x9340('0x26')];_0x89b151+=0x1){_0x3c7fec=_0x18cedc[_0x89b151][_0x9340('0x51')]({'plain':!![]});switch(_0x3c7fec[_0x9340('0x4e')]){case _0x9340('0x5a'):_0x426903['push'](db[_0x9340('0x52')]['query'](_0x1779ae(_0x3c7fec,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})[_0x9340('0x2f')](_0x53c95b()));break;case _0x9340('0x5c'):_0x426903['push'](db[_0x9340('0x52')][_0x9340('0x54')](_0x4e82ee(_0x3c7fec,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));break;default:_0x426903['push'](db['sequelize']['query'](_0xf86423(_0x3c7fec,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));}}}return _0x426903;})[_0x9340('0x55')]();})['then'](function(){return db['Campaign'][_0x9340('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x58'),'where':{'id':LISTID}}]})[_0x9340('0x2d')](function(_0x46cb27){var _0x41e587=[];if(_0x46cb27){for(var _0x358f69=0x0,_0x2bec4c;_0x358f69<_0x46cb27[_0x9340('0x26')];_0x358f69+=0x1){_0x2bec4c=_0x46cb27[_0x358f69]['get']({'plain':!![]});_0x41e587[_0x9340('0x2e')](db[_0x9340('0x52')][_0x9340('0x54')](_0x188c84(_0x2bec4c,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));}}return _0x41e587;})[_0x9340('0x55')]();})[_0x9340('0x2f')](function(_0x18056b){logger[_0x9340('0x17')](_0x9340('0x5d'),_0x9340('0x5e'),_0x18056b['message']);});}var processPromises=function(_0x355720){return BPromise[_0x9340('0x55')](promises)[_0x9340('0x2d')](function(_0x10ef6d){})[_0x9340('0x2f')](function(_0x456692){logger['error'](_0x9340('0x5f'),JSON[_0x9340('0x60')](_0x456692));})[_0x9340('0x61')](function(){socket['emit'](_0x9340('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x355720){return _0x355720[_0x9340('0x63')]();}});};var endCsv=function(){return BPromise[_0x9340('0x64')]()[_0x9340('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x9340('0x65')](_0x9340('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1a426a){logger[_0x9340('0x17')](_0x9340('0x66'),JSON['stringify'](_0x1a426a));}finally{process[_0x9340('0x67')](0x0);}});};process['on'](_0x9340('0x68'),function(){logger[_0x9340('0x69')](_0x9340('0x6a'));endCsv();});function main(){return BPromise[_0x9340('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9340('0x11')](',');return db[_0x9340('0x2a')][_0x9340('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1fcff6){var _0x2c4eba=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c4eba,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bebe6,_0x3bef2e){total+=0x1;var _0x3c9f00=total;promises[_0x9340('0x2e')](checkRow(_0x1bebe6,_0x1fcff6,_0x3c9f00)[_0x9340('0x2d')](function(){success+=0x1;})[_0x9340('0x2f')](function(_0x5547dd){if(_0x5547dd['error']){errors+=0x1;delete _0x5547dd[_0x9340('0x17')];}else if(_0x5547dd[_0x9340('0x28')]){duplicates+=0x1;delete _0x5547dd['duplicate'];}rows[_0x9340('0x2e')](_0x5547dd);}));if(total%0xc8===0x0){_0x3bef2e[_0x9340('0x6b')]();return processPromises(_0x3bef2e);}},'complete':function(){return processPromises()[_0x9340('0x2d')](function(){logger[_0x9340('0x69')](_0x9340('0x6c'));endCsv();});},'error':function(_0x504cc2,_0x2c3643){logger[_0x9340('0x69')]('CSV\x20parse\x20error',JSON[_0x9340('0x60')](_0x504cc2));endCsv();}});})[_0x9340('0x2f')](function(_0x42da5d){logger[_0x9340('0x17')](_0x9340('0x6d'),JSON[_0x9340('0x60')](_0x42da5d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d12e08d..d704c0e 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 _0xb8a9=['voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','offset','set','stringify','binding','clone','.csv','includes','header','ContactItemType','name','writeFileSync','createReadStream','data','find','_description','hasOwnProperty','trim','replace','isValid','isNaN','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','argv','arguments\x20\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\x20\x20','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','AdditionalPhones','then','length','push','all','split','filter','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','ContactId','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','priority','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','findAll','name','_description','writeFileSync','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists'];(function(_0x5bc76f,_0x2ed7e1){var _0x76152f=function(_0x265e63){while(--_0x265e63){_0x5bc76f['push'](_0x5bc76f['shift']());}};_0x76152f(++_0x2ed7e1);}(_0xbc77,0xc2));var _0x7bc7=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xbc77[_0x237f8b];return _0x423f94;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x7bc7('0x0'));var util=require(_0x7bc7('0x1'));var BPromise=require(_0x7bc7('0x2'));var moment=require(_0x7bc7('0x3'));var squel=require(_0x7bc7('0x4'));var Redis=require(_0x7bc7('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x7bc7('0x6'));var logger=require('../../../config/logger')(_0x7bc7('0x7'));config[_0x7bc7('0x8')]=_['defaults'](config[_0x7bc7('0x8')],{'host':_0x7bc7('0x9'),'port':0x18eb});var socket=require(_0x7bc7('0xa'))(new Redis(config[_0x7bc7('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7bc7('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7bc7('0xc'));function isEmail(_0x16fe67){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))*$/[_0x7bc7('0xd')](_0x16fe67);}function selectNotIn(_0x26de62,_0x55fae2,_0x397afd,_0x512427,_0x14bbc3){return squel[_0x7bc7('0xe')]()[_0x7bc7('0xf')]('phone')[_0x7bc7('0x10')](_0x512427)['join'](_0x55fae2,null,_0x55fae2+_0x7bc7('0x11')+_0x512427+'.'+_0x397afd)[_0x7bc7('0x12')](_0x512427+'.'+_0x397afd+'\x20=\x20'+_0x26de62+'.'+_0x397afd)[_0x7bc7('0x12')](_0x55fae2+_0x7bc7('0x13')+_0x14bbc3[_0x7bc7('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1a7f1c,_0x5cd19a){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x7bc7('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7bc7('0x16')](function(_0x1182da){if(_0x1182da!==null){var _0x1aaab8=[];for(var _0x2ce905=0x0;_0x2ce905<_0x1182da[_0x7bc7('0x17')];_0x2ce905++){var _0x2d25f3=_0x1182da[_0x2ce905];_0x1aaab8[_0x7bc7('0x18')](insertAdditionalPhones(_0x2d25f3));}}Promise[_0x7bc7('0x19')](_0x1aaab8)[_0x7bc7('0x16')](function(){_0x1a7f1c({'val':0x1});});});});}function insertAdditionalPhones(_0x240483){return new Promise(function(_0x5d6b31,_0xa5fa7e){var _0x5c3897=_0x240483[_0x7bc7('0x15')];var _0x418747=_0x5c3897[_0x7bc7('0x1a')](';');var _0x31c2cc=[];orderBy=0x0;for(var _0x43dc80=0x0;_0x43dc80<_0x418747[_0x7bc7('0x17')];_0x43dc80++){_0x31c2cc['push'](splitAdditionalPhone(_0x240483['id'],_0x418747[_0x43dc80]));}Promise[_0x7bc7('0x19')](_0x31c2cc)[_0x7bc7('0x16')](function(){_0x5d6b31({'val':_0x418747[_0x7bc7('0x17')]});});});}function splitAdditionalPhone(_0x476595,_0x3b521b){return new Promise(function(_0x16cdba,_0x3b8851){var _0x309655=_0x3b521b[_0x7bc7('0x1a')](':');var _0x236043=_0x309655[0x0];var _0xf8ff10=_0x309655[0x1];if(!_['isNil'](_0xf8ff10)){var _0x2ec898=_0xf8ff10[_0x7bc7('0x1a')]('|');var _0x293d67=[];for(var _0x5c6bbc=0x0;_0x5c6bbc<_0x2ec898[_0x7bc7('0x17')];_0x5c6bbc++){if(_0x2ec898[_0x5c6bbc]!==''){var _0x2834ca=_[_0x7bc7('0x1b')](promisesAdditionalPhones,{'contactId':_0x476595,'phone':_0x2ec898[_0x5c6bbc]});if(_0x2834ca[_0x7bc7('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x7bc7('0x18')]({'contactId':_0x476595,'contactTypeId':_0x236043,'phone':_0x2ec898[_0x5c6bbc],'orderBy':orderBy});}}}_0x16cdba({'ok':0x1});}else _0x16cdba({'res':0x0});});}function createAdditionalPhone(_0x4c8d5e,_0x37f857,_0x384e51,_0x39968e){var _0x2f04d4='';var _0x40b5a5='';var _0x3b04ac=_0x384e51[_0x7bc7('0x1a')]('§');_0x2f04d4=_0x3b04ac[0x0];if(_0x3b04ac[_0x7bc7('0x17')]==0x2)_0x40b5a5=_0x3b04ac[0x1];return new Promise(function(_0x1e55d1,_0x3b27b8){return db[_0x7bc7('0x1c')][_0x7bc7('0x1d')]({'where':{'CmContactId':_0x4c8d5e,'item':_0x2f04d4}})[_0x7bc7('0x16')](function(_0x1d5300){if(_0x1d5300){return db[_0x7bc7('0x1c')][_0x7bc7('0x1e')]({'ItemTypeId':_0x37f857,'description':_0x40b5a5,'OrderBy':_0x39968e},{'where':{'CmContactId':_0x4c8d5e,'item':_0x2f04d4}})[_0x7bc7('0x16')](function(_0x3288c6){_0x1e55d1({'res':_0x7bc7('0x1f')});});}else{return db[_0x7bc7('0x1c')][_0x7bc7('0x20')]({'CmContactId':_0x4c8d5e,'item':_0x2f04d4,'description':_0x40b5a5,'ItemTypeId':_0x37f857,'OrderBy':_0x39968e,'ItemClass':'PHONE'})[_0x7bc7('0x16')](function(_0x5be076){_0x1e55d1({'res':_0x7bc7('0x21')});});}});});}function insertCmHopper(_0x3eca97,_0x15b3d3,_0x1dcad2,_0x4ab852,_0x405625){var _0x35e3cc=[_0x7bc7('0x22'),_0x7bc7('0x23'),_0x7bc7('0x24'),_0x7bc7('0x25'),_0x15b3d3+'.'+_0x4ab852,'cm_contacts.createdAt',_0x7bc7('0x26'),_0x7bc7('0x27'),_0x7bc7('0x28'),'\x22'+_0x405625+'\x22'];return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')](_0x7bc7('0x2b'))[_0x7bc7('0x2c')]([_0x7bc7('0x2d'),_0x7bc7('0x2e'),'ContactId',_0x7bc7('0x2f'),_0x4ab852,_0x7bc7('0x30'),_0x7bc7('0x31'),'priority',_0x7bc7('0x32'),_0x7bc7('0x33')],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x35e3cc)['from'](_0x15b3d3)[_0x7bc7('0x14')](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x15b3d3+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x1dcad2,null,_0x1dcad2+_0x7bc7('0x11')+_0x15b3d3+'.'+_0x4ab852)[_0x7bc7('0x12')](_0x15b3d3+_0x7bc7('0x38'),_0x3eca97)[_0x7bc7('0x12')](_0x7bc7('0x39'),NOW)[_0x7bc7('0x12')](_0x7bc7('0x3a'),selectNotIn(_0x15b3d3,_0x1dcad2,_0x4ab852,'cm_hopper',[_0x7bc7('0x3b'),_0x7bc7('0x3c')]))[_0x7bc7('0x12')](_0x7bc7('0x3a'),selectNotIn(_0x15b3d3,_0x1dcad2,_0x4ab852,_0x7bc7('0x2b'),[_0x7bc7('0x3b')])))[_0x7bc7('0x3d')]();}function insertCmHopperBlack(_0x565579,_0x1c4e60,_0x92bf7f,_0x38b33d){var _0x52c722=[_0x7bc7('0x22'),_0x7bc7('0x24'),_0x7bc7('0x25'),_0x1c4e60+'.'+_0x38b33d,_0x7bc7('0x3e'),_0x7bc7('0x26')];return squel['insert']()[_0x7bc7('0x2a')](_0x7bc7('0x3f'))['fromQuery']([_0x7bc7('0x2d'),_0x7bc7('0x40'),'ListId',_0x38b33d,_0x7bc7('0x30'),_0x7bc7('0x31')],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x52c722)[_0x7bc7('0x10')](_0x1c4e60)['join'](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x1c4e60+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x92bf7f,null,_0x92bf7f+_0x7bc7('0x11')+_0x1c4e60+'.'+_0x38b33d)[_0x7bc7('0x12')](_0x1c4e60+_0x7bc7('0x38'),_0x565579)['where'](_0x7bc7('0x39'),NOW)[_0x7bc7('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7bc7('0xe')]()[_0x7bc7('0xf')]('phone')[_0x7bc7('0x10')](_0x7bc7('0x3f'))['where']('ListId\x20=\x20?',_0x565579)[_0x7bc7('0x12')](_0x38b33d+_0x7bc7('0x41')+_0x1c4e60+'.'+_0x38b33d)))[_0x7bc7('0x3d')]();}function insertTzCmHopper(_0x30582f,_0x287c5a,_0x2f29a7,_0x134e29,_0x11b463,_0xa6b9ad){var _0x51fda5=[_0x7bc7('0x22'),_0x7bc7('0x42')+_0xa6b9ad+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x7bc7('0x25'),_0x287c5a+'.'+_0x134e29,_0x7bc7('0x3e'),_0x7bc7('0x26'),_0x7bc7('0x27'),_0x7bc7('0x28'),'\x22'+_0x11b463+'\x22'];var _0x485fe8=squel['insert']()[_0x7bc7('0x2a')](_0x7bc7('0x2b'))[_0x7bc7('0x2c')](['phone','scheduledat',_0x7bc7('0x40'),_0x7bc7('0x2f'),_0x134e29,_0x7bc7('0x30'),_0x7bc7('0x31'),_0x7bc7('0x43'),_0x7bc7('0x32'),'recallme'],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x51fda5)[_0x7bc7('0x10')](_0x287c5a)['join'](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x287c5a+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x2f29a7,null,_0x2f29a7+_0x7bc7('0x11')+_0x287c5a+'.'+_0x134e29)[_0x7bc7('0x14')](_0xa6b9ad,null,_0xa6b9ad+_0x7bc7('0x11')+_0x287c5a+'.'+_0x134e29)[_0x7bc7('0x12')](_0x287c5a+_0x7bc7('0x38'),_0x30582f)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7bc7('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x287c5a,_0x2f29a7,_0x134e29,_0x7bc7('0x2b'),[_0x7bc7('0x3b'),_0x7bc7('0x3c')]))[_0x7bc7('0x12')](_0x7bc7('0x3a'),selectNotIn(_0x287c5a,_0x2f29a7,_0x134e29,_0x7bc7('0x2b'),[_0x7bc7('0x3b')])))[_0x7bc7('0x3d')]();return _0x485fe8;}function insertTzCmHopperBlack(_0x16a952,_0x153662,_0x552093,_0x3a72d2){var _0x399965=['cm_contacts.phone',_0x7bc7('0x24'),_0x7bc7('0x25'),_0x153662+'.'+_0x3a72d2,_0x7bc7('0x3e'),'cm_contacts.updatedAt'];return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')]('cm_hopper_black')[_0x7bc7('0x2c')](['phone',_0x7bc7('0x40'),_0x7bc7('0x2f'),_0x3a72d2,_0x7bc7('0x30'),_0x7bc7('0x31')],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x399965)[_0x7bc7('0x10')](_0x153662)['join'](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x153662+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x552093,null,_0x552093+'.id\x20=\x20'+_0x153662+'.'+_0x3a72d2)['where'](_0x153662+_0x7bc7('0x38'),_0x16a952)[_0x7bc7('0x12')](_0x7bc7('0x39'),NOW)[_0x7bc7('0x12')](_0x7bc7('0x3a'),squel[_0x7bc7('0xe')]()[_0x7bc7('0xf')](_0x7bc7('0x2d'))[_0x7bc7('0x10')](_0x7bc7('0x3f'))[_0x7bc7('0x12')](_0x7bc7('0x44'),_0x16a952)[_0x7bc7('0x12')](_0x3a72d2+_0x7bc7('0x41')+_0x153662+'.'+_0x3a72d2)))[_0x7bc7('0x3d')]();}function insertCmHopperAdditionalPhones(_0x530c12){var _0x5d6ad8=[_0x7bc7('0x45'),_0x7bc7('0x46'),'cm_contact_has_items.OrderBy',_0x7bc7('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')](_0x7bc7('0x48'))[_0x7bc7('0x2c')]([_0x7bc7('0x49'),'phone',_0x7bc7('0x4a'),_0x7bc7('0x30'),_0x7bc7('0x31')],squel[_0x7bc7('0xe')]()['fields'](_0x5d6ad8)[_0x7bc7('0x10')](_0x7bc7('0x2b'))[_0x7bc7('0x14')](_0x7bc7('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,_0x7bc7('0x4b'))['where'](_0x7bc7('0x4c'),_0x530c12)[_0x7bc7('0x12')](_0x7bc7('0x39'),NOW))['toString']();}function insertCmContact(_0x5cba5b,_0x33a040,_0x4ec0f2,_0x8dff91){var _0x23ae47=_[_0x7bc7('0x4d')](_[_0x7bc7('0x4e')](_0x8dff91),[_0x7bc7('0x2f'),'CompanyId',_0x7bc7('0x30'),_0x7bc7('0x31'),_0x7bc7('0x4f')]);return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')](_0x7bc7('0x35'))[_0x7bc7('0x2c')](_0x23ae47,squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x23ae47)[_0x7bc7('0x10')](_0x33a040)[_0x7bc7('0x12')]('('+_0x4ec0f2[_0x7bc7('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0x7bc7('0xe')]()['fields'](_0x4ec0f2)[_0x7bc7('0x10')](_0x7bc7('0x35'))[_0x7bc7('0x12')](_0x7bc7('0x44'),_0x5cba5b)[_0x7bc7('0x12')](_0x7bc7('0x50')))[_0x7bc7('0x12')](_0x7bc7('0x51'),squel[_0x7bc7('0xe')]()['field'](_0x7bc7('0x52'),'min_id')['from'](_0x33a040)['group'](_0x4ec0f2[_0x7bc7('0x14')](','))))[_0x7bc7('0x3d')]();}function handleStop(){logger[_0x7bc7('0x53')](_0x7bc7('0x54'));stopped=!![];}function handleUncaughtException(_0x9a3bc2){logger[_0x7bc7('0x55')](_0x9a3bc2[_0x7bc7('0x56')]);process['exit'](0x1);}function handleError(_0xb0e23b,_0xae7792){stats[_0x7bc7('0x57')][_0x7bc7('0x18')]({'name':_0xae7792[_0x7bc7('0x58')],'message':_0xae7792['message'],'row':_0xb0e23b});}function handleQuery(_0x57441e){logger[_0x7bc7('0x53')](_0x57441e);return db[_0x7bc7('0x59')][_0x7bc7('0x5a')](_0x57441e)[_0x7bc7('0x5b')](function(_0x4f9ef1){results[_0x7bc7('0x18')](_0x4f9ef1);})[_0x7bc7('0x5c')](function(_0x39ca94){logger[_0x7bc7('0x55')](_0x39ca94['message']);});}function updateTzCampaigns(_0x19a430){return new Promise(function(_0x39f970,_0x28db6f){var _0x26061d=squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')]([_0x7bc7('0x5d'),_0x7bc7('0x5e')])[_0x7bc7('0x10')]('campaigns')['join']('campaigns_has_cm_lists',null,_0x7bc7('0x5f'))[_0x7bc7('0x12')](_0x7bc7('0x60')+_0x19a430);db['sequelize']['query'](_0x26061d['toString']())['spread'](function(_0x597ca3){var _0x4e8fe0=[];for(var _0x5e1287=0x0;_0x5e1287<_0x597ca3['length'];_0x5e1287++){_0x4e8fe0['push'](getTimezoneData(_0x597ca3[_0x5e1287],tmp_campaigns));}BPromise[_0x7bc7('0x19')](_0x4e8fe0)['then'](function(){_0x39f970({'val':0x1});});})[_0x7bc7('0x5c')](function(_0x3bd03e){logger[_0x7bc7('0x55')](_0x3bd03e[_0x7bc7('0x56')]);_0x39f970({'val':0x0});});});}function updateTzVoiceQueues(_0x1a0815){return new Promise(function(_0x506a21,_0x5b3a18){var _0x4add8d=squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](['voice_queues.id','voice_queues.dialTimezone'])[_0x7bc7('0x10')](_0x7bc7('0x61'))[_0x7bc7('0x14')](_0x7bc7('0x62'),null,_0x7bc7('0x63'))['where']('voice_queues_has_cm_lists.CmListId='+_0x1a0815);db[_0x7bc7('0x59')][_0x7bc7('0x5a')](_0x4add8d['toString']())['spread'](function(_0x2df78d){var _0x208a87=[];for(var _0x5633a1=0x0;_0x5633a1<_0x2df78d[_0x7bc7('0x17')];_0x5633a1++){_0x208a87[_0x7bc7('0x18')](getTimezoneData(_0x2df78d[_0x5633a1],tmp_voice_queues));}BPromise[_0x7bc7('0x19')](_0x208a87)['then'](function(){_0x506a21({'val':0x1});});})[_0x7bc7('0x5c')](function(_0x5a6f84){logger[_0x7bc7('0x55')](_0x5a6f84[_0x7bc7('0x56')]);_0x506a21({'val':0x0});});});}function getTimezoneData(_0x267263,_0x28663b){return new Promise(function(_0xc76a4f,_0x3f0880){var _0x2db253=shared[_0x7bc7('0x64')];var _0x3c5d9c=_0x2db253[_0x267263[_0x7bc7('0x65')]];if(_[_0x7bc7('0x66')](_0x3c5d9c)){_0xc76a4f({'ret':0x1});}else{var _0x7d0e4c=_0x3c5d9c[_0x7bc7('0x67')];var _0x4d2fde=squel[_0x7bc7('0x29')]()['into'](_0x28663b)[_0x7bc7('0x68')]('id',_0x267263['id'])[_0x7bc7('0x68')](_0x7bc7('0x69'),_0x7d0e4c)['set']('dialTimezone',_0x267263[_0x7bc7('0x65')])[_0x7bc7('0x3d')]();return db['sequelize'][_0x7bc7('0x5a')](_0x4d2fde)['spread'](function(_0xddb2b1){_0xc76a4f({'ret':0x1});})[_0x7bc7('0x5c')](function(_0x4176bf){logger['error'](_0x4176bf[_0x7bc7('0x56')]);_0x3f0880({'ret':0x1});});}});}function handleTZQuery(_0x565dd9){logger[_0x7bc7('0x53')](_0x565dd9);return db['sequelize'][_0x7bc7('0x5a')](_0x565dd9)[_0x7bc7('0x5b')](function(_0xd7c076){})[_0x7bc7('0x5c')](function(_0x41b128){logger[_0x7bc7('0x55')](_0x41b128['message']);});}function main(_0x349490,_0x1299d4,_0xa6dc6,_0x425c97){logger['info'](_0x7bc7('0x6a'),_0x349490,JSON[_0x7bc7('0x6b')](_0x1299d4));process['send'](_0x7bc7('0x6c'));var _0x323412=_0x1299d4['binding'];var _0x89df6e=_[_0x7bc7('0x6d')](_0x323412);var _0x580a57=_0x1299d4[_0x7bc7('0x6e')];var _0x4f1d4b=path['join'](config[_0x7bc7('0x6f')],_0x7bc7('0x70'),_0x580a57+_0x7bc7('0x71'));hasTZ=_[_0x7bc7('0x4e')](_0x323412)[_0x7bc7('0x72')]('dialTimezone');var _0x2c1c75=_[_0x7bc7('0x4e')](_0x323412)['join']();logger[_0x7bc7('0x53')](_0x7bc7('0x73'),_0x2c1c75);db['ContactItemType'][_0x7bc7('0x74')]({'raw':!![],'attributes':['id',_0x7bc7('0x75')]})[_0x7bc7('0x16')](function(_0xdfac1b){for(var _0x20188d=0x0;_0x20188d<_0xdfac1b[_0x7bc7('0x17')];_0x20188d++){if(_0xdfac1b[_0x20188d][_0x7bc7('0x75')]in _0x323412){contactItemTypes[_0x7bc7('0x18')](_0xdfac1b[_0x20188d]);delete _0x89df6e[_0xdfac1b[_0x20188d]['name']];hasAdditionalPhones=!![];}for(var _0x4ea6aa in _0x323412){if(_0xdfac1b[_0x20188d][_0x7bc7('0x75')]+_0x7bc7('0x76')===_0x4ea6aa){phoneDescriptions[_0x7bc7('0x18')]({'itemTypeId':_0xdfac1b[_0x20188d]['id'],'description':_0x4ea6aa});delete _0x89df6e[_0x4ea6aa];}}}if(hasAdditionalPhones)_0x89df6e[_0x7bc7('0x15')]='';var _0x43e42e=_[_0x7bc7('0x4e')](_0x89df6e)[_0x7bc7('0x14')]();logger[_0x7bc7('0x53')](_0x7bc7('0x73'),_0x43e42e);fs[_0x7bc7('0x77')](_0x4f1d4b,_0x43e42e+'\x0a');Papa['parse'](fs['createReadStream'](_0x349490),{'header':!![],'skipEmptyLines':!![],'step':function(_0x482a4e,_0x315391){try{for(var _0x27b76b=0x0,_0x47f36b=[];_0x27b76b<_0x482a4e[_0x7bc7('0x78')]['length'];_0x27b76b++){stats[_0x7bc7('0x79')]+=0x1;if(_0x482a4e[_0x7bc7('0x57')][_0x27b76b]){handleError(_0x482a4e[_0x7bc7('0x78')][_0x27b76b],_0x482a4e[_0x7bc7('0x57')][_0x27b76b]);}else{var _0x37ecc9=[];var _0x45e2ea=[];var _0x5614f9={};for(var _0x37b33a in _0x323412){let _0x867a59=contactItemTypes[_0x7bc7('0x7a')](_0x48a0dc=>_0x48a0dc[_0x7bc7('0x75')]===_0x37b33a);let _0x306b04=contactItemTypes[_0x7bc7('0x7a')](_0x5e1db5=>_0x5e1db5[_0x7bc7('0x75')]+_0x7bc7('0x76')===_0x37b33a);if(_[_0x7bc7('0x66')](_0x867a59)&&_[_0x7bc7('0x66')](_0x306b04)){if(_0x323412[_0x7bc7('0x7b')](_0x37b33a)){if(_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]]){var _0x3738ee=_[_0x7bc7('0x7c')](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]][_0x7bc7('0x7d')](/"/g,'\x27'));switch(_0x37b33a){case _0x7bc7('0x2e'):var _0x18930c=moment(_0x3738ee,_0x7bc7('0xc'),!![]);if(_0x18930c[_0x7bc7('0x7e')]()){_0x47f36b['push']('\x22'+_0x3738ee+'\x22');}else{_0x37ecc9[_0x7bc7('0x18')](_0x7bc7('0x7f'));}break;case _0x7bc7('0x43'):var _0x59bf0c=parseInt(_0x3738ee);_0x3738ee=_[_0x7bc7('0x80')](_0x59bf0c)||_0x59bf0c<0x0||_0x59bf0c>0x4?_0x425c97?0x3:0x2:_0x59bf0c;_0x47f36b['push']('\x22'+_0x3738ee+'\x22');break;case'UserId':var _0x4eb4d3=parseInt(_0x3738ee);if(_['isNumber'](_0x4eb4d3)&&_['includes'](_0xa6dc6,_0x4eb4d3)){_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x4eb4d3+'\x22');}else{_0x37ecc9['push'](_0x7bc7('0x81'));}break;case _0x7bc7('0x82'):if(isEmail(_0x3738ee)){_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x3738ee+'\x22');}else{_0x37ecc9[_0x7bc7('0x18')](_0x7bc7('0x83'));}break;case _0x7bc7('0x84'):var _0x14b6dc=moment(_0x3738ee,_0x7bc7('0x85'),!![]);if(_0x14b6dc[_0x7bc7('0x7e')]()){_0x47f36b['push']('\x22'+_0x3738ee+'\x22');}else{_0x37ecc9[_0x7bc7('0x18')](_0x7bc7('0x86'));}break;case _0x7bc7('0x65'):var _0x53e3f9=shared[_0x7bc7('0x64')];var _0x294e9a=_0x53e3f9[_0x3738ee];if(!_[_0x7bc7('0x66')](_0x294e9a)){var _0x3a02fb=_0x294e9a[_0x7bc7('0x67')];_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x3738ee+'\x22');_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x3a02fb+'\x22');}break;default:_0x47f36b['push']('\x22'+_0x3738ee+'\x22');}}else{switch(_0x37b33a){case _0x7bc7('0x87'):case _0x7bc7('0x2d'):_0x37ecc9['push'](_0x37b33a+_0x7bc7('0x88'));break;default:_0x47f36b[_0x7bc7('0x18')]('\x22\x22');}}}}else{var _0x126b68='';if(!_[_0x7bc7('0x66')](_0x867a59)){if(!_0x5614f9[_0x7bc7('0x7b')](_0x867a59['id'])){if(!_[_0x7bc7('0x66')](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]])){var _0x3738ee=_['trim'](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]][_0x7bc7('0x7d')](/"/g,'\x27'));var _0x4c55f7=phoneDescriptions[_0x7bc7('0x7a')](_0x48b475=>_0x48b475[_0x7bc7('0x89')]===_0x867a59['id']);if(!_['isNil'](_0x4c55f7)){var _0xbb978=_[_0x7bc7('0x7c')](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x4c55f7[_0x7bc7('0x8a')]]]['replace'](/"/g,'\x27'));if(!_[_0x7bc7('0x66')](_0xbb978))_0x3738ee=_0x3738ee+'§'+_0xbb978;}if(_0x126b68=='')_0x126b68=_0x3738ee;else _0x126b68+='|'+_0x3738ee;}_0x45e2ea['push'](_0x867a59['id']+':'+_0x126b68);_0x5614f9[_0x867a59['id']]=0x1;}}}}if(hasAdditionalPhones){_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x45e2ea['join'](';')+'\x22');}if(_0x37ecc9[_0x7bc7('0x17')]){handleError(_0x482a4e['data'][_0x27b76b],{'code':'SystemRow','message':_0x37ecc9['join']()});}else{fs[_0x7bc7('0x8b')](_0x4f1d4b,_0x47f36b['join']()+'\x0a');}_0x47f36b=[];}if(!(stats[_0x7bc7('0x79')]%0xc8)){socket[_0x7bc7('0x8c')](_0x7bc7('0x8d')+_0x580a57,stats);stats[_0x7bc7('0x57')]=[];}}if(stopped){logger[_0x7bc7('0x53')](_0x7bc7('0x8e'));_0x315391[_0x7bc7('0x8f')]();}}catch(_0x6ab4f2){handleError(_0x482a4e['data'][_0x27b76b],{'code':'SystemError','message':_0x6ab4f2[_0x7bc7('0x56')]});logger[_0x7bc7('0x55')]('step',_0x6ab4f2['message']);}},'complete':function(){try{var _0x341ee5=[];var _0x80ef6=[];var _0x5321bc=_0x7bc7('0x35');if(_0x1299d4[_0x7bc7('0x90')]&&_0x1299d4[_0x7bc7('0x90')]['length']){_0x5321bc='cm_contacts_'+_0x580a57;_0x341ee5[_0x7bc7('0x18')](_0x7bc7('0x91')+_0x5321bc+_0x7bc7('0x92'));}tmp_campaigns=_0x7bc7('0x93')+_0x580a57;tmp_voice_queues='voice_queues_'+_0x580a57;_0x80ef6[_0x7bc7('0x18')](_0x7bc7('0x91')+tmp_campaigns+_0x7bc7('0x94'));_0x80ef6['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x7bc7('0x94'));BPromise['each'](_0x80ef6,handleTZQuery)[_0x7bc7('0x16')](function(_0x5180d4){updateTzCampaigns(_0x1299d4[_0x7bc7('0x2f')])['then'](function(_0x51c30e){updateTzVoiceQueues(_0x1299d4[_0x7bc7('0x2f')])[_0x7bc7('0x16')](function(_0x586f0d){if(hasTZ)_0x43e42e=_0x43e42e[_0x7bc7('0x7d')]('dialTimezone',_0x7bc7('0x95'));var _0x4a56f6=util['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',_0x4f1d4b,_0x5321bc,_0x43e42e,_0x1299d4['ListId'],_0x1299d4['CompanyId']||null,NOW,NOW);if(_[_0x7bc7('0x66')](_0x323412[_0x7bc7('0x2e')])){_0x4a56f6+=_0x7bc7('0x96');}_0x341ee5['push'](_0x4a56f6);if(_0x1299d4[_0x7bc7('0x90')]&&_0x1299d4[_0x7bc7('0x90')][_0x7bc7('0x17')]){_0x341ee5[_0x7bc7('0x18')](insertCmContact(_0x1299d4[_0x7bc7('0x2f')],_0x5321bc,_0x1299d4['duplicates'],_0x323412));_0x341ee5[_0x7bc7('0x18')](_0x7bc7('0x97')+_0x5321bc+';');}BPromise[_0x7bc7('0x98')](_0x341ee5,handleQuery)[_0x7bc7('0x16')](function(_0x18752e){BPromise[_0x7bc7('0x19')]([handleAdditionalPhones()])[_0x7bc7('0x16')](function(){_0x341ee5=[];for(var _0x5c7460=0x0;_0x5c7460_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 +var _0x1a85=['server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','errors','find','data','trim','replace','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','description','appendFileSync','rows','emit','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','contactId','contactTypeId','orderBy','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','import','defaults','localhost','socket.io-emitter','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','split','filter','CmContactHasItem','findOne','then','updated','create','inserted','update','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.id','into','cm_hopper_black','.CmListId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_hopper_additional_phones','CmHopperId','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)','info','query','main','start','socket_timestamp','root'];(function(_0x281eb5,_0x120187){var _0x544e51=function(_0x4e4081){while(--_0x4e4081){_0x281eb5['push'](_0x281eb5['shift']());}};_0x544e51(++_0x120187);}(_0x1a85,0x178));var _0x51a8=function(_0x2a92a4,_0x5ca2ec){_0x2a92a4=_0x2a92a4-0x0;var _0x383acc=_0x1a85[_0x2a92a4];return _0x383acc;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x51a8('0x0'));var util=require(_0x51a8('0x1'));var BPromise=require(_0x51a8('0x2'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x51a8('0x3'));var db=require(_0x51a8('0x4'))['db'];var config=require(_0x51a8('0x5'));var logger=require('../../../config/logger')(_0x51a8('0x6'));config['redis']=_[_0x51a8('0x7')](config['redis'],{'host':_0x51a8('0x8'),'port':0x18eb});var socket=require(_0x51a8('0x9'))(new Redis(config['redis']));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()[_0x51a8('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x51a8('0xa')](_0x51a8('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1a476d){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))*$/[_0x51a8('0xc')](_0x1a476d);}function selectNotIn(_0x418f06,_0x421fa4,_0x3f93c7,_0x273a3f,_0x34c887){return squel[_0x51a8('0xd')]()[_0x51a8('0xe')](_0x51a8('0xf'))[_0x51a8('0x10')](_0x273a3f)[_0x51a8('0x11')](_0x421fa4,null,_0x421fa4+_0x51a8('0x12')+_0x273a3f+'.'+_0x3f93c7)[_0x51a8('0x13')](_0x273a3f+'.'+_0x3f93c7+_0x51a8('0x14')+_0x418f06+'.'+_0x3f93c7)['where'](_0x421fa4+_0x51a8('0x15')+_0x34c887[_0x51a8('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xaec066,_0x50d992){promisesAdditionalPhones=[];promisesContact=[];return db[_0x51a8('0x16')]['query'](_0x51a8('0x17')+tempTableName)[_0x51a8('0x18')](function(_0x39cd45){if(_0x39cd45!==null){var _0x2b0521=[];for(var _0x3fbd02=0x0;_0x3fbd02<_0x39cd45[_0x51a8('0x19')];_0x3fbd02++){var _0x1f49ee=_0x39cd45[_0x3fbd02];if(!_['isNil'](_0x1f49ee[_0x51a8('0xf')])){if(!_[_0x51a8('0x1a')](_0x1f49ee[_0x51a8('0x1b')]))_0x2b0521[_0x51a8('0x1c')](insertAdditionalPhones(_0x1f49ee));promisesContact[_0x51a8('0x1c')]({'contact':_0x1f49ee});}}}Promise[_0x51a8('0x1d')](_0x2b0521)['then'](function(){_0xaec066({'val':0x1});});})[_0x51a8('0x1e')](function(_0x3b7e7e){logger[_0x51a8('0x1f')](_0x3b7e7e[_0x51a8('0x20')]);});});}function insertAdditionalPhones(_0x2a4c4c){return new Promise(function(_0x3bc044,_0x28aea0){var _0x3bf5b6=_0x2a4c4c['AdditionalPhones'];if(_[_0x51a8('0x1a')](_0x3bf5b6))_0x28aea0({'val':0x0});else{var _0x53438c=_0x3bf5b6[_0x51a8('0x21')](';');var _0x12c029=[];orderBy=0x0;for(var _0x8bda40=0x0;_0x8bda40<_0x53438c[_0x51a8('0x19')];_0x8bda40++){_0x12c029['push'](splitAdditionalPhone(_0x2a4c4c['id'],_0x53438c[_0x8bda40]));}Promise[_0x51a8('0x1d')](_0x12c029)['then'](function(){_0x3bc044({'val':_0x53438c['length']});});}});}function splitAdditionalPhone(_0x23d26a,_0x52e503){return new Promise(function(_0x384d25,_0x78d3d6){var _0x20ef8b=_0x52e503[_0x51a8('0x21')](':');var _0x157554=_0x20ef8b[0x0];var _0x2f2f05=_0x20ef8b[0x1];if(_0x2f2f05!==''){var _0x291ed6=_0x2f2f05[_0x51a8('0x21')]('|');var _0x5b3f49=[];for(var _0x273ce2=0x0;_0x273ce2<_0x291ed6[_0x51a8('0x19')];_0x273ce2++){if(_0x291ed6[_0x273ce2]!==''){var _0xca5746=_[_0x51a8('0x22')](promisesAdditionalPhones,{'contactId':_0x23d26a,'phone':_0x291ed6[_0x273ce2]});if(_0xca5746[_0x51a8('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x51a8('0x1c')]({'contactId':_0x23d26a,'contactTypeId':_0x157554,'phone':_0x291ed6[_0x273ce2],'orderBy':orderBy});}}}_0x384d25({'ok':0x1});}else _0x384d25({'res':0x0});});}function createAdditionalPhone(_0x1a886f,_0x2742f5,_0xec08ae,_0x4b5cda){var _0x20c6b5='';var _0x347a02='';var _0x4a1548=_0xec08ae[_0x51a8('0x21')]('§');_0x20c6b5=_0x4a1548[0x0];if(_0x4a1548['length']==0x2)_0x347a02=_0x4a1548[0x1];return new Promise(function(_0x276424,_0x3bc19a){return db[_0x51a8('0x23')][_0x51a8('0x24')]({'where':{'CmContactId':_0x1a886f,'item':_0x20c6b5}})[_0x51a8('0x25')](function(_0x4ea271){if(_0x4ea271){return db[_0x51a8('0x23')]['update']({'ItemTypeId':_0x2742f5,'description':_0x347a02,'OrderBy':_0x4b5cda},{'where':{'CmContactId':_0x1a886f,'item':_0x20c6b5}})[_0x51a8('0x25')](function(_0x24b39a){_0x276424({'res':_0x51a8('0x26')});});}else{return db['CmContactHasItem'][_0x51a8('0x27')]({'CmContactId':_0x1a886f,'item':_0x20c6b5,'ItemTypeId':_0x2742f5,'description':_0x347a02,'OrderBy':_0x4b5cda,'ItemClass':'PHONE'})[_0x51a8('0x25')](function(_0x192ac4){_0x276424({'res':_0x51a8('0x28')});});}});});}function updateContact(_0x224099){return new Promise(function(_0x193e0f,_0x50195b){var _0x1167b8=_0x224099['id'];delete _0x224099['id'];return db['CmContact'][_0x51a8('0x29')](_0x224099,{'where':{'id':_0x1167b8}})[_0x51a8('0x25')](function(_0x41561a){updatedRows+=0x1;return db['CmHopper'][_0x51a8('0x29')]({'phone':_0x224099[_0x51a8('0xf')]},{'where':{'ContactId':_0x1167b8}})[_0x51a8('0x25')](function(_0x2429f8){_0x193e0f({'ret':'OK'});});});});}function insertCmHopper(_0x41c020,_0x49ab37,_0x4c2b3d,_0x4d3114,_0x21b871){var _0x299001=['cm_contacts.phone',_0x51a8('0x2a'),'cm_contacts.id',_0x51a8('0x2b'),_0x49ab37+'.'+_0x4d3114,_0x51a8('0x2c'),_0x51a8('0x2d'),_0x51a8('0x2e'),_0x51a8('0x2f'),'\x22'+_0x21b871+'\x22'];return squel[_0x51a8('0x30')]()['into']('cm_hopper')[_0x51a8('0x31')](['phone','scheduledat','ContactId',_0x51a8('0x32'),_0x4d3114,_0x51a8('0x33'),_0x51a8('0x34'),'priority',_0x51a8('0x35'),_0x51a8('0x36')],squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0x299001)['from'](_0x49ab37)[_0x51a8('0x11')](_0x51a8('0x38'),null,_0x51a8('0x39')+_0x49ab37+'.CmListId')[_0x51a8('0x11')](_0x4c2b3d,null,_0x4c2b3d+'.id\x20=\x20'+_0x49ab37+'.'+_0x4d3114)[_0x51a8('0x13')](_0x49ab37+_0x51a8('0x3a'),_0x41c020)[_0x51a8('0x13')](_0x51a8('0x3b'),NOW)['where'](_0x51a8('0x3c'),selectNotIn(_0x49ab37,_0x4c2b3d,_0x4d3114,_0x51a8('0x3d'),[_0x51a8('0x3e'),_0x51a8('0x3f')]))[_0x51a8('0x13')](_0x51a8('0x3c'),selectNotIn(_0x49ab37,_0x4c2b3d,_0x4d3114,_0x51a8('0x3d'),[_0x51a8('0x3e')])))[_0x51a8('0x40')]();}function insertCmHopperBlack(_0x4b8467,_0x22e6e6,_0x2afb74,_0x4c7c67){var _0x53409d=[_0x51a8('0x41'),_0x51a8('0x42'),_0x51a8('0x2b'),_0x22e6e6+'.'+_0x4c7c67,_0x51a8('0x2c'),_0x51a8('0x2d')];return squel[_0x51a8('0x30')]()[_0x51a8('0x43')](_0x51a8('0x44'))[_0x51a8('0x31')]([_0x51a8('0xf'),'ContactId',_0x51a8('0x32'),_0x4c7c67,_0x51a8('0x33'),_0x51a8('0x34')],squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0x53409d)[_0x51a8('0x10')](_0x22e6e6)['join'](_0x51a8('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x22e6e6+_0x51a8('0x45'))[_0x51a8('0x11')](_0x2afb74,null,_0x2afb74+_0x51a8('0x12')+_0x22e6e6+'.'+_0x4c7c67)[_0x51a8('0x13')](_0x22e6e6+_0x51a8('0x3a'),_0x4b8467)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x51a8('0x13')](_0x51a8('0x3c'),squel[_0x51a8('0xd')]()[_0x51a8('0xe')](_0x51a8('0xf'))['from']('cm_hopper_black')[_0x51a8('0x13')](_0x51a8('0x46'),_0x4b8467)[_0x51a8('0x13')](_0x4c7c67+_0x51a8('0x47'),_0x22e6e6+'.'+_0x4c7c67)))[_0x51a8('0x40')]();}function insertCmHopperAdditionalPhones(_0x1cf058){var _0x15e5a2=[_0x51a8('0x48'),_0x51a8('0x49'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x51a8('0x30')]()[_0x51a8('0x43')](_0x51a8('0x4a'))['fromQuery']([_0x51a8('0x4b'),_0x51a8('0xf'),'OrderBy',_0x51a8('0x33'),'updatedAt'],squel['select']()[_0x51a8('0x37')](_0x15e5a2)[_0x51a8('0x10')](_0x51a8('0x3d'))['join']('cm_contacts',null,_0x51a8('0x4c'))['join'](_0x51a8('0x4d'),null,_0x51a8('0x4e'))[_0x51a8('0x13')](_0x51a8('0x4f'),_0x1cf058)[_0x51a8('0x13')](_0x51a8('0x3b'),NOW))[_0x51a8('0x40')]();}function insertCmContact(_0x406a87,_0x29d31e,_0x530ad0,_0x2eda9c){var _0xe4518d=_[_0x51a8('0x50')](_[_0x51a8('0x51')](_0x2eda9c),['ListId',_0x51a8('0x52'),'createdAt',_0x51a8('0x34')]);return squel[_0x51a8('0x30')]()['into']('cm_contacts')[_0x51a8('0x31')](_0xe4518d,squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0xe4518d)[_0x51a8('0x10')](_0x29d31e)[_0x51a8('0x13')]('('+_0x530ad0['join'](',')+_0x51a8('0x53'),squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0x530ad0)[_0x51a8('0x10')](_0x51a8('0x38'))['where'](_0x51a8('0x46'),_0x406a87))[_0x51a8('0x13')](_0x51a8('0x54'),squel[_0x51a8('0xd')]()[_0x51a8('0xe')](_0x51a8('0x55'),'min_id')['from'](_0x29d31e)['group'](_0x530ad0['join'](','))))[_0x51a8('0x40')]();}function handleStop(){logger[_0x51a8('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x7ac0ae){logger['error'](_0x7ac0ae[_0x51a8('0x20')]);process['exit'](0x1);}function handleError(_0x3947e1,_0x472fdb){stats['errors']['push']({'name':_0x472fdb['code'],'message':_0x472fdb[_0x51a8('0x20')],'row':_0x3947e1});}function handleQuery(_0x1ead77){logger[_0x51a8('0x56')](_0x1ead77);return db[_0x51a8('0x16')][_0x51a8('0x57')](_0x1ead77)[_0x51a8('0x18')](function(_0x3fd347){results[_0x51a8('0x1c')](_0x3fd347);})['catch'](function(_0x43c2ad){logger[_0x51a8('0x1f')](_0x43c2ad['message']);});}function main(_0xd48a5c,_0x315231,_0xf24966,_0x390c25){logger[_0x51a8('0x56')](_0x51a8('0x58'),_0xd48a5c,JSON['stringify'](_0x315231));process['send'](_0x51a8('0x59'));var _0x53f25e=_0x315231['binding'];var _0x50a6ad=_['clone'](_0x53f25e);var _0x483a5a=_0x315231[_0x51a8('0x5a')];var _0x529b2f=path[_0x51a8('0x11')](config[_0x51a8('0x5b')],_0x51a8('0x5c'),_0x483a5a+_0x51a8('0x5d'));logger[_0x51a8('0x56')](_0x51a8('0x5e'),_0x315231);db[_0x51a8('0x5f')][_0x51a8('0x60')]({'raw':!![],'attributes':['id',_0x51a8('0x61')]})[_0x51a8('0x25')](function(_0x48affc){for(var _0x3e66d0=0x0;_0x3e66d0<_0x48affc[_0x51a8('0x19')];_0x3e66d0++){if(_0x48affc[_0x3e66d0][_0x51a8('0x61')]in _0x53f25e){contactItemTypes['push'](_0x48affc[_0x3e66d0]);delete _0x50a6ad[_0x48affc[_0x3e66d0]['name']];hasAdditionalPhones=!![];}for(var _0x5e6bf8 in _0x53f25e){if(_0x48affc[_0x3e66d0][_0x51a8('0x61')]+_0x51a8('0x62')===_0x5e6bf8){phoneDescriptions[_0x51a8('0x1c')]({'itemTypeId':_0x48affc[_0x3e66d0]['id'],'description':_0x5e6bf8});delete _0x50a6ad[_0x5e6bf8];}}}if(hasAdditionalPhones)_0x50a6ad[_0x51a8('0x1b')]='';var _0x2efb36=_[_0x51a8('0x51')](_0x50a6ad)[_0x51a8('0x11')]();logger[_0x51a8('0x56')](_0x51a8('0x63'),_0x2efb36);fs[_0x51a8('0x64')](_0x529b2f,_0x2efb36+'\x0a');Papa[_0x51a8('0x65')](fs[_0x51a8('0x66')](_0xd48a5c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x934ea9,_0x531995){try{for(var _0x5aa50d=0x0,_0x8b9b1b=[];_0x5aa50d<_0x934ea9['data'][_0x51a8('0x19')];_0x5aa50d++){stats['rows']+=0x1;if(_0x934ea9['errors'][_0x5aa50d]){handleError(_0x934ea9['data'][_0x5aa50d],_0x934ea9[_0x51a8('0x67')][_0x5aa50d]);}else{var _0x385878=[];var _0xb480ec=[];var _0x283385={};for(var _0x156eab in _0x53f25e){let _0x1f036b=contactItemTypes[_0x51a8('0x68')](_0x5a37c1=>_0x5a37c1['name']===_0x156eab);let _0x51b004=contactItemTypes[_0x51a8('0x68')](_0x1fed32=>_0x1fed32[_0x51a8('0x61')]+_0x51a8('0x62')===_0x156eab);if(_[_0x51a8('0x1a')](_0x1f036b)&&_[_0x51a8('0x1a')](_0x51b004)){if(_0x53f25e['hasOwnProperty'](_0x156eab)){if(_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x156eab]]){var _0x1325ca=_[_0x51a8('0x6a')](_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x156eab]][_0x51a8('0x6b')](/"/g,'\x27'));switch(_0x156eab){case _0x51a8('0x6c'):var _0x149a40=moment(_0x1325ca,_0x51a8('0x6d'),!![]);if(_0x149a40[_0x51a8('0x6e')]()){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');}else{_0x385878[_0x51a8('0x1c')](_0x51a8('0x6f'));}break;case _0x51a8('0x70'):var _0x55b9a0=parseInt(_0x1325ca);_0x1325ca=_['isNaN'](_0x55b9a0)||_0x55b9a0<0x0||_0x55b9a0>0x4?_0x390c25?0x3:0x2:_0x55b9a0;_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');break;case _0x51a8('0x35'):var _0x156b0c=parseInt(_0x1325ca);if(_[_0x51a8('0x71')](_0x156b0c)&&_['includes'](_0xf24966,_0x156b0c)){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x156b0c+'\x22');}else{_0x385878['push'](_0x51a8('0x72'));}break;case _0x51a8('0x73'):if(isEmail(_0x1325ca)){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');}else{_0x385878[_0x51a8('0x1c')](_0x51a8('0x74'));}break;case _0x51a8('0x75'):var _0x19e12b=moment(_0x1325ca,_0x51a8('0x76'),!![]);if(_0x19e12b[_0x51a8('0x6e')]()){_0x8b9b1b['push']('\x22'+_0x1325ca+'\x22');}else{_0x385878[_0x51a8('0x1c')](_0x51a8('0x77'));}break;default:_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');}}else{switch(_0x156eab){case _0x51a8('0x78'):case'phone':_0x385878['push'](_0x156eab+_0x51a8('0x79'));break;default:_0x8b9b1b['push']('\x22\x22');}}}}else{var _0x572bea='';if(!_['isNil'](_0x1f036b)){if(!_0x283385[_0x51a8('0x7a')](_0x1f036b['id'])){for(var _0x5934ef=0x0;_0x5934ef<_0x53f25e[_0x156eab]['length'];_0x5934ef++){var _0x1325ca=_[_0x51a8('0x6a')](_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x156eab][_0x5934ef]]['replace'](/"/g,'\x27'));var _0x847b0a=phoneDescriptions[_0x51a8('0x68')](_0x43f6f0=>_0x43f6f0['itemTypeId']===_0x1f036b['id']);if(!_[_0x51a8('0x1a')](_0x847b0a)){var _0x2a0fc6=_[_0x51a8('0x6a')](_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x847b0a[_0x51a8('0x7b')]][0x0]][_0x51a8('0x6b')](/"/g,'\x27'));if(!_[_0x51a8('0x1a')](_0x2a0fc6))_0x1325ca=_0x1325ca+'§'+_0x2a0fc6;}if(_0x572bea=='')_0x572bea=_0x1325ca;else _0x572bea+='|'+_0x1325ca;}_0xb480ec[_0x51a8('0x1c')](_0x1f036b['id']+':'+_0x572bea);_0x283385[_0x1f036b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0xb480ec['join'](';')+'\x22');}if(_0x385878[_0x51a8('0x19')]){handleError(_0x934ea9[_0x51a8('0x69')][_0x5aa50d],{'code':'SystemRow','message':_0x385878[_0x51a8('0x11')]()});}else{fs[_0x51a8('0x7c')](_0x529b2f,_0x8b9b1b['join']()+'\x0a');}_0x8b9b1b=[];}if(!(stats[_0x51a8('0x7d')]%0xc8)){socket[_0x51a8('0x7e')](_0x51a8('0x7f')+_0x483a5a,stats);stats[_0x51a8('0x67')]=[];}}if(stopped){logger[_0x51a8('0x56')]('Abort\x20parser');_0x531995[_0x51a8('0x80')]();}}catch(_0x1e7f04){handleError(_0x934ea9[_0x51a8('0x69')][_0x5aa50d],{'code':_0x51a8('0x81'),'message':_0x1e7f04['message']});logger[_0x51a8('0x1f')](_0x51a8('0x82'),_0x1e7f04[_0x51a8('0x20')]);}},'complete':function(){try{var _0x37f253=[];var _0x6cd464=tempTableName;_0x37f253[_0x51a8('0x1c')](_0x51a8('0x83')+_0x6cd464+_0x51a8('0x84'));logger['info'](_0x51a8('0x85'),contactItemTypes[_0x51a8('0x19')]);var _0x5c04b4=util[_0x51a8('0xa')](_0x51a8('0x86'),_0x529b2f,_0x6cd464,_0x2efb36,_0x315231['ListId'],_0x315231[_0x51a8('0x52')]||null,NOW,NOW);if(_['isNil'](_0x53f25e['scheduledat'])){_0x5c04b4+=_0x51a8('0x87');}_0x37f253[_0x51a8('0x1c')](_0x5c04b4);BPromise[_0x51a8('0x88')](_0x37f253,handleQuery)['then'](function(_0x585d4e){BPromise[_0x51a8('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x37f253=[];for(var _0x30c1be=0x0;_0x30c1be\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 +var _0xa460=['Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','type','default','text','value','start','read','and','Contact','operator','split','contact','find','ContactId','end','Tag','tags','ids','User','$substring','user','UserId','body','plainBody','some','compact','\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','clause','filter','get','capitalize','chat','Websites','Accounts','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join'];(function(_0x51ebad,_0x1e546f){var _0x20f39f=function(_0x4e26e4){while(--_0x4e26e4){_0x51ebad['push'](_0x51ebad['shift']());}};_0x20f39f(++_0x1e546f);}(_0xa460,0xe4));var _0x0a46=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xa460[_0x3dc538];return _0x72c2fd;};'use strict';var _=require(_0x0a46('0x0'));var squel=require(_0x0a46('0x1'));var as=require(_0x0a46('0x2'));var qs=require(_0x0a46('0x3'));var updateInteraction=require(_0x0a46('0x4'))[_0x0a46('0x5')];var utils=require(_0x0a46('0x6'));var db=require(_0x0a46('0x7'))['db'];function skipInteractionsQuery(_0x352547,_0x160da8,_0x48e5aa){var _0x10b1dc=![];var _0x104127=utils[_0x0a46('0x8')](_0x352547);if(_0x160da8[_0x0a46('0x9')]===_0x0a46('0xa')&&!_0x48e5aa[_0x0a46('0xb')]&&!_0x48e5aa[_0x104127]){_0x10b1dc=!![];}return _0x10b1dc;}function getTagsQuery(){return squel[_0x0a46('0xc')]()['field']('id')[_0x0a46('0xd')](_0x0a46('0xe'))['field'](_0x0a46('0xf'))[_0x0a46('0x10')](_0x0a46('0x11'));}function getUsersQuery(_0x2a2574,_0x40457e){var _0x8e454d=utils[_0x0a46('0x12')](_0x2a2574);var _0xf6f23e=_0x0a46('0x13')+_0x2a2574+_0x0a46('0x14');var _0x4a3ab8=squel[_0x0a46('0xc')]()[_0x0a46('0xd')](_0x0a46('0x15'))['field'](_0x0a46('0x16'))[_0x0a46('0xd')](_0x0a46('0x17')+_0x8e454d)[_0x0a46('0x10')](_0xf6f23e,'ui')[_0x0a46('0x18')](_0x0a46('0x19'),'u',_0x0a46('0x1a'));if(_0x40457e[_0x0a46('0x1b')]>0x0){_0x4a3ab8[_0x0a46('0x1c')](_0x0a46('0x17')+_0x8e454d+'\x20IN\x20?',_[_0x0a46('0x1d')](_0x40457e,'id'));}return _0x4a3ab8;}function getInteractionsQuery(_0x85d4d2){var _0x10ecb1=utils[_0x0a46('0x1e')](_0x85d4d2);var _0x2a0c5b=utils[_0x0a46('0x8')](_0x85d4d2);var _0x35b9a2=utils['getInteractionFK'](_0x85d4d2);return squel[_0x0a46('0xc')]()[_0x0a46('0x10')](_0x10ecb1[_0x0a46('0x1f')],'i')[_0x0a46('0x18')](_0x0a46('0x20'),'c',_0x0a46('0x21'))[_0x0a46('0x18')](_0x0a46('0x19'),'o',_0x0a46('0x22'))['left_join'](_0x10ecb1[_0x0a46('0x23')],'a',_0x0a46('0x24')+_0x2a0c5b)[_0x0a46('0x18')](_0x10ecb1[_0x0a46('0x25')],'me',_0x0a46('0x26')+_0x35b9a2+_0x0a46('0x27'))['left_join'](_0x10ecb1['interactionsTags'],'it',_0x0a46('0x28')+_0x35b9a2+_0x0a46('0x27'))[_0x0a46('0x18')](_0x0a46('0x11'),'t',_0x0a46('0x29'));}function getSqlClauses(){var _0x242ced={'body':squel[_0x0a46('0x2a')](),'contact':squel[_0x0a46('0x2a')](),'default':squel[_0x0a46('0x2a')](),'fields':squel[_0x0a46('0x2a')](),'filter':squel['expr'](),'read':squel[_0x0a46('0x2a')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x242ced;}function parseTagParameter(_0x3bc952){var _0x26c509=squel[_0x0a46('0x2a')]();if(_0x3bc952){var _0x3fc827=utils[_0x0a46('0x2b')](_0x3bc952);_0x3fc827[_0x0a46('0x2c')](function(_0x101232){_0x26c509['or'](_0x0a46('0x2d'),'%,'+_0x101232+',%');});}return _0x26c509;}function parseReadParameter(_0x45ecb6){var _0x1796e6='';if(_0x45ecb6){_0x1796e6='unreadMessages\x20{OPERATOR}\x200';if(_0x45ecb6==='1'){_0x1796e6=_0x1796e6['replace'](_0x0a46('0x2e'),'=');}else{_0x1796e6=_0x1796e6['replace'](_0x0a46('0x2e'),'>');}}return _0x1796e6;}function parseSearchFilter(_0x34b797,_0xaf843c){var _0x36ed22=squel['expr']();if(_0xaf843c){var _0x110d66=_0xaf843c[_0x0a46('0x2f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x24098b=qs[_0x0a46('0x30')](_0x110d66);if(qs[_0x0a46('0x31')](_0x110d66)){_0x36ed22['or'](_0x0a46('0x32'),_0x24098b+'%');if([_0x0a46('0x33'),_0x0a46('0x34')][_0x0a46('0x35')](_0x34b797)){_0x36ed22['or'](_0x0a46('0x36'),_0x24098b+'%');}else if(_0x34b797===_0x0a46('0x37')){_0x36ed22['or'](_0x0a46('0x38'),_0x24098b+'%');}else if(_0x34b797===_0x0a46('0x39')){_0x36ed22['or']('i.from\x20LIKE\x20?',_0x24098b+'%');}}else if(_0x34b797===_0x0a46('0x3a')&&qs['isEmail'](_0x110d66)){_0x36ed22['or'](_0x0a46('0x3b'),_0x24098b+'%');}else{if(_0x34b797==='mail'){_0x36ed22['or'](_0x0a46('0x3c'),qs['getFullTextValue'](_0x110d66,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a46('0x3d')](_0x110d66));}else if(_0x34b797!==_0x0a46('0x37')){_0x36ed22['or'](_0x0a46('0x3e'),qs['getFullTextValue'](_0x110d66));}_0x36ed22['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a46('0x3d')](_0x110d66,!![]),null);}}return _0x36ed22;}function parseAdvancedSearchFilter(_0x1d02dd,_0x13c385){var _0x203f5d=getSqlClauses();var _0x18d96b=as[_0x0a46('0x3f')](_0x1d02dd);var _0x55050e=_0x18d96b[_0x0a46('0x40')];for(var _0x64a364=0x0;_0x64a364<_0x18d96b[_0x0a46('0x41')][_0x0a46('0x1b')];_0x64a364++){var _0x2b8ce3=_0x18d96b[_0x0a46('0x41')][_0x64a364];var _0xd8728a='i';var _0x440e27=_['find'](_0x13c385,[_0x0a46('0xe'),_0x2b8ce3[_0x0a46('0xd')]]);if(_0x440e27){var _0x347453=as[_0x0a46('0x42')](_0xd8728a,_0x440e27[_0x0a46('0x43')],_0x2b8ce3);_0x203f5d[_0x0a46('0x44')][_0x55050e](_0x347453[_0x0a46('0x45')],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453['value']['end']);}else{switch(_0x2b8ce3[_0x0a46('0xd')]){case'unreadMessages':var _0x2ed64a=parseReadParameter(_0x2b8ce3[_0x0a46('0x46')]);_0x203f5d[_0x0a46('0x48')][_0x0a46('0x49')](_0x2ed64a);break;case _0x0a46('0x4a'):if(_0x2b8ce3[_0x0a46('0x4b')]==='$substring'){if(_0x2b8ce3[_0x0a46('0x46')][_0x0a46('0x4c')]('\x20')[_0x0a46('0x1b')]>0x1){_0x203f5d[_0x0a46('0x4d')][_0x55050e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2b8ce3[_0x0a46('0x46')],!![]),null);}else{var _0x189e99='%'+_0x2b8ce3[_0x0a46('0x46')]+'%';_0x203f5d['contact'][_0x55050e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x189e99,_0x189e99,_0x189e99);}}else{_0x440e27=_[_0x0a46('0x4e')](_0x13c385,[_0x0a46('0xe'),'ContactId']);_0x2b8ce3[_0x0a46('0xd')]=_0x0a46('0x4f');_0x347453=as[_0x0a46('0x42')](_0xd8728a,_0x440e27[_0x0a46('0x43')],_0x2b8ce3);_0x203f5d['contact'][_0x55050e](_0x347453['text'],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453['value'][_0x0a46('0x50')]);}break;case _0x0a46('0x51'):var _0x3d502a=_0x2b8ce3[_0x0a46('0x46')]['split'](',')[_0x0a46('0x1d')](function(_0x268700){return Number(_0x268700);});var _0x397454=parseTagParameter(_0x3d502a);_0x203f5d[_0x0a46('0x52')]['clause']['and'](_0x397454);_0x203f5d[_0x0a46('0x52')][_0x0a46('0x53')]=_0x3d502a;break;case _0x0a46('0x54'):if(_0x2b8ce3[_0x0a46('0x4b')]===_0x0a46('0x55')){_0x203f5d[_0x0a46('0x56')][_0x55050e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x2b8ce3['value']+'%',null);}else{_0x440e27=_[_0x0a46('0x4e')](_0x13c385,[_0x0a46('0xe'),_0x0a46('0x57')]);_0x2b8ce3['field']='UserId';_0x347453=as[_0x0a46('0x42')](_0xd8728a,_0x440e27[_0x0a46('0x43')],_0x2b8ce3);_0x203f5d['user'][_0x55050e](_0x347453['text'],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453[_0x0a46('0x46')]['end']);}break;case _0x0a46('0x58'):case _0x0a46('0x59'):_0x347453=as[_0x0a46('0x42')]('me',null,_0x2b8ce3);_0x203f5d[_0x0a46('0x58')][_0x55050e](_0x347453['text'],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453[_0x0a46('0x46')]['end']);break;}}}return _0x203f5d;}function parseModelFields(_0x3e9e9a,_0x4efc52,_0x19c207){var _0x33ab3a=utils[_0x0a46('0x8')](_0x3e9e9a);var _0xb9b6bb=squel[_0x0a46('0x2a')]();var _0x4421bb=_(_0x4efc52)['keys']()['map'](function(_0x2bb9b6){return _[_0x0a46('0x5a')](_0x19c207,['name',_0x2bb9b6])?_0x2bb9b6:undefined;})[_0x0a46('0x5b')]()['value']();if(_0x4421bb['length']>0x0){_0x4421bb[_0x0a46('0x2c')](function(_0x243db3){if(_0x243db3===_0x33ab3a){_0xb9b6bb[_0x0a46('0x49')]('i.'+_0x33ab3a+_0x0a46('0x5c'),[]['concat'](_0x4efc52[_0x243db3]));}else if(_0x243db3===_0x0a46('0x5d')){var _0x4e70d1=JSON[_0x0a46('0x5e')](_0x4efc52[_0x243db3])[_0x0a46('0x5f')];var _0x7d75d1=JSON['parse'](_0x4efc52[_0x243db3])[_0x0a46('0x60')];_0xb9b6bb[_0x0a46('0x49')](_0x0a46('0x61'),_0x4e70d1,_0x7d75d1);}else{if(_0x4efc52[_0x243db3]==='null'){_0xb9b6bb['and']('i.'+_0x243db3+_0x0a46('0x62'));}else{_0xb9b6bb['and']('i.'+_0x243db3+_0x0a46('0x63'),_0x4efc52[_0x243db3]);}}});}return _0xb9b6bb;}function parseQueryParameters(_0x3d4101,_0x3502df,_0x12d9b1){var _0x1de156=getSqlClauses();return Promise[_0x0a46('0x64')]()[_0x0a46('0x65')](function(){return parseModelFields(_0x3d4101,_0x3502df,_0x12d9b1);})['then'](function(_0x4c12fc){_0x1de156[_0x0a46('0x66')][_0x0a46('0x49')](_0x4c12fc);return parseReadParameter(_0x3502df[_0x0a46('0x48')]);})[_0x0a46('0x65')](function(_0x511c72){_0x1de156[_0x0a46('0x48')][_0x0a46('0x49')](_0x511c72);return parseTagParameter(_0x3502df[_0x0a46('0x67')]);})['then'](function(_0x350fcc){_0x1de156[_0x0a46('0x52')][_0x0a46('0x68')][_0x0a46('0x49')](_0x350fcc);return parseSearchFilter(_0x3d4101,_0x3502df[_0x0a46('0x69')]);})['then'](function(_0x1d1617){_0x1de156['filter']=_0x1d1617;return _0x1de156;});}function checkAccountsRestrictions(_0x2b3c0f,_0x34265a,_0xf57446){var _0x56176b=utils['getAccountFK'](_0x2b3c0f);var _0x2c739b=_0x0a46('0x6a')+_[_0x0a46('0x6b')](_0x2b3c0f)+(_0x2b3c0f===_0x0a46('0x6c')?_0x0a46('0x6d'):_0x0a46('0x6e'));var _0x29ab85=squel[_0x0a46('0x2a')]();return Promise[_0x0a46('0x64')]()['then'](function(){if(_0xf57446[_0x0a46('0xb')]&&_0x34265a[_0x0a46('0x9')]==='agent'){return _0x34265a[_0x2c739b]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x11609f){if(_0x11609f){if(_0x11609f[_0x0a46('0x1b')]===0x0){_0x29ab85['and']('i.'+_0x56176b+_0x0a46('0x62'));}else{_0x29ab85[_0x0a46('0x49')]('i.'+_0x56176b+_0x0a46('0x5c'),_['map'](_0x11609f,'id'));}}else if(!_0xf57446[_0x56176b]){_0x29ab85[_0x0a46('0x49')]('i.'+_0x56176b+'\x20IS\x20NOT\x20NULL');}})[_0x0a46('0x65')](function(){return _0x29ab85;});}function getClosedOrderClause(_0x354291,_0x56cbdb){var _0x31ac16='';var _0x14c61e=['i.thirdDisposition',_0x0a46('0x6f'),_0x0a46('0x70')];if(_0x354291===_0x0a46('0x3a')){_0x14c61e[_0x0a46('0x71')](_0x0a46('0x72'));}if(_0x56cbdb['closed']==='0'&&_0x354291===_0x0a46('0x3a')){_0x31ac16='i.substatus';}else{if(_0x56cbdb[_0x0a46('0x73')]==='1'){_0x14c61e['shift']();}_0x31ac16=_0x0a46('0x74')+_0x14c61e[_0x0a46('0x75')](',\x20')+')';}return _0x31ac16;}function getFilteredInteractions(_0x2f65ac,_0x3839c9,_0x49d7d3,_0x16ed73){var _0x38d606=utils[_0x0a46('0x12')](_0x2f65ac);var _0x1f65d0=_[_0x0a46('0x6b')](_0x2f65ac)+_0x0a46('0x76');var _0x54de2a=[];var _0x31e2e5=getTagsQuery();var _0xe536b9={'type':db[_0x0a46('0x77')][_0x0a46('0x78')][_0x0a46('0x79')],'raw':!![]};var _0x381588=[];var _0x4abf7d=[];return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x31e2e5[_0x0a46('0x7c')](),_0xe536b9)[_0x0a46('0x65')](function(_0x403abe){_0x54de2a=_['keyBy'](_0x403abe,'id');_0xe536b9=_[_0x0a46('0x7d')](_0xe536b9,{'model':db[_0x1f65d0],'mapToModel':!![],'nest':!![]});if(_0x49d7d3[_0x0a46('0x66')]){_0x16ed73[_0x0a46('0x7e')][_0x0a46('0x2c')](function(_0x39e960){_0x3839c9['field']('i.'+_0x39e960);});}else{_0x3839c9[_0x0a46('0xd')](_0x0a46('0x7f'),_0x0a46('0x80'));_0x3839c9[_0x0a46('0xd')]('a.key',_0x0a46('0x81'));_0x3839c9['field'](_0x0a46('0x82'),_0x0a46('0x83'));if(_0x2f65ac===_0x0a46('0x3a')){_0x3839c9[_0x0a46('0xd')]('a.email',_0x0a46('0x84'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x85'),_0x0a46('0x86'));_0x3839c9['field']('i.id');_0x3839c9[_0x0a46('0xd')](_0x0a46('0x87'));_0x3839c9['field'](_0x0a46('0x88'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x89'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x8a'));_0x3839c9['field'](_0x0a46('0x8b'));_0x3839c9[_0x0a46('0xd')]('i.lastMsgAt');_0x3839c9[_0x0a46('0xd')](_0x0a46('0x8c'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x8d'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x70'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x6f'));_0x3839c9['field'](_0x0a46('0x8e'));_0x3839c9[_0x0a46('0xd')]('i.substatus');_0x3839c9['field'](_0x0a46('0x8f'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x90'));_0x3839c9['field'](_0x0a46('0x91'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x92'));}else if(_0x2f65ac===_0x0a46('0x39')){_0x3839c9[_0x0a46('0xd')](_0x0a46('0x93'),'contactName');}else{_0x3839c9[_0x0a46('0xd')](_0x0a46('0x94'),_0x0a46('0x86'));}if(_0x2f65ac!=='mail'){_0x3839c9['field'](_0x0a46('0x95'));}_0x3839c9['field'](_0x0a46('0x96'),_0x0a46('0x97'));_0x3839c9['field'](_0x0a46('0x98'),_0x0a46('0x99'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x9a'),_0x0a46('0x9b'));_0x3839c9['field'](_0x0a46('0x9c'),_0x0a46('0x9d'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x9e'),_0x0a46('0x9f'));_0x3839c9[_0x0a46('0xd')]('c.fax','Contact.fax');_0x3839c9[_0x0a46('0xd')]('o.fullname',_0x0a46('0xa0'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0xa1'),_0x0a46('0xa2'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0xa3'),'TagIds');}if(_0x16ed73['limit']){_0x3839c9[_0x0a46('0xa4')](_0x16ed73['limit']);}if(_0x16ed73['offset']){_0x3839c9['offset'](_0x16ed73[_0x0a46('0xa5')]);}return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x3839c9['toString'](),_0xe536b9);})[_0x0a46('0x65')](function(_0xaca27f){_0x381588=_0xaca27f;var _0x51c883=getUsersQuery(_0x2f65ac,_0x381588);return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x51c883[_0x0a46('0x7c')](),_0xe536b9);})['then'](function(_0x492c02){_0x4abf7d=_['groupBy'](_0x492c02,_0x38d606);if(_0x2f65ac==='mail'){return db[_0x0a46('0xa6')][_0x0a46('0xa7')]({'attributes':[_0x0a46('0xa8')],'raw':!![]});}})[_0x0a46('0x65')](function(_0x5c7335){var _0x7a33ec=_0x5c7335?_0x5c7335['enableEmailPreview']:undefined;var _0x4a15c0=_0x381588[_0x0a46('0x1d')](function(_0x4322d3){return updateInteraction(_0x4322d3,_0x54de2a,_0x4abf7d,_0x7a33ec);});return Promise[_0x0a46('0xa9')](_0x4a15c0);});}function countFilteredInteractions(_0x40006f,_0x2b3613){var _0x5d7ade=_0x40006f[_0x0a46('0xaa')]();_0x5d7ade[_0x0a46('0xd')](_0x0a46('0xab'));_0x5d7ade[_0x0a46('0xd')](_0x0a46('0x7f'),_0x0a46('0x80'));var _0xf8bd7=utils[_0x0a46('0x2b')](_0x2b3613);if(!_[_0x0a46('0xac')](_0xf8bd7)){_0x5d7ade[_0x0a46('0x1c')]('t.id\x20IN\x20?',_0xf8bd7);}var _0x99e18d={'type':db[_0x0a46('0x77')]['QueryTypes'][_0x0a46('0x79')],'raw':!![]};return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x5d7ade[_0x0a46('0x7c')](),_0x99e18d);}module['exports']={'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 dbc66ea..de6dc06 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 _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 +var _0x0461=['talking','answered','unmanaged','abandoned','total','disposition','UserId','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','../../mysqldb','map','fullname','split','waiting'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0x0461,0x193));var _0x1046=function(_0xca3a5a,_0x17c9f1){_0xca3a5a=_0xca3a5a-0x0;var _0x4403e2=_0x0461[_0xca3a5a];return _0x4403e2;};'use strict';var _=require('lodash');var db=require(_0x1046('0x0'))['db'];function getInteractionUsers(_0x28ec8c,_0x37ff6f){return new Promise(function(_0x35c743,_0x513c1f){try{var _0xf56a4=[];if(_0x37ff6f[_0x28ec8c]){_0xf56a4=_0x37ff6f[_0x28ec8c][_0x1046('0x1')](function(_0x12fd2b){return{'id':_0x12fd2b['id'],'fullname':_0x12fd2b[_0x1046('0x2')]};});}return _0x35c743(_0xf56a4);}catch(_0x55258d){_0x513c1f(_0x55258d);}});}function getInteractionTags(_0x1d0d43,_0x8b113a){var _0x2097f1=[];if(_0x1d0d43){_0x1d0d43[_0x1046('0x3')](',')['forEach'](function(_0x2565bd){_0x2097f1['push'](_0x8b113a[_0x2565bd]);});}return _0x2097f1;}function updateWaitingCounter(_0x3a03d7){if(_0x3a03d7[_0x1046('0x4')]){_0x3a03d7[_0x1046('0x4')]-=0x1;}}function updateInteractionCounters(_0xc5ea7e){_0xc5ea7e[_0x1046('0x4')]=0x0;_0xc5ea7e[_0x1046('0x5')]=0x0;_0xc5ea7e[_0x1046('0x6')]=0x0;_0xc5ea7e[_0x1046('0x7')]=0x0;_0xc5ea7e[_0x1046('0x8')]=0x0;_0xc5ea7e[_0x1046('0x9')]=0x0;if(_0xc5ea7e['closed']){if(_0xc5ea7e[_0x1046('0xa')]===_0x1046('0x8')){_0xc5ea7e[_0x1046('0x8')]+=0x1;updateWaitingCounter(_0xc5ea7e);}if(_0xc5ea7e['UserId']){_0xc5ea7e[_0x1046('0x6')]+=0x1;if(_0xc5ea7e['talking']){_0xc5ea7e[_0x1046('0x5')]-=0x1;}}else{if(_0xc5ea7e[_0x1046('0xa')]){_0xc5ea7e['unmanaged']+=0x1;updateWaitingCounter(_0xc5ea7e);}}}else{if(!_0xc5ea7e['UserId']){_0xc5ea7e[_0x1046('0x4')]+=0x1;}if(_0xc5ea7e[_0x1046('0xb')]){_0xc5ea7e[_0x1046('0x5')]+=0x1;updateWaitingCounter(_0xc5ea7e);}}_0xc5ea7e[_0x1046('0x9')]+=0x1;return _0xc5ea7e;}function getLastMessageText(_0x3d305e){return db['MailMessage'][_0x1046('0xc')]({'where':{'$and':[{'MailInteractionId':_0x3d305e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1046('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1046('0xe')],'order':_0x1046('0xf'),'raw':!![]})['then'](function(_0x5a5b0a){if(_0x5a5b0a&&_0x5a5b0a[_0x1046('0xe')]){_0x3d305e[_0x1046('0x10')]=_[_0x1046('0x11')](_0x5a5b0a[_0x1046('0xe')]);}return _0x3d305e;})[_0x1046('0x12')](function(_0x447acb){throw _0x447acb;});}exports[_0x1046('0x13')]=function(_0x3b524f,_0x16fb8c,_0x258e4a,_0xb28c1e){return new Promise(function(_0x584213,_0x243f7b){return getInteractionUsers(_0x3b524f['id'],_0x258e4a)[_0x1046('0x14')](function(_0x23c723){_0x3b524f[_0x1046('0x15')]=_0x23c723;return getInteractionTags(_0x3b524f[_0x1046('0x16')],_0x16fb8c);})[_0x1046('0x14')](function(_0x952016){_0x3b524f[_0x1046('0x17')]=_0x952016;delete _0x3b524f[_0x1046('0x16')];return updateInteractionCounters(_0x3b524f);})[_0x1046('0x14')](function(_0x1a12f6){if(_0xb28c1e){return getLastMessageText(_0x1a12f6);}else{return _0x1a12f6;}})[_0x1046('0x14')](function(_0x2aa090){_0x584213(_0x2aa090);})[_0x1046('0x12')](function(_0x5af23c){_0x243f7b(_0x5af23c);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index e66263a..df8f991 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 _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 +var _0x0e35=['../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','Interaction','findOne','then','catch','error','toLowerCase','stringify','info','MESSAGE:ACCEPT]\x20id=','\x20role=','exports','lodash','../../mysqldb'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0e35,0xc4));var _0x50e3=function(_0x2401b3,_0xbc525b){_0x2401b3=_0x2401b3-0x0;var _0x10870e=_0x0e35[_0x2401b3];return _0x10870e;};'use strict';var _=require(_0x50e3('0x0'));var db=require(_0x50e3('0x1'))['db'];var loggers={'openchannel':require(_0x50e3('0x2'))(_0x50e3('0x3')),'mail':require(_0x50e3('0x2'))(_0x50e3('0x4')),'fax':require('../../config/logger')(_0x50e3('0x5')),'sms':require(_0x50e3('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x50e3('0x6')),'whatsapp':require('../../config/logger')(_0x50e3('0x7'))};function getAccountFK(_0x11e46b){return _[_0x50e3('0x8')](_0x11e46b)+(_0x11e46b===_0x50e3('0x9')?_0x50e3('0xa'):'Account')+'Id';}function getInteractionFK(_0x4a0bf1){return _['capitalize'](_0x4a0bf1)+_0x50e3('0xb');}function getInteractionId(_0xb34531,_0x17ad35,_0x216389){if(_0xb34531&&_0xb34531[_[_0x50e3('0xc')](_0x216389)+_0x50e3('0xb')]){return _0xb34531[_['upperFirst'](_0x216389)+_0x50e3('0xb')];}else if(_0xb34531&&_0xb34531['id']){return _0xb34531['id'];}else if(_0x17ad35&&_0x17ad35['id']){return _0x17ad35['id'];}else{return _0x50e3('0xd');}}function getInteractionsTables(_0x35c685){return{'accounts':_0x35c685+'_'+(_0x35c685===_0x50e3('0x9')?_0x50e3('0xe'):_0x50e3('0xf')),'interactions':_0x35c685+_0x50e3('0x10'),'interactionsTags':_0x35c685+_0x50e3('0x11'),'messages':_0x35c685+'_messages','userInteractions':'user_has_'+_0x35c685+_0x50e3('0x10')};}function getSelectedTags(_0x2765a2){var _0x448348=[];if(_0x2765a2){_0x448348=Array['isArray'](_0x2765a2)?_0x2765a2:[_0x2765a2];}return _0x448348;}function log(_0x4cc3cd,_0x50ecf3,_0x3527f3,_0x220a9b,_0x9b2090,_0x2a45df){loggers[_0x9b2090['toLowerCase']()][_0x4cc3cd](_0x50e3('0x12'),_0x2a45df[_0x50e3('0x13')](),_0x50ecf3?_0x50ecf3['id']:null,_0x50ecf3?_0x50ecf3['name']:null,_0x50ecf3?_0x50ecf3[_0x50e3('0x14')]:null,getInteractionId(_0x3527f3,_0x220a9b,_0x9b2090),_0x3527f3?JSON['stringify'](_0x3527f3):_0x50e3('0x15'));}function updateUser(_0x5aee3d,_0x1f6338,_0x52d4ce,_0x579e2d,_0x248cd0){db[_['upperFirst'](_0x579e2d)+_0x50e3('0x16')][_0x50e3('0x17')]({'where':{'id':getInteractionId(_0x1f6338,_0x52d4ce,_0x579e2d)}})[_0x50e3('0x18')](function(_0x335bbc){if(_0x335bbc){return _0x335bbc['update']({'UserId':_0x5aee3d?_0x5aee3d['id']:null});}})[_0x50e3('0x18')](function(_0x2d9dad){if(_0x2d9dad){log('info',_0x5aee3d,_0x1f6338,_0x52d4ce,_0x579e2d,_0x248cd0);}})[_0x50e3('0x19')](function(){log(_0x50e3('0x1a'),_0x5aee3d,_0x1f6338,_0x52d4ce,_0x579e2d,_0x248cd0);});}function logAcceptMessage(_0x4743b8,_0x2f1890,_0x1cc3c3,_0x53975d){var _0x2dc7bf=loggers[_0x4743b8[_0x50e3('0x1b')]()];var _0x123bcb=_0x2f1890['id'];var _0x1432ef=_0x2f1890['name'];var _0x219704=_0x2f1890['role'];var _0x33ee50=JSON[_0x50e3('0x1c')](_0x53975d||null);_0x2dc7bf[_0x50e3('0x1d')]('['+_0x4743b8[_0x50e3('0x13')]()+_0x50e3('0x1e')+_0x123bcb+'\x20name='+_0x1432ef+_0x50e3('0x1f')+_0x219704+'\x20interaction='+_0x1cc3c3+'\x20body='+_0x33ee50);}module[_0x50e3('0x20')]={'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 2d53b1b..dde3741 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 _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 +var _0x505d=['status','format','catch','User','admin','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','base64','final','License','findOne','then'];(function(_0x48fa19,_0x449238){var _0x3bacdf=function(_0x2b7979){while(--_0x2b7979){_0x48fa19['push'](_0x48fa19['shift']());}};_0x3bacdf(++_0x449238);}(_0x505d,0x93));var _0xd505=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x505d[_0x3c4f1f];return _0x19cb69;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xd505('0x0'));var db=require(_0xd505('0x1'))['db'];var config=require(_0xd505('0x2'));function getValueFromLicense(_0x19ea83,_0x217d1b){if(_0x19ea83&&_0x217d1b){if(_0x217d1b['data1']&&_0x217d1b[_0xd505('0x3')]){var _0x8d7475=_0x217d1b[_0xd505('0x4')];var _0x1bd434=_0x217d1b['license'];var _0x3a2863=_0x8d7475['split']('-')[0x4];var _0x2bc4e7=_0x8d7475[_0xd505('0x5')]('-')[0x0];var _0x543c42=crypto[_0xd505('0x6')](_0xd505('0x7'),util['format']('%s:%s:%s',_0x3a2863,_0x8d7475,_0x2bc4e7));var _0x378dd2=_0x543c42['update'](_0x1bd434,_0xd505('0x8'),'utf8');_0x378dd2+=_0x543c42[_0xd505('0x9')]('utf8');var _0x2bb3d8=JSON['parse'](_0x378dd2);return _0x2bb3d8['hasOwnProperty'](_0x19ea83)?_0x2bb3d8[_0x19ea83]:null;}}return null;}function isLimit(_0x5a4179,_0x40d201,_0x52eafa,_0x477f1b){var _0x2a292e=_0x40d201;return compose()['use'](function(_0x47a6ab,_0x712b99,_0x39cd89){return db[_0xd505('0xa')][_0xd505('0xb')]({'where':{'id':0x1},'raw':!![]})[_0xd505('0xc')](function(_0xe9bea6){var _0x366df6=getValueFromLicense(_0x5a4179,_0xe9bea6);return _0x366df6?_0x366df6:_0x2a292e;})[_0xd505('0xc')](function(_0x20088a){_0x2a292e=_0x20088a;return _0x52eafa['count'](_0x477f1b);})[_0xd505('0xc')](function(_0xf71091){if(_0xf71091>=_0x2a292e){return _0x712b99[_0xd505('0xd')](0x193)['json']({'message':util[_0xd505('0xe')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5a4179)});}_0x39cd89();})[_0xd505('0xf')](function(_0x3b03cb){_0x39cd89(_0x3b03cb);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xd505('0x10')],{'where':{'$or':[{'role':_0xd505('0x11')},{'role':_0xd505('0x12')}]}});}exports[_0xd505('0x13')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 30fee4e..168af69 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 _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 +var _0x4dbd=['slice','forEach','split','match','filter','map','push','buildExpression','DATE','$eq','$between','value','includes','$gt','operator','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','start','shift','pop','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','and','length'];(function(_0x27e952,_0x3578f2){var _0x3c1811=function(_0x53e445){while(--_0x53e445){_0x27e952['push'](_0x27e952['shift']());}};_0x3c1811(++_0x3578f2);}(_0x4dbd,0x165));var _0xd4db=function(_0x4ac301,_0x117c0b){_0x4ac301=_0x4ac301-0x0;var _0x5321b3=_0x4dbd[_0x4ac301];return _0x5321b3;};'use strict';var _=require(_0xd4db('0x0'));var moment=require(_0xd4db('0x1'));exports[_0xd4db('0x2')]=function(_0x89f280){var _0x4dba41={'conditions':[]};_0x4dba41[_0xd4db('0x3')]=_[_0xd4db('0x4')](_0x89f280,'[$or]')?'or':_0xd4db('0x5');var _0x1e8b63=_0x89f280['replace']('[$and]','')['replace']('[$or]','')['split']('||');for(var _0x4ede2f=0x0;_0x4ede2f<_0x1e8b63[_0xd4db('0x6')];_0x4ede2f++){var _0x5705b0=_0x1e8b63[_0x4ede2f]['split'](':=');var _0x4ee4fb=_0x5705b0[0x0];var _0x4ea174=_0x5705b0[_0xd4db('0x7')](0x1);_0x4ea174[_0xd4db('0x8')](function(_0x4c47b5){var _0x3a0333=_0x4c47b5[_0xd4db('0x9')]('[')['shift']();var _0x3800be=_0x4c47b5[_0xd4db('0xa')](/\[(.*?)\]/g);_0x3800be['forEach'](function(_0x41e972){var _0x5f5860=_0x41e972[_0xd4db('0x9')]('[')[_0xd4db('0xb')](function(_0x34657e){return _0x34657e['indexOf'](']')>-0x1;})[_0xd4db('0xc')](function(_0x504011){return _0x504011[_0xd4db('0x9')](']')[0x0];})[0x0];_0x4dba41['conditions'][_0xd4db('0xd')]({'field':_0x4ee4fb,'operator':_0x3a0333,'value':_0x5f5860});});});}return _0x4dba41;};exports[_0xd4db('0xe')]=function(_0x51695f,_0x2090d1,_0x215113){var _0x1efb1d={};if(_0x2090d1===_0xd4db('0xf')){if(_0x215113['operator']===_0xd4db('0x10')){_0x215113['operator']=_0xd4db('0x11');_0x215113['value']+=','+_0x215113[_0xd4db('0x12')];}else if(_[_0xd4db('0x13')]([_0xd4db('0x14'),'$lte'],_0x215113[_0xd4db('0x15')])){_0x215113[_0xd4db('0x12')]=moment(_0x215113[_0xd4db('0x12')])[_0xd4db('0x16')](0x1,'days')[_0xd4db('0x17')](_0xd4db('0x18'));}}if(_0x215113[_0xd4db('0x19')]){_0x2090d1=_0x215113['castTo'];_0x1efb1d[_0xd4db('0x1a')]=_0xd4db('0x1b')+_0x51695f+'.'+_0x215113[_0xd4db('0x1c')]+_0xd4db('0x1d')+_0x215113[_0xd4db('0x19')]+')\x20'+parseOperator(_0x215113[_0xd4db('0x15')]);}else{_0x1efb1d[_0xd4db('0x1a')]=_0x51695f+'.'+_0x215113['field']+'\x20'+parseOperator(_0x215113[_0xd4db('0x15')]);}if(_['includes']([_0xd4db('0x1e'),_0xd4db('0x1f')],_0x215113[_0xd4db('0x15')]))_0x1efb1d[_0xd4db('0x1a')]='('+_0x1efb1d[_0xd4db('0x1a')]+_0xd4db('0x20')+_0x51695f+'.'+_0x215113['field']+_0xd4db('0x21');_0x1efb1d[_0xd4db('0x12')]=parseValue(_0x2090d1,_0x215113[_0xd4db('0x15')],_0x215113[_0xd4db('0x12')]);return _0x1efb1d;};function parseOperator(_0x3a3866){var _0xe20add;switch(_0x3a3866){case _0xd4db('0x22'):_0xe20add=_0xd4db('0x23');break;case _0xd4db('0x1f'):_0xe20add=_0xd4db('0x24');break;case'$eq':_0xe20add='=\x20?';break;case _0xd4db('0x1e'):_0xe20add=_0xd4db('0x25');break;case _0xd4db('0x26'):case _0xd4db('0x27'):case _0xd4db('0x28'):_0xe20add=_0xd4db('0x29');break;case _0xd4db('0x2a'):_0xe20add=_0xd4db('0x2b');break;case'$gt':_0xe20add=_0xd4db('0x2c');break;case'$lte':_0xe20add='<=\x20?';break;case _0xd4db('0x2d'):_0xe20add='>=\x20?';break;case'$between':_0xe20add='BETWEEN\x20?\x20AND\x20?';break;}return _0xe20add;}function parseValue(_0x52185e,_0x4afad0,_0x2e9794){var _0x5369f2={'start':undefined,'end':undefined};switch(_0x4afad0){case _0xd4db('0x22'):case _0xd4db('0x1f'):_0x5369f2[_0xd4db('0x2e')]=_0x2e9794[_0xd4db('0x9')](',');break;case _0xd4db('0x26'):_0x5369f2[_0xd4db('0x2e')]='%'+_0x2e9794+'%';break;case _0xd4db('0x27'):_0x5369f2[_0xd4db('0x2e')]=_0x2e9794+'%';break;case _0xd4db('0x28'):_0x5369f2[_0xd4db('0x2e')]='%'+_0x2e9794;break;case _0xd4db('0x11'):var _0x52c550=_0x2e9794['split'](',');var _0x2e9794=_0x52c550[_0xd4db('0x2f')]();var _0x23f2ea=_0x52c550[_0xd4db('0x30')]();if(_0x52185e===_0xd4db('0xf')){_0x2e9794=moment(_0x2e9794)[_0xd4db('0x31')](0x0,!![])[_0xd4db('0x17')]();_0x23f2ea=moment(_0x23f2ea)[_0xd4db('0x31')](0x0,!![])[_0xd4db('0x16')](0x17,_0xd4db('0x32'))['add'](0x3b,_0xd4db('0x33'))[_0xd4db('0x16')](0x3b,'seconds')[_0xd4db('0x17')]();}_0x5369f2={'start':_0x2e9794,'end':_0x23f2ea};break;default:_0x5369f2['start']=_0x2e9794;break;}return _0x5369f2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6c82e42..818cdad 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 _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 +var _0x5253=['includes','parse','model','alias','fields','raw','filters','isEmpty','forOwn','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isString','unset','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','join','getOptions','query','$id','attributes','intersection','hasOwnProperty','nolimit','where','pick','filter','columns','value','merge','type','lower','include','escapeLIKESpecialChars','sequelize','moment','../../mysqldb','keys'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0x5253,0x7a));var _0x3525=function(_0x486cdd,_0x42fe40){_0x486cdd=_0x486cdd-0x0;var _0x933640=_0x5253[_0x486cdd];return _0x933640;};'use strict';var _=require('lodash');var sequelize=require(_0x3525('0x0'));var moment=require(_0x3525('0x1'));var db=require(_0x3525('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2fb95b){var _0x461b23=['ne'];try{var _0x246f1c=JSON['parse'](_0x2fb95b);var _0x3f1555=Object[_0x3525('0x3')](_0x246f1c)[0x0];return _0x461b23[_0x3525('0x4')](_0x3f1555);}catch(_0x4c292e){return![];}}function getOperatorValue(_0x566b91){var _0x5c358a=JSON[_0x3525('0x5')](_0x566b91);var _0x3d6e11=Object['keys'](_0x5c358a)[0x0];var _0x3e480a=_0x5c358a[_0x3d6e11];return{['$'+_0x3d6e11]:_0x3e480a};}function parseIncludeModel(_0x577fc6){var _0x180d6b=JSON['parse'](_0x577fc6);return{'model':db[_0x180d6b[_0x3525('0x6')]],'as':_0x180d6b[_0x3525('0x7')],'attributes':_0x180d6b[_0x3525('0x8')],'raw':_0x180d6b[_0x3525('0x9')]};}exports['fields']=function(_0x2cf5c6){var _0x3f2ba4=null;if(_0x2cf5c6){_0x3f2ba4=_0x2cf5c6['split'](',');}return _0x3f2ba4;};exports[_0x3525('0xa')]=function(_0x387c88,_0xf09d17){var _0x26e28a={};if(!_[_0x3525('0xb')](_0x387c88)){_[_0x3525('0xc')](_0x387c88,function(_0x48676f,_0x2f7137){try{if(_0xf09d17){var _0x257a2a=_['find'](_0xf09d17,{'name':_0x2f7137})||{};if(hasSequelizeOperator(_0x48676f)){_0x26e28a[_0x2f7137]=getOperatorValue(_0x48676f);}else if(_0x257a2a['type']==='DATE'&&_[_0x3525('0xd')](_0x48676f)){var _0xe62b73=JSON['parse'](_0x48676f);var _0x3267a9={'$gte':moment(moment(_0xe62b73['$gte'])[_0x3525('0xe')](_0x3525('0xf')))[_0x3525('0x10')]()[_0x3525('0xe')](),'$lte':moment(moment(_0xe62b73[_0x3525('0x11')])['format'](_0x3525('0xf')))[_0x3525('0x10')]()[_0x3525('0x12')](0x1,'s')['format']()};_0x26e28a[_0x2f7137]=_0x3267a9;}else if(_0x257a2a[_0x3525('0x13')]==='uniqueid'){_0x26e28a[_0x2f7137]=_0x48676f;}else{_0x26e28a[_0x2f7137]=_['isArray'](_0x48676f)?_0x48676f:JSON[_0x3525('0x5')](_0x48676f);}}else{_0x26e28a[_0x2f7137]=_[_0x3525('0x14')](_0x48676f)?_0x48676f:JSON[_0x3525('0x5')](_0x48676f);}}catch(_0x800747){_0x26e28a[_0x2f7137]=_0x48676f[_0x3525('0x15')](',');}});}return _0x26e28a;};exports[_0x3525('0x16')]=function(_0x520454){_0x520454=parseInt(_0x520454,0xa);if(!_0x520454||_0x520454<0x0){_0x520454=LIMIT_VALUE;}return _0x520454;};exports[_0x3525('0x17')]=function(_0x26db75){_0x26db75=parseInt(_0x26db75,0xa);if(!_0x26db75||_0x26db75<0x0){_0x26db75=0x0;}return _0x26db75;};exports[_0x3525('0x18')]=function(_0x41eb70){var _0x1bfd21,_0x42e010=null;if(_0x41eb70){_0x1bfd21=_0x41eb70[_0x3525('0x15')](',');_0x42e010=_[_0x3525('0x19')](_0x1bfd21,function(_0x346167){if(_0x346167[_0x3525('0x1a')]('-')===0x0){return[_0x346167===_0x3525('0x1b')?sequelize[_0x3525('0x1c')](sequelize[_0x3525('0x1d')]('priority'),_0x3525('0x1e')):_0x346167[_0x3525('0x1f')](0x1),_0x3525('0x20')];}else{return[_0x346167===_0x3525('0x1b')?sequelize[_0x3525('0x1c')](sequelize[_0x3525('0x1d')](_0x3525('0x1b')),_0x3525('0x1e')):_0x346167,_0x3525('0x21')];}});}return _0x42e010;};exports[_0x3525('0x22')]=function(_0x47fb20,_0x468e03){if(_[_0x3525('0xb')](_0x47fb20)){return _0x47fb20;}if(_[_0x3525('0x14')](_0x47fb20)){for(var _0x1c756a=0x0;_0x1c756a<_0x47fb20['length'];_0x1c756a+=0x1){_0x47fb20[_0x1c756a]=this[_0x3525('0x22')](_0x47fb20[_0x1c756a],_0x468e03);}return _0x47fb20;}if(!_['isObject'](_0x47fb20)){return _0x47fb20;}if(_[_0x3525('0x23')](_0x468e03)){_0x468e03=[_0x468e03];}if(!_[_0x3525('0x14')](_0x468e03)){return _0x47fb20;}for(var _0x41d5fe=0x0;_0x41d5fe<_0x468e03['length'];_0x41d5fe+=0x1){_[_0x3525('0x24')](_0x47fb20,_0x468e03[_0x41d5fe]);}for(var _0x33a6a2 in _0x47fb20){if(_0x47fb20['hasOwnProperty'](_0x33a6a2)){_0x47fb20[_0x33a6a2]=this['omit'](_0x47fb20[_0x33a6a2],_0x468e03);}}return _0x47fb20;};exports['isNumeric']=function(_0x4f2dff){return _0x4f2dff[_0x3525('0x25')](RegExp(_0x3525('0x26')))?!![]:![];};exports[_0x3525('0x27')]=function(_0x399073){return _0x399073['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x3525('0x28')]=function(_0x58d31f,_0x45cdfb){var _0x37c756=[];var _0x9d29fd=/([^:]")"+/g;var _0x1a8d81=/[*<>~@-]/g;var _0x5dfcce=/[ `!@#$%^&*()_\-?~<>]/;var _0x1e2462=/[ ,]+/;var _0x45533c=_0x45cdfb?_0x3525('0x29'):_0x3525('0x2a');if(_0x45cdfb){_0x58d31f=_0x58d31f[_0x3525('0x2b')](_0x1a8d81,'\x20')['trim']();}_0x58d31f[_0x3525('0x15')](_0x1e2462)['forEach'](function(_0x47b38b){_0x47b38b=_0x47b38b[_0x3525('0x2b')](_0x9d29fd,'$1');_0x47b38b='+'+_0x47b38b+'*';var _0x4f2d21=_0x47b38b[_0x3525('0x25')](_0x5dfcce);if(_0x4f2d21){_0x47b38b='\x22'+_0x47b38b+'\x22';}_0x37c756[_0x3525('0x2c')](_0x47b38b);});_0x45533c=_0x45533c[_0x3525('0x2b')]('{EXPR}',_0x37c756[_0x3525('0x2d')]('\x20'));return _0x45533c;};exports[_0x3525('0x2e')]=function(_0x19b10f,_0x14a1e1,_0x2c7346){var _0x625a5e={},_0x1bb7ec={};if(_0x14a1e1[_0x3525('0x2f')][_0x3525('0x30')]){_0x14a1e1[_0x3525('0x2f')]['id']=_0x14a1e1[_0x3525('0x2f')][_0x3525('0x30')];delete _0x14a1e1[_0x3525('0x2f')][_0x3525('0x30')];}_0x625a5e[_0x3525('0x6')]=_[_0x3525('0x19')](_0x19b10f,_0x3525('0x13'));_0x625a5e[_0x3525('0x2f')]=_[_0x3525('0x3')](_0x14a1e1[_0x3525('0x2f')]);_0x625a5e['filters']=_['intersection'](_0x625a5e[_0x3525('0x6')],_0x625a5e[_0x3525('0x2f')]);_0x1bb7ec[_0x3525('0x31')]=_[_0x3525('0x32')](_0x625a5e['model'],this[_0x3525('0x8')](_0x14a1e1[_0x3525('0x2f')][_0x3525('0x8')]));_0x1bb7ec[_0x3525('0x31')]=_0x1bb7ec[_0x3525('0x31')]['length']?_0x1bb7ec[_0x3525('0x31')]:_0x625a5e[_0x3525('0x6')];if(!_0x14a1e1[_0x3525('0x2f')][_0x3525('0x33')](_0x3525('0x34'))){_0x1bb7ec[_0x3525('0x16')]=this[_0x3525('0x16')](_0x14a1e1['query'][_0x3525('0x16')]);_0x1bb7ec[_0x3525('0x17')]=this[_0x3525('0x17')](_0x14a1e1[_0x3525('0x2f')]['offset']);}_0x1bb7ec['order']=this[_0x3525('0x18')](_0x14a1e1[_0x3525('0x2f')]['sort']);_0x1bb7ec[_0x3525('0x35')]=this['filters'](_[_0x3525('0x36')](_0x14a1e1[_0x3525('0x2f')],_0x625a5e[_0x3525('0xa')]),_0x19b10f);if(_0x14a1e1[_0x3525('0x2f')][_0x3525('0x37')]){var _0x7896d3=_0x19b10f;var _0x15e373=_0x14a1e1[_0x3525('0x2f')][_0x3525('0x37')];if(typeof _0x15e373==='object'){_0x7896d3=_[_0x3525('0x37')](_0x19b10f,function(_0x323b4c){return _[_0x3525('0x4')](_0x15e373[_0x3525('0x38')],_0x323b4c[_0x3525('0x13')]);});_0x15e373=_0x15e373[_0x3525('0x39')];}_0x1bb7ec[_0x3525('0x35')]=_[_0x3525('0x3a')](_0x1bb7ec[_0x3525('0x35')],{'$or':_[_0x3525('0x19')](_0x7896d3,function(_0x193089){if(_0x193089[_0x3525('0x3b')]!=='VIRTUAL'){if(_0x2c7346){return sequelize[_0x3525('0x35')](sequelize['fn'](_0x3525('0x3c'),sequelize[_0x3525('0x1d')](_0x193089[_0x3525('0x13')])),{'$like':sequelize['fn'](_0x3525('0x3c'),'%'+_0x14a1e1[_0x3525('0x2f')]['filter']+'%')});}else{var _0x386a84={};_0x386a84[_0x193089[_0x3525('0x13')]]={'$like':'%'+_0x14a1e1[_0x3525('0x2f')][_0x3525('0x37')]+'%'};return _0x386a84;}}})});}_0x1bb7ec=_[_0x3525('0x3a')]({},_0x1bb7ec,_0x14a1e1['options']);return _0x1bb7ec;};exports[_0x3525('0x3d')]=function(_0x18f33d){var _0x61fbf9=[];if(_0x18f33d['includeAll']){_0x61fbf9[_0x3525('0x2c')]({'all':!![]});}else if(_0x18f33d[_0x3525('0x3d')]){if(Array[_0x3525('0x14')](_0x18f33d[_0x3525('0x3d')])){_0x61fbf9=Object[_0x3525('0x3')](_0x18f33d[_0x3525('0x3d')])[_0x3525('0x19')](function(_0x2f20c0){return parseIncludeModel(_0x18f33d[_0x3525('0x3d')][_0x2f20c0]);});}else{var _0x71ab74=parseIncludeModel(_0x18f33d[_0x3525('0x3d')]);_0x61fbf9[_0x3525('0x2c')](_0x71ab74);}}return _0x61fbf9;};exports[_0x3525('0x3e')]=function(_0x375b52){return _0x375b52['replace'](/[%_^-]/g,function(_0xc8afff){return'\x5c'+_0xc8afff;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 14512ea..dd51ee1 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 _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 +var _0x753c=['globalStatus','getSortedAgentsIdsByStatus','split','fields','includes','startsWith','DESC','ASC','internal','substring','indexOf','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatus','mailStatus','smsStatus','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','lastPauseAt','chatStatusTime','faxStatusTime','smsStatusTime','faxCurrentCapacity','screenrecording','getRealtimeAgentsQueryFields','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','faxStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','User','findAll','name','fullname','find'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x753c,0x96));var _0xc753=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x753c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var jayson=require(_0xc753('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xc753('0x1')][_0xc753('0x2')]({'port':0x232a});var routingClient=jayson[_0xc753('0x1')][_0xc753('0x2')]({'port':0x232c});function isAgentPaused(_0x3f5dc4,_0x44ff14){var _0x3990bd=[_0x3f5dc4[_0xc753('0x3')],_0x3f5dc4[_0xc753('0x4')],_0x3f5dc4[_0xc753('0x5')],_0x3f5dc4[_0xc753('0x6')],_0x3f5dc4[_0xc753('0x7')],_0x3f5dc4[_0xc753('0x8')],_0x3f5dc4[_0xc753('0x9')]];if(!_0x44ff14)return _[_0xc753('0xa')](_0x3990bd);var _0x3866e8=_[_0xc753('0xb')](_0x3990bd);return _0x3866e8[_0xc753('0xc')]>0x0&&_0x3866e8[_0xc753('0xc')]<_0x3990bd[_0xc753('0xc')]?!![]:![];}function isIdle(_0x1fe61c){return _0x1fe61c===_0xc753('0xd')||_0x1fe61c===_0xc753('0xe')||_0x1fe61c===_0xc753('0xf')||_0x1fe61c==='ringing'||_[_0xc753('0x10')](_0x1fe61c);}function isAgentIdle(_0x366591){if(_0x366591['voiceStatus']!==_0xc753('0xd')&&_0x366591['voicePause']){_0x366591[_0xc753('0x11')]=_0xc753('0x12');return![];}return _[_0xc753('0xa')]([_0x366591['chatStatus'],_0x366591[_0xc753('0x13')],_0x366591['mailStatus'],_0x366591[_0xc753('0x14')],_0x366591['smsStatus'],_0x366591[_0xc753('0x11')],_0x366591[_0xc753('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xc753('0x16')](_0xc753('0x17'),{})[_0xc753('0x18')](function(_0x4fae9f){if(_0x4fae9f[_0xc753('0x19')]){throw new Error(_0xc753('0x1a'));}var _0x1f94f9=_0x4fae9f[_0xc753('0x1b')];return routingClient[_0xc753('0x16')](_0xc753('0x17'),{})[_0xc753('0x18')](function(_0x387fbf){if(_0x387fbf['error']){throw new Error(_0xc753('0x1c'));}var _0x3feebb=_0x387fbf[_0xc753('0x1b')];return _[_0xc753('0x1d')]({},_0x1f94f9,_0x3feebb);});})[_0xc753('0x1e')](function(_0xc612dc){throw _0xc612dc;});}exports[_0xc753('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x42a222){var _0xaf6367=_0xc753('0xe');if(isAgentPaused(_0x42a222))_0xaf6367=_0xc753('0x12');else if(isAgentPaused(_0x42a222,!![]))_0xaf6367=_0xc753('0x20');else if(isAgentIdle(_0x42a222))_0xaf6367=_0xc753('0xd');else _0xaf6367=_0xc753('0x21');return _0xaf6367;}exports[_0xc753('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x9899e6,_0x4f167b){var _0x2c04d4=_[_0xc753('0x23')](_0x9899e6)?_0x9899e6:[_0x9899e6];var _0x5158ee=_['startCase'](_0x4f167b)+_0xc753('0x24');var _0x3aeda8=_[_0xc753('0x25')](_0x2c04d4,function(_0x22b06a){return db[_0x5158ee][_0xc753('0x26')]({'where':{'id':_0x22b06a}})['then'](function(_0x3521ba){if(!_0x3521ba)return[];return _0x3521ba[_0xc753('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc753('0x28')](_0x3aeda8)[_0xc753('0x18')](function(_0x1ede62){var _0x4d6cf4=_(_0x1ede62)[_0xc753('0x29')]()['map']('id')[_0xc753('0x2a')]()[_0xc753('0x2b')]();return _0x4d6cf4;});}exports[_0xc753('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2f5c9f,_0x51b460,_0x209bbb){try{if(_0x51b460[_0xc753('0xc')]>0x0){_0x2f5c9f=_0x2f5c9f['filter'](function(_0x20bf00){return _0x51b460['includes'](_0x20bf00['id']);});}var _0xed387e=_0x2f5c9f['filter'](function(_0x5ec317){var _0x32c188=_0xc753('0x21');if(isAgentIdle(_0x5ec317)){_0x32c188='idle';}return _0x32c188===_0x209bbb;});return _[_0xc753('0x25')](_0xed387e,'id');}catch(_0x86cb0d){throw _0x86cb0d;}}exports[_0xc753('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x207c85,_0x3af826,_0x49691d){return Promise[_0xc753('0x2e')]()['then'](function(){if(_0x3af826[_0xc753('0xc')]>0x0){_0x207c85=_0x207c85[_0xc753('0xb')](function(_0x35e1f0){return _0x3af826['includes'](_0x35e1f0['id']);});}return _0x207c85;})[_0xc753('0x18')](function(){return db[_0xc753('0x2f')][_0xc753('0x30')]({'attributes':['id',_0xc753('0x31'),_0xc753('0x32'),_0xc753('0x3'),_0xc753('0x4'),_0xc753('0x5'),'openchannelPause',_0xc753('0x7'),_0xc753('0x8'),_0xc753('0x9'),'pauseType'],'where':{'id':{'$in':_[_0xc753('0x25')](_0x207c85,'id')}},'raw':!![]});})['then'](function(_0x197224){return _0x197224[_0xc753('0x25')](function(_0x32397e){var _0x213dc4=_[_0xc753('0x33')](_0x207c85,['id',_0x32397e['id']]);var _0x3b11d1=filterAgentAttributes(_0x213dc4);_[_0xc753('0x1d')](_0x32397e,_0x3b11d1);_0x32397e[_0xc753('0x34')]=getAgentStatus(_0x32397e);return _0x32397e;});})[_0xc753('0x18')](function(_0x551b5c){var _0x1f4afd=sortAgentsByStatus(_0x551b5c,_0x49691d);return _['map'](_0x1f4afd,'id');})['catch'](function(_0x1c5925){throw _0x1c5925;});}exports[_0xc753('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5e32e4){var _0x376cb9={'fields':[],'order':null};var _0x344d49=_0x5e32e4[_0xc753('0x36')](',');_0x376cb9[_0xc753('0x37')]=_[_0xc753('0xb')](_0x344d49,function(_0x1b164d){if(!_0x1b164d[_0xc753('0x38')]('globalStatus')){return!![];}_0x376cb9['order']=_[_0xc753('0x39')](_0x1b164d,'-')?_0xc753('0x3a'):_0xc753('0x3b');return![];});return _0x376cb9;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x4fa6bc){if(!_0x4fa6bc){_0x4fa6bc='fullname,internal';}if(_0x4fa6bc[_0xc753('0x38')](_0xc753('0x32'))&&!_0x4fa6bc[_0xc753('0x38')](_0xc753('0x3c'))){var _0x4907bf=_0x4fa6bc[_0xc753('0x3d')](0x0,_0x4fa6bc[_0xc753('0x3e')](_0xc753('0x32')));_0x4fa6bc+=','+_0x4907bf+'internal';}return _0x4fa6bc;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x259238,_0x8ce6a4){var _0x211f59=_0x259238[_0xc753('0x3f')](function(_0x4bf6f1,_0x4daaef){if(_0x4bf6f1[_0xc753('0x34')]===_0x4daaef['globalStatus']){if(_0x4bf6f1[_0xc753('0x34')]===_0xc753('0x12')){if(_0x8ce6a4===_0xc753('0x3a')){return(_0x4bf6f1[_0xc753('0x40')]||'')<(_0x4daaef[_0xc753('0x40')]||'')||_0x4bf6f1['fullname'][_0xc753('0x41')]()>_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?0x1:-0x1;}else{return(_0x4bf6f1[_0xc753('0x40')]||'')<(_0x4daaef[_0xc753('0x40')]||'')||_0x4bf6f1[_0xc753('0x32')]['toLowerCase']()>_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?-0x1:0x1;}}else{if(_0x8ce6a4===_0xc753('0x3a')){return _0x4bf6f1[_0xc753('0x32')][_0xc753('0x41')]()<_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?0x1:-0x1;}else{return _0x4bf6f1[_0xc753('0x32')]['toLowerCase']()<_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?-0x1:0x1;}}}else{if(_0x8ce6a4===_0xc753('0x3a')){return _0x4bf6f1[_0xc753('0x34')]<_0x4daaef['globalStatus']?0x1:-0x1;}else{return _0x4bf6f1[_0xc753('0x34')]<_0x4daaef[_0xc753('0x34')]?-0x1:0x1;}}});return _0x211f59;}exports[_0xc753('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x11b1a3){var _0x50013a=[_0xc753('0x43'),'online',_0xc753('0x44'),'lastPauseAt','pauseType','lastPauseAt',_0xc753('0x3c'),_0xc753('0x45'),_0xc753('0x3'),_0xc753('0x6'),_0xc753('0x5'),_0xc753('0x7'),_0xc753('0x9'),_0xc753('0x4'),'voicePause',_0xc753('0x46'),_0xc753('0x47'),_0xc753('0x48'),_0xc753('0x49'),_0xc753('0x4a'),_0xc753('0x4b'),'chatCurrentCapacity','openchannelCurrentCapacity',_0xc753('0x4c'),_0xc753('0x4d'),_0xc753('0x4e'),'faxCurrentCapacity',_0xc753('0x4f'),_0xc753('0x14'),_0xc753('0x50'),_0xc753('0x51'),'whatsappStatus',_0xc753('0x13'),_0xc753('0x11'),'chatStatusTime',_0xc753('0x52'),_0xc753('0x53'),'smsStatusTime',_0xc753('0x54'),'faxStatusTime',_0xc753('0x55'),_0xc753('0x56'),_0xc753('0x57'),'screenrecording',_0xc753('0x58'),_0xc753('0x59')];var _0x1eebf0=[_0xc753('0x3'),'openchannelPause',_0xc753('0x5'),_0xc753('0x7'),_0xc753('0x9'),_0xc753('0x4'),_0xc753('0x8'),_0xc753('0x5a')];var _0x33c085=_(_0x11b1a3)[_0xc753('0x5b')](_0x1eebf0)[_0xc753('0x5c')](_0x50013a)['value']();return _0x33c085;}exports[_0xc753('0x5d')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xc753('0x32'),'role',_0xc753('0x3c'),'online',_0xc753('0x34'),'userpic',_0xc753('0x44'),_0xc753('0x40'),_0xc753('0x5e'),_0xc753('0x4'),_0xc753('0x3'),_0xc753('0x5'),_0xc753('0x6'),_0xc753('0x7'),'voicePause','whatsappPause',_0xc753('0x4f'),_0xc753('0x13'),_0xc753('0x50'),_0xc753('0x14'),_0xc753('0x51'),'voiceStatus',_0xc753('0x15'),_0xc753('0x5f'),_0xc753('0x60'),'mailStatusTime',_0xc753('0x52'),_0xc753('0x61'),_0xc753('0x55'),'whatsappStatusTime',_0xc753('0x46'),_0xc753('0x4b'),_0xc753('0x48'),_0xc753('0x47'),_0xc753('0x49'),'whatsappCapacity','chatCurrentCapacity',_0xc753('0x62'),_0xc753('0x4c'),'openchannelCurrentCapacity',_0xc753('0x4d'),'whatsappCurrentCapacity',_0xc753('0x58'),_0xc753('0x59'),_0xc753('0x57'),'onhold','queue',_0xc753('0x63')];}exports[_0xc753('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 7b4171d..f1207c0 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 _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 +var _0xd3f8=['inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','waiting','merge','pick','initializeQueues','lodash','util','client','http','available','loggedIn','paused','busy'];(function(_0x3ab116,_0x22a648){var _0x4d1843=function(_0x333ea0){while(--_0x333ea0){_0x3ab116['push'](_0x3ab116['shift']());}};_0x4d1843(++_0x22a648);}(_0xd3f8,0x130));var _0x8d3f=function(_0x7447ec,_0x2f4711){_0x7447ec=_0x7447ec-0x0;var _0x2eef5b=_0xd3f8[_0x7447ec];return _0x2eef5b;};'use strict';var _=require(_0x8d3f('0x0'));var jayson=require('jayson/promise');var util=require(_0x8d3f('0x1'));var amiClient=jayson[_0x8d3f('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x8d3f('0x2')][_0x8d3f('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8d3f('0x4'),_0x8d3f('0x5'),_0x8d3f('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x8d3f('0x7'),_0x8d3f('0x8'),_0x8d3f('0x9'),_0x8d3f('0xa'),_0x8d3f('0xb'),_0x8d3f('0xc'),_0x8d3f('0xd'),_0x8d3f('0xe'),_0x8d3f('0xf'),_0x8d3f('0x10'),_0x8d3f('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8d3f('0x12'),_0x8d3f('0x13'),_0x8d3f('0x14'),_0x8d3f('0x15'),_0x8d3f('0x16'),'dialMethod',_0x8d3f('0x17'),_0x8d3f('0x18'),'startProgressive','erlangCalls',_0x8d3f('0x19'),_0x8d3f('0x1a'),'erlangBusyFactor',_0x8d3f('0x1b'),_0x8d3f('0x1c'),_0x8d3f('0x1d'),'predictiveIntervalAvailable',_0x8d3f('0x1e'),_0x8d3f('0x1f'),_0x8d3f('0x20'),_0x8d3f('0x21'),_0x8d3f('0x22'),_0x8d3f('0x23')];function getRealtimeQueues(_0x5331e4,_0x2795c4){var _0x5d94fd=_0x2795c4===_0x8d3f('0x24')?amiClient:routingClient;return _0x5d94fd['request'](_['startCase'](_0x2795c4)+_0x8d3f('0x25'),_0x5331e4)[_0x8d3f('0x26')](function(_0x5870b3){if(_0x5870b3[_0x8d3f('0x27')])throw new Error(util[_0x8d3f('0x28')](_0x8d3f('0x29'),_0x2795c4));return _0x5870b3[_0x8d3f('0x2a')];})['catch'](function(_0x36e94c){throw _0x36e94c;});}exports[_0x8d3f('0x2b')]=getRealtimeQueues;function initializeQueues(_0x4c78db,_0x57dc45,_0x14896e,_0x327532){var _0x323bb6=DEFAULT_QUEUE_ATTRIBUTES;if(_0x14896e===_0x8d3f('0x24')){if(_0x327532===_0x8d3f('0x2c')){_0x323bb6=_0x323bb6[_0x8d3f('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x327532===_0x8d3f('0x2e')){_0x323bb6=_0x323bb6['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4c78db[_0x8d3f('0x2f')](function(_0x2669bc){var _0x25279c=_0x2669bc['get']({'plain':!![]});_0x25279c[_0x8d3f('0x6')]=0x0;_0x25279c['loggedInDb']=0x0;_0x25279c[_0x8d3f('0x5')]=0x0;_0x25279c[_0x8d3f('0x4')]=0x0;_0x25279c[_0x8d3f('0x30')]=0x0;if(_0x14896e===_0x8d3f('0x24')){_0x25279c[_0x8d3f('0xf')]=0x0;_0x25279c[_0x8d3f('0x7')]=0x0;if(_0x327532==='outbound'){_0x25279c[_0x8d3f('0x12')]=0x0;_0x25279c[_0x8d3f('0x13')]=0x0;}}var _0x545685=_['find'](_0x57dc45,['id',_0x25279c['id']]);if(_0x545685){_[_0x8d3f('0x31')](_0x25279c,_[_0x8d3f('0x32')](_0x545685,_0x323bb6));}return _0x25279c;});}exports[_0x8d3f('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 9d9e715..fd407e8 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(_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 +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(_0x165360,_0x5ca20b){var _0x5acc59=function(_0x4f9d07){while(--_0x4f9d07){_0x165360['push'](_0x165360['shift']());}};_0x5acc59(++_0x5ca20b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 dbd3ed4..0d4cbfe 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 _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 +var _0x0ea0=['crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','map','join','createHash','md5','update','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','digest','hex','substring','lodash'];(function(_0x4c5a90,_0x39edaf){var _0x8e83e8=function(_0xce4f7e){while(--_0xce4f7e){_0x4c5a90['push'](_0x4c5a90['shift']());}};_0x8e83e8(++_0x39edaf);}(_0x0ea0,0x6b));var _0x00ea=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x0ea0[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require(_0x00ea('0x0'));var os=require('os');var crypto=require(_0x00ea('0x1'));var machine=require(_0x00ea('0x2'));var exec=require(_0x00ea('0x3'))[_0x00ea('0x4')];var config=require(_0x00ea('0x5'));function getInterfaces(){var _0x5c0d4d=[];var _0x300d6c=os[_0x00ea('0x6')]();var _0xfe2b26=_['orderBy'](_[_0x00ea('0x7')](_0x300d6c));for(var _0x593de7=0x0;_0x593de7<_0xfe2b26[_0x00ea('0x8')];_0x593de7++){var _0xc24e19=_0x300d6c[_0xfe2b26[_0x593de7]][_0x00ea('0x9')](function(_0x5f43c5){return _0x5f43c5['family']===_0x00ea('0xa')&&_0x5f43c5[_0x00ea('0xb')]===![];});_0x5c0d4d=_0x5c0d4d[_0x00ea('0xc')](_0xc24e19);}return _0x5c0d4d;}function getFirstInterface(){var _0x5edab6=_[_0x00ea('0xd')](getInterfaces());return{'macAddress':_0x5edab6&&_0x5edab6[_0x00ea('0xe')]?_0x5edab6['mac']:_0x00ea('0xf'),'ipAddress':_0x5edab6&&_0x5edab6[_0x00ea('0x10')]?_0x5edab6[_0x00ea('0x10')]:_0x00ea('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2fe504=_[_0x00ea('0x12')](os['cpus']()[_0x00ea('0x13')](function(_0x5b8c43){return _0x5b8c43['model'];}))[_0x00ea('0x14')](':');return crypto[_0x00ea('0x15')](_0x00ea('0x16'))[_0x00ea('0x17')](_0x2fe504)['digest']('hex');}exports[_0x00ea('0x18')]=function(){var _0x4a4a47=os[_0x00ea('0x19')]();var _0x5c991d=/[0-9a-f-]{36}/;if(config[_0x00ea('0x1a')]&&_0x5c991d[_0x00ea('0x1b')](config['licenseToken'])){return config[_0x00ea('0x1a')];}else if(_0x4a4a47===_0x00ea('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x00ea('0x1d')})[_0x00ea('0x1e')]('\x0d\x0a','');}else{var _0x389408=getFirstInterface();var _0x25ef27=getCPUhash();var _0x23e373=_0x25ef27+'|'+os[_0x00ea('0x1f')]()+'|'+_0x389408['macAddress']+'|'+_0x389408[_0x00ea('0x20')];var _0x39a719=crypto['createHash']('md5')[_0x00ea('0x17')](_0x23e373)[_0x00ea('0x21')](_0x00ea('0x22'));return _0x39a719[_0x00ea('0x23')](0x0,0x8)+'-'+_0x39a719[_0x00ea('0x23')](0x8,0xc)+'-'+_0x39a719['substring'](0xc,0x10)+'-'+_0x39a719[_0x00ea('0x23')](0x10,0x14)+'-'+_0x39a719[_0x00ea('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 901d7f3..2f3ada4 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 _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 +var _0xd18e=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x28d31d,_0x57a4e6){var _0x2df7c1=function(_0x52601d){while(--_0x52601d){_0x28d31d['push'](_0x28d31d['shift']());}};_0x2df7c1(++_0x57a4e6);}(_0xd18e,0x113));var _0xed18=function(_0x416def,_0x26324c){_0x416def=_0x416def-0x0;var _0x164e7e=_0xd18e[_0x416def];return _0x164e7e;};'use strict';var util=require(_0xed18('0x0'));var moment=require(_0xed18('0x1'));var rp=require(_0xed18('0x2'));var BPromise=require(_0xed18('0x3'));var pkginfo=require(_0xed18('0x4'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xed18('0x5'));var hardware=require(_0xed18('0x6'));var logger=require('../logger')(_0xed18('0x7'));var HOST=_0xed18('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1a0202){return new BPromise(function(_0x588ca5,_0x2c866f){var _0x338668=util[_0xed18('0x9')](_0xed18('0xa'),HOST,_0x1a0202,module[_0xed18('0xb')]['version']);if(oldToken){_0x338668=util[_0xed18('0x9')](_0xed18('0xc'),HOST,_0x1a0202,module[_0xed18('0xb')][_0xed18('0xd')],oldToken);}var _0x2fc2b3={'uri':_0x338668,'method':_0xed18('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2fc2b3)[_0xed18('0xf')](function(_0x4cc088){_0x588ca5(_0x4cc088);})[_0xed18('0x10')](function(_0x320c0a){_0x2c866f(_0x320c0a);});});}function manageLicense(_0x4bea89,_0x55f9b3){var _0x1f5e29=_0x55f9b3[_0xed18('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x1f5e29[_0xed18('0x12')]!==_0x4bea89&&!_0x1f5e29[_0xed18('0x13')]){oldToken=_0x1f5e29[_0xed18('0x12')];}httpRequest(_0x4bea89)[_0xed18('0xf')](function(_0x46289a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x46289a[_0xed18('0x14')]){isOldTokenSent=![];if(!_0x1f5e29[_0xed18('0x7')]&&_0x1f5e29[_0xed18('0x7')]!=_0x46289a[_0xed18('0x7')]||_0x1f5e29[_0xed18('0x7')]&&_0x1f5e29[_0xed18('0x13')]){logger[_0xed18('0x15')](_0xed18('0x16'));}if(_0x1f5e29[_0xed18('0x7')]&&!_0x1f5e29[_0xed18('0x13')]&&_0x1f5e29[_0xed18('0x7')]!=_0x46289a[_0xed18('0x7')]){logger[_0xed18('0x15')](_0xed18('0x17'));}if(_0x1f5e29[_0xed18('0x7')]&&!_0x1f5e29[_0xed18('0x13')]&&_0x1f5e29[_0xed18('0x7')]==_0x46289a[_0xed18('0x7')]){return _0x55f9b3;}return _0x55f9b3['update']({'data1':_0x4bea89,'data2':null,'license':_0x46289a[_0xed18('0x7')]});}else{if(_0x46289a[_0xed18('0x7')]||_0x1f5e29[_0xed18('0x7')]){if(!_0x1f5e29[_0xed18('0x13')]){if(_0x1f5e29['data1']==_0x4bea89){GRAY_PERIOD_REASON=_0xed18('0x18');logger[_0xed18('0x15')](_0xed18('0x19'));}else{GRAY_PERIOD_REASON=_0xed18('0x1a');logger[_0xed18('0x15')](_0xed18('0x1b'),_0x1f5e29['data1'],_0x4bea89);}logger[_0xed18('0x15')](_0xed18('0x1c'),GRAY_PERIOD_REASON[_0xed18('0x1d')](),moment()[_0xed18('0x9')](_0xed18('0x1e')));return _0x55f9b3[_0xed18('0x1f')]({'data2':encryptor[_0xed18('0x20')](moment()[_0xed18('0x9')](_0xed18('0x1e')))});}else{if(moment()[_0xed18('0x21')](encryptor[_0xed18('0x22')](_0x1f5e29[_0xed18('0x13')]),'days')>DAYS){logger[_0xed18('0x15')](_0xed18('0x23'),moment()[_0xed18('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x55f9b3[_0xed18('0x1f')]({'data1':_0x4bea89,'data2':null,'license':null});}}}else{if(_0x1f5e29[_0xed18('0x12')]!=_0x4bea89){logger[_0xed18('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1f5e29[_0xed18('0x12')],_0x4bea89);return _0x55f9b3[_0xed18('0x1f')]({'data1':_0x4bea89,'data2':null,'license':null});}}}return _0x55f9b3;})[_0xed18('0xf')](function(_0x17ad13){_0x55f9b3=_0x17ad13;})[_0xed18('0x10')](function(_0x383a93){logger[_0xed18('0x24')](_0x383a93[_0xed18('0x25')]);})[_0xed18('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0xed18('0x27')](),_0x55f9b3);},TIME);});}function defaultLicense(){var _0x3c199d=hardware[_0xed18('0x27')]();if(_0x3c199d){return db['License'][_0xed18('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x3c199d}})['spread'](function(_0x3f8c6f,_0x3b1b0a){logger['info'](_0xed18('0x29'),_0x3c199d);manageLicense(_0x3c199d,_0x3f8c6f);})[_0xed18('0x10')](function(_0x317b73){logger[_0xed18('0x24')](_0x317b73['message']);});}}exports[_0xed18('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0305beb..4cb0e59 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 _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 +var _0xc77c=['forEach','role','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','parse','machineUuid','gray','add','days','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','count','admin','telephone','users','telephones'];(function(_0x3a16d4,_0x221ae7){var _0x48310b=function(_0x462be1){while(--_0x462be1){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x48310b(++_0x221ae7);}(_0xc77c,0xdd));var _0xcc77=function(_0x2d54ba,_0x3d5c1a){_0x2d54ba=_0x2d54ba-0x0;var _0x445649=_0xc77c[_0x2d54ba];return _0x445649;};'use strict';var util=require(_0xcc77('0x0'));var _=require(_0xcc77('0x1'));var moment=require(_0xcc77('0x2'));var BPromise=require('bluebird');var hardware=require(_0xcc77('0x3'));var encryptor=require(_0xcc77('0x4'));var db=require(_0xcc77('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcc77('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcc77('0x7'),'machineUuid':hardware[_0xcc77('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':'Breaking\x20license','machineUuid':hardware[_0xcc77('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x220f02){return new BPromise(function(_0x37c2a4,_0x335356){return db['License']['find'](_['defaults'](_0x220f02,{'raw':!![],'where':{'id':0x1}}))[_0xcc77('0x9')](function(_0x51f44e){return checkLicense(_0x51f44e,null);})[_0xcc77('0x9')](function(_0x46a8c6){_0x37c2a4(_0x46a8c6);return;})[_0xcc77('0xa')](function(_0x50128a){_0x335356(_0x50128a);});});}function checkLicense(_0x5ba931,_0x81422){if(!_0x5ba931){demoLicense[_0xcc77('0xb')]=_0x5ba931['data1'];return demoLicense;}try{var _0x53dc69=_0x81422||_0x5ba931[_0xcc77('0xc')];if(_[_0xcc77('0xd')](_0x53dc69)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xa32a84=_0x5ba931[_0xcc77('0xe')];var _0x1a4882=_0x5ba931[_0xcc77('0xf')];var _0x142041=_0xa32a84['split']('-')[0x4];var _0x376714=_0xa32a84[_0xcc77('0x10')]('-')[0x0];var _0xc750f1=encryptor[_0xcc77('0x11')](_0x53dc69,util['format']('%s:%s:%s',_0x142041,_0xa32a84,_0x376714));var _0x3f4a84=JSON[_0xcc77('0x12')](_0xc750f1);_0x3f4a84['demo']=![];_0x3f4a84[_0xcc77('0xb')]=_0xa32a84;_0x3f4a84[_0xcc77('0x13')]=hardware[_0xcc77('0x8')]();if(_0x1a4882){var _0x272660=encryptor[_0xcc77('0x11')](_0x1a4882);_0x3f4a84[_0xcc77('0x14')]=_0x272660;_0x3f4a84['deadline']=moment(_0x272660)[_0xcc77('0x15')](0x7,_0xcc77('0x16'))['format']();_0x3f4a84[_0xcc77('0x17')]=_0x3f4a84[_0xcc77('0xb')]!=_0x3f4a84['machineUuid']?_0xcc77('0x18'):_0xcc77('0x19');}return _0x3f4a84;}catch(_0xc9b551){breakingLicense['uuid']=_0x5ba931[_0xcc77('0xe')];breakingLicense[_0xcc77('0x1a')]=_0xc9b551['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x51eb07,_0x3f4d1e){getLicense()[_0xcc77('0x9')](function(_0x3e6c00){return db[_0xcc77('0x1b')][_0xcc77('0x1c')]({'attributes':['role',[db[_0xcc77('0x1d')]['fn'](_0xcc77('0x1e'),db[_0xcc77('0x1d')][_0xcc77('0x1f')]('role')),_0xcc77('0x20')]],'group':'role','where':{'role':{'$or':[_0xcc77('0x21'),'user',_0xcc77('0x22')]}},'raw':!![]})[_0xcc77('0x9')](function(_0x59df84){var _0x2773bd={'user':_0x3e6c00[_0xcc77('0x23')]||0x0,'telephone':_0x3e6c00[_0xcc77('0x24')]||0x0};_0x59df84[_0xcc77('0x25')](function(_0x5a2c4c){var _0x5eb2e1=_0x5a2c4c[_0xcc77('0x26')]===_0xcc77('0x21')?'user':_0x5a2c4c[_0xcc77('0x26')];_0x2773bd[_0x5eb2e1]-=_0x5a2c4c[_0xcc77('0x20')];if(_0x2773bd[_0x5eb2e1]<0x0)_0x2773bd[_0x5eb2e1]=0x0;});_0x51eb07(_0x2773bd);return;});})[_0xcc77('0xa')](function(_0x4b78c6){_0x3f4d1e(_0x4b78c6);});});}function checkUserLimits(_0x1c34fd){return new BPromise(function(_0x4f3091,_0x4349db){getLimits()['then'](function(_0x2ff378){var _0x372b3d=_['pick'](_['countBy'](_0x1c34fd,_0xcc77('0x26')),['admin','user',_0xcc77('0x22')]);var _0x390be9=(_0x372b3d[_0xcc77('0x21')]||0x0)+(_0x372b3d[_0xcc77('0x27')]||0x0);var _0x9079cf=_0x372b3d['telephone']||0x0;if(_0x390be9>_0x2ff378[_0xcc77('0x27')])return _0x4349db(_0xcc77('0x28'));if(_0x9079cf>_0x2ff378['telephone'])return _0x4349db(_0xcc77('0x29'));return _0x4f3091();})['catch'](function(_0xa716ee){_0x4349db(_0xa716ee);});});}module[_0xcc77('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 928eeee..6731f00 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 _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 +var _0xc2c7=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x361654,_0x2180f2){var _0x161d3c=function(_0xfcd29f){while(--_0xfcd29f){_0x361654['push'](_0x361654['shift']());}};_0x161d3c(++_0x2180f2);}(_0xc2c7,0x134));var _0x7c2c=function(_0x478a67,_0x38214e){_0x478a67=_0x478a67-0x0;var _0x4cd8a4=_0xc2c7[_0x478a67];return _0x4cd8a4;};'use strict';module['exports']={'DOMAIN':_0x7c2c('0x0'),'SESSION_SECRET':_0x7c2c('0x1'),'GOOGLE_ID':_0x7c2c('0x2'),'GOOGLE_SECRET':_0x7c2c('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 15afc02..eadd224 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x7da1=['fileLogger','../utils/loggers'];(function(_0x4fbc52,_0x1a547){var _0x474551=function(_0x406af1){while(--_0x406af1){_0x4fbc52['push'](_0x4fbc52['shift']());}};_0x474551(++_0x1a547);}(_0x7da1,0x171));var _0x17da=function(_0x57b5b3,_0x2e1ff9){_0x57b5b3=_0x57b5b3-0x0;var _0x46f985=_0x7da1[_0x57b5b3];return _0x46f985;};'use strict';var fileLogger=require(_0x17da('0x0'))[_0x17da('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 c0b35a2..9279903 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 _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 +var _0x18a5=['routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x5f2e12,_0x45491f){var _0x142184=function(_0x11bb02){while(--_0x11bb02){_0x5f2e12['push'](_0x5f2e12['shift']());}};_0x142184(++_0x45491f);}(_0x18a5,0x100));var _0x518a=function(_0x5198b2,_0x590c84){_0x5198b2=_0x5198b2-0x0;var _0x57959a=_0x18a5[_0x5198b2];return _0x57959a;};'use strict';var path=require(_0x518a('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0x518a('0x1')](cfg[_0x518a('0x2')],_0x518a('0x3')))};var pm2config={'apps':[{'name':_0x518a('0x4'),'script':path[_0x518a('0x1')](__dirname,_0x518a('0x5')),'env':env},{'name':'ami','script':path[_0x518a('0x1')](__dirname,_0x518a('0x6')),'env':env},{'name':_0x518a('0x7'),'script':path[_0x518a('0x1')](__dirname,_0x518a('0x8')),'env':env},{'name':'email','script':path[_0x518a('0x1')](__dirname,_0x518a('0x9')),'env':env},{'name':_0x518a('0xa'),'script':path['join'](__dirname,_0x518a('0xb')),'env':env},{'name':'xdr','script':path['join'](__dirname,_0x518a('0xc')),'env':env}]};module[_0x518a('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 56fb7fd..37e5a5c 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 _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 +var _0xab26=['./config','connect','connected','start','disconnect','stop','then','list','describe','delete','dump','saved','pm2'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xab26,0x1c6));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var pm2=require(_0x6ab2('0x0'));var BPromise=require('bluebird');var config=require(_0x6ab2('0x1'));function connect(){return new BPromise(function(_0x12dff8,_0x5af0b9){return pm2[_0x6ab2('0x2')](function(_0x2a53e7){if(_0x2a53e7){return _0x5af0b9(_0x2a53e7);}return _0x12dff8(_0x6ab2('0x3'));});});};exports[_0x6ab2('0x4')]=function(_0xf9fcef){return connect()['then'](function(){return new BPromise(function(_0x1d9902,_0x52e94b){return pm2['start'](_0xf9fcef,function(_0x259b54,_0x1edb23){if(_0x259b54){return _0x52e94b(_0x259b54);}pm2[_0x6ab2('0x5')]();return _0x1d9902(_0x1edb23);});});});};exports[_0x6ab2('0x6')]=function(_0x20927f){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x40ea07,_0x2b2cce){return pm2[_0x6ab2('0x6')](_0x20927f,function(_0x1e2710,_0xe5fb2c){if(_0x1e2710){return _0x2b2cce(_0x1e2710);}pm2[_0x6ab2('0x5')]();return _0x40ea07(_0xe5fb2c);});});});};exports['restart']=function(_0x41edb9){return connect()['then'](function(){return new BPromise(function(_0x7fd1ba,_0x1fed71){return pm2['restart'](_0x41edb9,function(_0x1db56a,_0x49e21b){if(_0x1db56a){return _0x1fed71(_0x1db56a);}pm2[_0x6ab2('0x5')]();return _0x7fd1ba(_0x49e21b);});});});};exports[_0x6ab2('0x8')]=function(){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x3be010,_0x52cccd){return pm2[_0x6ab2('0x8')](function(_0x3ce898,_0xc58582){if(_0x3ce898){return _0x52cccd(_0x3ce898);}pm2[_0x6ab2('0x5')]();return _0x3be010(_0xc58582);});});});};exports['describe']=function(_0x468460){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x585abe,_0x4cb905){return pm2[_0x6ab2('0x9')](_0x468460,function(_0x2f7dc9,_0x2e13b4){if(_0x2f7dc9){return _0x4cb905(_0x2f7dc9);}pm2[_0x6ab2('0x5')]();return _0x585abe(_0x2e13b4);});});});};exports[_0x6ab2('0xa')]=function(_0x287157){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x53fc23,_0x252a97){return pm2['delete'](_0x287157,function(_0x1a2539,_0x351898){if(_0x1a2539){return _0x252a97(_0x1a2539);}pm2[_0x6ab2('0x5')]();return _0x53fc23(_0x351898);});});});};exports[_0x6ab2('0xb')]=function(){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x1684b7,_0x20129a){return pm2['dump'](function(_0x5f00de){if(_0x5f00de){return _0x20129a(_0x5f00de);}return _0x1684b7(_0x6ab2('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 9baa43a..244102e 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 _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 +var _0xc614=['util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','ChatInteraction','update','timeout','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment'];(function(_0x38a1c5,_0x3773ee){var _0x2bddf5=function(_0x4ee0cb){while(--_0x4ee0cb){_0x38a1c5['push'](_0x38a1c5['shift']());}};_0x2bddf5(++_0x3773ee);}(_0xc614,0x135));var _0x4c61=function(_0x34d067,_0x13d2fe){_0x34d067=_0x34d067-0x0;var _0x308b9a=_0xc614[_0x34d067];return _0x308b9a;};'use strict';var _=require('lodash');var moment=require(_0x4c61('0x0'));var Redis=require('ioredis');var util=require(_0x4c61('0x1'));var config=require(_0x4c61('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x4c61('0x3'))(_0x4c61('0x4'));config[_0x4c61('0x5')]=_[_0x4c61('0x6')](config[_0x4c61('0x5')],{'host':_0x4c61('0x7'),'port':0x18eb});var io=require(_0x4c61('0x8'))(new Redis(config[_0x4c61('0x5')]));function closeInteractions(){var _0xcc5ee=0x0;var _0xa9e53a=[];return db[_0x4c61('0x9')][_0x4c61('0xa')]({'raw':!![],'attributes':['id',_0x4c61('0xb')],'where':{'id':0x1}})[_0x4c61('0xc')](function(_0x41275f){_0xcc5ee=_0x41275f[_0x4c61('0xb')];if(_0xcc5ee){return db['ChatInteraction'][_0x4c61('0xd')]({'raw':!![],'attributes':['id',_0x4c61('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4c61('0xf')](_0x41275f[_0x4c61('0xb')],_0x4c61('0x10'))}}});}else{return[];}})[_0x4c61('0xc')](function(_0x54abfa){if(_0x54abfa&&_0x54abfa[_0x4c61('0x11')]){_0xa9e53a=_[_0x4c61('0x12')](_0x54abfa||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0xa9e53a['join']());return db[_0x4c61('0x13')][_0x4c61('0x14')]({'closeReason':'system','disposition':_0x4c61('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xa9e53a}});}})[_0x4c61('0xc')](function(){if(_0xa9e53a&&_0xa9e53a[_0x4c61('0x11')]){logger[_0x4c61('0x16')](_0x4c61('0x17'),_0xa9e53a[_0x4c61('0x18')]());for(var _0xe6a164=0x0;_0xe6a164<_0xa9e53a[_0x4c61('0x11')];_0xe6a164++){io[_0x4c61('0x19')](_0x4c61('0x1a'),{'id':_0xa9e53a[_0xe6a164],'closed':!![]});}}})[_0x4c61('0x1b')](function(_0x3c13b6){logger[_0x4c61('0x1c')](_0x4c61('0x1d'),_0x3c13b6?util['inspect'](_0x3c13b6,{'showHidden':![],'depth':null}):'');});}exports[_0x4c61('0x1e')]=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 815da26..7491a70 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 _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 +var _0xfa74=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x265021,_0x455fa5){var _0x106a05=function(_0x43ef38){while(--_0x43ef38){_0x265021['push'](_0x265021['shift']());}};_0x106a05(++_0x455fa5);}(_0xfa74,0x1bd));var _0x4fa7=function(_0x569fac,_0x24dce9){_0x569fac=_0x569fac-0x0;var _0x1a6c38=_0xfa74[_0x569fac];return _0x1a6c38;};'use strict';function start(){var _0x44d452=require(_0x4fa7('0x0'));return _0x44d452[_0x4fa7('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5abdc50..8827fe7 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 _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 +var _0xfe06=['add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','number','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','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','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','entity','dataValues','attempt','report\x20status:','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','intersection','length','exists','deleteJob','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start'];(function(_0x1b2808,_0x35a0dc){var _0x2ca622=function(_0x43a52c){while(--_0x43a52c){_0x1b2808['push'](_0x1b2808['shift']());}};_0x2ca622(++_0x35a0dc);}(_0xfe06,0x6f));var _0x6fe0=function(_0x1b74cc,_0x32eb3a){_0x1b74cc=_0x1b74cc-0x0;var _0xb57de7=_0xfe06[_0x1b74cc];return _0xb57de7;};'use strict';var fs=require('fs');var util=require(_0x6fe0('0x0'));var path=require(_0x6fe0('0x1'));var _=require(_0x6fe0('0x2'));var moment=require(_0x6fe0('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6fe0('0x4'));var BPromise=require(_0x6fe0('0x5'));var logger=require('../logger')('schedule');var db=require(_0x6fe0('0x6'))['db'];const retry=require(_0x6fe0('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x6fe0('0x8'));var client=jayson[_0x6fe0('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x57f6a6){const _0x6a5581={};if(typeof _0x57f6a6===_0x6fe0('0xa')){_0x6a5581['id']=_0x57f6a6;}return db['AnalyticExtractedReport']['findOne']({'where':_0x6a5581})[_0x6fe0('0xb')](function(_0x30a4ad){return _0x30a4ad;})[_0x6fe0('0xc')](function(_0x68a6b6){logger[_0x6fe0('0xd')](_0x68a6b6);});}function handleSendEmail(_0x2b4781,_0x58a790){logger[_0x6fe0('0xe')](_0x6fe0('0xf'),_0x2b4781[_0x6fe0('0x10')]);var _0x2a1c5c=!![];var _0x1dc29b=_0x2b4781[_0x6fe0('0x11')][_0x6fe0('0x12')]();var _0x3ee5bd={'account':_0x1dc29b,'message':{'from':util[_0x6fe0('0x13')](_0x6fe0('0x14'),_0x2b4781[_0x6fe0('0x11')]['name'],_0x2b4781['MailAccount'][_0x6fe0('0x10')]||_0x2b4781[_0x6fe0('0x11')][_0x6fe0('0x15')]['user']),'to':_0x2b4781['email'],'cc':_0x2b4781['cc'],'bcc':_0x2b4781[_0x6fe0('0x16')],'subject':util[_0x6fe0('0x13')](_0x6fe0('0x17'),_0x58a790[_0x6fe0('0x18')],_0x2b4781[_0x6fe0('0x19')],_0x2b4781[_0x6fe0('0x1a')])}};var _0x458868=path['join'](__dirname,_0x6fe0('0x1b'));var _0x2de946=_0x58a790[_0x6fe0('0x1c')];var _0xa17f55=util['format'](_0x6fe0('0x1d'),path['basename'](_0x58a790['savename'],path[_0x6fe0('0x1e')](_0x58a790[_0x6fe0('0x1c')])),_0x6fe0('0x1f'));var _0x2ca9be=path[_0x6fe0('0x20')](_0x458868,_0x2de946);var _0x709f7=path[_0x6fe0('0x20')](_0x458868,_0xa17f55);if(fs[_0x6fe0('0x21')](_0x2ca9be)){_0x58a790[_0x6fe0('0x22')]='Sent';_0x3ee5bd[_0x6fe0('0x23')][_0x6fe0('0x24')]=[{'filename':_0x2de946,'path':_0x2ca9be}];_0x3ee5bd['message']['text']=util['format'](_0x6fe0('0x25'),JSON[_0x6fe0('0x26')](_0x58a790,null,0x2));}else if(fs[_0x6fe0('0x21')](_0x709f7)){_0x58a790[_0x6fe0('0x22')]='Sent';_0x3ee5bd[_0x6fe0('0x23')][_0x6fe0('0x24')]=[{'filename':_0xa17f55,'path':_0x709f7}];}else{if(_0x58a790[_0x6fe0('0x22')]==='Empty'){_0x3ee5bd['message'][_0x6fe0('0x27')]=_0x6fe0('0x28');if(!_0x2b4781['sendIfEmpty']){_0x2a1c5c=![];logger[_0x6fe0('0xe')](_0x6fe0('0x29'));}}else if(_0x58a790['status']===_0x6fe0('0x2a')){_0x3ee5bd[_0x6fe0('0x23')]['text']=_0x6fe0('0x2b');}else if(_0x58a790[_0x6fe0('0x22')]===_0x6fe0('0x2c')){_0x3ee5bd[_0x6fe0('0x23')][_0x6fe0('0x27')]=_0x6fe0('0x2d');}else if(_0x58a790['status']===_0x6fe0('0x2e')){_0x3ee5bd[_0x6fe0('0x23')]['text']=_0x6fe0('0x2f');}else{logger[_0x6fe0('0xd')](_0x6fe0('0x30'),_0x58a790['status']);}}if(_0x2a1c5c){return client[_0x6fe0('0x31')](_0x6fe0('0x32'),_0x3ee5bd)['then'](function(_0x44363d){if(_0x44363d[_0x6fe0('0xd')]){return logger['error'](_0x6fe0('0x33'),JSON[_0x6fe0('0x26')](_0x44363d));}return logger[_0x6fe0('0xe')](_0x6fe0('0x34'));})['catch'](function(_0x364c95){return logger['error'](_0x6fe0('0x33'),JSON[_0x6fe0('0x26')](_0x364c95));});}}function handleError(){return function(_0x322ec1){return logger[_0x6fe0('0xd')](JSON[_0x6fe0('0x26')](_0x322ec1));};}function loading(_0x427077){logger[_0x6fe0('0xe')](_0x6fe0('0x35'));if(_0x427077[_0x6fe0('0x36')]===_0x427077[_0x6fe0('0x37')][_0x6fe0('0x38')]){handleSendEmail(_0x427077[_0x6fe0('0x39')],_0x427077[_0x6fe0('0x3a')]);_0x427077[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}else{_0x427077[_0x6fe0('0x3b')][_0x6fe0('0x7')](_0x6fe0('0x3d'));}}function completed(_0x486d95){logger[_0x6fe0('0xe')](_0x6fe0('0x3e'));handleSendEmail(_0x486d95[_0x6fe0('0x39')],_0x486d95[_0x6fe0('0x3a')]);_0x486d95['operation']['stop']();}function empty(_0x12bc85){logger[_0x6fe0('0xe')](_0x6fe0('0x3f'));handleSendEmail(_0x12bc85[_0x6fe0('0x39')],_0x12bc85[_0x6fe0('0x3a')]);_0x12bc85[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}function failed(_0xff2883){logger['info']('case\x20failed');handleSendEmail(_0xff2883['job'],_0xff2883[_0x6fe0('0x3a')]);_0xff2883[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}function urecognized(_0x2e5f57){logger[_0x6fe0('0xd')]('Unrecognized\x20status:',_0x2e5f57[_0x6fe0('0x40')][_0x6fe0('0x41')][_0x6fe0('0x22')]);_0x2e5f57[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5d9faa,_0xd9756f){const _0x261187={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x47ced5=retry[_0x6fe0('0x3b')](_0x261187);_0x47ced5[_0x6fe0('0x42')](_0x5b3d5e=>{logger[_0x6fe0('0xe')]('Job\x20ID\x20'+_0x5d9faa['id']+'\x20Attempt\x20#:'+_0x5b3d5e);try{getReportData(_0xd9756f['id'])['then'](function(_0x54bd62){_0xd9756f=_0x54bd62;logger['info'](_0x6fe0('0x43'),_0x54bd62[_0x6fe0('0x41')][_0x6fe0('0x22')]);if(!reportStatusStrategies[_0x54bd62[_0x6fe0('0x41')]['status']]){logger[_0x6fe0('0xd')]('report\x20status:',_0x54bd62['dataValues'][_0x6fe0('0x22')]);_0x47ced5[_0x6fe0('0x7')]();}reportStatusStrategies[_0x54bd62[_0x6fe0('0x41')][_0x6fe0('0x22')]]({'operation':_0x47ced5,'currentAttempt':_0x5b3d5e,'retryOptions':_0x261187,'job':_0x5d9faa,'data':_0xd9756f,'entity':_0x54bd62});});}catch(_0x2389db){_0x47ced5[_0x6fe0('0x7')](_0x2389db);}});}function handleResult(_0x548896){return function(_0x459f8b){if(_0x548896['sendMail']&&_0x548896[_0x6fe0('0x11')]&&_0x548896[_0x6fe0('0x11')][_0x6fe0('0x15')]&&!_[_0x6fe0('0x44')](_0x548896[_0x6fe0('0x10')])){retryer(_0x548896,_0x459f8b);}};}function handleJob(_0x334a13){return function(){try{if(_['isNil'](_0x334a13[_0x6fe0('0x19')])){return logger[_0x6fe0('0xe')](_0x6fe0('0x45'));}if(_[_0x6fe0('0x44')](_0x334a13[_0x6fe0('0x1a')])){return logger[_0x6fe0('0xe')](_0x6fe0('0x46'));}var _0x3656b5={'startDate':moment()[_0x6fe0('0x47')](_0x334a13[_0x6fe0('0x19')],_0x334a13['subtractUnit'])[_0x6fe0('0x13')](_0x6fe0('0x48')),'endDate':moment()['format'](_0x6fe0('0x48')),'type':_0x6fe0('0x49'),'output':_0x334a13[_0x6fe0('0x4a')],'name':_0x334a13[_0x6fe0('0x18')]};if(!_[_0x6fe0('0x44')](_0x334a13['DefaultReportId'])){logger['info'](_0x6fe0('0x4b'),_0x334a13[_0x6fe0('0x4c')]);return analyticDefaultReportController['runReport']({'id':_0x334a13[_0x6fe0('0x4c')]},_0x3656b5)['then'](handleResult(_0x334a13))[_0x6fe0('0xc')](handleError());}if(!_[_0x6fe0('0x44')](_0x334a13[_0x6fe0('0x4d')])){logger[_0x6fe0('0xe')]('exec\x20custom\x20report\x20id:%s',_0x334a13[_0x6fe0('0x4d')]);return analyticCustomReportController[_0x6fe0('0x4e')]({'id':_0x334a13[_0x6fe0('0x4d')]},_0x3656b5)[_0x6fe0('0xb')](handleResult(_0x334a13))[_0x6fe0('0xc')](handleError());}}catch(_0x281874){logger['error'](JSON[_0x6fe0('0x26')](_0x281874));}return logger['info'](_0x6fe0('0x4f'));};}function getJobs(_0x50801e){var _0x5493a7={};if(_0x50801e){_0x5493a7['id']=_0x50801e;}return db[_0x6fe0('0x50')][_0x6fe0('0x51')]({'where':_0x5493a7,'include':[{'model':db[_0x6fe0('0x11')],'attributes':['id',_0x6fe0('0x18'),_0x6fe0('0x10')],'include':[{'model':db[_0x6fe0('0x52')],'as':_0x6fe0('0x15'),'include':[{'model':db[_0x6fe0('0x53')],'as':_0x6fe0('0x53')}]}]}]})[_0x6fe0('0xb')](function(_0x5bb1f3){var _0x11c067=_[_0x6fe0('0x54')](manager['jobs']);var _0x96d845=_[_0x6fe0('0x55')](_0x5bb1f3,function(_0x4957f6){return _0x4957f6['id'][_0x6fe0('0x56')]();});var _0x375f89=_['keyBy'](_0x5bb1f3,function(_0x5bfb49){return _0x5bfb49['id']['toString']();});var _0x4f9627=_0x50801e?_0x96d845:_['difference'](_0x96d845,_0x11c067);var _0x48967a=_[_0x6fe0('0x57')](_0x96d845,_0x11c067);var _0x21e6b1=_['difference'](_0x11c067,_0x96d845);var _0x3766ce;var _0x1c2c2a;for(_0x3766ce=0x0;_0x3766ce<_0x21e6b1[_0x6fe0('0x58')]&&!_0x50801e;_0x3766ce+=0x1){_0x1c2c2a=_0x21e6b1[_0x3766ce]['toString']();if(manager[_0x6fe0('0x59')](_0x1c2c2a)){manager[_0x6fe0('0x3c')](_0x1c2c2a);manager[_0x6fe0('0x5a')](_0x1c2c2a);logger[_0x6fe0('0xe')]('delete\x20cron',_0x1c2c2a);}}logger[_0x6fe0('0xe')](_0x6fe0('0x5b'),JSON[_0x6fe0('0x26')](_0x4f9627));for(_0x3766ce=0x0;_0x3766ce<_0x4f9627[_0x6fe0('0x58')];_0x3766ce+=0x1){_0x1c2c2a=_0x4f9627[_0x3766ce][_0x6fe0('0x56')]();if(_0x50801e){logger[_0x6fe0('0xe')](JSON['stringify'](_0x375f89[_0x1c2c2a]));BPromise[_0x6fe0('0x5c')]()[_0x6fe0('0xb')](handleJob(_0x375f89[_0x1c2c2a]));logger[_0x6fe0('0xe')](_0x6fe0('0x5d'),_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a]['cron']);}else if(_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]&&_0x375f89[_0x1c2c2a][_0x6fe0('0x5f')]&&moment()[_0x6fe0('0x60')](_0x375f89[_0x1c2c2a][_0x6fe0('0x61')],_0x375f89[_0x1c2c2a][_0x6fe0('0x62')])){manager[_0x6fe0('0x63')](_0x1c2c2a,_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')],handleJob(_0x375f89[_0x1c2c2a]));manager[_0x6fe0('0x64')](_0x1c2c2a);logger['info'](_0x6fe0('0x65'),_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a]['cron']);}else if(manager['exists'](_0x1c2c2a)){manager['stop'](_0x1c2c2a);manager['deleteJob'](_0x1c2c2a);logger[_0x6fe0('0xe')](_0x6fe0('0x66'),_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]);}}for(_0x3766ce=0x0,_0x1c2c2a;_0x3766ce<_0x48967a['length']&&!_0x50801e;_0x3766ce+=0x1){_0x1c2c2a=_0x48967a[_0x3766ce][_0x6fe0('0x56')]();if(manager[_0x6fe0('0x59')](_0x1c2c2a)){if(_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]&&_0x375f89[_0x1c2c2a]['active']&&moment()[_0x6fe0('0x60')](_0x375f89[_0x1c2c2a][_0x6fe0('0x61')],_0x375f89[_0x1c2c2a][_0x6fe0('0x62')])){manager[_0x6fe0('0x67')](_0x1c2c2a,_0x375f89[_0x1c2c2a]['cron'],handleJob(_0x375f89[_0x1c2c2a]));logger[_0x6fe0('0xe')](_0x6fe0('0x68'),_0x375f89[_0x1c2c2a]['name'],_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]);}else{manager[_0x6fe0('0x3c')](_0x1c2c2a);manager[_0x6fe0('0x5a')](_0x1c2c2a);logger[_0x6fe0('0xe')]('stop\x20cron',_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]);}}}})[_0x6fe0('0xc')](function(_0x4994c1){logger['error'](JSON[_0x6fe0('0x26')](_0x4994c1));});}exports[_0x6fe0('0x69')]=function(_0x182a22){return getJobs(_0x182a22);};exports[_0x6fe0('0x64')]=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 ad90164..5be85f7 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 _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 +var _0x500c=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','SentimentScore','Positive','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length'];(function(_0xc177,_0x5bac47){var _0x1ad055=function(_0x4da002){while(--_0x4da002){_0xc177['push'](_0xc177['shift']());}};_0x1ad055(++_0x5bac47);}(_0x500c,0x188));var _0xc500=function(_0x297373,_0x25366e){_0x297373=_0x297373-0x0;var _0x580df8=_0x500c[_0x297373];return _0x580df8;};var _=require(_0xc500('0x0'));var AWS=require(_0xc500('0x1'));var rp=require(_0xc500('0x2'));var util=require(_0xc500('0x3'));var BPromise=require(_0xc500('0x4'));var db=require(_0xc500('0x5'))['db'];var logger=require(_0xc500('0x6'))(_0xc500('0x7'));function getTranscriptionJob(_0xf06e0f,_0x1107bb,_0x81acf6,_0x37ae10){return new Promise(function(_0x39a572,_0x1390ec){var _0x3bc410=new AWS['TranscribeService']({'accessKeyId':_0x1107bb,'secretAccessKey':_0xf06e0f,'region':_0x81acf6});_0x3bc410[_0xc500('0x8')]({'TranscriptionJobName':_0x37ae10},function(_0x480a10,_0x3cf7f9){if(_0x480a10){return _0x1390ec(_0x480a10);}else{return _0x39a572(_0x3cf7f9);}});});}function sentiment(_0x3312f6,_0x2982e7,_0x3b40f2,_0x198a32,_0x311826){return new Promise(function(_0x47b778,_0x3a35af){var _0x58887b=new AWS[(_0xc500('0x9'))]({'accessKeyId':_0x2982e7,'secretAccessKey':_0x3312f6,'region':_0x3b40f2});_0x58887b['detectSentiment']({'Text':_0x198a32,'LanguageCode':_0x311826['substring'](0x0,0x2)},function(_0xea3f01,_0x1edbae){if(_0xea3f01){return _0x3a35af(_0xea3f01);}else{return _0x47b778(_0x1edbae);}});});}function checkTranscribeJob(_0x597624,_0x45331c,_0x3274ba){var _0x3221b7;return new BPromise(function(_0x1c6fdc,_0x4513b9){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0xc'),_0x597624['id'],_0x597624['transcribeName']));return getTranscriptionJob(_0x3274ba[_0xc500('0xd')],_0x3274ba[_0xc500('0xe')],_0x45331c['transcribeRegion'],_0x597624[_0xc500('0xf')])[_0xc500('0x10')](function(_0x387d54){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x11'),_0x597624['id'],_0x597624[_0xc500('0xf')],_0x387d54['TranscriptionJob'][_0xc500('0x12')]));if(!_0x597624[_0xc500('0x13')]){switch(_0x387d54[_0xc500('0x14')][_0xc500('0x12')]){case _0xc500('0x15'):var _0xa2388d={'transcribeStatus':_0x387d54[_0xc500('0x14')]['TranscriptionJobStatus'],'fileUri':_0x387d54['TranscriptionJob']['Transcript'][_0xc500('0x16')]};logger['info'](util[_0xc500('0xb')](_0xc500('0x17'),_0x597624['id']));return rp({'uri':_0x387d54['TranscriptionJob'][_0xc500('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x1b5a19){logger['info'](util[_0xc500('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x597624['id']));if(_0x1b5a19&&_0x1b5a19['results']&&_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')]&&_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')][_0xc500('0x1b')]){_0xa2388d[_0xc500('0x13')]='';for(var _0x15540a=0x0;_0x15540a<_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')][_0xc500('0x1b')];_0x15540a++){_0xa2388d[_0xc500('0x13')]+=_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')][_0x15540a]['transcript']+'';}}return _0x597624[_0xc500('0x1c')](_0xa2388d);})['then'](function(){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x1d'),_0x597624['id']));if(!_0x597624[_0xc500('0x1e')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x45331c[_0xc500('0x21')]||!_0x45331c[_0xc500('0x22')]||!_0x45331c[_0xc500('0x23')]||!_0x45331c[_0xc500('0x24')]||!_0x45331c['bucket']){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x25'));}if(!_0xa2388d[_0xc500('0x13')]){throw new Error(_0xc500('0x26'));}if(_0x45331c[_0xc500('0x22')]===_0x3274ba['id']){return _0x3274ba;}else{return db[_0xc500('0x27')][_0xc500('0x28')]({'where':{'id':_settings[_0xc500('0x22')]}});}})[_0xc500('0x10')](function(_0x36f35c){if(!_0x36f35c){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x29'));}if(!_0x36f35c[_0xc500('0xd')]||!_0x36f35c[_0xc500('0xe')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x2a'));}_0x3221b7=_0x36f35c;logger['info'](util[_0xc500('0xb')](_0xc500('0x2b'),_0x597624['id']));return sentiment(_0x3221b7[_0xc500('0xd')],_0x3221b7[_0xc500('0xe')],_0x45331c['sentimentRegion'],_0xa2388d[_0xc500('0x13')],_0x45331c['language']);})[_0xc500('0x10')](function(_0x2435d7){logger[_0xc500('0xa')](util[_0xc500('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x597624['id']));return _0x597624[_0xc500('0x1c')]({'sentiment':_0x2435d7['Sentiment'],'sPositive':_0x2435d7[_0xc500('0x2c')][_0xc500('0x2d')],'sNegative':_0x2435d7['SentimentScore'][_0xc500('0x2e')],'sMixed':_0x2435d7[_0xc500('0x2c')]['Mixed'],'sNeutral':_0x2435d7[_0xc500('0x2c')][_0xc500('0x2f')]});})['then'](function(){logger[_0xc500('0xa')](util[_0xc500('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x597624['id']));_0x1c6fdc();});case _0xc500('0x30'):return _0x597624[_0xc500('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x387d54[_0xc500('0x14')]['FailureReason']})[_0xc500('0x10')](function(){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x1d'),_0x597624['id']));_0x1c6fdc();});default:logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x31'),_0x597624['id']));break;}}else{return BPromise[_0xc500('0x32')]()['then'](function(){if(!_0x597624[_0xc500('0x1e')]){throw new db['Sequelize']['ValidationError'](_0xc500('0x33'));}if(!_0x45331c[_0xc500('0x21')]||!_0x45331c['sentimentAccountId']||!_0x45331c['sentimentRegion']||!_0x45331c[_0xc500('0x24')]||!_0x45331c[_0xc500('0x34')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x25'));}if(!_0x597624[_0xc500('0x13')]){throw new Error(_0xc500('0x26'));}if(_0x45331c[_0xc500('0x22')]===_0x3274ba['id']){return _0x3274ba;}else{return db[_0xc500('0x27')][_0xc500('0x28')]({'where':{'id':_settings[_0xc500('0x22')]}});}})[_0xc500('0x10')](function(_0x415f0f){if(!_0x415f0f){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x415f0f['data1']||!_0x415f0f[_0xc500('0xe')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x2a'));}_0x3221b7=_0x415f0f;logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x2b'),_0x597624['id']));return sentiment(_0x3221b7[_0xc500('0xd')],_0x3221b7[_0xc500('0xe')],_0x45331c[_0xc500('0x23')],_0x597624['fileText'],_0x45331c[_0xc500('0x24')]);})[_0xc500('0x10')](function(_0x8c5177){logger['info'](util['format'](_0xc500('0x35'),_0x597624['id']));return _0x597624[_0xc500('0x1c')]({'sentiment':_0x8c5177['Sentiment'],'sPositive':_0x8c5177[_0xc500('0x2c')][_0xc500('0x2d')],'sNegative':_0x8c5177[_0xc500('0x2c')]['Negative'],'sMixed':_0x8c5177['SentimentScore'][_0xc500('0x36')],'sNeutral':_0x8c5177[_0xc500('0x2c')][_0xc500('0x2f')],'transcribeStatus':_0xc500('0x15')});})[_0xc500('0x10')](function(){logger['info'](util[_0xc500('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x597624['id']));_0x1c6fdc();});}})[_0xc500('0x37')](function(_0x52b27a){if(_0x52b27a){if(!_0x52b27a[_0xc500('0x38')]||_0x52b27a[_0xc500('0x38')]!==_0xc500('0x39')){logger[_0xc500('0x3a')](util[_0xc500('0xb')](_0xc500('0x3b'),_0x597624['id']),util[_0xc500('0x3c')](_0x52b27a,{'showHidden':![],'depth':null}));}}_0x1c6fdc();});});}function checkTranscribe(){var _0x3a2cd8;var _0x3d8ecc;var _0x39f065;return db['VoiceRecording'][_0xc500('0x3d')]({'where':{'transcribeStatus':_0xc500('0x3e')}})['then'](function(_0x15c427){if(!_0x15c427||!_0x15c427['length']){throw new db['Sequelize'][(_0xc500('0x20'))](_0xc500('0x3f'));}_0x3a2cd8=_0x15c427;return db[_0xc500('0x40')]['findOne']({'where':{'id':0x1}});})[_0xc500('0x10')](function(_0x1a7df9){if(!_0x1a7df9){throw new db[(_0xc500('0x1f'))]['ValidationError']('Settings\x20not\x20available');}_0x3d8ecc=_0x1a7df9;if(!_0x3d8ecc[_0xc500('0x7')]||!_0x3d8ecc[_0xc500('0x41')]||!_0x3d8ecc[_0xc500('0x42')]||!_0x3d8ecc[_0xc500('0x24')]||!_0x3d8ecc['bucket']){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x43'));}return db[_0xc500('0x27')]['findOne']({'where':{'id':_0x3d8ecc[_0xc500('0x41')]}});})[_0xc500('0x10')](function(_0x33f746){if(!_0x33f746){throw new db[(_0xc500('0x1f'))]['ValidationError'](_0xc500('0x29'));}if(!_0x33f746[_0xc500('0xd')]||!_0x33f746[_0xc500('0xe')]){throw new db['Sequelize'][(_0xc500('0x20'))](_0xc500('0x2a'));}_0x39f065=_0x33f746;var _0x9fb2e0=[];_0x3a2cd8[_0xc500('0x44')](function(_0x2d5bf9){_0x9fb2e0[_0xc500('0x45')](checkTranscribeJob(_0x2d5bf9,_0x3d8ecc,_0x39f065));});return BPromise['all'](_0x9fb2e0);})[_0xc500('0x37')](function(_0x242109){if(_0x242109){if(!_0x242109[_0xc500('0x38')]||_0x242109[_0xc500('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0xc500('0x3c')](_0x242109,{'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 63e2273..a21910c 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 _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 +var _0x5b5f=['join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x428b38,_0x1dc7c2){var _0x59adf8=function(_0x4506bf){while(--_0x4506bf){_0x428b38['push'](_0x428b38['shift']());}};_0x59adf8(++_0x1dc7c2);}(_0x5b5f,0x1a7));var _0xf5b5=function(_0x5acf1d,_0x17f4d3){_0x5acf1d=_0x5acf1d-0x0;var _0x380572=_0x5b5f[_0x5acf1d];return _0x380572;};'use strict';var _=require(_0xf5b5('0x0'));var moment=require(_0xf5b5('0x1'));var Redis=require(_0xf5b5('0x2'));var util=require(_0xf5b5('0x3'));var config=require('../../config/environment');var db=require(_0xf5b5('0x4'))['db'];var logger=require(_0xf5b5('0x5'))(_0xf5b5('0x6'));config[_0xf5b5('0x7')]=_[_0xf5b5('0x8')](config[_0xf5b5('0x7')],{'host':_0xf5b5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x20eafe=[];return db[_0xf5b5('0xa')][_0xf5b5('0xb')]({'raw':!![],'attributes':['id',_0xf5b5('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf5b5('0xd')](0x18,_0xf5b5('0xe'))}}})['then'](function(_0xb5c3ad){if(_0xb5c3ad&&_0xb5c3ad[_0xf5b5('0xf')]){_0x20eafe=_[_0xf5b5('0x10')](_0xb5c3ad||[],'id');logger[_0xf5b5('0x11')](_0xf5b5('0x12'),_0x20eafe[_0xf5b5('0x13')]());return db['WhatsappInteraction'][_0xf5b5('0x14')]({'closeReason':_0xf5b5('0x15'),'disposition':_0xf5b5('0x16'),'closed':!![],'closedAt':moment()[_0xf5b5('0x17')](_0xf5b5('0x18'))},{'where':{'id':_0x20eafe}});}})[_0xf5b5('0x19')](function(){if(_0x20eafe&&_0x20eafe['length']){logger[_0xf5b5('0x11')](_0xf5b5('0x1a'),_0x20eafe[_0xf5b5('0x13')]());for(var _0x35770a=0x0;_0x35770a<_0x20eafe[_0xf5b5('0xf')];_0x35770a++){io[_0xf5b5('0x1b')](_0xf5b5('0x1c'),{'id':_0x20eafe[_0x35770a],'closed':!![]});}}})[_0xf5b5('0x1d')](function(_0x4e0b49){logger[_0xf5b5('0x1e')](_0xf5b5('0x1f'),_0x4e0b49?util[_0xf5b5('0x20')](_0x4e0b49,{'showHidden':![],'depth':null}):'');});}exports[_0xf5b5('0x21')]=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 0098abe..fdebb14 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xbdd4=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','CmContact','destroy','bulkCreate','then','log'];(function(_0x366f97,_0x64754a){var _0x5c0c44=function(_0x35deaf){while(--_0x35deaf){_0x366f97['push'](_0x366f97['shift']());}};_0x5c0c44(++_0x64754a);}(_0xbdd4,0x138));var _0x4bdd=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xbdd4[_0x47b58b];return _0x46bebe;};'use strict';var util=require('util');var db=require(_0x4bdd('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4bdd('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4bdd('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4bdd('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4bdd('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x4bdd('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4bdd('0x1')]({'id':i,'firstName':_0x4bdd('0x5')+i,'lastName':_0x4bdd('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4bdd('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4bdd('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4bdd('0x4')](),'updatedAt':Date[_0x4bdd('0x4')]()});}db[_0x4bdd('0x6')][_0x4bdd('0x7')]({'where':{}})['then'](function(){return db[_0x4bdd('0x6')][_0x4bdd('0x8')](contacts);})[_0x4bdd('0x9')](function(){console[_0x4bdd('0xa')](_0x4bdd('0xb'),_0x4bdd('0xc'));return db[_0x4bdd('0xd')][_0x4bdd('0x7')]({'where':{}});})[_0x4bdd('0x9')](function(){return db[_0x4bdd('0xd')][_0x4bdd('0x8')](hopper);})[_0x4bdd('0x9')](function(){console['log'](_0x4bdd('0xb'),_0x4bdd('0xe'));return db['CmContact'][_0x4bdd('0x8')](contacts2);})[_0x4bdd('0x9')](function(){console[_0x4bdd('0xa')](_0x4bdd('0xb'),_0x4bdd('0xf'));return db['CmHopper'][_0x4bdd('0x8')](hopper2);})[_0x4bdd('0x9')](function(){console[_0x4bdd('0xa')](_0x4bdd('0xb'),_0x4bdd('0x10'));})['catch'](function(_0x17aa50){console[_0x4bdd('0xa')](_0x17aa50);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 106b421..da3948b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x245d=['then','catch','log','../mysqldb','format','%s%s','agent','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x120787,_0x3f5934){var _0xc757a3=function(_0x57a091){while(--_0x57a091){_0x120787['push'](_0x120787['shift']());}};_0xc757a3(++_0x3f5934);}(_0x245d,0x159));var _0xd245=function(_0xe66db3,_0x343054){_0xe66db3=_0xe66db3-0x0;var _0xd035a7=_0x245d[_0xe66db3];return _0xd035a7;};'use strict';var util=require('util');var db=require(_0xd245('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xd245('0x1')](_0xd245('0x2'),_0xd245('0x3'),i),'fullname':util[_0xd245('0x1')](_0xd245('0x2'),_0xd245('0x3'),i),'email':util['format']('%s%s@xcally.com','agent',i),'role':_0xd245('0x3'),'password':_0xd245('0x4'),'internal':0xfa0+i,'type':_0xd245('0x5'),'transport':[_0xd245('0x6'),'ws',_0xd245('0x7')],'disallow':['all'],'allow':[_0xd245('0x8')],'defaultuser':util[_0xd245('0x1')]('%s%s','agent',i),'encryption':_0xd245('0x9'),'avpf':_0xd245('0x9'),'force_avp':_0xd245('0x9'),'icesupport':_0xd245('0x9'),'dtlsenable':_0xd245('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xd245('0xa'),'dtlssetup':_0xd245('0xb'),'callerid':util[_0xd245('0x1')](_0xd245('0xc'),util['format']('%s%s',_0xd245('0x3'),i),0xfa0+i)});}db[_0xd245('0xd')][_0xd245('0xe')](users)[_0xd245('0xf')](function(){console['log']('add\x20user');})[_0xd245('0x10')](function(_0x14d713){console[_0xd245('0x11')](_0x14d713);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 19bb0af..f55558f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x046b=['user_has_chat_interactions:remove','leave','removeMailInteractions','emit','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:outbound','SmsQueues','MailQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','map','removeChatInteractions'];(function(_0x2b9594,_0x1f439b){var _0x58a5d1=function(_0xd289a1){while(--_0xd289a1){_0x2b9594['push'](_0x2b9594['shift']());}};_0x58a5d1(++_0x1f439b);}(_0x046b,0x1ba));var _0xb046=function(_0x46fa5e,_0x3973d7){_0x46fa5e=_0x46fa5e-0x0;var _0x2a9360=_0x046b[_0x46fa5e];return _0x2a9360;};'use strict';var _=require(_0xb046('0x0'));var util=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var db=require(_0xb046('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb046('0x4')],'include':[{'as':_0xb046('0x5'),'model':db['User'],'attributes':['id',_0xb046('0x4'),_0xb046('0x6')],'raw':!![],'where':{'role':_0xb046('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb046('0x4')],'where':{'role':_0xb046('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb046('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb046('0x4')],'where':{'role':_0xb046('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb046('0x4'),_0xb046('0x9')],'where':{'type':_0xb046('0xa')}};function getAssociatedResources(_0x48f38d,_0x37eef0,_0x53c263){return db[_0xb046('0xb')][_0xb046('0xc')]({'where':{'name':_0x48f38d,'userProfileId':_0x37eef0},'raw':!![]})[_0xb046('0xd')](function(_0x322324){if(_0x322324){if(_0x322324[_0xb046('0xe')]){switch(_0x48f38d){case'VoiceQueues':case _0xb046('0xf'):case _0xb046('0x10'):case'SmsQueues':case'MailQueues':case _0xb046('0x11'):case _0xb046('0x12'):return db[_0x53c263][_0xb046('0x13')](queryQueues);case _0xb046('0x14'):return db[_0x53c263][_0xb046('0x13')](queryTelephones);case _0xb046('0x15'):return db[_0x53c263][_0xb046('0x13')](queryTrunks);case _0xb046('0x16'):return db[_0x53c263][_0xb046('0x13')](queryCampaigns);}}else{return db[_0xb046('0x17')]['findAll']({'attributes':[_0xb046('0x18')],'where':{'sectionId':_0x322324['id']},'raw':!![]})[_0xb046('0xd')](function(_0x4fd90c){if(_0x4fd90c){var _0x2b0d1e={'where':{'id':_['map'](_0x4fd90c,_0xb046('0x18'))},'raw':!![]};switch(_0x53c263){case _0xb046('0x19'):_0x2b0d1e[_0xb046('0x1a')][_0xb046('0x6')]=_0xb046('0x8');break;case _0xb046('0x1b'):_0x2b0d1e['where']['type']=_0xb046('0xa');break;}return db[_0x53c263][_0xb046('0x13')](_0x2b0d1e);}else{return[];}});}}else{return[];}})[_0xb046('0xd')](function(_0x4cd3c1){return _0x4cd3c1;});}function joinOrLeaveQueues(_0x541283,_0x1d617c,_0x5e5594,_0x144022){_0x541283[_0x1d617c](util['format'](_0xb046('0x1c'),_0x5e5594,_0x144022[_0xb046('0x4')]));if(_0x144022[_0xb046('0x5')]){for(var _0x324dba=0x0;_0x324dba<_0x144022['Agents']['length'];_0x324dba+=0x1){_0x541283[_0x1d617c](util['format'](_0xb046('0x1d'),_0x144022[_0xb046('0x5')][_0x324dba][_0xb046('0x4')]));}}}function joinOrLeave(_0x471c65,_0xc3c99a,_0x433526){var _0x51c65d;if(_0x471c65[_0xb046('0x1e')]['query']['id']){db['User'][_0xb046('0x1f')]({'attributes':['id',_0xb046('0x4'),_0xb046('0x6'),_0xb046('0x20')],'where':{'id':_0x471c65[_0xb046('0x1e')][_0xb046('0x21')]['id']},'include':[{'model':db[_0xb046('0x22')],'as':_0xb046('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x25')],'as':_0xb046('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x27')],'as':_0xb046('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x29')],'as':_0xb046('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xb046('0xd')](function(_0x333dbe){if(_0x333dbe){_0x51c65d=_0x333dbe;_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x1d'),_0x333dbe[_0xb046('0x4')]));var _0x4706ab=[];switch(_0x333dbe[_0xb046('0x6')]){case'admin':_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a]('voice:outbound');if(queryQueues[_0xb046('0x2d')](_0xb046('0x2e'))){delete queryQueues[_0xb046('0x2e')];}_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x30')]['findAll'](queryQueues));_0x4706ab['push'](db[_0xb046('0x31')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x32')]['findAll'](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x33')][_0xb046('0x13')](queryQueues));_0x4706ab['push'](db[_0xb046('0x34')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x35')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x19')][_0xb046('0x13')](queryTelephones));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x36')]['findAll'](queryTrunks));_0x4706ab[_0xb046('0x2f')](db['Campaign'][_0xb046('0x13')](queryCampaigns));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x19')][_0xb046('0x13')](queryAgents));break;case _0xb046('0x37'):_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a](_0xb046('0x38'));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('VoiceQueues',_0x333dbe[_0xb046('0x20')],_0xb046('0x30')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('ChatQueues',_0x333dbe['userProfileId'],'ChatQueue'));_0x4706ab['push'](getAssociatedResources(_0xb046('0x10'),_0x333dbe[_0xb046('0x20')],'FaxQueue'));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x39'),_0x333dbe[_0xb046('0x20')],_0xb046('0x33')));_0x4706ab['push'](getAssociatedResources(_0xb046('0x3a'),_0x333dbe['userProfileId'],_0xb046('0x34')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x11'),_0x333dbe[_0xb046('0x20')],_0xb046('0x35')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x12'),_0x333dbe[_0xb046('0x20')],_0xb046('0x3b')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x14'),_0x333dbe[_0xb046('0x20')],_0xb046('0x19')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('Trunks',_0x333dbe[_0xb046('0x20')],_0xb046('0x36')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x16'),_0x333dbe[_0xb046('0x20')],_0xb046('0x1b')));_0x4706ab['push'](db['User'][_0xb046('0x13')](queryAgents));break;case _0xb046('0x7'):_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a](_0xb046('0x38'));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x3c')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3d')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3e')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3f')]({'attributes':['id','name']}));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x40')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x41')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x42')]({'attributes':['id',_0xb046('0x4')]}));break;}return BPromise['all'](_0x4706ab);}})['then'](function(_0x5b81f1){if(_0x5b81f1&&_0x5b81f1[_0xb046('0x43')]){for(var _0x7004b4=0x0;_0x7004b4<_0x5b81f1[_0xb046('0x43')];_0x7004b4+=0x1){for(var _0x33a6fd=0x0;_0x33a6fd<_0x5b81f1[_0x7004b4][_0xb046('0x43')];_0x33a6fd+=0x1){switch(_0x7004b4){case 0x0:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x44'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x1:joinOrLeaveQueues(_0x471c65,_0xc3c99a,'chat',_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x2:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x45'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x3:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x46'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x4:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x47'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x5:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x48'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x6:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x49'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x7:if(_0x51c65d[_0xb046('0x6')]!==_0xb046('0x7'))_0x471c65[_0xc3c99a](util[_0xb046('0x2b')]('telephone:%s',_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;case 0x8:if(_0x51c65d[_0xb046('0x6')]!==_0xb046('0x7'))_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x4a'),_0x5b81f1[_0x7004b4][_0x33a6fd]['name']));break;case 0x9:if(_0x51c65d[_0xb046('0x6')]!=='agent')_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x4b'),_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x9')],_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;case 0xa:_0x471c65[_0xc3c99a](util['format'](_0xb046('0x1d'),_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;}}}}})[_0xb046('0xd')](function(){if(_0xc3c99a==='leave'){var _0x474b65=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x23')],'id');return _0x51c65d[_0xb046('0x4d')](_0x474b65)[_0xb046('0xd')](function(){for(var _0x248097=0x0;_0x248097<_0x474b65[_0xb046('0x43')];_0x248097+=0x1){_0x433526['emit'](_0xb046('0x4e'),{'ChatInteractionId':Number(_0x474b65[_0x248097]),'UserId':Number(_0x51c65d['id'])});}});}})['then'](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x41e3a8=_['map'](_0x51c65d['MailInteractions'],'id');return _0x51c65d[_0xb046('0x50')](_0x41e3a8)[_0xb046('0xd')](function(){for(var _0x27692a=0x0;_0x27692a<_0x41e3a8['length'];_0x27692a+=0x1){_0x433526[_0xb046('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x41e3a8[_0x27692a]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x4dd0f7=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x52')],'id');return _0x51c65d[_0xb046('0x53')](_0x4dd0f7)['then'](function(){for(var _0x10ed02=0x0;_0x10ed02<_0x4dd0f7[_0xb046('0x43')];_0x10ed02+=0x1){_0x433526['emit'](_0xb046('0x54'),{'FaxInteractionId':Number(_0x4dd0f7[_0x10ed02]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x22adbf=_['map'](_0x51c65d['SmsInteractions'],'id');return _0x51c65d[_0xb046('0x55')](_0x22adbf)[_0xb046('0xd')](function(){for(var _0x5d3fbb=0x0;_0x5d3fbb<_0x22adbf[_0xb046('0x43')];_0x5d3fbb+=0x1){_0x433526[_0xb046('0x51')](_0xb046('0x56'),{'SmsInteractionId':Number(_0x22adbf[_0x5d3fbb]),'UserId':Number(_0x51c65d['id'])});}});}})['then'](function(){if(_0xc3c99a==='leave'){var _0x262cde=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x28')],'id');return _0x51c65d[_0xb046('0x57')](_0x262cde)[_0xb046('0xd')](function(){for(var _0x3aff1a=0x0;_0x3aff1a<_0x262cde[_0xb046('0x43')];_0x3aff1a+=0x1){_0x433526[_0xb046('0x51')](_0xb046('0x58'),{'OpenchannelInteractionId':Number(_0x262cde[_0x3aff1a]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x28cce4=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x2a')],'id');return _0x51c65d[_0xb046('0x59')](_0x28cce4)['then'](function(){for(var _0x519d2d=0x0;_0x519d2d<_0x28cce4[_0xb046('0x43')];_0x519d2d+=0x1){_0x433526['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x28cce4[_0x519d2d]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0x5a')](function(_0x2c6782){_0x471c65[_0xb046('0x5b')](_0x2c6782);});}}function onDisconnect(_0x237cbe,_0x2fe60b){joinOrLeave(_0x237cbe,_0xb046('0x4f'),_0x2fe60b);}function onConnect(_0x21735d){joinOrLeave(_0x21735d,_0xb046('0x5c'));}exports[_0xb046('0x5d')]=function(_0x119754){_0x119754['on'](_0xb046('0x5e'),function(_0x4caa5a){_0x4caa5a[_0xb046('0x5f')](0x0);_0x4caa5a[_0xb046('0x60')]=_0x4caa5a[_0xb046('0x61')][_0xb046('0x5e')][_0xb046('0x62')]+':'+_0x4caa5a[_0xb046('0x61')][_0xb046('0x5e')]['remotePort'];_0x4caa5a['connectedAt']=new Date();_0x4caa5a['log']=function(_0x555b8a){console[_0xb046('0x5b')](_0xb046('0x63')+_0x4caa5a[_0xb046('0x64')][_0xb046('0x4')]+'['+_0x4caa5a['address']+']',_0x555b8a);};_0x4caa5a['on'](_0xb046('0x65'),function(){onDisconnect(_0x4caa5a,_0x119754);_0x4caa5a[_0xb046('0x5b')](_0xb046('0x66'));});onConnect(_0x4caa5a);_0x4caa5a[_0xb046('0x5b')](_0xb046('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a3c63e7..da874e4 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 _0x4dc1=['Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','UserId','format','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','resolve','sequelize','query','Sequelize','interface','SIP/%s','AfterCreate','closed','changed','substatus','AfterUpdate','fullname','email','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','OpenchannelInteraction'];(function(_0x2eef0a,_0x320cb1){var _0x20ec4d=function(_0x53f4d4){while(--_0x53f4d4){_0x2eef0a['push'](_0x2eef0a['shift']());}};_0x20ec4d(++_0x320cb1);}(_0x4dc1,0x116));var _0x14dc=function(_0xd5d6b3,_0x420f41){_0xd5d6b3=_0xd5d6b3-0x0;var _0x1810e7=_0x4dc1[_0xd5d6b3];return _0x1810e7;};'use strict';var util=require(_0x14dc('0x0'));var db=require(_0x14dc('0x1'))['db'];var jayson=require(_0x14dc('0x2'));var logger=require(_0x14dc('0x3'))('triggers');var client=jayson[_0x14dc('0x4')][_0x14dc('0x5')]({'port':0x232a});var triggers=[{'channel':_0x14dc('0x6'),'model':_0x14dc('0x7'),'event':_0x14dc('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x14dc('0x6'),'model':_0x14dc('0x7'),'event':_0x14dc('0x9'),'condition':_0x14dc('0xa'),'callback':afterUpdate},{'channel':_0x14dc('0x6'),'model':'ChatMessage','event':_0x14dc('0x8'),'condition':_0x14dc('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x14dc('0xc'),'event':_0x14dc('0x8'),'condition':_0x14dc('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x14dc('0xd'),'model':_0x14dc('0xe'),'event':_0x14dc('0x8'),'condition':_0x14dc('0xf'),'callback':afterCreate},{'channel':'Sms','model':_0x14dc('0xe'),'event':_0x14dc('0x9'),'condition':_0x14dc('0xa'),'callback':afterUpdate},{'channel':_0x14dc('0xd'),'model':_0x14dc('0x10'),'event':_0x14dc('0x8'),'condition':_0x14dc('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x14dc('0x8'),'condition':_0x14dc('0xf'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x14dc('0x11'),'event':_0x14dc('0x9'),'condition':_0x14dc('0xa'),'callback':afterUpdate},{'channel':_0x14dc('0x12'),'model':_0x14dc('0x13'),'event':_0x14dc('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x14dc('0x14'),'model':_0x14dc('0x15'),'event':_0x14dc('0x8'),'condition':_0x14dc('0xf'),'callback':afterCreate},{'channel':_0x14dc('0x14'),'model':'FaxInteraction','event':_0x14dc('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0x14dc('0x16'),'event':_0x14dc('0x8'),'condition':_0x14dc('0xb'),'callback':afterCreateMessage},{'channel':_0x14dc('0x17'),'model':'MailInteraction','event':_0x14dc('0x8'),'condition':_0x14dc('0xf'),'callback':afterCreate},{'channel':'Mail','model':_0x14dc('0x18'),'event':_0x14dc('0x9'),'condition':_0x14dc('0xa'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x14dc('0x8'),'condition':_0x14dc('0xb'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x14dc('0x8'),'condition':_0x14dc('0xf'),'callback':afterCreate},{'channel':'Openchannel','model':_0x14dc('0x19'),'event':'afterUpdate','condition':_0x14dc('0xa'),'callback':afterUpdate},{'channel':_0x14dc('0x1a'),'model':_0x14dc('0x1b'),'event':_0x14dc('0x8'),'condition':_0x14dc('0xb'),'callback':afterCreateMessage}];function request(_0x73340d){return client['request'](_0x14dc('0x1c'),_0x73340d)[_0x14dc('0x1d')](function(_0x589f25){logger[_0x14dc('0x1e')](_0x14dc('0x1f'),_0x14dc('0x1c'),_0x589f25);if(_0x589f25[_0x14dc('0x20')]){if(_0x589f25['error'][_0x14dc('0x21')]===0x1f4){logger[_0x14dc('0x20')]('Trigger,\x20%s','EventManager',_0x589f25[_0x14dc('0x20')]);}}})[_0x14dc('0x22')](function(_0x3f71d1){logger[_0x14dc('0x20')](_0x14dc('0x1f'),_0x14dc('0x1c'),_0x3f71d1);});}function afterCreateMessage(_0x28e95d){return function(_0x452c18){_0x452c18=_0x452c18[_0x14dc('0x23')]({'plain':!![]});_0x452c18[_0x14dc('0x24')]=_0x28e95d;_0x452c18[_0x14dc('0x25')]=_0x28e95d;_0x452c18[_0x14dc('0x26')]=_0x452c18[_0x14dc('0x27')];Promise['resolve']()[_0x14dc('0x1d')](function(){if(typeof _0x452c18['ContactId']===_0x14dc('0x28'))return null;var _0x321c3b=_0x14dc('0x29')+_0x452c18[_0x14dc('0x2a')];return db['sequelize']['query'](_0x321c3b,{'type':db['Sequelize'][_0x14dc('0x2b')][_0x14dc('0x2c')],'raw':!![]});})['then'](function(_0x5db411){if(_0x5db411){_0x452c18[_0x14dc('0x2d')]=_0x5db411[0x0];}if(typeof _0x452c18['UserId']==='undefined')return;return getAgent(_0x452c18[_0x14dc('0x2e')]);})[_0x14dc('0x1d')](function(_0x2f9614){if(_0x2f9614){_0x452c18['interface']=util[_0x14dc('0x2f')]('SIP/%s',_0x2f9614[_0x14dc('0x30')]);_0x452c18[_0x14dc('0x31')]=_0x2f9614;_0x452c18[_0x14dc('0x24')]=_0x28e95d;return request({'event':_0x14dc('0x32'),'message':_0x452c18});}else{return request({'event':_0x14dc('0x33'),'message':_0x452c18});}})[_0x14dc('0x22')](function(_0x4f26e1){logger['error']('Trigger,\x20%s',_0x14dc('0x34'),_0x4f26e1);});};}function afterCreateOfflineMessage(_0x148bad){return function(_0x3c1452){_0x3c1452=_0x3c1452[_0x14dc('0x23')]({'plain':!![]});_0x3c1452[_0x14dc('0x24')]=_0x148bad;_0x3c1452['motionChannel']=_0x148bad;_0x3c1452[_0x14dc('0x26')]=_0x14dc('0x35');return request({'event':_0x3c1452[_0x14dc('0x26')],'message':_0x3c1452});};}function afterCreate(_0x27cfa7,_0x3014fa){return function(_0x5d308f){var _0x154085=_0x5d308f['get']({'plain':!![]});_0x154085[_0x14dc('0x24')]=_0x27cfa7;_0x154085[_0x14dc('0x25')]=_0x27cfa7;_0x154085[_0x14dc('0x26')]=_0x14dc('0x36');Promise[_0x14dc('0x37')]()['then'](function(){var _0x4225e1=_0x14dc('0x29')+_0x154085['ContactId'];return db[_0x14dc('0x38')][_0x14dc('0x39')](_0x4225e1,{'type':db[_0x14dc('0x3a')][_0x14dc('0x2b')][_0x14dc('0x2c')],'raw':!![]});})[_0x14dc('0x1d')](function(_0x5dbecd){if(_0x5dbecd){_0x154085[_0x14dc('0x2d')]=_0x5dbecd[0x0];}if(_0x154085[_0x14dc('0x2e')]){return getAgent(_0x154085['UserId']);}return;})[_0x14dc('0x1d')](function(_0x3e4697){if(_0x3e4697){_0x154085[_0x14dc('0x3b')]=util['format'](_0x14dc('0x3c'),_0x3e4697[_0x14dc('0x30')]);_0x154085[_0x14dc('0x31')]=_0x3e4697;}return request({'event':_0x3014fa,'message':_0x154085});})[_0x14dc('0x22')](function(_0x2fa15e){logger['error'](_0x14dc('0x1f'),_0x14dc('0x3d'),_0x2fa15e);});};}function afterUpdate(_0x4e3582){return function(_0x48caa0){var _0x31c001=_0x48caa0['changed'](_0x14dc('0x3e'))&&_0x48caa0[_0x14dc('0x3e')];var _0x425804=_0x48caa0[_0x14dc('0x3f')](_0x14dc('0x40'));if(_0x31c001||_0x425804){var _0x5c4115=_0x31c001?'closedinteraction':_0x14dc('0x40');var _0x10fcf4=_0x48caa0[_0x14dc('0x23')]({'plain':!![]});_0x10fcf4['channel']=_0x4e3582;_0x10fcf4['motionChannel']=_0x4e3582;_0x10fcf4[_0x14dc('0x26')]=_0x31c001?_0x14dc('0x3e'):_0x14dc('0x40');var _0x6e6914=_0x14dc('0x29')+_0x10fcf4[_0x14dc('0x2a')];return db[_0x14dc('0x38')]['query'](_0x6e6914,{'type':db[_0x14dc('0x3a')][_0x14dc('0x2b')][_0x14dc('0x2c')],'raw':!![]})['then'](function(_0x55b515){if(_0x55b515){_0x10fcf4['contact']=_0x55b515[0x0];}if(typeof _0x10fcf4['UserId']===_0x14dc('0x28'))return;return getAgent(_0x10fcf4['UserId']);})[_0x14dc('0x1d')](function(_0x414ff5){if(_0x414ff5){_0x10fcf4[_0x14dc('0x3b')]=util[_0x14dc('0x2f')](_0x14dc('0x3c'),_0x414ff5[_0x14dc('0x30')]);_0x10fcf4['agent']=_0x414ff5;}return request({'event':_0x5c4115,'message':_0x10fcf4});})[_0x14dc('0x22')](function(_0x22ce8a){logger[_0x14dc('0x20')]('Trigger,\x20%s',_0x14dc('0x41'),_0x22ce8a);});}};}function getAgent(_0x3c0f94){return db['User']['find']({'where':{'id':_0x3c0f94},'attributes':['id',_0x14dc('0x30'),_0x14dc('0x42'),_0x14dc('0x43'),_0x14dc('0x44')],'raw':!![]})[_0x14dc('0x1d')](function(_0x309710){return _0x309710;});}exports[_0x14dc('0x45')]=function(){for(var _0x29a381=0x0;_0x29a381=_0xa67734[_0x15a0('0x15')]){throw Error(_0x15a0('0x16'));}_0x1dae83(_0x19ba68);})[_0x15a0('0x17')](function(_0x1bdc81){_0x570d29(_0x1bdc81);});});}; \ No newline at end of file +var _0x7118=['openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','updateAttributes','agent','User','count','getLicense','then','agents','catch','lodash','../mysqldb','./license/util','voice','mail','chat','sms','whatsapp'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7118,0x1db));var _0x8711=function(_0x455902,_0x1f2ed5){_0x455902=_0x455902-0x0;var _0x10f513=_0x7118[_0x455902];return _0x10f513;};'use strict';var _=require(_0x8711('0x0'));var BPromise=require('bluebird');var db=require(_0x8711('0x1'))['db'];var util=require(_0x8711('0x2'));var channels=[_0x8711('0x3'),_0x8711('0x4'),_0x8711('0x5'),'fax',_0x8711('0x6'),_0x8711('0x7'),_0x8711('0x8')];exports[_0x8711('0x9')]=function(){return channels;};exports[_0x8711('0xa')]=function(_0x52596a){_0x52596a=_0x52596a[_0x8711('0xb')]();return _['includes'](channels,_0x52596a);};exports[_0x8711('0xc')]=function(_0x25cac3,_0x3b89ae,_0x4d8154,_0x19c3bf){var _0x538d18={'loginAttempts':_0x3b89ae,'blocked':_0x4d8154};if(!_['isUndefined'](_0x19c3bf)){_0x538d18['blockedAt']=_0x19c3bf;}return _0x25cac3[_0x8711('0xd')](_0x538d18);};exports['getLicense']=function(_0x5baae7){return new BPromise(function(_0x5468e9,_0x4cfb1a){var _0x5b09b4=0x0;if(_0x5baae7['role']!==_0x8711('0xe')){_0x5468e9(_0x5baae7);}db[_0x8711('0xf')][_0x8711('0x10')]({'where':{'role':_0x8711('0xe'),'online':!![],'id':{'$ne':_0x5baae7['id']}}})['then'](function(_0x3cecd3){_0x5b09b4=_0x3cecd3;return util[_0x8711('0x11')]();})[_0x8711('0x12')](function(_0x4a8fdf){if(_0x4a8fdf&&_0x4a8fdf[_0x8711('0x13')]&&_0x5b09b4>=_0x4a8fdf['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5468e9(_0x5baae7);})[_0x8711('0x14')](function(_0x4da071){_0x4cfb1a(_0x4da071);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 99abe52..d96c673 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x71e0=['OutOfInterval','Conflict','stack','statusMessage','send','../config/logger','api','inherits','message','Bad\x20Request','name','Forbidden','Not\x20Found','Out\x20Of\x20Interval','code'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x71e0,0x15e));var _0x071e=function(_0x251598,_0x5a0a1b){_0x251598=_0x251598-0x0;var _0x46b489=_0x71e0[_0x251598];return _0x46b489;};'use strict';var util=require('util');var logger=require(_0x071e('0x0'))(_0x071e('0x1'));var APIError=function(_0x264e0d,_0x379dfc){this['message']=_0x264e0d||'Internal\x20Server\x20Error';this['name']=_0x379dfc||'Error';util[_0x071e('0x2')](APIError,Error);};var APIBadRequestError=function(_0x299c6d){this[_0x071e('0x3')]=_0x299c6d||_0x071e('0x4');this[_0x071e('0x5')]=_0x071e('0x4');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xc9f614){this[_0x071e('0x3')]=_0xc9f614||_0x071e('0x6');this[_0x071e('0x5')]=_0x071e('0x6');util[_0x071e('0x2')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x115447){this['message']=_0x115447||'Entity\x20not\x20found';this[_0x071e('0x5')]=_0x071e('0x7');util[_0x071e('0x2')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2cffbd){this[_0x071e('0x3')]=_0x2cffbd||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x071e('0x5')]=_0x071e('0x8');this[_0x071e('0x9')]=0x193;this['details']={'type':_0x071e('0xa')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x463d63){this[_0x071e('0x3')]=_0x463d63||'Resource\x20Conflict';this[_0x071e('0x5')]=_0x071e('0xb');util[_0x071e('0x2')](APIBadRequestError,APIError);};function getStatusCode(_0x576233){switch(_0x576233){case _0x071e('0x4'):return 0x190;case _0x071e('0x6'),_0x071e('0x8'):return 0x193;case'Not\x20Found':return 0x194;case _0x071e('0xb'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1230a9){if(_0x1230a9==='Out\x20Of\x20Interval')return _0x1230a9;return null;}function handleError(_0xb3094a){return function(_0x185a9f){logger['error'](_0x185a9f[_0x071e('0xc')]);var _0x40905d=getStatusCode(_0x185a9f['name']);var _0x244199=getCustomStatusMessage(_0x185a9f[_0x071e('0x5')]);if(_0x185a9f['name']){delete _0x185a9f[_0x071e('0x5')];}if(_0x244199){_0xb3094a[_0x071e('0xd')]=_0x244199;}return _0xb3094a['status'](_0x40905d)[_0x071e('0xe')](_0x185a9f);};}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 92e72c7..24dd679 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xa130=['exports','404','status'];(function(_0x1416fc,_0x72e155){var _0x3a4b34=function(_0x455ac8){while(--_0x455ac8){_0x1416fc['push'](_0x1416fc['shift']());}};_0x3a4b34(++_0x72e155);}(_0xa130,0x1cb));var _0x0a13=function(_0x55358e,_0x413315){_0x55358e=_0x55358e-0x0;var _0x45a0c6=_0xa130[_0x55358e];return _0x45a0c6;};'use strict';module[_0x0a13('0x0')][0x194]=function pageNotFound(_0x4448f4,_0x250c8b){var _0x451c08=_0x0a13('0x1');var _0x649aca=0x194;var _0x4183de={'status':_0x649aca};_0x250c8b['status'](_0x4183de['status']);_0x250c8b['render'](_0x451c08,{},function(_0x50267e,_0x2aa5eb){if(_0x50267e){return _0x250c8b[_0x0a13('0x2')](_0x4183de[_0x0a13('0x2')])['json'](_0x4183de);}_0x250c8b['send'](_0x2aa5eb);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index afe4260..10749bb 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x4ac7=['../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','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','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','User','userSetting','hasMany','Recordings','UserId','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','CmHopper','Hoppers','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperFinal','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','CmList','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Answers','MailMessage','List','Template','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatOfflineMessage','IntervalId','ListId','Dispositions','FaxAccountId','Interactions','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','TagId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CompanyId','Phones','CmContactId','Company','AdditionalPhones','CmHopperId','Agent','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Action','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','cm_contact_has_tags','WhatsappInteraction','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','SugarcrmField','Field','DeskField','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','Dynamics365Account','ChatQueueReport','FromId','ToId','SessionId','ProjectId','user_has_teams','team_has_mail_queues','team_has_fax_queues','OpenchannelQueues','HopperBlacks','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToMailAccountId','ToAccount','ToAgent','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','../config/environment','jstz','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','mysql','password','options','database','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model'];(function(_0x39c2a3,_0x5b8d9a){var _0x540c8d=function(_0x3ca526){while(--_0x3ca526){_0x39c2a3['push'](_0x39c2a3['shift']());}};_0x540c8d(++_0x5b8d9a);}(_0x4ac7,0x13b));var _0x74ac=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4ac7[_0x465028];return _0xb783d4;};'use strict';var config=require(_0x74ac('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x74ac('0x1'));var timezone=jstz['determine']();config[_0x74ac('0x2')]=_[_0x74ac('0x3')](config[_0x74ac('0x2')],{'database':'motion2','username':_0x74ac('0x4'),'password':_0x74ac('0x5'),'options':{'host':_0x74ac('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x74ac('0x7')},'logging':![],'timezone':timezone[_0x74ac('0x8')](),'define':{'charset':_0x74ac('0x9'),'collate':_0x74ac('0xa')}}});config[_0x74ac('0xb')]=_[_0x74ac('0x3')](config[_0x74ac('0xb')],{'database':_0x74ac('0xc'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x74ac('0xd'),'dialectOptions':{'charset':_0x74ac('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x74ac('0x9'),'collate':_0x74ac('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x74ac('0x2')]['username'],config[_0x74ac('0x2')][_0x74ac('0xe')],config['sequelize'][_0x74ac('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x74ac('0x10')],config[_0x74ac('0xb')]['username'],config[_0x74ac('0xb')][_0x74ac('0xe')],config['sequelizeHistory']['options'])};db['User']=db[_0x74ac('0x2')]['import']('../api/user/user.model');db[_0x74ac('0x11')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x13'));db[_0x74ac('0x14')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x15'));db['VoiceExtension']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x16'));db[_0x74ac('0x17')]=db['sequelize'][_0x74ac('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x74ac('0x18')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x19'));db[_0x74ac('0x1a')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x1b'));db[_0x74ac('0x1c')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/screenRecording/screenRecording.model');db[_0x74ac('0x1d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x1e'));db[_0x74ac('0x1f')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x20'));db[_0x74ac('0x21')]=db['sequelize']['import'](_0x74ac('0x22'));db[_0x74ac('0x23')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x24'));db[_0x74ac('0x25')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x26'));db['MemberReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x27'));db[_0x74ac('0x28')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x29'));db['VoiceTransferReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x2a'));db['UserVoiceQueueRt']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x2b'));db['UserVoiceQueue']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x2c'));db[_0x74ac('0x2d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x2e'));db[_0x74ac('0x2f')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x30'));db[_0x74ac('0x31')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x32'));db['UserOpenchannelQueue']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x74ac('0x33')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x74ac('0x34')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x35'));db[_0x74ac('0x36')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/mailServerOut/mailServerOut.model');db[_0x74ac('0x37')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x38'));db[_0x74ac('0x39')]=db['sequelize']['import'](_0x74ac('0x3a'));db[_0x74ac('0x3b')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x3c'));db[_0x74ac('0x3d')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x3e'));db['MailMessage']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x3f'));db[_0x74ac('0x40')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x41'));db[_0x74ac('0x42')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x43'));db[_0x74ac('0x44')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x45'));db[_0x74ac('0x46')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x47'));db['FaxAccount']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x48'));db[_0x74ac('0x49')]=db['sequelize']['import']('../api/faxApplication/faxApplication.model');db[_0x74ac('0x4a')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x74ac('0x4b')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/faxMessage/faxMessage.model');db[_0x74ac('0x4c')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x4d'));db[_0x74ac('0x4e')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0x74ac('0x4f')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x50'));db['SmsApplication']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x51'));db[_0x74ac('0x52')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x53'));db[_0x74ac('0x54')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x55'));db[_0x74ac('0x56')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x57'));db['OpenchannelAccount']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x58'));db[_0x74ac('0x59')]=db['sequelize'][_0x74ac('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x74ac('0x5a')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x5b'));db[_0x74ac('0x5c')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x5d'));db[_0x74ac('0x5e')]=db['sequelize'][_0x74ac('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x74ac('0x5f')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x60'));db[_0x74ac('0x61')]=db['sequelize'][_0x74ac('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x74ac('0x62')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/chatApplication/chatApplication.model');db[_0x74ac('0x63')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x64'));db[_0x74ac('0x65')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x74ac('0x2')]['import'](_0x74ac('0x66'));db[_0x74ac('0x67')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x68'));db[_0x74ac('0x69')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/chatGroup/chatGroup.model');db[_0x74ac('0x6a')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x6b'));db[_0x74ac('0x6c')]=db['sequelize'][_0x74ac('0x12')]('../api/cmCompany/cmCompany.model');db[_0x74ac('0x6d')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x6e'));db[_0x74ac('0x6f')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x70'));db['CmHopperFinal']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x71'));db[_0x74ac('0x72')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x73'));db[_0x74ac('0x74')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x75'));db[_0x74ac('0x76')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x77'));db['Action']=db[_0x74ac('0x2')]['import'](_0x74ac('0x78'));db[_0x74ac('0x79')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x7a'));db[_0x74ac('0x7b')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x7c'));db[_0x74ac('0x7d')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x7e'));db['Condition']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x7f'));db[_0x74ac('0x80')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x81'));db[_0x74ac('0x82')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x83'));db[_0x74ac('0x84')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x85'));db[_0x74ac('0x86')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x87'));db[_0x74ac('0x88')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x89'));db[_0x74ac('0x8a')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x8b'));db[_0x74ac('0x8c')]=db['sequelize'][_0x74ac('0x12')]('../api/tag/tag.model');db[_0x74ac('0x8d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x8e'));db[_0x74ac('0x8f')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x90'));db[_0x74ac('0x91')]=db[_0x74ac('0x2')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x92'));db['Trigger']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/trigger/trigger.model');db[_0x74ac('0x93')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x94'));db[_0x74ac('0x95')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x96'));db[_0x74ac('0x97')]=db[_0x74ac('0x2')]['import']('../api/integrationReport/integrationReport.model');db[_0x74ac('0x98')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x99'));db[_0x74ac('0x9a')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x9b'));db[_0x74ac('0x9c')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x9d'));db[_0x74ac('0x9e')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x9f'));db[_0x74ac('0xa0')]=db['sequelize']['import'](_0x74ac('0xa1'));db[_0x74ac('0xa2')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xa3'));db[_0x74ac('0xa4')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xa5'));db[_0x74ac('0xa6')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xa7'));db[_0x74ac('0xa8')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xa9'));db['SugarcrmConfiguration']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xaa'));db['SugarcrmField']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xab'));db[_0x74ac('0xac')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xad'));db[_0x74ac('0xae')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xaf'));db['DeskField']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intDeskField/intDeskField.model');db[_0x74ac('0xb0')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xb1'));db['ZohoConfiguration']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xb2'));db[_0x74ac('0xb3')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xb4'));db[_0x74ac('0xb5')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x74ac('0xb6')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xb7'));db[_0x74ac('0xb8')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xb9'));db[_0x74ac('0xba')]=db[_0x74ac('0x2')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x74ac('0xbb')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xbc'));db[_0x74ac('0xbd')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xbe'));db[_0x74ac('0xbf')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xc0'));db[_0x74ac('0xc1')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xc2'));db[_0x74ac('0xc3')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xc4'));db[_0x74ac('0xc5')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xc6'));db[_0x74ac('0xc7')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xc8'));db['Dynamics365Account']=db[_0x74ac('0x2')]['import'](_0x74ac('0xc9'));db[_0x74ac('0xca')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x74ac('0xcb')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xcc'));db[_0x74ac('0xcd')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xce'));db[_0x74ac('0xcf')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x74ac('0xd0')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xd1'));db[_0x74ac('0x95')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x96'));db['Network']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/network/network.model');db['ChatQueueReport']=db[_0x74ac('0x2')]['import'](_0x74ac('0xd2'));db[_0x74ac('0xd3')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xd4'));db[_0x74ac('0xd5')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xd6'));db[_0x74ac('0xd7')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xd8'));db['JscriptySessionReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xd9'));db[_0x74ac('0xda')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xdb'));db[_0x74ac('0xdc')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xdd'));db[_0x74ac('0xde')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xdf'));db[_0x74ac('0xe0')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xe1'));db[_0x74ac('0xe2')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xe3'));db[_0x74ac('0xe4')]=db[_0x74ac('0x2')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x74ac('0xe5')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xe6'));db[_0x74ac('0xe7')]=db['sequelize'][_0x74ac('0x12')]('../api/squareRecording/squareRecording.model');db[_0x74ac('0xe8')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xe9'));db[_0x74ac('0xea')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xeb'));db[_0x74ac('0xec')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xed'));db[_0x74ac('0xee')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xef'));db[_0x74ac('0xf0')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xf1'));db[_0x74ac('0xf2')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xf3'));db[_0x74ac('0xf4')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xf5'));db[_0x74ac('0xf6')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x74ac('0xf7')]=db['sequelize']['import'](_0x74ac('0xf8'));db['FaxTransferReport']=db['sequelize']['import'](_0x74ac('0xf9'));db['OpenchannelTransferReport']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x74ac('0x2')]['import'](_0x74ac('0xfa'));db['CmList']=db[_0x74ac('0x2')]['import'](_0x74ac('0xfb'));db[_0x74ac('0xfc')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xfd'));db['UserProfile']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xfe'));db[_0x74ac('0xff')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x100'));db[_0x74ac('0x101')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x102'));db['UserNotification']=db[_0x74ac('0x2')]['import'](_0x74ac('0x103'));db[_0x74ac('0x104')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x105'));db[_0x74ac('0x106')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x107'));db['WhatsappInteraction']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x108'));db[_0x74ac('0x109')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/whatsappMessage/whatsappMessage.model');db[_0x74ac('0x10a')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x10b'));db[_0x74ac('0x10c')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x74ac('0x10d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x10e'));db[_0x74ac('0x10f')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x110'));db[_0x74ac('0x111')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x112'));db[_0x74ac('0x113')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x114'));db['UserVoicePrefix']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x115'));db[_0x74ac('0x116')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/user-setting/user-setting.model');db[_0x74ac('0x117')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x118'));db['User'][_0x74ac('0x119')](db[_0x74ac('0x1d')],{'as':_0x74ac('0x1d'),'onDelete':_0x74ac('0x11a'),'foreignKey':'UserId'});db[_0x74ac('0x11b')]['hasOne'](db[_0x74ac('0x116')],{'as':_0x74ac('0x11c'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0x74ac('0x11d')](db[_0x74ac('0x1a')],{'as':_0x74ac('0x11e'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x120')],{'as':'VoiceQueuesRt','foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x122'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db['CmHopperFinal'],{'as':_0x74ac('0x123'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db['CmHopperHistory'],{'as':_0x74ac('0x124'),'foreignKey':_0x74ac('0x11f')});db['User'][_0x74ac('0x11d')](db['ReportAgentPreview'],{'as':_0x74ac('0x74'),'foreignKey':'UserId'});db['User'][_0x74ac('0x11d')](db['OpenchannelInteraction'],{'as':_0x74ac('0x125'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x74ac('0x63')],{'as':_0x74ac('0x126'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')]['hasMany'](db[_0x74ac('0x52')],{'as':_0x74ac('0x127'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x4a')],{'as':_0x74ac('0x128'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x3d')],{'as':_0x74ac('0x129'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db['WhatsappInteraction'],{'as':_0x74ac('0x12a'),'foreignKey':_0x74ac('0x11f')});db['User'][_0x74ac('0x11d')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x74ac('0x12b')});db['User'][_0x74ac('0x11d')](db[_0x74ac('0x12c')],{'as':_0x74ac('0x12d'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x74ac('0x11b')][_0x74ac('0x12e')](db[_0x74ac('0x12f')],{'as':'UserProfile','foreignKey':_0x74ac('0x130')});db['User']['belongsToMany'](db[_0x74ac('0x69')],{'as':_0x74ac('0x131'),'through':_0x74ac('0x132')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x134'),'through':_0x74ac('0x135')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['CmList'],{'as':_0x74ac('0x136'),'through':_0x74ac('0x137')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':'user_has_teams'});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x3d')],{'as':_0x74ac('0x129'),'through':_0x74ac('0x138')});db['User'][_0x74ac('0x133')](db['ChatInteraction'],{'as':_0x74ac('0x126'),'through':_0x74ac('0x139')});db['User'][_0x74ac('0x133')](db[_0x74ac('0x4a')],{'as':'FaxInteractions','through':_0x74ac('0x13a')});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x52')],{'as':_0x74ac('0x127'),'through':_0x74ac('0x13b')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['OpenchannelInteraction'],{'as':_0x74ac('0x125'),'through':'user_has_openchannel_interactions'});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['WhatsappInteraction'],{'as':_0x74ac('0x12a'),'through':_0x74ac('0x13c')});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x18')],{'as':_0x74ac('0x13d'),'through':_0x74ac('0x13e'),'required':![]});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0xfc')],{'as':_0x74ac('0x13f'),'through':_0x74ac('0x140'),'required':![]});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0x39')],{'as':_0x74ac('0x141'),'through':_0x74ac('0x2d'),'required':![]});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x67')],{'as':_0x74ac('0x142'),'through':_0x74ac('0x143'),'required':![],'hooks':!![]});db['User'][_0x74ac('0x133')](db[_0x74ac('0x4c')],{'as':_0x74ac('0x144'),'through':_0x74ac('0x2f'),'required':![]});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x56')],{'as':_0x74ac('0x145'),'through':_0x74ac('0x31'),'required':![]});db['User'][_0x74ac('0x133')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x74ac('0x146'),'required':![]});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x10d')],{'as':_0x74ac('0x147'),'through':_0x74ac('0x33'),'required':![]});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['CmList'],{'through':_0x74ac('0x137')});db['User'][_0x74ac('0x133')](db[_0x74ac('0x5f')],{'as':_0x74ac('0x148'),'through':'user_has_chat_websites'});db['User'][_0x74ac('0x133')](db[_0x74ac('0x149')],{'as':_0x74ac('0x14a'),'through':_0x74ac('0x14b')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['MailAccount'],{'as':_0x74ac('0x14c'),'through':_0x74ac('0x14d')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0x14e')],{'as':_0x74ac('0x14f'),'through':'user_has_openchannel_accounts'});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x74ac('0x150')});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x104')],{'as':_0x74ac('0x151'),'through':'user_has_whatsapp_accounts'});db[_0x74ac('0x11')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x152'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x153')});db[_0x74ac('0x14')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'onDelete':_0x74ac('0x11a')});db['VoiceExtension'][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x154'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x17')]['belongsToMany'](db['Sound'],{'as':_0x74ac('0x155'),'through':_0x74ac('0x156')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db['UserVoiceQueueRt'],{'as':_0x74ac('0x157'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db['CmHopper'],{'as':_0x74ac('0x12d'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x159')],{'as':_0x74ac('0x123'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x72')],{'as':_0x74ac('0x15a'),'foreignKey':'VoiceQueueId'});db[_0x74ac('0x18')][_0x74ac('0x11d')](db['ReportAgentPreview'],{'as':_0x74ac('0x74'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x6f')],{'as':'HopperBlacks','foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x15b')],{'as':_0x74ac('0x15c'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')]['belongsTo'](db['Trunk'],{'as':_0x74ac('0x28'),'foreignKey':'TrunkId'});db[_0x74ac('0x18')][_0x74ac('0x12e')](db[_0x74ac('0x28')],{'as':'TrunkBackup','foreignKey':_0x74ac('0x15d')});db[_0x74ac('0x18')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'as':_0x74ac('0x80'),'foreignKey':'IntervalId'});db[_0x74ac('0x18')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x18')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x136'),'through':_0x74ac('0x161')});db[_0x74ac('0x18')]['belongsToMany'](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x13e')});db[_0x74ac('0x18')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'as':_0x74ac('0x163'),'through':_0x74ac('0x111')});db[_0x74ac('0x18')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x164'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x11b'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x1c')][_0x74ac('0x12e')](db['User'],{'as':_0x74ac('0x11b'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x1d')][_0x74ac('0x11d')](db[_0x74ac('0x1f')],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x166'),'sourceKey':_0x74ac('0x167')});db[_0x74ac('0x1f')][_0x74ac('0x12e')](db[_0x74ac('0x1d')],{'foreignKey':_0x74ac('0x166'),'targetKey':_0x74ac('0x167')});db[_0x74ac('0x21')]['hasMany'](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x74ac('0x168'),'constraints':![]});db['VoiceCallReport'][_0x74ac('0x11d')](db[_0x74ac('0x25')],{'as':_0x74ac('0x169'),'foreignKey':_0x74ac('0x168'),'constraints':![]});db[_0x74ac('0x21')][_0x74ac('0x12e')](db['User'],{'as':_0x74ac('0x11b'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x21')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x34')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{'as':_0x74ac('0x37'),'foreignKey':_0x74ac('0x16c')});db['MailServerIn'][_0x74ac('0x12e')](db[_0x74ac('0x10f')],{'as':_0x74ac('0x10f'),'foreignKey':'CloudProviderId','onDelete':_0x74ac('0x16d')});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0x74ac('0x37'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x36')][_0x74ac('0x12e')](db[_0x74ac('0x10f')],{'as':_0x74ac('0x10f'),'foreignKey':_0x74ac('0x16e'),'onDelete':'restrict'});db[_0x74ac('0x37')][_0x74ac('0x119')](db[_0x74ac('0x34')],{'as':_0x74ac('0x16f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x37')][_0x74ac('0x119')](db[_0x74ac('0x36')],{'as':_0x74ac('0x170'),'onDelete':'cascade'});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':'Dispositions','foreignKey':_0x74ac('0x16c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x172')],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x3d')],{'as':'Interactions'});db[_0x74ac('0x37')]['hasMany'](db['MailApplication'],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x16c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x37')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db[_0x74ac('0x37')][_0x74ac('0x12e')](db[_0x74ac('0x174')],{'as':_0x74ac('0x174'),'foreignKey':'TemplateId'});db['MailAccount'][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x37')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x14d')});db['MailQueue'][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':'Agents','through':_0x74ac('0x2d')});db[_0x74ac('0x39')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':'team_has_mail_queues','as':_0x74ac('0x163')});db[_0x74ac('0x3d')][_0x74ac('0x11d')](db['MailMessage'],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x175')});db['MailInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x37')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x3d')]['belongsTo'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db['MailInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':'Owner','foreignKey':'UserId'});db[_0x74ac('0x3d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':'mail_interaction_has_tags','as':_0x74ac('0x177')});db[_0x74ac('0x3d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x178'),'as':_0x74ac('0x179')});db[_0x74ac('0x3d')][_0x74ac('0x133')](db['User'],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x138'),'foreignKey':_0x74ac('0x175')});db[_0x74ac('0x172')][_0x74ac('0x11d')](db[_0x74ac('0xf2')],{'as':_0x74ac('0x17b'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x172')]['belongsTo'](db['User'],{'as':_0x74ac('0x11b')});db[_0x74ac('0x172')][_0x74ac('0x12e')](db['CmContact'],{'onDelete':_0x74ac('0x11a'),'as':'Contact'});db['MailMessage'][_0x74ac('0x12e')](db[_0x74ac('0x3d')],{'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x175')});db['MailMessage']['belongsTo'](db[_0x74ac('0x37')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x172')]['belongsTo'](db['ChatWebsite'],{'as':_0x74ac('0x5f'),'foreignKey':'ChatWebsiteId'});db[_0x74ac('0x172')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x74ac('0x17d'),'foreignKey':'ChatOfflineMessageId'});db[_0x74ac('0x40')][_0x74ac('0x12e')](db['User'],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x40')][_0x74ac('0x12e')](db[_0x74ac('0x39')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x40')]['belongsTo'](db[_0x74ac('0x37')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x40')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x40')]['belongsTo'](db['Tag'],{'onDelete':_0x74ac('0x16d'),'foreignKey':'TagId'});db[_0x74ac('0x42')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{});db[_0x74ac('0x42')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x42')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x42')][_0x74ac('0x12e')](db[_0x74ac('0x3d')],{});db[_0x74ac('0x42')][_0x74ac('0x12e')](db['MailMessage'],{});db[_0x74ac('0x42')]['belongsTo'](db['User'],{});db['MailQueueReport'][_0x74ac('0x12e')](db[_0x74ac('0x39')],{});db[_0x74ac('0x44')][_0x74ac('0x11d')](db['DashboardItem'],{'as':'Items','onDelete':'cascade'});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':_0x74ac('0x181'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x181')});db[_0x74ac('0x149')]['hasMany'](db[_0x74ac('0x4a')],{'as':_0x74ac('0x182')});db[_0x74ac('0x149')]['hasMany'](db[_0x74ac('0x49')],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x181'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':'Exntensions','onDelete':_0x74ac('0x11a')});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x4b')],{'as':_0x74ac('0x165')});db[_0x74ac('0x149')][_0x74ac('0x12e')](db[_0x74ac('0x28')],{'as':_0x74ac('0x28')});db['FaxAccount']['belongsTo'](db['CmList'],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x149')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x149')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db[_0x74ac('0x11b')],{'onDelete':'restrict'});db['FaxApplication'][_0x74ac('0x12e')](db[_0x74ac('0x4c')],{'onDelete':'restrict'});db[_0x74ac('0x49')][_0x74ac('0x12e')](db[_0x74ac('0x149')],{'onDelete':'restrict'});db['FaxApplication'][_0x74ac('0x12e')](db[_0x74ac('0x8c')],{'onDelete':_0x74ac('0x16d'),'foreignKey':'TagId'});db['FaxInteraction'][_0x74ac('0x11d')](db['FaxMessage'],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x183')});db['FaxInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x149')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x181')});db['FaxInteraction']['belongsTo'](db[_0x74ac('0x6d')],{'as':'Contact','foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x4a')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':_0x74ac('0x11f')});db['FaxInteraction']['belongsToMany'](db[_0x74ac('0x8c')],{'through':_0x74ac('0x185'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x74ac('0x8c')],{'through':_0x74ac('0x185'),'as':'ThroughTags'});db['FaxInteraction'][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x13a'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x74ac('0x12e')](db['User'],{'onDelete':'cascade','as':'User'});db[_0x74ac('0x4b')][_0x74ac('0x12e')](db[_0x74ac('0x4a')],{'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x183')});db[_0x74ac('0x4b')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a')});db[_0x74ac('0x4b')]['belongsTo'](db[_0x74ac('0xf2')],{'as':_0x74ac('0xf2'),'foreignKey':_0x74ac('0x186')});db[_0x74ac('0x4b')][_0x74ac('0x12e')](db['FaxAccount'],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x181')});db[_0x74ac('0x4c')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x2f')});db[_0x74ac('0x4c')]['belongsToMany'](db[_0x74ac('0xea')],{'through':'team_has_fax_queues','as':_0x74ac('0x163')});db[_0x74ac('0x4e')][_0x74ac('0x12e')](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x4e')]['belongsTo'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x4e')][_0x74ac('0x12e')](db['FaxInteraction'],{});db[_0x74ac('0x4e')]['belongsTo'](db[_0x74ac('0x4b')],{});db[_0x74ac('0x4e')][_0x74ac('0x12e')](db['User'],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':_0x74ac('0x187'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x4f')]['hasMany'](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x187')});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db['SmsMessage'],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x187')});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db[_0x74ac('0x52')],{'as':_0x74ac('0x182')});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db[_0x74ac('0x188')],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x187'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x4f')]['belongsTo'](db['CmList'],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x4f')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x4f')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':'user_has_sms_accounts'});db[_0x74ac('0x188')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':'restrict'});db['SmsApplication'][_0x74ac('0x12e')](db[_0x74ac('0x56')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x188')]['belongsTo'](db[_0x74ac('0x4f')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x188')]['belongsTo'](db['Interval'],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x188')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0x74ac('0x11d')](db[_0x74ac('0x54')],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x189')});db['SmsInteraction']['belongsTo'](db[_0x74ac('0x4f')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x187')});db[_0x74ac('0x52')][_0x74ac('0x12e')](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x52')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x52')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x18a'),'as':'Tags'});db[_0x74ac('0x52')]['belongsToMany'](db[_0x74ac('0x8c')],{'through':'sms_interaction_has_tags','as':_0x74ac('0x179')});db['SmsInteraction']['belongsToMany'](db[_0x74ac('0x11b')],{'as':'Users','through':_0x74ac('0x13b'),'foreignKey':_0x74ac('0x189')});db['SmsMessage'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x11b')});db[_0x74ac('0x54')][_0x74ac('0x12e')](db['CmContact'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a')});db[_0x74ac('0x54')][_0x74ac('0x12e')](db['SmsInteraction'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x189')});db[_0x74ac('0x54')][_0x74ac('0x12e')](db[_0x74ac('0x4f')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x74ac('0x56')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':'Agents','through':_0x74ac('0x31'),'foreignKey':'SmsQueueId'});db[_0x74ac('0x56')][_0x74ac('0x133')](db['Team'],{'through':_0x74ac('0x18b'),'as':'Teams'});db[_0x74ac('0x14e')]['hasMany'](db[_0x74ac('0x7d')],{'as':'Dispositions','foreignKey':_0x74ac('0x18c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x14e')][_0x74ac('0x11d')](db['CannedAnswer'],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x14e')]['hasMany'](db[_0x74ac('0x5a')],{'as':_0x74ac('0x182'),'foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x14e')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x14e')][_0x74ac('0x11d')](db['OpenchannelApplication'],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x18c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x14e')][_0x74ac('0x12e')](db['CmList'],{'as':'List','foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x14e')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x74ac('0x14e')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':'user_has_openchannel_accounts'});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x5e')],{'onDelete':_0x74ac('0x16d'),'foreignKey':'OpenchannelQueueId'});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x14e')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'onDelete':_0x74ac('0x16d'),'foreignKey':'IntervalId'});db[_0x74ac('0x59')][_0x74ac('0x12e')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x74ac('0x18d')});db['OpenchannelInteraction'][_0x74ac('0x11d')](db[_0x74ac('0x5c')],{'as':'Messages','onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x18e')});db[_0x74ac('0x5a')]['belongsTo'](db[_0x74ac('0x14e')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x18c')});db['OpenchannelInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db['OpenchannelInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':'Owner','foreignKey':'UserId'});db['OpenchannelInteraction'][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x18f'),'as':_0x74ac('0x177')});db[_0x74ac('0x5a')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x18f'),'as':_0x74ac('0x179')});db['OpenchannelInteraction']['belongsToMany'](db['User'],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x190'),'foreignKey':'OpenchannelInteractionId'});db[_0x74ac('0x5c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x11b')});db[_0x74ac('0x5c')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a')});db[_0x74ac('0x5c')][_0x74ac('0x12e')](db[_0x74ac('0x5a')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x18e')});db['OpenchannelMessage']['belongsTo'](db[_0x74ac('0xf2')],{'as':_0x74ac('0xf2'),'foreignKey':'AttachmentId'});db[_0x74ac('0x5c')]['belongsTo'](db[_0x74ac('0x14e')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x18c')});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x74ac('0x162'),'through':'UserOpenchannelQueue','foreignKey':_0x74ac('0x191')});db['OpenchannelQueue'][_0x74ac('0x133')](db['Team'],{'through':_0x74ac('0x192'),'as':'Teams'});db[_0x74ac('0x5f')]['hasMany'](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':_0x74ac('0x193'),'onDelete':'cascade'});db[_0x74ac('0x5f')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x193')});db['ChatWebsite'][_0x74ac('0x11d')](db['ChatProactiveAction'],{'as':_0x74ac('0x194')});db[_0x74ac('0x5f')][_0x74ac('0x11d')](db[_0x74ac('0x63')],{'as':_0x74ac('0x182')});db[_0x74ac('0x5f')][_0x74ac('0x11d')](db[_0x74ac('0x62')],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':_0x74ac('0x11a')});db[_0x74ac('0x5f')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'as':'Interval','foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db['MailAccount'],{'as':_0x74ac('0x37'),'foreignKey':'MailAccountId'});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x74ac('0x5f')][_0x74ac('0x133')](db['User'],{'as':_0x74ac('0x162'),'through':_0x74ac('0x195')});db['OpenchannelQueueReport'][_0x74ac('0x12e')](db['OpenchannelAccount'],{});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db['OpenchannelQueueReport'][_0x74ac('0x12e')](db[_0x74ac('0x5a')],{});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x5c')],{});db['OpenchannelQueueReport'][_0x74ac('0x12e')](db['User'],{});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x5e')],{});db[_0x74ac('0x62')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':'Agent','foreignKey':_0x74ac('0x11f'),'onDelete':'restrict'});db[_0x74ac('0x62')][_0x74ac('0x12e')](db[_0x74ac('0x67')],{'as':_0x74ac('0x196'),'foreignKey':_0x74ac('0x197'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x62')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{'as':_0x74ac('0x198'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0x74ac('0x12e')](db[_0x74ac('0x8c')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x18d')});db[_0x74ac('0x63')][_0x74ac('0x11d')](db[_0x74ac('0x65')],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x199')});db[_0x74ac('0x63')]['belongsTo'](db[_0x74ac('0x5f')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x193')});db['ChatInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x63')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':'UserId'});db[_0x74ac('0x63')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x19a'),'as':_0x74ac('0x177')});db[_0x74ac('0x63')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x19a'),'as':_0x74ac('0x179')});db[_0x74ac('0x63')]['belongsToMany'](db[_0x74ac('0x11b')],{'as':_0x74ac('0x17a'),'through':'user_has_chat_interactions','foreignKey':_0x74ac('0x199')});db[_0x74ac('0x65')][_0x74ac('0x12e')](db['User'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x11b')});db[_0x74ac('0x65')][_0x74ac('0x12e')](db['CmContact'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x65')]['belongsTo'](db[_0x74ac('0x63')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':'ChatInteractionId'});db[_0x74ac('0x65')][_0x74ac('0x12e')](db[_0x74ac('0xf2')],{'as':_0x74ac('0xf2'),'foreignKey':_0x74ac('0x186')});db[_0x74ac('0x65')]['belongsTo'](db[_0x74ac('0x5f')],{'as':_0x74ac('0x176'),'foreignKey':'ChatWebsiteId'});db[_0x74ac('0x17d')]['hasMany'](db[_0x74ac('0xf2')],{'as':'Attachments','foreignKey':_0x74ac('0x19b'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x17d')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':'cascade','as':_0x74ac('0x16a'),'foreignKey':'ContactId'});db[_0x74ac('0x17d')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{'as':'Account','foreignKey':_0x74ac('0x193')});db['ChatQueue'][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x143'),'hooks':!![]});db[_0x74ac('0x67')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':_0x74ac('0x19c'),'as':_0x74ac('0x163')});db[_0x74ac('0x69')]['hasMany'](db[_0x74ac('0xd3')],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x19d'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x69')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':'Members','through':_0x74ac('0x132')});db[_0x74ac('0x6a')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{'as':_0x74ac('0x198'),'foreignKey':_0x74ac('0x193')});db[_0x74ac('0x6c')][_0x74ac('0x11d')](db['CmContact'],{'as':_0x74ac('0x134'),'foreignKey':_0x74ac('0x19e')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x8f')],{'as':_0x74ac('0x19f'),'foreignKey':_0x74ac('0x1a0')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db['CmHopperFinal'],{'as':_0x74ac('0x123'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x74ac('0x72')],{'as':_0x74ac('0x15a'),'foreignKey':_0x74ac('0x16b')});db['CmContact']['hasMany'](db[_0x74ac('0x74')],{'as':_0x74ac('0x74'),'foreignKey':'ContactId'});db[_0x74ac('0x6d')]['hasMany'](db[_0x74ac('0x15b')],{'as':_0x74ac('0x15c'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x5a')],{'as':'OpenchannelInteractions','foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x63')],{'as':_0x74ac('0x126'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db['SmsInteraction'],{'as':_0x74ac('0x127'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x4a')],{'as':_0x74ac('0x128'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')]['hasMany'](db[_0x74ac('0x3d')],{'as':_0x74ac('0x129'),'foreignKey':'ContactId','onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x12e')](db[_0x74ac('0x6c')],{'as':_0x74ac('0x1a1'),'foreignKey':_0x74ac('0x19e')});db[_0x74ac('0x6d')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':'List','foreignKey':_0x74ac('0x17f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6d')]['belongsToMany'](db['User'],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x135')});db[_0x74ac('0x6d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x74ac('0x6d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':'cm_contact_has_tags','as':_0x74ac('0x179')});db[_0x74ac('0x12c')][_0x74ac('0x11d')](db['CmHopperAdditionalPhone'],{'as':_0x74ac('0x1a2'),'foreignKey':_0x74ac('0x1a3')});db[_0x74ac('0x12c')]['belongsTo'](db[_0x74ac('0x6d')],{'as':'Contact','foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x12c')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x12c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x1a4'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x12c')][_0x74ac('0x12e')](db['VoiceQueue'],{'as':_0x74ac('0x196'),'foreignKey':_0x74ac('0x158'),'onDelete':_0x74ac('0x11a')});db['CmHopper'][_0x74ac('0x12e')](db[_0x74ac('0xee')],{'as':_0x74ac('0xee'),'foreignKey':_0x74ac('0x1a5'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x12c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':_0x74ac('0x1a6')});db[_0x74ac('0x6f')]['belongsTo'](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6f')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6f')]['belongsTo'](db[_0x74ac('0x18')],{'as':_0x74ac('0x196'),'foreignKey':_0x74ac('0x158'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6f')]['belongsTo'](db[_0x74ac('0xee')],{'as':_0x74ac('0xee'),'foreignKey':_0x74ac('0x1a5'),'onDelete':'cascade'});db['Automation'][_0x74ac('0x11d')](db[_0x74ac('0x1a7')],{'as':{'plural':_0x74ac('0x1a8'),'singular':_0x74ac('0x1a9')},'foreignKey':_0x74ac('0x1aa'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x79')][_0x74ac('0x11d')](db[_0x74ac('0x1a7')],{'as':{'plural':'Any','singular':_0x74ac('0x1ab')},'foreignKey':_0x74ac('0x1ac'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x79')][_0x74ac('0x11d')](db[_0x74ac('0x1ad')],{'as':'Actions','foreignKey':_0x74ac('0x1ae'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x7d')][_0x74ac('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x74ac('0x1af'),'onDelete':'cascade'});db[_0x74ac('0x80')][_0x74ac('0x11d')](db[_0x74ac('0x80')],{'as':_0x74ac('0x1b0'),'foreignKey':_0x74ac('0x17e'),'onDelete':_0x74ac('0x11a'),'hooks':!![],'required':![]});db[_0x74ac('0x80')]['hasMany'](db[_0x74ac('0x121')],{'as':'Extensions','foreignKey':_0x74ac('0x17e'),'onDelete':_0x74ac('0x16d')});db['Interval']['hasMany'](db[_0x74ac('0x40')],{'as':'MailApplications','foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x80')][_0x74ac('0x11d')](db[_0x74ac('0x62')],{'as':_0x74ac('0x1b1'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x80')]['hasMany'](db[_0x74ac('0x49')],{'as':'FaxApplications','foreignKey':_0x74ac('0x17e')});db['Interval'][_0x74ac('0x11d')](db['SmsApplication'],{'as':_0x74ac('0x1b2'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x88')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{});db['Schedule'][_0x74ac('0x12e')](db['AnalyticDefaultReport'],{'foreignKey':_0x74ac('0x1b3')});db[_0x74ac('0x88')][_0x74ac('0x12e')](db[_0x74ac('0x98')],{'foreignKey':_0x74ac('0x1b4')});db['Sound'][_0x74ac('0x133')](db[_0x74ac('0x17')],{'as':'Mohs','through':_0x74ac('0x156'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x6d')],{'through':_0x74ac('0x1b5')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x63')],{'through':_0x74ac('0x19a')});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':_0x74ac('0x178')});db['Tag']['belongsToMany'](db[_0x74ac('0x52')],{'through':_0x74ac('0x18a')});db[_0x74ac('0x8c')]['belongsToMany'](db[_0x74ac('0x4a')],{'through':_0x74ac('0x185')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x5a')],{'through':_0x74ac('0x18f')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x1b6')],{'through':_0x74ac('0x1b7')});db['CmContactHasItem'][_0x74ac('0x12e')](db[_0x74ac('0x8d')],{'as':_0x74ac('0x1b8'),'foreignKey':_0x74ac('0x1b9')});db[_0x74ac('0x91')][_0x74ac('0x12e')](db[_0x74ac('0x12c')],{'as':'Hopper','foreignKey':_0x74ac('0x1a3')});db['CmContactHasItem'][_0x74ac('0x12e')](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x1a0')});db[_0x74ac('0x1ba')][_0x74ac('0x11d')](db['Condition'],{'as':{'plural':_0x74ac('0x1bb'),'singular':_0x74ac('0x1bc')},'foreignKey':_0x74ac('0x1bd'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x1ba')][_0x74ac('0x11d')](db[_0x74ac('0x1a7')],{'as':{'plural':_0x74ac('0x1be'),'singular':_0x74ac('0x1bf')},'foreignKey':_0x74ac('0x1c0'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x74ac('0x1ad')],{'as':_0x74ac('0x1c1'),'foreignKey':_0x74ac('0x1c2'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x98')][_0x74ac('0x11d')](db[_0x74ac('0x9e')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1b4'),'hooks':!![]});db[_0x74ac('0x9a')]['hasMany'](db[_0x74ac('0x9e')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1b3')});db[_0x74ac('0x9c')][_0x74ac('0x11d')](db[_0x74ac('0x9e')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x74ac('0x1c4')});db['AnalyticFieldReport'][_0x74ac('0x12e')](db[_0x74ac('0x9c')],{'foreignKey':_0x74ac('0x1c4')});db['SalesforceAccount']['hasMany'](db[_0x74ac('0xa4')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xa4')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1c7'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xa4')]['hasMany'](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1c9'),'onDelete':'cascade','foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xa4')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xa4')][_0x74ac('0x12e')](db['SalesforceAccount'],{'as':_0x74ac('0x176'),'foreignKey':'AccountId'});db[_0x74ac('0xa6')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xa6')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db['SalesforceField']['hasMany'](db[_0x74ac('0xa6')],{'as':'Field','foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xa6')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db[_0x74ac('0xa8')][_0x74ac('0x11d')](db[_0x74ac('0x1cf')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1cf')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1c7'),'onDelete':_0x74ac('0x11a'),'foreignKey':'SubjectId'});db[_0x74ac('0x1cf')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1c9'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1cf')]['hasMany'](db['SugarcrmField'],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0x1cf')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d0')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db['SugarcrmField'][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x74ac('0x1d0')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1d1'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':'Variable','foreignKey':'VariableId'});db[_0x74ac('0xac')]['hasMany'](db[_0x74ac('0xae')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':'AccountId'});db[_0x74ac('0xae')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1c7'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xae')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':'Descriptions','onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db['DeskConfiguration'][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':'FieldId'});db[_0x74ac('0xae')][_0x74ac('0x12e')](db[_0x74ac('0xac')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xae')]['belongsToMany'](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x74ac('0x1d2')][_0x74ac('0x11d')](db['DeskField'],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0x1d2')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1d2')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1d1'),'foreignKey':'FieldId'});db[_0x74ac('0x1d2')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db[_0x74ac('0xb0')]['hasMany'](db['ZohoConfiguration'],{'as':_0x74ac('0x1c5'),'onDelete':'cascade','foreignKey':_0x74ac('0x1c6')});db['ZohoConfiguration'][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1c7'),'onDelete':'cascade','foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0x1d3')][_0x74ac('0x11d')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1d3')][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0x1d3')][_0x74ac('0x12e')](db[_0x74ac('0xb0')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db['ZohoField'][_0x74ac('0x11d')](db['ZohoField'],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xb3')][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1cd'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1d1'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xb3')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0x74ac('0xb6')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xb6')]['hasMany'](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1c7'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xb6')][_0x74ac('0x11d')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x74ac('0x1ca')});db['ZendeskConfiguration'][_0x74ac('0x11d')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x74ac('0x1cb')});db['ZendeskConfiguration'][_0x74ac('0x12e')](db[_0x74ac('0xb5')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xb6')]['belongsToMany'](db[_0x74ac('0x8c')],{'through':_0x74ac('0x1d4')});db[_0x74ac('0xb8')]['hasMany'](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db['ZendeskField'][_0x74ac('0x11d')](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xb8')][_0x74ac('0x11d')](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1d1'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xb8')][_0x74ac('0x12e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x74ac('0xba')][_0x74ac('0x11d')](db[_0x74ac('0x1d5')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d5')]['hasMany'](db[_0x74ac('0xbb')],{'as':'Subjects','onDelete':_0x74ac('0x11a'),'foreignKey':'SubjectId'});db[_0x74ac('0x1d5')][_0x74ac('0x11d')](db[_0x74ac('0xbb')],{'as':_0x74ac('0x1c9'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1d5')]['hasMany'](db[_0x74ac('0xbb')],{'as':_0x74ac('0x1c3'),'onDelete':'cascade','foreignKey':_0x74ac('0x1cb')});db['FreshdeskConfiguration'][_0x74ac('0x12e')](db[_0x74ac('0xba')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d5')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x1d6')});db[_0x74ac('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0x74ac('0x1cc'),'foreignKey':'SubjectId'});db[_0x74ac('0xbb')][_0x74ac('0x11d')](db[_0x74ac('0xbb')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xbb')][_0x74ac('0x11d')](db[_0x74ac('0xbb')],{'as':'Field','foreignKey':'FieldId'});db[_0x74ac('0xbb')]['belongsTo'](db[_0x74ac('0x93')],{'as':'Variable','foreignKey':_0x74ac('0x1ce')});db[_0x74ac('0xbd')][_0x74ac('0x11d')](db['VtigerConfiguration'],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xbf')][_0x74ac('0x11d')](db['VtigerField'],{'as':_0x74ac('0x1c7'),'foreignKey':'SubjectId'});db[_0x74ac('0xbf')][_0x74ac('0x11d')](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1c9'),'foreignKey':'DescriptionId'});db[_0x74ac('0xbf')]['hasMany'](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1c3'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xbf')]['belongsTo'](db['VtigerAccount'],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xc1')][_0x74ac('0x11d')](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db['VtigerField'][_0x74ac('0x11d')](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1cd'),'foreignKey':'DescriptionId'});db[_0x74ac('0xc1')]['hasMany'](db[_0x74ac('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0x74ac('0xc1')][_0x74ac('0x12e')](db['Variable'],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db['ServicenowAccount'][_0x74ac('0x11d')](db[_0x74ac('0xc5')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xc5')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':'Descriptions','foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xc5')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':'Fields','foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xc5')]['belongsTo'](db[_0x74ac('0xc3')],{'as':_0x74ac('0x176'),'foreignKey':'AccountId'});db[_0x74ac('0xc7')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':_0x74ac('0x1cc'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0x74ac('0xc7')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xc7')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':_0x74ac('0x1d1'),'foreignKey':'FieldId'});db[_0x74ac('0xc7')]['belongsTo'](db['Variable'],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db['Dynamics365Account'][_0x74ac('0x11d')](db[_0x74ac('0xca')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d7')][_0x74ac('0x12e')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x74ac('0x16e')});db['Dynamics365Configuration'][_0x74ac('0x11d')](db[_0x74ac('0xcb')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xca')]['hasMany'](db[_0x74ac('0xcb')],{'as':'Descriptions','onDelete':_0x74ac('0x11a'),'foreignKey':'DescriptionId'});db[_0x74ac('0xca')][_0x74ac('0x11d')](db[_0x74ac('0xcb')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xca')][_0x74ac('0x12e')](db[_0x74ac('0x1d7')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xcb')][_0x74ac('0x11d')](db[_0x74ac('0xcb')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xcb')]['hasMany'](db[_0x74ac('0xcb')],{'as':'Description','foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xcb')]['hasMany'](db[_0x74ac('0xcb')],{'as':'Field','foreignKey':'FieldId'});db[_0x74ac('0xcb')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':'VariableId'});db[_0x74ac('0xcd')][_0x74ac('0x11d')](db['FreshsalesConfiguration'],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xcf')][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1c7'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xcf')][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1c9'),'foreignKey':'DescriptionId'});db[_0x74ac('0xcf')]['hasMany'](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1c3'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xcf')][_0x74ac('0x12e')](db[_0x74ac('0xcd')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xd0')][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':'Subject','foreignKey':_0x74ac('0x1c8')});db['FreshsalesField']['hasMany'](db[_0x74ac('0xd0')],{'as':'Description','foreignKey':_0x74ac('0x1ca')});db['FreshsalesField'][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1d1'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xd0')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':'VariableId'});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':'ContactId'});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db['ChatInteraction'],{});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db[_0x74ac('0x65')],{});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db['User'],{});db['ChatQueueReport'][_0x74ac('0x12e')](db[_0x74ac('0x67')],{});db[_0x74ac('0xd3')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1d9')});db[_0x74ac('0xd3')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1da')});db[_0x74ac('0x15b')]['hasMany'](db[_0x74ac('0xd7')],{'foreignKey':_0x74ac('0x1db'),'onDelete':'cascade'});db[_0x74ac('0x15b')]['hasMany'](db[_0x74ac('0xd5')],{'foreignKey':_0x74ac('0x1db'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0xda')]['belongsTo'](db['SmsAccount'],{});db[_0x74ac('0xda')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db[_0x74ac('0xda')][_0x74ac('0x12e')](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':'ContactId'});db[_0x74ac('0xda')]['belongsTo'](db['SmsInteraction'],{});db[_0x74ac('0xda')][_0x74ac('0x12e')](db[_0x74ac('0x54')],{});db[_0x74ac('0xda')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{});db[_0x74ac('0xda')]['belongsTo'](db[_0x74ac('0x56')],{});db[_0x74ac('0xe0')]['hasMany'](db[_0x74ac('0x15b')],{'foreignKey':_0x74ac('0x1dc')});db['JscriptyProject']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x74ac('0x1dc')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x1dd')});db[_0x74ac('0xea')]['belongsToMany'](db[_0x74ac('0x18')],{'through':'TeamVoiceQueue','as':_0x74ac('0x13d')});db[_0x74ac('0xea')][_0x74ac('0x133')](db['MailQueue'],{'through':_0x74ac('0x1de'),'as':_0x74ac('0x141')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x67')],{'through':_0x74ac('0x19c'),'as':_0x74ac('0x142')});db['Team']['belongsToMany'](db[_0x74ac('0x4c')],{'through':_0x74ac('0x1df'),'as':'FaxQueues'});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x56')],{'through':_0x74ac('0x18b'),'as':_0x74ac('0x145')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x5e')],{'through':_0x74ac('0x192'),'as':_0x74ac('0x1e0')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x10d')],{'through':'team_has_whatsapp_queues','as':_0x74ac('0x147')});db[_0x74ac('0xea')][_0x74ac('0x133')](db['VoicePrefix'],{'through':_0x74ac('0x113'),'as':_0x74ac('0x13f')});db[_0x74ac('0xee')][_0x74ac('0x11d')](db[_0x74ac('0x12c')],{'as':_0x74ac('0x12d'),'foreignKey':_0x74ac('0x1a5')});db['Campaign']['hasMany'](db[_0x74ac('0x159')],{'as':'HopperFinals','foreignKey':_0x74ac('0x1a5')});db['Campaign'][_0x74ac('0x11d')](db[_0x74ac('0x72')],{'as':_0x74ac('0x15a'),'foreignKey':_0x74ac('0x1a5')});db[_0x74ac('0xee')][_0x74ac('0x11d')](db['CmHopperBlack'],{'as':_0x74ac('0x1e1'),'foreignKey':_0x74ac('0x1a5')});db[_0x74ac('0xee')][_0x74ac('0x12e')](db['Trunk'],{'as':_0x74ac('0x28'),'foreignKey':'TrunkId'});db['Campaign']['belongsTo'](db[_0x74ac('0x28')],{'as':_0x74ac('0x1e2'),'foreignKey':'TrunkBackupId'});db[_0x74ac('0xee')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'as':_0x74ac('0x80'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0xee')][_0x74ac('0x12e')](db[_0x74ac('0xe5')],{'as':'SquareProject','foreignKey':_0x74ac('0x1e3')});db[_0x74ac('0xee')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x136'),'through':'campaigns_has_cm_lists'});db[_0x74ac('0xee')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x164'),'through':_0x74ac('0x1e4')});db[_0x74ac('0xf2')][_0x74ac('0x12e')](db[_0x74ac('0x17d')],{'as':'ChatOfflineMessage','foreignKey':_0x74ac('0x19b')});db['MailTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x172')],{});db[_0x74ac('0xf6')]['belongsTo'](db[_0x74ac('0x3d')],{});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0x74ac('0x1e5'),'as':_0x74ac('0x1e6')});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':'ToAgent'});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db['MailQueue'],{'foreignKey':_0x74ac('0x1ea'),'as':'ToQueue'});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{'foreignKey':_0x74ac('0x1eb'),'as':_0x74ac('0x1ec')});db['ChatTransferReport'][_0x74ac('0x12e')](db['ChatMessage'],{});db['ChatTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x63')],{});db[_0x74ac('0xf7')][_0x74ac('0x12e')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x74ac('0xf7')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0xf7')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':_0x74ac('0x1ed')});db[_0x74ac('0xf7')][_0x74ac('0x12e')](db[_0x74ac('0x67')],{'foreignKey':'ToChatQueueId','as':_0x74ac('0x1ee')});db[_0x74ac('0xf7')]['belongsTo'](db[_0x74ac('0x5f')],{'foreignKey':_0x74ac('0x1ef'),'as':'ToAccount'});db[_0x74ac('0x1f0')]['belongsTo'](db[_0x74ac('0x4b')],{});db[_0x74ac('0x1f0')][_0x74ac('0x12e')](db[_0x74ac('0x4a')],{});db[_0x74ac('0x1f0')][_0x74ac('0x12e')](db[_0x74ac('0x149')],{'foreignKey':_0x74ac('0x1f1'),'as':_0x74ac('0x1e6')});db[_0x74ac('0x1f0')][_0x74ac('0x12e')](db['User'],{'foreignKey':_0x74ac('0x1e7'),'as':'FromAgent'});db['FaxTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':'ToAgent'});db['FaxTransferReport'][_0x74ac('0x12e')](db['FaxQueue'],{'foreignKey':_0x74ac('0x1f2'),'as':_0x74ac('0x1ee')});db[_0x74ac('0x1f0')]['belongsTo'](db[_0x74ac('0x149')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x74ac('0x1f3')][_0x74ac('0x12e')](db[_0x74ac('0x5c')],{});db['OpenchannelTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x5a')],{});db[_0x74ac('0x1f3')]['belongsTo'](db[_0x74ac('0x14e')],{'foreignKey':'FromOpenchannelAccountId','as':_0x74ac('0x1e6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0x1f3')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x74ac('0x1f3')][_0x74ac('0x12e')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x74ac('0x1ee')});db['OpenchannelTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x14e')],{'foreignKey':_0x74ac('0x1f4'),'as':'ToAccount'});db[_0x74ac('0x1f5')][_0x74ac('0x12e')](db[_0x74ac('0x54')],{});db['SmsTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x52')],{});db['SmsTransferReport'][_0x74ac('0x12e')](db['SmsAccount'],{'foreignKey':_0x74ac('0x1f6'),'as':_0x74ac('0x1e6')});db[_0x74ac('0x1f5')]['belongsTo'](db['User'],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0x1f5')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':'ToAgent'});db[_0x74ac('0x1f5')][_0x74ac('0x12e')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x74ac('0x1ee')});db[_0x74ac('0x1f5')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x74ac('0x1f7'),'as':_0x74ac('0x1ec')});db[_0x74ac('0x160')][_0x74ac('0x11d')](db['Disposition'],{'as':_0x74ac('0x180'),'foreignKey':'ListId','onDelete':_0x74ac('0x11a')});db['CmList']['hasMany'](db[_0x74ac('0x76')],{'as':_0x74ac('0x1f8'),'foreignKey':_0x74ac('0x17f')});db['CmList']['hasMany'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x134'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x160')][_0x74ac('0x11d')](db[_0x74ac('0x159')],{'as':_0x74ac('0x123'),'foreignKey':'ListId'});db[_0x74ac('0x160')]['hasMany'](db[_0x74ac('0x72')],{'as':_0x74ac('0x124'),'foreignKey':'ListId'});db[_0x74ac('0x160')][_0x74ac('0x11d')](db[_0x74ac('0x74')],{'as':_0x74ac('0x74'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x160')][_0x74ac('0x133')](db[_0x74ac('0x18')],{'as':_0x74ac('0x1f9'),'through':_0x74ac('0x161')});db[_0x74ac('0x160')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x137')});db['VoicePrefix'][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x122'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0xfc')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x140')});db['VoicePrefix'][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':_0x74ac('0x113'),'as':_0x74ac('0x163')});db[_0x74ac('0x12f')][_0x74ac('0x11d')](db['User'],{'as':_0x74ac('0x17a'),'foreignKey':_0x74ac('0x130')});db[_0x74ac('0x12f')][_0x74ac('0x11d')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x74ac('0x130'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0xff')][_0x74ac('0x11d')](db[_0x74ac('0x101')],{'as':_0x74ac('0x1fa'),'foreignKey':_0x74ac('0x1fb'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x104')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x74ac('0x104')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x1fc')});db[_0x74ac('0x104')]['hasMany'](db[_0x74ac('0x109')],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x1fc')});db[_0x74ac('0x104')]['hasMany'](db[_0x74ac('0x1b6')],{'as':_0x74ac('0x182')});db[_0x74ac('0x104')][_0x74ac('0x11d')](db[_0x74ac('0x106')],{'as':'Applications','foreignKey':_0x74ac('0x1fc'),'onDelete':_0x74ac('0x11a')});db['WhatsappAccount'][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':'List','foreignKey':'ListId'});db[_0x74ac('0x104')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x104')][_0x74ac('0x133')](db['User'],{'as':_0x74ac('0x162'),'through':_0x74ac('0x1fd')});db[_0x74ac('0x106')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x106')]['belongsTo'](db[_0x74ac('0x10d')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x106')][_0x74ac('0x12e')](db[_0x74ac('0x104')],{'onDelete':'restrict'});db[_0x74ac('0x106')]['belongsTo'](db[_0x74ac('0x80')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x106')][_0x74ac('0x12e')](db[_0x74ac('0x8c')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x18d')});db[_0x74ac('0x1b6')][_0x74ac('0x11d')](db['WhatsappMessage'],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1fe')});db[_0x74ac('0x1b6')]['belongsTo'](db['WhatsappAccount'],{'as':_0x74ac('0x176'),'foreignKey':'WhatsappAccountId'});db[_0x74ac('0x1b6')]['belongsTo'](db[_0x74ac('0x6d')],{'as':'Contact','foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x1b6')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':'UserId'});db[_0x74ac('0x1b6')]['belongsToMany'](db[_0x74ac('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x74ac('0x177')});db[_0x74ac('0x1b6')][_0x74ac('0x133')](db['Tag'],{'through':_0x74ac('0x1b7'),'as':_0x74ac('0x179')});db['WhatsappInteraction']['belongsToMany'](db[_0x74ac('0x11b')],{'as':'Users','through':_0x74ac('0x13c'),'foreignKey':_0x74ac('0x1fe')});db[_0x74ac('0x109')][_0x74ac('0x12e')](db['User'],{'as':_0x74ac('0x11b')});db[_0x74ac('0x109')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':'cascade','as':_0x74ac('0x16a')});db[_0x74ac('0x109')]['belongsTo'](db[_0x74ac('0x1b6')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x1fe')});db[_0x74ac('0x109')]['belongsTo'](db[_0x74ac('0x104')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x74ac('0x10a')]['belongsTo'](db[_0x74ac('0x104')],{});db[_0x74ac('0x10a')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x1b6')],{});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x10d')],{});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x109')],{});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{});db['WhatsappTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x109')],{});db[_0x74ac('0x10c')][_0x74ac('0x12e')](db[_0x74ac('0x1b6')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x74ac('0x104')],{'foreignKey':_0x74ac('0x1ff'),'as':_0x74ac('0x1e6')});db[_0x74ac('0x10c')][_0x74ac('0x12e')](db[_0x74ac('0x104')],{'foreignKey':'ToWhatsappAccountId','as':_0x74ac('0x1ec')});db['WhatsappTransferReport']['belongsTo'](db[_0x74ac('0x10d')],{'foreignKey':_0x74ac('0x200'),'as':'ToQueue'});db[_0x74ac('0x10c')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0x10c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':_0x74ac('0x1ed')});db[_0x74ac('0x10d')]['belongsToMany'](db['User'],{'as':_0x74ac('0x162'),'through':'UserWhatsappQueue','foreignKey':_0x74ac('0x201')});db[_0x74ac('0x10d')]['belongsToMany'](db['Team'],{'through':_0x74ac('0x202'),'as':_0x74ac('0x163')});db['UserSetting'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x203'),'foreignKey':_0x74ac('0x11f'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db['CloudProvider'][_0x74ac('0x119')](db[_0x74ac('0x1d7')],{'as':_0x74ac('0x1d7'),'onDelete':'restrict'});db[_0x74ac('0x10f')][_0x74ac('0x119')](db[_0x74ac('0x34')],{'as':_0x74ac('0x16f'),'onDelete':'restrict'});db[_0x74ac('0x10f')][_0x74ac('0x119')](db[_0x74ac('0x36')],{'as':'Smtp','onDelete':_0x74ac('0x16d')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 040dd28..186b140 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x68a5=['./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/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/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/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/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','3.12.2','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','path','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers'];(function(_0x2ed434,_0x57663e){var _0x1e20f3=function(_0x3ca3a6){while(--_0x3ca3a6){_0x2ed434['push'](_0x2ed434['shift']());}};_0x1e20f3(++_0x57663e);}(_0x68a5,0xfc));var _0x568a=function(_0x457efb,_0x38bea9){_0x457efb=_0x457efb-0x0;var _0x210f00=_0x68a5[_0x457efb];return _0x210f00;};'use strict';var path=require(_0x568a('0x0'));var express=require('express');var errors=require(_0x568a('0x1'));var config=require(_0x568a('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x568a('0x3')];var clientSideLogs=require(_0x568a('0x4'));exports[_0x568a('0x5')]=function(_0x2d4dce){return setupLoggers(_0x2d4dce)['then'](function(){_0x2d4dce[_0x568a('0x6')]('/api/users',require(_0x568a('0x7')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x8'),require(_0x568a('0x9')));_0x2d4dce['use'](_0x568a('0xa'),require('./api/voiceContext'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xb'),require(_0x568a('0xc')));_0x2d4dce[_0x568a('0x6')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd'),require('./api/voiceQueue'));_0x2d4dce[_0x568a('0x6')]('/api/voice/recordings',require(_0x568a('0xe')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf'),require(_0x568a('0x10')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x11'),require(_0x568a('0x12')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x13'),require(_0x568a('0x14')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x15'),require(_0x568a('0x16')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x17'),require(_0x568a('0x18')));_0x2d4dce[_0x568a('0x6')]('/api/voice/agents/reports',require(_0x568a('0x19')));_0x2d4dce['use'](_0x568a('0x1a'),require(_0x568a('0x1b')));_0x2d4dce['use'](_0x568a('0x1c'),require('./api/memberReport'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x1d'),require(_0x568a('0x1e')));_0x2d4dce[_0x568a('0x6')]('/api/voice/transfers/reports',require(_0x568a('0x1f')));_0x2d4dce['use'](_0x568a('0x20'),require(_0x568a('0x21')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x22'),require(_0x568a('0x23')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x24'),require(_0x568a('0x25')));_0x2d4dce['use'](_0x568a('0x26'),require(_0x568a('0x27')));_0x2d4dce['use'](_0x568a('0x28'),require(_0x568a('0x29')));_0x2d4dce[_0x568a('0x6')]('/api/mail/messages',require(_0x568a('0x2a')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x2b'),require(_0x568a('0x2c')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x2d'),require(_0x568a('0x2e')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x2f'),require('./api/dashboard'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x30'),require(_0x568a('0x31')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x32'),require(_0x568a('0x33')));_0x2d4dce['use'](_0x568a('0x34'),require(_0x568a('0x35')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x36'),require(_0x568a('0x37')));_0x2d4dce['use'](_0x568a('0x38'),require(_0x568a('0x39')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3a'),require(_0x568a('0x3b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3c'),require(_0x568a('0x3d')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3e'),require('./api/smsAccount'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3f'),require(_0x568a('0x40')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x41'),require(_0x568a('0x42')));_0x2d4dce['use']('/api/sms/messages',require('./api/smsMessage'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x43'),require(_0x568a('0x44')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x45'),require('./api/openchannelAccount'));_0x2d4dce['use'](_0x568a('0x46'),require(_0x568a('0x47')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x48'),require(_0x568a('0x49')));_0x2d4dce['use'](_0x568a('0x4a'),require('./api/openchannelMessage'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x4b'),require('./api/openchannelQueue'));_0x2d4dce[_0x568a('0x6')]('/api/chat/websites',require(_0x568a('0x4c')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x4d'),require('./api/openchannelQueueReport'));_0x2d4dce['use'](_0x568a('0x4e'),require(_0x568a('0x4f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x50'),require(_0x568a('0x51')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x52'),require('./api/chatMessage'));_0x2d4dce['use'](_0x568a('0x53'),require(_0x568a('0x54')));_0x2d4dce[_0x568a('0x6')]('/api/chat/queues',require('./api/chatQueue'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x55'),require('./api/chatGroup'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x56'),require('./api/chatProactiveAction'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x57'),require(_0x568a('0x58')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x59'),require(_0x568a('0x5a')));_0x2d4dce['use']('/api/cm/hopper',require(_0x568a('0x5b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x5c'),require(_0x568a('0x5d')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x5e'),require(_0x568a('0x5f')));_0x2d4dce[_0x568a('0x6')]('/api/cm/hopper_history',require(_0x568a('0x60')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x61'),require(_0x568a('0x62')));_0x2d4dce[_0x568a('0x6')]('/api/actions',require(_0x568a('0x63')));_0x2d4dce['use'](_0x568a('0x64'),require(_0x568a('0x65')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x66'),require(_0x568a('0x67')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x68'),require('./api/disposition'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x69'),require(_0x568a('0x6a')));_0x2d4dce['use'](_0x568a('0x6b'),require('./api/interval'));_0x2d4dce['use'](_0x568a('0x6c'),require('./api/pause'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x6d'),require('./api/cdr'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x6e'),require(_0x568a('0x6f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x70'),require('./api/schedule'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x71'),require('./api/sound'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x72'),require(_0x568a('0x73')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x74'),require(_0x568a('0x75')));_0x2d4dce[_0x568a('0x6')]('/api/cm_contact_has_items',require(_0x568a('0x76')));_0x2d4dce[_0x568a('0x6')]('/api/cm_hopper_additional_phones',require(_0x568a('0x77')));_0x2d4dce[_0x568a('0x6')]('/api/templates',require(_0x568a('0x78')));_0x2d4dce['use'](_0x568a('0x79'),require(_0x568a('0x7a')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x7b'),require(_0x568a('0x7c')));_0x2d4dce['use'](_0x568a('0x7d'),require(_0x568a('0x7e')));_0x2d4dce['use'](_0x568a('0x7f'),require(_0x568a('0x80')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x81'),require('./api/analyticCustomReport'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x82'),require(_0x568a('0x83')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x84'),require(_0x568a('0x85')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x86'),require('./api/analyticMetric'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x87'),require(_0x568a('0x88')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x89'),require('./api/analyticTreeReport'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x8a'),require(_0x568a('0x8b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x8c'),require(_0x568a('0x8d')));_0x2d4dce['use'](_0x568a('0x8e'),require(_0x568a('0x8f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x90'),require(_0x568a('0x91')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x92'),require(_0x568a('0x93')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x94'),require(_0x568a('0x95')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x96'),require(_0x568a('0x97')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x98'),require(_0x568a('0x99')));_0x2d4dce['use'](_0x568a('0x9a'),require('./api/intDeskField'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/zoho/fields',require(_0x568a('0x9b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x9c'),require(_0x568a('0x9d')));_0x2d4dce['use'](_0x568a('0x9e'),require(_0x568a('0x9f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa0'),require('./api/intZendeskField'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa1'),require(_0x568a('0xa2')));_0x2d4dce['use']('/api/integrations/freshdesk/configurations',require(_0x568a('0xa3')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa4'),require('./api/intFreshdeskField'));_0x2d4dce['use'](_0x568a('0xa5'),require('./api/intVtigerAccount'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa6'),require('./api/intVtigerConfiguration'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa7'),require(_0x568a('0xa8')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa9'),require(_0x568a('0xaa')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xab'),require(_0x568a('0xac')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xad'),require('./api/intServicenowField'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xae'),require('./api/intDynamics365Configuration'));_0x2d4dce['use'](_0x568a('0xaf'),require('./api/intDynamics365Field'));_0x2d4dce['use'](_0x568a('0xb0'),require(_0x568a('0xb1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xb2'),require(_0x568a('0xb3')));_0x2d4dce['use'](_0x568a('0xb4'),require('./api/intFreshsalesField'));_0x2d4dce[_0x568a('0x6')]('/api/networks',require(_0x568a('0xb5')));_0x2d4dce[_0x568a('0x6')]('/api/chat/reports/queue',require(_0x568a('0xb6')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xb7'),require(_0x568a('0xb8')));_0x2d4dce['use'](_0x568a('0xb9'),require(_0x568a('0xba')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xbb'),require(_0x568a('0xbc')));_0x2d4dce[_0x568a('0x6')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x2d4dce['use'](_0x568a('0xbd'),require(_0x568a('0xbe')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xbf'),require(_0x568a('0xc0')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc1'),require(_0x568a('0xc2')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc3'),require(_0x568a('0xc4')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc5'),require('./api/setting'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc6'),require('./api/squareOdbc'));_0x2d4dce['use'](_0x568a('0xc7'),require(_0x568a('0xc8')));_0x2d4dce['use'](_0x568a('0xc9'),require(_0x568a('0xca')));_0x2d4dce['use']('/api/square/messages',require(_0x568a('0xcb')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xcc'),require(_0x568a('0xcd')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xce'),require(_0x568a('0xcf')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd0'),require(_0x568a('0xd1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd2'),require(_0x568a('0xd3')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd4'),require(_0x568a('0xd5')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd6'),require(_0x568a('0xd7')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd8'),require(_0x568a('0xd9')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xda'),require(_0x568a('0xdb')));_0x2d4dce['use']('/api/fax/reports/transfer',require(_0x568a('0xdc')));_0x2d4dce['use'](_0x568a('0xdd'),require(_0x568a('0xde')));_0x2d4dce[_0x568a('0x6')]('/api/sms/reports/transfer',require(_0x568a('0xdf')));_0x2d4dce['use'](_0x568a('0xe0'),require(_0x568a('0xe1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xe2'),require(_0x568a('0xe3')));_0x2d4dce[_0x568a('0x6')]('/api/userProfiles',require(_0x568a('0xe4')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xe5'),require('./api/userProfileSection'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xe6'),require(_0x568a('0xe7')));_0x2d4dce['use'](_0x568a('0xe8'),require(_0x568a('0xe9')));_0x2d4dce['use'](_0x568a('0xea'),require(_0x568a('0xeb')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xec'),require(_0x568a('0xed')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xee'),require(_0x568a('0xef')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf0'),require(_0x568a('0xf1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf2'),require(_0x568a('0xf3')));_0x2d4dce[_0x568a('0x6')]('/api/whatsapp/reports/transfer',require(_0x568a('0xf4')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf5'),require(_0x568a('0xf6')));_0x2d4dce['use'](_0x568a('0xf7'),require(_0x568a('0xf8')));_0x2d4dce['use'](_0x568a('0xf9'),require(_0x568a('0xfa')));_0x2d4dce['use']('/api/user-settings',require(_0x568a('0xfb')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xfc'),require(_0x568a('0xfd')));_0x2d4dce['use'](_0x568a('0xfe'),require(_0x568a('0xff')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x100'),require('./api/authGoogle'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x101'),require(_0x568a('0x102')));_0x2d4dce[_0x568a('0x6')]('/api/jira',require(_0x568a('0x103')));_0x2d4dce['use'](_0x568a('0x104'),require(_0x568a('0x105')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x106'),require(_0x568a('0x107')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x108'),require(_0x568a('0x109')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x10a'),require(_0x568a('0x10b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x10c'),require(_0x568a('0x10d')));_0x2d4dce['use']('/api/logs',clientSideLogs);_0x2d4dce[_0x568a('0x6')](_0x568a('0x10e'),express[_0x568a('0x10f')](path[_0x568a('0x110')](config[_0x568a('0x111')],_0x568a('0x10e'))));_0x2d4dce[_0x568a('0x6')](_0x568a('0x112'),express[_0x568a('0x10f')](path[_0x568a('0x110')](config[_0x568a('0x111')],_0x568a('0x112'))));_0x2d4dce[_0x568a('0x6')](_0x568a('0x113'),express[_0x568a('0x10f')](path[_0x568a('0x110')](config['root'],_0x568a('0x113'))));_0x2d4dce['use']('/snippet',express[_0x568a('0x10f')](path['join'](config[_0x568a('0x111')],_0x568a('0x114'),_0x568a('0x115'))));_0x2d4dce[_0x568a('0x6')](_0x568a('0x116'),express['static'](path['join'](config[_0x568a('0x111')],_0x568a('0x117'))));_0x2d4dce[_0x568a('0x118')](_0x568a('0x119'))['get'](errors[0x194]);_0x2d4dce[_0x568a('0x118')]('/*')[_0x568a('0x11a')](function(_0x52967f,_0x568944){_0x568944['sendFile'](path[_0x568a('0x11b')](_0x2d4dce[_0x568a('0x11a')](_0x568a('0x11c'))+'/index.html'));});return _0x2d4dce;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index cccf204..a963921 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xb85f=['../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc'];(function(_0x19aaa9,_0x9d0bb6){var _0x465463=function(_0x3a96db){while(--_0x3a96db){_0x19aaa9['push'](_0x19aaa9['shift']());}};_0x465463(++_0x9d0bb6);}(_0xb85f,0x132));var _0xfb85=function(_0x4a16a2,_0x3cbf1c){_0x4a16a2=_0x4a16a2-0x0;var _0x564b20=_0xb85f[_0x4a16a2];return _0x564b20;};'use strict';var jayson=require('jayson/promise');var _=require(_0xfb85('0x0'));var config=require(_0xfb85('0x1'));exports[_0xfb85('0x2')]=function(){return new Promise(function(_0x5b75a6,_0x935fd0){var _0x50f7c7={};_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x3')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/voiceExtension/voiceExtension.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x5')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x6')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x7')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x8')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x9')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/memberReport/memberReport.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0xa')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xb')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xc')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xd')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/mailAccount/mailAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xe')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0xf')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x10')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x11')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x12')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/faxApplication/faxApplication.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x13')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/faxMessage/faxMessage.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x14')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x15')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x16')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/smsInteraction/smsInteraction.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x17')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/smsQueue/smsQueue.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x18')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x19')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x1a')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x1b')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x1c')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x1d')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x1e')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/cmHopper/cmHopper.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x1f')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x20')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x21')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x22')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x23')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x24')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x25')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x26')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x27')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x28')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x29')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2a')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2b')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x2c')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2d')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2e')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2f')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x30')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x31')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/setting/setting.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x32')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/squareProject/squareProject.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x33')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x34')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x35')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x36')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x37')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x38')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x39')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x3a')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x30fb56=jayson[_0xfb85('0x3b')](_0x50f7c7)[_0xfb85('0x3c')]();var _0x1a3e79=config[_0xfb85('0x3d')][_0xfb85('0x3e')]||config['port']+0x1;var _0x82e1b1=config[_0xfb85('0x3d')]['ip']||_0xfb85('0x3f');_0x30fb56['on'](_0xfb85('0x40'),function(_0x4eda45){return _0x935fd0(_0x4eda45);});_0x30fb56[_0xfb85('0x2')](_0x1a3e79,_0x82e1b1,function(){console['log'](_0xfb85('0x41'),_0x82e1b1,_0x1a3e79);require('../config/triggers')[_0xfb85('0x42')]();return _0x5b75a6(_0xfb85('0x43')+_0x82e1b1+':'+_0x1a3e79);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 41e508a..34d6064 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 _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 +var _0xbb59=['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','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./reply','./error','setTimeout','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xbb59,0x167));var _0x9bb5=function(_0x5b921b,_0x37ee51){_0x5b921b=_0x5b921b-0x0;var _0xb83ee6=_0xbb59[_0x5b921b];return _0xb83ee6;};'use strict';var util=require('util');var _=require(_0x9bb5('0x0'));var EventEmitter=require(_0x9bb5('0x1'))[_0x9bb5('0x2')];var AGIReply=require(_0x9bb5('0x3'));var AGIError=require(_0x9bb5('0x4'));function AGIChannel(_0x435269){var _0x1f288d=this,_0x304809=new AGIReply(),_0x35a697=![],_0x311401={};EventEmitter['call'](_0x1f288d);_0x435269['setEncoding']('utf8');_0x435269[_0x9bb5('0x5')](0x8*0x3c*0x3c*0x3e8);_0x304809[_0x9bb5('0x6')](_0x9bb5('0x7'));_0x304809['on'](_0x9bb5('0x8'),function(_0x389120){for(var _0x338b8a in _0x389120){_0x1f288d[_0x338b8a]=_0x389120[_0x338b8a];}_0x1f288d[_0x9bb5('0x9')](_0x9bb5('0xa'));});_0x304809['on'](_0x9bb5('0xb'),function(_0x17a011){if(_0x17a011[_0x9bb5('0xc')]()==_0x9bb5('0xd')){_0x1f288d[_0x9bb5('0x9')]('hangup');return;}if(_0x17a011['substring'](0x0,0xb)==_0x9bb5('0xe')){_0x35a697=!![];}if(_0x35a697){_0x311401['rx']+=_0x17a011+'\x0a';if(_0x17a011['search']('520\x20End\x20of\x20proper')!=-0x1){_0x35a697=![];}}else{_0x311401['rx']=_0x17a011;}if(_0x35a697){return;}if(typeof _0x311401['cb']=='function'){var _0x1a32b1=_0x311401['rx'][_0x9bb5('0xf')](0x0,0x3),_0x2025b7=null,_0x2edd65=null;_0x1a32b1=parseInt(_0x1a32b1);if(isNaN(_0x1a32b1)){_0x311401['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9bb5('0x10')});return;}if(_0x1a32b1!=0xc8){_0x311401['cb'](null,{'code':_0x1a32b1,'result':-0x1,'extra':'KO'});return;}_0x2025b7=_0x311401['rx'][_0x9bb5('0xf')](0x4)[_0x9bb5('0x11')](_0x9bb5('0x12'),'');if(_0x2025b7[_0x9bb5('0x13')]('\x20')!=-0x1){_0x2025b7=_0x2025b7[_0x9bb5('0x14')](0x0,_0x2025b7[_0x9bb5('0x13')]('\x20'));}if(_[_0x9bb5('0x15')](_0x2025b7,'-1')){_0x2025b7=parseInt(_0x2025b7);}_0x2edd65=_0x311401['rx'][_0x9bb5('0x16')]('\x20');if(_0x2edd65[_0x9bb5('0x17')]==0x3){_0x2edd65=_0x2edd65[0x2][_0x9bb5('0xf')](0x1,_0x2edd65[0x2]['length']-0x1);}else if(_0x2edd65[_0x9bb5('0x17')]>0x3){var _0x53920b=/\((.+)\)/;var _0x587187=_0x311401['rx'][_0x9bb5('0x18')](_0x53920b);if(_0x587187){_0x2edd65=_0x587187[0x1];}else{_0x2edd65=null;}}else{_0x2edd65=null;}_0x311401['cb'](null,{'code':_0x1a32b1,'result':_0x2025b7,'extra':_0x2edd65});}});_0x435269['on'](_0x9bb5('0x19'),function(_0x11e4dd){_0x1f288d[_0x9bb5('0x9')](_0x9bb5('0x19'),new AGIError(_0x9bb5('0x1a'),_0x11e4dd[_0x9bb5('0x1b')]));});_0x435269['on'](_0x9bb5('0x1c'),function(){_0x1f288d[_0x9bb5('0x9')](_0x9bb5('0x1c'),new AGIError(_0x9bb5('0x1d')));});_0x435269['on'](_0x9bb5('0x1e'),function(){_0x1f288d[_0x9bb5('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x435269[_0x9bb5('0x1f')]();});_0x435269[_0x9bb5('0x20')](_0x304809);this[_0x9bb5('0x21')]=function(_0x5781d2,_0x43e18d){var _0x5781d2=_0x5781d2||'',_0x43e18d=typeof _0x43e18d=='function'?_0x43e18d:new Function();_0x311401={'tx':_0x5781d2,'rx':'','cb':_0x43e18d};_0x435269[_0x9bb5('0x22')](_0x5781d2+'\x0a');},this[_0x9bb5('0x1c')]=function(){_0x435269[_0x9bb5('0x1f')]();};}util[_0x9bb5('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x25')]=function(_0x37a0a0){return this[_0x9bb5('0x21')][_0x9bb5('0x26')](this,_0x37a0a0);};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x27')]=function(){return this[_0x9bb5('0x25')](_0x9bb5('0x28'));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x29')]=function(_0x3edfa5,_0x254ff4,_0x10b9f4){_0x3edfa5=_0x3edfa5===undefined?_0x9bb5('0x2a'):_0x3edfa5;_0x254ff4=_0x254ff4===undefined?'5':_0x254ff4;_0x10b9f4=_0x10b9f4===undefined?'1':_0x10b9f4;return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x2c'),_0x3edfa5,_0x254ff4*0x3e8,_0x10b9f4));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x2d')]=function(_0x52a6d7){_0x52a6d7=_0x52a6d7||_0x9bb5('0x2e');return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')]('VERBOSE\x20\x22%s\x22',_0x52a6d7));};AGIChannel['prototype']['exec']=function(_0x45268e,_0x40ba10){if(_[_0x9bb5('0x2f')](_0x40ba10)){return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')]('EXEC\x20%s\x20%s',_0x45268e,_0x40ba10['join'](',')));}return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x30'),_0x45268e,_0x40ba10));};AGIChannel['prototype']['setContext']=function(_0x11f337){return this['sendRequest'](util[_0x9bb5('0x2b')](_0x9bb5('0x31'),_0x11f337));};AGIChannel[_0x9bb5('0x24')]['setExtension']=function(_0x534750){return this['sendRequest'](util['format'](_0x9bb5('0x32'),_0x534750));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x33')]=function(_0x39c474){return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x34'),_0x39c474));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0xd')]=function(){return this[_0x9bb5('0x25')](_0x9bb5('0x35'));};AGIChannel[_0x9bb5('0x24')]['setVariable']=function(_0x2b96d9,_0x4a8ca2){var _0x30b784=_['isBoolean'](_0x4a8ca2)||_[_0x9bb5('0x36')](_0x4a8ca2)?_0x4a8ca2['toString']():_0x4a8ca2;return this[_0x9bb5('0x25')](util['format'](_0x9bb5('0x37'),_0x2b96d9,_0x30b784?_0x30b784[_0x9bb5('0x38')]()[_0x9bb5('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x39')]=function(_0x30162a,_0x2a68d5){return this['sendRequest'](util[_0x9bb5('0x2b')](_0x9bb5('0x3a'),_0x30162a,_0x2a68d5));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x3b')]=function(_0x1cac45,_0x24dc0c){return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x3c'),_0x1cac45,_0x24dc0c));};AGIChannel[_0x9bb5('0x24')]['sayPhonetic']=function(_0x483353,_0x5d8635){return this[_0x9bb5('0x25')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x483353,_0x5d8635));};AGIChannel['prototype'][_0x9bb5('0x3d')]=function(_0x5be18c,_0x3f2ea3,_0x10085e){_0x3f2ea3=_0x3f2ea3||this[_0x9bb5('0x3e')];_0x10085e=_0x10085e||0x1;this[_0x9bb5('0x3f')](_0x5be18c);this['setExtension'](_0x3f2ea3);this[_0x9bb5('0x33')](_0x10085e);return this[_0x9bb5('0x2d')](util[_0x9bb5('0x2b')](_0x9bb5('0x40'),_0x5be18c,_0x3f2ea3,_0x10085e));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x41')]=function(_0x7eec49){return this['sendRequest'](util[_0x9bb5('0x2b')](_0x9bb5('0x42'),_0x7eec49));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x43')]=function(_0x30cc06,_0x2f5985,_0x45b2b3,_0x141224,_0x23f9a3,_0x5a8829){_0x2f5985=_0x2f5985||_0x9bb5('0x44');_0x45b2b3=_0x45b2b3||'';_0x141224=_0x141224===undefined?-0x1:_0x141224==='-1'?-0x1:_0x141224*0x3e8;_0x23f9a3=_0x23f9a3===undefined?'':'s='+_0x23f9a3;_0x5a8829=_0x5a8829?_0x9bb5('0x45'):'';return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x46'),_0x30cc06,_0x2f5985,_0x45b2b3,_0x141224,_0x5a8829,_0x23f9a3));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x47')]=function(_0x5568e8,_0x473dbc){_0x473dbc=_0x473dbc||'';return this[_0x9bb5('0x25')](util['format'](_0x9bb5('0x48'),_0x5568e8,_0x473dbc));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x49')]=function(_0x2564f4){return this[_0x9bb5('0x4a')]('AGI',_0x2564f4);};AGIChannel[_0x9bb5('0x24')]['wait']=function(_0xc514cc){return this['exec'](_0x9bb5('0x4b'),_0xc514cc);};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x19')]=function(_0x3bc433,_0x431132){this[_0x9bb5('0x2d')](util['format'](_0x9bb5('0x4c'),_0x3bc433['id'],_0x3bc433[_0x9bb5('0x4d')],_0x431132));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 f46724e..3f90c0f 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 _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 +var _0x8f5a=['exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x3c1d48,_0x361ab3){var _0x359de5=function(_0x59d45b){while(--_0x59d45b){_0x3c1d48['push'](_0x3c1d48['shift']());}};_0x359de5(++_0x361ab3);}(_0x8f5a,0x171));var _0xa8f5=function(_0x426e9b,_0x50cc93){_0x426e9b=_0x426e9b-0x0;var _0x1dc9dd=_0x8f5a[_0x426e9b];return _0x1dc9dd;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xa8f5('0x0'),'E_AGI_ARGUMENT_PORT':_0xa8f5('0x1'),'E_AGI_SERVER_ERROR':_0xa8f5('0x2'),'E_AGI_SERVER_CLOSE':_0xa8f5('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa8f5('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa8f5('0x5'),'E_AGI_SOCKET_CLOSE':_0xa8f5('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xa8f5('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa8f5('0x8'),'E_AGI_IVR_ENTRY':_0xa8f5('0x9')};function AGIError(_0x580f0b){var _0x580f0b=_0x580f0b||null,_0x454fb1=_0x454fb1||[],_0x29a50f=0x1,_0x91ccea='';if(!error[_0x580f0b]){_0x580f0b=_0xa8f5('0xa');}_0x454fb1['push'](error[_0x580f0b]);while(arguments[_0x29a50f]){_0x454fb1[_0xa8f5('0xb')](arguments[_0x29a50f]);_0x29a50f++;}_0x91ccea=util[_0xa8f5('0xc')][_0xa8f5('0xd')](util,_0x454fb1);this[_0xa8f5('0xe')]=_0x91ccea;this['name']=_0x580f0b;}module[_0xa8f5('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 07f27d0..baf816e 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 _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 +var _0xd151=['redis','defaults','localhost','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','events','ioredis'];(function(_0xdc250d,_0x49433b){var _0x5e0da5=function(_0x1721c8){while(--_0x1721c8){_0xdc250d['push'](_0xdc250d['shift']());}};_0x5e0da5(++_0x49433b);}(_0xd151,0xbe));var _0x1d15=function(_0x41e3e5,_0x441240){_0x41e3e5=_0x41e3e5-0x0;var _0x4b5b5c=_0xd151[_0x41e3e5];return _0x4b5b5c;};'use strict';var _=require('lodash');var EventEmitter=require(_0x1d15('0x0'))['EventEmitter'];var Redis=require(_0x1d15('0x1'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x1d15('0x2')]=_[_0x1d15('0x3')](config[_0x1d15('0x2')],{'host':_0x1d15('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1d15('0x2')]);sub['subscribe']('agi',function(_0x20e8ef){if(_0x20e8ef)return eventEmitter[_0x1d15('0x5')](_0x1d15('0x6'),new AGIError(_0x1d15('0x7'),_0x20e8ef));});sub['on'](_0x1d15('0x8'),function(_0x551cfc,_0x323b40){if(_0x551cfc!=='agi')return;try{var _0x476d0d=JSON[_0x1d15('0x9')](_0x323b40);eventEmitter[_0x1d15('0x5')](_0x1d15('0xa'),_0x476d0d);}catch(_0x1bd132){eventEmitter[_0x1d15('0x5')](_0x1d15('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x1bd132));}});module[_0x1d15('0xb')]={'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 68c3f18..2756f78 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 _0xb160=['target','default','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch'];(function(_0x312fca,_0x413a5e){var _0x5193f8=function(_0x56196c){while(--_0x56196c){_0x312fca['push'](_0x312fca['shift']());}};_0x5193f8(++_0x413a5e);}(_0xb160,0x14f));var _0x0b16=function(_0x5380e5,_0x2151f3){_0x5380e5=_0x5380e5-0x0;var _0x183ee2=_0xb160[_0x5380e5];return _0x183ee2;};'use strict';var _=require(_0x0b16('0x0'));var logger=require(_0x0b16('0x1'))(_0x0b16('0x2'));var verticesWithRetry=[_0x0b16('0x3'),_0x0b16('0x4'),_0x0b16('0x5')];var Graph=function(){this[_0x0b16('0x6')]={};this[_0x0b16('0x7')]={};this[_0x0b16('0x8')]=0x0;};Graph[_0x0b16('0x9')][_0x0b16('0xa')]=function(_0xc62a9f){this[_0x0b16('0x6')][_0xc62a9f['id']]=_0xc62a9f;this[_0x0b16('0x7')][_0xc62a9f['id']]=[];};Graph[_0x0b16('0x9')][_0x0b16('0xb')]=function(_0x4f6c9b,_0x2494e4,_0x270e44){this['edges'][_0x4f6c9b][_0x0b16('0xc')]({'target':_0x2494e4,'condition':_0x270e44});this[_0x0b16('0x8')]+=0x1;};Graph[_0x0b16('0x9')][_0x0b16('0xd')]=function(){return _[_0x0b16('0xd')](this[_0x0b16('0x6')]);};Graph['prototype']['relations']=function(){return this[_0x0b16('0x8')];};Graph[_0x0b16('0x9')][_0x0b16('0xe')]=function(_0x447d3b){return this[_0x0b16('0x6')][_0x447d3b];};Graph[_0x0b16('0x9')][_0x0b16('0xf')]=function(_0x16840e,_0x562f8a){if(!this[_0x0b16('0x6')][_0x16840e]){return logger[_0x0b16('0x10')](_0x0b16('0x11'));}var _0x813f98=_0x562f8a(this[_0x0b16('0x6')][_0x16840e]);if(!_0x813f98){return logger[_0x0b16('0x10')](_0x0b16('0x12'));}if(this[_0x0b16('0x7')][_0x16840e][_0x0b16('0x13')]===0x0){return logger['info'](_0x0b16('0x14'));}for(var _0x3567a2=0x0,_0x21fffc=[],_0x291212=![];_0x3567a2\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 +var _0xb0c5=['getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','./server','listening','connection','lodash','util','../../config/environment','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','error','stack','splice','push','env','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','agi_','substring','stringify','close','timeout','hangup','find','production','initialize'];(function(_0x49ac39,_0x583aa2){var _0x45ee5e=function(_0x44d62e){while(--_0x44d62e){_0x49ac39['push'](_0x49ac39['shift']());}};_0x45ee5e(++_0x583aa2);}(_0xb0c5,0x18a));var _0x5b0c=function(_0x41a333,_0x4e19e3){_0x41a333=_0x41a333-0x0;var _0x5938f2=_0xb0c5[_0x41a333];return _0x5938f2;};'use strict';var _=require(_0x5b0c('0x0'));var syncho=require('syncho');var util=require(_0x5b0c('0x1'));var config=require(_0x5b0c('0x2'));var logger=require('../../config/logger')(_0x5b0c('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x5b0c('0x4'));var Project=require(_0x5b0c('0x5'));var AGIEmitter=require(_0x5b0c('0x6'))[_0x5b0c('0x7')];var projects=[];config[_0x5b0c('0x3')]=_[_0x5b0c('0x8')](config[_0x5b0c('0x3')],{'ip':_0x5b0c('0x9'),'port':0x11dd});AGIEmitter['on'](_0x5b0c('0xa'),projectUpdateHandler);function connectionHandler(_0x129f7b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x129f7b);agiHandler(_0x129f7b);}catch(_0x9dab3c){logger[_0x5b0c('0xb')](_0x9dab3c[_0x5b0c('0xc')]);}});});}function projectUpdateHandler(_0x5f032e){try{var _0x4b2fc9=_['findIndex'](projects,['id',_0x5f032e['id']]);if(_0x4b2fc9>-0x1){if(_0x5f032e['deleted']===!![]){projects[_0x5b0c('0xd')](_0x4b2fc9,0x1);}else{projects[_0x4b2fc9]=_0x5f032e;}}else{projects[_0x5b0c('0xe')](_0x5f032e);}}catch(_0x375317){logger['error'](_0x375317['stack']);}}function listeningHandler(){var _0x36c461=config[_0x5b0c('0xf')]==='production'||![];console[_0x5b0c('0x10')](_0x5b0c('0x11'),config[_0x5b0c('0x3')][_0x5b0c('0x12')]);logger[_0x5b0c('0x13')](util[_0x5b0c('0x14')](_0x5b0c('0x15'),_0x36c461?config['agi']['ip']:'host.docker.internal',config[_0x5b0c('0x3')][_0x5b0c('0x12')]));}function errorHandler(_0x4856ab){if(_0x4856ab&&_0x4856ab[_0x5b0c('0x16')]&&_0x4856ab[_0x5b0c('0x17')]){logger[_0x5b0c('0xb')](util['format'](_0x5b0c('0x18'),_0x4856ab[_0x5b0c('0x16')],_0x4856ab['message']));}else{logger[_0x5b0c('0xb')](util[_0x5b0c('0x14')](_0x5b0c('0x19'),_0x4856ab[_0x5b0c('0xc')]));}}function closeHandler(){logger[_0x5b0c('0x13')](util[_0x5b0c('0x14')](_0x5b0c('0x1a'),this[_0x5b0c('0x1b')],this[_0x5b0c('0x1c')],this[_0x5b0c('0x1d')],this[_0x5b0c('0x1e')],this[_0x5b0c('0x1f')]));try{createSquareReport(this);}catch(_0x4da96b){logger[_0x5b0c('0xb')](_0x4da96b[_0x5b0c('0xc')]);}}function timeoutHandler(){logger['info'](util[_0x5b0c('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x5b0c('0x1c')],this[_0x5b0c('0x1d')],this[_0x5b0c('0x1e')],this[_0x5b0c('0x1f')]));}function hangupHandler(){logger[_0x5b0c('0x13')](util['format'](_0x5b0c('0x20'),this[_0x5b0c('0x1b')],this[_0x5b0c('0x1c')],this[_0x5b0c('0x1d')],this[_0x5b0c('0x1e')],this[_0x5b0c('0x1f')]));this[_0x5b0c('0x21')]=!![];}function createSquareReport(_0x5f183f,_0x3fb904){rpc[_0x5b0c('0x22')](_0x5f183f)[_0x5b0c('0x23')](function(_0x5489cf){if(_0x3fb904){_0x3fb904(null,_0x5489cf);}})[_0x5b0c('0x24')](function(_0x31e05a){if(_0x3fb904){_0x3fb904(null,_0x31e05a);}});}function setChannelVariables(_0x4c3c04){for(var _0x39570 in _0x4c3c04){if(_0x4c3c04['hasOwnProperty'](_0x39570)){if(_0x39570['indexOf'](_0x5b0c('0x25'))===0x0){_0x4c3c04[_0x39570[_0x5b0c('0x26')](0x4)]=_0x4c3c04[_0x39570];delete _0x4c3c04[_0x39570];}}}}function agiHandler(_0x22dc44){logger['debug']('variables',JSON[_0x5b0c('0x27')](_0x22dc44,null,0x2));logger[_0x5b0c('0x13')](util[_0x5b0c('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x22dc44[_0x5b0c('0x1b')],_0x22dc44[_0x5b0c('0x1c')],_0x22dc44['callerid'],_0x22dc44[_0x5b0c('0x1e')],_0x22dc44[_0x5b0c('0x1f')]));_0x22dc44['on']('error',errorHandler);_0x22dc44['on'](_0x5b0c('0x28'),closeHandler);_0x22dc44['on'](_0x5b0c('0x29'),timeoutHandler);_0x22dc44[_0x5b0c('0x21')]=![];_0x22dc44['on'](_0x5b0c('0x2a'),hangupHandler);var _0x5222df=_[_0x5b0c('0x2b')](projects,[_0x5b0c('0x16'),_0x22dc44[_0x5b0c('0x1b')]]);if(!_0x5222df)return Project['handleNotFound'](_0x22dc44);if(!_0x5222df[_0x5b0c('0x2c')])return Project['handleUnpublished'](_0x22dc44);return Project[_0x5b0c('0x2d')](_0x5222df,_0x22dc44);}function main(){var _0x23396c;return utilLicense[_0x5b0c('0x2e')]()['then'](function(_0x518ae9){if(!_0x518ae9)return;if(_0x518ae9[_0x5b0c('0x2f')]){if(_0x518ae9['callysquare']&&_0x518ae9[_0x5b0c('0x30')]>0x0){logger['info'](util[_0x5b0c('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x518ae9[_0x5b0c('0x30')]));_0x23396c=_0x518ae9[_0x5b0c('0x30')];}else{logger[_0x5b0c('0x13')](_0x5b0c('0x31'));}}else{logger[_0x5b0c('0x13')](_0x5b0c('0x32'));_0x23396c=-0x1;}})['then'](function(){return Project[_0x5b0c('0x33')]();})[_0x5b0c('0x23')](function(_0x5eb908){projects=_0x5eb908;return;})[_0x5b0c('0x24')](function(_0x3e6fe6){logger['error']('[LICENSE]',_0x3e6fe6['stack']);})['finally'](function(){var _0x5af9cf=require(_0x5b0c('0x34'))(config['agi'][_0x5b0c('0x12')],config['agi']['ip'],_0x23396c);_0x5af9cf['on'](_0x5b0c('0xb'),errorHandler);_0x5af9cf['on'](_0x5b0c('0x35'),listeningHandler);_0x5af9cf['on'](_0x5b0c('0x36'),connectionHandler);_0x5af9cf['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 28451c0..4057aba 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 _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 +var _0x5217=['result','sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x505c9a,_0x3c0087){var _0x3ddae6=function(_0xce0893){while(--_0xce0893){_0x505c9a['push'](_0x505c9a['shift']());}};_0x3ddae6(++_0x3c0087);}(_0x5217,0x7a));var _0x7521=function(_0x17f94f,_0x977aa){_0x17f94f=_0x17f94f-0x0;var _0x63c583=_0x5217[_0x17f94f];return _0x63c583;};'use strict';var BPromise=require(_0x7521('0x0'));var jayson=require(_0x7521('0x1'));var client=jayson[_0x7521('0x2')][_0x7521('0x3')]({'port':0x232b});function request(_0x4e8101,_0x2b3af9){return new BPromise(function(_0x51d987,_0x343445){return client[_0x7521('0x4')](_0x4e8101,_0x2b3af9)[_0x7521('0x5')](function(_0x97c157){if(_0x97c157[_0x7521('0x6')]){return _0x343445(_0x97c157[_0x7521('0x6')][_0x7521('0x7')]);}else{return _0x51d987(_0x97c157[_0x7521('0x8')]);}})['catch'](function(_0x497e1e){return _0x343445(_0x497e1e);});});}exports[_0x7521('0x9')]=function(_0x302be2,_0x57b182){return request('SendMail',{'account':_0x302be2,'message':_0x57b182});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 72c2940..c92e18b 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 _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 +var _0xf462=['isUndefined','[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','close','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','toString','agicommand\x20not\x20found','stack','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','finally'];(function(_0x335f37,_0x37302b){var _0x1768f4=function(_0x3ce316){while(--_0x3ce316){_0x335f37['push'](_0x335f37['shift']());}};_0x1768f4(++_0x37302b);}(_0xf462,0xc5));var _0x2f46=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xf462[_0x26a906];return _0x495575;};'use strict';var _=require('lodash');var moment=require(_0x2f46('0x0'));var parser=require(_0x2f46('0x1'));var util=require(_0x2f46('0x2'));var logger=require(_0x2f46('0x3'))(_0x2f46('0x4'));var rpc=require(_0x2f46('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x2f46('0x6'));var Vertices=require(_0x2f46('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2f46('0x8')]()['catch'](function(_0x8efd68){logger[_0x2f46('0x9')](_0x2f46('0xa'),_0x8efd68['stack']);return[];});}function addVertex(_0xce4152,_0xa3b28d,_0x4894a7){_0xa3b28d[_0x2f46('0xb')]=_0x4894a7;if(_0xa3b28d[_0x2f46('0xc')](_0x2f46('0xd'))){_0xa3b28d['maxRetry']=parseInt(_0xa3b28d[_0x2f46('0xd')],0xa);}_0xce4152[_0x2f46('0xe')](_[_0x2f46('0xf')](_0xa3b28d,_0x2f46('0x10')));}function initGraph(_0x1cee95,_0x293d3f){var _0x4f13f4=new Graph();for(var _0x47fc31 in _0x1cee95){if(_0x1cee95[_0x2f46('0xc')](_0x47fc31)){if(_[_0x2f46('0x11')](_0x1cee95[_0x47fc31])){for(var _0x17cd03=0x0;_0x17cd03<_0x1cee95[_0x47fc31][_0x2f46('0x12')];_0x17cd03+=0x1){addVertex(_0x4f13f4,_0x1cee95[_0x47fc31][_0x17cd03],_0x47fc31);}}else{addVertex(_0x4f13f4,_0x1cee95[_0x47fc31],_0x47fc31);}}}for(var _0x25f60e=0x0;_0x25f60e<_0x293d3f[_0x2f46('0x12')];_0x25f60e+=0x1){if(_0x293d3f[_0x25f60e][_0x2f46('0x13')]&&_0x293d3f[_0x25f60e][_0x2f46('0x14')]){_0x4f13f4['addEdge'](_0x293d3f[_0x25f60e][_0x2f46('0x13')],_0x293d3f[_0x25f60e][_0x2f46('0x14')],_0x293d3f[_0x25f60e][_0x2f46('0x15')]);}}return _0x4f13f4;}function getRoot(_0xf3f9c0){return parser[_0x2f46('0x16')](_0xf3f9c0,{'object':!![]})[_0x2f46('0x17')][_0x2f46('0x18')];}function inspect(_0x3dd41d){return util[_0x2f46('0x19')](_0x3dd41d,{'showHidden':![],'depth':null});}function initialize(_0x544c83,_0x5af25d){var _0x59e053=getRoot(_0x544c83[_0x2f46('0x1a')]);if(!_0x59e053||!_0x59e053[_0x2f46('0x1b')])return;var _0x2f9d94,_0x46e79a,_0x20e222;logger[_0x2f46('0x1c')]('root',JSON[_0x2f46('0x1d')](_0x59e053,null,0x2));_0x5af25d[_0x2f46('0x1e')]=moment()[_0x2f46('0x1f')](_0x2f46('0x20'));_0x2f9d94=initGraph(_[_0x2f46('0xf')](_0x59e053,_0x2f46('0x10')),_0x59e053[_0x2f46('0x10')]);_0x46e79a=new Vertices(_0x5af25d,rpc,mailRpc);logger[_0x2f46('0x21')](util[_0x2f46('0x1f')](_0x2f46('0x22'),_0x5af25d[_0x2f46('0x23')],_0x5af25d[_0x2f46('0x24')],_0x5af25d[_0x2f46('0x25')],_0x5af25d[_0x2f46('0x26')],_0x5af25d['uniqueid']));_0x2f9d94[_0x2f46('0x27')](_0x59e053[_0x2f46('0x1b')]['id'],function(_0x49680c){try{_0x49680c=_0x46e79a['clear'](_0x49680c);logger['debug'](_0x2f46('0x28'),JSON[_0x2f46('0x1d')](_0x49680c,null,0x2));if(_0x49680c[_0x2f46('0xb')]==='gotoc'){logger[_0x2f46('0x21')](_0x2f46('0x29'));_0x5af25d[_0x2f46('0x2a')]=_0x49680c[_0x2f46('0x2a')]||_0x5af25d['context'];_0x5af25d[_0x2f46('0x2b')]=_0x49680c[_0x2f46('0x2b')];_0x5af25d[_0x2f46('0x2c')]=_0x49680c[_0x2f46('0x2c')]?_0x49680c[_0x2f46('0x2c')]-0x1:0x1;return null;}else if(_0x49680c&&_0x46e79a[_0x49680c[_0x2f46('0xb')]]){_0x20e222=_0x46e79a[_0x49680c['agicommand']](_0x49680c);logger['info']('response',JSON[_0x2f46('0x1d')](_0x20e222,null,0x2));if(_0x20e222&&_0x20e222[_0x2f46('0x2d')]===AGI_CODE_SUCCESS&&_0x20e222[_0x2f46('0x2e')]!==AGI_RESULT_ERROR&&!_0x5af25d[_0x2f46('0x2f')]){logger[_0x2f46('0x1c')](_0x2f46('0x30'),inspect(_0x20e222));return _['isUndefined'](_0x20e222[_0x2f46('0x2e')])?null:_0x20e222['result'][_0x2f46('0x31')]();}else{logger[_0x2f46('0x9')](_0x2f46('0x30'),inspect(_0x20e222));return null;}}else{logger[_0x2f46('0x9')](_0x2f46('0x32'));return null;}}catch(_0x4bcdd6){logger['error'](_0x4bcdd6[_0x2f46('0x33')]);return null;}});if(_0x59e053['finally']){logger[_0x2f46('0x21')](util[_0x2f46('0x1f')](_0x2f46('0x34'),_0x5af25d[_0x2f46('0x23')],_0x5af25d['calleridname'],_0x5af25d['callerid'],_0x5af25d[_0x2f46('0x26')],_0x5af25d[_0x2f46('0x35')]));_0x2f9d94['traverseBFS'](_0x59e053[_0x2f46('0x36')]['id'],function(_0x442e35){try{_0x442e35=_0x46e79a['clear'](_0x442e35);logger[_0x2f46('0x1c')]('vertex',JSON[_0x2f46('0x1d')](_0x442e35,null,0x2));if(_0x442e35&&_0x46e79a[_0x442e35[_0x2f46('0xb')]]){_0x20e222=_0x46e79a[_0x442e35['agicommand']](_0x442e35);if(_0x20e222){logger['debug'](_0x2f46('0x30'),inspect(_0x20e222));return _[_0x2f46('0x37')](_0x20e222[_0x2f46('0x2e')])?null:_0x20e222[_0x2f46('0x2e')]['toString']();}else{logger[_0x2f46('0x9')](_0x2f46('0x30'),inspect(_0x20e222));return null;}}else{logger[_0x2f46('0x9')](_0x2f46('0x32'));return null;}}catch(_0x3159c4){logger['error'](_0x3159c4[_0x2f46('0x33')]);return null;}});}logger[_0x2f46('0x21')](util[_0x2f46('0x1f')](_0x2f46('0x38'),_0x5af25d[_0x2f46('0x23')],_0x5af25d[_0x2f46('0x24')],_0x5af25d['callerid'],_0x5af25d[_0x2f46('0x26')],_0x5af25d[_0x2f46('0x35')]));logger['info'](util[_0x2f46('0x1f')](_0x2f46('0x39'),_0x5af25d['context'],_0x5af25d['extension'],parseInt(_0x5af25d[_0x2f46('0x2c')],0xa)+0x1));_0x5af25d[_0x2f46('0x3a')](_0x5af25d[_0x2f46('0x2a')],_0x5af25d[_0x2f46('0x2b')],parseInt(_0x5af25d['priority'],0xa)+0x1);_0x5af25d['close']();}function handleNotFound(_0x3864a3){logger['error'](util[_0x2f46('0x1f')](_0x2f46('0x3b'),_0x3864a3[_0x2f46('0x23')]));_0x3864a3[_0x2f46('0x3a')](_0x3864a3[_0x2f46('0x2a')],_0x3864a3['extension'],parseInt(_0x3864a3[_0x2f46('0x2c')],0xa)+0x1);_0x3864a3[_0x2f46('0x3c')]();}function handleUnpublished(_0x21aa95){logger[_0x2f46('0x9')](util['format'](_0x2f46('0x3d'),_0x21aa95[_0x2f46('0x23')]));_0x21aa95[_0x2f46('0x3a')](_0x21aa95['context'],_0x21aa95[_0x2f46('0x2b')],parseInt(_0x21aa95[_0x2f46('0x2c')],0xa)+0x1);_0x21aa95[_0x2f46('0x3c')]();}module[_0x2f46('0x3e')]={'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 60ea6a3..cf797b3 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 _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 +var _0x32e6=['trim','emit','headers','line','util','stream','Transform','call','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','_localBuffer','indexOf','substring','length','split','slice'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x32e6,0x82));var _0x632e=function(_0x2cf84d,_0x2cba31){_0x2cf84d=_0x2cf84d-0x0;var _0x38bf07=_0x32e6[_0x2cf84d];return _0x38bf07;};'use strict';var util=require(_0x632e('0x0'));var Transform=require(_0x632e('0x1'))[_0x632e('0x2')];function AGIReply(_0x4431e8){Transform[_0x632e('0x3')](this,_0x4431e8);this['_localBuffer']='';this[_0x632e('0x4')]=![];}util[_0x632e('0x5')](AGIReply,Transform);AGIReply[_0x632e('0x6')]['_transform']=function(_0xd3dceb,_0x297a1c,_0x1abc27){var _0x1d2800='\x0a',_0x40411d=['\x0a\x0a',_0x632e('0x7')],_0x11dea4=-0x1,_0x25e6a7=-0x1,_0x4665a5='',_0x541db6=0x0,_0x404ca6='',_0x32b732='';this['_localBuffer']+=_0xd3dceb['toString']();_0x404ca6=this[_0x632e('0x8')];if(!this[_0x632e('0x4')]){_0x541db6=0x0;while(_0x40411d[_0x541db6]){while((_0x25e6a7=_0x404ca6[_0x632e('0x9')](_0x40411d[_0x541db6]))!=-0x1){_0x4665a5=_0x40411d[_0x541db6];_0x32b732=_0x404ca6[_0x632e('0xa')](0x0,_0x25e6a7);_0x404ca6=_0x404ca6[_0x632e('0xa')](_0x25e6a7+_0x4665a5[_0x632e('0xb')]);var _0x5e0d62=_0x32b732[_0x632e('0xc')](_0x1d2800),_0xb08890=0x0,_0x5d005a={},_0x2690d3='',_0x264195='',_0xceffee=-0x1;while(_0x5e0d62[_0xb08890]){_0xceffee=_0x5e0d62[_0xb08890][_0x632e('0x9')](':');if(_0xceffee!=-0x1){_0x2690d3=_0x5e0d62[_0xb08890][_0x632e('0xd')](0x0,_0xceffee)['trim']();_0x264195=_0x5e0d62[_0xb08890][_0x632e('0xd')](_0xceffee+0x1)[_0x632e('0xe')]();if(_0x2690d3['length']>0x0){_0x5d005a[_0x2690d3]=_0x264195;}}else{}_0xb08890++;}this[_0x632e('0xf')](_0x632e('0x10'),_0x5d005a);this[_0x632e('0x4')]=!![];}_0x541db6++;}this[_0x632e('0x8')]=_0x404ca6;}else{while((_0x11dea4=_0x404ca6[_0x632e('0x9')](_0x1d2800))!=-0x1){_0x32b732=_0x404ca6['substring'](0x0,_0x11dea4);this[_0x632e('0xf')](_0x632e('0x11'),_0x32b732);_0x404ca6=_0x404ca6['substring'](_0x11dea4+_0x1d2800[_0x632e('0xb')]);}this['_localBuffer']=_0x404ca6;}_0x1abc27();};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 76471f9..10b664d 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 _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 +var _0x25b5=['CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','catch','getSquareProjects','name','production','getSquareProject','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','GetContactByPhone','phone','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createCmContact','ShowCmHopper'];(function(_0x11de96,_0x3b172b){var _0x26d213=function(_0x178662){while(--_0x178662){_0x11de96['push'](_0x11de96['shift']());}};_0x26d213(++_0x3b172b);}(_0x25b5,0x198));var _0x525b=function(_0x1271c0,_0x2b8ed4){_0x1271c0=_0x1271c0-0x0;var _0x355b93=_0x25b5[_0x1271c0];return _0x355b93;};'use strict';var _=require(_0x525b('0x0'));var moment=require(_0x525b('0x1'));var jayson=require(_0x525b('0x2'));var client=jayson[_0x525b('0x3')][_0x525b('0x4')]({'port':0x2329});function request(_0x55c204,_0x1086a1){return new Promise(function(_0x59aba3,_0xae34c2){return client[_0x525b('0x5')](_0x55c204,_0x1086a1)[_0x525b('0x6')](function(_0x5eca98){if(_0x5eca98['error']){return _0xae34c2(_0x5eca98[_0x525b('0x7')]['message']);}else{return _0x59aba3(_0x5eca98['result']);}})[_0x525b('0x8')](function(_0x3ef6f1){return _0xae34c2(_0x3ef6f1);});});}exports[_0x525b('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x525b('0xa'),_0x525b('0xb')]}});};exports[_0x525b('0xc')]=function(_0x535dd9){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x535dd9},'attributes':['production']}});};exports['getMailAccountById']=function(_0x27ce0f){return request(_0x525b('0xd'),{'options':{'raw':![],'where':{'id':_0x27ce0f},'include':[{'model':'MailServerOut','as':_0x525b('0xe'),'include':[{'model':_0x525b('0xf'),'as':_0x525b('0xf')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x525b('0x10')]=function(_0x1af427){return request(_0x525b('0x11'),{'options':{'where':{'id':_0x1af427},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x12')]=function(_0x3897d5){return request(_0x525b('0x13'),{'options':{'where':{'id':_0x3897d5},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x14')]=function(_0x28de50){return request(_0x525b('0x15'),{'options':{'where':{'id':_0x28de50},'attributes':['name']}});};exports[_0x525b('0x16')]=function(_0x170e3e){return request(_0x525b('0x17'),{'options':{'where':{'id':_0x170e3e},'attributes':['dsn']}});};exports['getUserById']=function(_0x43b941){return request(_0x525b('0x18'),{'options':{'where':{'id':_0x43b941},'attributes':[_0x525b('0xa')]}});};exports['getContactByPhone']=function(_0x19eabd){return request(_0x525b('0x19'),{'options':{'where':{'phone':_0x19eabd[_0x525b('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x4db72e){return request('ShowTrunk',{'options':{'where':{'id':_0x4db72e},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x1b')]=function(_0xd93a42){return request(_0x525b('0x1c'),{'options':{'where':{'id':_0xd93a42},'attributes':[_0x525b('0x1d')]}});};exports[_0x525b('0x1e')]=function(_0x41ad32){return request(_0x525b('0x1f'),{'options':{'raw':![],'where':{'id':_0x41ad32},'include':[{'model':_0x525b('0x20'),'as':'Intervals'}]}});};exports[_0x525b('0x21')]=function(_0x3357a7){return request(_0x525b('0x22'),{'options':{'where':{'id':_0x3357a7},'attributes':['id','name']}});};exports[_0x525b('0x23')]=function(_0x29b5dc){return request(_0x525b('0x24'),{'body':_0x29b5dc});};exports['createSquareDetailsReport']=function(_0x497ca8){return request(_0x525b('0x25'),{'body':_0x497ca8});};exports[_0x525b('0x26')]=function(_0x1f22f8){return request(_0x525b('0x27'),{'body':_[_0x525b('0x28')](_0x1f22f8,{'project_name':_0x1f22f8[_0x525b('0x29')],'prev_project_name':_0x1f22f8[_0x525b('0x2a')]||'','is_subproject':_0x1f22f8[_0x525b('0x2a')]?!![]:![],'leaveAt':moment()[_0x525b('0x2b')](_0x525b('0x2c'))})});};exports[_0x525b('0x2d')]=function(_0x3448e7){return request('CreateSquareRecording',{'body':_0x3448e7});};exports['createSquareMessage']=function(_0x42a8ad){return request('CreateSquareMessage',{'body':_0x42a8ad});};exports[_0x525b('0x2e')]=function(_0x23a248){return request(_0x525b('0x2f'),{'options':{'raw':![],'where':{'phone':_0x23a248['phone'],'ListId':_0x23a248['ListId']}}})[_0x525b('0x6')](function(_0x3b2029){if(_0x3b2029){return _0x3b2029;}return request(_0x525b('0x30'),{'body':_0x23a248});});};exports[_0x525b('0x31')]=function(_0x268fb2){return request('ShowPause',{'options':{'where':{'id':_0x268fb2},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x32')]=function(_0x642eb1,_0x5c1791){return request(_0x525b('0x33'),{'body':{'interface':_0x5c1791},'options':{'where':_0x642eb1}});};exports[_0x525b('0x34')]=function(_0x2ebdf3,_0x3abc26,_0x1319d7){return request(_0x525b('0x35'),{'body':{'type':_0x3abc26,'uniqueid':_0x1319d7},'options':{'where':_0x2ebdf3}});};exports['agentUnpause']=function(_0x417bf3){return request(_0x525b('0x36'),{'body':{},'options':{'where':_0x417bf3}});};exports[_0x525b('0x37')]=function(_0x3b00bc){return request(_0x525b('0x38'),{'body':{},'options':{'where':_0x3b00bc}});}; \ 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 0912a7e..a69942c 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 _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 +var _0xa647=['./polly','./lex','exports'];(function(_0x2b7520,_0x21098c){var _0xf91023=function(_0x1fee4e){while(--_0x1fee4e){_0x2b7520['push'](_0x2b7520['shift']());}};_0xf91023(++_0x21098c);}(_0xa647,0x81));var _0x7a64=function(_0x33c54e,_0xce27e0){_0x33c54e=_0x33c54e-0x0;var _0xd90453=_0xa647[_0x33c54e];return _0xd90453;};var polly=require(_0x7a64('0x0'));var lex=require(_0x7a64('0x1'));module[_0x7a64('0x2')]={'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 6706b77..9dfb070 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0x4483=['exports','./lib/api'];(function(_0x53079f,_0x208f73){var _0x14ef16=function(_0x5337da){while(--_0x5337da){_0x53079f['push'](_0x53079f['shift']());}};_0x14ef16(++_0x208f73);}(_0x4483,0x1a3));var _0x3448=function(_0x4739e0,_0x3aa890){_0x4739e0=_0x4739e0-0x0;var _0x2ca372=_0x4483[_0x4739e0];return _0x2ca372;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 273b2d3..7041917 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(_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 +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x40fb00,_0x4da8f6){var _0x31754c=function(_0x198a46){while(--_0x198a46){_0x40fb00['push'](_0x40fb00['shift']());}};_0x31754c(++_0x4da8f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 419e730..d8c98a2 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 _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 +var _0xafbf=['exports','./lib/api'];(function(_0x37bfce,_0x4fc123){var _0x24bc5d=function(_0x2e3e81){while(--_0x2e3e81){_0x37bfce['push'](_0x37bfce['shift']());}};_0x24bc5d(++_0x4fc123);}(_0xafbf,0x113));var _0xfafb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xafbf[_0x1facfa];return _0x9ec701;};'use strict';var polly=require(_0xfafb('0x0'));module[_0xfafb('0x1')]=function(_0x87306e,_0x33738b,_0x487923,_0x5bd96f,_0x38a955,_0x11c968,_0x44e21a){return polly(_0x87306e,_0x33738b,_0x487923,_0x5bd96f,_0x38a955,_0x11c968,_0x44e21a);}; \ 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 fe10194..93427c0 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 _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 +var _0x82fb=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x130c64,_0x24ce68){var _0x59d57e=function(_0x2af67f){while(--_0x2af67f){_0x130c64['push'](_0x130c64['shift']());}};_0x59d57e(++_0x24ce68);}(_0x82fb,0xab));var _0xb82f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x82fb[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xb82f('0x0'));var rs=require(_0xb82f('0x1'));var AWS=require(_0xb82f('0x2'));function pollyResult(_0x190284,_0x137097,_0x883930){return new BPromise(function(_0x404afc,_0x18e637){_0x190284[_0xb82f('0x3')](_0x137097,function(_0x4a50a3,_0x3944de){if(_0x4a50a3){_0x18e637(_0x4a50a3);}else if(_0x3944de){if(_0x3944de['AudioStream']instanceof Buffer){fs[_0xb82f('0x4')](_0x883930,_0x3944de[_0xb82f('0x5')],function(_0x35828a){if(_0x35828a){_0x18e637(_0x35828a);}else{_0x404afc();}});}else{_0x18e637(new Error(_0xb82f('0x6')));}}else{_0x18e637(new Error(_0xb82f('0x7')));}});});}module['exports']=function(_0x1144b7,_0x33ea9d,_0x499618,_0x49c4ac,_0x469dea,_0x1e8d16,_0x11b384){var _0x1d66c6=new AWS[(_0xb82f('0x8'))]({'accessKeyId':_0x1144b7,'secretAccessKey':_0x33ea9d,'region':_0x499618});var _0x1c6fb9={'Text':_0x469dea,'TextType':_0x1e8d16||_0xb82f('0x9'),'OutputFormat':_0xb82f('0xa'),'VoiceId':_0x49c4ac};return pollyResult(_0x1d66c6,_0x1c6fb9,_0x11b384);}; \ 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 855fd7e..01086cf 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 _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 +var _0xaa38=['./lib/api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaa38,0xc0));var _0x8aa3=function(_0x596f83,_0x307d15){_0x596f83=_0x596f83-0x0;var _0x3bd2ca=_0xaa38[_0x596f83];return _0x3bd2ca;};'use strict';var asr=require(_0x8aa3('0x0'));module['exports']=function(_0x6a6d87,_0x4ab647,_0x481673,_0x5a8a03){return asr(_0x6a6d87,_0x4ab647,_0x481673);}; \ 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 33d14f9..ea5ee6c 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 _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 +var _0x1152=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','/v1/speech:recognize?key='];(function(_0x597d88,_0x4fb94c){var _0x553ae2=function(_0x45af54){while(--_0x45af54){_0x597d88['push'](_0x597d88['shift']());}};_0x553ae2(++_0x4fb94c);}(_0x1152,0x182));var _0x2115=function(_0x2567f0,_0x4fa60){_0x2567f0=_0x2567f0-0x0;var _0x14852a=_0x1152[_0x2567f0];return _0x14852a;};'use strict';var url=require(_0x2115('0x0'));var BPromise=require(_0x2115('0x1'));var fs=require('fs');var host=_0x2115('0x2');module[_0x2115('0x3')]=function(_0x20049f,_0x31ab3c,_0x31783d){return new BPromise(function(_0x3b8dfa,_0x4d0f31){var _0x1e8a26;if(typeof _0x20049f!=='string'||_0x20049f[_0x2115('0x4')]===0x0){return _0x4d0f31(_0x2115('0x5'));}if(typeof _0x31ab3c!=='string'||_0x31ab3c['length']===0x0){return _0x4d0f31('key\x20should\x20be\x20a\x20string');}if(typeof _0x31783d!=='undefined'&&(typeof _0x31783d!=='string'||_0x31783d[_0x2115('0x4')]===0x0)){return _0x4d0f31(_0x2115('0x6'));}try{_0x1e8a26=fs[_0x2115('0x7')](_0x20049f)['toString'](_0x2115('0x8'));}catch(_0x534958){return _0x4d0f31(_0x534958);}return _0x3b8dfa({'method':'POST','uri':host+_0x2115('0x9')+_0x31ab3c,'body':{'config':{'encoding':_0x2115('0xa'),'sampleRateHertz':_0x2115('0xb'),'languageCode':_0x31783d},'audio':{'content':_0x1e8a26}},'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 419d004..bec341d 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 _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 +var _0x8336=['./asr','exports'];(function(_0x1cd548,_0x2b0943){var _0x3da50=function(_0x3f790d){while(--_0x3f790d){_0x1cd548['push'](_0x1cd548['shift']());}};_0x3da50(++_0x2b0943);}(_0x8336,0x88));var _0x6833=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x8336[_0x2d61b2];return _0x12df89;};var asr=require(_0x6833('0x0'));module[_0x6833('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index d25e7ef..a13d18b 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 _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 +var _0xbce6=['CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','https','path','querystring','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','pipe','end','WHAT_EVER','get','data','wav','error\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','.mp3','from','writeFile','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','googleDialogflowV2','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction'];(function(_0x5ecf73,_0x11e61d){var _0x43c2b7=function(_0x2cdfac){while(--_0x2cdfac){_0x5ecf73['push'](_0x5ecf73['shift']());}};_0x43c2b7(++_0x11e61d);}(_0xbce6,0x8f));var _0x6bce=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0xbce6[_0x5b9252];return _0x1a4284;};'use strict';var apiai=require(_0x6bce('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x6bce('0x1'));var https=require(_0x6bce('0x2'));var md5=require('md5');var path=require(_0x6bce('0x3'));var querystring=require(_0x6bce('0x4'));var rp=require('request-promise');var rs=require(_0x6bce('0x5'));var sox=require(_0x6bce('0x6'));var tts=require(_0x6bce('0x7'));var urlParse=require('url')[_0x6bce('0x8')];var util=require(_0x6bce('0x9'));var aws=require(_0x6bce('0xa'));var google=require(_0x6bce('0xb'));var sestek=require(_0x6bce('0xc'));var tilde=require('./tilde');var logger=require(_0x6bce('0xd'))(_0x6bce('0xe'));var ISPEECH_API=_0x6bce('0xf');function downloadFile(_0xbed8f0,_0x4eec03){return new BPromise(function(_0x7bdbf6,_0x3d1cf3){var _0x45385d=urlParse(_0xbed8f0);var _0x53b8ed=_0x45385d[_0x6bce('0x10')]===_0x6bce('0x11')?https:http;var _0x4d805a={'host':_0x45385d[_0x6bce('0x12')],'path':_0x45385d[_0x6bce('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x53b8ed['get'](_0x4d805a,function(_0x37d189){if(_0x37d189[_0x6bce('0x13')]!==0xc8){logger[_0x6bce('0x14')](_0x6bce('0x15')+_0xbed8f0+_0x6bce('0x16')+_0x37d189[_0x6bce('0x13')]+'\x20('+_0x37d189[_0x6bce('0x17')]+')');_0x3d1cf3(new Error(_0x6bce('0x15')+_0xbed8f0+_0x6bce('0x16')+_0x37d189[_0x6bce('0x13')]+'\x20('+_0x37d189[_0x6bce('0x17')]+')'));return;}var _0x1e43d3=fs[_0x6bce('0x18')](_0x4eec03);_0x1e43d3['on']('finish',function(){logger[_0x6bce('0x19')](_0x6bce('0x1a'));_0x1e43d3[_0x6bce('0x1b')](_0x7bdbf6);});_0x1e43d3['on']('error',function(_0x479c33){fs['unlink'](_0x4eec03);logger['error']('download\x20error',_0x479c33);_0x3d1cf3(_0x479c33);});_0x37d189[_0x6bce('0x1c')](_0x1e43d3);})['on'](_0x6bce('0x14'),function(_0x504d36){logger['error'](_0x504d36);_0x3d1cf3(_0x504d36);})[_0x6bce('0x1d')]();});}function uploadFile(_0x43fe0a){return new BPromise(function(_0x2bfd45,_0x2540ea){var _0x53f23a=urlParse(_0x43fe0a);var _0x1551c4=_0x53f23a[_0x6bce('0x10')]===_0x6bce('0x11')?https:http;var _0x2d3a5d={'host':_0x53f23a[_0x6bce('0x12')],'path':_0x53f23a[_0x6bce('0x3')],'headers':{'user-agent':_0x6bce('0x1e')}};_0x1551c4[_0x6bce('0x1f')](_0x2d3a5d,function(_0x1651fe){if(_0x1651fe['statusCode']!==0xc8){_0x2540ea(new Error(_0x6bce('0x15')+_0x43fe0a+'\x20failed,\x20status\x20code\x20=\x20'+_0x1651fe['statusCode']+'\x20('+_0x1651fe[_0x6bce('0x17')]+')'));return;}var _0x3e5f9a='';_0x1651fe['on'](_0x6bce('0x20'),function(_0xdf40e2){_0x3e5f9a+=_0xdf40e2;});_0x1651fe['on'](_0x6bce('0x1d'),function(){_0x2bfd45(_0x3e5f9a);});})['on'](_0x6bce('0x14'),function(_0x491746){_0x2540ea(_0x491746);})[_0x6bce('0x1d')]();});}function convertFile(_0x2e3447,_0x1ebfc7){return new BPromise(function(_0x25c63d,_0xc0ce25){var _0x21298f=sox['transcode'](_0x2e3447,_0x1ebfc7,{'sampleRate':0x1f40,'format':_0x6bce('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21298f['on']('error',function(_0x159d17){logger[_0x6bce('0x14')](_0x6bce('0x22'),_0x159d17);_0xc0ce25(_0x159d17);});_0x21298f['on'](_0x6bce('0x1d'),function(){logger[_0x6bce('0x19')]('finish\x20to\x20convert');_0x25c63d();});_0x21298f[_0x6bce('0x23')]();});}function base64Decode(_0x15a2d9,_0x2562a7){var _0x58450e=path['resolve'](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));fs[_0x6bce('0x27')](_0x58450e,_0x15a2d9,_0x6bce('0x28'));return convertFile(_0x58450e,_0x2562a7)[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x58450e);fs[_0x6bce('0x2b')](_0x2562a7,'777');}catch(_0xe6e3c1){logger['error'](_0xe6e3c1);}return _0x2562a7[_0x6bce('0x2c')]('.')[0x0];});}function base64Encode(_0x10220d){var _0x3a39d3=fs[_0x6bce('0x2d')](_0x10220d);return new Buffer(_0x3a39d3)[_0x6bce('0x2e')]('base64');}exports[_0x6bce('0x2f')]=function(_0x2ae307,_0x4fc9c5,_0x44bc52,_0x415544,_0x449f95,_0x468e4c){var _0x5ce8d7,_0x37c731;var _0x4b22fd=_0x6bce('0x30');var _0x565607=_0x6bce('0x31')+_0x2ae307;var _0xe68339={};if(_0x4fc9c5===_0x6bce('0x32')){_0xe68339[_0x6bce('0x33')]={'ssml':_0x44bc52};}else{_0xe68339[_0x6bce('0x33')]={'text':_0x44bc52};};_0xe68339[_0x6bce('0x34')]={'languageCode':_0x415544,'ssmlGender':_0x449f95};_0xe68339[_0x6bce('0x35')]={'audioEncoding':_0x6bce('0x36'),'sampleRateHertz':0x1f40};var _0x312366={'url':_0x4b22fd+_0x6bce('0x37')+_0x565607,'method':'POST','json':!![],'body':_0xe68339};return rp(_0x312366)[_0x6bce('0x29')](function(_0x48effa){return new BPromise(function(_0x449545,_0x2a8698){_0x5ce8d7=path[_0x6bce('0x38')](__dirname,'tmp',rs[_0x6bce('0x25')](0x4)+_0x6bce('0x39'));var _0x43a857=Buffer[_0x6bce('0x3a')](_0x48effa['audioContent'],_0x6bce('0x28'));return fs[_0x6bce('0x3b')](_0x5ce8d7,_0x43a857,function(_0x4b7521){_0x2a8698(_0x4b7521);},function(_0x2fbccd){fs['chmodSync'](_0x5ce8d7,_0x6bce('0x3c'));_0x449545(_0x2fbccd);});});})['then'](function(_0x4a6c84){_0x37c731=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));return convertFile(_0x5ce8d7,_0x37c731);})['then'](function(){try{fs[_0x6bce('0x2a')](_0x5ce8d7);fs[_0x6bce('0x2b')](_0x37c731,'777');}catch(_0x247170){logger[_0x6bce('0x14')](_0x247170);}logger['info'](_0x6bce('0x3d'),_0x37c731[_0x6bce('0x2c')]('.')[0x0]);return _0x37c731[_0x6bce('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x2b4771,_0x10f3cd){var _0x5b4694=_0x6bce('0x3e');var _0x19d2e0,_0x14530b;var _0xc724ab;var _0x5f36e0={'encoding':_0x6bce('0x3f'),'method':_0x6bce('0x40'),'timeout':0x2710,'url':_0x5b4694,'headers':{'Content-Type':_0x6bce('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x6bce('0x42')]([[['jQ1olc',JSON['stringify']([_0x2b4771,_0x10f3cd||'en',![],'null']),null,'generic']]]))};return rp(_0x5f36e0)[_0x6bce('0x29')](function(_0x19b0bc){try{_0xc724ab=eval(_0x19b0bc[_0x6bce('0x43')](0x5))[0x0][0x2];}catch(_0x594a34){throw new Error(_0x6bce('0x44')+_0x19b0bc[_0x6bce('0x20')]);}if(!_0xc724ab){if(_0x2b4771[_0x6bce('0x45')]>0xc8){throw new Error(_0x6bce('0x46'));}else{throw new Error(_0x6bce('0x47')+_0x10f3cd+_0x6bce('0x48'));}}try{_0xc724ab=eval(_0xc724ab)[0x0];}catch(_0x37870d){throw new Error(_0x6bce('0x44')+res[_0x6bce('0x20')]);}const _0x51f515=_0xc724ab;_0x19d2e0=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x39'));fs[_0x6bce('0x27')](_0x19d2e0,_0xc724ab,{'encoding':'base64'});_0x14530b=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));return convertFile(_0x19d2e0,_0x14530b);})[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x19d2e0);fs['chmodSync'](_0x14530b,'777');}catch(_0x50659c){logger[_0x6bce('0x14')](_0x50659c);}logger[_0x6bce('0x19')](_0x6bce('0x49'),_0x14530b[_0x6bce('0x2c')]('.')[0x0]);return _0x14530b[_0x6bce('0x2c')]('.')[0x0];});};exports[_0x6bce('0x4a')]=function(_0x244940,_0x2ed81f,_0x10bbe2){return google[_0x6bce('0x4b')](_0x244940,_0x2ed81f,_0x10bbe2)[_0x6bce('0x29')](function(_0x591e2b){logger[_0x6bce('0x19')](_0x591e2b[_0x6bce('0x4c')]);return rp(_0x591e2b);})[_0x6bce('0x29')](function(_0x3984e0){var _0x119a06='';var _0x2dcc1a=0x0;try{fs[_0x6bce('0x2a')](_0x244940);}catch(_0x36d3f4){logger['error'](_0x36d3f4);}if(_0x3984e0&&_0x3984e0[_0x6bce('0x4d')]){_0x119a06=_0x3984e0[_0x6bce('0x4d')][_0x6bce('0x4e')](function(_0x25dc04){return _0x25dc04&&_0x25dc04[_0x6bce('0x4f')][0x0]&&_0x25dc04[_0x6bce('0x4f')][0x0]['transcript']?_0x25dc04[_0x6bce('0x4f')][0x0][_0x6bce('0x50')]:'';})[_0x6bce('0x51')]('\x0a');_0x2dcc1a=_0x3984e0[_0x6bce('0x4d')]['map'](function(_0xb478e2){return _0xb478e2&&_0xb478e2[_0x6bce('0x4f')][0x0]&&_0xb478e2[_0x6bce('0x4f')][0x0][_0x6bce('0x52')]?_0xb478e2[_0x6bce('0x4f')][0x0][_0x6bce('0x52')]:0x0;})[_0x6bce('0x51')]('\x0a');}logger[_0x6bce('0x19')](_0x6bce('0x53'),_0x119a06);logger[_0x6bce('0x19')](_0x6bce('0x54'),_0x2dcc1a);return{'transcript':_0x119a06,'confidence':_0x2dcc1a};})[_0x6bce('0x55')](function(_0x2df9c2){logger[_0x6bce('0x14')]('[%s]\x20%s:%s',_0x2df9c2[_0x6bce('0x13')],_0x2df9c2[_0x6bce('0x56')],_0x2df9c2[_0x6bce('0x57')]);});};exports[_0x6bce('0x58')]=function(_0x412c99,_0x4d6ecd,_0x43925b,_0x165ab6){var _0x5138d0=apiai(_0x4d6ecd,{'language':_0x165ab6||'en'});return _0x5138d0[_0x6bce('0x59')](_0x43925b,{'sessionId':md5(_0x412c99)})[_0x6bce('0x29')](function(_0x3c2c90){logger[_0x6bce('0x19')](JSON[_0x6bce('0x42')](_0x3c2c90));return{'source':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x5b')],'resolvedQuery':_0x3c2c90['result']['resolvedQuery'],'action':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x5c')],'actionIncomplete':_0x3c2c90['result'][_0x6bce('0x5d')],'speech':_0x3c2c90['result'][_0x6bce('0x5e')][_0x6bce('0x5f')],'score':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x60')],'statusCode':_0x3c2c90[_0x6bce('0x61')][_0x6bce('0x62')],'endConversation':_0x3c2c90[_0x6bce('0x5a')]['metadata'][_0x6bce('0x63')]||![],'isFallbackIntent':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x64')]['isFallbackIntent']};});};exports[_0x6bce('0x65')]=function(_0x160de8,_0x150ba4,_0x13f21a,_0x1eeeca,_0x297a40,_0x5df8e5){var _0x257753=_0x1eeeca['replace'](/\\n/g,'\x0a');var _0x3e94c2={'credentials':{'private_key':_0x257753,'client_email':_0x13f21a}};var _0x384082=new dialogflow['SessionsClient'](_0x3e94c2);var _0x26e18b=_0x384082[_0x6bce('0x66')](_0x150ba4,md5(_0x160de8));var _0x3dfb00={'session':_0x26e18b,'queryInput':{'text':{'text':_0x297a40,'languageCode':_0x5df8e5}}};return _0x384082[_0x6bce('0x67')](_0x3dfb00)[_0x6bce('0x29')](function(_0xdfb838){if(_0xdfb838&&_0xdfb838[_0x6bce('0x45')]){logger['info'](_0x6bce('0x68'),JSON[_0x6bce('0x42')](_0xdfb838));var _0xc7502b=_0xdfb838[0x0];if(_0xc7502b){var _0x569551={'action':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x5c')],'allRequiredParamsPresent':_0xc7502b[_0x6bce('0x69')]['allRequiredParamsPresent'],'endConversation':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6a')]&&_0xc7502b[_0x6bce('0x69')]['diagnosticInfo']['fields']?_0xc7502b['queryResult']['diagnosticInfo'][_0x6bce('0x6b')][_0x6bce('0x6c')][_0x6bce('0x6d')]:![],'fulfillmentText':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6e')],'intentName':_0xc7502b['queryResult'][_0x6bce('0x6f')][_0x6bce('0x56')],'intentDisplayName':_0xc7502b['queryResult'][_0x6bce('0x6f')][_0x6bce('0x70')],'isFallbackIntent':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6f')][_0x6bce('0x71')],'languageCode':_0xc7502b[_0x6bce('0x69')]['languageCode'],'queryText':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x72')],'responseId':_0xc7502b[_0x6bce('0x73')],'score':_0xc7502b[_0x6bce('0x69')]['intentDetectionConfidence'],'speech':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6e')],'providerResponse':JSON[_0x6bce('0x42')](_0xdfb838)};return _0x569551;}}});};exports[_0x6bce('0x74')]=function(_0x317c83,_0x3f29cf,_0xad2fc7,_0x233fd8){return tilde[_0x6bce('0x4b')](_0x317c83,_0x3f29cf,_0xad2fc7,_0x233fd8)[_0x6bce('0x29')](function(_0xdb4f81){try{fs['unlink'](_0x317c83);}catch(_0x1035c2){logger[_0x6bce('0x14')](_0x1035c2);}logger['info'](_0x6bce('0x75'),_0xdb4f81[_0x6bce('0x50')]);logger[_0x6bce('0x19')](_0x6bce('0x76'),_0xdb4f81[_0x6bce('0x52')]);return _0xdb4f81;});};exports[_0x6bce('0x77')]=function(_0x19826d,_0x581a66,_0x4a673c,_0x2e8e47,_0xb5f91a,_0x1d72ce){var _0x31b38c=path[_0x6bce('0x38')](__dirname,'tmp',rs[_0x6bce('0x25')](0x4)+'.mp3');var _0x57a201;return aws[_0x6bce('0x78')](_0x19826d,_0x581a66,_0x4a673c,_0x2e8e47,_0xb5f91a,_0x1d72ce,_0x31b38c)[_0x6bce('0x29')](function(){_0x57a201=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));return convertFile(_0x31b38c,_0x57a201);})[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x31b38c);fs['chmodSync'](_0x57a201,_0x6bce('0x3c'));}catch(_0x22c649){logger[_0x6bce('0x14')](_0x22c649);}return _0x57a201[_0x6bce('0x2c')]('.')[0x0];});};exports[_0x6bce('0x79')]=function(_0x4f3b76,_0x509f33,_0x2b8e3a,_0x1246d7,_0x51a4bf,_0x2cb467){return aws[_0x6bce('0x7a')](_0x4f3b76,_0x509f33,_0x2b8e3a,_0x1246d7,_0x51a4bf,_0x2cb467)['then'](function(_0x1f04e){logger[_0x6bce('0x19')](JSON[_0x6bce('0x42')](_0x1f04e));return _0x1f04e;});};exports['ispeechTTS']=function(_0x2ec1fd,_0x3f4e75,_0x3a673d,_0x349edb){var _0x40cb09=util[_0x6bce('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2ec1fd,encodeURIComponent(_0x3f4e75),_0x3a673d,_0x349edb);var _0x3a1208=path[_0x6bce('0x38')](__dirname,'tmp',rs[_0x6bce('0x25')](0x4)+_0x6bce('0x39'));var _0x75e6ec;return downloadFile(_0x40cb09,_0x3a1208)[_0x6bce('0x29')](function(){_0x75e6ec=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+'.wav');return convertFile(_0x3a1208,_0x75e6ec);})[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x3a1208);fs[_0x6bce('0x2b')](_0x75e6ec,'777');}catch(_0xacf30d){logger[_0x6bce('0x14')](_0xacf30d);}return _0x75e6ec[_0x6bce('0x2c')]('.')[0x0];});};exports[_0x6bce('0x7c')]=function(_0x24ca21,_0x2e1fd6,_0x1fabf8,_0x3c4d03){var _0x544781=util[_0x6bce('0x7b')](_0x6bce('0x7d'),ISPEECH_API,_0x2e1fd6,_0x1fabf8,base64Encode(_0x24ca21),_0x3c4d03?util[_0x6bce('0x7b')](_0x6bce('0x7e'),encodeURIComponent(_0x3c4d03)):_0x6bce('0x7f'));return uploadFile(_0x544781)['then'](function(_0x7d7c96){return querystring[_0x6bce('0x8')](_0x7d7c96);});};exports[_0x6bce('0x80')]=function(_0x23a67e,_0x573d93){return sestek[_0x6bce('0x81')](_0x23a67e,_0x573d93)[_0x6bce('0x29')](function(_0x4a608f){logger[_0x6bce('0x19')](JSON[_0x6bce('0x42')](_0x4a608f));var _0x586b39={'speech':_0x4a608f[_0x6bce('0x82')],'action':_0x4a608f[_0x6bce('0x83')]?_0x4a608f[_0x6bce('0x83')][_0x6bce('0x84')]:undefined,'actiondata':_0x4a608f[_0x6bce('0x83')]?_0x4a608f[_0x6bce('0x83')][_0x6bce('0x85')]:undefined};if(_0x4a608f[_0x6bce('0x83')]&&_0x4a608f[_0x6bce('0x83')][_0x6bce('0x86')]){return base64Decode(_0x4a608f[_0x6bce('0x83')][_0x6bce('0x86')][_0x6bce('0x87')],path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs['generate'](0x4)+_0x6bce('0x26')))[_0x6bce('0x29')](function(_0x28edef){_0x586b39[_0x6bce('0x88')]=_0x28edef;return _0x586b39;});}return _0x586b39;});};exports[_0x6bce('0x89')]=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 8f34e03..81ed73d 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0x63e2=['./nda'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x63e2,0xe5));var _0x263e=function(_0x1e8e81,_0x240af8){_0x1e8e81=_0x1e8e81-0x0;var _0x583bcd=_0x63e2[_0x1e8e81];return _0x583bcd;};var nda=require(_0x263e('0x0'));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 b2da084..86edfd7 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 _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 +var _0xbefe=['AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','ndagenerate_audio','body','channelData'];(function(_0x145eb2,_0x396cab){var _0x447d25=function(_0x432b6b){while(--_0x432b6b){_0x145eb2['push'](_0x145eb2['shift']());}};_0x447d25(++_0x396cab);}(_0xbefe,0x168));var _0xebef=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0xbefe[_0x22cd0c];return _0x439eba;};'use strict';var rp=require('request-promise');var url=require(_0xebef('0x0'));var logger=require('../../../../../config/logger')(_0xebef('0x1'));module[_0xebef('0x2')]=function(_0x2f814c,_0x2cd3bf){var _0x1da4cd={'method':_0xebef('0x3'),'uri':url[_0xebef('0x4')](_0x2cd3bf[_0xebef('0x5')],'/token'),'form':{'grant_type':_0xebef('0x6'),'username':_0x2cd3bf[_0xebef('0x7')],'password':_0x2cd3bf[_0xebef('0x6')]},'json':!![]};return rp(_0x1da4cd)['then'](function(_0x4286bf){var _0x2fbd2c={'method':'POST','uri':url['resolve'](_0x2cd3bf[_0xebef('0x8')],_0xebef('0x9')),'body':{'type':_0x2cd3bf[_0xebef('0xa')]||_0xebef('0xb'),'channelId':_0xebef('0xc'),'conversation':{'id':_0x2f814c[_0xebef('0xd')]},'from':{'id':_0x2f814c[_0xebef('0xe')],'name':_0x2f814c[_0xebef('0xf')]},'recipient':{'id':_0x2f814c['dnid'],'name':_0x2f814c[_0xebef('0x10')]},'text':_0x2cd3bf[_0xebef('0x11')],'channelData':{}},'headers':{'Authorization':_0xebef('0x12')+_0x4286bf[_0xebef('0x13')]},'json':!![]};if(_0x2cd3bf[_0xebef('0x14')]){_0x2fbd2c['body']['channelData']['ProjectName']=_0x2cd3bf['project'];}if(_0x2cd3bf[_0xebef('0x15')]=='1'){_0x2fbd2c[_0xebef('0x16')][_0xebef('0x17')][_0xebef('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xebef('0x19')};}if(_0x2cd3bf[_0xebef('0x1a')]){_0x2fbd2c['body'][_0xebef('0x17')][_0xebef('0x1b')]=_0x2cd3bf[_0xebef('0x1a')];if(_0x2cd3bf[_0xebef('0x1c')]){_0x2fbd2c[_0xebef('0x16')][_0xebef('0x17')][_0xebef('0x1d')]=_0x2cd3bf[_0xebef('0x1c')];}}logger[_0xebef('0x1e')](JSON[_0xebef('0x1f')](_0x2fbd2c));return rp(_0x2fbd2c);});}; \ 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 423fe33..6b90fd2 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 _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 +var _0xd4f1=['./lib/api','exports'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xd4f1,0x1e6));var _0x1d4f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4f1[_0x14add3];return _0x4a174f;};'use strict';var asr=require(_0x1d4f('0x0'));module[_0x1d4f('0x1')]=function(_0x536ab2,_0x52bd3c,_0x569221,_0x3345e9){return asr(_0x536ab2,_0x52bd3c,_0x569221,_0x3345e9);}; \ 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 2afcf31..066091a 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 _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 +var _0xc82d=['send','stringify','createReadStream','close','error','Tilde\x20ASR\x20send\x20error','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','bluebird','lodash','moment','crypto','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xc82d,0x113));var _0xdc82=function(_0x2089fe,_0x1a95c6){_0x2089fe=_0x2089fe-0x0;var _0x5eb20b=_0xc82d[_0x2089fe];return _0x5eb20b;};'use strict';var BPromise=require(_0xdc82('0x0'));var _=require(_0xdc82('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xdc82('0x2'));var crypto=require(_0xdc82('0x3'));var logger=require('../../../../../../config/logger')('agi');module[_0xdc82('0x4')]=function(_0x341cb5,_0x201567,_0xa8bafc,_0x13f5d0){return new BPromise(function(_0x3a41e9,_0x4d8f5d){logger['info'](_0xdc82('0x5'),_0x13f5d0||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x556b2c=new WebSocket(_0x13f5d0||_0xdc82('0x6'),{'perMessageDeflate':![]});var _0x57eff1='';var _0x750052='0';var _0x471416='1';var _0x1b5d90=_0xdc82('0x7');function _0x2af452(_0x4962f1){var _0x12264d=crypto['createHash']('sha1');_0x12264d[_0xdc82('0x8')](_0x4962f1);return _0x12264d['digest'](_0xdc82('0x9'));}function _0x4cee01(){try{logger[_0xdc82('0xa')](_0xdc82('0xb'));var _0xc68350=moment()[_0xdc82('0xc')]();var _0x36c083=_0x2af452(_0xc68350+_0x201567+_0xa8bafc);_0x556b2c[_0xdc82('0xd')](JSON[_0xdc82('0xe')]({'appID':_0x201567,'timestamp':_0xc68350,'appKey':_0x36c083}));var _0xc8968d=fs[_0xdc82('0xf')](_0x341cb5);_0xc8968d['on']('data',function(_0x535685){_0x556b2c[_0xdc82('0xd')](_0x535685);});_0xc8968d['on'](_0xdc82('0x10'),function(){_0x556b2c[_0xdc82('0xd')]('EOS');});}catch(_0x5ecb56){logger[_0xdc82('0x11')](_0xdc82('0x12'),JSON[_0xdc82('0xe')](_0x5ecb56));_0x556b2c['terminate']();}}function _0x312cf8(_0x46be2b){try{if(_0x46be2b){var _0x2b2811=JSON[_0xdc82('0x13')](_0x46be2b);switch(_0x2b2811[_0xdc82('0x14')]){case 0x0:if(_0x2b2811['result']){if(_0x2b2811['result'][_0xdc82('0x15')]){logger['info'](_0xdc82('0x16'),JSON[_0xdc82('0xe')](_0x2b2811[_0xdc82('0x17')][_0xdc82('0x18')]));_0x57eff1=_0x2b2811[_0xdc82('0x17')]['hypotheses'][0x0][_0xdc82('0x19')];_0x750052=_0x2b2811[_0xdc82('0x17')]['hypotheses'][0x0]['likelihood'];_0x471416='0';_0x1b5d90=_0xdc82('0x1a');_0x556b2c['terminate']();}}break;case 0x1:logger[_0xdc82('0xa')](_0xdc82('0x7'));_0x471416='1';_0x1b5d90=_0xdc82('0x7');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x471416='2';_0x1b5d90=_0xdc82('0x1b');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x471416='9';_0x1b5d90=_0xdc82('0x1c');break;case 0xa:logger['info'](_0xdc82('0x1d'));_0x471416='10';_0x1b5d90='Authentication\x20failed.';break;case 0xb:logger[_0xdc82('0xa')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x471416='11';_0x1b5d90=_0xdc82('0x1e');}}}catch(_0x42a7eb){logger['error'](_0xdc82('0x1f'),JSON[_0xdc82('0xe')](_0x42a7eb));_0x556b2c[_0xdc82('0x20')]();}}function _0x204649(){logger[_0xdc82('0xa')](_0xdc82('0x21'));_0x3a41e9({'transcript':_0x57eff1,'confidence':_0x750052,'status':_0x471416,'status_message':_0x1b5d90});}function _0x283895(_0x1adbb0){logger[_0xdc82('0x11')](_0xdc82('0x22'));if(!_['isNil'](_0x1adbb0)){logger['error'](_['isObject'](_0x1adbb0)?JSON[_0xdc82('0xe')](_0x1adbb0):_0x1adbb0);}}_0x556b2c['on'](_0xdc82('0x23'),_0x4cee01);_0x556b2c['on']('message',_0x312cf8);_0x556b2c['on'](_0xdc82('0x10'),_0x204649);_0x556b2c['on']('error',_0x283895);});}; \ 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 c070118..750c8ad 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 _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 +var _0xa813=['./asr','exports'];(function(_0x5f5164,_0xa128be){var _0x3ec41d=function(_0x3839fe){while(--_0x3839fe){_0x5f5164['push'](_0x5f5164['shift']());}};_0x3ec41d(++_0xa128be);}(_0xa813,0x17a));var _0x3a81=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xa813[_0x173441];return _0x2423a8;};var asr=require(_0x3a81('0x0'));module[_0x3a81('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 346da93..03efe9e 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_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 +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x598419,_0x521a50){var _0x19c03c=function(_0x55b8ad){while(--_0x55b8ad){_0x598419['push'](_0x598419['shift']());}};_0x19c03c(++_0x521a50);}(_0x34e8,0x12c));var _0x834e=function(_0x8a07df,_0x85f200){_0x8a07df=_0x8a07df-0x0;var _0x2be95b=_0x34e8[_0x8a07df];return _0x2be95b;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b53a043..134b425 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 _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 +var _0x0a9a=['callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','result','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()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','list_id','delay','add','minutes','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','isString','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','recordFile','intKey','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','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','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','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','mailRpc','prototype','rpc','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','scheduledAt'];(function(_0x3e7b5a,_0x4c06fe){var _0x4880aa=function(_0x2410ac){while(--_0x2410ac){_0x3e7b5a['push'](_0x3e7b5a['shift']());}};_0x4880aa(++_0x4c06fe);}(_0x0a9a,0x183));var _0xa0a9=function(_0x534bea,_0x1dc598){_0x534bea=_0x534bea-0x0;var _0xb6276=_0x0a9a[_0x534bea];return _0xb6276;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xa0a9('0x0'));var sh=require('shelljs');var odbc=require(_0xa0a9('0x1'))();var rs=require(_0xa0a9('0x2'));var moment=require(_0xa0a9('0x3'));var Mustache=require(_0xa0a9('0x4'));var rp=require('request-promise');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var scripts=require(_0xa0a9('0x7'));var FILES_PATH=_0xa0a9('0x8');var recursiveMapAttributes=[_0xa0a9('0x9'),_0xa0a9('0xa')];var verticesWithRetry=['menu',_0xa0a9('0xb'),'getsecretdigits'];var AGIVertices=function(_0x10aa8a,_0x221072,_0x12ce8a){this[_0xa0a9('0xc')]=_0x10aa8a;this['rpc']=_0x221072;this[_0xa0a9('0xd')]=_0x12ce8a;};AGIVertices[_0xa0a9('0xe')]['getVariable']=function(_0x5909cf,_0x13dc4a){this[_0xa0a9('0xf')]['getVariableById'](_0x5909cf)[_0xa0a9('0x10')](function(_0x5cc496){_0x13dc4a(null,_0x5cc496?_0x5cc496[_0xa0a9('0x11')]:![]);})['catch'](function(_0xb87a94){_0x13dc4a(_0xb87a94);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x12')]=function(_0x35e7cd,_0x13833c){this['rpc'][_0xa0a9('0x13')](_0x35e7cd)[_0xa0a9('0x10')](function(_0x31e716){_0x13833c(null,_0x31e716?_0x31e716[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0x1a7b8a){_0x13833c(_0x1a7b8a);});};AGIVertices['prototype'][_0xa0a9('0x15')]=function(_0x48c315,_0x4a57dd){this[_0xa0a9('0xf')][_0xa0a9('0x16')](_0x48c315)[_0xa0a9('0x10')](function(_0x16c3e3){_0x4a57dd(null,_0x16c3e3?_0x16c3e3['name']:![]);})[_0xa0a9('0x14')](function(_0x126401){_0x4a57dd(_0x126401);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x17')]=function(_0x292240,_0x3c1b3a){this['rpc'][_0xa0a9('0x18')](_0x292240)[_0xa0a9('0x10')](function(_0x4a8e80){_0x3c1b3a(null,_0x4a8e80?_0x4a8e80['dsn']:![]);})[_0xa0a9('0x14')](function(_0x1f6955){_0x3c1b3a(_0x1f6955);});};AGIVertices[_0xa0a9('0xe')]['getUser']=function(_0x307d7e,_0x4e6f4c){this[_0xa0a9('0xf')]['getUserById'](_0x307d7e)[_0xa0a9('0x10')](function(_0x504786){_0x4e6f4c(null,_0x504786?_0x504786[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0x4938da){_0x4e6f4c(_0x4938da);});};AGIVertices[_0xa0a9('0xe')]['getTrunk']=function(_0x20b318,_0x1f78e1){this[_0xa0a9('0xf')][_0xa0a9('0x19')](_0x20b318)['then'](function(_0x7c1502){_0x1f78e1(null,_0x7c1502?_0x7c1502[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0x3f4bea){_0x1f78e1(_0x3f4bea);});};AGIVertices['prototype'][_0xa0a9('0x1a')]=function(_0x38e454,_0x2eae30){var _0x5c446e=this;this['rpc'][_0xa0a9('0x1b')](_0x38e454)[_0xa0a9('0x10')](function(_0x10bbfd){_0x2eae30(null,_0x10bbfd?_0x5c446e[_0xa0a9('0x1c')](_0x10bbfd[_0xa0a9('0x1d')]):![]);})[_0xa0a9('0x14')](function(_0x2386c9){_0x2eae30(_0x2386c9);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1e')]=function(_0x42024c,_0x41e994){this['rpc'][_0xa0a9('0x1f')](_0x42024c)[_0xa0a9('0x10')](function(_0x4fc94a){_0x41e994(null,_0x4fc94a?_0x4fc94a:![]);})[_0xa0a9('0x14')](function(_0x122f56){_0x41e994(_0x122f56);});};AGIVertices['prototype']['sendMailMessage']=function(_0x45374e,_0x5291e3,_0x5a1095){this[_0xa0a9('0xd')][_0xa0a9('0x20')](_0x45374e,_0x5291e3)[_0xa0a9('0x10')](function(){_0x5a1095(null);})[_0xa0a9('0x14')](function(_0x37f2d){_0x5a1095(_0x37f2d);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x21')]=function(_0x4bbcc2,_0x366ba9){this[_0xa0a9('0xf')]['getIntervalById'](_0x4bbcc2)[_0xa0a9('0x10')](function(_0x2f98f6){if(_0x2f98f6){if(_0x2f98f6[_0xa0a9('0x22')]){_0x366ba9(null,[_0x2f98f6['interval']]);}else{_0x366ba9(null,_['map'](_0x2f98f6[_0xa0a9('0x23')],_0xa0a9('0x24')));}}else{_0x366ba9(null,![]);}})[_0xa0a9('0x14')](function(_0x42fd7a){_0x366ba9(_0x42fd7a);});};AGIVertices['prototype'][_0xa0a9('0x1c')]=function(_0x19a122){return util[_0xa0a9('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x19a122);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x26')]=function(_0x4e121e,_0x53dfd1,_0x3ae735){odbc[_0xa0a9('0x27')](_0x4e121e,function(_0x41c056){if(_0x41c056){logger[_0xa0a9('0x28')](_0xa0a9('0x29'),_0x41c056);_0x3ae735(_0x41c056);}else{logger[_0xa0a9('0x2a')](_0xa0a9('0x2b'));odbc[_0xa0a9('0x2c')](_0x53dfd1,function(_0x20e23d,_0x2ea301){if(_0x20e23d){logger[_0xa0a9('0x2a')](_0xa0a9('0x2d'),_0x53dfd1);_0x3ae735(_0x20e23d);}else{logger[_0xa0a9('0x2a')](_0xa0a9('0x2e'),_0x53dfd1);odbc[_0xa0a9('0x2f')](function(_0x1b1aff){if(_0x1b1aff){logger[_0xa0a9('0x28')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1b1aff);}_0x3ae735(null,_0x2ea301);});}});}});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x30')]=function(_0x3d3769,_0x5aadc9){this[_0xa0a9('0xf')][_0xa0a9('0x31')](_0x3d3769)[_0xa0a9('0x10')](function(_0xbbd377){_0x5aadc9(null,_0xbbd377?_0xbbd377:![]);})['catch'](function(_0x26ffb8){_0x5aadc9(_0x26ffb8);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x32')]=function(_0x17c40b,_0x38be3f){this['rpc'][_0xa0a9('0x32')](_0x17c40b)[_0xa0a9('0x10')](function(_0x39c02a){_0x38be3f(null,_0x39c02a);})[_0xa0a9('0x14')](function(_0x1c0fec){_0x38be3f(_0x1c0fec);});};AGIVertices['prototype'][_0xa0a9('0x33')]=function(_0x11c130,_0x27358c,_0x1a0c79){this[_0xa0a9('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'node':_0x11c130['label'],'application':_0x11c130['agicommand'],'data':_0x27358c||null,'project_name':this[_0xa0a9('0xc')][_0xa0a9('0x35')],'callerid':this[_0xa0a9('0xc')][_0xa0a9('0x36')]})['then'](function(_0x464499){if(_0x1a0c79){_0x1a0c79(null,_0x464499);}})[_0xa0a9('0x14')](function(_0x1dc4ed){if(_0x1a0c79){_0x1a0c79(_0x1dc4ed);}});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x37')]=function(_0x1304e0,_0x39fa5b,_0x9690d6,_0xbdce0e){this[_0xa0a9('0xf')][_0xa0a9('0x37')]({'uniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'callerid':this[_0xa0a9('0xc')][_0xa0a9('0x36')],'calleridname':this[_0xa0a9('0xc')][_0xa0a9('0x38')],'context':this['channel'][_0xa0a9('0x39')],'extension':this['channel'][_0xa0a9('0x3a')],'priority':this[_0xa0a9('0xc')][_0xa0a9('0x3b')],'accountcode':this[_0xa0a9('0xc')][_0xa0a9('0x3c')],'dnid':this[_0xa0a9('0xc')][_0xa0a9('0x3d')],'projectName':this[_0xa0a9('0xc')][_0xa0a9('0x35')],'saveName':_0x39fa5b,'filename':_0x1304e0['file']||_0x39fa5b,'savePath':_0x9690d6})[_0xa0a9('0x10')](function(_0x46a9ca){_0xbdce0e(null,_0x46a9ca);})[_0xa0a9('0x14')](function(_0x54cfa8){_0xbdce0e(_0x54cfa8);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x3e')]=function(_0x2c9c29,_0x4a35dd,_0xc1a16b,_0x7e1058,_0x2d0b1c){this[_0xa0a9('0xf')]['createSquareMessage']({'uniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'body':_0x2c9c29,'direction':_0x4a35dd,'providerName':_0xc1a16b,'providerResponse':_0x7e1058})[_0xa0a9('0x10')](function(_0x2f97e2){if(_0x2d0b1c){_0x2d0b1c(null,_0x2f97e2);}})[_0xa0a9('0x14')](function(_0x41128b){if(_0x2d0b1c){_0x2d0b1c(_0x41128b);}});};AGIVertices[_0xa0a9('0xe')]['createCmContact']=function(_0x63cbda,_0x429c65){this['rpc'][_0xa0a9('0x3f')]({'firstName':_[_0xa0a9('0x40')](_0x63cbda[_0xa0a9('0x11')])||_['isNil'](_0x63cbda['name'])?_0xa0a9('0x41')+Math[_0xa0a9('0x42')]():_0x63cbda[_0xa0a9('0x11')],'lastName':_[_0xa0a9('0x40')](_0x63cbda['lastName'])||_['isNil'](_0x63cbda[_0xa0a9('0x43')])?null:_0x63cbda[_0xa0a9('0x43')],'phone':_0x63cbda['phone'],'ListId':_0x63cbda['list_id'],'scheduledat':_0x63cbda[_0xa0a9('0x44')],'callbackUniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'tags':_0xa0a9('0x45'),'description':_0xa0a9('0x46')+_0x63cbda[_0xa0a9('0x44')][_0xa0a9('0x47')](),'priority':_0x63cbda[_0xa0a9('0x48')]})[_0xa0a9('0x10')](function(_0x23f1b1){_0x429c65(null,_0x23f1b1);})[_0xa0a9('0x14')](function(_0x52d34c){_0x429c65(_0x52d34c);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x49')]=function(_0xb0a05c,_0x481184){this[_0xa0a9('0xf')][_0xa0a9('0x4a')](_0xb0a05c)[_0xa0a9('0x10')](function(_0x4a1912){_0x481184(null,_0x4a1912?_0x4a1912[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0xe2d6f2){_0x481184(_0xe2d6f2);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x4b')]=function(_0x47107f,_0x12f97d,_0x577c1f){var _0x2b447f={'role':_0xa0a9('0x4c')};_0x2b447f[_0x47107f]=this[_0xa0a9('0xc')][_0xa0a9('0x36')];this[_0xa0a9('0xf')][_0xa0a9('0x4b')](_0x2b447f,_0x12f97d,this[_0xa0a9('0xc')]['uniqueid'])['then'](function(_0x4a2307){_0x577c1f(null,_[_0xa0a9('0x4d')](_0x4a2307)?![]:!![]);})['catch'](function(_0x331a0a){logger['error'](_0x331a0a);_0x577c1f(null,![]);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x4e')]=function(_0x5d06e0,_0x2f7ab4){var _0x31d3c0={'role':_0xa0a9('0x4c')};_0x31d3c0[_0x5d06e0]=this[_0xa0a9('0xc')][_0xa0a9('0x36')];this['rpc']['agentUnpause'](_0x31d3c0)[_0xa0a9('0x10')](function(_0x50249c){_0x2f7ab4(null,_[_0xa0a9('0x4d')](_0x50249c)?![]:!![]);})[_0xa0a9('0x14')](function(_0x3c526a){logger['error'](_0x3c526a);_0x2f7ab4(null,![]);});};AGIVertices[_0xa0a9('0xe')]['agentLogout']=function(_0x89b5bb,_0x194087){var _0x16873a={'role':'agent'};_0x16873a[_0x89b5bb]=this[_0xa0a9('0xc')]['callerid'];this[_0xa0a9('0xf')]['agentLogout'](_0x16873a)[_0xa0a9('0x10')](function(_0x4829f9){_0x194087(null,_[_0xa0a9('0x4d')](_0x4829f9)?![]:!![]);})[_0xa0a9('0x14')](function(_0x258aa4){logger[_0xa0a9('0x28')](_0x258aa4);_0x194087(null,![]);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x4f')]=function(_0x4cc06d,_0x2f5ea0){var _0x273a8c={'role':_0xa0a9('0x4c')};_0x273a8c[_0x4cc06d]=this['channel'][_0xa0a9('0x36')];var _0x184b0e=_0x4cc06d!=_0xa0a9('0x50')?util[_0xa0a9('0x25')](_0xa0a9('0x51'),'LOCAL',this[_0xa0a9('0xc')][_0xa0a9('0x36')]):undefined;this[_0xa0a9('0xf')][_0xa0a9('0x4f')](_0x273a8c,_0x184b0e)[_0xa0a9('0x10')](function(_0x3514d8){_0x2f5ea0(null,_[_0xa0a9('0x4d')](_0x3514d8)?![]:!![]);})[_0xa0a9('0x14')](function(_0x3a6b21){logger[_0xa0a9('0x28')](_0x3a6b21);_0x2f5ea0(null,![]);});};AGIVertices['prototype'][_0xa0a9('0x52')]=function(_0x1bae56,_0x183d4b){sh[_0xa0a9('0x53')](_[_0xa0a9('0x54')](_0x1bae56),function(_0x278cad,_0x1f47c){var _0x2bf2c2=_0x1f47c[_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'');_0x183d4b(null,_0x2bf2c2);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x56')]=function(_0x2915a4,_0x27cdcc){scripts[_0xa0a9('0x56')](_0x2915a4[_0xa0a9('0x57')],_0x2915a4[_0xa0a9('0x58')]||'text',_0x2915a4[_0xa0a9('0x59')],_0x2915a4['languageCode']||_0xa0a9('0x5a'),_0x2915a4['ssmlGender']||_0xa0a9('0x5b'),_0x2915a4[_0xa0a9('0x5c')]||_0xa0a9('0x5d'))[_0xa0a9('0x10')](function(_0x4755ce){_0x27cdcc(null,_0x4755ce);})[_0xa0a9('0x14')](function(_0x2aec78){_0x27cdcc(_0x2aec78);});};AGIVertices['prototype'][_0xa0a9('0x5e')]=function(_0x2faa44,_0x44a73b){scripts[_0xa0a9('0x5e')](_0x2faa44[_0xa0a9('0x59')],_0x2faa44[_0xa0a9('0x5f')]||'en',0x1)[_0xa0a9('0x10')](function(_0x23b7ca){_0x44a73b(null,_0x23b7ca);})[_0xa0a9('0x14')](function(_0x4da18d){_0x44a73b(_0x4da18d);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x60')]=function(_0x36dbf4,_0x2a0a40){var _0x465c12={'uri':_0x36dbf4[_0xa0a9('0x61')],'method':_0x36dbf4[_0xa0a9('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x36dbf4[_0xa0a9('0x63')])==='number'&&parseInt(_0x36dbf4[_0xa0a9('0x63')])>=0x1?parseInt(_0x36dbf4[_0xa0a9('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xa0a9('0x64'),_0xa0a9('0x65')],_0x465c12[_0xa0a9('0x62')][_0xa0a9('0x66')]())){try{_0x465c12[_0xa0a9('0x67')]=_0x36dbf4[_0xa0a9('0xa')]?JSON[_0xa0a9('0x68')](_0x36dbf4[_0xa0a9('0xa')]):{};}catch(_0x8a5178){logger[_0xa0a9('0x28')](_0xa0a9('0x69'),_0x8a5178);}}try{_0x465c12[_0xa0a9('0x6a')]=_0x36dbf4[_0xa0a9('0x9')]?JSON['parse'](_0x36dbf4['rawHeaders']):{};}catch(_0x3d809d){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d809d);}if(_0x36dbf4[_0xa0a9('0x6b')]){try{var _0x2b408a=require(_0x36dbf4['computedVariables'])[_0xa0a9('0x6c')](this,_0x465c12);_0x465c12[_0xa0a9('0x6d')]=Mustache[_0xa0a9('0x6e')](_0x36dbf4[_0xa0a9('0x61')],_0x2b408a,{},['$$','$$']);if(_0x465c12[_0xa0a9('0x6a')]){_0x465c12[_0xa0a9('0x6a')]=JSON[_0xa0a9('0x68')](Mustache['render'](JSON[_0xa0a9('0x6f')](_0x465c12['headers']),_0x2b408a,{},['$$','$$']));}if(_0x465c12['body']){_0x465c12['body']=JSON[_0xa0a9('0x68')](Mustache[_0xa0a9('0x6e')](JSON['stringify'](_0x465c12[_0xa0a9('0x67')]),_0x2b408a,{},['$$','$$']));}}catch(_0x435f68){logger[_0xa0a9('0x28')](_0xa0a9('0x70'),_0x435f68);}}rp(_0x465c12)[_0xa0a9('0x10')](function(_0x26adae){var _0x1bd849={'statusCode':_0x26adae['statusCode']||0xc8,'statusMessage':_0x26adae[_0xa0a9('0x71')]||'OK','headers':_0x26adae['headers']||{},'body':_0x26adae[_0xa0a9('0x67')]||{}};_0x2a0a40(null,_0x1bd849);})[_0xa0a9('0x14')](function(_0x1a3fe4){var _0x132b50={'statusCode':_0x1a3fe4['statusCode']||0x1f4,'statusMessage':_0x1a3fe4['message']||_0xa0a9('0x72'),'headers':_0x1a3fe4[_0xa0a9('0x73')][_0xa0a9('0x6a')]||{},'body':_0x1a3fe4[_0xa0a9('0x73')][_0xa0a9('0x67')]||{}};_0x2a0a40(null,_0x132b50);});};AGIVertices[_0xa0a9('0xe')]['googleDialogflow']=function(_0x51bfd8,_0x44d006){scripts[_0xa0a9('0x74')](this[_0xa0a9('0xc')][_0xa0a9('0x34')],_0x51bfd8[_0xa0a9('0x75')],_0x51bfd8[_0xa0a9('0x59')],_0x51bfd8[_0xa0a9('0x76')]||'en')['then'](function(_0xfd9faf){_0x44d006(null,_0xfd9faf);})[_0xa0a9('0x14')](function(_0x503b24){_0x44d006(_0x503b24);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x77')]=function(_0x591449,_0x32575f){scripts[_0xa0a9('0x77')](this['channel']['uniqueid'],_0x591449['dialogflowV2_project_id'],_0x591449[_0xa0a9('0x78')],_0x591449['private_key'],_0x591449[_0xa0a9('0x59')],_0x591449[_0xa0a9('0x79')]||'en')[_0xa0a9('0x10')](function(_0x58e78e){_0x32575f(null,_0x58e78e);})['catch'](function(_0x51aa68){_0x32575f(_0x51aa68);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x7a')]=function(_0x4f0b5f,_0x53197f){scripts['sestekNDA'](this[_0xa0a9('0xc')],_0x4f0b5f)[_0xa0a9('0x10')](function(_0x295145){_0x53197f(null,_0x295145);})[_0xa0a9('0x14')](function(_0x50fae3){_0x53197f(_0x50fae3);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x7b')]=function(_0x5c943d,_0x455b37){scripts[_0xa0a9('0x7b')](_0x5c943d[_0xa0a9('0x75')],_0x5c943d['text'],_0x5c943d[_0xa0a9('0x7c')]||_0xa0a9('0x5a'),_0x5c943d[_0xa0a9('0x7d')])['then'](function(_0x10ff5a){_0x455b37(null,_0x10ff5a);})[_0xa0a9('0x14')](function(_0x5e793d){_0x455b37(_0x5e793d);});};AGIVertices[_0xa0a9('0xe')]['ispeechASR']=function(_0x565979,_0x930af7,_0x4ff01d){scripts['ispeechASR'](_0x930af7,_0x565979[_0xa0a9('0x75')],_0x565979[_0xa0a9('0x7e')]||'en-US',this[_0xa0a9('0x7f')](_0x565979['model'])?_0x565979[_0xa0a9('0x80')]:undefined)[_0xa0a9('0x10')](function(_0x5dc92b){_0x4ff01d(null,_0x5dc92b);})[_0xa0a9('0x14')](function(_0x130428){_0x4ff01d(_0x130428);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x81')]=function(_0x182ef3,_0x4ae8e2){scripts[_0xa0a9('0x81')](_0x182ef3[_0xa0a9('0x82')],_0x182ef3[_0xa0a9('0x83')],_0x182ef3[_0xa0a9('0x84')],_0x182ef3[_0xa0a9('0x85')]||'Amy',_0x182ef3[_0xa0a9('0x59')],_0x182ef3[_0xa0a9('0x86')]||_0xa0a9('0x59'))[_0xa0a9('0x10')](function(_0x48c9f5){_0x4ae8e2(null,_0x48c9f5);})[_0xa0a9('0x14')](function(_0x23a2bf){_0x4ae8e2(_0x23a2bf);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x87')]=function(_0x411c1a,_0x357bfe){scripts[_0xa0a9('0x87')](this['channel']['uniqueid'],_0x411c1a[_0xa0a9('0x82')],_0x411c1a[_0xa0a9('0x83')],_0x411c1a[_0xa0a9('0x88')],_0x411c1a[_0xa0a9('0x59')],_0x411c1a[_0xa0a9('0x89')])['then'](function(_0x4d3705){_0x357bfe(null,_0x4d3705);})[_0xa0a9('0x14')](function(_0x3ca8ed){_0x357bfe(_0x3ca8ed);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x8a')]=function(_0x3788d3,_0x19f07a,_0x3a742f){scripts[_0xa0a9('0x8a')](_0x19f07a,_0x3788d3[_0xa0a9('0x75')],_0x3788d3[_0xa0a9('0x8b')]||_0xa0a9('0x5a'))[_0xa0a9('0x10')](function(_0x27d117){_0x3a742f(null,_0x27d117);})[_0xa0a9('0x14')](function(_0x308196){_0x3a742f(_0x308196);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x8c')]=function(_0x160473,_0x3db961,_0x36a501){scripts[_0xa0a9('0x8c')](_0x3db961,_0x160473[_0xa0a9('0x8d')],_0x160473[_0xa0a9('0x8e')],_0x160473['uri'])['then'](function(_0x5cf91e){_0x36a501(null,_0x5cf91e);})[_0xa0a9('0x14')](function(_0x21e364){_0x36a501(_0x21e364);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x8f')]=function(_0x3ed1c3){var _0x283324=_['includes'](verticesWithRetry,_0x3ed1c3[_0xa0a9('0x90')])?_0x3ed1c3:_[_0xa0a9('0x91')](_0x3ed1c3);for(var _0x3b8d17 in _0x283324){if(_0x283324[_0xa0a9('0x92')](_0x3b8d17)){if(_0x283324[_0x3b8d17]&&_['isString'](_0x283324[_0x3b8d17])){if(_[_0xa0a9('0x93')](recursiveMapAttributes,_0x3b8d17)){_0x283324[_0x3b8d17]=this[_0xa0a9('0x94')](_0x283324[_0x3b8d17]);}else{_0x283324[_0x3b8d17]=this[_0xa0a9('0x95')](_0x283324[_0x3b8d17]);}}}}return _0x283324;};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x96')]=function(_0x6f0c1a){for(var _0x63e1f8 in _0x6f0c1a){if(_0x6f0c1a['hasOwnProperty'](_0x63e1f8)){if(_['isPlainObject'](_0x6f0c1a[_0x63e1f8])){this['recursiveNodeIndex'](_0x6f0c1a[_0x63e1f8]);}else if(_[_0xa0a9('0x97')](_0x6f0c1a[_0x63e1f8])){for(var _0x21bd11=0x0;_0x21bd11<_0x6f0c1a[_0x63e1f8][_0xa0a9('0x98')];_0x21bd11++){this[_0xa0a9('0x96')](_0x6f0c1a[_0x63e1f8][_0x21bd11]);}}else if(_['isString'](_0x6f0c1a[_0x63e1f8])){_0x6f0c1a[_0x63e1f8]=this['replaceAllVariables'](_0x6f0c1a[_0x63e1f8]);}}}};AGIVertices[_0xa0a9('0xe')]['saveRestApiResult']=function(_0x9d50c5,_0x5bdebb){for(var _0xb5dbbe in _0x9d50c5){if(_0x9d50c5[_0xa0a9('0x92')](_0xb5dbbe)){if(_['isPlainObject'](_0x9d50c5[_0xb5dbbe])){if(!_[_0xa0a9('0x40')](_0x9d50c5[_0xb5dbbe])){this[_0xa0a9('0x99')](_0x9d50c5[_0xb5dbbe],util['format'](_0xa0a9('0x9a'),_0x5bdebb,_0xb5dbbe));}}else if(_[_0xa0a9('0x97')](_0x9d50c5[_0xb5dbbe])){for(var _0xe93099=0x0;_0xe93099<_0x9d50c5[_0xb5dbbe][_0xa0a9('0x98')];_0xe93099++){this[_0xa0a9('0x99')](_0x9d50c5[_0xb5dbbe][_0xe93099],util[_0xa0a9('0x25')](_0xa0a9('0x9a'),_0x5bdebb,_0xb5dbbe+'['+_0xe93099+']'));}}else{if(!_['isNil'](_0x9d50c5[_0xb5dbbe])){this['channel'][_0xa0a9('0x9b')](util[_0xa0a9('0x25')]('%s.%s',_0x5bdebb,_0xb5dbbe),_0x9d50c5[_0xb5dbbe]);}}}}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x94')]=function(_0x13e6c5){try{var _0x2a1b0f=JSON[_0xa0a9('0x68')](_0x13e6c5);this[_0xa0a9('0x96')](_0x2a1b0f);return JSON['stringify'](_0x2a1b0f);}catch(_0x1b3c8e){return this['replaceAllVariables'](_0x13e6c5);}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x95')]=function(_0x54cc2e){var _0x8b0cdd=_0x54cc2e[_0xa0a9('0x9c')]('{');for(var _0x2f9e19=0x1;_0x2f9e19<_0x8b0cdd[_0xa0a9('0x98')];_0x2f9e19+=0x1){var _0x2c1e79=_0x8b0cdd[_0x2f9e19][_0xa0a9('0x9c')]('}');if(_0x2c1e79['length']>0x1){_0x54cc2e=_0x54cc2e[_0xa0a9('0x9d')]('{'+_0x2c1e79[0x0]+'}',this[_0xa0a9('0xc')][_0xa0a9('0x9e')](_0x2c1e79[0x0])[_0xa0a9('0x9f')]||_0x2c1e79[0x0]);}}if(_0x8b0cdd['length']===0x1){return _0x54cc2e[_0xa0a9('0x47')]();}return this['replaceAllVariables'](_0x54cc2e);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xa0')]=function(_0x44a188,_0x41dc60){var _0x49470a=this[_0xa0a9('0xc')][_0xa0a9('0x9e')](_0x44a188);if(_0x49470a['result']===-0x1){return _0x49470a;}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xa1'),_0x41dc60,_0x49470a['extra']));return this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0x41dc60,_0x49470a[_0xa0a9('0x9f')]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x7f')]=function(_0x1d0c93){return _0x1d0c93&&_0x1d0c93!=='0'&&_0x1d0c93!=='-1'&&_0x1d0c93!=='';};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xa2')]=function(_0x3de7b5){this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x3de7b5,'-');_0x3de7b5[_0xa0a9('0xa3')]=_0x3de7b5[_0xa0a9('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa0a9('0xe')]['mrcpsynth']=function(_0x5b5986){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xa4'),_0x5b5986[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x5b5986[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20text\x20configured');}var _0x3c9f79='\x22'+_0x5b5986[_0xa0a9('0x59')]+'\x22';if(this[_0xa0a9('0x7f')](_0x5b5986[_0xa0a9('0x73')])){_0x3c9f79+=','+_0x5b5986[_0xa0a9('0x73')];}var _0x3c1e9e=this[_0xa0a9('0xc')][_0xa0a9('0x53')]('MRCPSynth',_0x3c9f79);if(_0x3c1e9e[_0xa0a9('0xa7')]===-0x1){return _0x3c1e9e;}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xa8'),_0x3c9f79));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xa9')]=function(_0x4a836e){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xaa'),_0x4a836e[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x4a836e[_0xa0a9('0xab')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20grammar\x20configured');}var _0x1dbada=_0x4a836e[_0xa0a9('0xab')];if(this[_0xa0a9('0x7f')](_0x4a836e[_0xa0a9('0x73')])){_0x1dbada+=','+_0x4a836e[_0xa0a9('0x73')];}var _0x2f2539=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0xac'),_0x1dbada);if(_0x2f2539[_0xa0a9('0xa7')]===-0x1){return _0x2f2539;}var _0x91a180=this[_0xa0a9('0xa0')](_0xa0a9('0xad'),_0xa0a9('0xae'));if(_0x91a180[_0xa0a9('0xa7')]===-0x1){return _0x91a180;}var _0x436650=this[_0xa0a9('0xa0')](_0xa0a9('0xaf'),_0xa0a9('0xb0'));if(_0x436650[_0xa0a9('0xa7')]===-0x1){return _0x436650;}var _0x391446=this[_0xa0a9('0xa0')](_0xa0a9('0xb1'),_0xa0a9('0xb2'));if(_0x391446[_0xa0a9('0xa7')]===-0x1){return _0x391446;}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xb3'),_0x1dbada));};AGIVertices['prototype'][_0xa0a9('0x6')]=function(_0x22841a){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x22841a['label']));return this[_0xa0a9('0xc')][_0xa0a9('0x6')]([_0x22841a[_0xa0a9('0xb4')],_0x22841a['args']]);};AGIVertices[_0xa0a9('0xe')]['answer']=function(_0x3ff32e){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xb5'),_0x3ff32e[_0xa0a9('0xa5')]));if(this[_0xa0a9('0x7f')](_0x3ff32e[_0xa0a9('0x63')])){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0xb6'),_0x3ff32e[_0xa0a9('0x63')]));var _0x27b2b9=this[_0xa0a9('0xc')][_0xa0a9('0xb7')](_0x3ff32e[_0xa0a9('0x63')]);if(_0x27b2b9['result']===-0x1){return _0x27b2b9;}}return this[_0xa0a9('0xc')][_0xa0a9('0xb8')]();};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x45')]=function(_0x14038e){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x14038e[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x14038e[_0xa0a9('0xb9')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x14038e,'no\x20list\x20selected');}_0x14038e[_0xa0a9('0x44')]=moment();if(this['isConfigured'](_0x14038e[_0xa0a9('0xba')])){_0x14038e[_0xa0a9('0x44')]=moment()[_0xa0a9('0xbb')](_0x14038e[_0xa0a9('0xba')],_0xa0a9('0xbc'));}if(!this['isConfigured'](_0x14038e[_0xa0a9('0x48')])){_0x14038e['callback_priority']=0x2;}this[_0xa0a9('0x3f')][_0xa0a9('0x6c')](this,_0x14038e);return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x14038e[_0xa0a9('0xbd')],_0x14038e['list_id'],_0x14038e[_0xa0a9('0x44')]));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xbe')]=function(_0x54f636){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0xbf'),_0x54f636['label']));var _0x58180d=this[_0xa0a9('0xc')]['exec'](_0x54f636['application'],_0x54f636['options']);if(_0x58180d[_0xa0a9('0xa7')]===-0x1){return _0x58180d;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('Executed\x20command\x20%s\x20%s',_0x54f636[_0xa0a9('0xc0')],_0x54f636['options']));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xc1')]=function(_0x3e6f25){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xc2'),_0x3e6f25[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3e6f25[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}var _0x42628b='\x22'+_0x3e6f25[_0xa0a9('0x59')]+'\x22';if(this[_0xa0a9('0x7f')](_0x3e6f25['options'])){_0x42628b+=','+_0x3e6f25[_0xa0a9('0x73')];}var _0x2d43db=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xc4'),_0x42628b);if(_0x2d43db[_0xa0a9('0xa7')]===-0x1){return _0x2d43db;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0xa8'),_0x42628b));};AGIVertices['prototype'][_0xa0a9('0xc5')]=function(_0x2d27bb){logger['info'](util['format'](_0xa0a9('0xc6'),_0x2d27bb[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x2d27bb[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}var _0x693cb8='\x22'+_0x2d27bb[_0xa0a9('0x59')]+'\x22';if(this[_0xa0a9('0x7f')](_0x2d27bb[_0xa0a9('0x73')])){_0x693cb8+=','+_0x2d27bb['options'];}var _0x5ba663=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xc4'),_0x693cb8);if(_0x5ba663[_0xa0a9('0xa7')]===-0x1){return _0x5ba663;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xa8'),_0x693cb8));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xc7')]=function(_0x3c40e7){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3c40e7[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3c40e7[_0xa0a9('0xab')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc8'));}var _0x189a6d=_0x3c40e7[_0xa0a9('0xab')];if(this[_0xa0a9('0x7f')](_0x3c40e7[_0xa0a9('0x73')])){_0x189a6d+=','+_0x3c40e7[_0xa0a9('0x73')];}var _0x79cac0=this[_0xa0a9('0xc')][_0xa0a9('0x53')]('MRCPRecog',_0x189a6d);if(_0x79cac0[_0xa0a9('0xa7')]===-0x1){return _0x79cac0;}var _0x14a805=this[_0xa0a9('0xa0')]('RECOG_CONFIDENCE()',_0xa0a9('0xc9'));if(_0x14a805[_0xa0a9('0xa7')]===-0x1){return _0x14a805;}var _0x12b2fd=this[_0xa0a9('0xa0')]('RECOG_INPUT()',_0xa0a9('0xca'));if(_0x12b2fd[_0xa0a9('0xa7')]===-0x1){return _0x12b2fd;}var _0x397629=this[_0xa0a9('0xa0')]('RECOG_INSTANCE()',_0xa0a9('0xcb'));if(_0x397629[_0xa0a9('0xa7')]===-0x1){return _0x397629;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xb3'),_0x189a6d));};AGIVertices[_0xa0a9('0xe')]['sestekasr']=function(_0x132475){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x132475['label']));if(!this[_0xa0a9('0x7f')](_0x132475[_0xa0a9('0xab')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc8'));}var _0x519cf5=_0x132475[_0xa0a9('0xab')];if(this[_0xa0a9('0x7f')](_0x132475[_0xa0a9('0x73')])){_0x519cf5+=','+_0x132475['options'];}var _0x53b4b9=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0xac'),_0x519cf5);if(_0x53b4b9[_0xa0a9('0xa7')]===-0x1){return _0x53b4b9;}var _0x1543ee=this['getAndSetVariable'](_0xa0a9('0xad'),'SESTEK_ASR_CONFIDENCE');if(_0x1543ee[_0xa0a9('0xa7')]===-0x1){return _0x1543ee;}var _0xd3816f=this['getAndSetVariable'](_0xa0a9('0xaf'),_0xa0a9('0xcc'));if(_0xd3816f['result']===-0x1){return _0xd3816f;}var _0xcd4e5b=this[_0xa0a9('0xa0')]('RECOG_INSTANCE()',_0xa0a9('0xcd'));if(_0xcd4e5b[_0xa0a9('0xa7')]===-0x1){return _0xcd4e5b;}return this['channel']['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xb3'),_0x519cf5));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xce')]=function(_0x3ee61d){logger[_0xa0a9('0x2a')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3ee61d[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3ee61d[_0xa0a9('0xcf')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd0'));}var _0x568c78=this[_0xa0a9('0x17')][_0xa0a9('0x6c')](this,_0x3ee61d[_0xa0a9('0xcf')]);if(!_0x568c78){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd1'));}if(!this['isConfigured'](_0x3ee61d[_0xa0a9('0x2c')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd2'));}var _0x50987c=_0x3ee61d['query'][_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xd3'),_0x50987c));var _0x6e8b08=this[_0xa0a9('0x26')][_0xa0a9('0x6c')](this,_0x568c78,_0x50987c);this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x3ee61d,_0x50987c);if(!this['isConfigured'](_0x3ee61d[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xd5'));}var _0x4761d5=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x3ee61d[_0xa0a9('0xd4')]);if(!_0x4761d5){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd6'));}var _0x207e6f=this;_0x6e8b08['forEach'](function(_0x3f82e8,_0x5553ab){Object['keys'](_0x3f82e8)[_0xa0a9('0xd7')](function(_0x2776dc){_0x207e6f['channel']['setVariable'](util[_0xa0a9('0x25')](_0xa0a9('0xd8'),_0x4761d5,_0x5553ab,_0x2776dc),_0x3f82e8[_0x2776dc]);});});this[_0xa0a9('0xc')]['setVariable'](util[_0xa0a9('0x25')](_0xa0a9('0xd9'),_0x4761d5),_0x6e8b08[_0xa0a9('0x98')]);return this['channel'][_0xa0a9('0xa6')](util['format'](_0xa0a9('0xda'),_0x4761d5));};AGIVertices[_0xa0a9('0xe')]['dial']=function(_0x4c0f65){logger[_0xa0a9('0xdb')](util['format'](_0xa0a9('0xdc'),_0x4c0f65['label']));if(!this[_0xa0a9('0x7f')](_0x4c0f65[_0xa0a9('0xdd')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x4c0f65,'no\x20user\x20selected');}var _0x25c27b=this[_0xa0a9('0xde')][_0xa0a9('0x6c')](this,_0x4c0f65['sip_id']);if(!_0x25c27b){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x4c0f65,_0xa0a9('0xdf'));}var _0x1d3efd=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xe0'),[util[_0xa0a9('0x25')](_0xa0a9('0xe1'),_0x25c27b),_0x4c0f65[_0xa0a9('0x63')],_0x4c0f65[_0xa0a9('0xe2')],_0x4c0f65['url']]);if(_0x1d3efd['result']===-0x1){return _0x1d3efd;}return this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xe3'),'DIAL'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xe4')]=function(_0x4d1058){logger[_0xa0a9('0x2a')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4d1058[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x4d1058['key'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20key\x20configured');}if(!this[_0xa0a9('0x7f')](_0x4d1058[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xe5')]=!![];this['createSquareDetailsReport'](_0x4d1058);this[_0xa0a9('0x3e')](_0x4d1058[_0xa0a9('0x59')],'in','','');this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('Trying\x20Dialogflow:\x20%s',_0x4d1058['text']));var _0x425c9d=this[_0xa0a9('0x74')][_0xa0a9('0x6c')](this,_0x4d1058);if(_0x425c9d){for(var _0x142963 in _0x425c9d){if(_0x425c9d['hasOwnProperty'](_0x142963)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util['format'](_0xa0a9('0xe6'),_0x142963[_0xa0a9('0x66')]()),_0x425c9d[_0x142963]);}}this[_0xa0a9('0x3e')](_0x425c9d[_0xa0a9('0xe7')],_0xa0a9('0xe8'),_0xa0a9('0xe4'),'');return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xe9'),_0x425c9d[_0xa0a9('0xe7')]));}return this[_0xa0a9('0xc')]['error'](_0x4d1058,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x48cd82){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0xea'),_0x48cd82[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x48cd82[_0xa0a9('0xeb')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20project_id\x20configured');}if(!this[_0xa0a9('0x7f')](_0x48cd82[_0xa0a9('0x78')])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0xec'));}if(!this['isConfigured'](_0x48cd82['private_key'])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xed'));}if(!this['isConfigured'](_0x48cd82['dialogflowV2_language'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xee'));}if(!this[_0xa0a9('0x7f')](_0x48cd82['text'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xe5')]=!![];this[_0xa0a9('0x33')](_0x48cd82);this[_0xa0a9('0x3e')](_0x48cd82[_0xa0a9('0x59')],'in','','');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xef'),_0x48cd82['text']));var _0x2f6e21=this[_0xa0a9('0x77')][_0xa0a9('0x6c')](this,_0x48cd82);if(_0x2f6e21){for(var _0x197d0f in _0x2f6e21){if(_0x2f6e21[_0xa0a9('0x92')](_0x197d0f)){if(_0x197d0f!==_0xa0a9('0xf0')){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util['format']('DIALOGFLOW_%s',_0x197d0f[_0xa0a9('0x66')]()),_0x2f6e21[_0x197d0f]);}}}this['createSquareMessage'](_0x2f6e21[_0xa0a9('0xe7')],_0xa0a9('0xe8'),_0xa0a9('0xf1'),_0x2f6e21[_0xa0a9('0xf0')]);return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xf2'),_0x2f6e21[_0xa0a9('0xe7')]));}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x48cd82,_0xa0a9('0xf3'));};AGIVertices['prototype'][_0xa0a9('0xf4')]=function(_0x3e4442){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xf5'),_0x3e4442[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3e4442['ndauth_url'])){return this['channel']['noop'](_0xa0a9('0xf6'));}if(!this[_0xa0a9('0x7f')](_0x3e4442['username'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xf7'));}if(!this[_0xa0a9('0x7f')](_0x3e4442[_0xa0a9('0xf8')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xf9'));}if(!this['isConfigured'](_0x3e4442[_0xa0a9('0xfa')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x3e4442);this[_0xa0a9('0x3e')](_0x3e4442[_0xa0a9('0x59')],'in','','');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format']('Trying\x20SestekNDA:\x20%s',_0x3e4442[_0xa0a9('0x59')]));var _0x334e81=this[_0xa0a9('0x7a')][_0xa0a9('0x6c')](this,_0x3e4442);if(_0x334e81){for(var _0x38463d in _0x334e81){if(_0x334e81[_0xa0a9('0x92')](_0x38463d)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util[_0xa0a9('0x25')](_0xa0a9('0xfb'),_0x38463d[_0xa0a9('0x66')]()),_0x334e81[_0x38463d]);}}this[_0xa0a9('0x3e')](_0x334e81[_0xa0a9('0xe7')],'out','sesteknda','');if(_0x334e81[_0xa0a9('0xfc')]){this[_0xa0a9('0xc')]['noop'](util['format'](_0xa0a9('0xfd'),_0x334e81[_0xa0a9('0xfc')]));var _0x3c9b49=this[_0xa0a9('0xc')][_0xa0a9('0xfe')](_0x334e81[_0xa0a9('0xfc')]);try{fs[_0xa0a9('0xff')](_0x334e81[_0xa0a9('0xfc')]+_0xa0a9('0x100'));}catch(_0x307abf){logger[_0xa0a9('0x28')](_0x307abf);}return _0x3c9b49;}else{return this['channel']['noop'](util['format'](_0xa0a9('0x101'),_0x334e81['speech']));}}return this['channel'][_0xa0a9('0x28')](_0x3e4442,_0xa0a9('0x102'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x103')]=function(_0xef2bd6){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x104'),_0xef2bd6[_0xa0a9('0xa5')]));return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x103'));};AGIVertices['prototype'][_0xa0a9('0x105')]=function(_0xe0bda5){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe0bda5[_0xa0a9('0xa5')]));var _0x25b313='';if(_0xe0bda5['trunk_id']){if(!this[_0xa0a9('0x7f')](_0xe0bda5['trunk_id'])){return this['channel'][_0xa0a9('0x28')](_0xe0bda5,_0xa0a9('0x106'));}else{var _0x59c2a1=parseInt(_0xe0bda5[_0xa0a9('0x107')],0xa);if(isNaN(_0x59c2a1)){_0x25b313=_0xe0bda5[_0xa0a9('0x107')];}else{_0x25b313=this['getTrunk'][_0xa0a9('0x6c')](this,_0xe0bda5[_0xa0a9('0x107')]);if(!_0x25b313){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0xe0bda5,_0xa0a9('0x108'));}}}}else if(_0xe0bda5[_0xa0a9('0x109')]){_0x25b313=_0xe0bda5[_0xa0a9('0x109')];}else{return this[_0xa0a9('0xc')]['error'](_0xe0bda5,_0xa0a9('0x106'));}var _0x34c880=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xe0'),[util[_0xa0a9('0x25')](_0xa0a9('0x10a'),_0x25b313,_0xe0bda5[_0xa0a9('0xbd')]),_0xe0bda5[_0xa0a9('0x63')],_0xe0bda5[_0xa0a9('0xe2')],_0xe0bda5[_0xa0a9('0x61')]]);if(_0x34c880[_0xa0a9('0xa7')]===-0x1){return _0x34c880;}return this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('Executed\x20command\x20%s',_0xa0a9('0xe0')));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x10b')]=function(_0x481ae1){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x10c'),_0x481ae1['label']));return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x10b'));};AGIVertices['prototype'][_0xa0a9('0xb')]=function(_0x170e40){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x170e40[_0xa0a9('0xa5')]));if(_0x170e40[_0xa0a9('0xa3')]===0x0){return this[_0xa0a9('0xa2')](_0x170e40);}_0x170e40[_0xa0a9('0xa3')]-=0x1;if(!this[_0xa0a9('0x7f')](_0x170e40[_0xa0a9('0x10d')])){return this['channel']['error'](_0x170e40,'no\x20file\x20audio\x20selected');}var _0x26ea60=this[_0xa0a9('0x1a')][_0xa0a9('0x6c')](this,_0x170e40[_0xa0a9('0x10d')]);if(!_0x26ea60){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x170e40,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x170e40[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5403b1=this[_0xa0a9('0xc')]['getData'](_0x26ea60,_0x170e40['response'],_0x170e40[_0xa0a9('0x10e')]);var _0x22b3a3=_0x5403b1['result']?_0x5403b1[_0xa0a9('0xa7')][_0xa0a9('0x47')]():'';logger[_0xa0a9('0x2a')]('test',JSON[_0xa0a9('0x6f')](_0x5403b1));if(_0x5403b1[_0xa0a9('0xa7')]===-0x1){this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x170e40,_0x22b3a3);return _0x5403b1;}else if(_0x5403b1['extra']===_0xa0a9('0x63')){_0x5403b1[_0xa0a9('0xa7')]=_0x22b3a3[_0xa0a9('0x98')]>=parseInt(_0x170e40[_0xa0a9('0x10f')])?'x':'i';}else{_0x5403b1[_0xa0a9('0xa7')]=_0x22b3a3[_0xa0a9('0x98')]>=parseInt(_0x170e40[_0xa0a9('0x10f')])&&_0x22b3a3['length']<=parseInt(_0x170e40['maxdigit'])?'x':'i';}var _0x51c79b=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x170e40[_0xa0a9('0xd4')]);if(!_0x51c79b){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x170e40,'no\x20variable\x20found');}this['channel'][_0xa0a9('0x9b')](_0x51c79b,_0x22b3a3);if(this[_0xa0a9('0x7f')](_0x170e40[_0xa0a9('0x110')])){var _0x57f984=parseInt(_0x170e40[_0xa0a9('0x110')],0xa);var _0x31b519=rs[_0xa0a9('0x111')]({'charset':'*','length':_0x57f984});var _0x3fa016=_0x22b3a3[_0xa0a9('0x98')];if(_0x3fa016>0x0){if(_0x3fa016>_0x57f984){this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x170e40,_0x170e40[_0xa0a9('0x112')]===_0xa0a9('0x113')?_0x31b519+_0x22b3a3[_0xa0a9('0x114')](_0x57f984):_0x22b3a3['substr'](0x0,_0x3fa016-_0x57f984)+_0x31b519);}else{this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x170e40,rs[_0xa0a9('0x111')]({'charset':'*','length':_0x3fa016}));}}else{this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x170e40,'');}}else{this[_0xa0a9('0x33')]['sync'](this,_0x170e40,_0x22b3a3);}return _0x5403b1;};AGIVertices['prototype'][_0xa0a9('0x115')]=function(_0x33cab2){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x33cab2[_0xa0a9('0xa5')]));return this[_0xa0a9('0xb')](_0x33cab2);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x116')]=function(_0x8c4d7b){logger['info'](util['format'](_0xa0a9('0x117'),_0x8c4d7b['label']));this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x8c4d7b,_0x8c4d7b['goalname']);return this['channel'][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x118'),_0x8c4d7b[_0xa0a9('0x119')]));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x11a')]=function(_0xcb18a8){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x11b'),_0xcb18a8['label']));if(!this[_0xa0a9('0x7f')](_0xcb18a8['aws_access_key_id'])||!this[_0xa0a9('0x7f')](_0xcb18a8[_0xa0a9('0x83')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xa0a9('0x7f')](_0xcb18a8['text'])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x11c'),_0xcb18a8[_0xa0a9('0x59')]));var _0x53707c=this[_0xa0a9('0x81')][_0xa0a9('0x6c')](this,_0xcb18a8);if(_0x53707c){this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x11d'),_0x53707c));var _0x527505=this[_0xa0a9('0xc')]['streamFile'](_0x53707c);try{fs[_0xa0a9('0xff')](_0x53707c+_0xa0a9('0x100'));}catch(_0x315f78){logger[_0xa0a9('0x28')](_0x315f78);}return _0x527505;}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0xcb18a8,_0xa0a9('0x11e'));};AGIVertices['prototype'][_0xa0a9('0x11f')]=function(_0x460151){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x120'),_0x460151[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x460151[_0xa0a9('0x82')])||!this[_0xa0a9('0x7f')](_0x460151[_0xa0a9('0x83')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0x121'));}if(!this[_0xa0a9('0x7f')](_0x460151['aws_bot_name'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x122'));}if(!this[_0xa0a9('0x7f')](_0x460151[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this['channel'][_0xa0a9('0xe5')]=!![];this[_0xa0a9('0x33')](_0x460151);this[_0xa0a9('0x3e')](_0x460151[_0xa0a9('0x59')],'in','','');this['channel'][_0xa0a9('0xa6')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x460151[_0xa0a9('0x59')]));var _0x4c5e90=this[_0xa0a9('0x87')]['sync'](this,_0x460151);if(_0x4c5e90){for(var _0x39c99b in _0x4c5e90){if(_0x4c5e90[_0xa0a9('0x92')](_0x39c99b)&&_[_0xa0a9('0x123')](_0x4c5e90[_0x39c99b])){this[_0xa0a9('0xc')]['setVariable'](util[_0xa0a9('0x25')]('AWS_LEX_%s',_0x39c99b[_0xa0a9('0x66')]()),_0x4c5e90[_0x39c99b]);}}if(_[_0xa0a9('0x4d')](_0x4c5e90['message'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x124'));}else{this['createSquareMessage'](_0x4c5e90[_0xa0a9('0x125')],_0xa0a9('0xe8'),'amazonlex','');return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x4c5e90['message']));}}return this['channel'][_0xa0a9('0x28')](_0x460151,_0xa0a9('0x126'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x127')]=function(_0x533fbd){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x128'),_0x533fbd[_0xa0a9('0xa5')],_0x533fbd[_0xa0a9('0x63')]));if(!this[_0xa0a9('0x7f')](_0x533fbd[_0xa0a9('0x75')])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x129'));}var _0x14ca83=_0xa0a9('0x12a');var _0x12beca=util[_0xa0a9('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xa0a9('0x111')](0x4));var _0x3c4a85=util[_0xa0a9('0x25')](_0xa0a9('0x9a'),_0x12beca,_0x14ca83);var _0x41b80b=!![];if(_0x533fbd[_0xa0a9('0x12b')]==='NOBEEP'){_0x41b80b=![];}var _0x46ef3a=this[_0xa0a9('0xc')][_0xa0a9('0x12c')](_0x12beca,_0x14ca83,_0x533fbd[_0xa0a9('0x12d')],_0x533fbd[_0xa0a9('0x63')],undefined,_0x41b80b);if(_0x46ef3a['result']!==-0x1){this['channel']['noop'](util[_0xa0a9('0x25')]('google\x20%s\x20file\x20created',_0x3c4a85));var _0x215ca8=this[_0xa0a9('0x8a')][_0xa0a9('0x6c')](this,_0x533fbd,_0x3c4a85);if(_0x215ca8){for(var _0x27c8fa in _0x215ca8){if(_0x215ca8[_0xa0a9('0x92')](_0x27c8fa)){this['channel'][_0xa0a9('0x9b')](util[_0xa0a9('0x25')]('GOOGLE_ASR_%s',_0x27c8fa[_0xa0a9('0x66')]()),_0x215ca8[_0x27c8fa]);}}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('GoogleASR\x20Result\x20%s',JSON[_0xa0a9('0x6f')](_0x215ca8)));}}return _0x46ef3a;};AGIVertices['prototype'][_0xa0a9('0x12e')]=function(_0x4ab3a0){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4ab3a0[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x4ab3a0['appid'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x12f'));}if(!this['isConfigured'](_0x4ab3a0[_0xa0a9('0x8e')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x130'));}var _0x53c26d=_0xa0a9('0x12a');var _0x217f42=util[_0xa0a9('0x25')](_0xa0a9('0x131'),FILES_PATH,rs[_0xa0a9('0x111')](0x4));var _0x55e686=util[_0xa0a9('0x25')]('%s.%s',_0x217f42,_0x53c26d);var _0x117ab2=!![];if(_0x4ab3a0[_0xa0a9('0x12b')]===_0xa0a9('0x132')){_0x117ab2=![];}var _0xc45312=this[_0xa0a9('0xc')]['recordFile'](_0x217f42,_0x53c26d,_0x4ab3a0[_0xa0a9('0x12d')],_0x4ab3a0[_0xa0a9('0x63')],undefined,_0x117ab2);if(_0xc45312[_0xa0a9('0xa7')]!==-0x1){this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x133'),_0x55e686));var _0x2a481e=this['tildeASR'][_0xa0a9('0x6c')](this,_0x4ab3a0,_0x55e686);if(_0x2a481e){for(var _0x43ba25 in _0x2a481e){if(_0x2a481e[_0xa0a9('0x92')](_0x43ba25)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util['format'](_0xa0a9('0x134'),_0x43ba25[_0xa0a9('0x66')]()),_0x2a481e[_0x43ba25]);}}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x135'),JSON[_0xa0a9('0x6f')](_0x2a481e)));}}return _0xc45312;};AGIVertices[_0xa0a9('0xe')]['gotoc']=function(_0x10ab6e){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x10ab6e[_0xa0a9('0xa5')]));return this['channel'][_0xa0a9('0x136')](_0x10ab6e[_0xa0a9('0x39')],_0x10ab6e[_0xa0a9('0x3a')],_0x10ab6e[_0xa0a9('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0x520373){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x137'),_0x520373[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x520373[_0xa0a9('0x138')])){return this['channel']['error'](_0x520373,_0xa0a9('0x139'));}try{var _0x254905=eval(_0x520373['condition'])?'true':_0xa0a9('0x13a');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x13b'),_0x520373[_0xa0a9('0x138')],_0x254905));return{'code':0xc8,'result':_0x254905};}catch(_0x52579d){return{'code':0xc8,'result':_0xa0a9('0x13a')};}};AGIVertices[_0xa0a9('0xe')]['gotoiftime']=function(_0x326dc1){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x13c'),_0x326dc1['label']));if(!this[_0xa0a9('0x7f')](_0x326dc1['interval_id'])){return this['channel']['error'](_0x326dc1,_0xa0a9('0x13d'));}var _0x53a278=this[_0xa0a9('0x21')][_0xa0a9('0x6c')](this,_0x326dc1[_0xa0a9('0x13e')]);if(!_0x53a278){return this[_0xa0a9('0xc')]['error'](_0x326dc1,_0xa0a9('0x13f'));}for(var _0x2220c1=0x0;_0x2220c1<_0x53a278['length'];_0x2220c1+=0x1){var _0x558886=this[_0xa0a9('0xc')]['getVariable'](util[_0xa0a9('0x25')](_0xa0a9('0x140'),_0x53a278[_0x2220c1]));if(_0x558886[_0xa0a9('0xa7')]===-0x1){return _0x558886;}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x141'),_0x53a278[_0x2220c1],_0x558886[_0xa0a9('0x9f')]));if(_0x558886[_0xa0a9('0x9f')]==='true'){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x141'),_0x53a278[_0x2220c1],_0xa0a9('0x142')));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x141'),_0x53a278[_0x2220c1],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x141'),_0x53a278[_0x2220c1],_0xa0a9('0x13a')));this[_0xa0a9('0xc')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x53a278[_0x2220c1],_0xa0a9('0x13a')));}}return{'code':0xc8,'result':_0xa0a9('0x13a')};};AGIVertices['prototype']['hangup']=function(_0x20a3b5){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x143'),_0x20a3b5['label']));return this[_0xa0a9('0xc')][_0xa0a9('0x144')]();};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x145')]=function(_0x1b009a){logger['info'](util['format'](_0xa0a9('0x146'),_0x1b009a['label']));if(!this[_0xa0a9('0x7f')](_0x1b009a[_0xa0a9('0x75')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x129'));}var _0x4a6125=_0xa0a9('0x12a');var _0x19761c=util[_0xa0a9('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xa0a9('0x111')](0x4));var _0x40632c=util[_0xa0a9('0x25')](_0xa0a9('0x9a'),_0x19761c,_0x4a6125);var _0x2f0486=!![];if(_0x1b009a[_0xa0a9('0x12b')]===_0xa0a9('0x132')){_0x2f0486=![];}var _0x5bddb1=this[_0xa0a9('0xc')][_0xa0a9('0x12c')](_0x19761c,_0x4a6125,_0x1b009a[_0xa0a9('0x12d')],_0x1b009a[_0xa0a9('0x63')],undefined,_0x2f0486);if(_0x5bddb1[_0xa0a9('0xa7')]!==-0x1){this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x147'),_0x40632c));var _0x1df97c=this['ispeechASR'][_0xa0a9('0x6c')](this,_0x1b009a,_0x40632c);if(_0x1df97c){for(var _0x4bfa83 in _0x1df97c){if(_0x1df97c[_0xa0a9('0x92')](_0x4bfa83)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util[_0xa0a9('0x25')](_0xa0a9('0x148'),_0x4bfa83[_0xa0a9('0x66')]()),_0x1df97c[_0x4bfa83]);}}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x1df97c)));}}return _0x5bddb1;};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x149')]=function(_0x27a388){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x14a'),_0x27a388['label']));if(!this['isConfigured'](_0x27a388[_0xa0a9('0x75')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0x129'));}if(!this[_0xa0a9('0x7f')](_0x27a388[_0xa0a9('0x59')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x14b'),_0x27a388[_0xa0a9('0x59')]));var _0x30ec81=this[_0xa0a9('0x7b')][_0xa0a9('0x6c')](this,_0x27a388);if(_0x30ec81){this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('ispeech\x20%s\x20file\x20created',_0x30ec81));var _0x2588f4=this['channel'][_0xa0a9('0xfe')](_0x30ec81,_0x27a388[_0xa0a9('0x12d')]);try{fs[_0xa0a9('0xff')](_0x30ec81+_0xa0a9('0x100'));}catch(_0x49e173){logger[_0xa0a9('0x28')](_0x49e173);}return _0x2588f4;}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x27a388,_0xa0a9('0x14c'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x14d')]=function(_0x1c291d){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x14e'),_0x1c291d[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x1c291d[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1c291d,_0xa0a9('0x150'));}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa0a9('0xc')]['callerid'],_0x1c291d[_0xa0a9('0x14f')]));var _0xddf2a0=this['agentLogin'][_0xa0a9('0x6c')](this,_0x1c291d[_0xa0a9('0x14f')]);if(_0xddf2a0){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x1c291d[_0xa0a9('0x14f')]));this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1c291d[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x152')};}else{logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')]['callerid'],_0x1c291d[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x1c291d[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x154')};}};AGIVertices['prototype']['logout']=function(_0x5000f9){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5000f9[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x5000f9[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x5000f9,_0xa0a9('0x150'));}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x155'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5000f9['findBy']));var _0x3671cb=this[_0xa0a9('0x156')][_0xa0a9('0x6c')](this,_0x5000f9[_0xa0a9('0x14f')]);if(_0x3671cb){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5000f9['findBy']));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x151'),this['channel'][_0xa0a9('0x36')],_0x5000f9[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x152')};}else{logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')]['callerid'],_0x5000f9['findBy']));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa0a9('0x36')],_0x5000f9[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x154')};}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x157')]=function(_0x41f41e){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x158'),_0x41f41e['label']));if(!this['isConfigured'](_0x41f41e[_0xa0a9('0x159')])){return this['channel']['error'](_0x41f41e,_0xa0a9('0x15a'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x15b'),_0x41f41e[_0xa0a9('0x159')]));var _0x5e6a97=eval(_0x41f41e['operation']);if(!this[_0xa0a9('0x7f')](_0x41f41e[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0xd5'));}var _0x2488a5=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x41f41e[_0xa0a9('0xd4')]);if(!_0x2488a5){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x41f41e,_0xa0a9('0xd6'));}if(_['isArray'](_0x5e6a97)){var _0x54c63c=this;_0x5e6a97[_0xa0a9('0xd7')](function(_0x370cb1,_0x3afa59){_0x54c63c['channel'][_0xa0a9('0x9b')](util['format']('%s[%s]',_0x2488a5,_0x3afa59),_0x370cb1);});return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('variable\x20%s[key]\x20set',_0x2488a5));}else{return this['channel']['setVariable'](_0x2488a5,_0x5e6a97);}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x15c')]=function(_0x45eadb){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x15d'),_0x45eadb[_0xa0a9('0xa5')]));if(_0x45eadb[_0xa0a9('0xa3')]===0x0){return this[_0xa0a9('0xa2')](_0x45eadb);}_0x45eadb[_0xa0a9('0xa3')]-=0x1;if(!this[_0xa0a9('0x7f')](_0x45eadb[_0xa0a9('0x10d')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x45eadb,'no\x20file\x20audio\x20selected');}var _0xfe6dc9=this[_0xa0a9('0x1a')][_0xa0a9('0x6c')](this,_0x45eadb[_0xa0a9('0x10d')]);if(!_0xfe6dc9){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x45eadb,_0xa0a9('0x15e'));}var _0x474ed9=this[_0xa0a9('0xc')][_0xa0a9('0x15f')](_0xfe6dc9,_0x45eadb['response'],_0x45eadb[_0xa0a9('0x160')]);var _0x1d1895=_0x474ed9['result'];if(_0x474ed9['result']===-0x1){this[_0xa0a9('0x33')]['sync'](this,_0x45eadb,'-1');return _0x474ed9;}else if(_0x474ed9['extra']===_0xa0a9('0x63')){_0x474ed9['result']=_0x474ed9[_0xa0a9('0xa7')]['length']>0x0?_0x474ed9[_0xa0a9('0xa7')]:'t';}else if(_[_0xa0a9('0x40')](_0x474ed9[_0xa0a9('0xa7')])){_0x474ed9[_0xa0a9('0xa7')]='#';_0x1d1895='#';}if(!this[_0xa0a9('0x7f')](_0x45eadb['variable_id'])){this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2ec38c=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x45eadb[_0xa0a9('0xd4')]);if(!_0x2ec38c){return this['channel']['error'](_0x45eadb,_0xa0a9('0xd6'));}this[_0xa0a9('0xc')]['setVariable'](_0x2ec38c,_0x1d1895);}this[_0xa0a9('0x33')]['sync'](this,_0x45eadb,_0x1d1895);return _0x474ed9;};AGIVertices['prototype'][_0xa0a9('0xa6')]=function(_0x53ba4f){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x161'),_0x53ba4f[_0xa0a9('0xa5')]));return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0x53ba4f[_0xa0a9('0x162')]||_0x53ba4f['label']);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x163')]=function(_0x342a28){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x164'),_0x342a28[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x342a28[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x342a28,_0xa0a9('0x150'));}logger['info'](util[_0xa0a9('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x342a28['findBy']));var _0x4b0f0e=this[_0xa0a9('0x49')][_0xa0a9('0x6c')](this,_0x342a28[_0xa0a9('0x165')]);var _0x3fab02=this[_0xa0a9('0x4b')][_0xa0a9('0x6c')](this,_0x342a28['findBy'],_0x4b0f0e);if(_0x3fab02){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x342a28['findBy']));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa0a9('0x36')],_0x342a28[_0xa0a9('0x14f')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')]['callerid'],_0x342a28[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa0a9('0x36')],_0x342a28['findBy']));return{'code':0xc8,'result':_0xa0a9('0x154')};}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x166')]=function(_0x1b5cb8){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x167'),_0x1b5cb8[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x1b5cb8[_0xa0a9('0x10d')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1b5cb8,_0xa0a9('0x168'));}var _0x39ecb8=this[_0xa0a9('0x1a')]['sync'](this,_0x1b5cb8[_0xa0a9('0x10d')]);if(!_0x39ecb8){return this['channel'][_0xa0a9('0x28')](_0x1b5cb8,_0xa0a9('0x15e'));}var _0x26a86e=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0x169'),[_0x39ecb8,_0x1b5cb8['opts']]);if(_0x26a86e[_0xa0a9('0xa7')]===-0x1){return _0x26a86e;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x169'),_0x39ecb8));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x16b')]=function(_0x205587){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x16c'),_0x205587['label']));if(!this[_0xa0a9('0x7f')](_0x205587[_0xa0a9('0x16d')])){return this['channel']['error'](_0x205587,'no\x20queue\x20selected');}var _0x30b59e='';var _0x27f23b=parseInt(_0x205587[_0xa0a9('0x16d')],0xa);if(isNaN(_0x27f23b)){_0x30b59e=_0x205587[_0xa0a9('0x16d')];}else{_0x30b59e=this['getVoiceQueue'][_0xa0a9('0x6c')](this,_0x205587[_0xa0a9('0x16d')]);if(!_0x30b59e){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x205587,'no\x20queue\x20found');}}var _0x39fe97='';if(this[_0xa0a9('0x7f')](_0x205587[_0xa0a9('0x10d')])){var _0x1277d2=this[_0xa0a9('0x1a')][_0xa0a9('0x6c')](this,_0x205587['file_id']);if(_0x1277d2){_0x39fe97=_0x1277d2;}}this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x205587,_0x30b59e);if(_0x205587[_0xa0a9('0xe2')][_0xa0a9('0x16e')]('x')<0x0){_0x205587['opts']+='x';}if(_0x205587[_0xa0a9('0xe2')][_0xa0a9('0x16e')]('X')<0x0){_0x205587[_0xa0a9('0xe2')]+='X';}this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0xa0a9('0x16f'),_0x30b59e?_0x30b59e[_0xa0a9('0x170')]():'');var _0x28fc06=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0x171'),[_0x30b59e,_0x205587[_0xa0a9('0xe2')],_0x205587[_0xa0a9('0x61')],_0x39fe97,_0x205587[_0xa0a9('0x63')],_0x205587[_0xa0a9('0x6')],_0x205587[_0xa0a9('0x172')],_0x205587[_0xa0a9('0x173')],'',_0x205587[_0xa0a9('0x174')]]);if(_0x28fc06[_0xa0a9('0xa7')]===-0x1){return _0x28fc06;}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x171'),_0x30b59e));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x175')]=function(_0x131589){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x176'),_0x131589[_0xa0a9('0xa5')]));var _0xe199cb=_0x131589[_0xa0a9('0x177')]||_0xa0a9('0x12a');var _0x95e1cc=util[_0xa0a9('0x25')](_0xa0a9('0x178'),this[_0xa0a9('0xc')][_0xa0a9('0x34')],rs[_0xa0a9('0x111')](0x5));var _0x3dea59=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x95e1cc,_0xe199cb);var _0x30bdf5=util[_0xa0a9('0x25')](_0xa0a9('0x131'),FILES_PATH,_0x95e1cc);this[_0xa0a9('0x37')]['sync'](this,_0x131589,_0x95e1cc,_0x3dea59);this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0xa0a9('0x179'),_0x95e1cc);logger['info'](_0xa0a9('0x17a'),_0x30bdf5,_0xe199cb,_0x131589[_0xa0a9('0x17b')],_0x131589[_0xa0a9('0x63')]);return this[_0xa0a9('0xc')][_0xa0a9('0x12c')](_0x30bdf5,_0xe199cb,_0x131589[_0xa0a9('0x17b')],_0x131589[_0xa0a9('0x63')],undefined,!![]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x17c')]=function(_0x3b65b3){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x17d'),_0x3b65b3[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x3b65b3['url'])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0x17e'));}var _0x119cac=this['restAPI'][_0xa0a9('0x6c')](this,_0x3b65b3);logger['info'](util[_0xa0a9('0x25')]('Response:',util[_0xa0a9('0x17f')](_0x119cac,{'showHidden':![],'depth':null})));if(!this[_0xa0a9('0x7f')](_0x3b65b3[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x180'));}var _0x37f444=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x3b65b3[_0xa0a9('0xd4')]);if(!_0x37f444){return this[_0xa0a9('0xc')]['error'](_0x3b65b3,_0xa0a9('0xd6'));}this['channel'][_0xa0a9('0x9b')](util[_0xa0a9('0x25')]('%s_STATUS_CODE',_0x37f444),_0x119cac[_0xa0a9('0x181')]?_0x119cac[_0xa0a9('0x181')]:_0xa0a9('0x182'));this[_0xa0a9('0xc')]['setVariable'](util[_0xa0a9('0x25')](_0xa0a9('0x183'),_0x37f444),_0x119cac['statusMessage']?_0x119cac[_0xa0a9('0x71')]:'OK');if(_0x119cac[_0xa0a9('0x67')]){try{this[_0xa0a9('0x99')](_0x119cac[_0xa0a9('0x67')],_0x37f444);}catch(_0x2a9c9f){logger[_0xa0a9('0x28')](util['format'](_0xa0a9('0x184'),_0x37f444));}}return this['channel']['noop'](util['format']('variable\x20%s\x20set',_0x37f444));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x185')]=function(_0x340024){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x186'),_0x340024['label']));return this['channel'][_0xa0a9('0x187')](_0x340024['digits'][_0xa0a9('0x55')](/\s+/g,''),_0x340024['escape_digits']);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x188')]=function(_0x57108f){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x189'),_0x57108f['label']));return this[_0xa0a9('0xc')][_0xa0a9('0x18a')](_0x57108f[_0xa0a9('0x18b')][_0xa0a9('0x55')](/\s+/g,''),_0x57108f[_0xa0a9('0x17b')]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x18c')]=function(_0x4e6bb2){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x18d'),_0x4e6bb2[_0xa0a9('0xa5')]));return this['channel'][_0xa0a9('0x18e')](_0x4e6bb2[_0xa0a9('0x59')],_0x4e6bb2[_0xa0a9('0x17b')]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x18f')]=function(_0x2a27d6){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2a27d6[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x2a27d6['account_id'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20mail\x20account\x20configured');}var _0x522c5b=this[_0xa0a9('0x1e')][_0xa0a9('0x6c')](this,_0x2a27d6[_0xa0a9('0x190')]);if(!_0x522c5b||!_0x522c5b[_0xa0a9('0x191')]){return this['channel'][_0xa0a9('0x28')](_0x2a27d6,_0xa0a9('0x192'));}var _0x480ba2={'from':util['format'](_0xa0a9('0x193'),_0x522c5b[_0xa0a9('0x11')],_0x522c5b[_0xa0a9('0x194')]||_0x522c5b[_0xa0a9('0x191')][_0xa0a9('0x195')]),'to':_0x2a27d6['to']||'','cc':_0x2a27d6['cc']||'','bcc':_0x2a27d6[_0xa0a9('0x196')]||'','subject':_0x2a27d6[_0xa0a9('0x197')],'html':_0x2a27d6['text'],'text':_0x2a27d6['text']};if(this[_0xa0a9('0x7f')](_0x2a27d6[_0xa0a9('0x198')])){}logger[_0xa0a9('0xdb')]('sendMail\x20message',JSON[_0xa0a9('0x6f')](_0x480ba2));this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x2a27d6,_0x2a27d6['account_id']);this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x522c5b[_0xa0a9('0x11')]));this[_0xa0a9('0x20')][_0xa0a9('0x6c')](this,_0x522c5b[_0xa0a9('0x199')],_0x480ba2);return this[_0xa0a9('0xc')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa0a9('0xe')]['sendFax']=function(_0x42585f){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x19a'),_0x42585f[_0xa0a9('0xa5')]));return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xa0a9('0xe')]['sendSMS']=function(_0x2792d7){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x19b'),_0x2792d7[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x2792d7['sms_account_id'])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x19c'));}var _0x46706a=this[_0xa0a9('0x30')][_0xa0a9('0x6c')](this,_0x2792d7[_0xa0a9('0x19d')]);if(!_0x46706a){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x2792d7,'no\x20sms\x20account\x20found');}var _0x52bb5b={'body':_0x2792d7[_0xa0a9('0x19e')],'phone':_0x2792d7['to']||'','SmsAccountId':_0x46706a['id']};logger[_0xa0a9('0xdb')](_0xa0a9('0x19f'),JSON['stringify'](_0x52bb5b));this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x2792d7,_0x2792d7[_0xa0a9('0x19d')]);this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x46706a[_0xa0a9('0x11')]));this[_0xa0a9('0x32')][_0xa0a9('0x6c')](this,_0x52bb5b);return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1a0')]=function(_0x1259f1){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x1a1'),_0x1259f1[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x1259f1[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')]['error'](_0x1259f1,_0xa0a9('0x1a2'));}var _0x5c0ae9=this['getVariable'][_0xa0a9('0x6c')](this,_0x1259f1['variable_id']);if(!_0x5c0ae9){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1259f1,_0xa0a9('0xd6'));}return this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0x5c0ae9,_0x1259f1['variable_value']);};AGIVertices['prototype']['start']=function(_0x39255b){logger['info'](util['format'](_0xa0a9('0x1a3'),_0x39255b[_0xa0a9('0xa5')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x1a4'));var _0x1c845c=this['channel'][_0xa0a9('0x9e')](_0xa0a9('0x1a5'));if(!_['isEmpty'](_0x1c845c[_0xa0a9('0x9f')])){this[_0xa0a9('0xc')][_0xa0a9('0x34')]=_0x1c845c[_0xa0a9('0x9f')];}if(_0x39255b[_0xa0a9('0xb8')]==='yes'){this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x1a6'));return this[_0xa0a9('0xc')][_0xa0a9('0xb8')]();}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x1a7'));};AGIVertices[_0xa0a9('0xe')]['subproject']=function(_0x423b44){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x1a8'),_0x423b44['label']));if(!this[_0xa0a9('0x7f')](_0x423b44[_0xa0a9('0x1a9')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x423b44,_0xa0a9('0x1aa'));}var _0x257a29=this[_0xa0a9('0x15')][_0xa0a9('0x6c')](this,_0x423b44['project_id']);if(!this[_0xa0a9('0x7f')](_0x257a29)){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x423b44,util[_0xa0a9('0x25')](_0xa0a9('0x1ab'),_0x423b44[_0xa0a9('0x1a9')]));}if(_0x257a29===this[_0xa0a9('0xc')][_0xa0a9('0x35')]){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x423b44,_0xa0a9('0x1ac'));}this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x423b44,_0x257a29);var _0xcecd05=this['channel'][_0xa0a9('0x53')](_0xa0a9('0x1ad'),util[_0xa0a9('0x25')](_0xa0a9('0x1ae'),config[_0xa0a9('0x6')][_0xa0a9('0x1af')]||_0xa0a9('0x1b0'),_0x257a29,this[_0xa0a9('0xc')][_0xa0a9('0x35')]));if(_0xcecd05[_0xa0a9('0xa7')]===-0x1){return _0xcecd05;}return this['channel']['noop'](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x1ad'),_0x257a29));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1b1')]=function(_0x4ee731){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x1b2'),_0x4ee731[_0xa0a9('0xa5')]));var _0x2039e6=this[_0xa0a9('0x52')][_0xa0a9('0x6c')](this,_0x4ee731[_0xa0a9('0xb4')]);this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x4ee731,_0x4ee731['command']);if(this[_0xa0a9('0x7f')](_0x4ee731[_0xa0a9('0xd4')])){var _0x53a95f=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x4ee731[_0xa0a9('0xd4')]);if(_0x53a95f){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0x53a95f,_0x2039e6);return this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x1b3'),_0x4ee731[_0xa0a9('0xb4')],_0x53a95f));}}return this['channel'][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x1b4'),_0x4ee731['command']));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1b5')]=function(_0x11535b){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x1b6'),_0x11535b[_0xa0a9('0xa5')]));_0x11535b[_0xa0a9('0x59')]=_0x11535b[_0xa0a9('0x59')][_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x11535b[_0xa0a9('0x57')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x1b7'));}if(!this[_0xa0a9('0x7f')](_0x11535b[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x1b8'),_0x11535b[_0xa0a9('0x59')]));var _0x5f461a=this[_0xa0a9('0x56')][_0xa0a9('0x6c')](this,_0x11535b);if(_0x5f461a){this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x1b9'),_0x5f461a));var _0x253557=this['channel'][_0xa0a9('0xfe')](_0x5f461a);try{fs[_0xa0a9('0xff')](_0x5f461a+_0xa0a9('0x100'));}catch(_0x111157){logger[_0xa0a9('0x28')](_0x111157);}return _0x253557;}return this[_0xa0a9('0xc')]['error'](_0x11535b,_0xa0a9('0x1ba'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1bb')]=function(_0x22beaf){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x1bc'),_0x22beaf[_0xa0a9('0xa5')]));_0x22beaf['text']=_0x22beaf['text'][_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa0a9('0x7f')](_0x22beaf['text'])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x1bd'),_0x22beaf[_0xa0a9('0x59')]));var _0x1ae48c=this[_0xa0a9('0x5e')]['sync'](this,_0x22beaf);if(_0x1ae48c){this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0x1be'),_0x1ae48c));var _0x27f802=this[_0xa0a9('0xc')][_0xa0a9('0xfe')](_0x1ae48c);try{fs['unlink'](_0x1ae48c+_0xa0a9('0x100'));}catch(_0x3095f3){logger[_0xa0a9('0x28')](_0x3095f3);}return _0x27f802;}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x22beaf,_0xa0a9('0x1bf'));};AGIVertices['prototype']['unpause']=function(_0x5d0d21){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x1c0'),_0x5d0d21[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x5d0d21[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x5d0d21,_0xa0a9('0x150'));}logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x155'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21['findBy']));var _0x103d3b=this[_0xa0a9('0x4e')]['sync'](this,_0x5d0d21[_0xa0a9('0x14f')]);if(_0x103d3b){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21['findBy']));return{'code':0xc8,'result':_0xa0a9('0x152')};}else{logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa0a9('0x1c1')]=function(_0x47ee14){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x1c2'),_0x47ee14['label']));var _0x3ba09e=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0x1c3'),[_0x47ee14[_0xa0a9('0x1c4')],_0x47ee14[_0xa0a9('0x73')]]);if(_0x3ba09e[_0xa0a9('0xa7')]===-0x1){return _0x3ba09e;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x1c3'),_0x47ee14['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x1d173a){logger['info'](util['format'](_0xa0a9('0x1c5'),_0x1d173a[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x1d173a['variable_id'])){return this['channel'][_0xa0a9('0x28')](_0x1d173a,'no\x20variable\x20selected');}var _0x5d879a=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x1d173a['variable_id']);if(!_0x5d879a){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1d173a,_0xa0a9('0xd6'));}var _0x14961c=this[_0xa0a9('0xc')][_0xa0a9('0x9e')](_0x5d879a);return{'code':0xc8,'result':_0x14961c[_0xa0a9('0x9f')]?_0x14961c[_0xa0a9('0x9f')]:'-'};};String['prototype']['replaceAll']=function(_0x60e20a,_0x5ad400){return this['split'](_0x60e20a)[_0xa0a9('0x1c6')](_0x5ad400);};module[_0xa0a9('0x1c7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ffd3e98..7efe9ff 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 _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 +var _0x25f1=['[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','bind','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','[ACW][START]\x20%s','stopAcw','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25f1,0x115));var _0x125f=function(_0x1d3019,_0x8dbbd5){_0x1d3019=_0x1d3019-0x0;var _0x36458e=_0x25f1[_0x1d3019];return _0x36458e;};'use strict';var _=require(_0x125f('0x0'));var moment=require(_0x125f('0x1'));var ami=require(_0x125f('0x2'));var logger=require('../../../config/logger')(_0x125f('0x3'));var RpcUser=require(_0x125f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1a3fff){this[_0x125f('0x5')]=_0x1a3fff[_0x125f('0x5')];this[_0x125f('0x6')]=_0x1a3fff[_0x125f('0x6')];this[_0x125f('0x7')]=_0x1a3fff[_0x125f('0x7')];this[_0x125f('0x8')]={};ami['on'](_0x125f('0x9'),this[_0x125f('0xa')]['bind'](this));ami['on'](_0x125f('0xb'),this[_0x125f('0xc')]['bind'](this));ami['on']('hangup',this[_0x125f('0xd')][_0x125f('0xe')](this));ami['on']('agentringnoanswer',this[_0x125f('0xf')][_0x125f('0xe')](this));ami['on']('attendedtransfer',this[_0x125f('0x10')]['bind'](this));ami['on'](_0x125f('0x11'),this[_0x125f('0x12')][_0x125f('0xe')](this));ami['on'](_0x125f('0x13'),this[_0x125f('0x14')][_0x125f('0xe')](this));}function getDiff(_0xb13f9e){var _0x28c791=moment()['milliseconds'](0x0);var _0x3e3ddf=moment(_0xb13f9e)[_0x125f('0x15')](0x0);return _0x28c791[_0x125f('0x16')](_0x3e3ddf,_0x125f('0x17'));}Acw[_0x125f('0x18')][_0x125f('0x19')]=function(_0x3f4ce5,_0x54b14b){var _0x18bd6d=this;var _0x4d4cd6=getDiff(_0x18bd6d[_0x125f('0x7')][_0x3f4ce5]['lastPauseAt']);clearTimeout(_0x18bd6d[_0x125f('0x7')][_0x3f4ce5][_0x125f('0x1a')]);_0x18bd6d[_0x125f('0x7')][_0x3f4ce5]['timer']=![];return RpcVoiceAgentReport[_0x125f('0x1b')]({'acwtime':_0x4d4cd6},_0x18bd6d['timers'][_0x3f4ce5][_0x125f('0x1c')],_0x3f4ce5)[_0x125f('0x1d')](function(_0x3eae75){logger[_0x125f('0x1e')](_0x125f('0x1f'),_0x54b14b,_0x4d4cd6,_0x3eae75);})[_0x125f('0x20')](function(_0x314375){logger[_0x125f('0x21')]('[%s][UPDATE][ERRORS:%s]',_0x54b14b,_0x314375);})[_0x125f('0x22')](function(){delete _0x18bd6d[_0x125f('0x7')][_0x3f4ce5];});};Acw[_0x125f('0x18')][_0x125f('0x23')]=function(_0x1811a1){try{var _0x5ea2a0=this;var _0x39bc59=this['channels'][_0x1811a1][_0x125f('0x24')];var _0x1f6415=this[_0x125f('0x8')][_0x1811a1]['queue'];var _0x161d63=this['voiceQueues'][_0x1f6415];var _0x49d4a4=![];var _0x2e82fc=_0x125f('0x25');if(_0x161d63[_0x125f('0x26')]&&_0x161d63[_0x125f('0x27')][_0x125f('0x28')]){_0x49d4a4=!![];_0x2e82fc=_0x161d63[_0x125f('0x27')]['name'];}return ami[_0x125f('0x29')]({'action':_0x125f('0x2a'),'interface':_0x39bc59,'paused':!![],'reason':_0x2e82fc})[_0x125f('0x1d')](function(){if(_0x5ea2a0['agents'][_0x39bc59]){return RpcUser[_0x125f('0x2b')](_0x5ea2a0[_0x125f('0x6')][_0x39bc59]['id'])[_0x125f('0x1d')](function(_0x4c7a91){if(!_0x4c7a91||_0x4c7a91[_0x125f('0x2c')]){logger[_0x125f('0x1e')](_0x125f('0x2d'),_0x1811a1,_0x39bc59,_0x1f6415);return;}logger[_0x125f('0x1e')](_0x125f('0x2e'),_0x1811a1,_0x39bc59,_0x1f6415);var _0x96f29f=_0x5ea2a0[_0x125f('0x8')][_0x1811a1]['attended']&&_0x5ea2a0[_0x125f('0x8')][_0x1811a1]['destlinkedid']?_0x5ea2a0['channels'][_0x1811a1][_0x125f('0x2f')]:_0x1811a1;return RpcUser[_0x125f('0x30')](_0x5ea2a0['agents'][_0x39bc59],_0x2e82fc,_0x96f29f)[_0x125f('0x1d')](function(_0x4c6b23){_0x5ea2a0[_0x125f('0x5')][_0x1f6415]['available']-=0x1;_0x5ea2a0['voiceQueues'][_0x1f6415]['paused']+=0x1;return _0x4c6b23;});})[_0x125f('0x1d')](function(_0x4c9ffa){if(_0x49d4a4||!_0x4c9ffa){return;}_0x5ea2a0[_0x125f('0x7')][_0x39bc59]={};logger[_0x125f('0x1e')](_0x125f('0x31'),_0x1811a1,_0x5ea2a0['voiceQueues'][_0x1f6415][_0x125f('0x32')],_0x39bc59,_0x1f6415);_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x1a')]=setTimeout(_0x5ea2a0['stopAcw'][_0x125f('0xe')](_0x5ea2a0,_0x39bc59),_0x5ea2a0[_0x125f('0x5')][_0x1f6415][_0x125f('0x32')]*0x3e8);_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x33')]=moment()[_0x125f('0x34')](_0x125f('0x35'));_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x1c')]=_0x1811a1;_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x36')]=_0x1f6415;_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x19')]=_0x5ea2a0['updateAcw'][_0x125f('0xe')](_0x5ea2a0,_0x39bc59,_0x1811a1);});}})[_0x125f('0x20')](function(){logger[_0x125f('0x21')](_0x125f('0x31'),_0x1811a1,_0x5ea2a0['voiceQueues'][_0x1f6415][_0x125f('0x32')],_0x39bc59,_0x1f6415);})[_0x125f('0x22')](function(){delete _0x5ea2a0[_0x125f('0x8')][_0x1811a1];});}catch(_0x56f3d9){logger[_0x125f('0x21')](_0x125f('0x37'),_0x56f3d9['message']);}};Acw[_0x125f('0x18')][_0x125f('0x38')]=function(_0x47d671){try{var _0x1a39f4=this;if(_0x1a39f4[_0x125f('0x7')][_0x47d671]){_0x1a39f4[_0x125f('0x7')][_0x47d671][_0x125f('0x1a')]=![];var _0x48ad71=_0x1a39f4['timers'][_0x47d671][_0x125f('0x1c')];var _0x59bce1=_0x1a39f4[_0x125f('0x7')][_0x47d671][_0x125f('0x36')];var _0x27fefc=_0x1a39f4['voiceQueues'][_0x59bce1][_0x125f('0x32')];logger[_0x125f('0x1e')]('[%s][TIMER][STOP][AGENT:%s]',_0x48ad71,_0x47d671);RpcUser[_0x125f('0x2b')](this['agents'][_0x47d671]['id'])[_0x125f('0x1d')](function(_0x3c1256){if(_0x3c1256['pauseType']===_0x125f('0x25')){return RpcUser['saveUnpause'](_0x1a39f4[_0x125f('0x6')][_0x47d671]);}});RpcVoiceAgentReport[_0x125f('0x1b')]({'acwtime':_0x27fefc,'agentacw':!![]},_0x48ad71,_0x47d671)[_0x125f('0x1d')](function(_0x193346){logger[_0x125f('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x48ad71,_0x27fefc,_0x193346);})[_0x125f('0x20')](function(_0x3b65e9){logger[_0x125f('0x21')](_0x125f('0x39'),_0x48ad71,_0x3b65e9);});}else{logger[_0x125f('0x21')](_0x125f('0x3a'),_0x47d671);if(_0x1a39f4[_0x125f('0x7')]){logger[_0x125f('0x1e')](_0x125f('0x3b'),JSON[_0x125f('0x3c')](_0x1a39f4[_0x125f('0x7')]));}}}catch(_0x3274da){logger['error'](_0x125f('0x3d'),_0x3274da[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0xa')]=function(_0x5ce824){try{if(this[_0x125f('0x5')][_0x5ce824['queue']]&&(this[_0x125f('0x5')][_0x5ce824['queue']]['acw']||this['voiceQueues'][_0x5ce824[_0x125f('0x36')]][_0x125f('0x26')])){if(this[_0x125f('0x6')][_0x5ce824[_0x125f('0x24')]]){this[_0x125f('0x8')][_0x5ce824[_0x125f('0x1c')]]={'queue':_0x5ce824['queue'],'interface':_0x5ce824[_0x125f('0x24')],'destlinkedid':_0x5ce824['destlinkedid']};}}}catch(_0x2de88a){logger[_0x125f('0x21')](_0x125f('0x3f'),_0x2de88a[_0x125f('0x3e')]);}};Acw['prototype'][_0x125f('0x14')]=function(_0x718168){try{if(this[_0x125f('0x5')][_0x718168['queue']]&&(this[_0x125f('0x5')][_0x718168[_0x125f('0x36')]][_0x125f('0x3')]||this[_0x125f('0x5')][_0x718168[_0x125f('0x36')]][_0x125f('0x26')])){if(this['agents'][_0x718168[_0x125f('0x24')]]){this[_0x125f('0x8')][_0x718168['uniqueid']]={'queue':_0x718168[_0x125f('0x36')],'interface':_0x718168[_0x125f('0x24')]};}}}catch(_0x5da6aa){logger['error'](_0x125f('0x40'),_0x5da6aa[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0xc')]=function(_0x5da585){try{if(this[_0x125f('0x8')][_0x5da585[_0x125f('0x1c')]]&&_[_0x125f('0x41')](this[_0x125f('0x8')][_0x5da585[_0x125f('0x1c')]][_0x125f('0x42')])){logger[_0x125f('0x1e')](_0x125f('0x43'),_0x5da585[_0x125f('0x1c')]);this['startAcw'](_0x5da585['uniqueid']);}else if(this[_0x125f('0x8')][_0x5da585[_0x125f('0x44')]]&&_['isUndefined'](this[_0x125f('0x8')][_0x5da585[_0x125f('0x44')]]['attended'])){logger[_0x125f('0x1e')](_0x125f('0x45'),_0x5da585[_0x125f('0x44')]);this[_0x125f('0x23')](_0x5da585[_0x125f('0x44')]);}}catch(_0x247fb0){logger[_0x125f('0x21')](_0x125f('0x46'),_0x247fb0[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0xd')]=function(_0x3a8ea2){try{if(this[_0x125f('0x8')][_0x3a8ea2['uniqueid']]&&this[_0x125f('0x8')][_0x3a8ea2['uniqueid']][_0x125f('0x42')]){logger[_0x125f('0x1e')](_0x125f('0x47'),_0x3a8ea2[_0x125f('0x1c')]);this[_0x125f('0x23')](_0x3a8ea2[_0x125f('0x1c')]);}else if(this['channels'][_0x3a8ea2['linkedid']]&&this[_0x125f('0x8')][_0x3a8ea2[_0x125f('0x44')]]['attended']){logger[_0x125f('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3a8ea2['linkedid']);this[_0x125f('0x23')](_0x3a8ea2[_0x125f('0x44')]);}}catch(_0x14abff){logger['error']('[ACW][syncHangup]\x20%s',_0x14abff[_0x125f('0x3e')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x3ac0da){try{if(!_[_0x125f('0x48')](this['channels'][_0x3ac0da['transfereeuniqueid']])){this[_0x125f('0x23')](_0x3ac0da[_0x125f('0x49')]);if(this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4a')]]){this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4a')]][_0x125f('0x42')]=!![];this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4b')]]=this['channels'][_0x3ac0da[_0x125f('0x4a')]];this[_0x125f('0x4c')](_0x3ac0da[_0x125f('0x4a')]);}}else if(!_[_0x125f('0x48')](this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4b')]])){this[_0x125f('0x23')](_0x3ac0da['transfertargetuniqueid']);if(this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4d')]]){this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4d')]]['attended']=!![];this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x49')]]=this[_0x125f('0x8')][_0x3ac0da['origtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x3ac0da['origtransfereruniqueid']);}}}catch(_0x1c90cb){logger[_0x125f('0x21')](_0x125f('0x4e'),_0x1c90cb[_0x125f('0x3e')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x5227df){try{if(this['channels'][_0x5227df[_0x125f('0x4f')]]){logger[_0x125f('0x1e')](_0x125f('0x50'),JSON[_0x125f('0x3c')](_0x5227df[_0x125f('0x4f')]));this['startAcw'](_0x5227df['transfereruniqueid']);}else if(this[_0x125f('0x8')][_0x5227df[_0x125f('0x51')]]){logger[_0x125f('0x1e')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x5227df[_0x125f('0x51')]));this['startAcw'](_0x5227df[_0x125f('0x51')]);}}catch(_0x1c0d81){logger[_0x125f('0x21')](_0x125f('0x52'),_0x1c0d81[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')]['syncAgentRingNoAnswer']=function(_0x38b5ea){try{if(this[_0x125f('0x5')][_0x38b5ea[_0x125f('0x36')]]&&this['voiceQueues'][_0x38b5ea[_0x125f('0x36')]][_0x125f('0x53')]==='all'){if(this[_0x125f('0x6')][_0x38b5ea['interface']]){logger['info'](_0x125f('0x54'),_0x38b5ea[_0x125f('0x1c')],_0x38b5ea['interface'],_0x38b5ea['queue']);return RpcUser[_0x125f('0x30')](this[_0x125f('0x6')][_0x38b5ea[_0x125f('0x24')]],'Auto-Pause',_0x38b5ea['uniqueid']);}}}catch(_0x636d6b){logger['error'](_0x125f('0x55'),_0x636d6b[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0x4c')]=function(_0x33772b,_0x541857=0x2710){if(this[_0x125f('0x8')][_0x33772b]){setTimeout(()=>{delete this[_0x125f('0x8')][_0x33772b];},_0x541857);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index fcdabfe..00986a7 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 _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 +var _0x72d8=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','port','asterisk','username','password','Action','promisify','action','error'];(function(_0x5b3784,_0x313e94){var _0x2f9d6d=function(_0x2fc710){while(--_0x2fc710){_0x5b3784['push'](_0x5b3784['shift']());}};_0x2f9d6d(++_0x313e94);}(_0x72d8,0x1c6));var _0x872d=function(_0x45afec,_0x18bc92){_0x45afec=_0x45afec-0x0;var _0x5a841a=_0x72d8[_0x45afec];return _0x5a841a;};'use strict';var Manager=require(_0x872d('0x0'));var BPromise=require(_0x872d('0x1'));var util=require(_0x872d('0x2'));var logger=require(_0x872d('0x3'))(_0x872d('0x4'));var config=require(_0x872d('0x5'));var ami=new Manager(config['asterisk'][_0x872d('0x6')],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')][_0x872d('0x8')],config[_0x872d('0x7')][_0x872d('0x9')],!![]);ami['keepConnected']();ami[_0x872d('0xa')]=BPromise[_0x872d('0xb')](ami[_0x872d('0xc')]);function error(_0x2c98a1){logger[_0x872d('0xd')](util[_0x872d('0xe')](_0x872d('0xf'),config[_0x872d('0x7')][_0x872d('0x8')],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')][_0x872d('0x6')],util[_0x872d('0x10')](_0x2c98a1,![],null)));}function close(){logger[_0x872d('0xd')](util[_0x872d('0xe')](_0x872d('0x11'),config['asterisk']['username'],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')]['port']));}ami[_0x872d('0x12')]=function(){return function(){return ami[_0x872d('0xa')]({'action':_0x872d('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x872d('0xa')]({'action':'devicestatelist'});};};ami[_0x872d('0x14')]=function(){return function(){return ami[_0x872d('0xa')]({'action':_0x872d('0x15')});};};ami[_0x872d('0x16')]=function(){return function(){return ami['Action']({'action':_0x872d('0x17')});};};ami[_0x872d('0x18')]=function(){return function(){return ami[_0x872d('0xa')]({'action':_0x872d('0x19')});};};function connect(){logger[_0x872d('0x1a')](util[_0x872d('0xe')](_0x872d('0x1b'),config['asterisk'][_0x872d('0x8')],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')][_0x872d('0x6')]));ami[_0x872d('0x1c')](_0x872d('0xd'),error);ami['once'](_0x872d('0x1d'),close);}ami['on'](_0x872d('0x1e'),connect);ami['on'](_0x872d('0x1f'),function(_0x37ee95){logger[_0x872d('0x1a')](util[_0x872d('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x872d('0x8')],config['asterisk']['ip'],config[_0x872d('0x7')]['port'],util[_0x872d('0x10')](_0x37ee95,![],null)));});ami['on'](_0x872d('0x20'),function(){logger[_0x872d('0x1a')](util[_0x872d('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x872d('0x7')][_0x872d('0x8')],config['asterisk']['ip'],config['asterisk'][_0x872d('0x6')]));return Promise[_0x872d('0x21')]()[_0x872d('0x22')](ami[_0x872d('0x12')]())[_0x872d('0x22')](ami[_0x872d('0x23')]())[_0x872d('0x22')](ami['actionSipPeerStatus']())[_0x872d('0x22')](ami[_0x872d('0x16')]())[_0x872d('0x22')](ami['actionCoreShowChannels']())[_0x872d('0x24')](function(_0x44e67e){logger[_0x872d('0xd')](_0x872d('0x25'),util[_0x872d('0x10')](_0x44e67e,{'showHidden':![],'depth':null}));});});ami[_0x872d('0x1c')](_0x872d('0xd'),error);ami[_0x872d('0x1c')](_0x872d('0x1d'),close);module[_0x872d('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d5e3a64..198101f 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_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 +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xda3f,0xec));var _0xfda3=function(_0x405884,_0x51bc5a){_0x405884=_0x405884-0x0;var _0x350bab=_0xda3f[_0x405884];return _0x350bab;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('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 15b3727..8b3c553 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 _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 +var _0x752a=['HANGUP','[syncHangupInAMDIvr]','createStateFinal','[syncHangup]','ivrAnswerCallsDay','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','[syncHangup2]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','statusMessage','available','paused','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','reachable','resolve','map','Agent','user:%s','user:dialPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[actions]','undefined','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','handlePreviewRecallNotifications','launchHandleIvr','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','xcally-motion-dialer','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','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(','getDataPredictive','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','run','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[handleIvr]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[handlePower]','[getContactCampaign2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[countReScheduled]\x20','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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','[busyFactor]','Ts\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','CAMPAIGN_STATUS','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','stringify','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','push','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','Action','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaign','isIVRCampaignActive','dialGlobalInterval','dialTimezone','[syncCampaigns]','dialMethod','handlePower','power','dialPowerLevel','Queue','silly','Dialer::ifTime()','intervalIftime','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','getSeconds','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','agiafterat','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','callAdditionalPhoneAfterMin','dialAbandonedRetryFrequency','VoiceQueueId','[rescheduleContact][Abandoned]','starttime','createHistory','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','roundrobin','isNil','locked','stateinterface','rrmemory','idHopper','[syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','[syncOriginateResponse]','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','value','[syncVarSet]','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x752a,0x103));var _0xa752=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x752a[_0x3c4a7c];return _0xf13d1e;};'use strict';var util=require(_0xa752('0x0'));var _=require(_0xa752('0x1'));var uuid=require(_0xa752('0x2'));var moment=require(_0xa752('0x3'));var rr=require('rr');var Redis=require(_0xa752('0x4'));var utils=require('./utils');var hopperUtils=require(_0xa752('0x5'));var ut=require(_0xa752('0x6'));var config=require(_0xa752('0x7'));var logger=require(_0xa752('0x8'))(_0xa752('0x9'));var loggerBooked=require('../../../config/logger')(_0xa752('0xa'));var loggerPredictive=require(_0xa752('0x8'))(_0xa752('0xb'));var loggerPredictiveCalls=require(_0xa752('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xa752('0x8'))(_0xa752('0xc'));var ami=require(_0xa752('0xd'));config[_0xa752('0xe')]=_['defaults'](config[_0xa752('0xe')],{'host':_0xa752('0xf'),'port':0x18eb});var io=require(_0xa752('0x10'))(new Redis(config[_0xa752('0xe')]));var cmHopper=require(_0xa752('0x11'));var voiceQueueRt=require(_0xa752('0x12'));var RpcSetting=require(_0xa752('0x13'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0xa752('0x14'));var Final=require(_0xa752('0x15'));var AgentComplete=require(_0xa752('0x16'));var QueueCallerAbandon=require(_0xa752('0x17'));var Hangup=require(_0xa752('0x18'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa752('0x19')]['enqueue']=function(_0x17501d){this[_0xa752('0x1a')]=this[_0xa752('0x1a')]?this[_0xa752('0x1a')][_0xa752('0x1b')](_0x17501d):_0x17501d();};function Dialer(_0x458c6d,_0x4a74b6){this[_0xa752('0x1c')]=new Sequence();this[_0xa752('0x1d')]=_0x4a74b6;this['voiceQueues']=_0x458c6d[_0xa752('0x1e')];this[_0xa752('0x1f')]=_0x458c6d[_0xa752('0x1f')];this[_0xa752('0x20')]=_0x458c6d[_0xa752('0x20')];this[_0xa752('0x21')]=_0x458c6d['trunks'];this[_0xa752('0x22')]=config[_0xa752('0x22')]||0x2;this[_0xa752('0x23')]={};this[_0xa752('0x24')]={};this[_0xa752('0x25')]={};this['uniqueId']={};this[_0xa752('0x26')]={};this[_0xa752('0x27')]={};this[_0xa752('0x28')]={};this[_0xa752('0x29')]={};this[_0xa752('0x2a')]={};this[_0xa752('0x2b')]={};this[_0xa752('0x2c')]={};ami['on'](_0xa752('0x2d'),this['syncAgentConnect'][_0xa752('0x2e')](this));ami['on'](_0xa752('0x2f'),this[_0xa752('0x30')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xa752('0x2e')](this));ami['on'](_0xa752('0x31'),this[_0xa752('0x32')][_0xa752('0x2e')](this));ami['on']('custom:queuesummary',this[_0xa752('0xc')][_0xa752('0x2e')](this));ami['on'](_0xa752('0x33'),this['syncQueueSummaryComplete'][_0xa752('0x2e')](this));ami['on'](_0xa752('0x34'),this[_0xa752('0x35')][_0xa752('0x2e')](this));ami['on']('newexten',this[_0xa752('0x36')][_0xa752('0x2e')](this));ami['on'](_0xa752('0x37'),this[_0xa752('0x38')]['bind'](this));ami['on']('queuemember',this[_0xa752('0x39')]['bind'](this));ami['on'](_0xa752('0x3a'),this[_0xa752('0x3b')][_0xa752('0x2e')](this));this[_0xa752('0x3c')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x575347){previewRecallmeReminderInterval=_0x575347[_0xa752('0x3d')];});}function isNotNull(_0x57d950){return _0x57d950!==null&&!_[_0xa752('0x3e')](_0x57d950);}function msgResponse(_0x912318,_0x1785ed,_0x1275c2){return{'action':_0x912318,'response':_0x1785ed,'message':_0x1275c2,'stack':_0x1275c2};}function emit(_0x1782d6,_0x5361b6,_0x13d275){io['to'](_0x1782d6)[_0xa752('0x3f')](_0x5361b6,_0x13d275);}function emitOutboundVoiceQueueSummary(_0x201449){if(_0x201449[_0xa752('0x40')]===_0xa752('0x41')){logger[_0xa752('0x42')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xa752('0x43')](_0x201449,{'showHidden':![],'depth':null}));emit(util[_0xa752('0x44')](_0xa752('0x45'),_0x201449[_0xa752('0x46')]),_0xa752('0x47'),_0x201449);}}function checkGetDataPredictive(_0x403264){if(isNotNull(_0x403264)&&!_[_0xa752('0x48')](_0x403264)){loggerPredictive[_0xa752('0x49')](_0xa752('0x4a'));loggerPredictive[_0xa752('0x49')](_0xa752('0x4b'),_0x403264[_0xa752('0x4c')]);loggerPredictive[_0xa752('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x403264['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xa752('0x49')](_0xa752('0x4d'),_0x403264[_0xa752('0x4e')]);loggerPredictive[_0xa752('0x49')](_0xa752('0x4f'),_0x403264[_0xa752('0x50')]);loggerPredictive['info'](_0xa752('0x51'),_0x403264['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x403264[_0xa752('0x52')]);loggerPredictive[_0xa752('0x49')](_0xa752('0x53'));if(_0x403264[_0xa752('0x4c')]>0x0){if(!_[_0xa752('0x3e')](_0x403264[_0xa752('0x52')])&&_0x403264['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xa752('0x49')](_0xa752('0x54'));if(!_['isUndefined'](_0x403264[_0xa752('0x55')])&&_0x403264[_0xa752('0x55')]>0x0){return!![];}loggerPredictive[_0xa752('0x49')](_0xa752('0x56'));}else{loggerPredictive[_0xa752('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xa752('0x49')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x44e380){return function(_0xe3baf6){loggerPredictive[_0xa752('0x49')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xa752('0x49')](_0xa752('0x57'),_0xe3baf6[_0xa752('0x58')]);loggerPredictive[_0xa752('0x49')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe3baf6['erlangCallToSecond']);loggerPredictive[_0xa752('0x49')](_0xa752('0x59'),_0xe3baf6['erlangAbandonmentRate']);loggerPredictive[_0xa752('0x49')](_0xa752('0x5a'),_0xe3baf6[_0xa752('0x5b')]);loggerPredictive[_0xa752('0x49')](_0xa752('0x59'),_0xe3baf6[_0xa752('0x5c')]);loggerPredictive['info']('---------------------------');_[_0xa752('0x5d')](_0x44e380,_0xe3baf6);};}function ifInterval(_0x1e4ed4,_0xfb3799){if(_['isUndefined'](_0xfb3799)){return![];}return utils['getSeconds'](undefined,_0xfb3799)<_0x1e4ed4*0x3c;}function clearPredictiveAttributes(_0x3c4653){if(_0x3c4653[_0xa752('0x28')]){_0x3c4653[_0xa752('0x28')]=undefined;loggerPredictive[_0xa752('0x42')](_0x3c4653[_0xa752('0x46')],_0xa752('0x5e'));}if(_0x3c4653[_0xa752('0x27')]){_0x3c4653[_0xa752('0x27')]=undefined;loggerPredictive['debug'](_0x3c4653['name'],_0xa752('0x5f'));}if(_0x3c4653[_0xa752('0x60')]){clearInterval(_0x3c4653[_0xa752('0x60')]);_0x3c4653[_0xa752('0x60')]=undefined;loggerPredictive[_0xa752('0x42')](_0x3c4653[_0xa752('0x46')],_0xa752('0x61'));}}function loggerCatchPredictive(_0x9309bd,_0x4bbaa6){return function(_0x3c3905){loggerPredictive[_0xa752('0x62')](_0x4bbaa6[_0xa752('0x46')],_0x9309bd);loggerPredictive[_0xa752('0x62')](_0x3c3905[_0xa752('0x63')]);clearPredictiveAttributes(_0x4bbaa6);};}function loggerCatch(_0x44d4f3){return function(_0x3ea42f){logger[_0xa752('0x62')](_0x44d4f3,util[_0xa752('0x43')](_0x3ea42f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x39fa51){return function(_0x1f5f32){if(isNotNull(_0x1f5f32)&&isNotNull(_0x1f5f32[0x0])){if(_0x1f5f32[0x0][_0xa752('0x64')]>0x0){_0x39fa51[_0xa752('0x65')]=utils['CAMPAIGN_STATUS'][_0xa752('0x66')];logger[_0xa752('0x49')](_0xa752('0x67')+_0x39fa51[_0xa752('0x46')],_0x1f5f32[0x0][_0xa752('0x64')],_0xa752('0x68'));}else{_0x39fa51['message']=utils['CAMPAIGN_STATUS'][_0xa752('0x69')];logger[_0xa752('0x49')](_0xa752('0x6a')+_0x39fa51['name']);}}};}function createObjHistory(_0x71a097,_0x1d9aba,_0x4de8b6,_0x240c57,_0x463f10){_0x71a097[_0xa752('0x65')]=_0x4de8b6;var _0x440391=new Action(_0x71a097,_0x1d9aba);var _0xb244f6=new History(_0x440391);_0xb244f6[_0xa752('0x6b')]=_0x240c57;_0xb244f6[_0xa752('0x6c')]=_0x463f10;_0xb244f6[_0xa752('0x6d')]=_0x440391['starttime'];return _0xb244f6;}function unlockQueueStatus(_0x372f9c,_0x59b9e3){setTimeout(function(){if(_[_0xa752('0x3e')](_0x372f9c[_0xa752('0x6e')])){loggerBooked[_0xa752('0x62')](_0xa752('0x6f'),_0x59b9e3);}_0x372f9c[_0xa752('0x6e')]=!![];loggerBooked[_0xa752('0x49')](_0xa752('0x70'),_0x59b9e3,JSON['stringify'](_[_0xa752('0x71')](_0x372f9c,[_0xa752('0x46'),_0xa752('0x6e')])));},0x1f3);}function checkInterval(_0x32820b){return function(){if(!isNotNull(_0x32820b[_0xa752('0x72')])){_0x32820b['message']=utils[_0xa752('0x73')][_0xa752('0x74')];throw _0x32820b[_0xa752('0x46')]+_0xa752('0x75');}if(!isNotNull(_0x32820b['Interval']['Intervals'])){_0x32820b[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x74')];throw _0x32820b['name']+_0xa752('0x75');}if(!isNotNull(_['isEmpty'](_0x32820b[_0xa752('0x72')][_0xa752('0x76')]))){_0x32820b[_0xa752('0x65')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x32820b[_0xa752('0x46')]+_0xa752('0x75');}};}function checkIsIVRCampaignActive(_0x254215){return function(){if(!utils['isIVRCampaignActive'](_0x254215)){_0x254215[_0xa752('0x65')]=utils[_0xa752('0x73')]['INACTIVE'];throw _0x254215[_0xa752('0x46')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x37aedf){if(utils['isIVRCampaign'](_0x37aedf)){emit(util['format'](_0xa752('0x77'),_0x37aedf[_0xa752('0x46')]),_0xa752('0x78'),_0x37aedf);}}function loggerCatchQueueSummary(_0x27a6fb,_0x50bbf2){return function(_0x3a6779){clearPredictiveAttributes(_0x50bbf2);emitCampaignSummary(_0x50bbf2);loggerSyncQueueSummary[_0xa752('0x42')](_0x27a6fb,util[_0xa752('0x43')](_0x3a6779,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3c9071){if(_0x3c9071[_0xa752('0x79')]){if(_0x3c9071[_0xa752('0x7a')]===0x0){_0x3c9071['sendMessageOneNotActive']=![];_0x3c9071[_0xa752('0x65')]=utils['CAMPAIGN_STATUS'][_0xa752('0x7b')];loggerSyncQueueSummary[_0xa752('0x42')](_0xa752('0x7c'),_0x3c9071[_0xa752('0x46')],_0xa752('0x7d'));}else{_0x3c9071[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x7e')];loggerSyncQueueSummary[_0xa752('0x42')](_0xa752('0x7c'),_0x3c9071[_0xa752('0x46')],_0xa752('0x7f'));}emitCampaignSummary(_0x3c9071);}}function myreject(_0x566846){return function(_0x1ed648){return _0x566846(msgResponse(_0xa752('0x80'),'Error',JSON[_0xa752('0x81')](_0x1ed648)));};}Dialer['prototype'][_0xa752('0x82')]=function(_0x1f46be){return!_[_0xa752('0x3e')](_0x1f46be)&&_0x1f46be&&!_[_0xa752('0x3e')](_0x1f46be[_0xa752('0x46')])&&!_[_0xa752('0x3e')](_0x1f46be[_0xa752('0x83')])&&_0x1f46be[_0xa752('0x83')]&&(this['trunks'][util[_0xa752('0x44')](_0xa752('0x84'),_0x1f46be['name'])][_0xa752('0x85')]==='reachable'||this['trunks'][util[_0xa752('0x44')](_0xa752('0x84'),_0x1f46be[_0xa752('0x46')])][_0xa752('0x85')]===_0xa752('0x86'));};Dialer[_0xa752('0x19')][_0xa752('0x87')]=function(_0x2bfccd){var _0x5ba4e1=this;return function(){if(!_0x5ba4e1[_0xa752('0x82')](_0x2bfccd[_0xa752('0x88')])){if(!_0x5ba4e1[_0xa752('0x82')](_0x2bfccd[_0xa752('0x89')])){_0x2bfccd['message']=utils[_0xa752('0x73')][_0xa752('0x8a')];throw _0x2bfccd[_0xa752('0x46')]+_0xa752('0x8b');}}};};Dialer['prototype'][_0xa752('0x8c')]=function(_0x4d2819,_0x2b6c22,_0x12f7f9,_0x994fa3){var _0x212359=this;return function(){var _0x522372=!![];return _0x212359[_0xa752('0x8d')](_0x4d2819,_0x2b6c22,_0x12f7f9,_0x994fa3,_0x522372);};};Dialer[_0xa752('0x19')][_0xa752('0x8e')]=function(_0x3d9f23,_0x38eb74,_0xbb5c41,_0x470839){var _0xc60525=this;return function(){var _0x43ca86=![];return _0xc60525[_0xa752('0x8d')](_0x3d9f23[_0xa752('0x76')],_0x38eb74,_0xbb5c41,_0x470839,_0x43ca86);};};Dialer['prototype'][_0xa752('0x8d')]=function(_0x4674e5,_0x3be7c0,_0x365c5d,_0xbee7e1,_0x1681b6){var _0x57e4fe=[];return new Promise(function(_0x53efc6,_0x1da945){if(!isNotNull(_0x4674e5)){_0xbee7e1[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x74')];return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),_0x365c5d+_0xa752('0x91')));}if(_[_0xa752('0x48')](_0x4674e5)){_0xbee7e1['message']=utils[_0xa752('0x73')]['EMPTY_INTERVAL'];return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),_0x365c5d+_0xa752('0x92')));}if(_0x3be7c0&&_[_0xa752('0x3e')](config[_0xa752('0x93')][_0x3be7c0])){_0xbee7e1[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x94')];return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),_0x365c5d+_0xa752('0x95')+_0x3be7c0));}if(_['isArray'](_0x4674e5)){for(var _0x31c6bd=0x0;_0x31c6bd<_0x4674e5['length'];_0x31c6bd+=0x1){_0x57e4fe[_0xa752('0x96')](ami['Action']({'action':'command','command':util[_0xa752('0x44')](_0xa752('0x97'),_0x4674e5[_0x31c6bd][_0xa752('0x98')],!_[_0xa752('0x3e')](config[_0xa752('0x93')][_0x3be7c0])?_0x3be7c0:'')})[_0xa752('0x99')](function(_0x346ba6){return _0x346ba6[_0xa752('0x9a')][_0xa752('0x9b')](_0xa752('0x9c'))>=0x0;})[_0xa752('0x9d')](myreject(_0x1da945)));}}else{_0x57e4fe[_0xa752('0x96')](ami[_0xa752('0x9e')]({'action':'command','command':util[_0xa752('0x44')](_0xa752('0x97'),_0x4674e5,!_[_0xa752('0x3e')](config['timezones'][_0x3be7c0])?_0x3be7c0:'')})[_0xa752('0x99')](function(_0x246f04){return _0x246f04[_0xa752('0x9a')][_0xa752('0x9b')](_0xa752('0x9c'))>=0x0;})[_0xa752('0x9d')](myreject(_0x1da945)));}Promise[_0xa752('0x9f')](_0x57e4fe)[_0xa752('0x99')](function(_0x44b4c4){var _0x1c9103=_[_0xa752('0xa0')](_0x44b4c4);if(_0x1c9103){return _0x53efc6(_0x1c9103);}else{_0xbee7e1['message']=_0x1681b6?utils[_0xa752('0x73')][_0xa752('0xa1')]:utils['CAMPAIGN_STATUS'][_0xa752('0xa2')];return _0x1da945(msgResponse(_0xa752('0xa3'),'Failure',_0xa752('0xa4')+_0x1681b6+'\x20'+_0x365c5d+_0xa752('0xa5')+util[_0xa752('0x43')](_0x4674e5,{'showHidden':![],'depth':null})+_0xa752('0xa6')+_0x3be7c0));}})[_0xa752('0x9d')](function(_0x363248){return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),JSON[_0xa752('0x81')](_0x363248)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x3e12a2=this;return cmHopper[_0xa752('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0xa752('0x99')](function(){setInterval(function(){_0x3e12a2[_0xa752('0xa8')]();},0x3e8);});};Dialer[_0xa752('0x19')][_0xa752('0xa8')]=function(){var _0x513c56=this;var _0x330acd;for(var _0x3eb63a in this['campaigns']){if(typeof this['campaigns'][_0x3eb63a]!=='undefined'){_0x330acd=this['campaigns'][_0x3eb63a];if(utils[_0xa752('0xa9')](_0x330acd)&&utils[_0xa752('0xaa')](_0x330acd)){_0x330acd['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xa752('0x99')](checkIsIVRCampaignActive(_0x330acd))['then'](checkInterval(_0x330acd))[_0xa752('0x99')](_0x513c56[_0xa752('0x87')](_0x330acd))['then'](_0x513c56[_0xa752('0x8c')](_0x330acd[_0xa752('0xab')],_0x330acd[_0xa752('0xac')],_0x330acd[_0xa752('0x46')],_0x330acd))['then'](_0x513c56[_0xa752('0x8e')](_0x330acd[_0xa752('0x72')],_0x330acd[_0xa752('0xac')],_0x330acd['name'],_0x330acd))[_0xa752('0x99')](_0x513c56['launchHandleIvr'](_0x330acd))['catch'](loggerCatchQueueSummary(_0xa752('0xad'),_0x330acd));}else{notSendMessagesCampaign(_0x330acd);}}}};Dialer['prototype']['checkDialMethod']=function(_0x4a10cc){if(_0x4a10cc[_0xa752('0xae')]!==_0xa752('0xb')){clearPredictiveAttributes(_0x4a10cc);}switch(_0x4a10cc[_0xa752('0xae')]){case'progressive':this[_0xa752('0xaf')](_0x4a10cc,0x1);break;case _0xa752('0xb0'):this[_0xa752('0xaf')](_0x4a10cc,_0x4a10cc[_0xa752('0xb1')]);break;case'predictive':this[_0xa752('0xb')](_0x4a10cc);break;case _0xa752('0xa'):this['handlePower'](_0x4a10cc,0x1);break;default:logger[_0xa752('0x62')](_0xa752('0xb2'),_0x4a10cc[_0xa752('0x46')],'method\x20not\x20recognized');}};Dialer[_0xa752('0x19')][_0xa752('0x8f')]=function(_0x1b8534,_0x5ac707){var _0x1edc21=_0x1b8534[_0xa752('0xac')];var _0x332c35=_0x5ac707?_0x1b8534[_0xa752('0xab')]:_0x1b8534[_0xa752('0x72')][_0xa752('0x76')];logger[_0xa752('0xb3')](_0xa752('0xb4'),_0x332c35,_0x1edc21,_0x1b8534['name'],util[_0xa752('0x44')]('Voice\x20Queue\x20%s\x20$s',_0x1b8534[_0xa752('0x46')],_0x1b8534['id']));var _0x4d8256=null;return Interval[_0xa752('0xb5')](_0x332c35,_0x1edc21)[_0xa752('0x99')](function(_0x3f7427){if(_0x3f7427===!![]){return _0x3f7427;}else{_0x1b8534[_0xa752('0x65')]=_0x5ac707?utils[_0xa752('0x73')][_0xa752('0xa1')]:utils[_0xa752('0x73')][_0xa752('0xa2')];_0x4d8256=msgResponse(_0xa752('0xa3'),_0xa752('0x90'),'Global:\x20'+_0x5ac707+'\x20'+_0x1b8534[_0xa752('0x46')]+_0xa752('0xa5')+util[_0xa752('0x43')](_0x332c35,{'showHidden':![],'depth':null})+_0xa752('0xa6')+_0x1edc21);}if(_0x4d8256!==null){logger[_0xa752('0xb3')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x4d8256);_0x4d8256[_0xa752('0xb6')]=_0x5ac707;throw _0x4d8256;}})[_0xa752('0x9d')](function(_0x21a7ea){logger[_0xa752('0x62')](_0xa752('0xb7'),_0x21a7ea);throw msgResponse(_0xa752('0x80'),'Error',util[_0xa752('0x43')](_0x21a7ea,{'showHidden':![],'depth':null}));});};Dialer[_0xa752('0x19')][_0xa752('0xb8')]=function(_0x5ebecd){if(this['voiceQueues'][_0x5ebecd[_0xa752('0xb9')]]){if(this[_0xa752('0xba')][_0x5ebecd[_0xa752('0xbb')]]&&this[_0xa752('0xba')][_0x5ebecd[_0xa752('0xbb')]][_0xa752('0x40')]!==_0xa752('0xbc')){utils[_0xa752('0xbd')](this[_0xa752('0x1e')][_0x5ebecd[_0xa752('0xb9')]],_0xa752('0xbe'));this['uniqueId'][_0x5ebecd[_0xa752('0xbb')]][_0xa752('0xbf')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));}}};Dialer[_0xa752('0x19')][_0xa752('0x32')]=function(_0x5b4c79){var _0x3a271c=this['uniqueId'][_0x5b4c79[_0xa752('0xbb')]];if(this[_0xa752('0x1e')][_0x5b4c79[_0xa752('0xb9')]]){if(_0x3a271c&&_0x3a271c[_0xa752('0x40')]!==_0xa752('0xbc')){delete this[_0xa752('0xba')][_0x5b4c79[_0xa752('0xbb')]];this[_0xa752('0x1e')][_0x5b4c79[_0xa752('0xb9')]][_0xa752('0xc1')]+=0x1;var _0xaa71a=new AgentComplete(_0x3a271c,_0x5b4c79);if(_0x5b4c79['reason']===_0xa752('0xc2')){_0xaa71a['agiafterat']=this[_0xa752('0x1e')][_0x5b4c79[_0xa752('0xb9')]][_0xa752('0xc3')]&&this['voiceQueues'][_0x5b4c79[_0xa752('0xb9')]][_0xa752('0xc4')]?moment()[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0xaa71a)[_0xa752('0x9d')](loggerCatch(_0xa752('0xc5')));hopperUtils['moveContactManagedDialer'](_0xaa71a)['catch'](loggerCatch(_0xa752('0xc6')));}}};Dialer[_0xa752('0x19')][_0xa752('0x30')]=function(_0x3fa6b5){var _0x5eda7e=this[_0xa752('0xba')][_0x3fa6b5[_0xa752('0xbb')]];var _0x1356ec=this;var _0x119ebd=![];var _0x2d5a70;var _0x109f12;if(this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]){if(_0x5eda7e&&_0x5eda7e['type']!==_0xa752('0xbc')){delete this[_0xa752('0xba')][_0x3fa6b5[_0xa752('0xbb')]];utils[_0xa752('0xbd')](this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]],_0xa752('0xc7'));_0x5eda7e[_0xa752('0xc8')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));var _0x1a444c=new QueueCallerAbandon(_0x5eda7e,_0x3fa6b5);if(utils[_0xa752('0xc9')](_0x5eda7e[_0xa752('0xc8')],_0x5eda7e['responsetime'])>=_0x5eda7e[_0xa752('0xca')]){this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0x4e')]+=0x1;this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xa752('0x1e')][_0x3fa6b5['queue']][_0xa752('0xcb')]+=0x1;_0x1a444c['state']=0xa;_0x1a444c['statedesc']=_0xa752('0xcc');_0x1a444c[_0xa752('0xcd')]='TIMEOUT';_0x1a444c[_0xa752('0xce')]=this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xc3')]?moment()[_0xa752('0x44')](_0xa752('0xc0')):undefined;_0x1a444c[_0xa752('0xcf')]+=0x1;_0x1a444c['countglobal']+=0x1;_0x2d5a70=this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xd0')];_0x109f12=this[_0xa752('0x1e')][_0x3fa6b5['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xa752('0xd1')](_0x1a444c,_0x1a444c[_0xa752('0x6b')],_0x5eda7e[_0xa752('0xd2')])[_0xa752('0x99')](function(_0x3504cd){_0x119ebd=_0x3504cd[_0xa752('0xd3')]==0x1;if(_0x1a444c[_0xa752('0xcf')]>=_0x1356ec['voiceQueues'][_0x3fa6b5[_0xa752('0xb9')]]['dialDropMaxRetry']){_0x1356ec[_0xa752('0xd4')](_0x1a444c,_0x3504cd['additional']);}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countdropretry':_0x1a444c[_0xa752('0xcf')],'scheduledat':moment()[_0xa752('0xd6')](_0x1356ec[_0xa752('0x1e')][_0x3fa6b5['queue']]['dialDropRetryFrequency'],_0xa752('0xd7'))['format'](_0xa752('0xc0')),'ContactId':_0x5eda7e[_0xa752('0xd8')],'ListId':_0x5eda7e[_0xa752('0xd9')],'VoiceQueueId':_0x5eda7e['VoiceQueueId']||undefined,'CampaignId':_0x5eda7e[_0xa752('0xda')]||undefined})['catch'](loggerCatch(_0xa752('0xdb')));var _0x410fad=new History(_0x1a444c);_0x410fad[_0xa752('0x6b')]=0xa;_0x410fad['statedesc']='Drop';_0x410fad['starttime']=moment()[_0xa752('0x44')](_0xa752('0xc0'));_0x410fad[_0xa752('0x6d')]=_0x410fad['starttime'];_0x410fad[_0xa752('0xdc')]=_0x1a444c['calleridname'];_0x410fad[_0xa752('0xdd')]=_0x1a444c[_0xa752('0xdd')];hopperUtils['createHistory'](_0x410fad)['catch'](loggerCatch(_0xa752('0xde')));}})['then'](function(){if(_0x119ebd)hopperUtils['swapAdditionalPhones'](_0x1a444c,_0x2d5a70,_0x109f12)['then'](function(){return 0x1;});});}else{this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xdf')]+=0x1;_0x1a444c['state']=0xb;_0x1a444c[_0xa752('0x6c')]=_0xa752('0xe0');_0x1a444c[_0xa752('0xcd')]=_0xa752('0xe1');_0x1a444c[_0xa752('0xe2')]+=0x1;_0x1a444c[_0xa752('0xe3')]+=0x1;_0x2d5a70=this[_0xa752('0x1e')][_0x3fa6b5['queue']]['dialAbandonedRetryFrequency'];_0x109f12=this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xe4')];hopperUtils['verifyAdditionalPhones'](_0x1a444c,_0x1a444c['state'],_0x5eda7e[_0xa752('0xd2')])['then'](function(_0xa4e9ee){if(_0x1a444c['countabandonedretry']>=_0x1356ec[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]['dialAbandonedMaxRetry']){_0x1356ec[_0xa752('0xd4')](_0x1a444c,_0xa4e9ee[_0xa752('0xd3')]);}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countabandonedretry':_0x1a444c[_0xa752('0xe2')],'scheduledat':moment()[_0xa752('0xd6')](_0x1356ec['voiceQueues'][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xe5')],_0xa752('0xd7'))[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5eda7e['ContactId'],'ListId':_0x5eda7e[_0xa752('0xd9')],'VoiceQueueId':_0x5eda7e[_0xa752('0xe6')]||undefined,'CampaignId':_0x5eda7e[_0xa752('0xda')]||undefined})['catch'](loggerCatch(_0xa752('0xe7')));var _0x250d58=new History(_0x1a444c);_0x250d58['state']=0xb;_0x250d58[_0xa752('0x6c')]='Abandoned';_0x250d58[_0xa752('0xe8')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));_0x250d58[_0xa752('0x6d')]=_0x250d58[_0xa752('0xe8')];_0x250d58[_0xa752('0xdc')]=_0x1a444c[_0xa752('0xdc')];_0x250d58[_0xa752('0xdd')]=_0x1a444c[_0xa752('0xdd')];hopperUtils[_0xa752('0xe9')](_0x250d58)[_0xa752('0x9d')](loggerCatch(_0xa752('0xea')));}})[_0xa752('0x99')](function(){if(_0x119ebd)hopperUtils[_0xa752('0xeb')](_0x1a444c,_0x2d5a70,_0x109f12)[_0xa752('0x99')](function(){return 0x1;});});}}}};Dialer[_0xa752('0x19')][_0xa752('0x36')]=function(_0x1ef40c){if(this[_0xa752('0x24')][_0x1ef40c[_0xa752('0xbb')]]){this[_0xa752('0x24')][_0x1ef40c[_0xa752('0xbb')]]['channel']=_0x1ef40c[_0xa752('0xec')];}if(this[_0xa752('0xba')][_0x1ef40c[_0xa752('0xbb')]]){this[_0xa752('0xba')][_0x1ef40c['uniqueid']][_0xa752('0xec')]=_0x1ef40c[_0xa752('0xec')];}};Dialer[_0xa752('0x19')][_0xa752('0x39')]=function(_0x29dcae){if(!this[_0xa752('0x24')][_0x29dcae['actionid']]){return;}var _0x40427e=this['voiceQueues'][this['actions'][_0x29dcae[_0xa752('0xed')]][_0xa752('0xb9')]][_0xa752('0xee')]||'rrmemory';if(_0x40427e===_0xa752('0xef')){if(this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]]&&_[_0xa752('0xf0')](this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xf1')])&&_0x29dcae[_0xa752('0x85')]==='1'&&_0x29dcae['paused']==='0'){if(this[_0xa752('0x20')][_0x29dcae[_0xa752('0xf2')]]){if(!this[_0xa752('0x20')][_0x29dcae[_0xa752('0xf2')]][_0xa752('0xf1')]){this[_0xa752('0x20')][_0x29dcae['stateinterface']][_0xa752('0xf1')]=!![];this['actions'][_0x29dcae[_0xa752('0xed')]][_0xa752('0xf1')]=!![];this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xf2')]=_0x29dcae[_0xa752('0xf2')];}}}}else if(_0x40427e===_0xa752('0xf3')){if(this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]]){if(this[_0xa752('0x20')][_0x29dcae[_0xa752('0xf2')]]){this['actions'][_0x29dcae[_0xa752('0xed')]]['stateinterface']=_0x29dcae[_0xa752('0xf2')];if(_[_0xa752('0xf0')](this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xb9')]])){this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]]['queue']]=[];}this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xb9')]][_0xa752('0x96')](_[_0xa752('0x5d')](_['pick'](this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]],[_0xa752('0xf4'),_0xa752('0xf2')]),{'status':_0x29dcae[_0xa752('0x85')],'paused':_0x29dcae['paused']}));}}}};Dialer[_0xa752('0x19')]['syncQueueStatusComplete']=function(_0x2b2653){if(!this[_0xa752('0x24')][_0x2b2653['actionid']]){return;}var _0x598c23=this;var _0x4f2762=this['voiceQueues'][this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xb9')]];var _0x251167=_0x4f2762[_0xa752('0xee')]||_0xa752('0xf3');if(_0x251167===_0xa752('0xef')){if(this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]&&this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xf2')]){this['preview']['run'](this['actions'][_0x2b2653[_0xa752('0xed')]][_0xa752('0xf4')],this['actions'][_0x2b2653[_0xa752('0xed')]][_0xa752('0xf2')])[_0xa752('0x9d')](function(_0x48f8dd){logger[_0xa752('0x62')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x48f8dd,{'showHidden':![],'depth':null}));})['finally'](function(){utils['decrementOriginate'](_0x598c23[_0xa752('0x1e')][_0x598c23[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]],'[syncQueueStatusComplete]');_0x598c23[_0xa752('0x20')][_0x598c23[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['stateinterface']]['locked']=![];delete _0x598c23['actions'][_0x2b2653[_0xa752('0xed')]];unlockQueueStatus(_0x4f2762);});}else{utils[_0xa752('0xbd')](this[_0xa752('0x1e')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]],_0xa752('0xf5'));hopperUtils[_0xa752('0xd5')]({'active':![],'ContactId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xd8')],'ListId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xd9')],'VoiceQueueId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x2b2653[_0xa752('0xed')]];unlockQueueStatus(_0x4f2762);}}else if(_0x251167===_0xa752('0xf3')){var _0x4b0dd5;if(this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]&&!_[_0xa752('0x48')](this['queueBooked'][this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xb9')]])){if(this[_0xa752('0x2b')][_0x598c23[_0xa752('0x24')][_0x2b2653['actionid']]['queue']]){this[_0xa752('0x2b')][_0x598c23[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['queue']]=this[_0xa752('0x2b')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]]?this[_0xa752('0x2b')][this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xb9')]]:this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]]?this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['queue']][_0xa752('0xf6')]||0x0:0x0;}this['queueBooked'][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]][_0xa752('0xf6')]=this[_0xa752('0x2b')][this[_0xa752('0x24')][_0x2b2653['actionid']]['queue']];for(var _0x27ec4b=0x0;_0x27ec4b=_0x3823ee[_0xa752('0x122')]){_0x36a2c3[_0xa752('0x123')](_0x108b5b,_0x5c88f5,_0x22b2e1,_0xa752('0x124'));}else{if(_0x108b5b[_0xa752('0x120')]>=_0x3823ee[_0xa752('0x125')]){_0x36a2c3['createStateFinal'](_0x108b5b,_0x5c88f5,_0x22b2e1,_0xa752('0x126'));}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countmachineretry':_0x108b5b['countmachineretry'],'scheduledat':moment()[_0xa752('0xd6')](_0x3823ee[_0xa752('0x127')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0x108b5b[_0xa752('0xd8')],'ListId':_0x108b5b['ListId'],'VoiceQueueId':_0x108b5b[_0xa752('0xe6')]||undefined,'CampaignId':_0x108b5b[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x128')));_0x5c88f5({'reschedule':0x1});}}});}if(_0x446515['type']==='ivr'&&this[_0xa752('0x1f')][_0x446515[_0xa752('0xb9')]]['dialAMDActive']&&_0x310db9[_0xa752('0x10d')]===_0xa752('0x129')){delete this[_0xa752('0xba')][_0x310db9[_0xa752('0xbb')]];utils['decrementOriginate'](this['campaigns'][_0x446515[_0xa752('0xb9')]],_0xa752('0x10e'));_0x4a7ddb=new Hangup(_0x446515,_0x310db9);_0x4a7ddb[_0xa752('0x6b')]=0x12;_0x4a7ddb[_0xa752('0x6c')]=_0xa752('0x10f');_0x4a7ddb['membername']=_0xa752('0x111');ami[_0xa752('0x3f')](_0xa752('0x112'),ut[_0xa752('0x113')](_0x4a7ddb,_0xa752('0x114')));this[_0xa752('0x115')](_0x4a7ddb,'[syncHangupInAMDIvr][createHistory]',_0xa752('0x12a'));}if(_0x446515[_0xa752('0x40')]==='ivr'&&this[_0xa752('0x1f')][_0x446515['queue']][_0xa752('0x10c')]&&_0x310db9[_0xa752('0x10d')]===_0xa752('0x118')){return new Promise(function(_0x481fd8,_0x4f6e9a){delete _0x36a2c3['uniqueId'][_0x310db9[_0xa752('0xbb')]];utils['decrementOriginate'](_0x36a2c3['campaigns'][_0x446515[_0xa752('0xb9')]],'[syncVarSet]');_0x36a2c3[_0xa752('0x1f')][_0x446515[_0xa752('0xb9')]][_0xa752('0xc1')]+=0x1;_0x36a2c3[_0xa752('0x1f')][_0x446515['queue']][_0xa752('0x119')]+=0x1;var _0x4c497e=_0x36a2c3[_0xa752('0x1f')][_0x446515['queue']];var _0x3989f0=new Hangup(_0x446515,_0x310db9);_0x3989f0[_0xa752('0x6b')]=0x13;_0x3989f0['statedesc']=_0xa752('0x11a');_0x3989f0[_0xa752('0x110')]='AMD';_0x3989f0[_0xa752('0x120')]+=0x1;_0x3989f0[_0xa752('0xe3')]+=0x1;_0x3989f0[_0xa752('0x114')]=!![];ami[_0xa752('0x3f')](_0xa752('0x112'),ut[_0xa752('0x113')](_0x3989f0,'amd'));hopperUtils[_0xa752('0xe9')](_0x3989f0)[_0xa752('0x9d')](loggerCatch(_0xa752('0x11b')));if(_0x3989f0['countbusyretry']+_0x3989f0[_0xa752('0x11d')]+_0x3989f0[_0xa752('0x11e')]+_0x3989f0[_0xa752('0x11f')]+_0x3989f0['countdropretry']+_0x3989f0[_0xa752('0xe2')]+_0x3989f0[_0xa752('0x120')]+_0x3989f0[_0xa752('0x121')]>=_0x4c497e['dialGlobalMaxRetry']){_0x36a2c3[_0xa752('0x123')](_0x3989f0,_0x481fd8,_0x4f6e9a,'reason19\x20machine....');}else{if(_0x3989f0[_0xa752('0x120')]>=_0x4c497e[_0xa752('0x125')]){_0x36a2c3[_0xa752('0x12b')](_0x3989f0,_0x481fd8,_0x4f6e9a,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3989f0[_0xa752('0x120')],'scheduledat':moment()['add'](_0x4c497e[_0xa752('0x127')],'minutes')[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3989f0[_0xa752('0xd8')],'ListId':_0x3989f0['ListId'],'VoiceQueueId':_0x3989f0[_0xa752('0xe6')]||undefined,'CampaignId':_0x3989f0[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x128')));_0x481fd8({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x5a69d2){var _0x1a0347=this[_0xa752('0xba')][_0x5a69d2[_0xa752('0xbb')]];var _0x283cdd;if(!_0x1a0347){return;}if(_0x1a0347[_0xa752('0x40')]===_0xa752('0xbc')){delete this[_0xa752('0xba')][_0x5a69d2['uniqueid']];utils[_0xa752('0xbd')](this[_0xa752('0x1f')][_0x1a0347[_0xa752('0xb9')]],_0xa752('0x12c'));this['campaigns'][_0x1a0347[_0xa752('0xb9')]][_0xa752('0x12d')]+=0x1;if(_0x5a69d2['cause-txt']==='Normal\x20Clearing'){const _0x524790=new AgentComplete(_0x1a0347,_0x5a69d2);_0x524790[_0xa752('0xda')]=this[_0xa752('0x1f')][_0x1a0347[_0xa752('0xb9')]]['id'];hopperUtils[_0xa752('0xe9')](_0x524790)[_0xa752('0x9d')](loggerCatch(_0xa752('0x12e')));hopperUtils[_0xa752('0x12f')](_0x524790)[_0xa752('0x9d')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x283cdd=new Hangup(_0x1a0347,_0x5a69d2);hopperUtils['createHistory'](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x130')));hopperUtils[_0xa752('0x12f')](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x131')));}}else{if(isNotNull(this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]][_0xa752('0x132')])){delete this[_0xa752('0xba')][_0x5a69d2[_0xa752('0xbb')]];utils[_0xa752('0xbd')](this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]],_0xa752('0x12c'));this[_0xa752('0x1e')][_0x1a0347['queue']][_0xa752('0xc1')]+=0x1;this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]][_0xa752('0x119')]+=0x1;_0x283cdd=new Hangup(_0x1a0347,_0x5a69d2);_0x283cdd[_0xa752('0x6b')]=0x10;_0x283cdd['statedesc']='AnswerAGI';_0x283cdd[_0xa752('0x110')]=_0xa752('0x133');hopperUtils[_0xa752('0xe9')](_0x283cdd)['catch'](loggerCatch(_0xa752('0x130')));hopperUtils[_0xa752('0x12f')](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x131')));}else{delete this[_0xa752('0xba')][_0x5a69d2[_0xa752('0xbb')]];utils['decrementOriginate'](this[_0xa752('0x1e')][_0x1a0347['queue']],_0xa752('0x134'));if(_0x5a69d2[_0xa752('0x135')]===_0xa752('0x136')){this['voiceQueues'][_0x1a0347[_0xa752('0xb9')]][_0xa752('0xc1')]+=0x1;const _0x53d1ba=new AgentComplete(_0x1a0347,_0x5a69d2);_0x53d1ba[_0xa752('0xe6')]=this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]]['id'];hopperUtils[_0xa752('0xe9')](_0x53d1ba)[_0xa752('0x9d')](loggerCatch(_0xa752('0xc5')));hopperUtils[_0xa752('0x12f')](_0x53d1ba)[_0xa752('0x9d')](loggerCatch(_0xa752('0xc6')));}else{this['voiceQueues'][_0x1a0347['queue']][_0xa752('0x137')]+=0x1;_0x283cdd=new Hangup(_0x1a0347,_0x5a69d2);_0x283cdd['state']=0xc;_0x283cdd[_0xa752('0x6c')]=_0x5a69d2[_0xa752('0x135')];_0x283cdd[_0xa752('0x110')]='Unknown';hopperUtils[_0xa752('0xe9')](_0x283cdd)[_0xa752('0x9d')](loggerCatch('[syncHangup][createHistory]'));hopperUtils[_0xa752('0x12f')](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x12c')));}}}};Dialer[_0xa752('0x19')][_0xa752('0xc')]=function(_0x4baccf){var _0x5e4079=this;if(!_0x5e4079[_0xa752('0x2c')][_0x4baccf[_0xa752('0x46')]]){_0x5e4079[_0xa752('0x2c')][_0x4baccf[_0xa752('0x46')]]={'running':![]};}else if(_0x5e4079['queuesSummary'][_0x4baccf['name']][_0xa752('0x138')]===!![]){return;}else if(_0x5e4079[_0xa752('0x2c')][_0x4baccf[_0xa752('0x46')]][_0xa752('0x138')]===![]){_0x5e4079['queuesSummary'][_0x4baccf[_0xa752('0x46')]][_0xa752('0x138')]=!![];}var _0x1135f8=_0x5e4079[_0xa752('0x1e')][_0x4baccf[_0xa752('0x46')]];var _0x85a69a=_0x1135f8[_0xa752('0x65')]!==utils[_0xa752('0x73')][_0xa752('0x7b')];var _0x59de74=utils['isPreviewCampaign'](_0x1135f8);_0x1135f8[_0xa752('0x139')]=utils['getQueueCampaignStatusMessage'](_0x1135f8,_0x5e4079['trunks']);Promise['resolve']()['then'](function(){if(_0x1135f8[_0xa752('0x139')]===utils[_0xa752('0x73')][_0xa752('0x7b')]){if(_0x85a69a){clearPredictiveAttributes(_0x1135f8);_0x4baccf[_0xa752('0x27')]=undefined;_0x4baccf[_0xa752('0x28')]=undefined;}if(_0x1135f8['statusMessage']===utils[_0xa752('0x73')][_0xa752('0x7b')]){_0x4baccf[_0xa752('0x13a')]=0x0;_0x4baccf[_0xa752('0x13b')]=0x0;_0x4baccf[_0xa752('0x13c')]=0x0;_0x4baccf[_0xa752('0x13d')]=0x0;_0x4baccf[_0xa752('0x13e')]=0x0;}}else if(_0x1135f8['statusMessage']===utils[_0xa752('0x73')][_0xa752('0x13f')]&&!_0x59de74){return _0x5e4079[_0xa752('0x8f')](_0x1135f8,!![])[_0xa752('0x99')](function(){return _0x5e4079[_0xa752('0x8f')](_0x1135f8,![]);})[_0xa752('0x99')](function(){return _0x5e4079[_0xa752('0x140')](_0x1135f8);})[_0xa752('0x9d')](function(_0x5de342){loggerSyncQueueSummary[_0xa752('0x42')](_0xa752('0x141'),util[_0xa752('0x43')](_0x5de342,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1135f8);});}else{clearPredictiveAttributes(_0x1135f8);}})[_0xa752('0x99')](function(){var _0x2d9bc3=_0x4baccf[_0xa752('0x142')](_0x1135f8);if(_0x2d9bc3||_0x1135f8[_0xa752('0x143')]){_0x1135f8[_0xa752('0x143')]=![];_0x4baccf[_0xa752('0x144')](_0x1135f8);Object[_0xa752('0x145')](_0x1135f8,_0x4baccf);emitOutboundVoiceQueueSummary(_0x4baccf);}_0x5e4079[_0xa752('0x2c')][_0x1135f8[_0xa752('0x46')]]['running']=![];})[_0xa752('0x9d')](function(_0x2041e1){logger['error']('[syncQueueSummary]',util[_0xa752('0x43')](_0x2041e1,{'showHidden':![],'depth':null}));_0x5e4079[_0xa752('0x2c')][_0x1135f8[_0xa752('0x46')]]['running']=![];});};Dialer[_0xa752('0x19')][_0xa752('0x146')]=_[_0xa752('0x147')](function(){var _0x148cd8=_[_0xa752('0x148')](this[_0xa752('0x1e')],function(_0x119c02){return _0x119c02[_0xa752('0x149')];});var _0x168a20=_[_0xa752('0x148')](this[_0xa752('0x20')],function(_0x172367){return _0x172367[_0xa752('0x14a')]&&_0x172367['status']===_0xa752('0x14b');});if(_0x148cd8[_0xa752('0xf7')]>0x0&&_0x168a20[_0xa752('0xf7')]>0x0){return Promise[_0xa752('0x14c')]()[_0xa752('0x99')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x148cd8,'id'),previewRecallmeReminderInterval,_[_0xa752('0x14d')](_0x168a20,'id')))[_0xa752('0x99')](function(_0x334ce2){for(var _0x3ef904=0x0;_0x3ef904<_0x334ce2[_0xa752('0xf7')];_0x3ef904++){var _0x246b72=_0x334ce2[_0x3ef904][_0xa752('0x14e')][_0xa752('0x46')];if(_0x246b72)io['to'](util[_0xa752('0x44')](_0xa752('0x14f'),_0x246b72))['emit'](_0xa752('0x150'),{'hopper':_0x334ce2[_0x3ef904]});}})[_0xa752('0x9d')](function(_0x627cce){logger[_0xa752('0x62')]('checkPreviewRecallReminder',_0x627cce);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xa752('0x151')]=function(){var _0x2ec4c6=this;setInterval(function(){_0x2ec4c6[_0xa752('0x152')](_0x2ec4c6[_0xa752('0xba')],'[uniqueid]');_0x2ec4c6[_0xa752('0x152')](_0x2ec4c6[_0xa752('0x24')],_0xa752('0x153'));},0x32c8);};Dialer[_0xa752('0x19')]['clearZombieChannels']=function(_0x1d462d,_0x3467a3){var _0x482529=this;for(var _0x533ca9 in _0x1d462d){if(typeof _0x1d462d[_0x533ca9]!==_0xa752('0x154')){this['sequence'][_0xa752('0x155')](function(){if(!_['isNil'](_0x1d462d[_0x533ca9])){return ami[_0xa752('0x9e')]({'action':_0xa752('0x85'),'channel':_0x1d462d[_0x533ca9][_0xa752('0xec')]})[_0xa752('0x9d')](function(_0xe02a6e){if(_0xe02a6e[_0xa752('0x65')]===_0xa752('0x156')){setTimeout(function(){if(_0x1d462d[_0x533ca9]&&_0x1d462d[_0x533ca9][_0xa752('0x40')]!==_0xa752('0xbc')){utils[_0xa752('0xbd')](_0x482529[_0xa752('0x1e')][_0x1d462d[_0x533ca9]['queue']],'[clearZombieChannels]');logger[_0xa752('0x62')](_0xa752('0x157'),_0x3467a3,_0x533ca9,_0x1d462d[_0x533ca9]['queue']);delete _0x1d462d[_0x533ca9];}if(_0x1d462d[_0x533ca9]&&_0x1d462d[_0x533ca9]['type']==='ivr'){utils[_0xa752('0xbd')](_0x482529[_0xa752('0x1f')][_0x1d462d[_0x533ca9][_0xa752('0xb9')]],_0xa752('0x158'));logger[_0xa752('0x62')](_0xa752('0x159'),_0x3467a3,_0x533ca9,_0x1d462d[_0x533ca9][_0xa752('0xb9')]);delete _0x1d462d[_0x533ca9];}},0x2328);}});}});}}};Dialer[_0xa752('0x19')][_0xa752('0x15a')]=function(_0x188d3d){return Promise[_0xa752('0x14c')]()[_0xa752('0x99')](voiceQueueRt['getVoiceQueueRtPauses'](_0x188d3d))[_0xa752('0x9d')](loggerCatch(_0xa752('0x15b')));};Dialer['prototype'][_0xa752('0x15c')]=function(_0x2f7558,_0x4ff81c,_0x2f7c80){var _0x4ab125={'state':0x19,'statedesc':_0xa752('0x15d')};utils[_0xa752('0xbd')](_0x4ff81c,_0xa752('0x15e')+_0x2f7558);this[_0xa752('0x115')](_[_0xa752('0x5d')](_0x4ab125,_[_0xa752('0x71')](_0x2f7c80,[_0xa752('0xd8'),'ListId',_0xa752('0x15f'),_0xa752('0xe6'),_0xa752('0xda')])),_0xa752('0x160'),_0xa752('0x15e'));logger[_0xa752('0x62')](_0x2f7558);};Dialer[_0xa752('0x19')][_0xa752('0x115')]=function(_0xf8f284,_0x425ed,_0x2797af){hopperUtils['createHistory'](_0xf8f284)[_0xa752('0x9d')](loggerCatch(_0x425ed));hopperUtils[_0xa752('0x12f')](_0xf8f284)[_0xa752('0x9d')](loggerCatch(_0x2797af));};Dialer[_0xa752('0x19')][_0xa752('0xd4')]=function(_0x246688,_0x44d623){hopperUtils[_0xa752('0xe9')](_0x246688)['catch'](loggerCatch(_0xa752('0xc5')));if(_0x44d623==0x0){hopperUtils[_0xa752('0x12f')](_0x246688)[_0xa752('0x9d')](loggerCatch(_0xa752('0x161')));}};Dialer[_0xa752('0x19')][_0xa752('0x162')]=function(_0x144ca1){return Promise[_0xa752('0x14c')]()[_0xa752('0x99')](cmHopper[_0xa752('0x163')](_0x144ca1['id'],previewRecallmeReminderInterval))[_0xa752('0x99')](function(_0x3d1cfb){for(var _0x255394=0x0;_0x255394<_0x3d1cfb['length'];_0x255394++){var _0x4b906c=_0x3d1cfb[_0x255394][_0xa752('0x14e')][_0xa752('0x46')];if(_0x4b906c)io['to'](util[_0xa752('0x44')]('user:%s',_0x4b906c))[_0xa752('0x3f')](_0xa752('0x150'),{'hopper':_0x3d1cfb[_0x255394]});}})[_0xa752('0x9d')](function(){});};Dialer[_0xa752('0x19')][_0xa752('0x164')]=function(_0x39063f){var _0x1e69b5=this;return function(){_0x1e69b5[_0xa752('0x165')](_0x39063f);};};Dialer['prototype'][_0xa752('0x166')]=function(_0x31905a,_0x2aa5bf){var _0x5d3576=this;var _0x52cc38=uuid['v4']();this[_0xa752('0x24')][_0x52cc38]=new Action(_0x31905a,_0x2aa5bf,_0x52cc38);return new Promise(function(_0xa70795,_0x5e98f8){if(_['isUndefined'](_0x31905a)&&typeof _0x31905a!=='object'){return _0x5e98f8(msgResponse(_0xa752('0x167'),'Failure',_0xa752('0x168')));}if(_[_0xa752('0x3e')](_0x2aa5bf['phone'])||_0x2aa5bf[_0xa752('0x169')]===null){return _0x5e98f8(msgResponse('originate',_0xa752('0x90'),_0xa752('0x16a')));}var _0x3c55a0={'XMD-CALLERID':_0x5d3576[_0xa752('0x24')][_0x52cc38][_0xa752('0x16b')](),'XMD-AGI':_0x31905a[_0xa752('0x132')]?util[_0xa752('0x44')](_0xa752('0x16c'),ipAgi,_0x31905a['dialQueueProject']):_0xa752('0x16d'),'XMD-AGIAFTER':_0x31905a[_0xa752('0xc3')]?util[_0xa752('0x44')](_0xa752('0x16c'),ipAgi,_0x31905a[_0xa752('0xc3')]):_0xa752('0x16d'),'XMD-QUEUE':utils['isOutboundQueue'](_0x31905a)?util[_0xa752('0x44')]('\x22%s,%s%s,,,%s\x22',_0x31905a[_0xa752('0x46')],_0x31905a[_0xa752('0x16e')]||'',_0x31905a[_0xa752('0xc4')]?'c':'',_0x31905a[_0xa752('0xca')]||0x3):_0xa752('0x16d'),'XMD-CONTACTID':_0x2aa5bf[_0xa752('0xd8')],'XMD-CDRTYPE':_0xa752('0x9'),'CALLERID(all)':_0x5d3576[_0xa752('0x24')][_0x52cc38]['getCaller'](),'XMD-AMD':_0x31905a[_0xa752('0x10c')]?_0xa752('0x13f'):_0xa752('0x16d'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x31905a[_0xa752('0x10c')]){_0x3c55a0['XMD-AMDINITIALSILENCE']=_0x31905a[_0xa752('0x16f')]||0x9c4;_0x3c55a0[_0xa752('0x170')]=_0x31905a[_0xa752('0x171')]||0x5dc;_0x3c55a0[_0xa752('0x172')]=_0x31905a[_0xa752('0x173')]||0x320;_0x3c55a0[_0xa752('0x174')]=_0x31905a[_0xa752('0x175')]||0x1388;_0x3c55a0[_0xa752('0x176')]=_0x31905a[_0xa752('0x177')]||0x64;_0x3c55a0['XMD-AMDBETWEENWORDSSILENCE']=_0x31905a[_0xa752('0x178')]||0x32;_0x3c55a0[_0xa752('0x179')]=_0x31905a[_0xa752('0x17a')]||0x3;_0x3c55a0[_0xa752('0x17b')]=_0x31905a[_0xa752('0x17c')]||0x100;_0x3c55a0[_0xa752('0x17d')]=_0x31905a['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x31905a)){_0x3c55a0[_0xa752('0x17e')]=_0x2aa5bf[_0xa752('0xe6')];}else{_0x3c55a0[_0xa752('0x17f')]=_0x2aa5bf[_0xa752('0xda')];}var _0x3d7209=utils['setXMDContactVariables'](_0x2aa5bf[_0xa752('0x180')]);Object[_0xa752('0x145')](_0x3c55a0,_0x3d7209);var _0x20fba5=_0x5d3576[_0xa752('0x82')](_0x31905a[_0xa752('0x88')])?utils['getCallerId'](_0x31905a[_0xa752('0x88')][_0xa752('0x181')],_0x31905a[_0xa752('0x182')],_0x31905a[_0xa752('0x183')]>0x0?utils['getCallerIdRandom'](_0x31905a[_0xa752('0x184')],_0x31905a[_0xa752('0x183')]):_0x31905a[_0xa752('0x184')]):utils[_0xa752('0x185')](_[_0xa752('0xf0')](_0x31905a[_0xa752('0x89')])?_0x31905a['Trunk'][_0xa752('0x181')]:_0x31905a['TrunkBackup'][_0xa752('0x181')],_0x31905a[_0xa752('0x182')],_0x31905a[_0xa752('0x183')]>0x0?utils[_0xa752('0x186')](_0x31905a[_0xa752('0x184')],_0x31905a[_0xa752('0x183')]):_0x31905a['dialOriginateCallerIdNumber']);if(_0x20fba5){_0x3c55a0[_0xa752('0x187')]=_0x5d3576[_0xa752('0x24')][_0x52cc38][_0xa752('0x188')]=utils[_0xa752('0x189')](_0x20fba5);_0x3c55a0['XMD-ORIGINATECALLERIDNUM']=_0x2aa5bf[_0xa752('0x169')];}_0x31905a['variables']=_0x3c55a0;return ami[_0xa752('0x9e')]({'actionid':_0x52cc38,'action':_0xa752('0x167'),'channel':_0x5d3576['isTrunkReachable'](_0x31905a[_0xa752('0x88')])?util['format'](_0xa752('0x18a'),_0x31905a['Trunk'][_0xa752('0x46')],isNotNull(_0x31905a[_0xa752('0x18b')])?_0x31905a[_0xa752('0x18b')][_0xa752('0x18c')]()||'':'',_0x31905a[_0xa752('0x18d')]>0x0?_0x2aa5bf[_0xa752('0x169')][_0xa752('0x18e')](_0x31905a[_0xa752('0x18d')]):_0x2aa5bf[_0xa752('0x169')]):util[_0xa752('0x44')](_0xa752('0x18a'),_[_0xa752('0xf0')](_0x31905a[_0xa752('0x89')])?_0x31905a[_0xa752('0x88')]['name']:_0x31905a[_0xa752('0x89')][_0xa752('0x46')],isNotNull(_0x31905a[_0xa752('0x18b')])?_0x31905a[_0xa752('0x18b')]['trim']()||'':'',_0x31905a[_0xa752('0x18d')]>0x0?_0x2aa5bf['phone'][_0xa752('0x18e')](_0x31905a[_0xa752('0x18d')]):_0x2aa5bf['phone']),'callerid':_0x20fba5,'Exten':_0xa752('0x18f'),'Context':'from-sip','Priority':'1','variable':_0x3c55a0,'timeout':(_0x31905a[_0xa752('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x52cc38})[_0xa752('0x99')](function(_0x33ca88){return _0xa70795(_0x33ca88);})[_0xa752('0x9d')](function(_0x4c81ff){_0x31905a[_0xa752('0x191')]+=0x1;var _0x3d360e=new History(_0x5d3576['actions'][_0x52cc38]);logger['error'](util['format'](_0xa752('0x192'),JSON[_0xa752('0x81')](_0x4c81ff)));_0x3d360e[_0xa752('0x6b')]=0xe;_0x3d360e[_0xa752('0x6c')]=_0xa752('0x193');_0x3d360e[_0xa752('0xe8')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));_0x3d360e[_0xa752('0x6d')]=_0x3d360e[_0xa752('0xe8')];hopperUtils[_0xa752('0xe9')](_0x3d360e)['catch'](loggerCatch(_0xa752('0x194')));_0x5d3576[_0xa752('0x12f')](_0x3d360e)[_0xa752('0x9d')](loggerCatch('[originate][error]'))[_0xa752('0x1b')](function(){delete _0x5d3576['actions'][_0x52cc38];return _0x5e98f8(msgResponse(_0xa752('0x167'),_0xa752('0x195'),'originate\x20action\x20Error'));});});});};Dialer[_0xa752('0x19')]['checkRetriveMax']=function(_0x41ab53,_0x4b28ab,_0x1e8fa7){var _0xfee2f3=new History(_0x4b28ab);if(_0xfee2f3[_0xa752('0x11c')]+_0xfee2f3[_0xa752('0x11d')]+_0xfee2f3[_0xa752('0x11e')]+_0xfee2f3[_0xa752('0x11f')]+_0xfee2f3['countdropretry']+_0xfee2f3[_0xa752('0xe2')]+_0xfee2f3[_0xa752('0x120')]+_0xfee2f3['countagentrejectretry']>=_0x1e8fa7[_0xa752('0x122')]-0x1){return!![];}switch(_0x41ab53){case 0x3:if(_0xfee2f3[_0xa752('0x11e')]>=_0x1e8fa7['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countnoanswerretry':_0xfee2f3[_0xa752('0x11e')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7['dialNoAnswerRetryFrequency'],'minutes')[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x196')));break;case 0x5:if(_0xfee2f3[_0xa752('0x11c')]>=_0x1e8fa7[_0xa752('0x197')]-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countbusyretry':_0xfee2f3['countbusyretry']+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x198')],_0xa752('0xd7'))['format'](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3['CampaignId']||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x199')));break;case 0x8:if(_0xfee2f3[_0xa752('0x11d')]>=_0x1e8fa7['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countcongestionretry':_0xfee2f3[_0xa752('0x11d')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x19a')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0xfee2f3[_0xa752('0x11f')]>=_0x1e8fa7[_0xa752('0x19b')]-0x1){return!![];}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countnosuchnumberretry':_0xfee2f3[_0xa752('0x11f')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x19c')],'minutes')[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3['ListId'],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xfee2f3[_0xa752('0xcf')]>=_0x1e8fa7[_0xa752('0x19d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xfee2f3[_0xa752('0xcf')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0xd0')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3['CampaignId']||undefined})['catch'](loggerCatch(_0xa752('0xdb')));break;case 0xb:if(_0xfee2f3['countabandonedretry']>=_0x1e8fa7['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countabandonedretry':_0xfee2f3[_0xa752('0xe2')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7['dialAbandonedRetryFrequency'],_0xa752('0xd7'))[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3['ListId'],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0xfee2f3[_0xa752('0x120')]>=_0x1e8fa7['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countmachineretry':_0xfee2f3[_0xa752('0x120')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x127')],_0xa752('0xd7'))['format'](_0xa752('0xc0')),'ContactId':_0xfee2f3['ContactId'],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xfee2f3[_0xa752('0x121')]>=_0x1e8fa7[_0xa752('0x19e')]-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countagentrejectretry':_0xfee2f3[_0xa752('0x121')]+=0x1,'scheduledat':moment()['add'](_0x1e8fa7[_0xa752('0x19f')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3['CampaignId']||undefined})['catch'](loggerCatch(_0xa752('0x1a0')));break;default:return!![];}};Dialer[_0xa752('0x19')][_0xa752('0x108')]=function(_0xec8478,_0x4f4f42,_0x5f5586){var _0xf421bc=this;var _0x44c417=new History(_0xec8478);var _0x251775=![];var _0x53c6d2;var _0x5f3225;return new Promise(function(_0x357bef,_0x27d6cc){if(_[_0xa752('0x3e')](_0x4f4f42)&&typeof _0x4f4f42!==_0xa752('0x1a1')){return _0x27d6cc(msgResponse(_0xa752('0x1a2'),_0xa752('0x90'),_0xa752('0x1a3')));}if(_['isUndefined'](_0x5f5586)&&typeof _0x5f5586!==_0xa752('0x1a1')){return _0x27d6cc(msgResponse('[callProgressDetecting]','Failure',_0xa752('0x1a4')));}hopperUtils[_0xa752('0xd1')](_0x44c417,_0x5f5586[_0xa752('0x1a5')],_0x4f4f42)[_0xa752('0x99')](function(_0x26b9f8){if(_0x26b9f8['additional']==0x1)_0x251775=!![];switch(_0x5f5586[_0xa752('0x1a5')]){case'0':_0x4f4f42['outboundNoSuchCallsDay']+=0x1;_0x44c417[_0xa752('0x6b')]=0x0;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1a6');_0x44c417[_0xa752('0x11f')]+=0x1;_0x44c417['countglobal']+=0x1;ami['emit'](_0xa752('0x1a7'),ut['buildObj'](_0xec8478,_0xa752('0x1a8')));_0x53c6d2=_0x4f4f42[_0xa752('0x19c')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xf421bc[_0xa752('0x1a9')](0x0,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countnosuchnumberretry']>=_0x4f4f42[_0xa752('0x19b')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1aa'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1aa'));}}break;case'3':_0x4f4f42[_0xa752('0x1ab')]+=0x1;_0x44c417[_0xa752('0x6b')]=0x3;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1ac');_0x44c417[_0xa752('0x11e')]+=0x1;_0x44c417['countglobal']+=0x1;var _0x5dec8e=ut[_0xa752('0x1ad')](_0xec8478,_0x4f4f42);ami[_0xa752('0x3f')](_0xa752('0x1ae'),_0x5dec8e);_0x53c6d2=_0x4f4f42['dialNoAnswerRetryFrequency'];_0x5f3225=_0x4f4f42['callAdditionalPhoneAfterMin'];hopperUtils[_0xa752('0xe9')](_0x44c417)['catch'](loggerCatch(_0xa752('0x1af')));if(_0xf421bc[_0xa752('0x1a9')](0x3,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countnoanswerretry']>=_0x4f4f42[_0xa752('0x1b0')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,'reason\x203\x20ringing\x20no\x20answer');}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4f4f42[_0xa752('0x1b1')]+=0x1;_0x44c417['state']=0x5;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1b2');_0x44c417[_0xa752('0x11c')]+=0x1;_0x44c417[_0xa752('0xe3')]+=0x1;ami[_0xa752('0x3f')](_0xa752('0x1b3'),ut['buildObj'](_0xec8478,_0xa752('0x1b4')));_0x53c6d2=_0x4f4f42[_0xa752('0x198')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch(_0xa752('0x1b5')));if(_0xf421bc[_0xa752('0x1a9')](0x5,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417[_0xa752('0x11c')]>=_0x4f4f42['dialBusyMaxRetry']){_0xf421bc['createStateFinal'](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1b6'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1b6'));}}break;case'8':_0x4f4f42['outboundCongestionCallsDay']+=0x1;_0x44c417['state']=0x8;_0x44c417['statedesc']=_0xa752('0x1b7');_0x44c417[_0xa752('0x11d')]+=0x1;_0x44c417['countglobal']+=0x1;_0x53c6d2=_0x4f4f42[_0xa752('0x19a')];_0x5f3225=_0x4f4f42['callAdditionalPhoneAfterMin'];ami[_0xa752('0x3f')](_0xa752('0x1b8'),ut['buildObj'](_0xec8478,_0xa752('0x1b9')));hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch(_0xa752('0x1ba')));if(_0xf421bc['checkRetriveMax'](0x8,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countcongestionretry']>=_0x4f4f42[_0xa752('0x1bb')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bc'));}else{_0xf421bc['stateGlobal'](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bc'));}}break;case'11':_0x4f4f42[_0xa752('0x1bd')]+=0x1;_0x44c417[_0xa752('0x6b')]=0xb;_0x44c417[_0xa752('0x6c')]=_0xa752('0xe0');_0x44c417[_0xa752('0xe2')]+=0x1;_0x44c417['countglobal']+=0x1;_0x53c6d2=_0x4f4f42[_0xa752('0xe5')];_0x5f3225=_0x4f4f42['callAdditionalPhoneAfterMin'];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0xf421bc[_0xa752('0x1a9')](0xb,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417[_0xa752('0xe2')]>=_0x4f4f42[_0xa752('0x1be')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bf'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bf'));}}break;case'20':_0x4f4f42[_0xa752('0x1c0')]+=0x1;_0x44c417['state']=0x14;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1c1');_0x44c417['countagentrejectretry']+=0x1;_0x44c417['countglobal']+=0x1;_0x53c6d2=_0x4f4f42[_0xa752('0x19f')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];ami[_0xa752('0x3f')]('custom:agentreject',ut[_0xa752('0x113')](_0xec8478,_0xa752('0x1c2')));hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xf421bc[_0xa752('0x1a9')](0x14,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417[_0xa752('0x121')]>=_0x4f4f42[_0xa752('0x19e')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1c3'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1c3'));}}break;default:_0x4f4f42[_0xa752('0x137')]+=0x1;_0x44c417[_0xa752('0x6b')]=0xc;_0x44c417[_0xa752('0x6c')]=_0x5f5586[_0xa752('0x1a5')];_0x53c6d2=_0x4f4f42[_0xa752('0x19f')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch(_0xa752('0x1c4')));if(_0xf421bc[_0xa752('0x1a9')](_0x5f5586[_0xa752('0x1a5')],_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countbusyretry']+_0x44c417[_0xa752('0x11d')]+_0x44c417[_0xa752('0x11e')]+_0x44c417[_0xa752('0x11f')]+_0x44c417[_0xa752('0xcf')]+_0x44c417[_0xa752('0xe2')]+_0x44c417[_0xa752('0x120')]+_0x44c417[_0xa752('0x121')]>=_0x4f4f42['dialGlobalMaxRetry']){_0xf421bc['stateGlobal'](_0x44c417,_0x357bef,_0x27d6cc,_0x5f5586[_0xa752('0x1a5')]);}else{_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0x5f5586[_0xa752('0x1a5')]);}}}})[_0xa752('0x99')](function(){if(_0x251775){hopperUtils[_0xa752('0xeb')](_0x44c417,_0x53c6d2,_0x5f3225)[_0xa752('0x99')](function(){return _0x357bef(0x1);});}});});};Dialer['prototype'][_0xa752('0x123')]=function(_0x129d3e,_0x370c98,_0x277871,_0x2dbb7f){var _0x45fffc=new Final(_0x129d3e);_0x45fffc[_0xa752('0x6b')]=0xf;_0x45fffc[_0xa752('0x6c')]='Global';this[_0xa752('0x12b')](_0x45fffc,_0x370c98,_0x277871,_0x2dbb7f);};Dialer[_0xa752('0x19')][_0xa752('0x12b')]=function(_0x12bc15,_0x3d6cb5,_0x5351fc,_0x2904e8){hopperUtils[_0xa752('0x12f')](_0x12bc15)[_0xa752('0x99')](function(){return _0x3d6cb5(msgResponse(_0xa752('0x1a2'),_0xa752('0x1c5'),_0x2904e8));})[_0xa752('0x9d')](function(){return _0x5351fc(msgResponse(_0xa752('0x1c6'),_0xa752('0x90'),'contact\x20not\x20moved'));});};Dialer[_0xa752('0x19')]['predictive']=function(_0x4db8a0){var _0xd81e3=_0x4db8a0[_0xa752('0x1c7')]/0x64;var _0x152d25=_0x4db8a0[_0xa752('0x1c8')]/(_0x4db8a0['outboundDropCallsDayTimeout']+_0x4db8a0[_0xa752('0xc1')]);var _0x149ed5=Math[_0xa752('0x1c9')](_0x4db8a0[_0xa752('0x1ca')]*(_0x4db8a0[_0xa752('0x1cb')]/0x64));var _0x5ac050=Math[_0xa752('0x1c9')](_0x4db8a0['predictiveIntervalAvailable']*(_0x4db8a0[_0xa752('0x1cc')]/0x64));var _0x5e4bff=_0x4db8a0[_0xa752('0x13a')]+_0x4db8a0['talking'];var _0x4f5789=Math[_0xa752('0x1cd')](_0x4db8a0['erlangCalls']*_0x4db8a0[_0xa752('0x5c')]*_0x4db8a0[_0xa752('0x1ce')]*_0x4db8a0[_0xa752('0x1cf')]);if(_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x28')])){if(!_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x27')])){_0x4db8a0[_0xa752('0x27')]=undefined;loggerPredictive['error'](_0xa752('0x1d0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x4db8a0[_0xa752('0x60')])){loggerPredictive[_0xa752('0x62')](_0xa752('0x1d0'),_0xa752('0x1d1'));clearInterval(_0x4db8a0[_0xa752('0x60')]);_0x4db8a0[_0xa752('0x60')]=undefined;}_0x4db8a0[_0xa752('0x28')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));loggerPredictive['info'](_0x4db8a0[_0xa752('0x46')],_0xa752('0x1d2'),_0x4db8a0[_0xa752('0x28')]);this[_0xa752('0xaf')](_0x4db8a0,0x1);}else if(ifInterval(_0x4db8a0[_0xa752('0x1d3')],_0x4db8a0['startProgressive'])){this[_0xa752('0xaf')](_0x4db8a0,0x1);loggerPredictiveCalls[_0xa752('0x49')](_0xa752('0x1d4'),_0x4db8a0[_0xa752('0x28')],_0x4db8a0[_0xa752('0x46')]);_0x4db8a0['erlangCalls']=0x0;_0x4db8a0['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xd81e3<_0x152d25&&_0x4db8a0[_0xa752('0x1d5')]==='dropRate'){clearPredictiveAttributes(_0x4db8a0);loggerPredictive[_0xa752('0x49')](_0xa752('0x1d6'),_0xa752('0x1d7'),_0x152d25,_0xa752('0x28'),_0x4db8a0[_0xa752('0x46')]);}else if(_0x4f5789<_0x4db8a0['predictiveIntervalErlangCallsDroppedCalls']&&_0x4db8a0[_0xa752('0x1d5')]===_0xa752('0x1d8')){clearPredictiveAttributes(_0x4db8a0);loggerPredictive['info'](_0xa752('0x1d9'),_0xa752('0x1da'),_0x4f5789,_0xa752('0x1db'),_0x4db8a0[_0xa752('0xcb')],_0xa752('0x28'),_0x4db8a0['name']);}else if(!ifInterval(_0x4db8a0[_0xa752('0x1d3')],_0x4db8a0[_0xa752('0x28')])&&_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x27')])&&!_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x28')])){_0x4db8a0[_0xa752('0x27')]=moment()[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa752('0x49')](_0x4db8a0[_0xa752('0x46')],_0xa752('0x1dc'),_0x4db8a0[_0xa752('0x27')]);hopperUtils['avgHandleTime'](_0x4db8a0['dialPredictiveInterval'])[_0xa752('0x99')](this['getDataPredictive'](_0x4db8a0))['then'](mergeDataErlangB(_0x4db8a0))[_0xa752('0x99')](this[_0xa752('0x1dd')](_0x4db8a0))[_0xa752('0x9d')](loggerCatchPredictive(_0xa752('0x1de'),_0x4db8a0));}else if(!ifInterval(_0x4db8a0[_0xa752('0x1d3')],_0x4db8a0[_0xa752('0x27')])){_0x4db8a0['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4db8a0[_0xa752('0x27')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));loggerPredictive[_0xa752('0x49')](_0x4db8a0['name'],_0xa752('0x1df'),_0x4db8a0['startPredictive']);clearInterval(_0x4db8a0[_0xa752('0x60')]);_0x4db8a0[_0xa752('0x60')]=undefined;hopperUtils[_0xa752('0x1e0')](_0x4db8a0[_0xa752('0x1d3')])[_0xa752('0x99')](this['getDataPredictive'](_0x4db8a0))['then'](mergeDataErlangB(_0x4db8a0))[_0xa752('0x99')](this[_0xa752('0x1dd')](_0x4db8a0))[_0xa752('0x9d')](loggerCatchPredictive(_0xa752('0x1e1'),_0x4db8a0));}else if(_0x4db8a0[_0xa752('0x1ca')]&&_0x5e4bff<_0x4db8a0[_0xa752('0x1ca')]-_0x5ac050){clearPredictiveAttributes(_0x4db8a0);loggerPredictive[_0xa752('0x49')](_0x4db8a0['name'],_0xa752('0x1e2'),_0x5e4bff,_0xa752('0x1e3'),_0x4db8a0[_0xa752('0x1ca')],'-',_0x5ac050,'=',_0x4db8a0[_0xa752('0x1ca')]-_0x5ac050,')');}else if(_0x4db8a0[_0xa752('0x1ca')]&&_0x5e4bff>_0x4db8a0[_0xa752('0x1ca')]+_0x149ed5){clearPredictiveAttributes(_0x4db8a0);loggerPredictive['info'](_0x4db8a0[_0xa752('0x46')],_0xa752('0x1e2'),_0x5e4bff,_0xa752('0x1e4'),_0x4db8a0[_0xa752('0x1ca')],'+',_0x149ed5,'=',_0x4db8a0[_0xa752('0x1ca')]+_0x149ed5,')');}};Dialer[_0xa752('0x19')][_0xa752('0x1e5')]=function(_0x5791a6){var _0x43f15d=this;return function(_0x17d0ed){return new Promise(function(_0x4503f5,_0x3675d1){_[_0xa752('0x5d')](_0x5791a6,_0x17d0ed[0x0]);if(checkGetDataPredictive(_0x17d0ed[0x0])){var _0x515d5f=_0x5791a6[_0xa752('0x1ca')]=_0x5791a6[_0xa752('0x13d')]+_0x5791a6[_0xa752('0x13a')];var _0x3340ab=_0x5791a6[_0xa752('0x1d3')]*0x3c;var _0x5de1b9=_0x17d0ed[0x0][_0xa752('0x52')]+_0x17d0ed[0x0][_0xa752('0x55')];var _0x9a3dd5=(_0x17d0ed[0x0][_0xa752('0x1e6')]+_0x17d0ed[0x0][_0xa752('0x4e')]+_0x17d0ed[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x17d0ed[0x0][_0xa752('0x4c')];_0x5791a6[_0xa752('0x1ce')]=_0x9a3dd5>0x0?_0x9a3dd5:0x1;switch(_0x5791a6[_0xa752('0x1d5')]){case _0xa752('0x1d8'):var _0x16f65b=_0x5791a6[_0xa752('0x1c7')]/0x64;return _0x43f15d[_0xa752('0x1e7')](_0x515d5f,_0x3340ab,_0x5de1b9,_0x9a3dd5,_0x16f65b)[_0xa752('0x99')](function(_0x1f9b04){return _0x4503f5(_0x1f9b04);});case _0xa752('0x1e8'):var _0x16b6c9=_0x5791a6[_0xa752('0x1c7')]/0x64;return _0x43f15d[_0xa752('0x1e9')](_0x515d5f,_0x3340ab,_0x5de1b9,_0x9a3dd5,_0x16b6c9)['then'](function(_0x2f08db){return _0x4503f5(_0x2f08db);});default:return _0x3675d1(msgResponse(_0xa752('0x1ea'),_0xa752('0x90'),_0xa752('0x1eb')));}}else{return _0x3675d1(msgResponse(_0xa752('0x1ea'),_0xa752('0x90'),_0xa752('0x1ec')));}});};};Dialer[_0xa752('0x19')]['getDataPredictiveOld']=function(_0x41ce4c){var _0x238490=this;return function(_0x22f417){return new Promise(function(_0x33b8cf,_0x4aaa79){_[_0xa752('0x5d')](_0x41ce4c,_0x22f417[0x0]);if(checkGetDataPredictive(_0x22f417[0x0])){loggerPredictive['info'](JSON['stringify'](_0x22f417[0x0]));if(_0x41ce4c[_0xa752('0x1d5')]===_0xa752('0x1d8')){return _0x238490[_0xa752('0x15a')](_0x41ce4c['id'])[_0xa752('0x99')](function(_0x196c38){var _0x3cbcb0=_0x41ce4c[_0xa752('0x1ed')]-_0x196c38[0x0][_0xa752('0x1ee')];var _0x49310b=_0x41ce4c[_0xa752('0x1d3')]*0x3c;var _0x4b3c63=_0x22f417[0x0][_0xa752('0x52')]+_0x22f417[0x0][_0xa752('0x55')];var _0x5d2dcf=(_0x22f417[0x0][_0xa752('0x1e6')]+_0x22f417[0x0][_0xa752('0x4e')]+_0x22f417[0x0][_0xa752('0x50')])/_0x22f417[0x0]['predictiveIntervalTotalCalls'];var _0xa893fd=_0x41ce4c[_0xa752('0x1c7')]/0x64;_0x41ce4c[_0xa752('0x1ef')]=_0x196c38[0x0][_0xa752('0x1ee')]||0x0;_0x41ce4c[_0xa752('0x1ce')]=_0x5d2dcf>0x0?_0x5d2dcf:0x1;return _0x238490[_0xa752('0x1e7')](_0x3cbcb0,_0x49310b,_0x4b3c63,_0x5d2dcf,_0xa893fd);})['then'](function(_0x459899){return _0x33b8cf(_0x459899);})[_0xa752('0x9d')](function(_0x18f753){return _0x4aaa79(msgResponse(_0xa752('0x1f0'),_0xa752('0x90'),JSON[_0xa752('0x81')](_0x18f753)));});}if(_0x41ce4c[_0xa752('0x1d5')]===_0xa752('0x1e8')){return _0x238490[_0xa752('0x15a')](_0x41ce4c['id'])['then'](function(_0x4ba3c0){var _0x4160fc=_0x41ce4c[_0xa752('0x1ed')]-_0x4ba3c0[0x0][_0xa752('0x1ee')];var _0x3729df=_0x41ce4c[_0xa752('0x1d3')]*0x3c;var _0x515326=_0x22f417[0x0][_0xa752('0x52')]+_0x22f417[0x0][_0xa752('0x55')];var _0x10b00c=(_0x22f417[0x0][_0xa752('0x1e6')]+_0x22f417[0x0][_0xa752('0x4e')]+_0x22f417[0x0][_0xa752('0x50')])/_0x22f417[0x0][_0xa752('0x4c')];var _0x58aa7f=_0x41ce4c[_0xa752('0x1c7')]/0x64;_0x41ce4c[_0xa752('0x1ef')]=_0x4ba3c0[0x0][_0xa752('0x1ee')]||0x0;_0x41ce4c[_0xa752('0x1ce')]=_0x10b00c>0x0?_0x10b00c:0x1;return _0x238490['busyFactor'](_0x4160fc,_0x3729df,_0x515326,_0x10b00c,_0x58aa7f);})[_0xa752('0x99')](function(_0x11c47d){return _0x33b8cf(_0x11c47d);})['catch'](function(_0x13e65d){return _0x4aaa79(msgResponse(_0xa752('0x1f0'),_0xa752('0x90'),JSON[_0xa752('0x81')](_0x13e65d)));});}}else{return _0x4aaa79(msgResponse('[getDataPredictive]',_0xa752('0x90'),_0xa752('0x1ec')));}});};};Dialer[_0xa752('0x19')]['startMethodPredictive']=function(_0x4c0413){var _0x30bb4=this;return function(){var _0xb26803=0x0;var _0x103e43=Math[_0xa752('0x1cd')](_0x4c0413['erlangCallToSecond']*0x3e8);if(_0x103e43>0x0){_0x103e43=_0x103e43<0x64?0x64:_0x103e43;loggerPredictive[_0xa752('0x49')](_0x4c0413['name'],'one\x20call\x20every:',_0x103e43,_0xa752('0x1f1'));_0x4c0413[_0xa752('0x60')]=setInterval(function(){_0x30bb4[_0xa752('0x60')](_0x4c0413);loggerPredictiveCalls[_0xa752('0x49')](_0xa752('0x1f2'),_0xb26803+=0x1);},_0x103e43);}else{loggerPredictive[_0xa752('0x49')](_0x4c0413['name'],_0xa752('0x1f3'));}};};Dialer[_0xa752('0x19')][_0xa752('0x1f4')]=function(_0x54628b,_0x515b2a){var _0x1548de=this;return function(_0x167071){if(_[_0xa752('0x48')](_0x167071)){if(_[_0xa752('0xf0')](_0x515b2a[_0xa752('0x15f')])||!_0x515b2a[_0xa752('0x1f5')]){if(_0x54628b[_0xa752('0xae')]===_0xa752('0xa')){_0x54628b[_0xa752('0x6e')]=_[_0xa752('0x3e')](_0x54628b[_0xa752('0x6e')])?!![]:_0x54628b['queueStatusComplete'];var _0x464d5f=uuid['v4']();_0x1548de[_0xa752('0x24')][_0x464d5f]=new Action(_0x54628b,_0x515b2a,_0x464d5f);loggerBooked['info'](_0xa752('0x1f6'),_0x464d5f,'queueStatusComplete:\x20',JSON[_0xa752('0x81')](_0x54628b[_0xa752('0x6e')]),_0xa752('0x1f7'),_0x54628b[_0xa752('0x46')]);if(_0x54628b[_0xa752('0x6e')]){_0x54628b['queueStatusComplete']=![];_0x1548de['queueBooked'][_0x1548de['actions'][_0x464d5f][_0xa752('0xb9')]]=[];ami[_0xa752('0x9e')]({'actionid':_0x464d5f,'action':_0xa752('0x1f8'),'queue':_0x54628b['name']})[_0xa752('0x9d')](function(){utils[_0xa752('0xbd')](_0x54628b,_0xa752('0x1f9'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1548de[_0xa752('0x24')][_0x464d5f]['ContactId'],'ListId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xd9')],'VoiceQueueId':_0x1548de['actions'][_0x464d5f]['VoiceQueueId']||undefined,'CampaignId':_0x1548de[_0xa752('0x24')][_0x464d5f]['CampaignId']||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x1fa')));delete _0x1548de[_0xa752('0x24')][_0x464d5f];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xa752('0x81')](_0x54628b[_0xa752('0x6e')]),_0xa752('0x1f7'),_0x54628b[_0xa752('0x46')]);utils[_0xa752('0xbd')](_0x54628b,_0xa752('0x1f9'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1548de[_0xa752('0x24')][_0x464d5f]['ContactId'],'ListId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xd9')],'VoiceQueueId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xe6')]||undefined,'CampaignId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1548de[_0xa752('0x24')][_0x464d5f];}}else{return _0x1548de[_0xa752('0x166')](_0x54628b,_0x515b2a);}}else{if(utils[_0xa752('0xc9')](undefined,_0x515b2a[_0xa752('0x1fb')])<_0x54628b['dialRecallMeTimeout']*0x3c){if(_0x515b2a[_0xa752('0x14e')]&&!_0x515b2a[_0xa752('0x14e')][_0xa752('0x1fc')]){_0x1548de[_0xa752('0x1d')][_0xa752('0x1fd')](_0x515b2a['id'])['finally'](function(){utils[_0xa752('0xbd')](_0x54628b,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x515b2a['id'],0x1)[_0xa752('0x1b')](function(){utils[_0xa752('0xbd')](_0x54628b,'[checkContactBlack]');});}}else{_0x54628b['outboundReCallsDay']+=0x1;utils[_0xa752('0xbd')](_0x54628b,'[checkContactBlack]');if(_0x54628b[_0xa752('0x1fe')]){hopperUtils[_0xa752('0xd5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x515b2a[_0xa752('0xd8')],'ListId':_0x515b2a[_0xa752('0xd9')],'VoiceQueueId':_0x515b2a[_0xa752('0xe6')]||undefined,'CampaignId':_0x515b2a[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x1ff')));hopperUtils[_0xa752('0xe9')](createObjHistory(_0x54628b,_0x515b2a,utils[_0xa752('0x73')][_0xa752('0x200')],0x17,_0xa752('0x201')))['catch'](loggerCatch(_0xa752('0x202')));}else{_0x1548de[_0xa752('0x115')](createObjHistory(_0x54628b,_0x515b2a,utils[_0xa752('0x73')][_0xa752('0x203')],0x16,_0xa752('0x204')),_0xa752('0x205'),_0xa752('0x206'));}}}}else{_0x54628b[_0xa752('0x207')]+=0x1;_0x1548de[_0xa752('0x115')](createObjHistory(_0x54628b,_0x515b2a,utils[_0xa752('0x73')][_0xa752('0x208')],0xd,'Blacklist'),_0xa752('0x209'),_0xa752('0x20a'));throw _0xa752('0x20b');}};};Dialer[_0xa752('0x19')][_0xa752('0x165')]=function(_0x4fe1f6){var _0x553234=this;var _0x7222b0=_0x4fe1f6[_0xa752('0x20c')]-_0x4fe1f6['originated'];emitCampaignSummary(_0x4fe1f6);if(_0x7222b0>0x0&&_0x4fe1f6[_0xa752('0x20d')]==0x0){if(_0x7222b0>this['maxNumberOriginate']){_0x7222b0=this['maxNumberOriginate'];}_0x4fe1f6[_0xa752('0x20d')]=0x1;hopperUtils['getContactDialerIvr'](_0x4fe1f6,_0x7222b0)[_0xa752('0x99')](function(_0x32ee5f){_0x4fe1f6['temp']=0x0;if(_0x32ee5f){if(!utils[_0xa752('0x20e')](_0x32ee5f)){_0x4fe1f6[_0xa752('0x65')]=utils[_0xa752('0x73')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0xa752('0x20f')+_0x4fe1f6['name']);}else{_0x4fe1f6[_0xa752('0x7a')]+=_0x32ee5f['length'];_0x4fe1f6[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x210')];for(var _0x450dbe=0x0;_0x450dbe<_0x32ee5f['length'];_0x450dbe+=0x1){_0x4fe1f6[_0xa752('0x211')]+=0x1;if(_['isNil'](_0x32ee5f[_0x450dbe])||_[_0xa752('0xf0')](_0x32ee5f[_0x450dbe][_0xa752('0x180')])||_['isNil'](_0x32ee5f[_0x450dbe][_0xa752('0x169')])){_0x553234[_0xa752('0x15c')](_0xa752('0x212'),_0x4fe1f6,_0x32ee5f[_0x450dbe]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xa752('0x71')](_0x32ee5f[_0x450dbe],['CampaignId',_0xa752('0x169')]))['then'](_0x553234[_0xa752('0x1f4')](_0x4fe1f6,_0x32ee5f[_0x450dbe]))['catch'](function(_0x193db7){logger[_0xa752('0x62')]('[actionOriginateIvr]',_0x193db7);utils[_0xa752('0xbd')](_0x4fe1f6,_0xa752('0x213'));});}}}}})[_0xa752('0x9d')](function(_0x47b503){_0x4fe1f6[_0xa752('0x20d')]=0x0;logger[_0xa752('0x62')]('[getContactCampaign2]',_0x47b503);});}};Dialer[_0xa752('0x19')][_0xa752('0xaf')]=function(_0x44ca38,_0x6cbc84){var _0x29ad29=this;var _0x29126b=[];if(_0x6cbc84<0x1||_0x44ca38['dialMethod']==='booked'){_0x6cbc84=0x1;}var _0x1bd700=Math[_0xa752('0x1cd')](_0x44ca38[_0xa752('0x13a')]*_0x6cbc84)-_0x44ca38[_0xa752('0x7a')];if(_0x44ca38[_0xa752('0x214')]>0x0){var _0x15d172=_0x44ca38['dialLimitQueue']-_0x44ca38['originated']-_0x44ca38[_0xa752('0x13d')]-_0x44ca38[_0xa752('0x13e')];if(_0x1bd700>_0x15d172){_0x1bd700=_0x15d172;}}if(_0x1bd700>0x0&&_0x44ca38[_0xa752('0x20d')]==0x0){if(_0x44ca38['dialMethod']===_0xa752('0xa')){_0x1bd700=0x1;}if(_0x1bd700>this['maxNumberOriginate']){_0x1bd700=this[_0xa752('0x22')];}for(var _0x2c09bd in this['agents']){if(typeof this['agents'][_0x2c09bd]!==_0xa752('0x154')){if(this[_0xa752('0x20')][_0x2c09bd][_0xa752('0x6b')]===_0xa752('0x215')&&this[_0xa752('0x20')][_0x2c09bd][_0xa752('0x85')]===_0xa752('0x14b')){_0x29126b[_0xa752('0x96')](this[_0xa752('0x20')][_0x2c09bd]['id']);}}}_0x44ca38[_0xa752('0x20d')]=0x1;hopperUtils[_0xa752('0x216')](_0x44ca38,_0x29126b,_0x1bd700)[_0xa752('0x99')](function(_0x2f33ea){_0x44ca38['temp']=0x0;if(_0x2f33ea){if(!utils[_0xa752('0x20e')](_0x2f33ea)){hopperUtils[_0xa752('0x217')](_0x44ca38)['then'](sendMessageReschedule(_0x44ca38))[_0xa752('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x44ca38['originated']+=_0x2f33ea[_0xa752('0xf7')];_0x44ca38['message']=_0x44ca38[_0xa752('0xae')]===_0xa752('0xa')?utils[_0xa752('0x73')][_0xa752('0x13f')]:utils[_0xa752('0x73')][_0xa752('0x210')];for(var _0x5a4f59=0x0;_0x5a4f59<_0x2f33ea['length'];_0x5a4f59+=0x1){if(_[_0xa752('0xf0')](_0x2f33ea[_0x5a4f59])||_[_0xa752('0xf0')](_0x2f33ea[_0x5a4f59][_0xa752('0x180')])||_[_0xa752('0xf0')](_0x2f33ea[_0x5a4f59][_0xa752('0x169')])){_0x29ad29[_0xa752('0x15c')](_0xa752('0x212'),_0x44ca38,_0x2f33ea[_0x5a4f59]);}else{hopperUtils[_0xa752('0x218')](_[_0xa752('0x71')](_0x2f33ea[_0x5a4f59],['VoiceQueueId',_0xa752('0x169')]))[_0xa752('0x99')](_0x29ad29[_0xa752('0x1f4')](_0x44ca38,_0x2f33ea[_0x5a4f59]))[_0xa752('0x9d')](function(_0x5ed567){logger['error']('[actionOriginate]',_0x5ed567);utils['decrementOriginate'](_0x44ca38,_0xa752('0x219'));});}}}}})[_0xa752('0x9d')](function(_0x35a8e4){_0x44ca38[_0xa752('0x20d')]=0x0;logger[_0xa752('0x62')](_0xa752('0x21a'),_0x35a8e4);});}};Dialer['prototype'][_0xa752('0x60')]=function(_0x2f6d68){if(_0x2f6d68[_0xa752('0x214')]>0x0){var _0x526232=_0x2f6d68[_0xa752('0x214')]-_0x2f6d68[_0xa752('0x7a')]-_0x2f6d68[_0xa752('0x13d')];if(_0x526232>0x0&&_0x2f6d68['temp']==0x0){this['tryOriginatePredictive'](_0x2f6d68);}else{loggerPredictiveCalls['info'](_0xa752('0x21b'));}}else{this[_0xa752('0x21c')](_0x2f6d68);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x594c8f){var _0x4c3220=this;var _0x39ecb8=[];_0x594c8f['originated']+=0x1;for(var _0x4e21a9 in this['agents']){if(typeof this['agents'][_0x4e21a9]!==_0xa752('0x154')){if(this[_0xa752('0x20')][_0x4e21a9][_0xa752('0x6b')]===_0xa752('0x215')&&this[_0xa752('0x20')][_0x4e21a9][_0xa752('0x85')]===_0xa752('0x14b')){_0x39ecb8[_0xa752('0x96')](this['agents'][_0x4e21a9]['id']);}}}_0x594c8f[_0xa752('0x20d')]=0x1;return this[_0xa752('0x216')](_0x594c8f['id'],_0x39ecb8,0x1,_0x594c8f[_0xa752('0x21d')],_0x594c8f)[_0xa752('0x99')](function(_0x5d4366){_0x594c8f['temp']=0x1;if(_0x5d4366){if(!utils[_0xa752('0x20e')](_0x5d4366)){utils[_0xa752('0x21e')](_0x594c8f,0x1,0x0);return hopperUtils[_0xa752('0x217')](_0x594c8f)[_0xa752('0x99')](sendMessageReschedule(_0x594c8f))[_0xa752('0x9d')](loggerCatch(_0xa752('0x21f')));}else{_0x594c8f['message']=utils[_0xa752('0x73')][_0xa752('0x210')];if(_[_0xa752('0xf0')](_0x5d4366[0x0])||_[_0xa752('0xf0')](_0x5d4366[0x0][_0xa752('0x180')])||_[_0xa752('0xf0')](_0x5d4366[0x0][_0xa752('0x169')])){_0x4c3220['emptyContact'](_0xa752('0x212'),_0x594c8f,_0x5d4366[0x0]);}else{return hopperUtils[_0xa752('0x218')](_[_0xa752('0x71')](_0x5d4366[0x0],[_0xa752('0xe6'),'phone']))[_0xa752('0x99')](_0x4c3220['checkContactBlack'](_0x594c8f,_0x5d4366[0x0]))[_0xa752('0x9d')](function(_0x51a3e9){logger['error'](_0xa752('0x220'),_0x51a3e9);utils[_0xa752('0xbd')](_0x594c8f,_0xa752('0x220'));});}}}})[_0xa752('0x9d')](function(_0x5b5cec){_0x594c8f[_0xa752('0x20d')]=0x0;logger['error'](_0xa752('0x21a'),_0x5b5cec);});};Dialer['prototype'][_0xa752('0x1e7')]=function(_0x54c49b,_0x4057f4,_0x2835eb,_0x43af09,_0xac8ee2,_0xc003af){loggerPredictive[_0xa752('0x49')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xa752('0x49')](_0xa752('0x221'),_0x54c49b);loggerPredictive[_0xa752('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4057f4);loggerPredictive[_0xa752('0x49')](_0xa752('0x222'),_0x2835eb);loggerPredictive[_0xa752('0x49')]('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',_0x43af09);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xac8ee2);loggerPredictive[_0xa752('0x49')](_0xa752('0x53'));return new Promise(function(_0x3005c1,_0x371bc2){if(_0x54c49b<=0x0||isNaN(_0x54c49b)){return _0x371bc2(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x54c49b));}if(_0x2835eb<=0x0||isNaN(_0x2835eb)){return _0x371bc2(msgResponse(_0xa752('0x223'),'Error','Ts\x20=\x20'+_0x2835eb));}if(_0x43af09<=0x0||isNaN(_0x43af09)){return _0x371bc2(msgResponse('[abandonmentRate]',_0xa752('0x195'),_0xa752('0x224')+_0x43af09));}if(_0x4057f4<=0x0||isNaN(_0x4057f4)){return _0x371bc2(msgResponse('[abandonmentRate]','Error',_0xa752('0x225')+_0x4057f4));}if(_0xac8ee2<=0x0||isNaN(_0xac8ee2)){return _0x371bc2(msgResponse('[abandonmentRate]','Error',_0xa752('0x226')+_0xac8ee2));}_0xc003af=_0xc003af||0x0;var _0x2a6075=0x1/_0x2835eb;var _0x2338a2=0x0;var _0x23297f=0x0;var _0x1f2c57=0x0;var _0x474e97=0x0;for(var _0x2c5e94=0x0;_0x1f2c57<_0xac8ee2;_0x2c5e94+=0x1){_0x23297f=_0x2c5e94/_0x4057f4;_0x2338a2=(_0x43af09*_0x23297f+_0xc003af)/_0x2a6075;_0x1f2c57=utils[_0xa752('0x227')](_0x2338a2,_0x54c49b);_0x474e97=_0x2338a2/_0x54c49b*(0x1-utils['erlangb'](_0x2338a2,_0x54c49b));}return _0x3005c1({'erlangCalls':_0x2c5e94,'erlangCallToSecond':_0x4057f4/_0x2c5e94,'erlangAbandonmentRate':_0x1f2c57,'erlangBusyFactor':_0x474e97});});};Dialer[_0xa752('0x19')][_0xa752('0x1e9')]=function(_0x3e1d34,_0x4c1bba,_0x109694,_0x474feb,_0x240c76,_0x1e8105){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa752('0x49')](_0xa752('0x221'),_0x3e1d34);loggerPredictive[_0xa752('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c1bba);loggerPredictive[_0xa752('0x49')](_0xa752('0x222'),_0x109694);loggerPredictive[_0xa752('0x49')](_0xa752('0x228'),_0x474feb);loggerPredictive[_0xa752('0x49')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x240c76);loggerPredictive[_0xa752('0x49')](_0xa752('0x53'));return new Promise(function(_0x5116e5,_0x514855){if(_0x3e1d34<=0x0||isNaN(_0x3e1d34)){return _0x514855(msgResponse(_0xa752('0x229'),_0xa752('0x195'),'m\x20=\x20'+_0x3e1d34));}if(_0x109694<=0x0||isNaN(_0x109694)){return _0x514855(msgResponse(_0xa752('0x229'),_0xa752('0x195'),_0xa752('0x22a')+_0x109694));}if(_0x474feb<=0x0||isNaN(_0x474feb)){return _0x514855(msgResponse('[busyFactor]','Error',_0xa752('0x224')+_0x474feb));}if(_0x4c1bba<=0x0||isNaN(_0x4c1bba)){return _0x514855(msgResponse(_0xa752('0x229'),'Error',_0xa752('0x225')+_0x4c1bba));}if(_0x240c76<=0x0||isNaN(_0x240c76)){return _0x514855(msgResponse(_0xa752('0x229'),_0xa752('0x195'),'Umin\x20=\x20'+_0x240c76));}_0x1e8105=_0x1e8105||0x0;var _0x13c892=0x1/_0x109694;var _0x1ff21f=0x0;var _0x36dd43=0x0;var _0xadfbd2=0x0;var _0x3b9e5e=0x0;for(var _0x155ae9=0x0;_0x3b9e5e<_0x240c76;_0x155ae9+=0x1){_0x36dd43=_0x155ae9/_0x4c1bba;_0x1ff21f=(_0x474feb*_0x36dd43+_0x1e8105)/_0x13c892;_0xadfbd2=utils[_0xa752('0x227')](_0x1ff21f,_0x3e1d34);_0x3b9e5e=_0x1ff21f/_0x3e1d34*(0x1-utils[_0xa752('0x227')](_0x1ff21f,_0x3e1d34));}return _0x5116e5({'erlangCalls':_0x155ae9,'erlangCallToSecond':_0x4c1bba/_0x155ae9,'erlangAbandonmentRate':_0xadfbd2,'erlangBusyFactor':_0x3b9e5e});});};module[_0xa752('0x22b')]=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 a3ee49a..b65e87e 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 _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 +var _0x721f=['phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','voiceQueue','dialCutDigit','substring','getQueue','lodash','moment','string','isNil','uniqueid','Contact','lastName','number'];(function(_0x1c7cb4,_0x268921){var _0x5bd55a=function(_0x1ef638){while(--_0x1ef638){_0x1c7cb4['push'](_0x1c7cb4['shift']());}};_0x5bd55a(++_0x268921);}(_0x721f,0x1cc));var _0xf721=function(_0x18f9f6,_0xd24ec2){_0x18f9f6=_0x18f9f6-0x0;var _0x1ba1a9=_0x721f[_0x18f9f6];return _0x1ba1a9;};'use strict';var util=require('util');var _=require(_0xf721('0x0'));var moment=require(_0xf721('0x1'));function checkNameSurname(_0x57959d,_0x27378c,_0x4138fe){var _0x35bea6='';if(!_['isNil'](_0x27378c)&&_0xf721('0x2')===typeof _0x27378c){_0x35bea6+=_0x27378c;}if(!_[_0xf721('0x3')](_0x4138fe)&&'string'===typeof _0x4138fe){_0x35bea6+='\x20'+_0x4138fe;}if(_0x35bea6!==''){return _0x35bea6;}return _0x57959d;}function Action(_0x3884d9,_0x6b2b3b,_0x33356c){this['voiceQueue']=_0x3884d9;this[_0xf721('0x4')]=_0x33356c||undefined;this['name']=checkNameSurname(_0x6b2b3b[_0xf721('0x5')]['phone'],_0x6b2b3b[_0xf721('0x5')]['firstName'],_0x6b2b3b[_0xf721('0x5')][_0xf721('0x6')]);this[_0xf721('0x7')]=_0x6b2b3b[_0xf721('0x8')];this[_0xf721('0x9')]=_0x3884d9[_0xf721('0xa')];this[_0xf721('0xb')]=_0x6b2b3b['active']||![];this[_0xf721('0xc')]=_0x3884d9['type'];this[_0xf721('0xd')]=_0x3884d9[_0xf721('0xd')]||0x3;this[_0xf721('0xe')]=_0x6b2b3b[_0xf721('0xe')];this['countbusyretry']=_0x6b2b3b[_0xf721('0xf')];this[_0xf721('0x10')]=_0x6b2b3b[_0xf721('0x10')];this['countnoanswerretry']=_0x6b2b3b['countnoanswerretry'];this[_0xf721('0x11')]=_0x6b2b3b['countnosuchnumberretry'];this[_0xf721('0x12')]=_0x6b2b3b[_0xf721('0x12')];this[_0xf721('0x13')]=_0x6b2b3b[_0xf721('0x13')];this['countmachineretry']=_0x6b2b3b['countmachineretry'];this[_0xf721('0x14')]=_0x6b2b3b[_0xf721('0x14')];this[_0xf721('0x15')]=_0x6b2b3b[_0xf721('0x15')];this[_0xf721('0x16')]=_0x6b2b3b[_0xf721('0x16')];this[_0xf721('0x17')]=_0x6b2b3b[_0xf721('0x17')];this[_0xf721('0x18')]=_0x6b2b3b[_0xf721('0x18')];this[_0xf721('0x19')]=_0x6b2b3b[_0xf721('0x19')];this[_0xf721('0x1a')]=_0x6b2b3b['id'];this['ContactFirstName']=_0x6b2b3b['Contact'][_0xf721('0x1b')]||'';this['starttime']=moment()[_0xf721('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf721('0x1d')]=_0x6b2b3b['callback'];this[_0xf721('0x1e')]=_0x6b2b3b[_0xf721('0x1e')];this['callbackat']=_0x6b2b3b[_0xf721('0x1f')];this['recallme']=_0x6b2b3b[_0xf721('0x20')];this[_0xf721('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0xf721('0x22')]=function(){return util[_0xf721('0x1c')]('\x22%s\x22\x20<%s>',this[_0xf721('0xa')],this[_0xf721('0x23')][_0xf721('0x24')]>0x0?this[_0xf721('0x7')][_0xf721('0x25')](this[_0xf721('0x23')][_0xf721('0x24')]):this[_0xf721('0x7')]);};Action['prototype'][_0xf721('0x26')]=function(){return this[_0xf721('0x9')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index be492c4..044082a 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 _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 +var _0x583c=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0x583c,0x12a));var _0xc583=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x583c[_0x1a9e78];return _0x113e06;};'use strict';var moment=require('moment');var utils=require(_0xc583('0x0'));function AgentComplete(_0x114df2,_0x3f9f8d){this[_0xc583('0x1')]=0x4;this[_0xc583('0x2')]=_0xc583('0x3');this[_0xc583('0x4')]=_0x114df2['scheduledat'];this[_0xc583('0x5')]=_0x114df2[_0xc583('0x5')];this[_0xc583('0x6')]=_0x114df2[_0xc583('0x5')]===_0xc583('0x7')?_0xc583('0x8'):_0x114df2['type'];this[_0xc583('0x9')]=_0x114df2[_0xc583('0x9')];this[_0xc583('0xa')]=_0x114df2['countcongestionretry'];this[_0xc583('0xb')]=_0x114df2[_0xc583('0xb')];this[_0xc583('0xc')]=_0x114df2['countbusyretry']+_0x114df2[_0xc583('0xa')]+_0x114df2[_0xc583('0xb')]+_0x114df2['countnosuchnumberretry']+_0x114df2[_0xc583('0xd')]+_0x114df2[_0xc583('0xe')]+_0x114df2['countmachineretry']+_0x114df2[_0xc583('0xf')];this[_0xc583('0x10')]=_0x114df2[_0xc583('0x10')];this[_0xc583('0xd')]=_0x114df2[_0xc583('0xd')];this[_0xc583('0xe')]=_0x114df2['countabandonedretry'];this['countmachineretry']=_0x114df2[_0xc583('0x11')];this[_0xc583('0xf')]=_0x114df2[_0xc583('0xf')];this['uniqueid']=_0x3f9f8d[_0xc583('0x12')];this[_0xc583('0x13')]=_0x114df2['name'];this[_0xc583('0x14')]=_0x114df2['number'];this[_0xc583('0x15')]=_0x114df2[_0xc583('0x15')];this[_0xc583('0x16')]=_0x114df2[_0xc583('0x16')];this[_0xc583('0x17')]=_0x114df2[_0xc583('0x17')];this[_0xc583('0x18')]=moment()[_0xc583('0x19')](_0xc583('0x1a'));this[_0xc583('0x1b')]=utils[_0xc583('0x1c')](_0x114df2[_0xc583('0x16')],_0x114df2[_0xc583('0x15')]);this[_0xc583('0x1d')]=utils['getSeconds'](_0x114df2[_0xc583('0x17')],_0x114df2[_0xc583('0x16')]);this[_0xc583('0x1e')]=utils[_0xc583('0x1c')](this[_0xc583('0x18')],_0x114df2['answertime']);this[_0xc583('0x8')]=_0x3f9f8d[_0xc583('0x8')];this[_0xc583('0x1f')]=_0x3f9f8d[_0xc583('0x1f')];this[_0xc583('0x20')]=_0x3f9f8d[_0xc583('0x20')];this[_0xc583('0x21')]=_0x114df2[_0xc583('0x21')];this[_0xc583('0x22')]=_0x114df2[_0xc583('0x22')];this[_0xc583('0x23')]=_0x114df2['callbackat'];this[_0xc583('0x24')]=_0x114df2[_0xc583('0x24')];this[_0xc583('0x25')]=_0x114df2[_0xc583('0x25')];this[_0xc583('0x26')]=_0x114df2[_0xc583('0x26')];this[_0xc583('0x27')]=_0x114df2[_0xc583('0x27')];this[_0xc583('0x28')]=_0x114df2[_0xc583('0x28')];this['CampaignId']=_0x114df2[_0xc583('0x29')];this[_0xc583('0x2a')]=_0x114df2[_0xc583('0x2a')]||'';this[_0xc583('0x2b')]=_0x114df2[_0xc583('0x2b')]||'';this[_0xc583('0x2c')]=_0x114df2[_0xc583('0x2c')];}module[_0xc583('0x2d')]=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 85b4c36..4a72eee 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 _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 +var _0xa220=['countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','campaigntype','type','queue','countcongestionretry','countnoanswerretry'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa220,0xc5));var _0x0a22=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa220[_0x4b369d];return _0x571a98;};'use strict';function Final(_0x3373cc){this[_0x0a22('0x0')]=_0x3373cc[_0x0a22('0x0')];this[_0x0a22('0x1')]=_0x3373cc['scheduledat'];this['type']=_0x3373cc['type'];this[_0x0a22('0x2')]=_0x3373cc[_0x0a22('0x3')]==='outbound'?_0x0a22('0x4'):_0x3373cc['type'];this['countbusyretry']=_0x3373cc['countbusyretry'];this[_0x0a22('0x5')]=_0x3373cc['countcongestionretry'];this['countnoanswerretry']=_0x3373cc[_0x0a22('0x6')];this['countglobal']=_0x3373cc[_0x0a22('0x7')]+_0x3373cc['countcongestionretry']+_0x3373cc['countnoanswerretry']+_0x3373cc[_0x0a22('0x8')]+_0x3373cc['countdropretry']+_0x3373cc[_0x0a22('0x9')]+_0x3373cc[_0x0a22('0xa')]+_0x3373cc[_0x0a22('0xb')];this['countnosuchnumberretry']=_0x3373cc[_0x0a22('0x8')];this[_0x0a22('0xc')]=_0x3373cc[_0x0a22('0xc')];this[_0x0a22('0x9')]=_0x3373cc[_0x0a22('0x9')];this['countmachineretry']=_0x3373cc['countmachineretry'];this['countagentrejectretry']=_0x3373cc[_0x0a22('0xb')];this[_0x0a22('0x4')]=_0x3373cc[_0x0a22('0x4')];this['calleridname']=_0x3373cc[_0x0a22('0xd')];this[_0x0a22('0xe')]=_0x3373cc[_0x0a22('0xe')];this['starttime']=_0x3373cc[_0x0a22('0xf')];this['responsetime']=_0x3373cc['responsetime'];this[_0x0a22('0x10')]=_0x3373cc[_0x0a22('0x11')];this[_0x0a22('0x12')]=_0x3373cc[_0x0a22('0x12')]||0x0;this[_0x0a22('0x13')]=_0x3373cc['holdtime']||0x0;this[_0x0a22('0x14')]=_0x3373cc[_0x0a22('0x14')]||0x0;this[_0x0a22('0x15')]=_0x3373cc['callback'];this[_0x0a22('0x16')]=_0x3373cc[_0x0a22('0x16')];this[_0x0a22('0x17')]=_0x3373cc[_0x0a22('0x17')];this[_0x0a22('0x18')]=_0x3373cc[_0x0a22('0x18')];this[_0x0a22('0x19')]=_0x3373cc['ContactId'];this[_0x0a22('0x1a')]=_0x3373cc[_0x0a22('0x1a')];this[_0x0a22('0x1b')]=_0x3373cc[_0x0a22('0x1b')];this[_0x0a22('0x1c')]=_0x3373cc[_0x0a22('0x1c')];this[_0x0a22('0x1d')]=_0x3373cc['CampaignId'];this[_0x0a22('0x1e')]=_0x3373cc['originatecalleridnum']||'';this[_0x0a22('0x1f')]=_0x3373cc[_0x0a22('0x1f')]||'';this[_0x0a22('0x20')]=_0x3373cc[_0x0a22('0x20')];this[_0x0a22('0x21')]=_0x3373cc['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 36c43da..2ea433a 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 _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 +var _0x67cc=['endtime','format','ringtime','getSeconds','holdtime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','number','starttime','responsetime'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x67cc,0x90));var _0xc67c=function(_0x1d227e,_0x361094){_0x1d227e=_0x1d227e-0x0;var _0x7ccf13=_0x67cc[_0x1d227e];return _0x7ccf13;};'use strict';var moment=require(_0xc67c('0x0'));var utils=require(_0xc67c('0x1'));function Hangup(_0x5097f0,_0x5404ce){this[_0xc67c('0x2')]=0x4;this[_0xc67c('0x3')]=_0xc67c('0x4');this[_0xc67c('0x5')]=_0x5097f0[_0xc67c('0x5')];this[_0xc67c('0x6')]=_0x5097f0[_0xc67c('0x6')];this[_0xc67c('0x7')]=_0x5097f0[_0xc67c('0x6')]===_0xc67c('0x8')?_0xc67c('0x9'):_0x5097f0[_0xc67c('0x6')];this[_0xc67c('0xa')]=_0x5097f0['amd']||![];this[_0xc67c('0xb')]=_0x5097f0['countbusyretry'];this[_0xc67c('0xc')]=_0x5097f0[_0xc67c('0xc')];this['countnoanswerretry']=_0x5097f0[_0xc67c('0xd')];this['countglobal']=_0x5097f0[_0xc67c('0xb')]+_0x5097f0['countcongestionretry']+_0x5097f0[_0xc67c('0xd')]+_0x5097f0[_0xc67c('0xe')]+_0x5097f0[_0xc67c('0xf')]+_0x5097f0['countabandonedretry']+_0x5097f0[_0xc67c('0x10')]+_0x5097f0[_0xc67c('0x11')];this[_0xc67c('0xe')]=_0x5097f0[_0xc67c('0xe')];this[_0xc67c('0xf')]=_0x5097f0[_0xc67c('0xf')];this[_0xc67c('0x12')]=_0x5097f0[_0xc67c('0x12')];this[_0xc67c('0x10')]=_0x5097f0[_0xc67c('0x10')];this[_0xc67c('0x11')]=_0x5097f0[_0xc67c('0x11')];this[_0xc67c('0x13')]=_0x5404ce[_0xc67c('0x13')];this['calleridname']=_0x5097f0['name'];this[_0xc67c('0x14')]=_0x5097f0[_0xc67c('0x15')];this['starttime']=_0x5097f0[_0xc67c('0x16')];this[_0xc67c('0x17')]=_0x5097f0[_0xc67c('0x17')];this[_0xc67c('0x18')]=moment()[_0xc67c('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc67c('0x1a')]=utils[_0xc67c('0x1b')](_0x5097f0[_0xc67c('0x17')],_0x5097f0[_0xc67c('0x16')]);this[_0xc67c('0x1c')]=0x0;this['talktime']=utils[_0xc67c('0x1b')](this[_0xc67c('0x18')],_0x5097f0[_0xc67c('0x17')]);this['queue']=_0x5097f0['queue'];this[_0xc67c('0x1d')]='IVR';this[_0xc67c('0x1e')]=_0x5404ce[_0xc67c('0x1f')];this[_0xc67c('0x20')]=_0x5097f0[_0xc67c('0x20')];this[_0xc67c('0x21')]=_0x5097f0[_0xc67c('0x21')];this['callbackat']=_0x5097f0[_0xc67c('0x22')];this[_0xc67c('0x23')]=_0x5097f0['recallme'];this[_0xc67c('0x24')]=_0x5097f0['ContactId'];this['ListId']=_0x5097f0[_0xc67c('0x25')];this[_0xc67c('0x26')]=_0x5097f0[_0xc67c('0x26')];this[_0xc67c('0x27')]=_0x5097f0[_0xc67c('0x27')];this[_0xc67c('0x28')]=_0x5097f0['CampaignId'];}module[_0xc67c('0x29')]=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 bbeda01..8ad747c 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 _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 +var _0xda88=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','../utils','uniqueid','scheduledat'];(function(_0x5d1204,_0x5dce3b){var _0x2d0ee7=function(_0x455678){while(--_0x455678){_0x5d1204['push'](_0x5d1204['shift']());}};_0x2d0ee7(++_0x5dce3b);}(_0xda88,0x1a1));var _0x8da8=function(_0x25dfe3,_0x35dc3b){_0x25dfe3=_0x25dfe3-0x0;var _0xfcb743=_0xda88[_0x25dfe3];return _0xfcb743;};'use strict';var utils=require(_0x8da8('0x0'));function History(_0x115fda){this[_0x8da8('0x1')]=_0x115fda[_0x8da8('0x1')];this[_0x8da8('0x2')]=_0x115fda['scheduledat']||undefined;this[_0x8da8('0x3')]=_0x115fda['type'];this[_0x8da8('0x4')]=_0x115fda[_0x8da8('0x3')]===_0x8da8('0x5')?_0x8da8('0x6'):_0x115fda[_0x8da8('0x3')];this[_0x8da8('0x7')]=_0x115fda[_0x8da8('0x7')];this[_0x8da8('0x8')]=_0x115fda[_0x8da8('0x8')];this[_0x8da8('0x9')]=_0x115fda[_0x8da8('0x9')];this[_0x8da8('0xa')]=_0x115fda[_0x8da8('0x7')]+_0x115fda[_0x8da8('0x8')]+_0x115fda[_0x8da8('0x9')]+_0x115fda[_0x8da8('0xb')]+_0x115fda[_0x8da8('0xc')]+_0x115fda['countabandonedretry']+_0x115fda[_0x8da8('0xd')]+_0x115fda[_0x8da8('0xe')];this['countnosuchnumberretry']=_0x115fda[_0x8da8('0xb')];this[_0x8da8('0xc')]=_0x115fda['countdropretry'];this[_0x8da8('0xf')]=_0x115fda[_0x8da8('0xf')];this[_0x8da8('0xd')]=_0x115fda[_0x8da8('0xd')];this[_0x8da8('0xe')]=_0x115fda[_0x8da8('0xe')];this['queue']=_0x115fda[_0x8da8('0x6')];this[_0x8da8('0x10')]=_0x115fda['name'];this['calleridnum']=_0x115fda['number'];this['starttime']=_0x115fda[_0x8da8('0x11')];this[_0x8da8('0x12')]=_0x115fda[_0x8da8('0x12')];this['endtime']=_0x115fda[_0x8da8('0x12')];this[_0x8da8('0x13')]=utils[_0x8da8('0x14')](_0x115fda[_0x8da8('0x12')],_0x115fda[_0x8da8('0x11')]);this[_0x8da8('0x15')]=0x0;this[_0x8da8('0x16')]=0x0;this[_0x8da8('0x17')]=_0x115fda['callback'];this[_0x8da8('0x18')]=_0x115fda[_0x8da8('0x18')];this[_0x8da8('0x19')]=_0x115fda[_0x8da8('0x19')];this[_0x8da8('0x1a')]=_0x115fda[_0x8da8('0x1a')];this[_0x8da8('0x1b')]=_0x115fda[_0x8da8('0x1b')];this[_0x8da8('0x1c')]=_0x115fda['ListId'];this[_0x8da8('0x1d')]=_0x115fda[_0x8da8('0x1d')];this[_0x8da8('0x1e')]=_0x115fda[_0x8da8('0x1e')];this[_0x8da8('0x1f')]=_0x115fda[_0x8da8('0x1f')];this[_0x8da8('0x20')]=_0x115fda[_0x8da8('0x20')]||'';this['originatecalleridname']=_0x115fda['originatecalleridname']||'';this[_0x8da8('0x21')]=_0x115fda[_0x8da8('0x21')];this[_0x8da8('0x22')]=_0x115fda[_0x8da8('0x22')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index b726f85..67d0f79 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 _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 +var _0x300b=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x205796,_0x1a1ac7){var _0x30f173=function(_0xc5c0b1){while(--_0xc5c0b1){_0x205796['push'](_0x205796['shift']());}};_0x30f173(++_0x1a1ac7);}(_0x300b,0x1c4));var _0xb300=function(_0x38d7a0,_0x32a096){_0x38d7a0=_0x38d7a0-0x0;var _0x350821=_0x300b[_0x38d7a0];return _0x350821;};'use strict';var utils=require(_0xb300('0x0'));function QueueCallerAbandon(_0x16a684,_0xf4863a){this[_0xb300('0x1')]=_0x16a684[_0xb300('0x1')];this[_0xb300('0x2')]=_0x16a684[_0xb300('0x2')];this[_0xb300('0x3')]=_0x16a684[_0xb300('0x2')]===_0xb300('0x4')?'queue':_0x16a684['type'];this[_0xb300('0x5')]=_0x16a684[_0xb300('0x5')];this['countcongestionretry']=_0x16a684[_0xb300('0x6')];this[_0xb300('0x7')]=_0x16a684[_0xb300('0x7')];this[_0xb300('0x8')]=_0x16a684['countbusyretry']+_0x16a684[_0xb300('0x6')]+_0x16a684[_0xb300('0x7')]+_0x16a684[_0xb300('0x9')]+_0x16a684[_0xb300('0xa')]+_0x16a684[_0xb300('0xb')]+_0x16a684[_0xb300('0xc')]+_0x16a684[_0xb300('0xd')];this[_0xb300('0x9')]=_0x16a684['countnosuchnumberretry'];this[_0xb300('0xa')]=_0x16a684[_0xb300('0xa')];this[_0xb300('0xb')]=_0x16a684[_0xb300('0xb')];this[_0xb300('0xc')]=_0x16a684[_0xb300('0xc')];this[_0xb300('0xd')]=_0x16a684[_0xb300('0xd')];this[_0xb300('0xe')]=_0xf4863a[_0xb300('0xe')];this[_0xb300('0xf')]=_0x16a684['name'];this['calleridnum']=_0x16a684[_0xb300('0x10')];this['starttime']=_0x16a684[_0xb300('0x11')];this[_0xb300('0x12')]=_0x16a684[_0xb300('0x12')];this[_0xb300('0x13')]=_0x16a684[_0xb300('0x13')];this['dropreason']=_0x16a684[_0xb300('0x14')];this[_0xb300('0x15')]=this[_0xb300('0x13')];this[_0xb300('0x16')]=utils[_0xb300('0x17')](_0x16a684[_0xb300('0x12')],_0x16a684[_0xb300('0x11')]);this[_0xb300('0x18')]=utils['getSeconds'](this['droptime'],_0x16a684['responsetime']);this[_0xb300('0x19')]=0x0;this[_0xb300('0x1a')]=_0xf4863a[_0xb300('0x1a')];this['membername']=_0xf4863a[_0xb300('0x1b')];this['reason']=_0xf4863a[_0xb300('0x1c')];this[_0xb300('0x1d')]=_0x16a684[_0xb300('0x1d')];this[_0xb300('0x1e')]=_0x16a684[_0xb300('0x1e')];this['callbackat']=_0x16a684['callbackat'];this[_0xb300('0x1f')]=_0x16a684[_0xb300('0x1f')];this[_0xb300('0x20')]=_0x16a684['ContactId'];this[_0xb300('0x21')]=_0x16a684[_0xb300('0x21')];this[_0xb300('0x22')]=_0x16a684['UserId'];this[_0xb300('0x23')]=_0x16a684[_0xb300('0x23')];this['CampaignId']=_0x16a684['CampaignId'];this[_0xb300('0x24')]=_0x16a684[_0xb300('0x24')]||'';this[_0xb300('0x25')]=_0x16a684[_0xb300('0x25')]||'';this[_0xb300('0x26')]=_0x16a684[_0xb300('0x26')];this[_0xb300('0x27')]=_0x16a684['state'];this['statedesc']=_0x16a684[_0xb300('0x28')];}module[_0xb300('0x29')]=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 3974761..f3f5e45 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 _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 +var _0xf61e=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xf61e,0x191));var _0xef61=function(_0x26314b,_0x34edcb){_0x26314b=_0x26314b-0x0;var _0x577189=_0xf61e[_0x26314b];return _0x577189;};'use strict';var util=require(_0xef61('0x0'));var logger=require(_0xef61('0x1'))(_0xef61('0x2'));var cmHopper=require(_0xef61('0x3'));var cmHopperAdditionalPhone=require(_0xef61('0x4'));var cmHopperBlack=require(_0xef61('0x5'));var cmHopperHistory=require(_0xef61('0x6'));function inspectError(_0x40509e){return util[_0xef61('0x7')](_0x40509e,{'showHidden':![],'depth':null});}function getContactDialer(_0x14122a,_0x239fa9,_0x45a18d){return cmHopper['getContactDialer'](_0x14122a['id'],_0x239fa9,_0x45a18d,_0x14122a[_0xef61('0x8')])[_0xef61('0x9')](function(_0x4f0cc5){_0x14122a[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xc'),inspectError(_0x4f0cc5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x47d0a7,_0x188894){return cmHopper[_0xef61('0xd')](_0x47d0a7['id'],_0x188894,_0x47d0a7[_0xef61('0x8')])[_0xef61('0x9')](function(_0x2af74c){_0x47d0a7[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xe'),inspectError(_0x2af74c));});}exports[_0xef61('0xd')]=getContactDialerIvr;function countReScheduled(_0x66e7b2){return cmHopper[_0xef61('0xf')](_0x66e7b2)[_0xef61('0x9')](function(_0x114e1f){logger[_0xef61('0xb')]('[countReScheduled]',inspectError(_0x114e1f));});}exports[_0xef61('0xf')]=countReScheduled;function rescheduleContact(_0x58d9a0){return cmHopper[_0xef61('0x10')](_0x58d9a0)[_0xef61('0x9')](function(_0x370ee0){logger[_0xef61('0xb')]('[rescheduleContact]',inspectError(_0x370ee0));});}exports[_0xef61('0x10')]=rescheduleContact;function unlockContact(_0x435beb,_0x1224c2,_0x78ff22){return cmHopper['unlockContact'](_0x435beb,_0x1224c2,_0x78ff22)[_0xef61('0x9')](function(_0xbe23a7){logger['error'](_0xef61('0x11'),inspectError(_0xbe23a7));});}exports[_0xef61('0x12')]=unlockContact;function moveContactManagedDialer(_0x36f558){return cmHopper[_0xef61('0x13')](_0x36f558)[_0xef61('0x9')](function(_0x28315a){logger[_0xef61('0xb')]('[moveContactManagedDialer]',inspectError(_0x28315a));});}exports[_0xef61('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x2c8dad){return cmHopperBlack['checkIsBlackList'](_0x2c8dad)[_0xef61('0x9')](function(_0x36966a){logger[_0xef61('0xb')](_0xef61('0x14'),inspectError(_0x36966a));});}exports[_0xef61('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x2ed61e){return cmHopperBlack[_0xef61('0x16')](_0x2ed61e)['catch'](function(_0x536e9e){logger[_0xef61('0xb')]('[checkIsBlackListIvr]',inspectError(_0x536e9e));});}exports[_0xef61('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5ae7a2,_0x488b47,_0x2f0569){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5ae7a2,_0x488b47,_0x2f0569)['catch'](function(_0xfbee94){logger[_0xef61('0xb')](_0xef61('0x17'),inspectError(_0xfbee94));});}exports[_0xef61('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5e56da,_0x16b144,_0x4e738f){return cmHopperAdditionalPhone[_0xef61('0x19')](_0x5e56da,_0x16b144,_0x4e738f)[_0xef61('0x9')](function(_0x2419a9){logger[_0xef61('0xb')](_0xef61('0x1a'),inspectError(_0x2419a9));});}exports[_0xef61('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x258b5a){return cmHopperHistory[_0xef61('0x1b')](_0x258b5a)[_0xef61('0x9')](function(_0x1ee27b){logger[_0xef61('0xb')](_0xef61('0x1c'),inspectError(_0x1ee27b));});}exports[_0xef61('0x1b')]=avgHandleTime;function createHistory(_0x63edd4){return cmHopperHistory[_0xef61('0x1d')](_0x63edd4)[_0xef61('0x9')](function(_0x39c15e){logger[_0xef61('0xb')](_0xef61('0x1e'),inspectError(_0x39c15e));});}exports[_0xef61('0x1d')]=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 d4feb64..23a14d0 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 _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 +var _0x054f=['loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','status','ACTIVE','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','extractCalleridName','isUndefined','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','tags','updatedAt','undefined','XMD-','substring','toUpperCase','setXMDContactVariables','util','../../../../config/logger','dialer','../../../../config/environment/shared','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','isQueueCampaignActive','active','diff','seconds','dialActive','available'];(function(_0xf39fd0,_0x9f4f32){var _0x459ebf=function(_0x43268f){while(--_0x43268f){_0xf39fd0['push'](_0xf39fd0['shift']());}};_0x459ebf(++_0x9f4f32);}(_0x054f,0x1cb));var _0xf054=function(_0x4bc5f5,_0x3fc086){_0x4bc5f5=_0x4bc5f5-0x0;var _0x54d2c5=_0x054f[_0x4bc5f5];return _0x54d2c5;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xf054('0x0'));var logger=require(_0xf054('0x1'))(_0xf054('0x2'));var timezones=require(_0xf054('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xf054('0x4'),'CONTACTS_RESCHEDULED':_0xf054('0x5'),'DEACTIVATED':_0xf054('0x6'),'DISACTIVED':_0xf054('0x7'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xf054('0x8'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xf054('0x9'),'NULL_INTERVAL':_0xf054('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xf054('0xb'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xf054('0xc'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xf054('0xd')};exports[_0xf054('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1553f3){return _0x1553f3[_0xf054('0xf')]==='preview';}exports[_0xf054('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x417dbf){return _0x417dbf[_0xf054('0x11')]===_0xf054('0x12');}exports[_0xf054('0x13')]=isIVRCampaign;function isOutboundQueue(_0x410c50){return _0x410c50['type']==='outbound';}exports[_0xf054('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x2d4e4d){return _0x2d4e4d['dialActive'];}exports[_0xf054('0x15')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5cc876){return _0x5cc876[_0xf054('0x16')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x401d6a,_0x4f0932){var _0x102c08=moment(_0x401d6a)['milliseconds'](0x0);var _0x5601e1=moment(_0x4f0932)['milliseconds'](0x0);return _0x102c08[_0xf054('0x17')](_0x5601e1,_0xf054('0x18'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x7f6094,_0x3799e6){var _0x42fd72=![];var _0x249e28=_0x7f6094[_0xf054('0xf')]!==_0x3799e6[_0xf054('0xf')]||_0x7f6094[_0xf054('0x19')]!==_0x3799e6[_0xf054('0x19')]||_0x7f6094['message']!==_0x3799e6['message'];var _0x1d3197=_0x7f6094['available']!==_0x3799e6[_0xf054('0x1a')]||_0x7f6094[_0xf054('0x1b')]!==_0x3799e6[_0xf054('0x1b')]||_0x7f6094[_0xf054('0x1c')]!==_0x3799e6[_0xf054('0x1c')]||_0x7f6094[_0xf054('0x1d')]!==_0x3799e6[_0xf054('0x1d')]||_0x7f6094['talking']!==_0x3799e6[_0xf054('0x1e')]||_0x7f6094[_0xf054('0x1f')]!==_0x3799e6['pTalking']||_0x7f6094[_0xf054('0x20')]!==_0x3799e6[_0xf054('0x20')]||_0x7f6094[_0xf054('0x21')]!==_0x3799e6[_0xf054('0x21')]||_0x7f6094[_0xf054('0x22')]!==_0x3799e6['originated'];if(_0x7f6094['Trunk']&&_0x3799e6[_0xf054('0x23')]){_0x42fd72=_0x7f6094['Trunk'][_0xf054('0x24')]!==_0x3799e6[_0xf054('0x23')][_0xf054('0x24')]||_0x7f6094[_0xf054('0x23')]['active']!==_0x3799e6['Trunk']['active'];}return _0x249e28||_0x1d3197||_0x42fd72;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x380146){var _0x339c08=null;var _0x5317ab=_0x380146[_0xf054('0x25')];if(_[_0xf054('0x26')](_0x380146[_0xf054('0x27')])||_[_0xf054('0x26')](_0x380146[_0xf054('0x28')])||_[_0xf054('0x26')](_0x380146[_0xf054('0x28')][_0xf054('0x29')])){_0x339c08=CAMPAIGN_STATUS[_0xf054('0x2a')];}else if(_[_0xf054('0x2b')](_0x380146[_0xf054('0x27')])||_[_0xf054('0x2b')](_0x380146['Interval']['Intervals'])){_0x339c08=CAMPAIGN_STATUS[_0xf054('0x2c')];}else if(_0x5317ab&&!timezones[_0x5317ab]){_0x339c08=CAMPAIGN_STATUS[_0xf054('0x2d')];}return _0x339c08;}function checkAnyValidTrunk(_0x23a8f4,_0x1c8a1f){var _0x55a827=null;var _0x1c31a8=_0xf054('0x2e');var _0x3e8409=[_0xf054('0x2f'),_0xf054('0x30')];var _0x57e572=!![];if(_0x23a8f4['Trunk']&&_0x23a8f4[_0xf054('0x23')][_0xf054('0x16')]){_0x1c31a8+=_0x23a8f4[_0xf054('0x23')]['name'];_0x55a827=_0x1c8a1f[_0x1c31a8];_0x57e572=_0x3e8409[_0xf054('0x31')](_0x55a827['status']);}else if(_0x23a8f4[_0xf054('0x32')]&&_0x23a8f4['TrunkBackup']['active']){_0x1c31a8+=_0x23a8f4[_0xf054('0x32')][_0xf054('0x24')];_0x55a827=_0x1c8a1f[_0x1c31a8];_0x57e572=_0x3e8409[_0xf054('0x31')](_0x55a827[_0xf054('0x33')]);}return _0x57e572;}function getQueueCampaignStatusMessage(_0x292499,_0x4317ed){var _0x1fe678=CAMPAIGN_STATUS[_0xf054('0x34')];var _0x243acd=isPreviewCampaign(_0x292499);if(!isQueueCampaignActive(_0x292499)){if(_0x243acd){_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x35')];}else{if(_0x292499[_0xf054('0x22')]===0x0&&_0x292499['talking']===0x0&&_0x292499[_0xf054('0x20')]===0x0&&(_0x292499[_0xf054('0x1f')]||0x0)===0x0){_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x35')];}else{_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x36')];}}}else if(_0x292499[_0xf054('0x1b')]===0x0){_0x1fe678=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x292499,_0x4317ed)){_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x37')];}else if(!isPreviewCampaign(_0x292499)){var _0x55e732=checkAnyValidQueueCampaignInterval(_0x292499);if(_0x55e732){_0x1fe678=_0x55e732;}}return _0x1fe678;}exports[_0xf054('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5d8e44){var _0x1b8d91=CAMPAIGN_STATUS['DISACTIVED'];if(_0x5d8e44['originated']===0x0&&_0x5d8e44[_0xf054('0x1e')]===0x0&&_0x5d8e44[_0xf054('0x20')]===0x0&&(_0x5d8e44['pTalking']||0x0)===0x0){_0x1b8d91=CAMPAIGN_STATUS[_0xf054('0x35')];}return _0x1b8d91;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2d7148){var _0x520cec=_0x2d7148['match'](/"(.*?)"/);return _0x520cec?_0x520cec[0x1]:_0x2d7148;}exports[_0xf054('0x39')]=extractCalleridName;function getCallerId(_0x431443,_0x119d99,_0x55cf87){if(!_[_0xf054('0x3a')](_0x55cf87)&&typeof _0x55cf87==='string'&&!_[_0xf054('0x2b')](_0x55cf87)){if(!_[_0xf054('0x3a')](_0x119d99)&&typeof _0x119d99==='string'&&!_['isEmpty'](_0x119d99)){return util[_0xf054('0x3b')](_0xf054('0x3c'),_0x119d99,_0x55cf87);}return util['format'](_0xf054('0x3c'),_0x55cf87,_0x55cf87);}if(!_[_0xf054('0x3a')](_0x431443)&&typeof _0x431443===_0xf054('0x3d')&&!_[_0xf054('0x2b')](_0x431443)){return _0x431443;}return _0xf054('0x3e');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x38b5e3,_0x146282){var _0x12a87e;var _0x4db53c;var _0xd1857a;if(_0x146282<=0x0){_0x146282=0x1;}_0x12a87e=new RegExp(_0xf054('0x3f')+_0x146282+'}$');_0x4db53c=Math['pow'](0xa,_0x146282-0x1);_0xd1857a=Math[_0xf054('0x40')](0xa,_0x146282)-0x1;return util[_0xf054('0x3b')]('%s',_['replace'](_0x38b5e3,_0x12a87e,_[_0xf054('0x41')](_0x4db53c,_0xd1857a)[_0xf054('0x42')]()));}exports[_0xf054('0x43')]=getCallerIdRandom;function decrementOriginate(_0x169e93,_0xb02c2c){if(_0x169e93[_0xf054('0x22')]&&_0x169e93[_0xf054('0x22')]>0x0){_0x169e93[_0xf054('0x22')]-=0x1;}else{logger[_0xf054('0x44')](_0xf054('0x45'),_0xb02c2c);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x3d41e9){return _0x3d41e9&&_0x3d41e9[_0xf054('0x46')]>0x0;}exports[_0xf054('0x47')]=checkContactEmpty;function erlangb(_0x4358c0,_0x4e9929){if(_0x4e9929===0x0){return 0x0;}var _0x387a96=0x1;for(var _0xcc3094=0x1;_0xcc3094<=_0x4e9929;_0xcc3094+=0x1){_0x387a96=0x1+_0x387a96*_0xcc3094/_0x4358c0;}return 0x1/_0x387a96;}exports[_0xf054('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x16801f,_0x45f515,_0x46c06a){if(_0x45f515>_0x46c06a){for(var _0x37d34d=0x0;_0x37d34d<_0x45f515-_0x46c06a;_0x37d34d+=0x1){decrementOriginate(_0x16801f,_0xf054('0x49'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x269871){var _0x120b55={};var _0x2eb3f0=['id','createdAt',_0xf054('0x4a'),_0xf054('0x4b')];const _0x4e26e0=0xfa;if(_0x269871){for(var _0x34a524 in _0x269871){if(typeof _0x269871[_0x34a524]!==_0xf054('0x4c')){if(!_[_0xf054('0x26')](_0x269871[_0x34a524])&&!_0x2eb3f0['includes'](_0x34a524)){if(_0x34a524==='description'&&_0x269871[_0x34a524][_0xf054('0x46')]>_0x4e26e0){_0x120b55[_0xf054('0x4d')+_0x34a524['toUpperCase']()]=_0x269871[_0x34a524][_0xf054('0x42')]()[_0xf054('0x4e')](0x0,_0x4e26e0);}else{_0x120b55[_0xf054('0x4d')+_0x34a524[_0xf054('0x4f')]()]=_0x269871[_0x34a524];}}}}}return _0x120b55;}exports[_0xf054('0x50')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 576bec9..bb3b7c6 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(_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 +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3fb38d,_0x1462ee){var _0x400fa8=function(_0x18c344){while(--_0x18c344){_0x3fb38d['push'](_0x3fb38d['shift']());}};_0x400fa8(++_0x1462ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 86dd8b6..c46dd5e 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 _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 +var _0x9696=['catch','syncOriginateResponse','actions','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','reachable','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','deleteChannelAfterTimeout','util','lodash','uuid','path','tiff2pdf','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','value','operation','status','filename','remotestationid','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','error','\x20notify\x20','stringify'];(function(_0x1fb7d1,_0x108781){var _0x2480d8=function(_0x9bc3d9){while(--_0x9bc3d9){_0x1fb7d1['push'](_0x1fb7d1['shift']());}};_0x2480d8(++_0x108781);}(_0x9696,0x17f));var _0x6969=function(_0x39e357,_0x4ab758){_0x39e357=_0x39e357-0x0;var _0x1fe3f7=_0x9696[_0x39e357];return _0x1fe3f7;};'use strict';var util=require(_0x6969('0x0'));var _=require(_0x6969('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6969('0x2'));var moment=require('moment');var path=require(_0x6969('0x3'));var tiff2pdf=require(_0x6969('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x6969('0x5'));var ami=require(_0x6969('0x6'));var rpcDb=require(_0x6969('0x7'));var Channel=require('./channel');var ut=require(_0x6969('0x8'));var Action=require(_0x6969('0x9'));var faxAccount=require(_0x6969('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x6969('0xb'));function Fax(_0x1865b7){this[_0x6969('0xc')]={};this[_0x6969('0xd')]=_0x1865b7[_0x6969('0xd')];this[_0x6969('0xe')]=_0x1865b7[_0x6969('0xe')];this['actions']={};ami['on'](_0x6969('0xf'),this[_0x6969('0x10')]['bind'](this));ami['on'](_0x6969('0x11'),this[_0x6969('0x12')][_0x6969('0x13')](this));ami['on'](_0x6969('0x14'),this[_0x6969('0x15')]['bind'](this));ami['on'](_0x6969('0x16'),this[_0x6969('0x17')][_0x6969('0x13')](this));ami['on']('faxstatus',this[_0x6969('0x18')]['bind'](this));ami['on']('receivefax',this[_0x6969('0x19')][_0x6969('0x13')](this));ami['on'](_0x6969('0x1a'),this[_0x6969('0x1b')][_0x6969('0x13')](this));ami['on'](_0x6969('0x1c'),this['syncOriginateResponse'][_0x6969('0x13')](this));}Fax[_0x6969('0x1d')][_0x6969('0x10')]=function(_0x2f7aa7){if(_0x2f7aa7['context']===_0x6969('0x1e')){for(var _0x35318d in this['faxAccounts']){if(this[_0x6969('0xd')][_0x6969('0x1f')](_0x35318d)){if(_0x2f7aa7[_0x6969('0x20')]===this[_0x6969('0xd')][_0x35318d][_0x6969('0x21')]){this[_0x6969('0xc')][_0x2f7aa7['uniqueid']]={};this['channels'][_0x2f7aa7[_0x6969('0x22')]][_0x6969('0x23')]=_0x2f7aa7[_0x6969('0x23')];this['channels'][_0x2f7aa7['uniqueid']]['id']=this[_0x6969('0xd')][_0x35318d]['id'];this[_0x6969('0xc')][_0x2f7aa7[_0x6969('0x22')]][_0x6969('0x24')]=this['faxAccounts'][_0x35318d][_0x6969('0x24')];logger[_0x6969('0x25')](_0x2f7aa7[_0x6969('0x22')],_0x6969('0x26'));}}}}if(this['actions'][_0x2f7aa7[_0x6969('0x22')]]){this[_0x6969('0xc')][_0x2f7aa7[_0x6969('0x22')]]={};this[_0x6969('0xc')][_0x2f7aa7[_0x6969('0x22')]][_0x6969('0x23')]=_0x2f7aa7['channel'];logger['info'](_0x2f7aa7[_0x6969('0x22')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x3207d9){if(this[_0x6969('0xc')][_0x3207d9[_0x6969('0x22')]]){for(var _0x21b0cb in _0x3207d9[_0x6969('0x27')]){if(_0x3207d9[_0x6969('0x27')][_0x6969('0x1f')](_0x21b0cb)){this[_0x6969('0xc')][_0x3207d9['uniqueid']][_0x21b0cb]=_0x3207d9['value'];}}}};Fax[_0x6969('0x1d')]['syncNewState']=function(_0x5bb61e){if(this['channels'][_0x5bb61e[_0x6969('0x22')]]){this['channels'][_0x5bb61e[_0x6969('0x22')]][_0x6969('0x28')]=_0x5bb61e[_0x6969('0x28')];this[_0x6969('0xc')][_0x5bb61e[_0x6969('0x22')]]['channelstatedesc']=_0x5bb61e['channelstatedesc'];}};Fax[_0x6969('0x1d')][_0x6969('0x17')]=function(_0x5dae90){if(this[_0x6969('0xc')][_0x5dae90[_0x6969('0x22')]]){for(var _0x2e9cf0 in _0x5dae90[_0x6969('0x27')]){if(_0x5dae90['variable'][_0x6969('0x1f')](_0x2e9cf0)){this[_0x6969('0xc')][_0x5dae90[_0x6969('0x22')]][_0x2e9cf0]=_0x5dae90[_0x6969('0x29')];}}}};Fax[_0x6969('0x1d')][_0x6969('0x18')]=function(_0x2ec5c8){if(this[_0x6969('0xc')][_0x2ec5c8[_0x6969('0x22')]]){this[_0x6969('0xc')][_0x2ec5c8['uniqueid']][_0x6969('0x2a')]=_0x2ec5c8[_0x6969('0x2a')];this['channels'][_0x2ec5c8[_0x6969('0x22')]][_0x6969('0x2b')]=_0x2ec5c8[_0x6969('0x2b')];this['channels'][_0x2ec5c8[_0x6969('0x22')]][_0x6969('0x21')]=_0x2ec5c8['localstationid'];this[_0x6969('0xc')][_0x2ec5c8[_0x6969('0x22')]][_0x6969('0x2c')]=_0x2ec5c8['filename'];logger['info'](_0x2ec5c8['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x6969('0x1d')]['syncReceiveFax']=function(_0x5c4403){var _0x3701ca=this;if(this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]]){var _0x198751=this[_0x6969('0xc')][_0x5c4403['uniqueid']]['id'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]]['remotestationid']=_0x5c4403[_0x6969('0x2d')];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2e')]=_0x5c4403['pagestransferred'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x21')]=_0x5c4403[_0x6969('0x21')];this['channels'][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2f')]=_0x5c4403[_0x6969('0x2f')];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]]['transferrate']=_0x5c4403['transferrate'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2c')]=_0x5c4403['filename'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x30')]=_0x5c4403[_0x6969('0x30')];if(this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2e')]>0x0){tiff2pdf(_0x5c4403[_0x6969('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x5b9cbb){logger[_0x6969('0x25')](_0x5c4403[_0x6969('0x22')],_0x6969('0x31'),_0x5b9cbb[_0x6969('0x32')]);attachment['create']({'name':path[_0x6969('0x33')](_0x5c4403['filename'])[_0x6969('0x24')],'basename':path[_0x6969('0x33')](_0x5c4403[_0x6969('0x2c')])[_0x6969('0x24')]+_0x6969('0x34'),'type':'application/pdf'})[_0x6969('0x35')](function(_0x542eb6){faxAccount['notify'](_0x198751,{'from':_0x5c4403[_0x6969('0x30')],'mapKey':'fax','body':path[_0x6969('0x33')](_0x5c4403[_0x6969('0x2c')])[_0x6969('0x24')]+_0x6969('0x34'),'AttachmentId':_0x542eb6['id']})['catch'](function(_0x1c7275){logger[_0x6969('0x36')](_0x5c4403['uniqueid'],_0x6969('0x37'),JSON[_0x6969('0x38')](_0x1c7275));});})[_0x6969('0x39')](function(_0x5e9fd8){logger[_0x6969('0x36')](_0x5c4403[_0x6969('0x22')],'\x20receiveFax\x20',JSON[_0x6969('0x38')](_0x5e9fd8));});});}logger[_0x6969('0x25')](_0x5c4403[_0x6969('0x22')],'\x20receiveFax\x20');}};Fax['prototype'][_0x6969('0x3a')]=function(_0x4ed9da){if(this[_0x6969('0x3b')][_0x4ed9da[_0x6969('0x22')]]){_[_0x6969('0x3c')](this[_0x6969('0xc')][_0x4ed9da[_0x6969('0x22')]],_[_0x6969('0x3d')](_0x4ed9da,[_0x6969('0x3e'),_0x6969('0x3f')]));}};function updateStatus(_0x3d8dcc){if(_0x3d8dcc[_0x6969('0x40')]){faxMessage['update'](_0x3d8dcc[_0x6969('0x40')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x6969('0x35')](function(_0x4d65fa){ut[_0x6969('0x41')](_0x6969('0x42'),_0x4d65fa);})[_0x6969('0x39')](function(_0xb2793a){ut['logger'](_0x6969('0x43'),_0xb2793a);});}else{ut[_0x6969('0x41')](_0x6969('0x44'));}}Fax[_0x6969('0x1d')][_0x6969('0x45')]=function(_0x58e3a2,_0x4e545f,_0x1cfb49){var _0x10232e=this;var _0x111b1c={};if(_0x4e545f){_0x111b1c={'read':_0x4e545f};}else{_0x111b1c={'failMessage':_0x1cfb49};}if(this[_0x6969('0x3b')][_0x58e3a2][_0x6969('0x40')]){faxMessage['update'](this[_0x6969('0x3b')][_0x58e3a2][_0x6969('0x40')],_0x111b1c)[_0x6969('0x35')](function(_0x5f09cb){ut['logger'](_0x6969('0x46'),_0x5f09cb);})['catch'](function(_0x48208b){ut[_0x6969('0x41')]('[Fax][Message][NoUpdate1]',_0x48208b);})['finally'](function(){delete _0x10232e['channels'][_0x58e3a2];delete _0x10232e[_0x6969('0x3b')][_0x58e3a2];});}else{ut[_0x6969('0x41')](_0x6969('0x47'));this['deleteChannelAfterTimeout'](_0x58e3a2);delete this[_0x6969('0x3b')][_0x58e3a2];}};Fax['prototype'][_0x6969('0x1b')]=function(_0x1f7830){var _0x2bfc67=this;if(this[_0x6969('0xc')][_0x1f7830[_0x6969('0x22')]]){if(this[_0x6969('0x3b')][_0x1f7830[_0x6969('0x22')]]){this[_0x6969('0xc')][_0x1f7830['uniqueid']]['id']=this['actions'][_0x1f7830['uniqueid']]['id'];this[_0x6969('0xc')][_0x1f7830[_0x6969('0x22')]][_0x6969('0x24')]=this[_0x6969('0x3b')][_0x1f7830[_0x6969('0x22')]][_0x6969('0x24')];}logger[_0x6969('0x25')](_0x1f7830[_0x6969('0x22')],this[_0x6969('0x3b')][_0x1f7830[_0x6969('0x22')]]?_0x6969('0x48'):_0x6969('0x49'),JSON['stringify'](this[_0x6969('0xc')][_0x1f7830[_0x6969('0x22')]]));if(this['actions'][_0x1f7830['uniqueid']]){if(this[_0x6969('0xc')][_0x1f7830['uniqueid']]['faxpages']>0x0&&this[_0x6969('0xc')][_0x1f7830['uniqueid']][_0x6969('0x4a')]===_0x6969('0x4b')){this[_0x6969('0x45')](_0x1f7830[_0x6969('0x22')],!![]);}else{this['updateStatus'](_0x1f7830[_0x6969('0x22')],![],this[_0x6969('0xc')][_0x1f7830['uniqueid']][_0x6969('0x4c')]?'SENDING\x20FAILED:\x20'+this[_0x6969('0xc')][_0x1f7830['uniqueid']][_0x6969('0x4c')]:_0x6969('0x4d'));}}}};Fax['prototype']['send']=function(_0x391cd9){var _0x1aa579=this;return new BPromise(function(_0x3eb0ad,_0x64cbb7){_0x1aa579[_0x6969('0x4e')](_0x391cd9,_0x1aa579[_0x6969('0xd')][_0x391cd9['FaxAccountId']])['then'](function(_0x266fa1){ut[_0x6969('0x41')]('[Fax][execOriginate][success]',_0x266fa1);_0x3eb0ad(ut[_0x6969('0x32')](_0x6969('0x4f')));})[_0x6969('0x39')](function(_0x3e8354){ut[_0x6969('0x41')](_0x6969('0x50'),_0x3e8354);updateStatus(_0x391cd9);_0x64cbb7(ut[_0x6969('0x32')](_0x6969('0x51')));});});};Fax['prototype'][_0x6969('0x52')]=function(_0xb1019b){var _0x134655=this;return new BPromise(function(_0x7d1a50,_0x3509ff){var _0x2e426e=_0x134655[_0x6969('0x53')](_0x134655[_0x6969('0xd')][_0xb1019b[_0x6969('0x54')]][_0x6969('0x55')],_0xb1019b);if(_0x2e426e['isValid']){_0x7d1a50(ut[_0x6969('0x32')](_0x6969('0x56')));}else{_0x3509ff(ut[_0x6969('0x32')](_0x2e426e['message']));}});};function originate(_0x5da553,_0x2ff7dc,_0xf71db9){return new BPromise(function(_0x1d2d1f,_0x3b6c89){if(_0xf71db9){var _0x3b10b7=util[_0x6969('0x57')](_0x6969('0x58'),path[_0x6969('0x33')](_0x5da553['path'])[_0x6969('0x24')],_0x5da553[_0x6969('0x3')]);gs[_0x6969('0x59')](_0x3b10b7)[_0x6969('0x35')](function(){_0x5da553[_0x6969('0x3')]=util[_0x6969('0x57')](_0x6969('0x5a'),path[_0x6969('0x33')](_0x5da553[_0x6969('0x3')])[_0x6969('0x5b')],path[_0x6969('0x33')](_0x5da553[_0x6969('0x3')])[_0x6969('0x24')]);_0x2ff7dc[_0x6969('0x5c')]=_0x5da553['path'];ut['logger'](_0x6969('0x5d'),'');ami[_0x6969('0x5e')](ut[_0x6969('0x5f')](_0x5da553,_0x2ff7dc))[_0x6969('0x35')](function(_0x294916){_0x1d2d1f(_0x294916);})[_0x6969('0x39')](function(_0x2d442f){_0x3b6c89(_0x2d442f);});})[_0x6969('0x39')](function(_0x26d129){_0x3b6c89(_0x26d129);});}else{ami[_0x6969('0x5e')](ut[_0x6969('0x5f')](_0x5da553,_0x2ff7dc))[_0x6969('0x35')](function(_0x17332f){_0x1d2d1f(_0x17332f);})[_0x6969('0x39')](function(_0x37d49d){_0x3b6c89(_0x37d49d);});}});}Fax[_0x6969('0x1d')][_0x6969('0x4e')]=function(_0x2b244a,_0x582922){var _0x56f73a=this;return new BPromise(function(_0x124f82,_0xa5e5e7){var _0x4b1478=uuid['v4']();var _0xef980f=ut[_0x6969('0x60')](_0x2b244a,_0x582922);_0x56f73a[_0x6969('0x3b')][_0x4b1478]=new Action(_0x4b1478,_0x582922,_0x2b244a);var _0x9ffa4=_0x56f73a[_0x6969('0x3b')][_0x4b1478];if(path[_0x6969('0x33')](_0x2b244a['path'])[_0x6969('0x61')]===_0x6969('0x34')){originate(_0x9ffa4,_0xef980f,!![])['then'](function(_0x30b938){_0x124f82(_0x30b938);})[_0x6969('0x39')](function(_0x1948b3){_0xa5e5e7(_0x1948b3);});}else{originate(_0x9ffa4,_0xef980f,![])['then'](function(_0x14fa2b){_0x124f82(_0x14fa2b);})[_0x6969('0x39')](function(_0x2f78d9){_0xa5e5e7(_0x2f78d9);});}});};Fax[_0x6969('0x1d')][_0x6969('0x62')]=function(_0xb17206){return!_[_0x6969('0x63')](_0xb17206)&&!_['isNil'](_0xb17206[_0x6969('0x24')])&&!_[_0x6969('0x63')](_0xb17206[_0x6969('0x64')])&&_0xb17206[_0x6969('0x64')]&&!_[_0x6969('0x63')](this[_0x6969('0xe')][util[_0x6969('0x57')]('SIP/%s',_0xb17206['name'])])&&!_[_0x6969('0x63')](this[_0x6969('0xe')][util[_0x6969('0x57')]('SIP/%s',_0xb17206[_0x6969('0x24')])][_0x6969('0x2b')])&&(this['trunks'][util['format']('SIP/%s',_0xb17206[_0x6969('0x24')])][_0x6969('0x2b')]===_0x6969('0x65')||this[_0x6969('0xe')][util[_0x6969('0x57')](_0x6969('0x66'),_0xb17206[_0x6969('0x24')])][_0x6969('0x2b')]===_0x6969('0x67'));};Fax[_0x6969('0x1d')]['checkTrunk']=function(_0x8758c2,_0x5cbe62){if(!this[_0x6969('0x62')](_0x8758c2)){ut[_0x6969('0x41')](_0x6969('0x68'),_['isNil'](_0x8758c2)?'':_0x8758c2[_0x6969('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x6969('0x63')](_0x5cbe62[_0x6969('0x5')])){ut[_0x6969('0x41')](_0x6969('0x69'),JSON[_0x6969('0x38')](_0x5cbe62));return{'isValid':![],'message':_0x6969('0x6a')};}if(_[_0x6969('0x63')](_0x5cbe62[_0x6969('0x3')])){ut[_0x6969('0x41')](_0x6969('0x6b'),JSON[_0x6969('0x38')](_0x5cbe62));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x6969('0x6c')};};Fax[_0x6969('0x1d')][_0x6969('0x6d')]=function(_0x434825,_0x1ad50e=0x2710){if(this[_0x6969('0xc')][_0x434825]){setTimeout(()=>{delete this[_0x6969('0xc')][_0x434825];},_0x1ad50e);}};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3f13642..f6d4bbd 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 _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 +var _0xfed7=['[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x29d335,_0x4346a8){var _0x3b0563=function(_0x1fe7b2){while(--_0x1fe7b2){_0x29d335['push'](_0x29d335['shift']());}};_0x3b0563(++_0x4346a8);}(_0xfed7,0xfb));var _0x7fed=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xfed7[_0x1ee351];return _0x245aaf;};'use strict';var util=require(_0x7fed('0x0'));var BPromise=require(_0x7fed('0x1'));var logger=require(_0x7fed('0x2'))('preview');var _=require(_0x7fed('0x3'));var faxAccount=require(_0x7fed('0x4'));function loggerCatch(_0x3d6ed1){return function(_0x535a24){logger[_0x7fed('0x5')](_0x3d6ed1,util[_0x7fed('0x6')](_0x535a24,{'showHidden':![],'depth':null}));};}exports[_0x7fed('0x7')]=function(_0x551aab,_0x17640f){return BPromise[_0x7fed('0x8')]()['then'](faxAccount[_0x7fed('0x7')](_0x551aab,_0x17640f))['catch'](loggerCatch(_0x7fed('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 5f25e37..79d40fa 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 _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 +var _0x13ed=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x335afe,_0x163f27){var _0x248dcd=function(_0x5c70ba){while(--_0x5c70ba){_0x335afe['push'](_0x335afe['shift']());}};_0x248dcd(++_0x163f27);}(_0x13ed,0x1f2));var _0xd13e=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x13ed[_0x5e3701];return _0x345dcf;};'use strict';var util=require(_0xd13e('0x0'));var logger=require(_0xd13e('0x1'))('fax');var BPromise=require(_0xd13e('0x2'));var exec=require(_0xd13e('0x3'))[_0xd13e('0x4')];exports[_0xd13e('0x5')]=function(_0x28ed88){return new BPromise(function(_0x19a905,_0x42ac5e){exec(_0x28ed88,function(_0x16bcc6,_0x389035,_0x3dc87d){logger[_0xd13e('0x6')]('Exec\x20gs',_0x389035);if(_0x16bcc6){logger[_0xd13e('0x6')](_0xd13e('0x7'),_0xd13e('0x8'),util[_0xd13e('0x9')](_0x16bcc6,{'showHidden':![],'depth':null}),_0x389035,_0x3dc87d);_0x42ac5e(_0x16bcc6);}_0x19a905(_0x389035);});});}; \ 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 a01cf91..9bd906d 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 _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 +var _0xc9d4=['../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment'];(function(_0x504fa7,_0x11a97b){var _0x11986f=function(_0x89a311){while(--_0x89a311){_0x504fa7['push'](_0x504fa7['shift']());}};_0x11986f(++_0x11a97b);}(_0xc9d4,0xf0));var _0x4c9d=function(_0x203a6d,_0x20da4c){_0x203a6d=_0x203a6d-0x0;var _0x132fa8=_0xc9d4[_0x203a6d];return _0x132fa8;};'use strict';var util=require(_0x4c9d('0x0'));var _=require(_0x4c9d('0x1'));var moment=require(_0x4c9d('0x2'));var logger=require(_0x4c9d('0x3'))(_0x4c9d('0x4'));exports[_0x4c9d('0x5')]=function(_0x4202cf){return{'message':_0x4202cf};};exports[_0x4c9d('0x6')]=function(_0x33f939,_0x231e0e){logger[_0x4c9d('0x7')](_0x33f939,util[_0x4c9d('0x8')](_0x231e0e,{'showHidden':![],'depth':null}));};exports[_0x4c9d('0x9')]=function(_0x21d81d,_0xd7e665){var _0xb576c2={'XMF-ECM':_0xd7e665['ecm'],'XMF-HEADERINFO':_0xd7e665[_0x4c9d('0xa')],'XMF-MINRATE':_0xd7e665['minrate'],'XMF-MAXRATE':_0xd7e665[_0x4c9d('0xb')],'XMF-MODEM':util[_0x4c9d('0xc')](_0x4c9d('0xd'),_0xd7e665[_0x4c9d('0xe')]),'XMF-GATEWAY':_0xd7e665[_0x4c9d('0xf')],'XMF-FAXDETECT':_0xd7e665[_0x4c9d('0x10')],'XMF-T38TIMEOUT':_0xd7e665[_0x4c9d('0x11')],'XMF-LOCALSTATIONID':_0xd7e665[_0x4c9d('0x12')],'XMF-PATH':_0x21d81d[_0x4c9d('0x13')]};return _0xb576c2;};exports[_0x4c9d('0x14')]=function(_0x497d13,_0x5352e8){return{'actionid':_0x497d13[_0x4c9d('0x15')],'action':_0x4c9d('0x16'),'channel':_0x497d13[_0x4c9d('0x17')],'Exten':_0x4c9d('0x18'),'Context':_0x4c9d('0x19'),'Priority':'1','callerid':util['format'](_0x4c9d('0x1a'),_0x497d13[_0x4c9d('0xa')]?_0x497d13['headerinfo']:'',_0x497d13['localstationid']),'variable':_0x5352e8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x497d13[_0x4c9d('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e4e937d..12d59a7 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 _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 +var _0x6000=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk'];(function(_0x46ac08,_0x1f4418){var _0x525ea7=function(_0x1932c9){while(--_0x1932c9){_0x46ac08['push'](_0x46ac08['shift']());}};_0x525ea7(++_0x1f4418);}(_0x6000,0x77));var _0x0600=function(_0xafd54c,_0x4cf5e5){_0xafd54c=_0xafd54c-0x0;var _0x5686f2=_0x6000[_0xafd54c];return _0x5686f2;};'use strict';var util=require(_0x0600('0x0'));var moment=require(_0x0600('0x1'));var server=require(_0x0600('0x2'));var Realtime=require(_0x0600('0x3'));var Report=require(_0x0600('0x4'));var Acw=require(_0x0600('0x5'));var Trigger=require(_0x0600('0x6'));var Dialer=require(_0x0600('0x7'));var Preview=require('./preview');var Fax=require(_0x0600('0x8'));var user=require(_0x0600('0x9'));var voiceQueue=require(_0x0600('0xa'));var voiceQueueReport=require(_0x0600('0xb'));var voiceCallReport=require(_0x0600('0xc'));var trunk=require(_0x0600('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x0600('0xe'));var cmHopperHistory=require(_0x0600('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x0600('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x0600('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x0600('0x12'));var desk=require(_0x0600('0x13'));var zoho=require(_0x0600('0x14'));var vtiger=require(_0x0600('0x15'));var freshsales=require(_0x0600('0x16'));var servicenow=require(_0x0600('0x17'));var dynamics365=require(_0x0600('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0600('0x19'))(_0x0600('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0600('0x1b')](_0x0600('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0600('0x1b')](_0x0600('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x0600('0x1d')]()[_0x0600('0x1e')](user['getAgents']())[_0x0600('0x1e')](realtime['initAgents']())['then'](user[_0x0600('0x1f')]())[_0x0600('0x1e')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x0600('0x1e')](realtime[_0x0600('0x20')]())[_0x0600('0x1e')](voiceQueue[_0x0600('0x21')]())['then'](realtime[_0x0600('0x22')]())[_0x0600('0x1e')](trigger[_0x0600('0x23')]())['then'](realtime[_0x0600('0x24')]())[_0x0600('0x1e')](template[_0x0600('0x25')]())[_0x0600('0x1e')](realtime[_0x0600('0x26')]())[_0x0600('0x1e')](zendesk[_0x0600('0x27')]())[_0x0600('0x1e')](realtime['initZendeskAccounts']())['then'](salesforce[_0x0600('0x28')]())[_0x0600('0x1e')](realtime[_0x0600('0x29')]())[_0x0600('0x1e')](sugarcrm[_0x0600('0x2a')]())[_0x0600('0x1e')](realtime[_0x0600('0x2b')]())['then'](freshdesk[_0x0600('0x2c')]())[_0x0600('0x1e')](realtime[_0x0600('0x2d')]())['then'](desk[_0x0600('0x2e')]())[_0x0600('0x1e')](realtime[_0x0600('0x2f')]())[_0x0600('0x1e')](zoho['getZohoAccounts']())[_0x0600('0x1e')](realtime['initZohoAccounts']())[_0x0600('0x1e')](vtiger[_0x0600('0x30')]())[_0x0600('0x1e')](realtime[_0x0600('0x31')]())[_0x0600('0x1e')](freshsales[_0x0600('0x32')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x0600('0x33')]())[_0x0600('0x1e')](realtime[_0x0600('0x34')]())['then'](dynamics365[_0x0600('0x35')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0x0600('0x36')]())[_0x0600('0x1e')](realtime['initCampaigns']())[_0x0600('0x1e')](voiceExtension[_0x0600('0x37')]())[_0x0600('0x1e')](realtime[_0x0600('0x38')]())[_0x0600('0x1e')](faxAccount['getFaxAccounts']())[_0x0600('0x1e')](realtime[_0x0600('0x39')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x0600('0x1d')]()[_0x0600('0x1e')](voiceQueueReport[_0x0600('0x3a')]())[_0x0600('0x1e')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x0600('0x3b')]())[_0x0600('0x1e')](realtime[_0x0600('0x3c')]())[_0x0600('0x1e')](cmHopperHistory[_0x0600('0x3d')]())[_0x0600('0x1e')](realtime[_0x0600('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x0600('0x1e')](realtime[_0x0600('0x3f')]())[_0x0600('0x40')](function(_0x47dffb){logger[_0x0600('0x41')](_0x0600('0x42'),util[_0x0600('0x43')](_0x47dffb,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x0600('0x1e')](function(){return initRealtime();})[_0x0600('0x1e')](function(){return initParams();})[_0x0600('0x1e')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0xbc611c){logger[_0x0600('0x41')](_0x0600('0x44'),util['inspect'](_0xbc611c,{'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 9036f12..8848604 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 _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 +var _0x34ac=['md5','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','interface','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','state','online','stringify','format','user:%s','user:ami:update','omit','emit','lodash','moment'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x34ac,0x70));var _0xc34a=function(_0x234fdc,_0x55471c){_0x234fdc=_0x234fdc-0x0;var _0x58a1aa=_0x34ac[_0x234fdc];return _0x58a1aa;};'use strict';var _=require(_0xc34a('0x0'));var util=require('util');var moment=require(_0xc34a('0x1'));var md5=require(_0xc34a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xc34a('0x3'),'port':0x18eb});var io=require(_0xc34a('0x4'))(new Redis(config['redis']));function Agent(_0x2c6e9c){this['id']=_0x2c6e9c['id']||0x0;this[_0xc34a('0x5')]=_0x2c6e9c[_0xc34a('0x5')]||'';this['email']=_0x2c6e9c[_0xc34a('0x6')]||'';this[_0xc34a('0x7')]=_0x2c6e9c[_0xc34a('0x7')]||'';this[_0xc34a('0x8')]=_0x2c6e9c[_0xc34a('0x8')]||'';this['state']=_0xc34a('0x9');this[_0xc34a('0xa')]=0x0;this[_0xc34a('0xb')]='unknown';this[_0xc34a('0xc')]='';this[_0xc34a('0xd')]='';this['mobile']='';this[_0xc34a('0xe')]='';this['online']=_0x2c6e9c['online']||![];this[_0xc34a('0xf')]=_0xc34a('0x9');this[_0xc34a('0x10')]=0x0;this[_0xc34a('0x11')]='';this[_0xc34a('0x12')]='';this[_0xc34a('0x13')]=![];this[_0xc34a('0x14')]=![];this['md5']='';}Agent[_0xc34a('0x15')][_0xc34a('0x16')]=function(_0x30a326){var _0x26a75f;if(_0x30a326&&_0x30a326['state']){_0x26a75f=_0x30a326['state'][_0xc34a('0x17')]();switch(_0x26a75f){case _0xc34a('0x18'):_0x26a75f=_0xc34a('0x19');break;case _0xc34a('0x1a'):_0x26a75f=_0xc34a('0x1b');break;}}if(_0x26a75f&&this['voiceStatus']!==_0x26a75f||_0x30a326[_0xc34a('0x1c')]){this[_0xc34a('0x10')]=_[_0xc34a('0x1d')](moment()['format']('x'));}if(_0x26a75f){this['voiceStatus']=_0x26a75f;}var _0x82107e={'id':this['id'],'name':this[_0xc34a('0x5')],'email':this[_0xc34a('0x6')],'accountcode':this[_0xc34a('0x7')],'fullname':this[_0xc34a('0x8')],'state':this[_0xc34a('0x1e')],'stateTime':this[_0xc34a('0xa')],'status':this[_0xc34a('0xb')],'address':this[_0xc34a('0xc')],'online':this[_0xc34a('0x1f')],'voiceStatus':this[_0xc34a('0xf')],'voiceStatusTime':this[_0xc34a('0x10')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xc34a('0x12')],'interface':this[_0xc34a('0xe')],'onhold':this[_0xc34a('0x13')]};var _0x476fb7=md5(JSON[_0xc34a('0x20')](_0x82107e));if(this[_0xc34a('0x2')]!==_0x476fb7){this[_0xc34a('0x2')]=_0x476fb7;io['to'](util[_0xc34a('0x21')](_0xc34a('0x22'),_0x82107e['name']))['emit'](_0xc34a('0x23'),_[_0xc34a('0x24')](_0x82107e,[_0xc34a('0x1f')]));io[_0xc34a('0x25')]('user:presence',_0x82107e);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index d1b3e11..870b9c8 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 _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 +var _0x3791=['Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x496790,_0x3de1ef){var _0x5e7fe1=function(_0x3b6304){while(--_0x3b6304){_0x496790['push'](_0x496790['shift']());}};_0x5e7fe1(++_0x3de1ef);}(_0x3791,0x184));var _0x1379=function(_0x3bc630,_0xfcae02){_0x3bc630=_0x3bc630-0x0;var _0x2cef17=_0x3791[_0x3bc630];return _0x2cef17;};'use strict';function Campaign(_0x45a209){this['id']=_0x45a209['id']||0x0;this[_0x1379('0x0')]=_0x45a209['name']||'';this['type']=_0x45a209['type']||_0x1379('0x1');this[_0x1379('0x2')]=0x0;this['temp']=0x0;this[_0x1379('0x3')]=0x0;this[_0x1379('0x4')]=0x0;this[_0x1379('0x5')]='';this[_0x1379('0x6')]=!![];this[_0x1379('0x7')]=_0x45a209[_0x1379('0x7')];this['limitCalls']=_0x45a209[_0x1379('0x8')];this[_0x1379('0x9')]=_0x45a209['dialTimezone']||null;this[_0x1379('0xa')]=_0x45a209[_0x1379('0xa')]?_0x45a209[_0x1379('0xa')]:null;this[_0x1379('0xb')]=_0x45a209['dialOriginateCallerIdName'];this[_0x1379('0xc')]=_0x45a209[_0x1379('0xc')];this['dialOriginateTimeout']=_0x45a209[_0x1379('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x45a209['dialCongestionMaxRetry'];this[_0x1379('0xe')]=_0x45a209[_0x1379('0xe')];this[_0x1379('0xf')]=_0x45a209[_0x1379('0xf')];this['dialBusyRetryFrequency']=_0x45a209[_0x1379('0x10')];this['dialNoAnswerMaxRetry']=_0x45a209['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x45a209['dialNoAnswerRetryFrequency'];this[_0x1379('0x11')]=_0x45a209[_0x1379('0x11')];this['dialNoSuchNumberMaxRetry']=_0x45a209[_0x1379('0x12')]||0x3;this[_0x1379('0x13')]=_0x45a209['dialNoSuchNumberRetryFrequency']||0x96;this[_0x1379('0x14')]=_0x45a209['dialDropMaxRetry']||0x3;this[_0x1379('0x15')]=_0x45a209[_0x1379('0x15')]||0x96;this[_0x1379('0x16')]=_0x45a209[_0x1379('0x16')]||0x3;this[_0x1379('0x17')]=_0x45a209['dialAbandonedRetryFrequency']||0x96;this[_0x1379('0x18')]=_0x45a209[_0x1379('0x18')]||0x3;this[_0x1379('0x19')]=_0x45a209[_0x1379('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x45a209[_0x1379('0x1a')]||0x3;this[_0x1379('0x1b')]=_0x45a209[_0x1379('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x45a209[_0x1379('0x1c')]||_0x1379('0x1d');this['dialPrefix']=_0x45a209[_0x1379('0x1e')]||undefined;this[_0x1379('0x1f')]=_0x45a209[_0x1379('0x1f')]||undefined;this[_0x1379('0x20')]=_0x45a209['dialCutDigit']||undefined;this[_0x1379('0x21')]=_0x45a209[_0x1379('0x21')]?_0x45a209[_0x1379('0x21')]:undefined;this[_0x1379('0x22')]=_0x45a209[_0x1379('0x22')]?_0x45a209[_0x1379('0x22')]:undefined;this[_0x1379('0x23')]=_0x45a209[_0x1379('0x23')]?_0x45a209['Interval']:undefined;this['SquareProject']=_0x45a209[_0x1379('0x24')]?_0x45a209['SquareProject']:undefined;this['dialQueueProject']=_0x45a209[_0x1379('0x24')]?_0x45a209[_0x1379('0x24')][_0x1379('0x0')]:undefined;this[_0x1379('0x25')]=_0x45a209[_0x1379('0x25')]||![];this[_0x1379('0x26')]=_0x45a209['dialAMDInitialSilence'];this[_0x1379('0x27')]=_0x45a209['dialAMDGreeting'];this[_0x1379('0x28')]=_0x45a209[_0x1379('0x28')];this['dialAMDTotalAnalysisTime']=_0x45a209[_0x1379('0x29')];this['dialAMDMinWordLength']=_0x45a209[_0x1379('0x2a')];this[_0x1379('0x2b')]=_0x45a209[_0x1379('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x45a209['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x45a209[_0x1379('0x2c')];this['dialAMDMaximumWordLength']=_0x45a209[_0x1379('0x2d')];}module[_0x1379('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 713aefc..b7bda60 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 _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 +var _0xfdb5=['type','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answertime','endtime','unmanaged','abandoned','lastdata','billableseconds','holdtime'];(function(_0x16ebba,_0x28fea7){var _0x160cb6=function(_0x5d1361){while(--_0x5d1361){_0x16ebba['push'](_0x16ebba['shift']());}};_0x160cb6(++_0x28fea7);}(_0xfdb5,0x18f));var _0x5fdb=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xfdb5[_0x38ced4];return _0x547c07;};'use strict';function Channel(){this[_0x5fdb('0x0')]=null;this['channel']='';this[_0x5fdb('0x1')]='';this[_0x5fdb('0x2')]=0x0;this[_0x5fdb('0x3')]='';this[_0x5fdb('0x4')]=undefined;this[_0x5fdb('0x5')]=undefined;this[_0x5fdb('0x6')]=0x0;this[_0x5fdb('0x7')]='';this[_0x5fdb('0x8')]=0x0;this['linkedid']=0x0;this[_0x5fdb('0x9')]=0x0;this['answered']=![];this[_0x5fdb('0xa')]=null;this[_0x5fdb('0xb')]=null;this[_0x5fdb('0xc')]=![];this[_0x5fdb('0xd')]=![];this['lastapplication']='';this[_0x5fdb('0xe')]='';this['duration']=0x0;this[_0x5fdb('0xf')]=0x0;this[_0x5fdb('0x10')]=0x0;this[_0x5fdb('0x11')]=null;this['tag']=null;this[_0x5fdb('0x12')]=null;this[_0x5fdb('0x13')]=![];this[_0x5fdb('0x14')]=null;this['queue']=null;this['monitors']=[];this[_0x5fdb('0x15')]=undefined;this[_0x5fdb('0x16')]=undefined;this[_0x5fdb('0x17')]=undefined;this[_0x5fdb('0x18')]=0x0;}module[_0x5fdb('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c3c4100..f031b1a 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 _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 +var _0xef9f=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x41d61d,_0x16ee95){var _0x35e06f=function(_0x41ebcf){while(--_0x41ebcf){_0x41d61d['push'](_0x41d61d['shift']());}};_0x35e06f(++_0x16ee95);}(_0xef9f,0x8f));var _0xfef9=function(_0x12ce75,_0x393661){_0x12ce75=_0x12ce75-0x0;var _0x521554=_0xef9f[_0x12ce75];return _0x521554;};'use strict';function DeskAccount(_0x7fea36){this['id']=_0x7fea36['id']||0x0;this[_0xfef9('0x0')]=_0x7fea36[_0xfef9('0x0')]||'';this[_0xfef9('0x1')]=_0x7fea36[_0xfef9('0x1')]||'';this[_0xfef9('0x2')]=_0x7fea36[_0xfef9('0x2')]||'';this[_0xfef9('0x3')]=_0x7fea36[_0xfef9('0x3')]||'';this['password']=_0x7fea36[_0xfef9('0x4')]||'';this['consumerKey']=_0x7fea36[_0xfef9('0x5')]||'';this[_0xfef9('0x6')]=_0x7fea36[_0xfef9('0x6')]||'';this[_0xfef9('0x7')]=_0x7fea36[_0xfef9('0x7')]||'';this[_0xfef9('0x8')]=_0x7fea36[_0xfef9('0x8')]||'';this[_0xfef9('0x9')]=_0x7fea36['type']||'';this[_0xfef9('0xa')]=_0x7fea36[_0xfef9('0xa')]||'';this[_0xfef9('0xb')]=_0x7fea36[_0xfef9('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 98d90e0..fb3128e 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 _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 +var _0x9220=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x1953af,_0x5e86ed){var _0x3b0a7f=function(_0x300818){while(--_0x300818){_0x1953af['push'](_0x1953af['shift']());}};_0x3b0a7f(++_0x5e86ed);}(_0x9220,0x1ef));var _0x0922=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x9220[_0x36884e];return _0x1cc367;};'use strict';function Dynamics365Account(_0x149850){this['id']=_0x149850['id']||0x0;this[_0x0922('0x0')]=_0x149850['name']||'';this[_0x0922('0x1')]=_0x149850[_0x0922('0x1')]||'';this[_0x0922('0x2')]=_0x149850[_0x0922('0x2')]||'';this[_0x0922('0x3')]=_0x149850['remoteUri']||'';this[_0x0922('0x4')]=_0x149850[_0x0922('0x4')]||'';this[_0x0922('0x5')]=_0x149850[_0x0922('0x5')]||'';this[_0x0922('0x6')]=_0x149850[_0x0922('0x6')]||{};this[_0x0922('0x7')]=_0x149850[_0x0922('0x7')]||'';this['modernAuthentication']=_0x149850[_0x0922('0x8')]||![];this[_0x0922('0x9')]=_0x149850[_0x0922('0x9')]||{};this[_0x0922('0xa')]=_0x149850[_0x0922('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ed64dee..464a928 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 _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 +var _0x1279=['tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x1279,0x1a5));var _0x9127=function(_0x45da43,_0x8a2bd0){_0x45da43=_0x45da43-0x0;var _0x37e01b=_0x1279[_0x45da43];return _0x37e01b;};'use strict';function FaxAccount(_0x43630e){this['id']=_0x43630e['id']||0x0;this[_0x9127('0x0')]=_0x43630e[_0x9127('0x0')]||'';this['description']=_0x43630e[_0x9127('0x1')];this[_0x9127('0x2')]=_0x43630e[_0x9127('0x2')];this[_0x9127('0x3')]=_0x43630e[_0x9127('0x3')];this[_0x9127('0x4')]=_0x43630e['localstationid'];this[_0x9127('0x5')]=_0x43630e[_0x9127('0x5')]||0x960;this[_0x9127('0x6')]=_0x43630e['maxrate']||0x3840;this[_0x9127('0x7')]=_0x43630e[_0x9127('0x7')]||'v17,v27,v29';this[_0x9127('0x8')]=_0x43630e[_0x9127('0x8')]||'no';this['faxdetect']=_0x43630e[_0x9127('0x9')]||'no';this[_0x9127('0xa')]=_0x43630e[_0x9127('0xa')]||0x1388;this['tech']=_0x43630e[_0x9127('0xb')]||'SIP';this[_0x9127('0xc')]=_0x43630e[_0x9127('0xc')]?_0x43630e[_0x9127('0xc')]:undefined;this[_0x9127('0xd')]=_0x43630e[_0x9127('0xd')];this[_0x9127('0xe')]=_0x43630e[_0x9127('0xe')];}module[_0x9127('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 6d06598..ec242ef 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 _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 +var _0xbb2b=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x4fe461,_0x180210){var _0x4aa96b=function(_0x523fd8){while(--_0x523fd8){_0x4fe461['push'](_0x4fe461['shift']());}};_0x4aa96b(++_0x180210);}(_0xbb2b,0x1dd));var _0xbbb2=function(_0x362388,_0x58e346){_0x362388=_0x362388-0x0;var _0x495aeb=_0xbb2b[_0x362388];return _0x495aeb;};'use strict';function FreshdeskAccount(_0x271e18){this['id']=_0x271e18['id']||0x0;this[_0xbbb2('0x0')]=_0x271e18[_0xbbb2('0x0')]||'';this[_0xbbb2('0x1')]=_0x271e18['username']||'';this['apiKey']=_0x271e18[_0xbbb2('0x2')]||'';this[_0xbbb2('0x3')]=_0x271e18[_0xbbb2('0x3')]||'';this[_0xbbb2('0x4')]=_0x271e18[_0xbbb2('0x4')]||'';this[_0xbbb2('0x5')]=_0x271e18[_0xbbb2('0x5')]||{};}module[_0xbbb2('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 eae744a..9644bf1 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 _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 +var _0xac4f=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x582e89,_0x4ef581){var _0x3a5e42=function(_0x438a6a){while(--_0x438a6a){_0x582e89['push'](_0x582e89['shift']());}};_0x3a5e42(++_0x4ef581);}(_0xac4f,0x122));var _0xfac4=function(_0x3f7101,_0x3af08b){_0x3f7101=_0x3f7101-0x0;var _0x1a30a0=_0xac4f[_0x3f7101];return _0x1a30a0;};'use strict';function FreshsalesAccount(_0x1d3686){this['id']=_0x1d3686['id']||0x0;this['name']=_0x1d3686[_0xfac4('0x0')]||'';this['username']=_0x1d3686[_0xfac4('0x1')]||'';this['apiKey']=_0x1d3686['token']||'';this[_0xfac4('0x2')]=_0x1d3686[_0xfac4('0x2')]||'';this['serverUrl']=_0x1d3686[_0xfac4('0x3')]||'';this[_0xfac4('0x4')]=_0x1d3686[_0xfac4('0x4')]||{};}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 5e8cc4b..3778187 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 _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 +var _0xede7=['mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority','holdtime','lastAssignedTo','motionChannel'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0xede7,0x1a0));var _0x7ede=function(_0x59f31e,_0x1fd672){_0x59f31e=_0x59f31e-0x0;var _0x1258af=_0xede7[_0x59f31e];return _0x1258af;};'use strict';function QueueReport(){this['type']=_0x7ede('0x0');this[_0x7ede('0x1')]='';this[_0x7ede('0x2')]='';this[_0x7ede('0x3')]='';this[_0x7ede('0x4')]='';this[_0x7ede('0x5')]=null;this[_0x7ede('0x6')]=null;this[_0x7ede('0x7')]=0x1;this['count']=0x1;this[_0x7ede('0x8')]=![];this[_0x7ede('0x9')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x7ede('0xa')]=![];this[_0x7ede('0xb')]=null;this[_0x7ede('0xc')]=0x1;this[_0x7ede('0xd')]='';this[_0x7ede('0xe')]='';this[_0x7ede('0xf')]='';this['accountcode']='';this['context']='';this[_0x7ede('0x10')]='';this[_0x7ede('0x11')]='';this[_0x7ede('0x12')]=0x0;this['assigned']=![];this[_0x7ede('0x13')]='';this[_0x7ede('0x14')]='voice';this[_0x7ede('0x15')]=0x0;this['variables']={};}module[_0x7ede('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 57d691a..76c3232 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 _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 +var _0xbffe=['securityToken','type','serverUrl','Configurations','name','remoteUri','password','clientSecret'];(function(_0x15ceb6,_0x1be291){var _0x2d5b6f=function(_0x342d3e){while(--_0x342d3e){_0x15ceb6['push'](_0x15ceb6['shift']());}};_0x2d5b6f(++_0x1be291);}(_0xbffe,0x1d4));var _0xebff=function(_0xc8fd78,_0xee5396){_0xc8fd78=_0xc8fd78-0x0;var _0x383e49=_0xbffe[_0xc8fd78];return _0x383e49;};'use strict';function SalesforceAccount(_0x1d28d6){this['id']=_0x1d28d6['id']||0x0;this['name']=_0x1d28d6[_0xebff('0x0')]||'';this['username']=_0x1d28d6['username']||'';this[_0xebff('0x1')]=_0x1d28d6[_0xebff('0x1')]||'';this['password']=_0x1d28d6[_0xebff('0x2')]||'';this['clientId']=_0x1d28d6['clientId']||'';this[_0xebff('0x3')]=_0x1d28d6[_0xebff('0x3')]||'';this[_0xebff('0x4')]=_0x1d28d6[_0xebff('0x4')]||'';this[_0xebff('0x5')]=_0x1d28d6[_0xebff('0x5')]||'integrationTab';this[_0xebff('0x6')]=_0x1d28d6['serverUrl']||'';this[_0xebff('0x7')]=_0x1d28d6['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 9ba71d4..e273eee 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 _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 +var _0x9bdd=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x9bdd,0x6d));var _0xd9bd=function(_0x3b7cec,_0x5aa2c3){_0x3b7cec=_0x3b7cec-0x0;var _0x46a7d9=_0x9bdd[_0x3b7cec];return _0x46a7d9;};'use strict';function ServicenowAccount(_0xbb0550){this['id']=_0xbb0550['id']||0x0;this[_0xd9bd('0x0')]=_0xbb0550[_0xd9bd('0x0')]||'';this[_0xd9bd('0x1')]=_0xbb0550[_0xd9bd('0x1')]||'';this['password']=_0xbb0550['password']||'';this[_0xd9bd('0x2')]=_0xbb0550[_0xd9bd('0x2')]||'';this[_0xd9bd('0x3')]=_0xbb0550[_0xd9bd('0x3')]||'';this[_0xd9bd('0x4')]=_0xbb0550['Configurations']||{};}module[_0xd9bd('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 658e435..3f5b38a 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 _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 +var _0x9c36=['exports','username','password','remoteUri','serverUrl','Configurations'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9c36,0x163));var _0x69c3=function(_0x40f217,_0x41a107){_0x40f217=_0x40f217-0x0;var _0x9e9b27=_0x9c36[_0x40f217];return _0x9e9b27;};'use strict';function SugarcrmAccount(_0x1e2d00){this['id']=_0x1e2d00['id']||0x0;this['name']=_0x1e2d00['name']||'';this[_0x69c3('0x0')]=_0x1e2d00[_0x69c3('0x0')]||'';this['password']=_0x1e2d00[_0x69c3('0x1')]||'';this['remoteUri']=_0x1e2d00[_0x69c3('0x2')]||'';this[_0x69c3('0x3')]=_0x1e2d00[_0x69c3('0x3')]||'';this[_0x69c3('0x4')]=_0x1e2d00[_0x69c3('0x4')]||{};}module[_0x69c3('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 16933dc..2e431ea 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 _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 +var _0x0817=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x412cad,_0x3f7070){var _0x42359b=function(_0x4ea5c8){while(--_0x4ea5c8){_0x412cad['push'](_0x412cad['shift']());}};_0x42359b(++_0x3f7070);}(_0x0817,0x90));var _0x7081=function(_0x4265d9,_0x2792b3){_0x4265d9=_0x4265d9-0x0;var _0x302e38=_0x0817[_0x4265d9];return _0x302e38;};'use strict';function Telephone(_0x4c6044){this['id']=_0x4c6044['id']||0x0;this['name']=_0x4c6044[_0x7081('0x0')]||'';this[_0x7081('0x1')]=_0x4c6044[_0x7081('0x1')]||'';this[_0x7081('0x2')]=_0x7081('0x3');this[_0x7081('0x4')]=0x0;this[_0x7081('0x5')]=_0x7081('0x3');this[_0x7081('0x6')]='';}module[_0x7081('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 893b3aa..67d857a 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_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 +var _0xa9e0=['exports','name'];(function(_0x3bad78,_0x22c997){var _0x2a76bd=function(_0x35511e){while(--_0x35511e){_0x3bad78['push'](_0x3bad78['shift']());}};_0x2a76bd(++_0x22c997);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index ef5b589..168bb88 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 _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 +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0xd93776,_0x15d253){var _0x5d8165=function(_0x4300bd){while(--_0x4300bd){_0xd93776['push'](_0xd93776['shift']());}};_0x5d8165(++_0x15d253);}(_0x757a,0xde));var _0xa757=function(_0x138af9,_0x1f2813){_0x138af9=_0x138af9-0x0;var _0x477896=_0x757a[_0x138af9];return _0x477896;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5eb58e4..c5345b3 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 _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 +var _0x21de=['registrationtime','address','defaultuser','exports','active','name','state','registry','indexOf','host','domain','domainport','refresh','stateRegistry'];(function(_0x5db4b0,_0x17dfb5){var _0x126c9f=function(_0x1f87f2){while(--_0x1f87f2){_0x5db4b0['push'](_0x5db4b0['shift']());}};_0x126c9f(++_0x17dfb5);}(_0x21de,0x74));var _0xe21d=function(_0x983ba4,_0x6babf5){_0x983ba4=_0x983ba4-0x0;var _0x3a91b9=_0x21de[_0x983ba4];return _0x3a91b9;};'use strict';function Trunk(_0x512e47){this['id']=_0x512e47['id']||0x0;this[_0xe21d('0x0')]=_0x512e47[_0xe21d('0x0')]||![];this[_0xe21d('0x1')]=_0x512e47[_0xe21d('0x1')]||'';this[_0xe21d('0x2')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0xe21d('0x3')]=_0x512e47['registry']&&_0x512e47[_0xe21d('0x3')][_0xe21d('0x4')](':')?_0x512e47[_0xe21d('0x3')]['split'](':')[0x0]:'';this[_0xe21d('0x5')]='';this['port']='';this[_0xe21d('0x6')]='';this[_0xe21d('0x7')]='';this[_0xe21d('0x8')]='';this[_0xe21d('0x9')]='unknown';this[_0xe21d('0xa')]='';this[_0xe21d('0xb')]='';this[_0xe21d('0xc')]=_0x512e47[_0xe21d('0xc')]||'';}module[_0xe21d('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d109203..0088238 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 _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 +var _0x8d8c=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x69c9f5,_0x23cfde){var _0x8178a0=function(_0x380ae0){while(--_0x380ae0){_0x69c9f5['push'](_0x69c9f5['shift']());}};_0x8178a0(++_0x23cfde);}(_0x8d8c,0x143));var _0xc8d8=function(_0x5d7c7d,_0xb243cc){_0x5d7c7d=_0x5d7c7d-0x0;var _0x30ae4f=_0x8d8c[_0x5d7c7d];return _0x30ae4f;};'use strict';function voiceExtension(_0x221b75){this['id']=_0x221b75['id']||0x0;this[_0xc8d8('0x0')]=_0x221b75[_0xc8d8('0x0')]||'';this[_0xc8d8('0x1')]=_0x221b75[_0xc8d8('0x1')]||'none';this[_0xc8d8('0x2')]=_0x221b75[_0xc8d8('0x2')]||![];}module[_0xc8d8('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 2d11d02..81f99bb 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 _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 +var _0xb073=['erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','onHold','paused','ringing','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb073,0x187));var _0x3b07=function(_0x5957c0,_0x33813b){_0x5957c0=_0x5957c0-0x0;var _0x5d0529=_0xb073[_0x5957c0];return _0x5d0529;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x3b07('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':_0x3b07('0x1'),'leastrecent':_0x3b07('0x2'),'linear':_0x3b07('0x3'),'random':'random','ringall':_0x3b07('0x4'),'rr':_0x3b07('0x5'),'rrmemory':_0x3b07('0x6'),'rrordered':'rrordered','wrandom':_0x3b07('0x7')};function VoiceQueue(_0x27d168){this['id']=_0x27d168['id']||0x0;this[_0x3b07('0x8')]=_0x27d168[_0x3b07('0x8')]||'';this[_0x3b07('0x9')]=_0x27d168[_0x3b07('0x9')]||'';this[_0x3b07('0xa')]=_0x27d168[_0x3b07('0xa')]||'inbound';this['waiting']=0x0;this[_0x3b07('0xb')]=0x0;this[_0x3b07('0xc')]=0x0;this[_0x3b07('0xd')]=0x0;this[_0x3b07('0xe')]=0x0;this[_0x3b07('0xf')]=0x0;this[_0x3b07('0x10')]=0x0;this[_0x3b07('0x11')]=0x0;this[_0x3b07('0x12')]=0x0;this[_0x3b07('0x13')]=0x0;this[_0x3b07('0x14')]=0x0;this[_0x3b07('0x15')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0x3b07('0x16')]=0x0;this[_0x3b07('0x17')]=0x0;this[_0x3b07('0x18')]=0x0;this['ringInUse']=0x0;this[_0x3b07('0x19')]=0x0;this['unavailable']=0x0;this[_0x3b07('0x1a')]=0x0;this[_0x3b07('0x1b')]=_0x27d168[_0x3b07('0x1b')]||![];this[_0x3b07('0x1c')]=_0x27d168[_0x3b07('0x1c')]||0xa;this[_0x3b07('0x1d')]=_0x27d168[_0x3b07('0x1d')]||'no';this[_0x3b07('0x1e')]=!![];this[_0x3b07('0x1f')]='';this[_0x3b07('0x20')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x27d168[_0x3b07('0x21')]||null;this[_0x3b07('0x22')]=_0x27d168['dialGlobalInterval']?_0x27d168['dialGlobalInterval']:null;this['dialActive']=_0x27d168[_0x3b07('0x23')];this['dialMethod']=_0x27d168[_0x3b07('0x24')]||_0x3b07('0x25');this[_0x3b07('0x26')]=_0x27d168[_0x3b07('0x26')]||0x0;this[_0x3b07('0x27')]=_0x27d168[_0x3b07('0x27')]||0x0;this[_0x3b07('0x28')]=_0x27d168[_0x3b07('0x28')]||0x1;this[_0x3b07('0x29')]=_0x27d168[_0x3b07('0x29')]||_0x3b07('0x2a');this['dialPredictiveOptimizationPercentage']=_0x27d168[_0x3b07('0x2b')]||0.03;this['dialPredictiveInterval']=_0x27d168[_0x3b07('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0x27d168[_0x3b07('0x2d')]||'anonymous';this[_0x3b07('0x2e')]=_0x27d168[_0x3b07('0x2e')]||_0x3b07('0x2f');this['dialOriginateTimeout']=_0x27d168[_0x3b07('0x30')]||0x1e;this['dialQueueOptions']=_0x27d168[_0x3b07('0x31')]||'tTxX';this[_0x3b07('0x32')]=_0x27d168[_0x3b07('0x32')]||0x3;this[_0x3b07('0x33')]=_0x27d168[_0x3b07('0x33')]||undefined;this[_0x3b07('0x34')]=_0x27d168[_0x3b07('0x34')]||0x3;this[_0x3b07('0x35')]=_0x27d168['dialCongestionRetryFrequency']||0x96;this[_0x3b07('0x36')]=_0x27d168[_0x3b07('0x36')]||0x3;this[_0x3b07('0x37')]=_0x27d168[_0x3b07('0x37')]||0x96;this[_0x3b07('0x38')]=_0x27d168[_0x3b07('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x27d168['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x27d168['dialNoSuchNumberMaxRetry']||0x3;this[_0x3b07('0x39')]=_0x27d168[_0x3b07('0x39')]||0x96;this[_0x3b07('0x3a')]=_0x27d168[_0x3b07('0x3a')]||0x3;this[_0x3b07('0x3b')]=_0x27d168[_0x3b07('0x3b')]||0x96;this['dialAbandonedMaxRetry']=_0x27d168['dialAbandonedMaxRetry']||0x3;this[_0x3b07('0x3c')]=_0x27d168[_0x3b07('0x3c')]||0x96;this[_0x3b07('0x3d')]=_0x27d168['dialMachineMaxRetry']||0x3;this[_0x3b07('0x3e')]=_0x27d168[_0x3b07('0x3e')]||0x96;this[_0x3b07('0x3f')]=_0x27d168[_0x3b07('0x3f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x27d168[_0x3b07('0x40')]||0x96;this[_0x3b07('0x41')]=_0x27d168[_0x3b07('0x41')]||0x3;this[_0x3b07('0x42')]=_0x27d168['dialGlobalMaxRetry']||0x4;this[_0x3b07('0x43')]=_0x27d168[_0x3b07('0x43')]?_0x27d168[_0x3b07('0x43')]:undefined;this[_0x3b07('0x44')]=_0x27d168[_0x3b07('0x44')]?_0x27d168[_0x3b07('0x44')]:undefined;this[_0x3b07('0x45')]=_0x27d168[_0x3b07('0x45')]||undefined;this[_0x3b07('0x46')]=_0x27d168['Interval']?_0x27d168[_0x3b07('0x46')]:undefined;this[_0x3b07('0x47')]=_0x27d168[_0x3b07('0x47')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x27d168[_0x3b07('0x48')]||undefined;this[_0x3b07('0x49')]=_0x27d168[_0x3b07('0x49')]||undefined;this[_0x3b07('0x4a')]=strategy[_0x27d168['strategy']];this[_0x3b07('0x4b')]=!![];this[_0x3b07('0x4c')]=_0x27d168[_0x3b07('0x4c')]||![];this['dialAMDInitialSilence']=_0x27d168[_0x3b07('0x4d')];this['dialAMDGreeting']=_0x27d168[_0x3b07('0x4e')];this[_0x3b07('0x4f')]=_0x27d168[_0x3b07('0x4f')];this[_0x3b07('0x50')]=_0x27d168[_0x3b07('0x50')];this[_0x3b07('0x51')]=_0x27d168[_0x3b07('0x51')];this[_0x3b07('0x52')]=_0x27d168['dialAMDBetweenWordsSilence'];this[_0x3b07('0x53')]=_0x27d168[_0x3b07('0x53')];this['dialAMDSilenceThreshold']=_0x27d168[_0x3b07('0x54')];this['dialAMDMaximumWordLength']=_0x27d168['dialAMDMaximumWordLength'];this[_0x3b07('0x55')]=0x0;this[_0x3b07('0x56')]=0x0;this['timeout']=_0x27d168[_0x3b07('0x57')];this[_0x3b07('0x58')]=0x0;this[_0x3b07('0x59')]=0x0;this[_0x3b07('0x5a')]=0x0;this[_0x3b07('0x5b')]=0x0;this[_0x3b07('0x5c')]=0x0;this[_0x3b07('0x5d')]=0x0;this[_0x3b07('0x5e')]=0x0;this[_0x3b07('0x5f')]=0x0;this[_0x3b07('0x60')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x3b07('0x61')]=0x0;this[_0x3b07('0x62')]=0x0;this[_0x3b07('0x63')]=0x0;this['startProgressive']=undefined;this[_0x3b07('0x64')]=undefined;this[_0x3b07('0x65')]=undefined;this[_0x3b07('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x3b07('0x67')]=0x0;this[_0x3b07('0x68')]=0x0;this[_0x3b07('0x69')]=0x0;this[_0x3b07('0x6a')]=0x0;this[_0x3b07('0x6b')]=0x0;this[_0x3b07('0x6c')]=_0x27d168[_0x3b07('0x6d')]||0x14;this[_0x3b07('0x6e')]=_0x27d168[_0x3b07('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x3b07('0x6f')]=0x0;this[_0x3b07('0x70')]=0x1;this[_0x3b07('0x71')]=0x0;this[_0x3b07('0x72')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x3b07('0x73')]=0x0;this[_0x3b07('0x74')]=_0x27d168[_0x3b07('0x74')]||0x1e;this['dialRecallInQueue']=_0x27d168[_0x3b07('0x75')]||![];this['dialPreviewAutoRecallMe']=!!_0x27d168[_0x3b07('0x76')]||![];this[_0x3b07('0x77')]=!!_0x27d168['dialPreviewRecallmeReminder']||![];this[_0x3b07('0x78')]=_0x27d168[_0x3b07('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x27d168[_0x3b07('0x79')]||![];this[_0x3b07('0x7a')]=_0x27d168[_0x3b07('0x7a')]||![];this[_0x3b07('0x9')]=monitorFormat[_0x27d168[_0x3b07('0x9')]]?monitorFormat[_0x27d168['monitor_format']]:undefined;this[_0x3b07('0x7b')]=_0x27d168['mandatoryDisposition']||![];this[_0x3b07('0x7c')]=_0x27d168[_0x3b07('0x7c')]?_0x27d168[_0x3b07('0x7c')]:undefined;this[_0x3b07('0x7d')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index fd47a0a..3b91773 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 _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 +var _0xf6c1=['onHold','notInUse','ringInUse','sumBillable','sumHoldTime','talking','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','length','SIP/','online','incall','includes','status','booked','queue','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','exports','loggedInDb','paused','ringing','waiting','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','total','name','strategy','abandoned','available','busy','invalid'];(function(_0x283fe1,_0x312094){var _0x1937b3=function(_0x37da3f){while(--_0x37da3f){_0x283fe1['push'](_0x283fe1['shift']());}};_0x1937b3(++_0x312094);}(_0xf6c1,0x99));var _0x1f6c=function(_0x12decc,_0x145ff9){_0x12decc=_0x12decc-0x0;var _0x42e2fd=_0xf6c1[_0x12decc];return _0x42e2fd;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x1f6c('0x0'),_0x1f6c('0x1'),_0x1f6c('0x2'),'talking',_0x1f6c('0x3')];var OUTBOUND_COUNTERS=['available',_0x1f6c('0x4'),_0x1f6c('0x5'),_0x1f6c('0x6'),_0x1f6c('0x0'),_0x1f6c('0x7'),_0x1f6c('0x8'),'outboundAnswerCallsDay',_0x1f6c('0x9'),_0x1f6c('0xa'),_0x1f6c('0xb'),_0x1f6c('0xc'),_0x1f6c('0xd'),_0x1f6c('0xe'),_0x1f6c('0xf'),_0x1f6c('0x10'),_0x1f6c('0x1'),'pTalking','talking','sumBillable',_0x1f6c('0x11'),_0x1f6c('0x12'),_0x1f6c('0x3')];function VoiceQueueSummary(_0x4739ec){this['id']=_0x4739ec['id'];this[_0x1f6c('0x13')]=_0x4739ec[_0x1f6c('0x13')];this['strategy']=_0x4739ec[_0x1f6c('0x14')];this[_0x1f6c('0x15')]=_0x4739ec[_0x1f6c('0x15')]||0x0;this[_0x1f6c('0x4')]=_0x4739ec[_0x1f6c('0x4')]||0x0;this[_0x1f6c('0x16')]=_0x4739ec[_0x1f6c('0x16')]||0x0;this[_0x1f6c('0x17')]=_0x4739ec['busy']||0x0;this[_0x1f6c('0x5')]=_0x4739ec[_0x1f6c('0x5')]||0x0;this[_0x1f6c('0x18')]=_0x4739ec[_0x1f6c('0x18')]||0x0;this[_0x1f6c('0x6')]=_0x4739ec[_0x1f6c('0x6')]||0x0;this['loggedInDb']=_0x4739ec['loggedInDb']||0x0;this[_0x1f6c('0x19')]=_0x4739ec[_0x1f6c('0x19')]||0x0;this['notInUse']=_0x4739ec[_0x1f6c('0x1a')]||0x0;this['paused']=_0x4739ec[_0x1f6c('0x1')]||0x0;this[_0x1f6c('0x2')]=_0x4739ec[_0x1f6c('0x2')]||0x0;this[_0x1f6c('0x1b')]=_0x4739ec[_0x1f6c('0x1b')];this[_0x1f6c('0x1c')]=_0x4739ec[_0x1f6c('0x1c')];this[_0x1f6c('0x11')]=_0x4739ec[_0x1f6c('0x11')];this[_0x1f6c('0x1d')]=_0x4739ec[_0x1f6c('0x1d')]||0x0;this[_0x1f6c('0x1e')]=_0x4739ec[_0x1f6c('0x1e')]||0x0;this[_0x1f6c('0x12')]=_0x4739ec[_0x1f6c('0x12')]||0x0;this['type']=_0x4739ec[_0x1f6c('0x1f')];this['unavailable']=_0x4739ec[_0x1f6c('0x20')]||0x0;this[_0x1f6c('0x21')]=_0x4739ec['unknown']||0x0;this[_0x1f6c('0x22')]=_0x4739ec['unmanaged']||0x0;this[_0x1f6c('0x3')]=_0x4739ec[_0x1f6c('0x3')]||0x0;if(_0x4739ec[_0x1f6c('0x1f')]===_0x1f6c('0x23')){this[_0x1f6c('0x24')]=_0x4739ec[_0x1f6c('0x24')]||0x0;this[_0x1f6c('0x25')]=_0x4739ec[_0x1f6c('0x25')];this[_0x1f6c('0x26')]=_0x4739ec[_0x1f6c('0x26')];this['dialOriginateCallerIdName']=_0x4739ec[_0x1f6c('0x27')];this[_0x1f6c('0x28')]=_0x4739ec[_0x1f6c('0x28')];this['dialOriginateTimeout']=_0x4739ec[_0x1f6c('0x29')];this[_0x1f6c('0x2a')]=_0x4739ec[_0x1f6c('0x2a')];this[_0x1f6c('0x2b')]=_0x4739ec[_0x1f6c('0x2b')];this[_0x1f6c('0x2c')]=_0x4739ec['outboundAnswerAgiCallsDay'];this[_0x1f6c('0x2d')]=_0x4739ec['outboundAnswerCallsDay'];this[_0x1f6c('0x9')]=_0x4739ec[_0x1f6c('0x9')];this[_0x1f6c('0xa')]=_0x4739ec[_0x1f6c('0xa')];this[_0x1f6c('0xb')]=_0x4739ec['outboundCongestionCallsDay'];this[_0x1f6c('0x2e')]=_0x4739ec['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x4739ec[_0x1f6c('0x2f')];this[_0x1f6c('0x30')]=_0x4739ec[_0x1f6c('0x30')];this[_0x1f6c('0xc')]=_0x4739ec['outboundNoAnswerCallsDay'];this[_0x1f6c('0xd')]=_0x4739ec[_0x1f6c('0xd')];this[_0x1f6c('0x31')]=_0x4739ec[_0x1f6c('0x31')];this[_0x1f6c('0xe')]=_0x4739ec['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x4739ec[_0x1f6c('0xf')];this[_0x1f6c('0x10')]=_0x4739ec[_0x1f6c('0x10')];this[_0x1f6c('0x32')]=_0x4739ec['predictiveIntervalAnsweredCalls'];this[_0x1f6c('0x33')]=_0x4739ec['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x4739ec[_0x1f6c('0x34')];this[_0x1f6c('0x35')]=_0x4739ec[_0x1f6c('0x35')];this[_0x1f6c('0x36')]=_0x4739ec[_0x1f6c('0x36')];this[_0x1f6c('0x37')]=_0x4739ec[_0x1f6c('0x37')];this[_0x1f6c('0x38')]=_0x4739ec[_0x1f6c('0x38')];this[_0x1f6c('0x39')]=_0x4739ec[_0x1f6c('0x39')];this[_0x1f6c('0x3a')]=_0x4739ec[_0x1f6c('0x3a')];this[_0x1f6c('0x3b')]=_0x4739ec[_0x1f6c('0x3b')];this[_0x1f6c('0x3c')]=_0x4739ec[_0x1f6c('0x3c')];this['predictiveIntervalTotalCalls']=_0x4739ec[_0x1f6c('0x3d')];this[_0x1f6c('0x7')]=_0x4739ec[_0x1f6c('0x7')];this[_0x1f6c('0x3e')]=_0x4739ec[_0x1f6c('0x3e')];this['erlangCallToSecond']=_0x4739ec['erlangCallToSecond'];this[_0x1f6c('0x3f')]=_0x4739ec[_0x1f6c('0x3f')];this[_0x1f6c('0x40')]=_0x4739ec[_0x1f6c('0x40')];this[_0x1f6c('0x41')]=_0x4739ec[_0x1f6c('0x41')];this['startProgressive']=_0x4739ec[_0x1f6c('0x42')];this[_0x1f6c('0x43')]=_0x4739ec[_0x1f6c('0x43')];this[_0x1f6c('0x44')]=_0x4739ec[_0x1f6c('0x44')];}if(_0x4739ec[_0x1f6c('0x45')]){this[_0x1f6c('0x45')]={'id':_0x4739ec[_0x1f6c('0x45')]['id'],'name':_0x4739ec['Trunk']['name'],'active':_0x4739ec[_0x1f6c('0x45')]['active'],'callerid':_0x4739ec['Trunk'][_0x1f6c('0x46')]};}}VoiceQueueSummary[_0x1f6c('0x47')][_0x1f6c('0x48')]=function(_0x1a2fff,_0x158900,_0x25e350,_0x73e00){this[_0x1f6c('0x0')]=0x0;this['talking']=0x0;this[_0x1f6c('0x1')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x1f6c('0x5')]=0x0;this[_0x1f6c('0x17')]=0x0;this[_0x1f6c('0x18')]=0x0;this['unavailable']=0x0;this[_0x1f6c('0x2')]=0x0;this[_0x1f6c('0x1b')]=0x0;this[_0x1f6c('0x19')]=0x0;if(_0x25e350){if(_0x25e350[_0x1f6c('0x16')]){this['available']=Number(_0x25e350[_0x1f6c('0x16')]);}if(_0x25e350['loggedin']){this[_0x1f6c('0x6')]=Number(_0x25e350[_0x1f6c('0x49')]);}if(_0x25e350['callers']){this[_0x1f6c('0x3')]=Number(_0x25e350['callers']);}}for(var _0x533f21=0x0;_0x533f21<_0x1a2fff[_0x1f6c('0x4a')];_0x533f21++){var _0x500dc4=_0x158900[_0x1f6c('0x4b')+_0x1a2fff[_0x533f21]['name']];if(_0x500dc4&&_0x500dc4[_0x1f6c('0x4c')]){this[_0x1f6c('0x0')]+=0x1;}if(_0x1a2fff[_0x533f21][_0x1f6c('0x4d')]==='1'){this['talking']+=0x1;}if(_0x1a2fff[_0x533f21][_0x1f6c('0x1')]==='1'&&!['2','7','8'][_0x1f6c('0x4e')](_0x1a2fff[_0x533f21][_0x1f6c('0x4f')])){this['paused']+=0x1;}switch(_0x1a2fff[_0x533f21]['status']){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x1f6c('0x5')]+=0x1;break;case'3':this[_0x1f6c('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x1f6c('0x2')]+=0x1;break;case'7':this[_0x1f6c('0x1b')]+=0x1;break;case'8':this[_0x1f6c('0x19')]+=0x1;break;}}if(this[_0x1f6c('0x26')]===_0x1f6c('0x50')){var _0x4153c8=Object['keys'](_0x73e00);for(var _0x303c50=0x0;_0x303c50<_0x4153c8[_0x1f6c('0x4a')];_0x303c50++){var _0x5a3c54=_0x4153c8[_0x303c50];var _0x306f60=_0x73e00[_0x5a3c54];if(_0x306f60[_0x1f6c('0x51')]===this['name']&&_0x306f60[_0x1f6c('0x1f')]==='dialer'&&_0x306f60[_0x1f6c('0x52')]===_0x1f6c('0x53')){this[_0x1f6c('0x1e')]+=0x1;}}if(this['talking']>this[_0x1f6c('0x5')]){this[_0x1f6c('0x1e')]=this['inUse'];}this[_0x1f6c('0x24')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x1f6c('0x54')]=function(_0x437726){var _0x150908=![];if(_0x437726){_0x150908=INBOUND_COUNTERS['some'](function(_0xde9d68){return this[_0xde9d68]!==_0x437726[_0xde9d68];},this);}return _0x150908;};VoiceQueueSummary[_0x1f6c('0x47')]['compareToOutboundQueue']=function(_0x286367){var _0x56fe49=![];var _0x3fb957=![];var _0x3b135c=![];if(_0x286367){_0x56fe49=this[_0x1f6c('0x26')]!==_0x286367[_0x1f6c('0x26')]||this['dialActive']!==_0x286367['dialActive']||this['message']!==_0x286367[_0x1f6c('0x43')]||this[_0x1f6c('0x44')]!==_0x286367[_0x1f6c('0x44')];_0x3fb957=OUTBOUND_COUNTERS[_0x1f6c('0x55')](function(_0x279d44){return this[_0x279d44]!==_0x286367[_0x279d44];},this);if(this[_0x1f6c('0x45')]&&_0x286367[_0x1f6c('0x45')]){_0x3b135c=this[_0x1f6c('0x45')][_0x1f6c('0x13')]!==_0x286367[_0x1f6c('0x45')][_0x1f6c('0x13')]||this[_0x1f6c('0x45')][_0x1f6c('0x56')]!==_0x286367[_0x1f6c('0x45')][_0x1f6c('0x56')];}}return _0x56fe49||_0x3fb957||_0x3b135c;};VoiceQueueSummary[_0x1f6c('0x47')][_0x1f6c('0x57')]=function(_0xdc959a){this[_0x1f6c('0x4')]=_0xdc959a['answered'];this[_0x1f6c('0x43')]=_0xdc959a['message'];this[_0x1f6c('0x44')]=_0xdc959a[_0x1f6c('0x44')];this['originated']=_0xdc959a[_0x1f6c('0x7')];this[_0x1f6c('0x8')]=_0xdc959a[_0x1f6c('0x8')];this['outboundAnswerCallsDay']=_0xdc959a[_0x1f6c('0x2d')];this[_0x1f6c('0x9')]=_0xdc959a['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0xdc959a['outboundBusyCallsDay'];this[_0x1f6c('0xb')]=_0xdc959a['outboundCongestionCallsDay'];this[_0x1f6c('0xc')]=_0xdc959a[_0x1f6c('0xc')];this[_0x1f6c('0xd')]=_0xdc959a[_0x1f6c('0xd')];this[_0x1f6c('0xe')]=_0xdc959a['outboundReCallsDay'];this[_0x1f6c('0xf')]=_0xdc959a[_0x1f6c('0xf')];this[_0x1f6c('0x10')]=_0xdc959a[_0x1f6c('0x10')];this[_0x1f6c('0x1c')]=_0xdc959a[_0x1f6c('0x1c')];this[_0x1f6c('0x11')]=_0xdc959a[_0x1f6c('0x11')];this[_0x1f6c('0x12')]=_0xdc959a[_0x1f6c('0x12')];if(this[_0x1f6c('0x26')]==='preview'){this[_0x1f6c('0x24')]=_0xdc959a['pTalking'];}};module[_0x1f6c('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 2fe446a..82ee277 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 _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 +var _0xa1b6=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x3c62ab,_0x33f23d){var _0x536970=function(_0x3a4759){while(--_0x3a4759){_0x3c62ab['push'](_0x3c62ab['shift']());}};_0x536970(++_0x33f23d);}(_0xa1b6,0x137));var _0x6a1b=function(_0x1787fd,_0xf44dec){_0x1787fd=_0x1787fd-0x0;var _0xbf4c6=_0xa1b6[_0x1787fd];return _0xbf4c6;};'use strict';function VtigerAccount(_0x423e13){this['id']=_0x423e13['id']||0x0;this[_0x6a1b('0x0')]=_0x423e13[_0x6a1b('0x0')]||'';this[_0x6a1b('0x1')]=_0x423e13[_0x6a1b('0x1')]||'';this['accessKey']=_0x423e13[_0x6a1b('0x2')]||'';this['remoteUri']=_0x423e13[_0x6a1b('0x3')]||'';this[_0x6a1b('0x4')]=_0x423e13[_0x6a1b('0x4')]||'';this[_0x6a1b('0x5')]=_0x423e13[_0x6a1b('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a3c7453..35104c6 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 _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 +var _0x8c3d=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','type'];(function(_0x697b6e,_0xd5ab09){var _0x4ea11c=function(_0x1ab3cf){while(--_0x1ab3cf){_0x697b6e['push'](_0x697b6e['shift']());}};_0x4ea11c(++_0xd5ab09);}(_0x8c3d,0x1bc));var _0xd8c3=function(_0x491468,_0x42f169){_0x491468=_0x491468-0x0;var _0x5b8c22=_0x8c3d[_0x491468];return _0x5b8c22;};'use strict';function ZendeskAccount(_0x2db4e3){this['id']=_0x2db4e3['id']||0x0;this[_0xd8c3('0x0')]=_0x2db4e3[_0xd8c3('0x0')]||'';this[_0xd8c3('0x1')]=_0x2db4e3[_0xd8c3('0x1')]||'';this[_0xd8c3('0x2')]=_0x2db4e3[_0xd8c3('0x2')]||'';this[_0xd8c3('0x3')]=_0x2db4e3['token']||'';this[_0xd8c3('0x4')]=_0x2db4e3[_0xd8c3('0x4')]||'';this['authType']=_0x2db4e3['authType']||'';this[_0xd8c3('0x5')]=_0x2db4e3[_0xd8c3('0x5')]||'integrationTab';this[_0xd8c3('0x6')]=_0x2db4e3[_0xd8c3('0x6')]||'';this[_0xd8c3('0x7')]=_0x2db4e3[_0xd8c3('0x7')]||{};}module[_0xd8c3('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c6b6df6..399cd04 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 _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 +var _0xf81c=['clientSecret','serverUrl','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x5794bb,_0x23ed8d){var _0x501067=function(_0xd4b8c){while(--_0xd4b8c){_0x5794bb['push'](_0x5794bb['shift']());}};_0x501067(++_0x23ed8d);}(_0xf81c,0xff));var _0xcf81=function(_0x274509,_0x1353f7){_0x274509=_0x274509-0x0;var _0x47298c=_0xf81c[_0x274509];return _0x47298c;};'use strict';function ZohoAccount(_0x5a158a){this['id']=_0x5a158a['id']||0x0;this[_0xcf81('0x0')]=_0x5a158a['name']||'';this[_0xcf81('0x1')]=_0x5a158a[_0xcf81('0x1')]||'';this['host']=_0x5a158a[_0xcf81('0x2')]||'';this[_0xcf81('0x3')]=_0x5a158a[_0xcf81('0x3')]||'';this[_0xcf81('0x4')]=_0x5a158a[_0xcf81('0x4')]||'';this[_0xcf81('0x5')]=_0x5a158a[_0xcf81('0x5')]||'';this['serverUrl']=_0x5a158a[_0xcf81('0x6')]||'';this['code']=_0x5a158a['code']||'';this[_0xcf81('0x7')]=_0x5a158a[_0xcf81('0x7')]||'';this[_0xcf81('0x8')]=_0x5a158a[_0xcf81('0x8')]||{};}module[_0xcf81('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 12c03ac..00b58ad 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 _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 +var _0xe511=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','lodash','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x588336,_0x5a353c){var _0x3e1cb5=function(_0x4893ed){while(--_0x4893ed){_0x588336['push'](_0x588336['shift']());}};_0x3e1cb5(++_0x5a353c);}(_0xe511,0x16f));var _0x1e51=function(_0x57834a,_0xfac574){_0x57834a=_0x57834a-0x0;var _0x5788d9=_0xe511[_0x57834a];return _0x5788d9;};'use strict';var util=require(_0x1e51('0x0'));var _=require(_0x1e51('0x1'));var moment=require('moment');function checkNameSurname(_0x2a5905,_0x5b9e45,_0x253e96){var _0xb75a96='';if(!_['isNil'](_0x5b9e45)&&_0x1e51('0x2')===typeof _0x5b9e45){_0xb75a96+=_0x5b9e45;}if(!_[_0x1e51('0x3')](_0x253e96)&&_0x1e51('0x2')===typeof _0x253e96){_0xb75a96+='\x20'+_0x253e96;}if(_0xb75a96!==''){return _0xb75a96;}return _0x2a5905;}function Action(_0x16ec99,_0x480cca,_0x26b22c,_0x21ed6b,_0x5c4590){this['uniqueid']=_0x26b22c||undefined;this[_0x1e51('0x4')]=_0x16ec99['id'];this[_0x1e51('0x5')]=_0x480cca['name'];this['type']=_0x480cca[_0x1e51('0x6')];this[_0x1e51('0x7')]=_0x1e51('0x5');this[_0x1e51('0x8')]=![];this[_0x1e51('0x9')]=_[_0x1e51('0x3')](_0x16ec99['Agent'])?undefined:_0x16ec99[_0x1e51('0xa')][_0x1e51('0xb')];this[_0x1e51('0xc')]=this[_0x1e51('0x9')]?util[_0x1e51('0xd')](_0x1e51('0xe'),this['membername']):_0x21ed6b||undefined;this[_0x1e51('0xf')]=checkNameSurname(_0x16ec99[_0x1e51('0x10')][_0x1e51('0x11')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x12')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x13')]);this[_0x1e51('0x14')]=_0x16ec99[_0x1e51('0x14')]||![];this[_0x1e51('0x15')]=_0x16ec99['phone'];this[_0x1e51('0x16')]=_0x16ec99[_0x1e51('0x16')];this[_0x1e51('0x17')]=_0x16ec99['countbusyretry']||0x0;this[_0x1e51('0x18')]=_0x16ec99['countcongestionretry']||0x0;this['countnoanswerretry']=_0x16ec99[_0x1e51('0x19')]||0x0;this[_0x1e51('0x1a')]=(_0x16ec99[_0x1e51('0x17')]||0x0)+(_0x16ec99[_0x1e51('0x18')]||0x0)+(_0x16ec99[_0x1e51('0x19')]||0x0)+(_0x16ec99[_0x1e51('0x1b')]||0x0)+(_0x16ec99['countdropretry']||0x0)+(_0x16ec99[_0x1e51('0x1c')]||0x0)+(_0x16ec99['countmachineretry']||0x0)+(_0x16ec99[_0x1e51('0x1d')]||0x0);this[_0x1e51('0x1b')]=_0x16ec99[_0x1e51('0x1b')]||0x0;this[_0x1e51('0x1e')]=_0x16ec99['countdropretry']||0x0;this['countabandonedretry']=_0x16ec99['countabandonedretry']||0x0;this['countmachineretry']=_0x16ec99[_0x1e51('0x1f')]||0x0;this['countagentrejectretry']=_0x16ec99[_0x1e51('0x1d')]||0x0;this[_0x1e51('0x20')]=_0x16ec99[_0x1e51('0x20')];this[_0x1e51('0x21')]=_0x16ec99[_0x1e51('0x21')];this[_0x1e51('0x22')]=_0x16ec99[_0x1e51('0x22')];this[_0x1e51('0x23')]=_0x16ec99['recallme'];this['ContactId']=_0x16ec99[_0x1e51('0x24')];this[_0x1e51('0x25')]=_0x16ec99[_0x1e51('0x25')];this[_0x1e51('0x26')]=_['isNil'](_0x16ec99['Agent'])?_0x16ec99['UserId']:_0x16ec99[_0x1e51('0xa')]['id'];this[_0x1e51('0x27')]=_0x16ec99[_0x1e51('0x27')];this['originatecalleridnum']='';this[_0x1e51('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x1e51('0xd')]('\x22%s\x22\x20<%s>',this[_0x1e51('0xf')],this[_0x1e51('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 098a252..e6efb15 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 _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 +var _0xf0e4=['[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','buildObj','connect','acw','mandatoryDisposition','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','unlockAgent','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','active','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','Contact','assign','variables','[originated][increment]','[originateFailure][logOriginateFailure]','channel','actionid','clone','response','unlockContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','[syncHangup][talking][transfer]','syncDialEnd','addVariable','filterKey','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','prototype','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','type','clearZombieChannels','dialPreviewAutoRecallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','actions','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','agentReadyId','length','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','logCustomer','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','answertime'];(function(_0xa27fe,_0x56b4be){var _0x2f7f97=function(_0x3eae92){while(--_0x3eae92){_0xa27fe['push'](_0xa27fe['shift']());}};_0x2f7f97(++_0x56b4be);}(_0xf0e4,0xb1));var _0x4f0e=function(_0x5a4157,_0x5000a0){_0x5a4157=_0x5a4157-0x0;var _0x49e1cd=_0xf0e4[_0x5a4157];return _0x49e1cd;};'use strict';var util=require(_0x4f0e('0x0'));var _=require(_0x4f0e('0x1'));var uuid=require(_0x4f0e('0x2'));var moment=require(_0x4f0e('0x3'));var Redis=require(_0x4f0e('0x4'));var config=require(_0x4f0e('0x5'));var logger=require(_0x4f0e('0x6'))(_0x4f0e('0x7'));var loggerAction=require('../../../config/logger')(_0x4f0e('0x8'));var ami=require(_0x4f0e('0x9'));var rpcDb=require(_0x4f0e('0xa'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x4f0e('0xb'));var ut=require(_0x4f0e('0xc'));var utils=require('../dialer/utils');config[_0x4f0e('0xd')]=_[_0x4f0e('0xe')](config[_0x4f0e('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f0e('0xd')]));var Sequence=function(){};Sequence[_0x4f0e('0xf')]['enqueue']=function(_0x31eabb){this[_0x4f0e('0x10')]=this['tail']?this['tail'][_0x4f0e('0x11')](_0x31eabb):_0x31eabb();};function Preview(_0x391935){this['sequence']=new Sequence();this[_0x4f0e('0x12')]=_0x391935[_0x4f0e('0x13')];this[_0x4f0e('0x14')]=_0x391935[_0x4f0e('0x14')];this['actions']={};this['agents']=_0x391935[_0x4f0e('0x15')];this[_0x4f0e('0x16')]=0x0;ami['on'](_0x4f0e('0x17'),this[_0x4f0e('0x18')][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1a'),this[_0x4f0e('0x1b')][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1c'),this[_0x4f0e('0x1d')][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1e'),this['syncDialEnd'][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1f'),this[_0x4f0e('0x20')]['bind'](this));ami['on'](_0x4f0e('0x21'),this[_0x4f0e('0x22')]['bind'](this));ami['on'](_0x4f0e('0x23'),this['syncAttendedTransfer'][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x24'),this['syncBlindTransfer']['bind'](this));this[_0x4f0e('0x25')](this[_0x4f0e('0x12')]);}function emit(_0x1f195a,_0x14c2a3,_0x551a9d){io['to'](_0x1f195a)['emit'](_0x14c2a3,_0x551a9d);}function emitVoiceQueueChannelRemove(_0x2050fe){logger[_0x4f0e('0x26')](_0x4f0e('0x27'),JSON[_0x4f0e('0x28')](_0x2050fe));emit(util[_0x4f0e('0x29')](_0x4f0e('0x2a'),_0x2050fe[_0x4f0e('0x2b')]),_0x4f0e('0x2c'),_0x2050fe);io[_0x4f0e('0x2d')](_0x4f0e('0x2e'),_0x2050fe);}function notSendMessagesQueue(_0x28afee){if(_0x28afee[_0x4f0e('0x2f')]){if(_0x28afee[_0x4f0e('0x30')]===0x0&&_0x28afee[_0x4f0e('0x31')]===0x0){_0x28afee[_0x4f0e('0x2f')]=![];_0x28afee[_0x4f0e('0x32')]=0x0;_0x28afee[_0x4f0e('0x33')]=0x0;_0x28afee[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')][_0x4f0e('0x36')];ut[_0x4f0e('0x37')](_0x4f0e('0x38'),_0x28afee[_0x4f0e('0x2b')]+'\x20is\x20not\x20active');}else{_0x28afee[_0x4f0e('0x34')]=utils['CAMPAIGN_STATUS'][_0x4f0e('0x39')];ut[_0x4f0e('0x37')](_0x4f0e('0x38'),_0x28afee[_0x4f0e('0x2b')]+_0x4f0e('0x3a'));}}}Preview[_0x4f0e('0xf')][_0x4f0e('0x25')]=function(){var _0x607c53=this;setInterval(function(){_0x607c53[_0x4f0e('0x3b')]();},0x7cf);};Preview[_0x4f0e('0xf')]['syncCampaigns']=function(){var _0x5a4a9f=this['campaignsPreview'];this[_0x4f0e('0x16')]+=0x1;for(var _0x35cc8c in _0x5a4a9f){if(_0x5a4a9f['hasOwnProperty'](_0x35cc8c)&&(_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3c')]===_0x4f0e('0x7')||_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3c')]===_0x4f0e('0x3d'))&&_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3e')]==='outbound'){if(this[_0x4f0e('0x16')]>0x7){this[_0x4f0e('0x16')]=0x0;this[_0x4f0e('0x3f')]();}}if(_0x5a4a9f['hasOwnProperty'](_0x35cc8c)&&_0x5a4a9f[_0x35cc8c]['dialMethod']==='preview'&&_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3e')]==='outbound'){if(_0x5a4a9f[_0x35cc8c]['dialActive']){this['setMessage'](_0x5a4a9f[_0x35cc8c]);if(_0x5a4a9f[_0x35cc8c][_0x4f0e('0x40')])this['recallMe'](_0x5a4a9f[_0x35cc8c]);}else{notSendMessagesQueue(_0x5a4a9f[_0x35cc8c]);}}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x41')]=function(_0x542742){var _0x2a88d9=this;this[_0x4f0e('0x42')]['enqueue'](function(){if(!_[_0x4f0e('0x43')](_0x2a88d9['actions'][_0x542742])){loggerAction[_0x4f0e('0x26')](_0x4f0e('0x44'),_0x542742,_0x4f0e('0x45'),_0x2a88d9[_0x4f0e('0x46')][_0x542742]['queue'],_0x4f0e('0x47'),JSON[_0x4f0e('0x28')](_0x2a88d9[_0x4f0e('0x12')][_0x2a88d9['actions'][_0x542742][_0x4f0e('0x48')]][_0x4f0e('0x30')]),'pTalking:\x20',JSON[_0x4f0e('0x28')](_0x2a88d9[_0x4f0e('0x12')][_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x48')]][_0x4f0e('0x31')]),JSON[_0x4f0e('0x28')](_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x49')]),JSON['stringify'](_[_0x4f0e('0x4a')](_0x2a88d9['actions'][_0x542742],[_0x4f0e('0x4b'),_0x4f0e('0x4c'),_0x4f0e('0x4d'),_0x4f0e('0x4e')])));return ami[_0x4f0e('0x4f')]({'action':_0x4f0e('0x50'),'channel':_0x2a88d9['actions'][_0x542742]['channel']})[_0x4f0e('0x51')](function(_0x1b6378){if(_0x1b6378[_0x4f0e('0x34')]===_0x4f0e('0x52')){setTimeout(function(){if(_0x2a88d9['actions'][_0x542742]){utils[_0x4f0e('0x53')](_0x2a88d9['campaignsPreview'][_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x48')]],_0x4f0e('0x54'));if(_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x49')]===!![]){ut[_0x4f0e('0x55')](_0x2a88d9[_0x4f0e('0x12')][_0x2a88d9[_0x4f0e('0x46')][_0x542742]['queue']],'[clearZombieChannel]');ut[_0x4f0e('0x56')](_0x4f0e('0x57')+_0x542742,_0x2a88d9[_0x4f0e('0x46')][_0x542742]['queue']);}ut['loggerError'](_0x4f0e('0x58')+_0x542742,_0x2a88d9['actions'][_0x542742][_0x4f0e('0x48')]);delete _0x2a88d9[_0x4f0e('0x46')][_0x542742];}},0x2328);}});}});};Preview[_0x4f0e('0xf')][_0x4f0e('0x3f')]=function(){var _0x356894=this;loggerAction[_0x4f0e('0x26')](_0x4f0e('0x59'),_[_0x4f0e('0x5a')](this[_0x4f0e('0x46')]));for(var _0xdb7015 in this['actions']){if(_0x356894[_0x4f0e('0x46')]['hasOwnProperty'](_0xdb7015)){_0x356894[_0x4f0e('0x41')](_0xdb7015);}}};Preview['prototype'][_0x4f0e('0x5b')]=function(_0x88831f){var _0x1fb7e7=this;rpcDb['getContactRecallMe'](_0x88831f['id'],ut[_0x4f0e('0x5c')](this[_0x4f0e('0x15')]))['then'](function(_0x3ae0dd){if(!_[_0x4f0e('0x43')](_0x3ae0dd)){for(var _0x1005fa=0x0;_0x1005fa<_0x3ae0dd[_0x4f0e('0x5d')];_0x1005fa+=0x1){if(ut['getDiff'](_0x3ae0dd[_0x1005fa][_0x4f0e('0x5e')])<_0x88831f[_0x4f0e('0x5f')]*0x3c){if(_0x3ae0dd[_0x1005fa][_0x4f0e('0x60')]&&!_0x3ae0dd[_0x1005fa][_0x4f0e('0x60')]['voicePause']){_0x1fb7e7[_0x4f0e('0x61')](_0x3ae0dd[_0x1005fa]['id'])[_0x4f0e('0x62')](ut[_0x4f0e('0x63')]('[RecallMe]'))['catch'](ut[_0x4f0e('0x63')]('[RecallMe]'));}else{rpcDb[_0x4f0e('0x64')](_0x3ae0dd[_0x1005fa]['id']);}}else{var _0x1caede=new Action(_0x3ae0dd[_0x1005fa],_0x88831f);_0x1caede[_0x4f0e('0x65')]=moment()['format'](_0x4f0e('0x66'));_0x88831f['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x1caede,0x17,_0x4f0e('0x67'));if(_0x88831f[_0x4f0e('0x68')]){rpcDb[_0x4f0e('0x69')](ut[_0x4f0e('0x6a')](_0x3ae0dd[_0x1005fa]));rpcDb[_0x4f0e('0x6b')](_0x1caede,_0x4f0e('0x6c'));}else{ut['logCustomer'](_0x1caede,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x1caede,_0x4f0e('0x6d'));rpcDb['createCustomerFinal'](_0x1caede,_0x4f0e('0x6d'));}}}}})['catch'](ut['logger2'](_0x4f0e('0x6e')));};Preview[_0x4f0e('0xf')]['setMessage']=function(_0x3701fc){_0x3701fc['sendMessageOneNotActive']=!![];if(ut[_0x4f0e('0x6f')](_0x3701fc[_0x4f0e('0x70')])){_0x3701fc['message']=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0x4f0e('0x71')](_0x3701fc['dialActive'])){_0x3701fc['message']=utils[_0x4f0e('0x35')][_0x4f0e('0x36')];}else if(!this[_0x4f0e('0x72')](_0x3701fc[_0x4f0e('0x73')])){if(!this['isTrunkReachable'](_0x3701fc[_0x4f0e('0x74')])){_0x3701fc['message']=utils['CAMPAIGN_STATUS'][_0x4f0e('0x75')];}else{_0x3701fc[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')][_0x4f0e('0x76')];}}else{_0x3701fc[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')]['ACTIVE'];}};Preview[_0x4f0e('0xf')][_0x4f0e('0x77')]=function(_0x440d4c,_0x4f04a5,_0x38dc08){var _0xc45dc2=this;var _0x51976a=this[_0x4f0e('0x46')][_0x4f04a5];var _0x4679f9=this[_0x4f0e('0x12')][_0x51976a[_0x4f0e('0x48')]];var _0x45d1e6;var _0x349c85=![];var _0x3b3577=0x2;var _0x947981=0x3;if(_0x4679f9){switch(_0x38dc08){case'1':_0x4679f9[_0x4f0e('0x78')]+=0x1;_0x51976a['countnosuchnumberretry']+=0x1;_0x51976a['countglobal']=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x0,_0x4f0e('0x7b'));ami['emit'](_0x4f0e('0x7c'),ut['buildObj'](_0x51976a,_0x4f0e('0x7d')));rpcDb['createCustomerHistory'](_0x51976a,_0x4f0e('0x7e'));_0xc45dc2['verifyAdditionalPhones'](_0x51976a,'0',_0x4679f9)[_0x4f0e('0x62')](function(_0x2ad4ec){_0x349c85=_0x2ad4ec[_0x4f0e('0x7f')]==0x1;_0x3b3577=_0x4679f9['dialNoSuchNumberRetryFrequency'];_0x947981=_0x4679f9['callAdditionalPhoneAfterMin'];if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut['cloneAction'](_0x51976a,0xf,_0x4f0e('0x81'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0x83'));}else{if(_0x51976a[_0x4f0e('0x84')]>=_0x4679f9[_0x4f0e('0x85')]){rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0x83'));}else{rpcDb[_0x4f0e('0x86')](ut[_0x4f0e('0x87')](_0x51976a,_0x4f0e('0x84'),_0x4679f9['dialNoSuchNumberRetryFrequency']),_0x51976a['unlockAgent'],_0x51976a[_0x4f0e('0x88')]);}}delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];}else{_0x51976a[_0x4f0e('0x84')]++;logger[_0x4f0e('0x26')](_0x4f0e('0x8a'),_0x51976a[_0x4f0e('0x84')]);logger['info']('id',_0x51976a[_0x4f0e('0x8b')]);_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnosuchnumberretry':_0x51976a[_0x4f0e('0x84')]}})[_0x4f0e('0x62')](function(){_0xc45dc2['swapAdditionalPhones'](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case _0x4f0e('0x8d'):var _0x58435e=moment()['format'](_0x4f0e('0x66'));_0x51976a[_0x4f0e('0x8e')]=_0x58435e;_0x51976a[_0x4f0e('0x8f')]=_0x58435e;_0x51976a[_0x4f0e('0x49')]=!![];_0x4679f9[_0x4f0e('0x31')]+=0x1;logger[_0x4f0e('0x26')](_0x4f0e('0x90'),_0x51976a[_0x4f0e('0x91')],_0x4f0e('0x92'),_0x4679f9[_0x4f0e('0x2b')],_0x4f0e('0x93'),_0x4679f9[_0x4f0e('0x31')]);ami[_0x4f0e('0x2d')]('custom:agentconnect',ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0x95'),this[_0x4f0e('0x12')][_0x51976a[_0x4f0e('0x48')]]));if(_0x4679f9[_0x4f0e('0x96')]||_0x4679f9[_0x4f0e('0x97')]){ami[_0x4f0e('0x2d')](_0x4f0e('0x98'),{'queue':_0x51976a[_0x4f0e('0x48')],'interface':_0x51976a['channelAgent'],'uniqueid':_0x51976a[_0x4f0e('0x91')]});}break;case'16':ami[_0x4f0e('0x2d')](_0x4f0e('0x99'),ut['buildObj'](_0x51976a,_0x4f0e('0x9a'),this[_0x4f0e('0x12')][_0x51976a[_0x4f0e('0x48')]]));emitVoiceQueueChannelRemove(ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0x9a')));_0x4679f9[_0x4f0e('0x9b')]+=0x1;_0x4679f9[_0x4f0e('0x9c')]+=0x1;_0x4679f9[_0x4f0e('0x9d')]+=0x1;ut['decrementTalking'](_0x4679f9,_0x4f0e('0x9e'));_0x51976a['countglobal']=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x4,_0x4f0e('0x9f'));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xa0'));rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xa1'));rpcDb[_0x4f0e('0xa2')](_0x51976a);_0x4679f9['sumDuration']+=_0x51976a['talktime'];_0x4679f9[_0x4f0e('0xa3')]+=_0x51976a[_0x4f0e('0xa4')];logger[_0x4f0e('0x26')](_0x4f0e('0xa5'),_0x51976a[_0x4f0e('0x91')],_0x4f0e('0x92'),_0x4679f9[_0x4f0e('0x2b')],'pTalking:\x20',_0x4679f9['pTalking']);delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];break;case _0x4f0e('0xa6'):_0x4679f9[_0x4f0e('0xa7')]+=0x1;_0x51976a[_0x4f0e('0xa8')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut['totalGlobal'](_0x51976a);ut['logCustomer'](_0x51976a,0x5,'Busy');_0x3b3577=_0x4679f9[_0x4f0e('0xaa')];_0x947981=_0x4679f9[_0x4f0e('0xab')];ami['emit']('custom:agentbusy',ut['buildObj'](_0x51976a,_0x4f0e('0xac')));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xad'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'5',_0x4679f9)[_0x4f0e('0x62')](function(_0x19f949){_0x349c85=_0x19f949['additional']==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,'Global');rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xb0'));}else{if(_0x51976a['countbusyretry']>=_0x4679f9[_0x4f0e('0xb1')]){rpcDb['createCustomerFinal'](_0x51976a,_0x4f0e('0xad'));}else{rpcDb[_0x4f0e('0x86')](ut['scheduledAt'](_0x51976a,_0x4f0e('0xa8'),_0x4679f9[_0x4f0e('0xaa')]),_0x51976a['unlockAgent'],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a['countbusyretry']++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countbusyretry':_0x51976a[_0x4f0e('0xa8')]}})[_0x4f0e('0x62')](function(){_0xc45dc2['swapAdditionalPhones'](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case _0x4f0e('0xb2'):_0x4679f9[_0x4f0e('0xb3')]+=0x1;_0x51976a[_0x4f0e('0xb4')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut['logCustomer'](_0x51976a,0x3,_0x4f0e('0xb5'));_0x3b3577=_0x4679f9[_0x4f0e('0xb6')];_0x947981=_0x4679f9[_0x4f0e('0xab')];var _0x1e3322=ut['buildNoAnswerEventPayload'](_0x51976a,_0x4679f9);ami[_0x4f0e('0x2d')](_0x4f0e('0xb7'),_0x1e3322);rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xb8'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'3',_0x4679f9)[_0x4f0e('0x62')](function(_0x594104){_0x349c85=_0x594104['additional']==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9['dialGlobalMaxRetry']){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,_0x4f0e('0x81'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xb9'));}else{if(_0x51976a[_0x4f0e('0xb4')]>=_0x4679f9[_0x4f0e('0xba')]){rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xb8'));}else{rpcDb[_0x4f0e('0x86')](ut[_0x4f0e('0x87')](_0x51976a,_0x4f0e('0xb4'),_0x4679f9[_0x4f0e('0xb6')]),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a[_0x4f0e('0xb4')]++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a[_0x4f0e('0xb4')]}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case _0x4f0e('0xbd'):_0x4679f9[_0x4f0e('0xbe')]+=0x1;_0x51976a[_0x4f0e('0xbf')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut['totalGlobal'](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x8,'Congestion');_0x3b3577=_0x4679f9[_0x4f0e('0xc0')];_0x947981=_0x4679f9[_0x4f0e('0xab')];ami[_0x4f0e('0x2d')](_0x4f0e('0xc1'),ut['buildObj'](_0x51976a,_0x4f0e('0xc2')));rpcDb['createCustomerHistory'](_0x51976a,'[callProgressDetectingCustomer][logCongestion]');_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'8',_0x4679f9)[_0x4f0e('0x62')](function(_0x1b36f0){_0x349c85=_0x1b36f0[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9['dialGlobalMaxRetry']){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,_0x4f0e('0x81'));rpcDb['createCustomerFinal'](_0x45d1e6,_0x4f0e('0xc3'));}else{if(_0x51976a[_0x4f0e('0xbf')]>=_0x4679f9['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x51976a,_0x4f0e('0xc4'));}else{rpcDb['rescheduleContact'](ut[_0x4f0e('0x87')](_0x51976a,'countcongestionretry',_0x4679f9['dialBusyRetryFrequency']),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a[_0x4f0e('0xbf')]++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a['idContact'],'field':{'countcongestionretry':_0x51976a[_0x4f0e('0xbf')]}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)['then'](function(){});});}});break;case _0x4f0e('0xc5'):_0x4679f9['outboundRejectCallsDay']+=0x1;_0x51976a[_0x4f0e('0xc6')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut['totalGlobal'](_0x51976a);ut['logCustomer'](_0x51976a,0x14,'AgentReject');_0x3b3577=_0x4679f9['dialAgentRejectRetryFrequency'];_0x947981=_0x4679f9['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0xc7')));rpcDb[_0x4f0e('0x6b')](_0x51976a,'[syncHangupRequest][logAgentReject]');_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'20',_0x4679f9)['then'](function(_0x1e66e0){_0x349c85=_0x1e66e0[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut['totalGlobal'](_0x51976a)>=_0x4679f9['dialGlobalMaxRetry']){_0x45d1e6=ut['cloneAction'](_0x51976a,0x14,_0x4f0e('0xc8'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xc9'));}else{if(_0x51976a[_0x4f0e('0xc6')]>=_0x4679f9['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x51976a,_0x4f0e('0xc9'));}else{rpcDb[_0x4f0e('0x86')](ut['scheduledAt'](_0x51976a,_0x4f0e('0xc6'),_0x4679f9[_0x4f0e('0xca')]),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a[_0x4f0e('0xb4')]++;_0xc45dc2['incrementPreviewCounters']({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a[_0x4f0e('0xb4')]}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case'ABANDONED':_0x4679f9[_0x4f0e('0xcb')]+=0x1;_0x51976a[_0x4f0e('0xcc')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0xb,_0x4f0e('0xcd'));rpcDb[_0x4f0e('0x6b')](_0x51976a,'[callProgressDetectingCustomer][logAbandoned]');_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'11',_0x4679f9)[_0x4f0e('0x62')](function(_0x20d7ba){_0x349c85=_0x20d7ba[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,'Global');rpcDb['createCustomerFinal'](_0x45d1e6,_0x4f0e('0xce'));}else{if(_0x51976a['countabandonedetry']>=_0x4679f9['dialAbandonedMaxRety']){rpcDb[_0x4f0e('0x82')](_0x51976a,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x51976a,_0x4f0e('0xcc'),_0x4679f9['dialAbandonedRetryFrequency']),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a['countnoanswerretry']++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a['countnoanswerretry']}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)['then'](function(){});});}});break;case'18':_0x4679f9[_0x4f0e('0xcf')]+=0x1;_0x51976a[_0x4f0e('0xd0')]+=0x1;_0x51976a['countglobal']=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x12,_0x440d4c[_0x4f0e('0xd1')]||_0x440d4c[_0x4f0e('0xd2')]);ami[_0x4f0e('0x2d')](_0x4f0e('0xd3'),ut[_0x4f0e('0x94')](_0x51976a,'amd'));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xd4'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'18',_0x4679f9)[_0x4f0e('0x62')](function(_0xe4f85a){_0x349c85=_0xe4f85a[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut['totalGlobal'](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0x12,_0x4f0e('0x81'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xd4'));}}else{_0x51976a['countnoanswerretry']++;_0xc45dc2['incrementPreviewCounters']({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a['countnoanswerretry']}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];break;case'19':_0x4679f9[_0x4f0e('0xcf')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x13,_0x440d4c[_0x4f0e('0xd1')]||_0x440d4c[_0x4f0e('0xd2')]);ami[_0x4f0e('0x2d')](_0x4f0e('0xd3'),ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0xd5')));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xd6'));_0xc45dc2['verifyAdditionalPhones'](_0x51976a,'18',_0x4679f9)[_0x4f0e('0x62')](function(_0x29372a){_0x349c85=_0x29372a[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,'Global');rpcDb['createCustomerFinal'](_0x45d1e6,_0x4f0e('0xd6'));}else{rpcDb[_0x4f0e('0x82')](_0x51976a,'[callProgressDetectingCustomer][machine]');}}else{_0x51976a[_0x4f0e('0xb4')]++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a[_0x4f0e('0xb4')]}})['then'](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)['then'](function(){});});}});delete this['actions'][_0x440d4c[_0x4f0e('0x89')]];break;default:if(_0x51976a[_0x4f0e('0x49')]){ut[_0x4f0e('0x55')](_0x4679f9,_0x4f0e('0xd7'));ut[_0x4f0e('0x56')](_0x4f0e('0xd8')+_0x4679f9['name'],_0x440d4c);}_0x4679f9[_0x4f0e('0xcf')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0xc,_0x440d4c[_0x4f0e('0xd1')]||_0x440d4c[_0x4f0e('0xd2')]);_0x3b3577=_0x4679f9[_0x4f0e('0xca')];_0x947981=_0x4679f9[_0x4f0e('0xab')];rpcDb['createCustomerHistory'](_0x51976a,_0x4f0e('0xd9'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'20',_0x4679f9)[_0x4f0e('0x62')](function(_0x568aaa){_0x349c85=_0x568aaa[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut['cloneAction'](_0x51976a,0xf,'Global');rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xda'));}else{rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xda'));}delete this['actions'][_0x440d4c['linkedid']];}else{_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});}});}if(!(_0x51976a[_0x4f0e('0x49')]&&_0x38dc08==='16')){utils['decrementOriginate'](_0x4679f9,_0x4f0e('0xdb'));logger[_0x4f0e('0x26')](_0x4f0e('0xdc'),_0x51976a[_0x4f0e('0x91')],'\x20Queue',_0x4679f9[_0x4f0e('0x2b')],_0x4f0e('0x47'),_0x4679f9['originated']);}if(_0x38dc08!=='ANSWER'){delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0xdd')]];}_0x4679f9[_0x4f0e('0xde')]=!![];}};Preview[_0x4f0e('0xf')]['callProgressDetectingAgent']=function(_0x432785,_0x4301fc,_0x68b352){if(_[_0x4f0e('0xdf')](_0x4301fc)&&_0x4f0e('0xe0')!==typeof _0x4301fc){return;}if(_['isUndefined'](_0x68b352)&&_0x4f0e('0xe0')!==typeof _0x68b352){return;}switch(_0x68b352[_0x4f0e('0xe1')]){case'0':ut[_0x4f0e('0xe2')](_0x432785,0x0,_0x4f0e('0x7b'));rpcDb[_0x4f0e('0xe3')](_0x432785,_0x4f0e('0xe4'));break;case'3':ut[_0x4f0e('0xe2')](_0x432785,0x3,'NoAnswer');rpcDb[_0x4f0e('0xe3')](_0x432785,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x4f0e('0xe2')](_0x432785,0x5,'Busy');rpcDb[_0x4f0e('0xe3')](_0x432785,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x432785,0x8,'Congestion');rpcDb[_0x4f0e('0xe3')](_0x432785,_0x4f0e('0xe5'));break;case'22':ut[_0x4f0e('0xe2')](_0x432785,0x16,_0x4f0e('0xe6'));rpcDb['createAgentHistory'](_0x432785,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x4f0e('0xe2')](_0x432785,0xc,_0x68b352[_0x4f0e('0xe1')]);rpcDb['createAgentHistory'](_0x432785,_0x4f0e('0xe5'));}utils[_0x4f0e('0x53')](_0x4301fc,_0x4f0e('0xe7'));logger[_0x4f0e('0x26')](_0x4f0e('0xe8'),_0x432785[_0x4f0e('0x91')],_0x4f0e('0x92'),_0x4301fc[_0x4f0e('0x2b')],'originated:\x20',_0x4301fc['originated']);delete this['actions'][_0x432785[_0x4f0e('0x91')]];};Preview[_0x4f0e('0xf')][_0x4f0e('0xae')]=function(_0x2694fc,_0x31670d,_0x1949ef){return cmHopperAdditionalPhone[_0x4f0e('0xae')](_0x2694fc,_0x31670d,_0x1949ef)[_0x4f0e('0x51')](logger['info'](_0x4f0e('0xe9')));};Preview[_0x4f0e('0xf')][_0x4f0e('0xbc')]=function(_0x138bcb,_0x51d4fe,_0x127029){return cmHopperAdditionalPhone[_0x4f0e('0xbc')](_0x138bcb,_0x51d4fe,_0x127029)[_0x4f0e('0x51')](logger[_0x4f0e('0x26')](_0x4f0e('0xea')));};Preview['prototype']['incrementPreviewCounters']=function(_0xfd8cff){return Promise['resolve']()[_0x4f0e('0x62')](cmHopperAdditionalPhone[_0x4f0e('0x8c')](_0xfd8cff))[_0x4f0e('0x51')](logger[_0x4f0e('0x26')](_0x4f0e('0xeb')));};Preview[_0x4f0e('0xf')]['checkInBlack']=function(_0x4ad242,_0x2e00be,_0x36f0b4,_0x4f0128,_0x3b64a9){var _0x2ddc34=this;return new Promise(function(_0x587dbf,_0x501f2b){if(_[_0x4f0e('0x43')](_0x2e00be)||_['isNil'](_0x2e00be['Contact'])||_[_0x4f0e('0x43')](_0x2e00be[_0x4f0e('0xec')])||_[_0x4f0e('0x43')](_0x2e00be[_0x4f0e('0x4d')])){_0x501f2b(ut[_0x4f0e('0x34')](_0x4f0e('0xed'),_0x4f0128,_0x3b64a9));return;}var _0x459653=uuid['v4']();var _0x3288aa=_0x2ddc34[_0x4f0e('0x12')][_0x2e00be[_0x4f0e('0x45')]['name']];var _0x442554=_0x36f0b4?_0x2ddc34[_0x4f0e('0x15')][_0x36f0b4]['id']:undefined;_0x2ddc34[_0x4f0e('0x46')][_0x459653]=new Action(_0x2e00be,_0x3288aa,_0x459653,_0x36f0b4,_0x442554);var _0x164947=_0x2ddc34[_0x4f0e('0x46')][_0x459653];_0x164947[_0x4f0e('0xbb')]=_0x4f0128;_0x164947['activeContact']=_0x3b64a9;_0x164947[_0x4f0e('0xee')]=_0x36f0b4;if(_[_0x4f0e('0xef')](_0x4ad242)){_0x2ddc34[_0x4f0e('0xf0')](_0x164947,_0x3288aa,_0x2e00be,_0x36f0b4)[_0x4f0e('0x62')](function(_0x346d2d){logger[_0x4f0e('0x26')](_0x4f0e('0xf1'),_0x4f0e('0xf2')+_0x164947[_0x4f0e('0x48')]+_0x4f0e('0xf3')+_0x164947[_0x4f0e('0x8b')],JSON[_0x4f0e('0x28')](_0x346d2d));ami[_0x4f0e('0x2d')]('custom:agentcalled',ut['buildObj'](_0x164947,_0x4f0e('0xf4'),_0x2ddc34[_0x4f0e('0x12')][_0x164947['queue']]));_0x587dbf(ut[_0x4f0e('0x34')]('Calling'));})[_0x4f0e('0x51')](function(_0x34e2b2){ut[_0x4f0e('0x37')](_0x4f0e('0xf5'),_0x34e2b2);_0x501f2b(ut[_0x4f0e('0x34')](_0x4f0e('0xf6'),_0x4f0128,_0x3b64a9));});}else{_0x3288aa[_0x4f0e('0xf7')]+=0x1;ut[_0x4f0e('0xf8')](_0x164947);rpcDb[_0x4f0e('0xf9')](_0x164947,'[Blacklist][error]');delete _0x2ddc34['actions'][_0x459653];_0x501f2b(ut[_0x4f0e('0x34')]('Contact\x20in\x20black\x20List',_0x4f0128,_0x3b64a9));}});};Preview[_0x4f0e('0xf')][_0x4f0e('0x72')]=function(_0x8b00a4){return!_[_0x4f0e('0x43')](_0x8b00a4)&&!_[_0x4f0e('0x43')](_0x8b00a4[_0x4f0e('0x2b')])&&!_['isNil'](_0x8b00a4[_0x4f0e('0xfa')])&&_0x8b00a4[_0x4f0e('0xfa')]&&!_['isNil'](this[_0x4f0e('0x14')][util['format']('SIP/%s',_0x8b00a4[_0x4f0e('0x2b')])])&&!_[_0x4f0e('0x43')](this['trunks'][util[_0x4f0e('0x29')]('SIP/%s',_0x8b00a4[_0x4f0e('0x2b')])][_0x4f0e('0x50')])&&(this[_0x4f0e('0x14')][util['format'](_0x4f0e('0xfb'),_0x8b00a4[_0x4f0e('0x2b')])][_0x4f0e('0x50')]===_0x4f0e('0xfc')||this['trunks'][util['format']('SIP/%s',_0x8b00a4['name'])][_0x4f0e('0x50')]===_0x4f0e('0xfd'));};Preview[_0x4f0e('0xf')][_0x4f0e('0x61')]=function(_0x3bc34b,_0x2fe5f8){return this[_0x4f0e('0xfe')](_0x3bc34b,_0x2fe5f8)[_0x4f0e('0x62')](function(_0x10d41d){return _['pick'](_0x10d41d,[_0x4f0e('0x34')]);})[_0x4f0e('0x51')](function(_0x4453ae){if(_0x4453ae[_0x4f0e('0xff')]){rpcDb['unlockContact'](_0x3bc34b);}if(_0x4453ae['active']){rpcDb['disableContact'](_0x3bc34b);}throw _[_0x4f0e('0x4a')](_0x4453ae,[_0x4f0e('0x34')]);});};Preview[_0x4f0e('0xf')][_0x4f0e('0xfe')]=function(_0x138eca,_0x11a1c8){var _0xd69c68=this;var _0x2302e8,_0x2445d4;return rpcDb[_0x4f0e('0x100')](_0x138eca)[_0x4f0e('0x62')](function(_0x32b296){if(!_[_0x4f0e('0x43')](_0x32b296[0x0])){_0x2445d4=_0x32b296[0x0]['recallme']?![]:!![];_0x2302e8=_0x32b296[0x0][_0x4f0e('0x101')]?!![]:![];_0x2302e8=_0x11a1c8?!![]:_0x2302e8;}var _0xb8b037=_0xd69c68[_0x4f0e('0x102')](_0x32b296);if(_0xb8b037[_0x4f0e('0x103')]){rpcDb[_0x4f0e('0x104')](_[_0x4f0e('0x4a')](_0x32b296[0x0],[_0x4f0e('0x4d'),_0x4f0e('0xec')]))[_0x4f0e('0x62')](function(_0x227715){_0xd69c68[_0x4f0e('0x105')](_0x227715,_0x32b296[0x0],_0x11a1c8,_0x2445d4,_0x2302e8)[_0x4f0e('0x62')](function(_0x560682){return _0x560682;})[_0x4f0e('0x51')](function(_0x14b24d){throw _0x14b24d;});})[_0x4f0e('0x51')](function(_0x4cf25f){ut[_0x4f0e('0x37')](_0x4f0e('0x106'),_0x4cf25f);throw ut['message'](_0x4f0e('0x107'),_0x2445d4,_0x2302e8);});}else{throw ut[_0x4f0e('0x34')](_0xb8b037[_0x4f0e('0x34')],_0x2445d4,_0x2302e8);}})['catch'](function(_0x556945){ut[_0x4f0e('0x37')]('[Preview][getContactPreview]',_0x556945);throw ut[_0x4f0e('0x34')](_0x4f0e('0x107'),![],!![]);});};Preview[_0x4f0e('0xf')][_0x4f0e('0x102')]=function(_0x3008c0){if(_[_0x4f0e('0x43')](_0x3008c0)||_[_0x4f0e('0xef')](_0x3008c0)||!_[_0x4f0e('0x43')](_0x3008c0[0x0][_0x4f0e('0x60')])&&_[_0x4f0e('0x43')](_0x3008c0[0x0][_0x4f0e('0x60')][_0x4f0e('0x2b')])){ut[_0x4f0e('0x37')]('[Preview][validateContact][Empty\x20Contact]',_0x3008c0);return{'isValid':![],'message':_0x4f0e('0x108')};}var _0x387ccf=this[_0x4f0e('0x12')][_0x3008c0[0x0][_0x4f0e('0x45')][_0x4f0e('0x2b')]];_0x387ccf[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')][_0x4f0e('0x76')];if(_[_0x4f0e('0x43')](_0x387ccf)){ut[_0x4f0e('0x37')](_0x4f0e('0x109'),_0x387ccf);return{'isValid':![],'message':_0x4f0e('0x10a')};}if(!this[_0x4f0e('0x72')](_0x387ccf['Trunk'])){ut[_0x4f0e('0x37')](_0x4f0e('0x10b'),_0x4f0e('0x10c')+_0x387ccf['name']+_0x4f0e('0x10d'));if(!this[_0x4f0e('0x72')](_0x387ccf['TrunkBackup'])){ut[_0x4f0e('0x37')](_0x4f0e('0x10b'),_0x387ccf[_0x4f0e('0x2b')]+_0x4f0e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x4f0e('0x71')](_0x387ccf[_0x4f0e('0x10f')])){ut[_0x4f0e('0x37')](_0x4f0e('0x110'),_0x387ccf[_0x4f0e('0x2b')]+_0x4f0e('0x111'));return{'isValid':![],'message':_0x4f0e('0x10c')+_0x387ccf[_0x4f0e('0x2b')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x4f0e('0x112')};};Preview[_0x4f0e('0xf')][_0x4f0e('0xf0')]=function(_0xb8d87b,_0x829e81,_0x11b22b,_0x2d945c){var _0x2ef851=this;return new Promise(function(_0x316fb9,_0x37d8cf){var _0x59c502=_0xb8d87b[_0x4f0e('0x91')];var _0x1adcd4=_0x2ef851[_0x4f0e('0x72')](_0x829e81[_0x4f0e('0x73')])?util[_0x4f0e('0x29')](_0x4f0e('0x113'),_0x829e81['Trunk'][_0x4f0e('0x2b')],_[_0x4f0e('0x43')](_0x829e81[_0x4f0e('0x114')])?'':_0x829e81[_0x4f0e('0x114')]['trim']()||'',_0x829e81[_0x4f0e('0x115')]>0x0?_0x11b22b[_0x4f0e('0xec')][_0x4f0e('0x116')](_0x829e81['dialCutDigit']):_0x11b22b[_0x4f0e('0xec')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x829e81[_0x4f0e('0x74')])?_0x829e81[_0x4f0e('0x73')][_0x4f0e('0x2b')]:_0x829e81[_0x4f0e('0x74')][_0x4f0e('0x2b')],_[_0x4f0e('0x43')](_0x829e81[_0x4f0e('0x114')])?'':_0x829e81['dialPrefix'][_0x4f0e('0x117')]()||'',_0x829e81[_0x4f0e('0x115')]>0x0?_0x11b22b[_0x4f0e('0xec')]['substring'](_0x829e81[_0x4f0e('0x115')]):_0x11b22b[_0x4f0e('0xec')]);var _0x454ceb=_0x2ef851[_0x4f0e('0x72')](_0x829e81[_0x4f0e('0x73')])?ut['getCallerId'](_0x829e81['Trunk']['callerid'],_0x829e81[_0x4f0e('0x118')],_0x829e81['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4f0e('0x119')](_0x829e81[_0x4f0e('0x11a')],_0x829e81[_0x4f0e('0x11b')]):_0x829e81['dialOriginateCallerIdNumber']):ut[_0x4f0e('0x11c')](_[_0x4f0e('0x43')](_0x829e81['TrunkBackup'])?_0x829e81[_0x4f0e('0x73')][_0x4f0e('0x11d')]:_0x829e81[_0x4f0e('0x74')][_0x4f0e('0x11d')],_0x829e81['dialOriginateCallerIdName'],_0x829e81[_0x4f0e('0x11b')]>0x0?ut['getCallerIdRandom'](_0x829e81[_0x4f0e('0x11a')],_0x829e81['dialRandomLastDigitCallerIdNumber']):_0x829e81[_0x4f0e('0x11a')]);if(_0x454ceb){_0xb8d87b[_0x4f0e('0x11e')]=ut[_0x4f0e('0x11f')](_0x454ceb);_0xb8d87b[_0x4f0e('0x120')]=ut[_0x4f0e('0x121')](_0x454ceb);}var _0x1e9474=ut['addVariables'](_0x829e81,_0x11b22b,_0x1adcd4,_0x454ceb,_0x59c502,_0xb8d87b);var _0xfc3b3b=utils['setXMDContactVariables'](_0x11b22b[_0x4f0e('0x122')]);Object[_0x4f0e('0x123')](_0x1e9474,_0xfc3b3b);_['merge'](_0xb8d87b,ut['toLowerVariables'](_0x1e9474));_0xb8d87b['starttime']=moment()[_0x4f0e('0x29')](_0x4f0e('0x66'));_0x829e81[_0x4f0e('0x124')]=_0x1e9474;var _0x16fc50=ut['variablesAction'](_0xb8d87b,_0x829e81,_0x1e9474,_0xb8d87b[_0x4f0e('0x88')],_0x2d945c);return ami[_0x4f0e('0x4f')](_0x16fc50)[_0x4f0e('0x62')](function(_0x5d0268){_0x829e81[_0x4f0e('0x30')]+=0x1;logger['info'](_0x4f0e('0x125'),_0x59c502,_0x4f0e('0x92'),_0x829e81['name'],_0x4f0e('0x47'),_0x829e81[_0x4f0e('0x30')]);_0x316fb9(_0x5d0268);})[_0x4f0e('0x51')](function(_0x16b390){ut[_0x4f0e('0xe2')](_0xb8d87b,0xe,'OriginateError');rpcDb[_0x4f0e('0xe3')](_0xb8d87b,_0x4f0e('0x126'));_0x37d8cf(_0x16b390);});});};Preview[_0x4f0e('0xf')][_0x4f0e('0x20')]=function(_0x2a5402){if(this['actions'][_0x2a5402[_0x4f0e('0x89')]]){this[_0x4f0e('0x46')][_0x2a5402[_0x4f0e('0x89')]][_0x4f0e('0x127')]=_0x2a5402['channel'];}};Preview[_0x4f0e('0xf')][_0x4f0e('0x18')]=function(_0x4e5a1b){var _0x55a96c=this;var _0x3db672=this[_0x4f0e('0x46')][_0x4e5a1b[_0x4f0e('0x128')]];if(_0x3db672){if(_0x3db672[_0x4f0e('0xee')]&&this[_0x4f0e('0x15')][_0x3db672[_0x4f0e('0xee')]]){ut['logLookAgent'](_0x3db672,this[_0x4f0e('0x15')][_0x3db672[_0x4f0e('0xee')]][_0x4f0e('0x2b')],this['agents'][_0x3db672['lookAgent']]['id']);}var _0x6e3303=_[_0x4f0e('0x129')](_0x3db672);_0x6e3303[_0x4f0e('0x8e')]=moment()[_0x4f0e('0x29')](_0x4f0e('0x66'));var _0x32c065=_0x55a96c[_0x4f0e('0x12')][_0x3db672[_0x4f0e('0x48')]];if(ut['isFailure'](_0x4e5a1b[_0x4f0e('0x12a')])){if(_0x3db672[_0x4f0e('0xbb')]){rpcDb[_0x4f0e('0x12b')](_0x3db672[_0x4f0e('0x8b')]);}if(_0x3db672[_0x4f0e('0x88')]){rpcDb['disableContact'](_0x3db672[_0x4f0e('0x8b')]);}ami[_0x4f0e('0x2d')](_0x4f0e('0x12c'),ut[_0x4f0e('0x94')](_0x3db672,'rejected',this['campaignsPreview'][_0x3db672['queue']]));this[_0x4f0e('0x12d')](_0x6e3303,_0x32c065,_0x4e5a1b);}else{_0x3db672['starttime']=moment()[_0x4f0e('0x29')](_0x4f0e('0x66'));ut['logAgent'](_0x6e3303,0x4,'Answer');rpcDb[_0x4f0e('0xe3')](_0x6e3303,_0x4f0e('0x12e'));}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x1b')]=function(_0x1b9088){var _0x40ef37=this['actions'][_0x1b9088[_0x4f0e('0x89')]];var _0x3ce795;if(_0x40ef37){_0x3ce795=this['campaignsPreview'][_0x40ef37[_0x4f0e('0x48')]];logger['info'](_0x4f0e('0x12f'),_0x1b9088[_0x4f0e('0x89')],_0x4f0e('0x92'),_0x3ce795[_0x4f0e('0x2b')],'pTalking:\x20',_0x3ce795[_0x4f0e('0x31')]);}if(this[_0x4f0e('0x46')][_0x1b9088[_0x4f0e('0x89')]]&&_0x1b9088[_0x4f0e('0x89')]!==_0x1b9088[_0x4f0e('0x91')]){if(_0x1b9088[_0x4f0e('0x130')]==='16'&&this[_0x4f0e('0x46')][_0x1b9088[_0x4f0e('0x89')]][_0x4f0e('0x49')]){this[_0x4f0e('0x77')](_0x1b9088,_0x1b9088['linkedid'],_0x1b9088['cause']);}else if(this[_0x4f0e('0x46')][_0x1b9088['linkedid']]['dialAnswer']){logger['info'](_0x4f0e('0x131'),_0x1b9088[_0x4f0e('0x89')],_0x1b9088[_0x4f0e('0x130')],'\x20Queue',_0x3ce795[_0x4f0e('0x2b')],_0x4f0e('0x93'),_0x3ce795[_0x4f0e('0x31')]);this[_0x4f0e('0x77')](_0x1b9088,_0x1b9088[_0x4f0e('0x89')],_0x1b9088['cause']);}}else if(_0x40ef37&&_[_0x4f0e('0x43')](_0x40ef37['statedesc'])&&_0x3ce795[_0x4f0e('0x132')]&&_0x1b9088['linkedid']===_0x1b9088[_0x4f0e('0x91')]&&_[_0x4f0e('0x43')](_0x1b9088[_0x4f0e('0xe1')])&&_0x1b9088[_0x4f0e('0x130')]==='16'&&_0x1b9088[_0x4f0e('0x133')]==='6'&&_[_0x4f0e('0xdf')](_0x40ef37['transfer'])){if(_0x40ef37[_0x4f0e('0xbb')]){rpcDb[_0x4f0e('0x12b')](_0x40ef37[_0x4f0e('0x8b')]);}if(_0x40ef37[_0x4f0e('0x88')]){rpcDb[_0x4f0e('0x64')](_0x40ef37[_0x4f0e('0x8b')]);}_0x1b9088['reason']='22';this[_0x4f0e('0x12d')](_0x40ef37,_0x3ce795,_0x1b9088);}else if(_0x40ef37&&_0x40ef37['transfer']){if(_0x1b9088['cause']==='16'&&this['actions'][_0x1b9088['linkedid']][_0x4f0e('0x49')]){logger[_0x4f0e('0x26')](_0x4f0e('0x134'),_0x1b9088[_0x4f0e('0x89')],_0x1b9088['cause'],_0x4f0e('0x92'),_0x3ce795[_0x4f0e('0x2b')],_0x4f0e('0x93'),_0x3ce795['pTalking']);this[_0x4f0e('0x77')](_0x1b9088,_0x1b9088[_0x4f0e('0x89')],_0x1b9088[_0x4f0e('0x130')]);}else if(this[_0x4f0e('0x46')][_0x1b9088['linkedid']][_0x4f0e('0x49')]){logger[_0x4f0e('0x26')](_0x4f0e('0x131'),_0x1b9088[_0x4f0e('0x89')],_0x1b9088[_0x4f0e('0x130')],_0x4f0e('0x92'),_0x3ce795['name'],_0x4f0e('0x93'),_0x3ce795[_0x4f0e('0x31')]);this['callProgressDetectingCustomer'](_0x1b9088,_0x1b9088['linkedid'],_0x1b9088[_0x4f0e('0x130')]);}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x135')]=function(_0x1a63af){if(this[_0x4f0e('0x46')][_0x1a63af[_0x4f0e('0xdd')]]&&_0x1a63af[_0x4f0e('0xdd')]!==_0x1a63af['destuniqueid']){this[_0x4f0e('0x77')](_0x1a63af,_0x1a63af[_0x4f0e('0xdd')],_0x1a63af[_0x4f0e('0xd2')]);}};Preview[_0x4f0e('0xf')][_0x4f0e('0x1d')]=function(_0xc4320c){if(this[_0x4f0e('0x46')][_0xc4320c[_0x4f0e('0x89')]]&&_0xc4320c['linkedid']!==_0xc4320c[_0x4f0e('0x91')]&&!this['actions'][_0xc4320c[_0x4f0e('0x89')]][_0x4f0e('0x49')]){if(_0xc4320c[_0x4f0e('0x130')]==='1'){this['callProgressDetectingCustomer'](_0xc4320c,_0xc4320c['linkedid'],_0xc4320c[_0x4f0e('0x130')]);}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x136')]=function(_0x5cedf3,_0x32f0ff,_0x530985){if(this[_0x4f0e('0x46')][_0x5cedf3]){if(_[_0x4f0e('0x43')](this[_0x4f0e('0x46')][_0x5cedf3][_0x4f0e('0x124')])){this[_0x4f0e('0x46')][_0x5cedf3][_0x4f0e('0x124')]={};}this[_0x4f0e('0x46')][_0x5cedf3][_0x4f0e('0x124')][_0x32f0ff]=_0x530985;}};Preview['prototype'][_0x4f0e('0x22')]=function(_0x2e52e5){try{if(!_[_0x4f0e('0x43')](_0x2e52e5)){if(ut[_0x4f0e('0x137')](_[_0x4f0e('0x138')](_0x2e52e5[_0x4f0e('0x139')])[0x0])){this['addVariable'](_0x2e52e5['uniqueid'],_['keys'](_0x2e52e5['variable'])[0x0],_0x2e52e5[_0x4f0e('0x13a')]);}}}catch(_0x1605f5){logger['error'](_0x4f0e('0x13b'),util['inspect'](_0x1605f5,{'showHidden':![],'depth':null}));}};Preview[_0x4f0e('0xf')]['syncAttendedTransfer']=function(_0xdbe74c){if(_0xdbe74c){if(this[_0x4f0e('0x46')][_0xdbe74c['transfertargetlinkedid']]){this[_0x4f0e('0x46')][_0xdbe74c[_0x4f0e('0x13c')]][_0x4f0e('0x13d')]=!![];}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x13e')]=function(_0xc52537){if(_0xc52537){if(this[_0x4f0e('0x46')][_0xc52537[_0x4f0e('0x13f')]]){this[_0x4f0e('0x46')][_0xc52537[_0x4f0e('0x13f')]][_0x4f0e('0x13d')]=!![];}}};module[_0x4f0e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c78db62..3fedfc9 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 _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 +var _0x8827=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8827,0x1d5));var _0x7882=function(_0x333737,_0x56320a){_0x333737=_0x333737-0x0;var _0xd21e71=_0x8827[_0x333737];return _0xd21e71;};'use strict';var util=require('util');var BPromise=require(_0x7882('0x0'));var logger=require(_0x7882('0x1'))(_0x7882('0x2'));var cmHopper=require(_0x7882('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x7882('0x4'));var agentReportPreview=require(_0x7882('0x5'));var voiceQueueReport=require(_0x7882('0x6'));function loggerCatch(_0x5250b6){return function(_0x48294a){logger['error'](_0x5250b6,util[_0x7882('0x7')](_0x48294a,{'showHidden':![],'depth':null}));};}function create(_0x17dbac){return cmHopperHistory[_0x7882('0x8')](_0x17dbac)[_0x7882('0x9')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x48216d){return BPromise[_0x7882('0xa')]()[_0x7882('0xb')](agentReportPreview[_0x7882('0x8')](_0x48216d))[_0x7882('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5cb9df){return cmHopper[_0x7882('0xc')](_0x5cb9df,!![])[_0x7882('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x7882('0xd')]=function(_0x4903ab){return cmHopperBlack['checkIsBlackList'](_0x4903ab)[_0x7882('0x9')](loggerCatch(_0x7882('0xe')));};exports[_0x7882('0xf')]=function(_0x4377a3){return BPromise[_0x7882('0xa')]()[_0x7882('0xb')](cmHopper[_0x7882('0xf')](_0x4377a3))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x7882('0x8')]=function(_0xff5c66,_0x294369){create(_0xff5c66)[_0x7882('0x9')](loggerCatch(_0x294369));moveContact(_0xff5c66)[_0x7882('0x9')](loggerCatch(_0x294369));};exports['createAgentHistory']=function(_0x28fd43,_0x5c6566){createAgent(_0x28fd43)[_0x7882('0x9')](loggerCatch(_0x5c6566));};exports[_0x7882('0x10')]=function(_0x356615,_0x45a3a6){create(_0x356615)[_0x7882('0x9')](loggerCatch(_0x45a3a6));};exports['createCustomerFinal']=function(_0x20bae1,_0x1d6d97){moveContact(_0x20bae1)['catch'](loggerCatch(_0x1d6d97));};exports[_0x7882('0x11')]=function(_0x5db910,_0x3121fe,_0x3e3e16){if(_0x3121fe){_0x5db910[_0x7882('0x12')]=null;}if(_0x3e3e16){_0x5db910[_0x7882('0x13')]=![];}return cmHopper[_0x7882('0x11')](_0x5db910)[_0x7882('0x9')](loggerCatch(_0x7882('0x14')));};exports[_0x7882('0x15')]=function(_0x2c0b5c){return cmHopper['countReScheduled'](_0x2c0b5c)[_0x7882('0x9')](loggerCatch(_0x7882('0x16')));};exports['unlockContact']=function(_0x2bba75){return cmHopper[_0x7882('0x17')]({'UserId':null},_0x2bba75,0x1)[_0x7882('0x9')](loggerCatch(_0x7882('0x18')));};exports[_0x7882('0x19')]=function(_0x2e286a){return cmHopper[_0x7882('0x17')]({'active':![]},_0x2e286a,0x1)[_0x7882('0x9')](loggerCatch(_0x7882('0x1a')));};exports[_0x7882('0x1b')]=function(_0x3bc897){var _0x3bc56c={};_0x3bc56c['type']=_0x3bc897[_0x7882('0x1c')];_0x3bc56c[_0x7882('0x1d')]=_0x3bc897[_0x7882('0x1d')];_0x3bc56c['calleridnum']=_0x3bc897['calleridnum'];_0x3bc56c[_0x7882('0x1e')]=_0x3bc897[_0x7882('0x1e')];_0x3bc56c[_0x7882('0x1f')]=_0x3bc897['queue'];_0x3bc56c['queuecallerjoinAt']=_0x3bc897[_0x7882('0x20')];_0x3bc56c['queuecallerleaveAt']=_0x3bc897['answertime'];_0x3bc56c[_0x7882('0x21')]=0x1;_0x3bc56c[_0x7882('0x22')]=_0x3bc897[_0x7882('0x23')];_0x3bc56c[_0x7882('0x24')]=_0x3bc897[_0x7882('0x25')];_0x3bc56c[_0x7882('0x26')]=_0x7882('0x27');_0x3bc56c[_0x7882('0x28')]=_0x7882('0x29');_0x3bc56c[_0x7882('0x2a')]=0x0;_0x3bc56c['assigned']=0x1;_0x3bc56c[_0x7882('0x2b')]=_0x3bc897[_0x7882('0x25')];_0x3bc56c['queuecallerexitreason']=_0x7882('0x2c');return BPromise['resolve']()[_0x7882('0xb')](voiceQueueReport['create'](_0x3bc56c))[_0x7882('0x9')](loggerCatch(_0x7882('0x2d')));};exports[_0x7882('0x2e')]=function(_0x404d1c,_0x1006d2){return BPromise[_0x7882('0xa')]()[_0x7882('0xb')](cmHopper[_0x7882('0x2e')](_0x404d1c,_0x1006d2))[_0x7882('0x9')](loggerCatch(_0x7882('0x2f')));};exports['rescheduleContactInQueue']=function(_0x50eec4){return cmHopper[_0x7882('0x11')](_0x50eec4,!![],!![])[_0x7882('0x9')](loggerCatch(_0x7882('0x30')));}; \ 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 0f9c7e3..0a81429 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 _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 +var _0x0dc0=['../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','logBlacklist','state','statedesc','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','logLookAgent','membername','getSeconds','talktime','answertime','Failure','RECALL','BOOKED','uniqueid','calleridnum','xcally-motion-preview','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','active','scheduledat','add','ListId','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','getDiff','milliseconds','seconds','createBody','CampaignId','idContact','queue','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','UserId','sipcallid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','forEach','toLowerCase','util','moment','preview','env','127.0.0.1'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x0dc0,0x178));var _0x00dc=function(_0xf6aea1,_0x5e4811){_0xf6aea1=_0xf6aea1-0x0;var _0x304a1e=_0x0dc0[_0xf6aea1];return _0x304a1e;};'use strict';var util=require(_0x00dc('0x0'));var _=require('lodash');var moment=require(_0x00dc('0x1'));var logger=require('../../../../config/logger')(_0x00dc('0x2'));var ipAgi=process[_0x00dc('0x3')]['XCALLY_IP_AGI']||_0x00dc('0x4');var utils=require(_0x00dc('0x5'));exports[_0x00dc('0x6')]=function(_0x9e1b41){return function(_0x46aa40){logger[_0x00dc('0x7')](_0x9e1b41,util[_0x00dc('0x8')](_0x46aa40,{'showHidden':![],'depth':null}));};};exports[_0x00dc('0x9')]=function(_0x12f018,_0x256f4c){logger[_0x00dc('0xa')](_0x12f018,util[_0x00dc('0x8')](_0x256f4c,{'showHidden':![],'depth':null}));};exports[_0x00dc('0xb')]=function(_0x346b88,_0x1d074b){logger[_0x00dc('0x7')](_0x346b88,util[_0x00dc('0x8')](_0x1d074b,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x13d7a8){return function(_0x4d331f){logger[_0x00dc('0xa')](_0x13d7a8,util[_0x00dc('0x8')](_0x4d331f,{'showHidden':![],'depth':null}));};};exports[_0x00dc('0xc')]=function(_0x17bdd8,_0x290b1d,_0x3c35e6){return{'message':_0x17bdd8,'unlock':_0x290b1d,'active':_0x3c35e6};};exports[_0x00dc('0xd')]=function(_0x1ba4f8,_0x522613,_0x2d2575){if(!_[_0x00dc('0xe')](_0x2d2575)&&_0x00dc('0xf')===typeof _0x2d2575&&!_[_0x00dc('0x10')](_0x2d2575)){if(!_[_0x00dc('0xe')](_0x522613)&&_0x00dc('0xf')===typeof _0x522613&&!_[_0x00dc('0x10')](_0x522613)){return util[_0x00dc('0x11')](_0x00dc('0x12'),_0x522613,_0x2d2575);}return util['format']('\x22%s\x22\x20<%s>',_0x2d2575,_0x2d2575);}if(!_['isUndefined'](_0x1ba4f8)&&'string'===typeof _0x1ba4f8&&!_[_0x00dc('0x10')](_0x1ba4f8)){return _0x1ba4f8;}return _0x00dc('0x13');};exports[_0x00dc('0x14')]=function(_0x2e9279){if(_[_0x00dc('0x15')](_0x2e9279)){return![];}return _0x2e9279;};exports['addVariables']=function(_0x3a21fe,_0x533e05,_0x4c64da,_0x4337e8,_0x31af72,_0x1daf51){var _0xb828fc={'XMD-QUEUE':_0x533e05['Queue']?_0x533e05['Queue'][_0x00dc('0x16')]:'','XMD-CALLERID':_0x4337e8,'XMD-CALLERID-PREVIEW':_0x1daf51?util[_0x00dc('0x11')](_0x00dc('0x12'),_0x1daf51[_0x00dc('0x17')],_0x1daf51['calleridnum']):_0x4337e8,'XMD-DIALID':_0x31af72,'XMD-CONTACTID':_0x533e05[_0x00dc('0x18')],'XMD-CDRTYPE':_0x00dc('0x19'),'CALLERID(all)':_0x4337e8,'XMD-VOICEQUEUEID':_0x533e05[_0x00dc('0x1a')],'XMD-DIALCHANNEL':_0x4c64da,'XMD-DIALTIMEOUT':_0x3a21fe[_0x00dc('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x3a21fe[_0x00dc('0x1c')]?'g':'',_[_0x00dc('0x10')](_0x3a21fe[_0x00dc('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3a21fe[_0x00dc('0x1e')]||'','XMD-AGI':_0x3a21fe['dialQueueProject']?util[_0x00dc('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3a21fe[_0x00dc('0x1f')]):_0x00dc('0x20'),'XMD-AGIAFTER':_0x3a21fe[_0x00dc('0x1c')]?util[_0x00dc('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3a21fe['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1daf51?_0x1daf51[_0x00dc('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x1daf51?_0x1daf51[_0x00dc('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x00dc('0x23')};if(!_[_0x00dc('0x10')](_0x3a21fe['monitor_format'])){_0xb828fc[util[_0x00dc('0x11')]('%s',_0x00dc('0x24'))]=_0x3a21fe[_0x00dc('0x1d')];_0xb828fc[util[_0x00dc('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x31af72;}return _0xb828fc;};exports[_0x00dc('0x25')]=function(_0x53e3af){var _0x17b5e5={};for(var _0x3f8704 in _0x53e3af){if(_0x53e3af[_0x00dc('0x26')](_0x3f8704)){_0x17b5e5[util['format']('%s',_[_0x00dc('0x27')](_0x3f8704))]=_0x53e3af[_0x3f8704];}}return{'variables':_0x17b5e5};};exports[_0x00dc('0x28')]=function(_0x4702d1){var _0x43ed9e=moment()[_0x00dc('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4702d1[_0x00dc('0x29')]=0xd;_0x4702d1[_0x00dc('0x2a')]=_0x00dc('0x2b');_0x4702d1[_0x00dc('0x2c')]=_0x43ed9e;_0x4702d1['responsetime']=_0x43ed9e;_0x4702d1[_0x00dc('0x2d')]=_0x43ed9e;};exports[_0x00dc('0x2e')]=function(_0x507d4d,_0x1a0233,_0x46ebd9){var _0x1cfe06=moment()[_0x00dc('0x11')](_0x00dc('0x2f'));_0x507d4d['state']=_0x1a0233;_0x507d4d[_0x00dc('0x2a')]=_0x46ebd9;_0x507d4d[_0x00dc('0x30')]=_0x1cfe06;_0x507d4d[_0x00dc('0x31')]=utils['getSeconds'](_0x507d4d[_0x00dc('0x30')],_0x507d4d[_0x00dc('0x2c')]);};exports[_0x00dc('0x32')]=function(_0x2952c8,_0x1dc315,_0x4aae69){_0x2952c8[_0x00dc('0x33')]=_0x1dc315;_0x2952c8['UserId']=_0x4aae69;};exports['logCustomer']=function(_0x313803,_0x46d52b,_0x43e00){var _0x2bde8b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x313803[_0x00dc('0x29')]=_0x46d52b;_0x313803[_0x00dc('0x2a')]=_0x43e00;_0x313803[_0x00dc('0x30')]=_0x313803[_0x00dc('0x30')]?_0x313803['responsetime']:_0x2bde8b;_0x313803[_0x00dc('0x2d')]=_0x313803['endtime']?_0x313803[_0x00dc('0x2d')]:_0x2bde8b;_0x313803[_0x00dc('0x31')]=utils[_0x00dc('0x34')](_0x313803['responsetime']||0x0,_0x313803['starttime']||0x0);_0x313803[_0x00dc('0x35')]=_0x313803['answertime']?utils[_0x00dc('0x34')](_0x313803[_0x00dc('0x2d')],_0x313803[_0x00dc('0x36')]):0x0;};exports['isFailure']=function(_0x3009f4){return _0x3009f4===_0x00dc('0x37');};exports['variablesAction']=function(_0x5a0311,_0xa0fef2,_0x579275,_0x342f3f,_0x5f1e12){var _0x1e6b37=_0x342f3f?_0x00dc('0x38'):_0x5a0311[_0x00dc('0x17')];_0x1e6b37=_0x5f1e12?_0x00dc('0x39'):_0x1e6b37;return{'actionid':_0x5a0311[_0x00dc('0x3a')],'action':'originate','channel':_0x5a0311['channelAgent'],'callerid':util[_0x00dc('0x11')](_0x00dc('0x12'),_0x1e6b37,_0x5a0311[_0x00dc('0x3b')]),'Exten':_0x00dc('0x3c'),'Context':'from-sip','Priority':'1','variable':_0x579275,'timeout':(_0xa0fef2[_0x00dc('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5a0311[_0x00dc('0x3a')]};};exports[_0x00dc('0x3e')]=function(_0x289b95){return _0x289b95[_0x00dc('0x3f')]+_0x289b95['countcongestionretry']+_0x289b95[_0x00dc('0x40')]+_0x289b95[_0x00dc('0x41')]+_0x289b95['countnosuchnumberretry'];};exports[_0x00dc('0x42')]=function(_0x48e940){var _0x434783=_['clone'](_0x48e940);_0x434783['state']=0xf;_0x434783[_0x00dc('0x2a')]=_0x00dc('0x43');return _0x434783;};exports['scheduledAt']=function(_0x324584,_0x4d1205,_0x3547ff){var _0x5b342b={};_0x5b342b[_0x4d1205]=_0x324584[_0x4d1205];_0x5b342b[_0x00dc('0x44')]=![];_0x5b342b[_0x00dc('0x45')]=moment()[_0x00dc('0x46')](_0x3547ff,'minutes')['format'](_0x00dc('0x2f'));_0x5b342b[_0x00dc('0x18')]=_0x324584['ContactId'];_0x5b342b[_0x00dc('0x47')]=_0x324584[_0x00dc('0x47')];_0x5b342b[_0x00dc('0x1a')]=_0x324584[_0x00dc('0x1a')]||undefined;return _0x5b342b;};exports['decrementTalking']=function(_0x1fc920,_0x22a252){if(!_[_0x00dc('0x15')](_0x1fc920)){if(_0x1fc920['pTalking']>0x0){_0x1fc920[_0x00dc('0x48')]-=0x1;}else{logger[_0x00dc('0xa')](_0x22a252,_0x00dc('0x49'));}}else{logger[_0x00dc('0x7')](_0x22a252,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0x00dc('0x4a')]=function(_0x383e67){if(_0x383e67<=0x0){return!![];}return![];};function buildObj(_0x538fb0,_0x2af773,_0x904645){_0x538fb0['lastevent']=_0x2af773;_0x538fb0[_0x00dc('0x16')]=_0x538fb0['queue'];_0x538fb0[_0x00dc('0x4b')]=_0x538fb0[_0x00dc('0x4c')];_0x538fb0[_0x00dc('0x4d')]=_0x00dc('0x4e');if(_0x904645){_0x538fb0[_0x00dc('0x4f')]=_0x904645['mandatoryDisposition'];}return _0x538fb0;}exports[_0x00dc('0x50')]=buildObj;exports[_0x00dc('0x51')]=function(_0x76d24e){var _0x4c2296=[];for(var _0x475008 in _0x76d24e){if(_0x76d24e['hasOwnProperty'](_0x475008)){if(!_[_0x00dc('0x15')](_0x76d24e[_0x475008])&&_0x76d24e[_0x475008]['state']==='not_inuse'&&_0x76d24e[_0x475008][_0x00dc('0x52')]==='reachable'){_0x4c2296['push'](_0x76d24e[_0x475008]['id']);}}}return _0x4c2296;};exports[_0x00dc('0x53')]=function(_0x315bee){var _0x1569f8=moment()['milliseconds'](0x0);var _0x1fd8e0=moment(_0x315bee)[_0x00dc('0x54')](0x0);return _0x1569f8['diff'](_0x1fd8e0,_0x00dc('0x55'));};exports[_0x00dc('0x56')]=function(_0x1cfca9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1cfca9[_0x00dc('0x18')],'ListId':_0x1cfca9[_0x00dc('0x47')],'VoiceQueueId':_0x1cfca9[_0x00dc('0x1a')]||undefined,'CampaignId':_0x1cfca9[_0x00dc('0x57')]||undefined};};exports['filterKey']=function(_0x2d8def){if(_0x2d8def===_0x00dc('0x3a')||_0x2d8def===_0x00dc('0x58')||_0x2d8def===_0x00dc('0x59')||_0x2d8def===_0x00dc('0x5a')||_0x2d8def===_0x00dc('0x5b')||_0x2d8def==='dialAnswer'||_0x2d8def===_0x00dc('0x33')||_0x2d8def===_0x00dc('0x4c')||_0x2d8def===_0x00dc('0x17')||_0x2d8def===_0x00dc('0x44')||_0x2d8def==='calleridnum'||_0x2d8def==='scheduledat'||_0x2d8def==='countbusyretry'||_0x2d8def==='countcongestionretry'||_0x2d8def==='countnoanswerretry'||_0x2d8def===_0x00dc('0x5c')||_0x2d8def===_0x00dc('0x5d')||_0x2d8def===_0x00dc('0x5e')||_0x2d8def===_0x00dc('0x5f')||_0x2d8def==='recallme'||_0x2d8def===_0x00dc('0x18')||_0x2d8def===_0x00dc('0x47')||_0x2d8def===_0x00dc('0x60')||_0x2d8def===_0x00dc('0x1a')||_0x2d8def===_0x00dc('0x61')||_0x2d8def==='xmd-voicequeueid'||_0x2d8def==='xmd-queue'||_0x2d8def===_0x00dc('0x62')||_0x2d8def===_0x00dc('0x63')||_0x2d8def==='xmd-dialurl'||_0x2d8def===_0x00dc('0x64')||_0x2d8def==='xmd-dialoptions'||_0x2d8def==='xmd-dialid'||_0x2d8def===_0x00dc('0x65')||_0x2d8def===_0x00dc('0x66')||_0x2d8def===_0x00dc('0x67')||_0x2d8def===_0x00dc('0x68')||_0x2d8def==='xmd-agiafter'||_0x2d8def===_0x00dc('0x69')||_0x2d8def==='rtpaudioqos'||_0x2d8def==='rtpaudioqosbridged'||_0x2d8def===_0x00dc('0x6a')||_0x2d8def===_0x00dc('0x6b')||_0x2d8def==='rtpaudioqosloss'||_0x2d8def===_0x00dc('0x6c')||_0x2d8def===_0x00dc('0x6d')||_0x2d8def==='rtpaudioqosrttbridged'||_0x2d8def===_0x00dc('0x6e')||_0x2d8def==='rtpaudioqosbridged'||_0x2d8def===_0x00dc('0x6a')||_0x2d8def===_0x00dc('0x6b')||_0x2d8def===_0x00dc('0x6f')||_0x2d8def==='rtpaudioqoslossbridged'||_0x2d8def===_0x00dc('0x6d')||_0x2d8def===_0x00dc('0x70')||_0x2d8def===_0x00dc('0x71')||_0x2d8def===_0x00dc('0x72')||_0x2d8def===_0x00dc('0x29')||_0x2d8def===_0x00dc('0x2a')){return![];}return!![];};exports[_0x00dc('0x73')]=function(_0x6ab7e0,_0x386e85){var _0x31c063,_0x153372,_0x47bbd8;if(_0x386e85<=0x0){_0x386e85=0x1;}_0x31c063=new RegExp(_0x00dc('0x74')+_0x386e85+'}$');_0x153372=Math[_0x00dc('0x75')](0xa,_0x386e85-0x1);_0x47bbd8=Math[_0x00dc('0x75')](0xa,_0x386e85)-0x1;return util[_0x00dc('0x11')]('%s',_[_0x00dc('0x76')](_0x6ab7e0,_0x31c063,_[_0x00dc('0x77')](_0x153372,_0x47bbd8)));};exports[_0x00dc('0x78')]=function(_0x4abec8){var _0xfec33f=_0x4abec8[_0x00dc('0x79')](/"(.*?)"/);return _0xfec33f?_0xfec33f[0x1]:_0x4abec8;};exports[_0x00dc('0x7a')]=function(_0x271e9d){var _0x1a95e0=_0x271e9d[_0x00dc('0x79')](/<(.*?)>/);return _0x1a95e0?_0x1a95e0[0x1]:_0x271e9d;};function buildNoAnswerEventPayload(_0x2bfb53,_0x5f1454){var _0x5c34f2=buildObj(_0x2bfb53,_0x00dc('0x7b'));if(!_['isEmpty'](_0x5f1454['variables'])){Object[_0x00dc('0x7c')](_0x5f1454['variables'])[_0x00dc('0x7d')](function(_0x39ecf4){_0x5c34f2[_0x39ecf4[_0x00dc('0x7e')]()]=_0x5f1454['variables'][_0x39ecf4];});}return _0x5c34f2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 593cfe1..0b04d2d 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 _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 +var _0x05b0=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','voicequeuechannel'];(function(_0x562e5f,_0x734a68){var _0x5627a4=function(_0x36bdbb){while(--_0x36bdbb){_0x562e5f['push'](_0x562e5f['shift']());}};_0x5627a4(++_0x734a68);}(_0x05b0,0xfa));var _0x005b=function(_0x2cfb34,_0x481e32){_0x2cfb34=_0x2cfb34-0x0;var _0xc4dd5c=_0x05b0[_0x2cfb34];return _0xc4dd5c;};'use strict';exports[_0x005b('0x0')]={'queue':{'type':_0x005b('0x1'),'required':!![]},'interface':{'type':_0x005b('0x1'),'required':!![]},'membername':{'type':_0x005b('0x1'),'required':!![]},'penalty':{'type':_0x005b('0x2'),'required':![]},'paused':{'type':_0x005b('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x005b('0x1'),'required':!![]},'interface':{'type':_0x005b('0x1'),'required':!![]}};exports[_0x005b('0x4')]={'interface':{'type':_0x005b('0x1'),'required':!![]},'paused':{'type':_0x005b('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x005b('0x1'),'required':![]}};exports[_0x005b('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x005b('0x1')},'format':{'type':_0x005b('0x1')},'mixmonitorid':{'type':_0x005b('0x1')}};exports[_0x005b('0x6')]={'uniqueid':{'type':_0x005b('0x1'),'required':!![]}};exports[_0x005b('0x7')]={'uniqueid':{'type':_0x005b('0x1'),'required':!![]},'exten':{'type':_0x005b('0x1'),'required':!![]},'context':{'type':_0x005b('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b2f6b48..597c6f7 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 _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 +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0xd39328,_0xc84656){var _0x17aa80=function(_0x28b818){while(--_0x28b818){_0xd39328['push'](_0xd39328['shift']());}};_0x17aa80(++_0xc84656);}(_0x757a,0xde));var _0xa757=function(_0x19ca19,_0x12f4ab){_0x19ca19=_0x19ca19-0x0;var _0x317eb9=_0x757a[_0x19ca19];return _0x317eb9;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index baaa445..f7c1da8 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 _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 +var _0x32be=['hasOwnProperty','assign'];(function(_0x2b0074,_0x42d50b){var _0x25b012=function(_0x53d3b9){while(--_0x53d3b9){_0x2b0074['push'](_0x2b0074['shift']());}};_0x25b012(++_0x42d50b);}(_0x32be,0xb9));var _0xe32b=function(_0x5950bd,_0x103e16){_0x5950bd=_0x5950bd-0x0;var _0x33e816=_0x32be[_0x5950bd];return _0x33e816;};'use strict';function mergeDBDataToRealtime(_0x5b4f17,_0x306652){var _0x289a11=Object[_0xe32b('0x0')]({},_0x5b4f17);for(var _0x47a65a in _0x306652){if(_0x289a11[_0xe32b('0x1')](_0x47a65a)){_0x289a11[_0x47a65a]=_0x306652[_0x47a65a];}}return _0x289a11;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 305c49f..33db2a0 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 _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','calleridname','transfers','linkedid'];(function(_0x5840a5,_0x374e6c){var _0x2d3e92=function(_0x96cad4){while(--_0x96cad4){_0x5840a5['push'](_0x5840a5['shift']());}};_0x2d3e92(++_0x374e6c);}(_0xa5cd,0x1cc));var _0xda5c=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xa5cd[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xda5c('0x0'));var moment=require(_0xda5c('0x1'));var util=require('util');var config=require(_0xda5c('0x2'));var ami=require(_0xda5c('0x3'));var RpcVoiceAgentReport=require(_0xda5c('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xda5c('0x5'));var RpcVoiceQueueReport=require(_0xda5c('0x6'));var RpcVoiceRecording=require(_0xda5c('0x7'));var RpcVoiceTransferReport=require(_0xda5c('0x8'));var VoiceQueueReport=require(_0xda5c('0x9'));var VoiceCallReport=require(_0xda5c('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xda5c('0xb'));var UserReport=require(_0xda5c('0xc'));function Report(_0x41660c){this[_0xda5c('0xd')]=_0x41660c;this[_0xda5c('0xe')]=_0x41660c[_0xda5c('0xe')];this[_0xda5c('0xf')]=_0x41660c[_0xda5c('0xf')];}Report['prototype'][_0xda5c('0x10')]=function(_0x2e69a4){var _0x26368c=new VoiceQueueReport(this[_0xda5c('0xd')]);var _0x1777a4=new VoiceAgentReport(this[_0xda5c('0xd')]);var _0x5379dc=new VoiceDialReport(this[_0xda5c('0xd')]);var _0x4eb706=new VoiceCallReport(this[_0xda5c('0xd')]);var _0x277b35=new UserReport(this['realtime']);if(config[_0xda5c('0x11')]&&config[_0xda5c('0x11')][_0xda5c('0x12')]){ami['on'](_0xda5c('0x13'),this[_0xda5c('0x14')][_0xda5c('0x15')](this));ami['on'](_0xda5c('0x16'),this[_0xda5c('0x17')][_0xda5c('0x15')](this));ami['on'](_0xda5c('0x18'),this['voiceAgentReport']['bind'](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0xda5c('0x15')](this));ami['on'](_0xda5c('0x19'),this[_0xda5c('0x1a')]['bind'](this));ami['on']('attendedtransfer',this[_0xda5c('0x1b')][_0xda5c('0x15')](this));}};Report[_0xda5c('0x1c')][_0xda5c('0x1d')]=function(_0x2c96bb){var _0xafca74;_0xafca74=_['find'](this[_0xda5c('0xe')],function(_0x380384){return _0x380384['accountcode']==_0x2c96bb||_0x380384[_0xda5c('0x1e')]==_0x2c96bb;});if(_[_0xda5c('0x1f')](_0xafca74)){var _0x52f30b=_[_0xda5c('0x20')](this[_0xda5c('0xf')],function(_0x42ff46){return _0x42ff46[_0xda5c('0x21')]==_0x2c96bb||_0x42ff46['name']==_0x2c96bb;});if(_0x52f30b){_0xafca74=_[_0xda5c('0x20')](this[_0xda5c('0xe')],function(_0x1b99e8){return _0x1b99e8['interface']==util[_0xda5c('0x22')](_0xda5c('0x23'),_0x52f30b['name']);});}}return _0xafca74;};Report[_0xda5c('0x1c')][_0xda5c('0x14')]=function(_0x52b626){for(var _0x502759=0x0;_0x502759<_0x52b626[_0xda5c('0x24')];_0x502759+=0x1){var _0x3a8fb1=this[_0xda5c('0x1d')](_0x52b626[_0x502759]['connectedlinenum']);if(_0x3a8fb1){_0x52b626[_0x502759][_0xda5c('0x21')]=_0x3a8fb1[_0xda5c('0x21')];_0x52b626[_0x502759][_0xda5c('0x25')]=!![];_0x52b626[_0x502759]['lastAssignedTo']=_0x3a8fb1[_0xda5c('0x1e')];_0x52b626[_0x502759]['interface']=_['isNil'](_0x3a8fb1[_0xda5c('0x26')])?util['format'](_0xda5c('0x23'),_0x3a8fb1[_0xda5c('0x1e')]):_0x3a8fb1[_0xda5c('0x26')];if(_0x52b626[_0x502759][_0xda5c('0x27')]){_0x52b626[_0x502759][_0xda5c('0x28')]=moment()[_0xda5c('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x52b626[_0x502759][_0xda5c('0x29')]){_0x52b626[_0x502759]['queuecallerexitAt']=moment()[_0xda5c('0x22')](_0xda5c('0x2a'));}RpcMemberReport[_0xda5c('0x14')](_0x52b626[_0x502759]);}RpcVoiceQueueReport['create'](_0x52b626[_0x502759]);}};function extractCalleridNumber(_0x3b13ad){var _0x2cf9cc=_0x3b13ad[_0xda5c('0x2b')](/<(.*?)>/);return _0x2cf9cc?_0x2cf9cc[0x1]:_0x3b13ad;}Report[_0xda5c('0x1c')]['getAgentByInternal']=function(_0x1a2075){for(var _0x99c584=0x0;_0x99c584{delete this[_0x827d('0xb')][_0x1706d7];},_0x38285e);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xac41=['[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','deleteChannelAfterTimeout','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','queuecallerabandon','varset','syncVarSet','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','isUndefined','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','voice','assign','event','privilege','inspect','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','error','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','merge','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:'];(function(_0x403738,_0x21f15d){var _0x3cbe9a=function(_0x175e6a){while(--_0x175e6a){_0x403738['push'](_0x403738['shift']());}};_0x3cbe9a(++_0x21f15d);}(_0xac41,0xdd));var _0x1ac4=function(_0x2eae0e,_0x3df171){_0x2eae0e=_0x2eae0e-0x0;var _0x54d33a=_0xac41[_0x2eae0e];return _0x54d33a;};'use strict';var _=require(_0x1ac4('0x0'));var moment=require(_0x1ac4('0x1'));var util=require(_0x1ac4('0x2'));var Redis=require(_0x1ac4('0x3'));var config=require(_0x1ac4('0x4'));var logger=require(_0x1ac4('0x5'))(_0x1ac4('0x6'));var ami=require(_0x1ac4('0x7'));config['redis']=_[_0x1ac4('0x8')](config[_0x1ac4('0x9')],{'host':_0x1ac4('0xa'),'port':0x18eb});var io=require(_0x1ac4('0xb'))(new Redis(config[_0x1ac4('0x9')]));function VoiceAgentReport(_0x2ad173){this[_0x1ac4('0xc')]={};this[_0x1ac4('0xd')]=_0x2ad173[_0x1ac4('0xc')];this[_0x1ac4('0xe')]=_0x2ad173[_0x1ac4('0xe')];this[_0x1ac4('0xf')]=_0x2ad173[_0x1ac4('0xf')];this[_0x1ac4('0x10')]={};ami['on'](_0x1ac4('0x11'),this[_0x1ac4('0x12')]['bind'](this));ami['on'](_0x1ac4('0x13'),this['syncAgentConnect'][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x15'),this['syncAgentRingNoAnswer'][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x16'),this['syncQueueCallerAbandon'][_0x1ac4('0x14')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x1ac4('0x17'),this[_0x1ac4('0x18')][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x19'),this[_0x1ac4('0x1a')][_0x1ac4('0x14')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x1b'),this[_0x1ac4('0x1c')]['bind'](this));ami['on'](_0x1ac4('0x1d'),this[_0x1ac4('0x1e')][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x1f'),this[_0x1ac4('0x20')][_0x1ac4('0x14')](this));}VoiceAgentReport[_0x1ac4('0x21')]['emit']=function(_0x535891,_0x9c8678,_0x1dc9b3){io['to'](_0x535891)[_0x1ac4('0x22')](_0x9c8678,_0x1dc9b3);};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x23')]=function(_0x5c7c4a){return _0x5c7c4a!==null&&!_['isUndefined'](_0x5c7c4a);};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x12')]=function(_0x479110){try{if(this[_0x1ac4('0x23')](_0x479110)){logger[_0x1ac4('0x24')](_0x1ac4('0x25'),_0x479110[_0x1ac4('0x26')],_0x479110['membername'],_0x479110[_0x1ac4('0x27')]);logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x479110[_0x1ac4('0x26')],util['inspect'](_0x479110,{'showHidden':![],'depth':null}));if(_[_0x1ac4('0x29')](this[_0x1ac4('0xc')][_0x479110[_0x1ac4('0x26')]])){this[_0x1ac4('0xc')][_0x479110['uniqueid']]={};}var _0x1ddf22=this['agents'][_0x479110[_0x1ac4('0x2a')]];var _0x2163f9=this[_0x1ac4('0xc')][_0x479110[_0x1ac4('0x26')]][_0x479110[_0x1ac4('0x27')]];var _0x13a85d=this[_0x1ac4('0xe')][_0x479110[_0x1ac4('0x2b')]];var _0x21a10e=this[_0x1ac4('0x10')][_0x479110[_0x1ac4('0x26')]];if(_[_0x1ac4('0x29')](_0x2163f9)){_0x2163f9={'agentcalledAt':moment()[_0x1ac4('0x2c')](_0x1ac4('0x2d')),'lastevent':_0x1ac4('0x2e'),'mandatoryDisposition':_0x13a85d&&_0x13a85d[_0x1ac4('0x2f')]?_0x13a85d[_0x1ac4('0x2f')]:![],'type':_0x13a85d&&_0x13a85d['type']?_0x13a85d['type']:'inbound','variables':_0x21a10e,'motionChannel':_0x1ac4('0x30')};}Object[_0x1ac4('0x31')](_0x2163f9,_['omit'](_0x479110,[_0x1ac4('0x32'),_0x1ac4('0x33')]));this[_0x1ac4('0xc')][_0x479110['uniqueid']][_0x479110[_0x1ac4('0x27')]]=_0x2163f9;logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x479110[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x2163f9,{'showHidden':![],'depth':null}));ami[_0x1ac4('0x22')]('custom:agentcalled',_0x2163f9);var _0xd8ed1b={'id':_0x1ddf22['id'],'calleridnum':_0x2163f9[_0x1ac4('0x35')],'queue':_0x2163f9[_0x1ac4('0x2b')],'variables':_0x2163f9[_0x1ac4('0x10')],'uniqueid':_0x479110[_0x1ac4('0x26')]};logger['debug'](_0x1ac4('0x36'),_0x479110[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0xd8ed1b,{'showHidden':![],'depth':null}));this[_0x1ac4('0x22')](util[_0x1ac4('0x2c')](_0x1ac4('0x37'),_0x479110[_0x1ac4('0x38')]),'user:called',_0xd8ed1b);}}catch(_0x302f2e){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][agentcalled]',_0x479110[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x302f2e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x3a')]=function(_0x2709e7){try{if(this[_0x1ac4('0x23')](_0x2709e7)){if(this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]]){for(var _0x3d8694 in this[_0x1ac4('0xc')][_0x2709e7['uniqueid']]){if(this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0x3d8694)){if(_0x2709e7[_0x1ac4('0x27')]===_0x3d8694){logger[_0x1ac4('0x24')](_0x1ac4('0x3c'),_0x2709e7[_0x1ac4('0x26')],_0x2709e7['membername'],_0x2709e7['destuniqueid']);this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694]['agentconnectAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x3d')]=_0x2709e7[_0x1ac4('0x3d')];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x3e')]=_0x2709e7[_0x1ac4('0x3e')];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x3f')]=_0x2709e7[_0x1ac4('0x3f')];this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x40')]=_0x2709e7[_0x1ac4('0x40')];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x41')]=_0x2709e7['holdtime'];this['channels'][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x42')]='connect';_[_0x1ac4('0x43')](this['agents'][_0x2709e7[_0x1ac4('0x2a')]],_['pick'](_0x2709e7,[_0x1ac4('0x2b'),_0x1ac4('0x44')]));var _0x2758a9=this[_0x1ac4('0xf')][_0x2709e7[_0x1ac4('0x2a')]];var _0x39adae={'id':_0x2758a9['id'],'name':_0x2758a9[_0x1ac4('0x45')],'agentconnected':!![],'destaccountcode':_0x2758a9[_0x1ac4('0x46')],'destconnectedlinenum':this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x2709e7[_0x1ac4('0x27')]]['exten'],'queue':this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x2709e7[_0x1ac4('0x27')]][_0x1ac4('0x2b')],'uniqueid':this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x2709e7[_0x1ac4('0x27')]]['uniqueid']};ami['emit'](_0x1ac4('0x47'),this['channels'][_0x2709e7[_0x1ac4('0x26')]][_0x2709e7[_0x1ac4('0x27')]]);this[_0x1ac4('0x22')](util['format'](_0x1ac4('0x37'),_0x2709e7[_0x1ac4('0x38')]),_0x1ac4('0x48'),_0x39adae);}else if(!this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x15')]&&!this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x49')]){logger['info'](_0x1ac4('0x4a'),_0x2709e7[_0x1ac4('0x26')],this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x38')],_0x3d8694);this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x15')]=!![];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694]['agentringnoanswerAt']=moment()['format'](_0x1ac4('0x2d'));this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x4b')]=_0x2709e7['destuniqueid'];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x4c')]=_0x2709e7['membername'];this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x42')]=_0x1ac4('0x4d');this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x4e')]='answered_elsewhere';logger['debug'](_0x1ac4('0x4f'),_0x2709e7['uniqueid'],util[_0x1ac4('0x34')](this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this['channels'][_0x2709e7['uniqueid']][_0x3d8694]);}else{logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x2709e7[_0x1ac4('0x26')]);}}}}}}catch(_0x2e88b1){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x2709e7[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x2e88b1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x50')]=function(_0x3bd1f2){try{if(this['isNotNull'](_0x3bd1f2)){logger[_0x1ac4('0x28')](_0x1ac4('0x51'),_0x3bd1f2['uniqueid'],util[_0x1ac4('0x34')](_0x3bd1f2,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x3bd1f2[_0x1ac4('0x26')]]&&this[_0x1ac4('0xc')][_0x3bd1f2[_0x1ac4('0x26')]][_0x3bd1f2[_0x1ac4('0x27')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x3bd1f2[_0x1ac4('0x26')],_0x3bd1f2[_0x1ac4('0x38')],_0x3bd1f2[_0x1ac4('0x27')]);var _0x362ed7=this[_0x1ac4('0xf')][_0x3bd1f2[_0x1ac4('0x2a')]];var _0xffd8e0=this[_0x1ac4('0xc')][_0x3bd1f2[_0x1ac4('0x26')]][_0x3bd1f2[_0x1ac4('0x27')]];_0xffd8e0[_0x1ac4('0x15')]=!![];_0xffd8e0[_0x1ac4('0x52')]=moment()[_0x1ac4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0xffd8e0['lastevent']=_0x1ac4('0x53');_0xffd8e0[_0x1ac4('0x4e')]=_0x1ac4('0x53');var _0x210523={'id':_0x362ed7['id'],'name':_0x362ed7[_0x1ac4('0x45')],'queue':_0xffd8e0[_0x1ac4('0x2b')],'uniqueid':_0xffd8e0['uniqueid']};logger['debug'](_0x1ac4('0x54'),_0x3bd1f2[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x210523,{'showHidden':![],'depth':null}));this[_0x1ac4('0x22')](util[_0x1ac4('0x2c')](_0x1ac4('0x37'),_0x362ed7[_0x1ac4('0x45')]),'user:agentringnoanswer',_0x210523);ami[_0x1ac4('0x22')]('custom:agentringnoanswer',_0xffd8e0);this['channels'][_0x3bd1f2[_0x1ac4('0x26')]][_0x3bd1f2[_0x1ac4('0x27')]]=Object[_0x1ac4('0x31')]({},_0xffd8e0);}}}catch(_0x37210b){logger[_0x1ac4('0x39')](_0x1ac4('0x55'),_0x3bd1f2[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x37210b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x56')]=function(_0x42a81f){try{if(this[_0x1ac4('0x23')](_0x42a81f)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x42a81f[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x42a81f,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]]){for(var _0xf76dac in this[_0x1ac4('0xc')][_0x42a81f['uniqueid']]){if(this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0xf76dac)&&!this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x15')]&&!this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x49')]){logger[_0x1ac4('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x42a81f[_0x1ac4('0x26')],this['channels'][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x38')],_0xf76dac);this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac]['agentringnoanswer']=!![];this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x52')]=moment()[_0x1ac4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ac4('0xc')][_0x42a81f['uniqueid']][_0xf76dac][_0x1ac4('0x42')]=_0x1ac4('0x57');this['channels'][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x4e')]='abandoned';logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x42a81f['uniqueid'],util[_0x1ac4('0x34')](this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac],{'showHidden':![],'depth':null}));ami[_0x1ac4('0x22')](_0x1ac4('0x58'),this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac]);}}}}}catch(_0x4b5f12){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][queuecallerabandon]',_0x42a81f[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x4b5f12,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')]['syncAgentComplete']=function(_0x28887d){try{if(this[_0x1ac4('0x23')](_0x28887d)){logger[_0x1ac4('0x28')](_0x1ac4('0x59'),_0x28887d[_0x1ac4('0x26')],util['inspect'](_0x28887d,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]]){for(var _0x26dd62 in this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]]){if(this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0x26dd62)){if(this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['agentconnectAt']&&!this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62][_0x1ac4('0x49')]){logger[_0x1ac4('0x24')](_0x1ac4('0x5a'),_0x28887d[_0x1ac4('0x26')],this['channels'][_0x28887d['uniqueid']][_0x26dd62][_0x1ac4('0x38')],_0x26dd62);this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['agentcomplete']=!![];this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62][_0x1ac4('0x5b')]=moment()[_0x1ac4('0x2c')](_0x1ac4('0x2d'));this['channels'][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['lastevent']=_0x1ac4('0x5c');this[_0x1ac4('0xc')][_0x28887d['uniqueid']][_0x26dd62][_0x1ac4('0x4e')]=_0x28887d[_0x1ac4('0x4e')]==_0x1ac4('0x5d')?'agent':_0x28887d['reason'];this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['talktime']=_0x28887d[_0x1ac4('0x5e')];if(this[_0x1ac4('0xe')][_0x28887d[_0x1ac4('0x2b')]]&&this[_0x1ac4('0xe')][_0x28887d[_0x1ac4('0x2b')]][_0x1ac4('0x5f')]){this[_0x1ac4('0xc')][_0x28887d['uniqueid']][_0x26dd62]['acwtime']=this['voiceQueues'][_0x28887d[_0x1ac4('0x2b')]][_0x1ac4('0x60')];this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62][_0x1ac4('0x61')]=!![];}this[_0x1ac4('0xf')][_0x28887d[_0x1ac4('0x2a')]]=_['omit'](this['agents'][_0x28887d['interface']],[_0x1ac4('0x2b'),_0x1ac4('0x44')]);logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x28887d[_0x1ac4('0x26')],util[_0x1ac4('0x34')](this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62],{'showHidden':![],'depth':null}));ami['emit'](_0x1ac4('0x62'),this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]);logger['debug'](_0x1ac4('0x63'),_0x28887d[_0x1ac4('0x26')],util[_0x1ac4('0x34')]({'id':this[_0x1ac4('0xf')][_0x28887d[_0x1ac4('0x2a')]]['id'],'destaccountcode':_0x28887d[_0x1ac4('0x64')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1ac4('0x2c')](_0x1ac4('0x37'),_0x28887d[_0x1ac4('0x38')]),_0x1ac4('0x65'),{'id':this[_0x1ac4('0xf')][_0x28887d[_0x1ac4('0x2a')]]['id'],'destaccountcode':Number(_0x28887d[_0x1ac4('0x64')])});}}}}}}catch(_0x4ccb4e){logger[_0x1ac4('0x39')](_0x1ac4('0x66'),_0x28887d[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x4ccb4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x18')]=function(_0x11d8bf){try{if(this[_0x1ac4('0x23')](_0x11d8bf)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][varset]\x20event:',_0x11d8bf[_0x1ac4('0x26')],util['inspect'](_0x11d8bf,{'showHidden':![],'depth':null}));this[_0x1ac4('0x67')](_0x11d8bf[_0x1ac4('0x26')],_['keys'](_0x11d8bf[_0x1ac4('0x68')])[0x0],_0x11d8bf[_0x1ac4('0x69')]);if(this[_0x1ac4('0xc')][_0x11d8bf[_0x1ac4('0x26')]]){for(var _0x53a19b in this[_0x1ac4('0xc')][_0x11d8bf[_0x1ac4('0x26')]]){if(this[_0x1ac4('0xc')][_0x11d8bf['uniqueid']]['hasOwnProperty'](_0x53a19b)){logger[_0x1ac4('0x24')](_0x1ac4('0x6a'),_0x11d8bf[_0x1ac4('0x26')],_0x53a19b,_[_0x1ac4('0x6b')](_0x11d8bf[_0x1ac4('0x68')])[0x0],_0x11d8bf[_0x1ac4('0x69')]);if(_[_0x1ac4('0x29')](this[_0x1ac4('0xc')][_0x11d8bf['uniqueid']][_0x53a19b][_0x1ac4('0x10')])){this['channels'][_0x11d8bf['uniqueid']][_0x53a19b][_0x1ac4('0x10')]={};}this['channels'][_0x11d8bf[_0x1ac4('0x26')]][_0x53a19b][_0x1ac4('0x10')]=this[_0x1ac4('0x10')][_0x11d8bf['uniqueid']];}}}}}catch(_0x385351){logger['error'](_0x1ac4('0x6c'),_0x11d8bf[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x385351,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x67')]=function(_0xf10760,_0x5835fd,_0x544e17){var _0x239e65=[_0x1ac4('0x6d'),_0x1ac4('0x6e'),_0x1ac4('0x6f'),_0x1ac4('0x70'),'rtpaudioqosloss',_0x1ac4('0x71'),_0x1ac4('0x72'),_0x1ac4('0x73'),_0x1ac4('0x74'),'sipuri',_0x1ac4('0x75'),_0x1ac4('0x76'),_0x1ac4('0x77'),_0x1ac4('0x78'),_0x1ac4('0x79'),_0x1ac4('0x7a'),'membername',_0x1ac4('0x7b'),_0x1ac4('0x7c')];if(!_[_0x1ac4('0x7d')](_0x5835fd)&&!_[_0x1ac4('0x7e')](_0x239e65,_0x5835fd)){if(_['isUndefined'](this[_0x1ac4('0x10')][_0xf10760])){this['variables'][_0xf10760]={};}this[_0x1ac4('0x10')][_0xf10760][_0x5835fd]=_0x544e17;}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x1a')]=function(_0x259f79){try{if(this[_0x1ac4('0x23')](_0x259f79)){logger[_0x1ac4('0x28')](_0x1ac4('0x7f'),_0x259f79[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x259f79,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]){for(var _0x8301e in this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]){if(this['channels'][_0x259f79[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0x8301e)){if(this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]][_0x8301e][_0x1ac4('0x4e')]==_0x1ac4('0x5d')&&this['channels'][_0x259f79[_0x1ac4('0x26')]][_0x8301e][_0x1ac4('0x49')]){logger[_0x1ac4('0x24')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x259f79[_0x1ac4('0x26')],_0x8301e);this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]][_0x8301e]['agentcompleteAt']=moment()[_0x1ac4('0x2c')](_0x1ac4('0x2d'));}}}logger['debug'](_0x1ac4('0x80'),_0x259f79[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_[_0x1ac4('0x81')](this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x1ac4('0x22')](_0x1ac4('0x82'),_['values'](this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]));this['deleteChannelAfterTimeout'](_0x259f79['uniqueid']);}if(this[_0x1ac4('0x10')][_0x259f79['uniqueid']]){delete this['variables'][_0x259f79['uniqueid']];}}}catch(_0xdf1b52){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][hangup]',_0x259f79[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0xdf1b52,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x1e')]=function(_0x20279e){try{if(this[_0x1ac4('0x23')](_0x20279e)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x20279e[_0x1ac4('0x26')],util['inspect'](_0x20279e,{'showHidden':![],'depth':null}));if(this['channels'][_0x20279e[_0x1ac4('0x83')]]){for(var _0x365482 in this['channels'][_0x20279e[_0x1ac4('0x83')]]){if(this[_0x1ac4('0xc')][_0x20279e['transfereeuniqueid']][_0x1ac4('0x3b')](_0x365482)){if(_0x20279e[_0x1ac4('0x84')]===_0x365482){logger['info'](_0x1ac4('0x85'),_0x20279e[_0x1ac4('0x26')],this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482][_0x1ac4('0x38')],_0x365482);var _0x16fc9c=moment();this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482][_0x1ac4('0x49')]=!![];this[_0x1ac4('0xc')][_0x20279e['transfereeuniqueid']][_0x365482][_0x1ac4('0x5b')]=moment()[_0x1ac4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482][_0x1ac4('0x42')]=_0x1ac4('0x5c');this['channels'][_0x20279e['transfereeuniqueid']][_0x365482][_0x1ac4('0x4e')]='transfer';this[_0x1ac4('0xc')][_0x20279e['transfereeuniqueid']][_0x365482][_0x1ac4('0x5e')]=_0x16fc9c[_0x1ac4('0x86')](this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482]['agentconnectAt'],_0x1ac4('0x87'));}}}}if(this[_0x1ac4('0xc')][_0x20279e['secondtransfereruniqueid']]){var _0x576c16=this[_0x1ac4('0xc')][_0x20279e['secondtransfereruniqueid']];this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x88')]]=this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]];this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]]=_0x576c16;}}}catch(_0x4e3a91){logger[_0x1ac4('0x39')](_0x1ac4('0x89'),_0x20279e[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x4e3a91,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x221448){try{if(this[_0x1ac4('0x23')](_0x221448)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x221448['uniqueid'],util[_0x1ac4('0x34')](_0x221448,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x221448['transfereeuniqueid']]){for(var _0x475a0f in this['channels'][_0x221448[_0x1ac4('0x83')]]){if(this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]]['hasOwnProperty'](_0x475a0f)){if(_0x221448[_0x1ac4('0x8a')]===_0x475a0f){logger[_0x1ac4('0x24')](_0x1ac4('0x8b'),_0x221448['uniqueid'],this[_0x1ac4('0xc')][_0x221448['transfereeuniqueid']][_0x475a0f][_0x1ac4('0x38')],_0x475a0f);var _0x297792=moment();this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f][_0x1ac4('0x49')]=!![];this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f][_0x1ac4('0x5b')]=_0x297792;this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f]['lastevent']=_0x1ac4('0x5c');this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f][_0x1ac4('0x4e')]=_0x1ac4('0x5d');this['channels'][_0x221448[_0x1ac4('0x83')]][_0x475a0f]['talktime']=_0x297792[_0x1ac4('0x86')](this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f]['agentconnectAt'],_0x1ac4('0x87'));}}}}}}catch(_0x3fc8b5){logger[_0x1ac4('0x39')](_0x1ac4('0x8c'),_0x221448['uniqueid'],util[_0x1ac4('0x34')](_0x3fc8b5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x8d')]=function(_0x505c83){var _0x376c26='';try{if(this[_0x1ac4('0x23')](_0x505c83)){logger[_0x1ac4('0x28')](_0x1ac4('0x8e'),_0x505c83[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x505c83,{'showHidden':![],'depth':null}));if(_0x505c83[_0x1ac4('0x8f')]){_0x376c26=_0x505c83['channel'][_0x1ac4('0x90')](0x0,_0x505c83[_0x1ac4('0x8f')]['lastIndexOf']('-'));if(this[_0x1ac4('0xf')][_0x376c26]){logger[_0x1ac4('0x24')](_0x1ac4('0x91'),_0x505c83[_0x1ac4('0x26')],_0x376c26);this[_0x1ac4('0xf')][_0x376c26][_0x1ac4('0x92')]=!![];}}}}catch(_0x498cd2){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x505c83[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x498cd2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x1c')]=function(_0x420873){var _0x173f52='';try{if(this['isNotNull'](_0x420873)){logger['debug'](_0x1ac4('0x93'),_0x420873[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x420873,{'showHidden':![],'depth':null}));if(_0x420873[_0x1ac4('0x8f')]){_0x173f52=_0x420873[_0x1ac4('0x8f')][_0x1ac4('0x90')](0x0,_0x420873[_0x1ac4('0x8f')][_0x1ac4('0x94')]('-'));if(this['agents'][_0x173f52]){logger[_0x1ac4('0x24')](_0x1ac4('0x95'),_0x420873['uniqueid'],_0x173f52);this[_0x1ac4('0xf')][_0x173f52][_0x1ac4('0x92')]=![];}}}}catch(_0x3af1b4){logger[_0x1ac4('0x39')](_0x1ac4('0x96'),_0x420873['uniqueid'],util[_0x1ac4('0x34')](_0x3af1b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x97')]=function(_0x2fe8ce,_0xb86fb6=0x2710){if(this[_0x1ac4('0xc')][_0x2fe8ce]){setTimeout(()=>{delete this[_0x1ac4('0xc')][_0x2fe8ce];},_0xb86fb6);}};module[_0x1ac4('0x98')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index a35e927..af5e443 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 _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 +var _0x2c9b=['merge','pick','context','from-sip','channel','split','xcally-motion-preview','destconnectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','blindTransfers','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','undefined','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','keys','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','toNumber','membername','name','UserId','syncMixMonitorFilename','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','rec','[%s][voiceCallReport][varset]\x20event:','value','variable','xmd-phone','xmd-callerid','callerid','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','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','deleteChannelAfterTimeout','exports','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','../rpc/setting','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid'];(function(_0xce399d,_0x3da11c){var _0x4b35d3=function(_0x3f8139){while(--_0x3f8139){_0xce399d['push'](_0xce399d['shift']());}};_0x4b35d3(++_0x3da11c);}(_0x2c9b,0x14a));var _0xb2c9=function(_0x344e48,_0xce9158){_0x344e48=_0x344e48-0x0;var _0x5de200=_0x2c9b[_0x344e48];return _0x5de200;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var path=require(_0xb2c9('0x0'));var Redis=require(_0xb2c9('0x1'));var config=require(_0xb2c9('0x2'));var logger=require(_0xb2c9('0x3'))('ami');var ami=require('../ami');var Channel=require(_0xb2c9('0x4'));var RpcSetting=require(_0xb2c9('0x5'));var applications=[_0xb2c9('0x6'),_0xb2c9('0x7'),_0xb2c9('0x8'),_0xb2c9('0x9'),_0xb2c9('0xa'),'voicemail'];var dispositions=['NO\x20ANSWER',_0xb2c9('0xb'),'FAILED',_0xb2c9('0xc'),'NO\x20ANSWER','NO\x20ANSWER',_0xb2c9('0xd'),_0xb2c9('0xe'),_0xb2c9('0xb'),'FAILED','FAILED'];config[_0xb2c9('0xf')]=_['defaults'](config[_0xb2c9('0xf')],{'host':_0xb2c9('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb2c9('0xf')]));function VoiceCallReport(_0x3596a6){this[_0xb2c9('0x11')]=_0x3596a6[_0xb2c9('0x11')];this[_0xb2c9('0x12')]=_0x3596a6[_0xb2c9('0x12')];this['blindTransfers']={};ami['on'](_0xb2c9('0x13'),this[_0xb2c9('0x14')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x16'),this[_0xb2c9('0x14')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x17'),this[_0xb2c9('0x18')][_0xb2c9('0x15')](this));ami['on']('newstate',this[_0xb2c9('0x19')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x1a'),this[_0xb2c9('0x1b')]['bind'](this));ami['on'](_0xb2c9('0x1c'),this[_0xb2c9('0x1d')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x1e'),this[_0xb2c9('0x1f')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x20'),this[_0xb2c9('0x21')]['bind'](this));ami['on'](_0xb2c9('0x22'),this[_0xb2c9('0x23')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x24'),this[_0xb2c9('0x25')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xb2c9('0x15')](this));try{logger[_0xb2c9('0x26')](_0xb2c9('0x27'));ami[_0xb2c9('0x28')]();}catch(_0xf76b87){logger[_0xb2c9('0x29')](_0xb2c9('0x2a'),util[_0xb2c9('0x2b')](_0xf76b87,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xb2c9('0x2c')]['isNotNull']=function(_0x505439){return _0x505439!==null&&!_[_0xb2c9('0x2d')](_0x505439);};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x2e')]=function(_0x514566,_0x974502,_0x288b4f){io['to'](_0x514566)['emit'](_0x974502,_0x288b4f);};VoiceCallReport[_0xb2c9('0x2c')]['syncNewCallerId']=function(_0x744097){try{if(this[_0xb2c9('0x2f')](_0x744097)){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x744097[_0xb2c9('0x30')],_0x744097[_0xb2c9('0x31')],_0x744097[_0xb2c9('0x32')]);logger[_0xb2c9('0x33')](_0xb2c9('0x34'),_0x744097[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x744097,{'showHidden':![],'depth':null}));if(_0x744097[_0xb2c9('0x30')]===_0x744097[_0xb2c9('0x35')]){if(!_[_0xb2c9('0x2d')](this[_0xb2c9('0x11')][_0x744097['uniqueid']])){_[_0xb2c9('0x36')](this[_0xb2c9('0x11')][_0x744097[_0xb2c9('0x30')]],_[_0xb2c9('0x37')](_0x744097,_['keys'](this[_0xb2c9('0x11')][_0x744097[_0xb2c9('0x30')]])));}}if(_0x744097[_0xb2c9('0x38')]===_0xb2c9('0x39')){var _0x3a9a32=this[_0xb2c9('0x12')][_0x744097[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]];if(_0x3a9a32){if(_0x744097['exten']==_0xb2c9('0x3c')){_0x3a9a32[_0xb2c9('0x3d')]=_0x744097['connectedlinenum'];this[_0xb2c9('0x2e')](util[_0xb2c9('0x3e')](_0xb2c9('0x3f'),_0x3a9a32['name']),_0xb2c9('0x40'),{'id':_0x3a9a32['id'],'destaccountcode':_0x3a9a32[_0xb2c9('0x41')],'destconnectedlinenum':_0x744097['connectedlinenum']});}}}}}catch(_0x44d497){logger[_0xb2c9('0x29')](_0xb2c9('0x42'),_0x744097[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x44d497,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x18')]=function(_0x47be3a){try{if(this[_0xb2c9('0x2f')](_0x47be3a)){logger[_0xb2c9('0x33')](_0xb2c9('0x43'),_0x47be3a[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x47be3a,{'showHidden':![],'depth':null}));if(this['channels'][_0x47be3a[_0xb2c9('0x30')]]){return;}if(_0x47be3a[_0xb2c9('0x3a')]==='OutgoingSpoolFailed'){return;}if(_0x47be3a[_0xb2c9('0x30')]!==_0x47be3a[_0xb2c9('0x35')]&&!this[_0xb2c9('0x44')][_0x47be3a[_0xb2c9('0x35')]]){return;}logger[_0xb2c9('0x26')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x47be3a[_0xb2c9('0x30')],_0x47be3a[_0xb2c9('0x38')],_0x47be3a[_0xb2c9('0x45')]);this['channels'][_0x47be3a[_0xb2c9('0x30')]]=new Channel();this[_0xb2c9('0x11')][_0x47be3a[_0xb2c9('0x30')]][_0xb2c9('0x46')]=moment()[_0xb2c9('0x3e')](_0xb2c9('0x47'));this[_0xb2c9('0x11')][_0x47be3a['uniqueid']][_0xb2c9('0x48')]=dispositions[_['toNumber'](_0x47be3a[_0xb2c9('0x49')])];_[_0xb2c9('0x36')](this[_0xb2c9('0x11')][_0x47be3a[_0xb2c9('0x30')]],_[_0xb2c9('0x37')](_0x47be3a,_['keys'](this[_0xb2c9('0x11')][_0x47be3a[_0xb2c9('0x30')]])));if(_0x47be3a[_0xb2c9('0x38')]==='from-sip'){var _0x31d262=this[_0xb2c9('0x12')][_0x47be3a[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]];if(_0x31d262&&typeof _0x31d262[_0xb2c9('0x3d')]===_0xb2c9('0x4a')){_0x31d262[_0xb2c9('0x3d')]=_0x47be3a['exten'];logger[_0xb2c9('0x33')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x47be3a[_0xb2c9('0x30')],util[_0xb2c9('0x2b')]({'id':_0x31d262['id'],'destaccountcode':_0x31d262[_0xb2c9('0x41')],'destconnectedlinenum':_0x47be3a[_0xb2c9('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xb2c9('0x3e')](_0xb2c9('0x3f'),_0x31d262['name']),_0xb2c9('0x40'),{'id':_0x31d262['id'],'destaccountcode':_0x31d262[_0xb2c9('0x41')],'destconnectedlinenum':_0x47be3a[_0xb2c9('0x45')]});}}}}catch(_0x10c0ff){logger['error'](_0xb2c9('0x4b'),_0x47be3a['uniqueid'],util['inspect'](_0x10c0ff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x14')]=function(_0x8c4b96){try{if(this[_0xb2c9('0x2f')](_0x8c4b96)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x8c4b96[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x8c4b96,{'showHidden':![],'depth':null}));if(_0x8c4b96[_0xb2c9('0x3a')]===_0xb2c9('0x4c')||_0x8c4b96[_0xb2c9('0x45')]==='h')return;if(_0x8c4b96[_0xb2c9('0x30')]===_0x8c4b96[_0xb2c9('0x35')]||this[_0xb2c9('0x44')][_0x8c4b96[_0xb2c9('0x35')]]){_0x8c4b96['application']=_0x8c4b96[_0xb2c9('0x4d')]?_0x8c4b96[_0xb2c9('0x4d')][_0xb2c9('0x4e')]():undefined;_0x8c4b96[_0xb2c9('0x4f')]=_0x8c4b96['appdata']||_0x8c4b96[_0xb2c9('0x4f')];if(_0x8c4b96[_0xb2c9('0x50')]&&_0x8c4b96[_0xb2c9('0x4d')]!==_0xb2c9('0x7')){_0x8c4b96['applicationdata']=_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x4e')]();}logger[_0xb2c9('0x26')](_0xb2c9('0x51'),_0x8c4b96[_0xb2c9('0x30')],_0x8c4b96['application'],_0x8c4b96[_0xb2c9('0x4f')]);if(_[_0xb2c9('0x2d')](this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]])){this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]]=new Channel();this[_0xb2c9('0x11')][_0x8c4b96['uniqueid']][_0xb2c9('0x46')]=_0x8c4b96[_0xb2c9('0x52')]?moment()[_0xb2c9('0x53')](moment['duration'](_0x8c4b96[_0xb2c9('0x52')])[_0xb2c9('0x54')](),'seconds')[_0xb2c9('0x3e')](_0xb2c9('0x47')):moment()[_0xb2c9('0x3e')](_0xb2c9('0x47'));this[_0xb2c9('0x11')][_0x8c4b96['uniqueid']][_0xb2c9('0x48')]='NO\x20ANSWER';}_[_0xb2c9('0x36')](this[_0xb2c9('0x11')][_0x8c4b96['uniqueid']],_[_0xb2c9('0x37')](_0x8c4b96,_[_0xb2c9('0x55')](this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]])));if(_[_0xb2c9('0x56')](applications,_0x8c4b96[_0xb2c9('0x4d')])){this['channels'][_0x8c4b96['uniqueid']][_0xb2c9('0x57')]=_0x8c4b96[_0xb2c9('0x4d')];this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]][_0xb2c9('0x58')]=_0x8c4b96[_0xb2c9('0x4f')];if(_0x8c4b96[_0xb2c9('0x4d')]===_0xb2c9('0x6')&&_[_0xb2c9('0x59')](_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x4e')](),_0xb2c9('0x5a'))){var _0x25ad90=_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x3b')]('=');var _0x2f8fe1=_0x25ad90[0x0][_0xb2c9('0x4e')]()[_0xb2c9('0x5b')](/cdr\((.*)\)/);if(_0x2f8fe1){if(_0x2f8fe1[0x1]===_0xb2c9('0x5c')&&!_[_0xb2c9('0x5d')](this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]][_0x2f8fe1[0x1]]))return;this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]][_0x2f8fe1[0x1]]=_0x25ad90[0x1];}}else if(_0x8c4b96[_0xb2c9('0x4d')]===_0xb2c9('0x7')){this['channels'][_0x8c4b96['uniqueid']][_0xb2c9('0x7')]=_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x3b')](',')[0x0];}}}}}catch(_0x561bb1){logger[_0xb2c9('0x29')](_0xb2c9('0x5e'),_0x8c4b96[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x561bb1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')]['syncNewState']=function(_0x305f13){try{if(this['isNotNull'](_0x305f13)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x305f13[_0xb2c9('0x30')],_0x305f13[_0xb2c9('0x35')],_0x305f13['calleridname'],_0x305f13['calleridnum']);logger[_0xb2c9('0x33')](_0xb2c9('0x5f'),_0x305f13[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x305f13,{'showHidden':![],'depth':null}));if(_0x305f13['channelstate']!=='6')return;var _0x208356=this['agents'][_0x305f13[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]];if(_0x305f13[_0xb2c9('0x30')]!==_0x305f13[_0xb2c9('0x35')]){var _0x4b0793=moment();if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]]){if(!this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x60')]){this['channels'][_0x305f13[_0xb2c9('0x35')]]['answered']=!![];this[_0xb2c9('0x11')][_0x305f13['linkedid']][_0xb2c9('0x61')]=_0x4b0793[_0xb2c9('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]]['starttime']){this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x62')]=_0x4b0793[_0xb2c9('0x63')](this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x46')],'seconds');}}this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x35')]=_0x305f13[_0xb2c9('0x30')];if(_0x305f13[_0xb2c9('0x32')]!==_0xb2c9('0x3c')){this['channels'][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x64')]=_0x305f13[_0xb2c9('0x32')];}this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x65')]=_0x305f13[_0xb2c9('0x31')];this['channels'][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x66')]=_0x305f13[_0xb2c9('0x3a')];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]]['disposition']=dispositions[_[_0xb2c9('0x67')](_0x305f13[_0xb2c9('0x49')])];if(_0x208356){this[_0xb2c9('0x11')][_0x305f13['linkedid']]['UserId']=_0x208356['id'];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x68')]=_0x208356[_0xb2c9('0x69')];}}if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]]){if(!this['channels'][_0x305f13['uniqueid']][_0xb2c9('0x60')]){this['channels'][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x60')]=!![];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x61')]=_0x4b0793[_0xb2c9('0x3e')](_0xb2c9('0x47'));if(this['channels'][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x46')]){this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x62')]=_0x4b0793[_0xb2c9('0x63')](this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x46')],_0xb2c9('0x54'));}}if(_0x305f13['calleridnum']!==_0xb2c9('0x3c')){this[_0xb2c9('0x11')][_0x305f13['uniqueid']][_0xb2c9('0x64')]=_0x305f13[_0xb2c9('0x32')];}this[_0xb2c9('0x11')][_0x305f13['uniqueid']][_0xb2c9('0x65')]=_0x305f13[_0xb2c9('0x31')];this['channels'][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x66')]=_0x305f13[_0xb2c9('0x3a')];this[_0xb2c9('0x11')][_0x305f13['uniqueid']]['disposition']=dispositions[_[_0xb2c9('0x67')](_0x305f13[_0xb2c9('0x49')])];}}else{if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]]){if(_0x208356){this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x6a')]=_0x208356['id'];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x68')]=_0x208356[_0xb2c9('0x69')];}}}if(_0x305f13[_0xb2c9('0x38')]==='from-sip'){if(_0x208356){_0x208356[_0xb2c9('0x3d')]=_0x305f13[_0xb2c9('0x45')];var _0x5699a7;if(this[_0xb2c9('0x11')][_0x305f13['uniqueid']]){_0x5699a7=this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]]['queue'];}else if(this['channels'][_0x305f13['linkedid']]){_0x5699a7=this[_0xb2c9('0x11')][_0x305f13['linkedid']]['queue'];}_0x208356[_0xb2c9('0x7')]=_0x5699a7;var _0x475bc5={'id':_0x208356['id'],'name':_0x208356[_0xb2c9('0x69')],'agentconnected':!![],'destaccountcode':_0x208356[_0xb2c9('0x41')],'destconnectedlinenum':_0x305f13[_0xb2c9('0x45')],'queue':_0x5699a7||undefined,'uniqueid':_0x305f13[_0xb2c9('0x35')]};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x305f13[_0xb2c9('0x30')],util['inspect'](_0x475bc5,{'showHidden':![],'depth':null}));this[_0xb2c9('0x2e')](util[_0xb2c9('0x3e')](_0xb2c9('0x3f'),_0x208356[_0xb2c9('0x69')]),_0xb2c9('0x40'),_0x475bc5);}}}}catch(_0x4ee72f){logger['error']('[%s][voiceCallReport][newstate]',_0x305f13['uniqueid'],util[_0xb2c9('0x2b')](_0x4ee72f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x6b')]=function(_0x883918,_0x3f131a){try{if(this[_0xb2c9('0x11')][_0x883918]){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x883918,_0x3f131a);this[_0xb2c9('0x11')][_0x883918]['monitor']=!![];if(_[_0xb2c9('0x6c')](_0x3f131a,'.wav49')){_0x3f131a=_0x3f131a[_0xb2c9('0x6d')](_0xb2c9('0x6e'),_0xb2c9('0x6f'));}this[_0xb2c9('0x11')][_0x883918][_0xb2c9('0x70')]=_0x3f131a;var _0x3a90e7=_[_0xb2c9('0x71')](this[_0xb2c9('0x11')][_0x883918][_0xb2c9('0x72')],{'filename':_0x3f131a});if(_[_0xb2c9('0x5d')](_0x3a90e7)){this[_0xb2c9('0x11')][_0x883918][_0xb2c9('0x72')]['push']({'filename':_0x3f131a,'createdAt':moment()['format'](_0xb2c9('0x47')),'mixmonitorid':'','status':_0xb2c9('0x73')});}}}catch(_0x15e33b){logger[_0xb2c9('0x29')]('[%s][voiceCallReport][mixMonitorFilename]',_0x883918,util['inspect'](_0x15e33b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x1b')]=function(_0xc7b427){try{if(this[_0xb2c9('0x2f')](_0xc7b427)){logger[_0xb2c9('0x33')](_0xb2c9('0x74'),_0xc7b427['uniqueid'],util[_0xb2c9('0x2b')](_0xc7b427,{'showHidden':![],'depth':null}));if(this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]]&&_0xc7b427[_0xb2c9('0x3a')]!=_0xb2c9('0x4c')){if(this[_0xb2c9('0x2f')](_0xc7b427['variable'])){if(this[_0xb2c9('0x2f')](_0xc7b427['variable']['mixmonitor_filename'])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);this['syncMixMonitorFilename'](_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);}else if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x77')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x32')]=_0xc7b427['value'];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x78')])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x79')]=_0xc7b427[_0xb2c9('0x75')];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')]['xmd-cdrtype'])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x5c')]=_0xc7b427[_0xb2c9('0x75')];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x7a')])){logger[_0xb2c9('0x26')](_0xb2c9('0x7b'),_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]['split'](',')[0x0]);this[_0xb2c9('0x11')][_0xc7b427['uniqueid']][_0xb2c9('0x7')]=_0xc7b427[_0xb2c9('0x75')][_0xb2c9('0x3b')](',')[0x0];}else if(this[_0xb2c9('0x2f')](_0xc7b427['variable'][_0xb2c9('0x7c')])){logger[_0xb2c9('0x26')](_0xb2c9('0x7d'),_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x7e')]=_0xc7b427[_0xb2c9('0x75')];}else if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x7f')])){logger[_0xb2c9('0x26')](_0xb2c9('0x80'),_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]]['destination']=_0xc7b427['value'];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x81')])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427['uniqueid']]['calleridpreview']=_0xc7b427[_0xb2c9('0x75')];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x82')])){logger['info'](_0xb2c9('0x83'),_0xc7b427['uniqueid'],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]]['queue']=_0xc7b427[_0xb2c9('0x75')];}else if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x84')])){logger[_0xb2c9('0x26')](_0xb2c9('0x85'),_0xc7b427['uniqueid'],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427['uniqueid']]['sipcalluniqueid']=_0xc7b427[_0xb2c9('0x75')];}}}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x86')])){if(_0xc7b427[_0xb2c9('0x75')]){var _0xe9f693=path[_0xb2c9('0x87')](_0xc7b427[_0xb2c9('0x75')])['name'];logger[_0xb2c9('0x26')](_0xb2c9('0x88'),_0xe9f693,_0xc7b427['value']);this[_0xb2c9('0x6b')](_0xe9f693,_0xc7b427[_0xb2c9('0x75')]);}}else if(this['channels'][_0xc7b427[_0xb2c9('0x35')]]){if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')])){if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x84')])){logger[_0xb2c9('0x26')](_0xb2c9('0x85'),_0xc7b427['linkedid'],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427['linkedid']]['sipcalllinkedid']=_0xc7b427[_0xb2c9('0x75')];}}}}}catch(_0x3e80ad){logger[_0xb2c9('0x29')](_0xb2c9('0x89'),_0xc7b427[_0xb2c9('0x30')],util['inspect'](_0x3e80ad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x1d')]=function(_0x40db00){try{if(this[_0xb2c9('0x2f')](_0x40db00)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x40db00[_0xb2c9('0x30')],util['inspect'](_0x40db00,{'showHidden':![],'depth':null}));if(this[_0xb2c9('0x44')][_0x40db00['linkedid']]){if(this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']]){this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']][_0xb2c9('0x30')]=_0x40db00[_0xb2c9('0x30')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x35')]]['answered']=this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x60')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']][_0xb2c9('0x61')]=this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['answertime'];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]]['linkedid']][_0xb2c9('0x66')]=this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x35')]][_0xb2c9('0x3a')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x35')]][_0xb2c9('0x48')]=this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x48')];this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]=this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']];this['deleteChannelAfterTimeout'](this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x35')]);}else if(this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x30')]]){this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]]['uniqueid']][_0xb2c9('0x30')]=[this[_0xb2c9('0x11')][this['blindTransfers'][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]][_0xb2c9('0x35')],this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['uniqueid']]['linkedid']=this['channels'][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x30')]]['uniqueid']][0x0];this[_0xb2c9('0x11')][this['blindTransfers'][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]]['answered']=this[_0xb2c9('0x11')][_0x40db00['uniqueid']][_0xb2c9('0x60')];this['channels'][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]][_0xb2c9('0x61')]=this['channels'][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x61')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]][_0xb2c9('0x66')]=this['channels'][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['uniqueid']]['channel'];this['channels'][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x30')]][_0xb2c9('0x48')]=this[_0xb2c9('0x11')][_0x40db00['uniqueid']][_0xb2c9('0x48')];this['channels'][_0x40db00['uniqueid']]=this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]];this['deleteChannelAfterTimeout'](this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]]['uniqueid']);}}if(this['channels'][_0x40db00[_0xb2c9('0x30')]]){logger[_0xb2c9('0x26')](_0xb2c9('0x8a'),_0x40db00[_0xb2c9('0x30')],_0x40db00['cause-txt']);var _0x497ccd=moment();this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['endtime']=_0x497ccd[_0xb2c9('0x3e')](_0xb2c9('0x47'));this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x52')]=_0x497ccd[_0xb2c9('0x63')](this['channels'][_0x40db00[_0xb2c9('0x30')]]['starttime'],_0xb2c9('0x54'));if(this['channels'][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x60')]){this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x8b')]=_0x497ccd[_0xb2c9('0x63')](this['channels'][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x61')],_0xb2c9('0x54'));this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['holdtime']=this[_0xb2c9('0x11')][_0x40db00['uniqueid']][_0xb2c9('0x52')]-this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['billableseconds'];}if(_0x40db00[_0xb2c9('0x38')]===_0xb2c9('0x39')){if(this[_0xb2c9('0x12')][_0x40db00['channel'][_0xb2c9('0x3b')]('-')[0x0]]){this['agents'][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]]=_[_0xb2c9('0x8c')](this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]],[_0xb2c9('0x3d')]);logger[_0xb2c9('0x33')](_0xb2c9('0x8d'),_0x40db00[_0xb2c9('0x30')],util['inspect']({'id':this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xb2c9('0x12')][_0x40db00['channel'][_0xb2c9('0x3b')]('-')[0x0]][_0xb2c9('0x41')]},{'showHidden':![],'depth':null}));this[_0xb2c9('0x2e')](util['format'](_0xb2c9('0x3f'),this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]][_0xb2c9('0x69')]),'user:agentcomplete',{'id':this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]][_0xb2c9('0x41')]});for(var _0x353ea0=0x0;_0x353ea0{delete this[_0xb2c9('0x11')][_0x127a42];},_0x4971af);}};module[_0xb2c9('0xbf')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 75fccce..d589395 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 _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 +var _0x076c=['variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','isNotNull','isUndefined','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','info','membername','interface','debug','voice:outbound','voice_outbound_channel:save','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','holdtime','billableseconds','sumBillable','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','outbound','applications'];(function(_0x34c1c5,_0x40a4d3){var _0x33608b=function(_0x2d6cd3){while(--_0x2d6cd3){_0x34c1c5['push'](_0x34c1c5['shift']());}};_0x33608b(++_0x40a4d3);}(_0x076c,0xce));var _0xc076=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x076c[_0x46a3e8];return _0xf1442e;};'use strict';var _=require('lodash');var moment=require(_0xc076('0x0'));var util=require(_0xc076('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xc076('0x2'))('ami');var ami=require('../ami');config[_0xc076('0x3')]=_[_0xc076('0x4')](config[_0xc076('0x3')],{'host':_0xc076('0x5'),'port':0x18eb});var io=require(_0xc076('0x6'))(new Redis(config[_0xc076('0x3')]));function VoiceDialReport(_0x30a953){this[_0xc076('0x7')]=_0x30a953['outboundChannels'];this[_0xc076('0x8')]=_0x30a953[_0xc076('0x8')];this[_0xc076('0x9')]={};this[_0xc076('0xa')]={};ami['on'](_0xc076('0xb'),this[_0xc076('0xc')][_0xc076('0xd')](this));ami['on']('dialend',this[_0xc076('0xe')]['bind'](this));ami['on'](_0xc076('0xf'),this['syncVarSet'][_0xc076('0xd')](this));ami['on']('hangup',this['syncHangup'][_0xc076('0xd')](this));}VoiceDialReport['prototype'][_0xc076('0x10')]=function(_0x2f76e2){return _0x2f76e2!==null&&!_[_0xc076('0x11')](_0x2f76e2);};VoiceDialReport[_0xc076('0x12')][_0xc076('0x13')]=function(_0x35dea0,_0x3ae08e,_0x735189){io['to'](_0x35dea0)[_0xc076('0x13')](_0x3ae08e,_0x735189);};VoiceDialReport[_0xc076('0x12')][_0xc076('0xc')]=function(_0x4d8b75){try{if(this[_0xc076('0x10')](_0x4d8b75)){logger['debug'](_0xc076('0x14'),_0x4d8b75[_0xc076('0x15')],util[_0xc076('0x16')](_0x4d8b75,{'showHidden':![],'depth':null}));if(this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]]){_[_0xc076('0x17')](this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]],{'starttime':moment()[_0xc076('0x18')](_0xc076('0x19')),'lastevent':_0xc076('0x1a'),'interface':_0x4d8b75[_0xc076('0x1b')]['substring'](0x0,_0x4d8b75[_0xc076('0x1b')][_0xc076('0x1c')]('-')),'membername':_0x4d8b75[_0xc076('0x1b')][_0xc076('0x1d')](_0x4d8b75['channel'][_0xc076('0x1c')]('/')+0x1,_0x4d8b75[_0xc076('0x1b')][_0xc076('0x1c')]('-'))},_[_0xc076('0x1e')](_0x4d8b75,['event','privilege']));logger[_0xc076('0x1f')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4d8b75[_0xc076('0x15')],this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]][_0xc076('0x20')],this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]][_0xc076('0x21')]);logger[_0xc076('0x22')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4d8b75[_0xc076('0x15')],util['inspect'](this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]],{'showHidden':![],'depth':null}));if(this[_0xc076('0x9')][_0x4d8b75[_0xc076('0x15')]])_[_0xc076('0x17')](this[_0xc076('0x7')][_0x4d8b75['uniqueid']],this[_0xc076('0x9')][_0x4d8b75['uniqueid']]);this[_0xc076('0x13')](_0xc076('0x23'),_0xc076('0x24'),this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]]);logger[_0xc076('0x22')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4d8b75['uniqueid'],util[_0xc076('0x16')](this[_0xc076('0x7')][_0x4d8b75['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')]('custom:dialbegin',this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]]);}}}catch(_0x4dfc92){logger[_0xc076('0x25')]('[%s][voiceDialReport][dialbegin]',_0x4d8b75[_0xc076('0x15')],util[_0xc076('0x16')](_0x4dfc92,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')][_0xc076('0xe')]=function(_0x41df55){try{if(this[_0xc076('0x10')](_0x41df55)){logger[_0xc076('0x22')]('[%s][voiceDialReport][dialend]\x20event:',_0x41df55['uniqueid'],util[_0xc076('0x16')](_0x41df55,{'showHidden':![],'depth':null}));if(this['channels'][_0x41df55[_0xc076('0x15')]]){this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x26')]=_0x41df55[_0xc076('0x26')];if(_0x41df55[_0xc076('0x26')]===_0xc076('0x27')){this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x28')]=_0x41df55[_0xc076('0x28')];this['channels'][_0x41df55[_0xc076('0x15')]][_0xc076('0x29')]=_0x41df55[_0xc076('0x29')];this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x2a')]=moment()['format'](_0xc076('0x19'));this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x2b')]='connect';logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x41df55[_0xc076('0x15')],_0x41df55['channel'][_0xc076('0x1d')](_0x41df55['channel'][_0xc076('0x1c')]('/')+0x1,_0x41df55[_0xc076('0x1b')][_0xc076('0x1c')]('-')));logger[_0xc076('0x22')](_0xc076('0x2c'),_0x41df55[_0xc076('0x15')],util[_0xc076('0x16')](this['channels'][_0x41df55[_0xc076('0x15')]],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')](_0xc076('0x2d'),this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]]);}logger[_0xc076('0x22')](_0xc076('0x2e'),_0x41df55[_0xc076('0x15')],util[_0xc076('0x16')](this['channels'][_0x41df55[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this[_0xc076('0x13')](_0xc076('0x23'),'voice_outbound_channel:save',this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]]);}}}catch(_0x3c580f){logger['error']('[%s][voiceDialReport][dialend]',_0x41df55[_0xc076('0x15')],util[_0xc076('0x16')](_0x3c580f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')]['syncVarSet']=function(_0x4d755f){try{if(this[_0xc076('0x10')](_0x4d755f)){logger[_0xc076('0x22')](_0xc076('0x2f'),_0x4d755f[_0xc076('0x15')],util[_0xc076('0x16')](_0x4d755f,{'showHidden':![],'depth':null}));this[_0xc076('0x30')](_0x4d755f['uniqueid'],_[_0xc076('0x31')](_0x4d755f[_0xc076('0x32')])[0x0],_0x4d755f[_0xc076('0x33')]);if(this['isNotNull'](_0x4d755f[_0xc076('0x32')])&&this[_0xc076('0x10')](_0x4d755f[_0xc076('0x32')][_0xc076('0x34')])){if(_[_0xc076('0x11')](this[_0xc076('0x7')][_0x4d755f['uniqueid']])){this['channels'][_0x4d755f[_0xc076('0x15')]]={'routeId':_0x4d755f[_0xc076('0x33')],'variables':this[_0xc076('0xa')][_0x4d755f[_0xc076('0x15')]],'motionChannel':_0xc076('0x35')};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x4d755f[_0xc076('0x15')],_0x4d755f[_0xc076('0x32')]['outboundrouteid'],_[_0xc076('0x31')](_0x4d755f[_0xc076('0x32')])[0x0],_0x4d755f[_0xc076('0x33')]);logger['debug'](_0xc076('0x36'),_0x4d755f[_0xc076('0x15')],util['inspect'](this['channels'][_0x4d755f[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this[_0xc076('0x13')](_0xc076('0x23'),_0xc076('0x24'),this['channels'][_0x4d755f[_0xc076('0x15')]]);}}}}catch(_0x33dc5f){logger[_0xc076('0x25')](_0xc076('0x37'),_0x4d755f['uniqueid'],util[_0xc076('0x16')](_0x33dc5f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')][_0xc076('0x30')]=function(_0x9e9eec,_0x5e7d92,_0x315db1){var _0x1fe081=[_0xc076('0x38'),_0xc076('0x39'),_0xc076('0x3a'),_0xc076('0x3b'),_0xc076('0x3c'),_0xc076('0x3d'),_0xc076('0x3e'),_0xc076('0x3f'),_0xc076('0x40'),_0xc076('0x41'),_0xc076('0x42'),_0xc076('0x43'),_0xc076('0x44'),_0xc076('0x45'),_0xc076('0x46'),'memberlastcall',_0xc076('0x20'),'memberpenalty','memberrealtime'];if(!_[_0xc076('0x47')](_0x5e7d92)&&!_[_0xc076('0x48')](_0x1fe081,_0x5e7d92)){if(_[_0xc076('0x11')](this[_0xc076('0xa')][_0x9e9eec])){this[_0xc076('0xa')][_0x9e9eec]={};}this[_0xc076('0xa')][_0x9e9eec][_0x5e7d92]=_0x315db1;}};VoiceDialReport[_0xc076('0x12')][_0xc076('0x49')]=function(_0x3f9919){try{if(this[_0xc076('0x10')](_0x3f9919)){logger[_0xc076('0x22')](_0xc076('0x4a'),_0x3f9919[_0xc076('0x15')],util['inspect'](_0x3f9919,{'showHidden':![],'depth':null}));if(this['channels'][_0x3f9919[_0xc076('0x15')]]){logger[_0xc076('0x1f')](_0xc076('0x4b'),_0x3f9919[_0xc076('0x15')],_0x3f9919[_0xc076('0x4c')]);this[_0xc076('0x7')][_0x3f9919['uniqueid']][_0xc076('0x4d')]=moment()['format'](_0xc076('0x19'));this['channels'][_0x3f9919['uniqueid']][_0xc076('0x4e')]=moment(this['channels'][_0x3f9919[_0xc076('0x15')]][_0xc076('0x4d')])[_0xc076('0x4f')](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x50')],_0xc076('0x51'));this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x2b')]=_0xc076('0x52');this['outbound'][_0xc076('0x53')]+=0x1;if(this[_0xc076('0x7')][_0x3f9919['uniqueid']]['answertime']){this[_0xc076('0x8')]['answered']+=0x1;this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x54')]=moment(this['channels'][_0x3f9919['uniqueid']][_0xc076('0x2a')])[_0xc076('0x4f')](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x50')],_0xc076('0x51'));this[_0xc076('0x7')][_0x3f9919['uniqueid']][_0xc076('0x55')]=moment(this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x4d')])['diff'](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x2a')],_0xc076('0x51'));this[_0xc076('0x8')]['sumHoldTime']+=this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x54')]||0x0;this[_0xc076('0x8')][_0xc076('0x56')]+=this[_0xc076('0x7')][_0x3f9919['uniqueid']][_0xc076('0x55')];}this['outbound']['sumDuration']+=this['channels'][_0x3f9919[_0xc076('0x15')]][_0xc076('0x4e')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x3f9919[_0xc076('0x15')],util['inspect'](this[_0xc076('0x7')][_0x3f9919['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')](_0xc076('0x57'),this['channels'][_0x3f9919[_0xc076('0x15')]]);logger[_0xc076('0x22')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x3f9919[_0xc076('0x15')],util[_0xc076('0x16')](this['channels'][_0x3f9919[_0xc076('0x15')]],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')](_0xc076('0x58'),this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]]);logger[_0xc076('0x22')](_0xc076('0x59'),_0x3f9919[_0xc076('0x15')],util['inspect'](this['channels'][_0x3f9919[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this['emit'](_0xc076('0x23'),_0xc076('0x5a'),this['outbound']);logger[_0xc076('0x1f')](_0xc076('0x5b'),JSON[_0xc076('0x5c')](this['channels'][_0x3f9919[_0xc076('0x15')]]));logger[_0xc076('0x22')](_0xc076('0x5d'),_0x3f9919[_0xc076('0x15')],util[_0xc076('0x16')](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this[_0xc076('0x13')](_0xc076('0x23'),'voice_outbound_channel:remove',this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]]);this[_0xc076('0x5e')](_0x3f9919[_0xc076('0x15')]);}else if(this[_0xc076('0x7')][_0x3f9919[_0xc076('0x5f')]]){this[_0xc076('0x7')][_0x3f9919[_0xc076('0x5f')]][_0xc076('0x15')]=this[_0xc076('0x7')][_0x3f9919[_0xc076('0x5f')]][_0xc076('0x60')];}if(this['variables'][_0x3f9919[_0xc076('0x15')]]){delete this[_0xc076('0xa')][_0x3f9919[_0xc076('0x15')]];}}}catch(_0x2d8887){logger[_0xc076('0x25')](_0xc076('0x61'),_0x3f9919[_0xc076('0x15')],util['inspect'](_0x2d8887,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')][_0xc076('0x62')]=function(_0x4ffd18){try{if(this[_0xc076('0x10')](_0x4ffd18)){logger[_0xc076('0x22')](_0xc076('0x63'),_0x4ffd18[_0xc076('0x15')],util[_0xc076('0x16')](_0x4ffd18,{'showHidden':![],'depth':null}));if(_0x4ffd18[_0xc076('0x64')][_0xc076('0x65')]()==='set'){_0x4ffd18[_0xc076('0x66')]=(_0x4ffd18[_0xc076('0x67')]||_0x4ffd18[_0xc076('0x66')])['toLowerCase']();if(_['startsWith'](_0x4ffd18[_0xc076('0x66')],'cdr(')){if(_['isUndefined'](this[_0xc076('0x9')][_0x4ffd18['uniqueid']]))this[_0xc076('0x9')][_0x4ffd18[_0xc076('0x15')]]={};logger['info']('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x4ffd18['uniqueid'],_0x4ffd18[_0xc076('0x64')],_0x4ffd18[_0xc076('0x66')]);var _0x416448=_0x4ffd18[_0xc076('0x66')][_0xc076('0x68')]('=');var _0x3f906a=_0x416448[0x0][_0xc076('0x69')](/cdr\((.*)\)/);if(_0x3f906a)this[_0xc076('0x9')][_0x4ffd18[_0xc076('0x15')]][_0x3f906a[0x1]]=_0x416448[0x1];}}}}catch(_0x39b4f4){logger[_0xc076('0x25')](_0xc076('0x6a'),_0x4ffd18[_0xc076('0x15')],util[_0xc076('0x16')](_0x39b4f4,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xc076('0x5e')]=function(_0x2d74a7,_0x2e8aa2=0x2710){if(this[_0xc076('0x7')][_0x2d74a7]){setTimeout(()=>{delete this[_0xc076('0x7')][_0x2d74a7];},_0x2e8aa2);}};module[_0xc076('0x6b')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 66e0b85..e2020a1 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 _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 +var _0x6fdc=['queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','originated','isEmpty','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','switch','isNil','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','agents','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','Action','queues','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','summaryEvent','createReport','compareToInboundQueue','assign','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent','debug','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','lastevent','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','length','sumHoldTime','diff','sumDuration','milliseconds','total','sumBillable','unmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','transferid','handleHangup','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transfereeuniqueid','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','secondtransfererexten','[%s][voiceQueueReport][attendedtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','[%s][voiceQueueReport][newexten]','exports','util','ioredis','../../../config/environment','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','channels','queueChannels','voiceQueues','campaigns','summary','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','syncQueueMember'];(function(_0x5f53ab,_0x324327){var _0x116166=function(_0x2e8e6a){while(--_0x2e8e6a){_0x5f53ab['push'](_0x5f53ab['shift']());}};_0x116166(++_0x324327);}(_0x6fdc,0xd7));var _0xc6fd=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x6fdc[_0x11f249];return _0x5c3656;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xc6fd('0x0'));var Redis=require(_0xc6fd('0x1'));var config=require(_0xc6fd('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0xc6fd('0x3'));var QueueReport=require(_0xc6fd('0x4'));var VoiceQueueSummary=require(_0xc6fd('0x5'));config[_0xc6fd('0x6')]=_[_0xc6fd('0x7')](config[_0xc6fd('0x6')],{'host':_0xc6fd('0x8'),'port':0x18eb});var io=require(_0xc6fd('0x9'))(new Redis(config[_0xc6fd('0x6')]));var Sequence=function(){};Sequence[_0xc6fd('0xa')][_0xc6fd('0xb')]=function(_0x25d23c){this['tail']=this['tail']?this[_0xc6fd('0xc')][_0xc6fd('0xd')](_0x25d23c):_0x25d23c();};function VoiceQueueReport(_0x336a99){this[_0xc6fd('0xe')]=new Sequence();this[_0xc6fd('0xf')]={};this[_0xc6fd('0x10')]=_0x336a99;this['agents']=_0x336a99['agents'];this[_0xc6fd('0x11')]=_0x336a99[_0xc6fd('0x12')];this[_0xc6fd('0x13')]=_0x336a99[_0xc6fd('0x13')];this[_0xc6fd('0x14')]=_0x336a99['campaigns'];this[_0xc6fd('0x15')]=initializeSummary();this['variables']={};ami['on'](_0xc6fd('0x16'),this[_0xc6fd('0x17')]['bind'](this));ami['on'](_0xc6fd('0x18'),this[_0xc6fd('0x19')][_0xc6fd('0x1a')](this));ami['on']('queuemember',this[_0xc6fd('0x1b')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x1c'),this['syncQueueStatusComplete'][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x1d'),this[_0xc6fd('0x1e')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x1f'),this[_0xc6fd('0x20')][_0xc6fd('0x1a')](this));ami['on']('queuecallerleave',this[_0xc6fd('0x21')][_0xc6fd('0x1a')](this));ami['on']('agentcomplete',this[_0xc6fd('0x22')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x23'),this[_0xc6fd('0x24')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x25'),this[_0xc6fd('0x26')][_0xc6fd('0x1a')](this));ami['on']('hangup',this[_0xc6fd('0x27')][_0xc6fd('0x1a')](this));ami['on']('fullybooted',this[_0xc6fd('0x28')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x29'),this[_0xc6fd('0x2a')]['bind'](this));ami['on']('musiconholdstop',this[_0xc6fd('0x2b')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x2c'),this[_0xc6fd('0x2d')][_0xc6fd('0x1a')](this));ami['on']('blindtransfer',this[_0xc6fd('0x2e')][_0xc6fd('0x1a')](this));this[_0xc6fd('0x2f')]();this[_0xc6fd('0x30')]();}function clearChannels(_0x3d3f87){if(!_['isEmpty'](_0x3d3f87)){for(var _0x583c5d in _0x3d3f87){if(_0x3d3f87[_0xc6fd('0x31')](_0x583c5d)){delete _0x3d3f87[_0x583c5d];}}}}function clearCampaigns(_0x3341d2){if(!_['isEmpty'](_0x3341d2)){for(var _0x425bc2 in _0x3341d2){if(_0x3341d2[_0xc6fd('0x31')](_0x425bc2)){_0x3341d2[_0x425bc2][_0xc6fd('0x32')]=0x0;}}}}function clearVoiceQueues(_0x954132){if(!_[_0xc6fd('0x33')](_0x954132)){for(var _0x19ffb7 in _0x954132){if(_0x954132[_0xc6fd('0x31')](_0x19ffb7)){_0x954132[_0x19ffb7][_0xc6fd('0x32')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x34')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x35')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x36')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x37')]=!![];}}}}function clearAgentBooked(_0x5118aa){if(!_[_0xc6fd('0x33')](_0x5118aa)){for(var _0x38ab0d in _0x5118aa){if(_0x5118aa[_0xc6fd('0x31')](_0x38ab0d)){_0x5118aa[_0x38ab0d][_0xc6fd('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x397088){return _0x397088[_0xc6fd('0x39')]||_0x397088[_0xc6fd('0x1f')]||_0x397088[_0xc6fd('0x3a')];}VoiceQueueReport[_0xc6fd('0xa')]['clearZombieChannels']=function(){var _0x43b18c=this;for(var _0x2c9712 in this[_0xc6fd('0x11')]){if(this[_0xc6fd('0x11')][_0xc6fd('0x31')](_0x2c9712)&&!this[_0xc6fd('0x11')][_0x2c9712][_0xc6fd('0x3b')]){this[_0xc6fd('0xe')][_0xc6fd('0xb')](function(){if(!_[_0xc6fd('0x3c')](_0x43b18c[_0xc6fd('0x11')][_0x2c9712])){return ami['Action']({'action':'status','channel':_0x43b18c[_0xc6fd('0x11')][_0x2c9712]['channel']})[_0xc6fd('0x3d')](function(_0x1523be){if(_0x1523be[_0xc6fd('0x3e')]===_0xc6fd('0x3f')){setTimeout(function(){if(_0x43b18c[_0xc6fd('0x11')][_0x2c9712]){delete _0x43b18c[_0xc6fd('0x11')][_0x2c9712];logger[_0xc6fd('0x40')](_0xc6fd('0x41'),_0x2c9712,util[_0xc6fd('0x42')](_0x1523be,{'showHidden':![],'depth':null}));}if(_0x43b18c[_0xc6fd('0xf')][_0x2c9712]){delete _0x43b18c[_0xc6fd('0xf')][_0x2c9712];logger['error'](_0xc6fd('0x43'),_0x2c9712,util[_0xc6fd('0x42')](_0x1523be,{'showHidden':![],'depth':null}));}if(_0x43b18c[_0xc6fd('0x44')][_0x2c9712]){delete _0x43b18c['variables'][_0x2c9712];logger[_0xc6fd('0x40')](_0xc6fd('0x45'),_0x2c9712,util['inspect'](_0x1523be,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x28')]=function(){logger[_0xc6fd('0x40')](_0xc6fd('0x46'));clearChannels(this[_0xc6fd('0x11')]);this[_0xc6fd('0x47')](this['queueReports']);clearAgentBooked(this[_0xc6fd('0x48')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xc6fd('0x14')]);this[_0xc6fd('0x15')]=initializeSummary();};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x47')]=function(_0x4744b6){var _0x761d73=this;if(!_[_0xc6fd('0x33')](_0x4744b6)){for(var _0x4e8ef6 in _0x4744b6){if(_0x4744b6[_0xc6fd('0x31')](_0x4e8ef6)){_0x761d73[_0xc6fd('0x49')](_0x4744b6[_0x4e8ef6],'clearqueuereport');delete _0x4744b6[_0x4e8ef6];}}}};VoiceQueueReport['prototype'][_0xc6fd('0x4a')]=function(_0x261abd,_0x238a2b,_0x190ba0){io['to'](_0x261abd)[_0xc6fd('0x4a')](_0x238a2b,_0x190ba0);};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x4b')]=function(_0x4231ce,_0x53d155){logger['debug'](_0xc6fd('0x4c')+_0x53d155+_0xc6fd('0x4d'),_0x4231ce[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x4231ce,{'showHidden':![],'depth':null}));this[_0xc6fd('0x4a')](util[_0xc6fd('0x4f')](_0xc6fd('0x50'),_0x4231ce[_0xc6fd('0x51')]),_0xc6fd('0x52'),_0x4231ce);io['emit']('voice_queue_presence:save',_0x4231ce);};VoiceQueueReport['prototype'][_0xc6fd('0x49')]=function(_0xb14baa,_0x4dc380){logger['debug'](_0xc6fd('0x4c')+_0x4dc380+_0xc6fd('0x53'),_0xb14baa[_0xc6fd('0x4e')],util['inspect'](_0xb14baa,{'showHidden':![],'depth':null}));if(_0xb14baa[_0xc6fd('0x54')]===_0xc6fd('0x55')){return;}this[_0xc6fd('0x4a')](util[_0xc6fd('0x4f')](_0xc6fd('0x50'),_0xb14baa['queue']),_0xc6fd('0x56'),_0xb14baa);io[_0xc6fd('0x4a')](_0xc6fd('0x57'),_0xb14baa);};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x58')]=function(_0x463bcf){if(_0x463bcf[_0xc6fd('0x59')]===_0xc6fd('0x5a')){logger['debug'](_0xc6fd('0x5b'),util[_0xc6fd('0x42')](_0x463bcf,{'showHidden':![],'depth':null}));this['emit'](util[_0xc6fd('0x4f')]('voice:queue:%s',_0x463bcf[_0xc6fd('0x5c')]),_0xc6fd('0x5d'),_0x463bcf);}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x5e')]=function(_0xae8771){return _0xae8771!==null&&!_[_0xc6fd('0x5f')](_0xae8771);};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x30')]=function(){var _0x51f5ca=this;setInterval(function(){_0x51f5ca[_0xc6fd('0x60')]();ami[_0xc6fd('0x61')]({'action':_0xc6fd('0x62')})[_0xc6fd('0x3d')](function(_0x264add){logger[_0xc6fd('0x40')](_0xc6fd('0x63'),util[_0xc6fd('0x42')](_0x264add,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xc6fd('0xa')]['loopQueueSummary']=function(){var _0x49bf71=this;setInterval(function(){if(!_0x49bf71[_0xc6fd('0x15')][_0xc6fd('0x64')]){return ami[_0xc6fd('0x61')]({'action':'queuesummary'})[_0xc6fd('0x65')](function(_0x57374f){_0x49bf71[_0xc6fd('0x15')]['id']=_0x57374f[_0xc6fd('0x66')];_0x49bf71[_0xc6fd('0x15')]['isRunning']=!![];_0x49bf71[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x57374f['actionid']]={};})[_0xc6fd('0x3d')](function(_0x427b32){logger[_0xc6fd('0x40')](_0xc6fd('0x68'),util[_0xc6fd('0x42')](_0x427b32,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xc6fd('0xa')]['createQueueSummaryReport']=function(_0x468f99,_0x1f9f3d){var _0x1ed0c1;if(this['summary']&&this[_0xc6fd('0x15')][_0xc6fd('0x62')]&&this[_0xc6fd('0x15')][_0xc6fd('0x62')][_0x468f99['name']]){_0x1ed0c1=this[_0xc6fd('0x15')][_0xc6fd('0x62')][_0x468f99[_0xc6fd('0x5c')]][_0xc6fd('0x69')];}var _0x35a2b6=new VoiceQueueSummary(_0x468f99);return _0x35a2b6[_0xc6fd('0x6a')](_0x1f9f3d['agents'],this[_0xc6fd('0x48')],_0x1ed0c1,this[_0xc6fd('0x10')][_0xc6fd('0x11')]);};VoiceQueueReport[_0xc6fd('0xa')]['handleInboundQueueSummaryReport']=function(_0x58fe43,_0x27bbb1){var _0x52246c=this['createQueueSummaryReport'](_0x58fe43,_0x27bbb1);var _0x1c7849=![];_0x1c7849=_0x52246c[_0xc6fd('0x6b')](_0x58fe43);if(_0x1c7849){Object[_0xc6fd('0x6c')](_0x58fe43,_0x52246c);this[_0xc6fd('0x10')][_0xc6fd('0x13')][_0x58fe43[_0xc6fd('0x5c')]]=_0x58fe43;this['emitInboundVoiceQueueSummary'](_0x52246c);}};VoiceQueueReport[_0xc6fd('0xa')]['syncQueueStatusComplete']=function(_0x7f33a3){var _0x4d2a2a=null;var _0x36e613=this[_0xc6fd('0x15')]['id'];if(this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x36e613]){_0x4d2a2a=this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x36e613][_0x7f33a3[_0xc6fd('0x66')]];}if(!_0x4d2a2a){this['summary']=initializeSummary();return;}var _0x21befd=this[_0xc6fd('0x13')][_0x4d2a2a[_0xc6fd('0x51')]];if(_0x21befd[_0xc6fd('0x59')]===_0xc6fd('0x5a')){this[_0xc6fd('0x6d')](_0x21befd,_0x4d2a2a);}else if(_0x21befd['type']===_0xc6fd('0x6e')){var _0x41f5f9=this['createQueueSummaryReport'](_0x21befd,_0x4d2a2a);ami[_0xc6fd('0x4a')](_0xc6fd('0x6f'),_0x41f5f9);}this[_0xc6fd('0x15')][_0xc6fd('0x70')]-=0x1;var _0x187c95=this[_0xc6fd('0x15')][_0xc6fd('0x70')]>0x0?!![]:![];if(!_0x187c95){return this[_0xc6fd('0x19')](this[_0xc6fd('0x15')][_0xc6fd('0x71')]);}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x1b')]=function(_0x36c7ba){var _0x132248=this[_0xc6fd('0x15')]['id'];if(this['summary'][_0xc6fd('0x67')][_0x132248]&&this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x132248][_0x36c7ba[_0xc6fd('0x66')]]){this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x132248][_0x36c7ba[_0xc6fd('0x66')]]['agents']['push'](_0x36c7ba);}};VoiceQueueReport['prototype'][_0xc6fd('0x17')]=function(_0x17c514){var _0x457bd5=this;try{if(this[_0xc6fd('0x5e')](_0x17c514)&&this[_0xc6fd('0x5e')](_0x17c514['queue'])){logger[_0xc6fd('0x72')](_0xc6fd('0x73'),util[_0xc6fd('0x42')](_0x17c514,{'showHidden':![],'depth':null}));var _0x25d1c8=this['voiceQueues'][_0x17c514[_0xc6fd('0x51')]];if(_0x25d1c8){logger[_0xc6fd('0x72')](_0xc6fd('0x74'),_0x25d1c8[_0xc6fd('0x5c')]);this[_0xc6fd('0x15')]['queues'][_0x25d1c8[_0xc6fd('0x5c')]]={'summaryEvent':_0x17c514};this['summary']['statusRequests']+=0x1;return ami[_0xc6fd('0x61')]({'action':_0xc6fd('0x67'),'queue':_0x25d1c8[_0xc6fd('0x5c')]})[_0xc6fd('0x65')](function(_0x5e9926){if(!_0x457bd5[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x17c514['actionid']]){_0x457bd5['summary']['queuestatus'][_0x17c514[_0xc6fd('0x66')]]={};}_0x457bd5['summary'][_0xc6fd('0x67')][_0x17c514[_0xc6fd('0x66')]][_0x5e9926[_0xc6fd('0x66')]]={'queue':_0x25d1c8['name'],'agents':[]};})[_0xc6fd('0x3d')](function(_0x53d75c){throw _0x53d75c;});}}}catch(_0x2d6eb7){logger[_0xc6fd('0x40')](_0xc6fd('0x68'),util[_0xc6fd('0x42')](_0x2d6eb7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x19')]=function(_0x2e0fa9){if(this[_0xc6fd('0x15')]['statusRequests']>0x0){this[_0xc6fd('0x15')][_0xc6fd('0x71')]=_0x2e0fa9;return;}logger[_0xc6fd('0x72')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xc6fd('0x42')](_0x2e0fa9,{'showHidden':![],'depth':null}));this[_0xc6fd('0x15')]=initializeSummary();ami[_0xc6fd('0x4a')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xc6fd('0xa')]['syncQueueCallerJoin']=function(_0x3c8566){try{if(this[_0xc6fd('0x5e')](_0x3c8566)){logger[_0xc6fd('0x72')](_0xc6fd('0x75'),_0x3c8566[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x3c8566,{'showHidden':![],'depth':null}));if(_[_0xc6fd('0x5f')](this[_0xc6fd('0xf')][_0x3c8566['uniqueid']])){this['queueReports'][_0x3c8566[_0xc6fd('0x4e')]]=[];}if(_['isUndefined'](this[_0xc6fd('0x11')][_0x3c8566['uniqueid']])){this[_0xc6fd('0x11')][_0x3c8566[_0xc6fd('0x4e')]]={};}var _0x1d76b8=new QueueReport();_0x1d76b8['queue']=_0x3c8566[_0xc6fd('0x51')];_0x1d76b8['type']=this[_0xc6fd('0x13')][_0x1d76b8[_0xc6fd('0x51')]]&&this[_0xc6fd('0x13')][_0x1d76b8[_0xc6fd('0x51')]][_0xc6fd('0x59')]?this[_0xc6fd('0x13')][_0x1d76b8['queue']][_0xc6fd('0x59')]||'inbound':'inbound';_0x1d76b8[_0xc6fd('0x76')]=moment()[_0xc6fd('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d76b8[_0xc6fd('0x77')]=_0x3c8566[_0xc6fd('0x77')];_0x1d76b8['count']=_0x3c8566['count'];_0x1d76b8[_0xc6fd('0x4e')]=_0x3c8566[_0xc6fd('0x4e')];logger[_0xc6fd('0x78')](_0xc6fd('0x79'),_0x1d76b8[_0xc6fd('0x51')],_0x1d76b8[_0xc6fd('0x59')]);Object['assign'](_0x1d76b8,_[_0xc6fd('0x7a')](_0x3c8566,_[_0xc6fd('0x7b')](_0x1d76b8)));this[_0xc6fd('0xf')][_0x3c8566[_0xc6fd('0x4e')]]['push'](_0x1d76b8);this[_0xc6fd('0x11')][_0x3c8566[_0xc6fd('0x4e')]]=_0x1d76b8;this[_0xc6fd('0x4b')](_0x1d76b8,_0xc6fd('0x1d'));}}catch(_0x6a9d6a){logger[_0xc6fd('0x40')](_0xc6fd('0x75'),_0x3c8566['uniqueid'],util['inspect'](_0x6a9d6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x1bbbbe){try{if(this['isNotNull'](_0x1bbbbe)){logger[_0xc6fd('0x72')](_0xc6fd('0x7c'),_0x1bbbbe[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x1bbbbe,{'showHidden':![],'depth':null}));if(this[_0xc6fd('0xf')][_0x1bbbbe[_0xc6fd('0x4e')]]){var _0x19dc59=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x1bbbbe[_0xc6fd('0x4e')]]);_0x19dc59[_0xc6fd('0x3a')]=![];_0x19dc59[_0xc6fd('0x7e')]=null;_0x19dc59[_0xc6fd('0x7f')]=_0x1bbbbe[_0xc6fd('0x7f')];_0x19dc59[_0xc6fd('0x80')]=_0x1bbbbe['originalposition'];_0x19dc59[_0xc6fd('0x1f')]=!![];_0x19dc59[_0xc6fd('0x81')]=moment()[_0xc6fd('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x19dc59['queuecallerexitreason']=_0xc6fd('0x82');_0x19dc59[_0xc6fd('0x83')]=null;logger[_0xc6fd('0x78')](_0xc6fd('0x84'),_0x19dc59['queue'],_0x19dc59[_0xc6fd('0x59')]);this['channels'][_0x1bbbbe[_0xc6fd('0x4e')]]=_0x19dc59;this[_0xc6fd('0x49')](_0x19dc59,_0xc6fd('0x1f'));}}}catch(_0x38adee){logger[_0xc6fd('0x40')](_0xc6fd('0x7c'),_0x1bbbbe[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x38adee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x21')]=function(_0x208e94){try{if(this['isNotNull'](_0x208e94)){logger[_0xc6fd('0x72')](_0xc6fd('0x85'),_0x208e94['uniqueid'],util['inspect'](_0x208e94,{'showHidden':![],'depth':null}));if(this[_0xc6fd('0xf')][_0x208e94[_0xc6fd('0x4e')]]){var _0x44381d=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x208e94['uniqueid']]);_0x44381d['queuecallerleaveAt']=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x44381d[_0xc6fd('0x87')]=_0x208e94['connectedlinenum'];_0x44381d[_0xc6fd('0x88')]=_0x208e94['connectedlinename'];logger[_0xc6fd('0x78')](_0xc6fd('0x89'),_0x44381d[_0xc6fd('0x51')],_0x44381d[_0xc6fd('0x59')],_0x208e94['connectedlinenum'],_0x208e94[_0xc6fd('0x88')]);this[_0xc6fd('0x11')][_0x208e94[_0xc6fd('0x4e')]]=_0x44381d;this[_0xc6fd('0x4b')](_0x44381d,_0xc6fd('0x8a'));}}}catch(_0x211b43){logger['error'](_0xc6fd('0x85'),_0x208e94[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x211b43,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x24')]=function(_0x27de50){try{if(this[_0xc6fd('0x5e')](_0x27de50)){logger[_0xc6fd('0x72')](_0xc6fd('0x8b'),_0x27de50[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x27de50,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x27de50[_0xc6fd('0x4e')]]){var _0x3697e0=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x27de50[_0xc6fd('0x4e')]]);_0x3697e0[_0xc6fd('0x3a')]=!![];_0x3697e0['queuecallerexitreason']=_0xc6fd('0x8c');logger[_0xc6fd('0x78')](_0xc6fd('0x8d'),_0x3697e0[_0xc6fd('0x51')],_0x3697e0[_0xc6fd('0x59')]);}}}catch(_0x39558b){logger[_0xc6fd('0x40')](_0xc6fd('0x8b'),_0x27de50[_0xc6fd('0x4e')],util['inspect'](_0x39558b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')]['syncAgentComplete']=function(_0x51912b){try{if(this[_0xc6fd('0x5e')](_0x51912b)){logger['debug'](_0xc6fd('0x8e'),_0x51912b[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x51912b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x51912b[_0xc6fd('0x4e')]]){var _0x52167b=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x51912b['uniqueid']]);_0x52167b[_0xc6fd('0x1f')]=![];_0x52167b[_0xc6fd('0x81')]=null;_0x52167b['assigned']=!![];_0x52167b['lastAssignedTo']=_0x51912b[_0xc6fd('0x8f')];_0x52167b['holdtime']=_0x51912b['holdtime'];_0x52167b[_0xc6fd('0x3a')]=!![];_0x52167b['queuecallerexit']=![];_0x52167b[_0xc6fd('0x90')]=null;if(!_0x52167b[_0xc6fd('0x91')]){if(_0x51912b[_0xc6fd('0x92')]==_0xc6fd('0x91')){_0x52167b[_0xc6fd('0x54')]=_0xc6fd('0x93');logger[_0xc6fd('0x78')](_0xc6fd('0x94'),_0x52167b[_0xc6fd('0x51')],_0x52167b[_0xc6fd('0x59')]);}else{if(_[_0xc6fd('0x95')](_0x51912b['channel'][_0xc6fd('0x96')](),_0xc6fd('0x97'))){if(this['queueReports'][_0x51912b[_0xc6fd('0x98')]]){var _0x3cef54=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x51912b[_0xc6fd('0x98')]]);_0x3cef54[_0xc6fd('0x3a')]=![];_0x3cef54['queuecallerexit']=!![];_0x3cef54[_0xc6fd('0x90')]=moment(_0x52167b[_0xc6fd('0x76')])[_0xc6fd('0x99')](_0x51912b[_0xc6fd('0x7f')],_0xc6fd('0x9a'))[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x3cef54[_0xc6fd('0x54')]=_0xc6fd('0x9b');_0x3cef54['transfer']=!![];_0x3cef54[_0xc6fd('0x9c')]='FORWARD';_0x3cef54[_0xc6fd('0x9d')]=_0x51912b['destexten'];_0x3cef54[_0xc6fd('0x9e')]=_0x51912b['uniqueid'];logger[_0xc6fd('0x78')](_0xc6fd('0x9f'),_0x3cef54['queue'],_0x3cef54[_0xc6fd('0x59')]);var _0x5422e3=this[_0xc6fd('0xf')][_0x51912b[_0xc6fd('0x98')]];this['queueReports'][_0x51912b[_0xc6fd('0x98')]]=this['queueReports'][_0x51912b[_0xc6fd('0x4e')]];this[_0xc6fd('0xf')][_0x51912b[_0xc6fd('0x4e')]]=_0x5422e3;}}else{_0x52167b[_0xc6fd('0x54')]=_0xc6fd('0xa0')+_0x51912b['reason'][_0xc6fd('0xa1')]();logger[_0xc6fd('0x78')](_0xc6fd('0xa2'),_0x52167b[_0xc6fd('0x51')],_0x52167b[_0xc6fd('0x59')],_0x52167b[_0xc6fd('0x54')]);}}}this[_0xc6fd('0x11')][_0x51912b[_0xc6fd('0x4e')]]=_0x52167b;}}}catch(_0x4a3a3c){logger['error'](_0xc6fd('0x8e'),_0x51912b[_0xc6fd('0x4e')],util['inspect'](_0x4a3a3c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x26')]=function(_0x1d0558){try{if(this[_0xc6fd('0x5e')](_0x1d0558)){logger[_0xc6fd('0x72')](_0xc6fd('0xa3'),_0x1d0558[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x1d0558,{'showHidden':![],'depth':null}));this['addVariable'](_0x1d0558[_0xc6fd('0x4e')],_[_0xc6fd('0x7b')](_0x1d0558[_0xc6fd('0xa4')])[0x0],_0x1d0558[_0xc6fd('0xa5')]);if(this[_0xc6fd('0xf')][_0x1d0558['uniqueid']]){var _0x22e97a=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x1d0558[_0xc6fd('0x4e')]]);if(_0x22e97a){if(this[_0xc6fd('0x5e')](_0x1d0558[_0xc6fd('0xa4')])&&this['isNotNull'](_0x1d0558['variable'][_0xc6fd('0x67')])){switch(_0x1d0558[_0xc6fd('0xa5')]){case _0xc6fd('0xa6'):_0x22e97a['queuecallerexit']=![];_0x22e97a['queuecallerexitAt']=null;break;case _0xc6fd('0xa7'):_0x22e97a[_0xc6fd('0xa8')]='timeout';_0x22e97a[_0xc6fd('0x39')]=!![];_0x22e97a[_0xc6fd('0x90')]=moment()['format'](_0xc6fd('0x86'));_0x22e97a[_0xc6fd('0xa9')]=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));logger[_0xc6fd('0x72')](_0xc6fd('0xaa'),_0x1d0558[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x22e97a,{'showHidden':![],'depth':null}));ami[_0xc6fd('0x4a')](_0xc6fd('0xab'),_0x22e97a);break;default:_0x22e97a[_0xc6fd('0x39')]=!![];_0x22e97a[_0xc6fd('0x90')]=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x22e97a[_0xc6fd('0xa9')]=moment()['format'](_0xc6fd('0x86'));}_0x22e97a['queuecallerabandon']=![];_0x22e97a[_0xc6fd('0x81')]=null;_0x22e97a[_0xc6fd('0x54')]=_0x1d0558[_0xc6fd('0xa5')];this[_0xc6fd('0x11')][_0x1d0558[_0xc6fd('0x4e')]]=_0x22e97a;this[_0xc6fd('0x49')](_0x22e97a,_0xc6fd('0x25'));}else if(this[_0xc6fd('0x5e')](_0x1d0558['variable'])&&this[_0xc6fd('0x5e')](_0x1d0558['variable'][_0xc6fd('0xac')])){if(!_0x22e97a[_0xc6fd('0x1f')]){_0x22e97a[_0xc6fd('0x39')]=!![];_0x22e97a[_0xc6fd('0x90')]=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x22e97a[_0xc6fd('0x54')]=_0xc6fd('0xad');_0x22e97a['queuecallerleaveAt']=moment()['format'](_0xc6fd('0x86'));this[_0xc6fd('0x11')][_0x1d0558['uniqueid']]=_0x22e97a;}}logger[_0xc6fd('0x78')](_0xc6fd('0xae'),_0x1d0558[_0xc6fd('0x4e')],_0x22e97a[_0xc6fd('0x51')],_0x22e97a[_0xc6fd('0x59')],_[_0xc6fd('0x7b')](_0x1d0558['variable'])[0x0],_0x1d0558[_0xc6fd('0xa5')]);_0x22e97a[_0xc6fd('0x44')]=this[_0xc6fd('0x44')][_0x1d0558[_0xc6fd('0x4e')]];}}}}catch(_0x2f21cd){logger[_0xc6fd('0x40')](_0xc6fd('0xa3'),_0x1d0558[_0xc6fd('0x4e')],util['inspect'](_0x2f21cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc6fd('0xaf')]=function(_0x637452,_0x32a67e,_0x44df6a){var _0x5d710e=['rtpaudioqos',_0xc6fd('0xb0'),'rtpaudioqosjitter',_0xc6fd('0xb1'),_0xc6fd('0xb2'),_0xc6fd('0xb3'),_0xc6fd('0xb4'),_0xc6fd('0xb5'),_0xc6fd('0xb6'),_0xc6fd('0xb7'),_0xc6fd('0xb8'),'bridgepvtcallid',_0xc6fd('0xb9'),_0xc6fd('0xba'),_0xc6fd('0xbb'),_0xc6fd('0xbc'),_0xc6fd('0x8f'),_0xc6fd('0xbd'),_0xc6fd('0xbe')];if(!_['isNil'](_0x32a67e)&&!_['includes'](_0x5d710e,_0x32a67e)){if(_[_0xc6fd('0x5f')](this[_0xc6fd('0x44')][_0x637452])){this[_0xc6fd('0x44')][_0x637452]={};}this['variables'][_0x637452][_0x32a67e]=_0x44df6a;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x15cc48,_0x3a1a2f,_0x1b43d3){try{var _0x370172={};if(this['queueReports'][_0x15cc48]){for(var _0x415e03=0x0;_0x415e03{delete this[_0xc6fd('0x11')][_0xd912a];},_0x13a43f);}};module[_0xc6fd('0xf2')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 47e09eb..4b1d8e4 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 _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 +var _0xeb83=['queue','Request','CreateReportAgentPreview','../client','campaign'];(function(_0x34f9f6,_0x299d0c){var _0x2e241c=function(_0x1a2302){while(--_0x1a2302){_0x34f9f6['push'](_0x34f9f6['shift']());}};_0x2e241c(++_0x299d0c);}(_0xeb83,0x12f));var _0x3eb8=function(_0x64d6e3,_0x5054af){_0x64d6e3=_0x64d6e3-0x0;var _0x4bf000=_0xeb83[_0x64d6e3];return _0x4bf000;};'use strict';var client=require(_0x3eb8('0x0'));exports['createHistory']=function(_0x1b39dc){return function(){_0x1b39dc[_0x3eb8('0x1')]=_0x1b39dc[_0x3eb8('0x2')];return client[_0x3eb8('0x3')]('CreateReportAgentPreview',{'body':_0x1b39dc,'log':_0x3eb8('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 72c31a4..e77c2cc 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 _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 +var _0xe086=['../client','Request','CreateAttachment'];(function(_0x37f4d8,_0x4ec257){var _0x10ebd8=function(_0x189b79){while(--_0x189b79){_0x37f4d8['push'](_0x37f4d8['shift']());}};_0x10ebd8(++_0x4ec257);}(_0xe086,0x15f));var _0x6e08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe086[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6e08('0x0'));exports['create']=function(_0x2a7cd4){return client[_0x6e08('0x1')](_0x6e08('0x2'),{'body':_0x2a7cd4,'log':_0x6e08('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 53ffc88..2bf40bc 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 _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 +var _0x1261=['Interval','interval','SquareProject','getCampaign','getCampaigns','Request','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','TrunkBackup','callerid'];(function(_0x11b6f5,_0x4789c9){var _0x455ec7=function(_0x3b494f){while(--_0x3b494f){_0x11b6f5['push'](_0x11b6f5['shift']());}};_0x455ec7(++_0x4789c9);}(_0x1261,0x144));var _0x1126=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0x1261[_0x137f1a];return _0x439923;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(){return function(){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x1126('0xa'),_0x1126('0xb'),'dialNoAnswerMaxRetry',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'dialDropRetryFrequency',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'dialMachineRetryFrequency',_0x1126('0x14'),'dialAgentRejectRetryFrequency','dialTimezone',_0x1126('0x15'),'dialAMDActive',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'dialOrderByScheduledAt','dialPrefix',_0x1126('0x1f'),_0x1126('0x20')],'include':[{'model':_0x1126('0x21'),'as':'Trunk','attributes':['id',_0x1126('0x3'),'callerid',_0x1126('0x5')]},{'model':_0x1126('0x21'),'as':_0x1126('0x22'),'attributes':['id','name',_0x1126('0x23'),_0x1126('0x5')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1126('0x3')],'include':[{'model':_0x1126('0x24'),'as':'Intervals','attributes':['id','name',_0x1126('0x25')]}]},{'model':'SquareProject','as':_0x1126('0x26'),'attributes':['id',_0x1126('0x3')]}]},'log':_0x1126('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 49b1218..7c028a0 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 _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 +var _0xfa24=['../client','createContact','Request','CreateCmContact','GetCmContact'];(function(_0x255b93,_0xd7d179){var _0x4f3427=function(_0x3410a){while(--_0x3410a){_0x255b93['push'](_0x255b93['shift']());}};_0x4f3427(++_0xd7d179);}(_0xfa24,0x69));var _0x4fa2=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xfa24[_0x379799];return _0x46e431;};'use strict';var client=require(_0x4fa2('0x0'));exports[_0x4fa2('0x1')]=function(_0x5a2cbd){return function(){return client[_0x4fa2('0x2')](_0x4fa2('0x3'),{'body':_0x5a2cbd,'log':_0x4fa2('0x3')});};};exports['getContacts']=function(_0x1755f){return function(){return client[_0x4fa2('0x2')](_0x4fa2('0x4'),{'options':_0x1755f,'log':_0x4fa2('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 00d5857..9eb38bb 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 _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 +var _0xf569=['CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','VoiceQueueId','countReScheduled','getContactPreview','GetCmHopperPreview','User','VoiceQueue','Queue','name','getCmHopper','unlockContact','GetContactRecallMe','Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','moment','getContacts','Request','GetCmHopper','CmContact','Contact','updateContacts','UpdateCmHopper','format','rescheduleContact','ContactId','ListId'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0xf569,0xd0));var _0x9f56=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf569[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require('../client');var moment=require(_0x9f56('0x0'));exports[_0x9f56('0x1')]=function(_0x156de2,_0x9c192){return function(){return client[_0x9f56('0x2')](_0x9f56('0x3'),{'options':{'where':{'VoiceQueueId':_0x156de2},'include':[{'model':_0x9f56('0x4'),'as':_0x9f56('0x5')}],'limit':_0x9c192,'raw':![]},'log':'getCmHopper'});};};exports[_0x9f56('0x6')]=function(_0x5ebdbd,_0x467a46,_0x3488f2){return function(){return client['Request'](_0x9f56('0x7'),{'body':_0x5ebdbd,'options':{'where':{'VoiceQueueId':_0x467a46,'scheduledat':{'$lte':moment()[_0x9f56('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x3488f2},'log':_0x9f56('0x7')});};};exports[_0x9f56('0x9')]=function(_0x40a384){return client['Request']('UpdateCmHopper',{'body':_0x40a384,'options':{'where':{'ContactId':_0x40a384[_0x9f56('0xa')],'ListId':_0x40a384[_0x9f56('0xb')],'VoiceQueueId':_0x40a384['VoiceQueueId'],'CampaignId':_0x40a384[_0x9f56('0xc')]}},'log':_0x9f56('0x9')});};exports[_0x9f56('0xd')]=function(_0x4baac9,_0x5b0e94,_0x19a5e1){return function(){return client['Request'](_0x9f56('0xe'),{'options':{'where':{'VoiceQueueId':_0x4baac9,'ListId':_0x5b0e94,'ContactId':_0x19a5e1}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x293687,_0x4230ea,_0x5af8ab,_0x227587){return client[_0x9f56('0x2')](_0x9f56('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x293687,'active':![],'scheduledat':{'$lte':moment()[_0x9f56('0x8')](_0x9f56('0x10'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4230ea}}]},'order':[[_0x9f56('0x11'),_0x9f56('0x12')],[_0x9f56('0x13'),_0x227587],['id',_0x9f56('0x14')]],'raw':!![],'limit':_0x5af8ab},'log':_0x9f56('0xf')});};exports[_0x9f56('0x15')]=function(_0x13ebfa,_0x25a100,_0x9c39ec){return client[_0x9f56('0x2')](_0x9f56('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x13ebfa,'active':![],'scheduledat':{'$lte':moment()[_0x9f56('0x8')](_0x9f56('0x10'))}},'include':[{'model':'CmContact','as':'Contact'}],'order':[[_0x9f56('0x11'),_0x9f56('0x12')],[_0x9f56('0x13'),_0x9c39ec],['id',_0x9f56('0x14')]],'raw':!![],'limit':_0x25a100},'log':_0x9f56('0x16')});};exports['moveContactManagedDialer']=function(_0x433418,_0x25d1ea){_0x433418[_0x9f56('0x17')]=_0x433418[_0x9f56('0x18')];return client[_0x9f56('0x2')](_0x9f56('0x19'),{'body':_0x433418,'options':{'where':{'ContactId':_0x433418[_0x9f56('0xa')],'ListId':_0x433418['ListId'],'VoiceQueueId':_0x433418[_0x9f56('0x1a')],'CampaignId':_0x433418['CampaignId'],'active':_0x25d1ea?undefined:!![]}},'log':_0x9f56('0x19')});};exports[_0x9f56('0x1b')]=function(_0x43aae6){return client[_0x9f56('0x2')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x43aae6['id']?_0x43aae6['id']||null:null}},'log':_0x9f56('0x1b')});};exports[_0x9f56('0x1c')]=function(_0x573e31){return function(){return client[_0x9f56('0x2')](_0x9f56('0x1d'),{'options':{'where':{'id':_0x573e31},'include':[{'model':'CmContact','as':_0x9f56('0x5')},{'model':_0x9f56('0x1e'),'as':'Agent','attributes':['id','name']},{'model':_0x9f56('0x1f'),'as':_0x9f56('0x20'),'attributes':['id',_0x9f56('0x21')]}],'raw':!![]},'log':_0x9f56('0x22')});};};exports[_0x9f56('0x23')]=function(_0x2aaf54,_0x48da87,_0x76b04f){return client[_0x9f56('0x2')](_0x9f56('0x7'),{'body':_0x2aaf54,'options':{'where':{'id':_0x48da87},'limit':_0x76b04f},'log':_0x9f56('0x7')});};exports['getContactRecallMe']=function(_0x1157ca,_0x25bc7e){return function(){return client[_0x9f56('0x2')](_0x9f56('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1157ca,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x9f56('0x8')](_0x9f56('0x10'))},'UserId':{'$in':_0x25bc7e}},'order':[[_0x9f56('0x11'),_0x9f56('0x12')],[_0x9f56('0x13'),_0x9f56('0x12')],['id',_0x9f56('0x14')]],'include':[{'model':_0x9f56('0x4'),'as':'Contact'},{'model':'User','as':_0x9f56('0x25'),'attributes':['id','name',_0x9f56('0x26')]}],'group':_0x9f56('0x27'),'raw':!![]},'log':_0x9f56('0xf')});};};exports[_0x9f56('0x28')]=function(_0xe8d198,_0x4513a2){return client[_0x9f56('0x2')]('ResetActiveCalls',{'body':_0xe8d198,'options':_0x4513a2||{},'log':_0x9f56('0x29')});};exports['handlePreviewRecallNotifications']=function(_0xcdf778,_0x3e9d62,_0x2063ae){return function(){return client[_0x9f56('0x2')](_0x9f56('0x2a'),{'body':{'where':{'voiceQueueIds':_0xcdf778,'interval':_0x3e9d62,'availableAgentsIds':_0x2063ae}},'log':_0x9f56('0x2b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 53708af..870a94e 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 _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 +var _0x3243=['Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones','VerifyAdditionalPhones'];(function(_0xbfc560,_0x311fba){var _0x47b022=function(_0x2cd37f){while(--_0x2cd37f){_0xbfc560['push'](_0xbfc560['shift']());}};_0x47b022(++_0x311fba);}(_0x3243,0x196));var _0x3324=function(_0x222fb3,_0x2751e7){_0x222fb3=_0x222fb3-0x0;var _0x2cb8f0=_0x3243[_0x222fb3];return _0x2cb8f0;};'use strict';var client=require('../client');exports[_0x3324('0x0')]=function(_0x55a794,_0x235b2b,_0x4bd6d6){return client['Request'](_0x3324('0x1'),{'body':_0x55a794,'reason':_0x235b2b,'entity':_0x4bd6d6,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x2acaf2,_0x4d2322,_0x5f14ef){return client[_0x3324('0x2')]('SwapAdditionalPhones',{'body':_0x2acaf2,'duration':_0x4d2322,'waitTime':_0x5f14ef,'log':_0x3324('0x3')});};exports[_0x3324('0x4')]=function(_0x1a9bfb){return function(){return client[_0x3324('0x2')](_0x3324('0x5'),{'body':_0x1a9bfb,'log':_0x3324('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index b6120b0..cb25bfa 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 _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 +var _0xd822=['CampaignId','../client','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr'];(function(_0x2a8f68,_0x23b0fe){var _0x31f2f5=function(_0x490617){while(--_0x490617){_0x2a8f68['push'](_0x2a8f68['shift']());}};_0x31f2f5(++_0x23b0fe);}(_0xd822,0x1ac));var _0x2d82=function(_0x42b71c,_0x35e86b){_0x42b71c=_0x42b71c-0x0;var _0x49017f=_0xd822[_0x42b71c];return _0x49017f;};'use strict';var client=require(_0x2d82('0x0'));exports['checkIsBlackList']=function(_0x51bfb3){return client[_0x2d82('0x1')](_0x2d82('0x2'),{'options':{'where':{'VoiceQueueId':_0x51bfb3[_0x2d82('0x3')],'phone':_0x51bfb3[_0x2d82('0x4')]},'raw':![]},'log':_0x2d82('0x2')});};exports[_0x2d82('0x5')]=function(_0x182e81){return client[_0x2d82('0x1')](_0x2d82('0x2'),{'options':{'where':{'CampaignId':_0x182e81[_0x2d82('0x6')],'phone':_0x182e81[_0x2d82('0x4')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 5b8e8ad..d5f672a 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 _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 +var _0x61b6=['../client','createContact','Request','CreateCmHopperFinal'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x61b6,0x158));var _0x661b=function(_0x38d510,_0x38bdfe){_0x38d510=_0x38d510-0x0;var _0x34ab19=_0x61b6[_0x38d510];return _0x34ab19;};'use strict';var client=require(_0x661b('0x0'));exports[_0x661b('0x1')]=function(_0x14c4b8){return function(){_0x14c4b8['campaign']=_0x14c4b8['queue'];return client[_0x661b('0x2')](_0x661b('0x3'),{'body':_0x14c4b8,'log':_0x661b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index deddc42..3bbfd49 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 _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 +var _0x8d7f=['getCampaignHopperHistory','GetCampaignHopperHistory','startOf','ivr','../client','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','endOf','day'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x8d7f,0x1a8));var _0xf8d7=function(_0x559d86,_0x25096b){_0x559d86=_0x559d86-0x0;var _0x325cf9=_0x8d7f[_0x559d86];return _0x325cf9;};'use strict';var client=require(_0xf8d7('0x0'));var moment=require(_0xf8d7('0x1'));exports[_0xf8d7('0x2')]=function(_0x1582f8){_0x1582f8[_0xf8d7('0x3')]=_0x1582f8[_0xf8d7('0x4')];return client[_0xf8d7('0x5')](_0xf8d7('0x6'),{'body':_0x1582f8,'log':'CreateCmHopperHistory'});};exports['avgHandleTime']=function(_0x3c65d7){return client['Request'](_0xf8d7('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0xf8d7('0x8')](_0x3c65d7,_0xf8d7('0x9'))[_0xf8d7('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf8d7('0xa')](_0xf8d7('0xb'))]}},'raw':![]},'log':_0xf8d7('0xc')});};exports[_0xf8d7('0xd')]=function(){return function(){return client['Request'](_0xf8d7('0xe'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xf8d7('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf8d7('0xf')](_0xf8d7('0x10'))[_0xf8d7('0xa')](_0xf8d7('0xb'))]},'campaigntype':'queue'},'raw':![]},'log':_0xf8d7('0xe')});};};exports[_0xf8d7('0x11')]=function(){return function(){return client['Request'](_0xf8d7('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xf8d7('0x13')](_0xf8d7('0x10'))[_0xf8d7('0xa')](_0xf8d7('0xb')),moment()['endOf'](_0xf8d7('0x10'))['format'](_0xf8d7('0xb'))]},'campaigntype':_0xf8d7('0x14')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index f48daa2..8186014 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 _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 +var _0xdacc=['Trunk','callerid','active','getFaxAccount','NotifyFaxAccount','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key'];(function(_0x28a635,_0xdbb2ac){var _0x44b855=function(_0x90130f){while(--_0x90130f){_0x28a635['push'](_0x28a635['shift']());}};_0x44b855(++_0xdbb2ac);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xcdac('0x0')]=function(){return function(){return client[_0xcdac('0x1')](_0xcdac('0x2'),{'options':{'raw':![],'attributes':['id',_0xcdac('0x3'),_0xcdac('0x4'),_0xcdac('0x5'),_0xcdac('0x6'),'localstationid',_0xcdac('0x7'),_0xcdac('0x8'),_0xcdac('0x9'),_0xcdac('0xa'),_0xcdac('0xb'),_0xcdac('0xc'),_0xcdac('0xd'),_0xcdac('0xe'),_0xcdac('0xf'),_0xcdac('0x10')],'include':[{'model':_0xcdac('0x11'),'as':_0xcdac('0x11'),'attributes':['id',_0xcdac('0x3'),_0xcdac('0x12'),_0xcdac('0x13')]}]},'log':_0xcdac('0x14')});};};exports['notify']=function(_0x3c105b,_0x611799){return client['Request'](_0xcdac('0x15'),{'account':{'id':_0x3c105b},'body':_0x611799,'log':_0xcdac('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index c5befea..26a8c0f 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 _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 +var _0x537a=['update','Request'];(function(_0x548d2f,_0x5e4697){var _0x1c5652=function(_0x22ff01){while(--_0x22ff01){_0x548d2f['push'](_0x548d2f['shift']());}};_0x1c5652(++_0x5e4697);}(_0x537a,0x14c));var _0xa537=function(_0x1e306b,_0x28da15){_0x1e306b=_0x1e306b-0x0;var _0x2aef66=_0x537a[_0x1e306b];return _0x2aef66;};'use strict';var client=require('../client');exports[_0xa537('0x0')]=function(_0x57d18b,_0x3b9a2c){return client[_0xa537('0x1')]('UpdateFaxMessage',{'body':_0x3b9a2c,'options':{'where':{'AttachmentId':_0x57d18b}},'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 66ebb4f..5f304fe 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 _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 +var _0x69c7=['../../client','getDeskAccounts','Request','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','content','Descriptions','key','keyType','keyContent','variableName','Variable','Fields','idField','customField','Tags'];(function(_0x28d296,_0x4b0063){var _0x1433f7=function(_0x500a82){while(--_0x500a82){_0x28d296['push'](_0x28d296['shift']());}};_0x1433f7(++_0x4b0063);}(_0x69c7,0x104));var _0x769c=function(_0x5f28f1,_0xd00b79){_0x5f28f1=_0x5f28f1-0x0;var _0x500181=_0x69c7[_0x5f28f1];return _0x500181;};'use strict';var client=require(_0x769c('0x0'));exports[_0x769c('0x1')]=function(){return function(_0x54d34e){return client[_0x769c('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x769c('0x3'),_0x769c('0x4'),_0x769c('0x5'),_0x769c('0x6'),_0x769c('0x7'),_0x769c('0x8'),_0x769c('0x9'),_0x769c('0xa')],'include':[{'model':_0x769c('0xb'),'as':_0x769c('0xc'),'attributes':['id',_0x769c('0x3')],'include':[{'model':_0x769c('0xd'),'as':_0x769c('0xe'),'attributes':['id',_0x769c('0x9'),_0x769c('0xf'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x769c('0x3')]}]},{'model':_0x769c('0xd'),'as':_0x769c('0x10'),'attributes':['id',_0x769c('0x9'),_0x769c('0xf'),_0x769c('0x11'),_0x769c('0x12'),_0x769c('0x13'),_0x769c('0x14')],'include':[{'model':_0x769c('0x15'),'as':_0x769c('0x15'),'attributes':['id','name']}]},{'model':_0x769c('0xd'),'as':_0x769c('0x16'),'attributes':['id',_0x769c('0x9'),'content',_0x769c('0x17'),'nameField',_0x769c('0x18'),_0x769c('0x14')],'include':[{'model':'Variable','as':_0x769c('0x15'),'attributes':['id',_0x769c('0x3')]}]},{'model':'Tag','as':_0x769c('0x19'),'attributes':['id',_0x769c('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 f37fcc5..7b75aef 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 _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 +var _0xda2d=['data5','data7','getDynamics365Accounts','Request','GetDynamics365Account','name','tenantId','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','openNewTab','Subjects','type','content','variableName','Variable','Dynamics365Field','key','keyType','keyContent','Fields','idField','nameField','customField','CloudProvider','data2'];(function(_0x9148ba,_0x2cb1b5){var _0x355e3b=function(_0x134846){while(--_0x134846){_0x9148ba['push'](_0x9148ba['shift']());}};_0x355e3b(++_0x2cb1b5);}(_0xda2d,0x102));var _0xdda2=function(_0x328ee2,_0x2f3f7c){_0x328ee2=_0x328ee2-0x0;var _0x36a71f=_0xda2d[_0x328ee2];return _0x36a71f;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4'),_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9')],'include':[{'model':_0xdda2('0xa'),'as':_0xdda2('0xb'),'attributes':['id',_0xdda2('0x3'),_0xdda2('0xc'),'moduleCreate',_0xdda2('0xd'),_0xdda2('0xe')],'include':[{'model':'Dynamics365Field','as':_0xdda2('0xf'),'attributes':['id',_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12')],'include':[{'model':_0xdda2('0x13'),'as':_0xdda2('0x13'),'attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x14'),'as':'Descriptions','attributes':['id','type','content',_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x12')],'include':[{'model':_0xdda2('0x13'),'as':_0xdda2('0x13'),'attributes':['id',_0xdda2('0x3')]}]},{'model':'Dynamics365Field','as':_0xdda2('0x18'),'attributes':['id','type',_0xdda2('0x11'),_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]},{'model':'CloudProvider','as':_0xdda2('0x1c'),'attributes':['id',_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f')]}]},'log':_0xdda2('0x2')});};}; \ 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 f79e559..846a021 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 _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 +var _0x2964=['type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations','Tag','FreshdeskField'];(function(_0x5e5ba1,_0x414dd8){var _0x15cb4f=function(_0x3d84b1){while(--_0x3d84b1){_0x5e5ba1['push'](_0x5e5ba1['shift']());}};_0x15cb4f(++_0x414dd8);}(_0x2964,0x108));var _0x4296=function(_0x549a15,_0x21290f){_0x549a15=_0x549a15-0x0;var _0x21275e=_0x2964[_0x549a15];return _0x21275e;};'use strict';var client=require(_0x4296('0x0'));exports[_0x4296('0x1')]=function(){return function(_0x31be5e){return client[_0x4296('0x2')](_0x4296('0x3'),{'options':{'raw':![],'attributes':['id',_0x4296('0x4'),_0x4296('0x5'),_0x4296('0x6'),_0x4296('0x7'),'serverUrl'],'include':[{'model':_0x4296('0x8'),'as':_0x4296('0x9'),'attributes':['id',_0x4296('0x4')],'include':[{'model':_0x4296('0xa'),'attributes':['id',_0x4296('0x4')]},{'model':_0x4296('0xb'),'as':'Subjects','attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x10'),'attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0x11'),_0x4296('0x12'),'keyContent',_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x13'),'attributes':['id',_0x4296('0xc'),'content',_0x4296('0x14'),_0x4296('0x15'),_0x4296('0x16'),'variableName'],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 83f07b1..a584f80 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 _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 +var _0x07e8=['Descriptions','key','keyType','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts','GetFreshsalesAccount','username','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','name'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x07e8,0x10f));var _0x807e=function(_0x59934f,_0x11b7f3){_0x59934f=_0x59934f-0x0;var _0x13fabd=_0x07e8[_0x59934f];return _0x13fabd;};'use strict';var client=require(_0x807e('0x0'));exports[_0x807e('0x1')]=function(){return function(_0x25e72e){return client['Request'](_0x807e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x807e('0x3'),'apiKey','remoteUri',_0x807e('0x4')],'include':[{'model':_0x807e('0x5'),'as':_0x807e('0x6'),'attributes':['id','name'],'include':[{'model':_0x807e('0x7'),'as':_0x807e('0x8'),'attributes':['id',_0x807e('0x9'),_0x807e('0xa'),_0x807e('0xb')],'include':[{'model':'Variable','as':_0x807e('0xc'),'attributes':['id',_0x807e('0xd')]}]},{'model':_0x807e('0x7'),'as':_0x807e('0xe'),'attributes':['id',_0x807e('0x9'),_0x807e('0xa'),_0x807e('0xf'),_0x807e('0x10'),_0x807e('0x11'),_0x807e('0xb')],'include':[{'model':_0x807e('0xc'),'as':_0x807e('0xc'),'attributes':['id',_0x807e('0xd')]}]}]}]},'log':_0x807e('0x12')});};}; \ 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 a023c15..351c1bb 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 _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 +var _0x3557=['SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchLead','SalesforceField','Variable','Descriptions','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','serverUrl'];(function(_0x2b91df,_0x47a223){var _0x217663=function(_0x49525d){while(--_0x49525d){_0x2b91df['push'](_0x2b91df['shift']());}};_0x217663(++_0x47a223);}(_0x3557,0x137));var _0x7355=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x3557[_0x231b2e];return _0x3feb2a;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x3801e6){return client[_0x7355('0x0')](_0x7355('0x1'),{'options':{'raw':![],'attributes':['id',_0x7355('0x2'),_0x7355('0x3'),_0x7355('0x4'),_0x7355('0x5'),_0x7355('0x6'),_0x7355('0x7'),'securityToken',_0x7355('0x8'),'type'],'include':[{'model':_0x7355('0x9'),'as':_0x7355('0xa'),'attributes':['id',_0x7355('0x2'),_0x7355('0xb'),_0x7355('0xc'),_0x7355('0xd'),_0x7355('0xe'),_0x7355('0xf'),'additionalSearchContact',_0x7355('0x10')],'include':[{'model':_0x7355('0x11'),'as':'Subjects','include':[{'model':_0x7355('0x12'),'as':_0x7355('0x12'),'attributes':['id','name']}]},{'model':_0x7355('0x11'),'as':_0x7355('0x13'),'include':[{'model':_0x7355('0x12'),'as':_0x7355('0x12'),'attributes':['id',_0x7355('0x2')]}]},{'model':'SalesforceField','as':'Fields','include':[{'model':_0x7355('0x12'),'as':_0x7355('0x12'),'attributes':['id',_0x7355('0x2')]}]}]}]},'log':_0x7355('0x1')});};}; \ 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 4698675..5c9669f 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 _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 +var _0xabce=['password','email','ServicenowConfiguration','name','Subjects','type','content','Variable','ServicenowField','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','username'];(function(_0x4dd5a3,_0x1753c4){var _0x41613d=function(_0x155f52){while(--_0x155f52){_0x4dd5a3['push'](_0x4dd5a3['shift']());}};_0x41613d(++_0x1753c4);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var client=require(_0xeabc('0x0'));exports[_0xeabc('0x1')]=function(){return function(_0x357cda){return client[_0xeabc('0x2')](_0xeabc('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0xeabc('0x4'),_0xeabc('0x5'),_0xeabc('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xeabc('0x7'),'as':'Configurations','attributes':['id',_0xeabc('0x8')],'include':[{'model':'ServicenowField','as':_0xeabc('0x9'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),'variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0xe'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),_0xeabc('0xf'),_0xeabc('0x10'),_0xeabc('0x11'),_0xeabc('0x12')],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0x13'),'attributes':['id','type',_0xeabc('0xb'),_0xeabc('0x14'),_0xeabc('0x15'),'customField','variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ 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 71c5fc3..46bdc75 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 _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 +var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x414cbe,_0x16a463){var _0x2793fe=function(_0x3a75f6){while(--_0x3a75f6){_0x414cbe['push'](_0x414cbe['shift']());}};_0x2793fe(++_0x16a463);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x0b0e[_0x1304c6];return _0x2e6654;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index e548bbb..069fa4b 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 _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 +var _0x7b18=['key','keyContent','name','idField','nameField','customField','../../client','getVtigerAccounts','GetVtigerAccount','description','username','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','variableName','Variable','Descriptions','content'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0x7b18,0xa0));var _0x87b1=function(_0x338601,_0x53e9af){_0x338601=_0x338601-0x0;var _0x5aa144=_0x7b18[_0x338601];return _0x5aa144;};'use strict';var client=require(_0x87b1('0x0'));exports[_0x87b1('0x1')]=function(){return function(_0x1663fd){return client['Request'](_0x87b1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x87b1('0x3'),_0x87b1('0x4'),'accessKey',_0x87b1('0x5'),_0x87b1('0x6')],'include':[{'model':_0x87b1('0x7'),'as':_0x87b1('0x8'),'attributes':['id','name'],'include':[{'model':_0x87b1('0x9'),'as':_0x87b1('0xa'),'attributes':['id',_0x87b1('0xb'),'content',_0x87b1('0xc')],'include':[{'model':_0x87b1('0xd'),'as':_0x87b1('0xd'),'attributes':['id','name']}]},{'model':'VtigerField','as':_0x87b1('0xe'),'attributes':['id','type',_0x87b1('0xf'),_0x87b1('0x10'),'keyType',_0x87b1('0x11'),'variableName'],'include':[{'model':_0x87b1('0xd'),'as':_0x87b1('0xd'),'attributes':['id',_0x87b1('0x12')]}]},{'model':_0x87b1('0x9'),'as':'Fields','attributes':['id',_0x87b1('0xb'),_0x87b1('0xf'),_0x87b1('0x13'),_0x87b1('0x14'),_0x87b1('0x15'),'variableName'],'include':[{'model':_0x87b1('0xd'),'as':'Variable','attributes':['id',_0x87b1('0x12')]}]}]}]},'log':_0x87b1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index e2f3c1a..15038bc 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 _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 +var _0xf9d1=['password','token','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','key','keyType','keyContent','Fields','nameField','GetZendeskAccount','../../client','getZendeskAccounts','Request','name'];(function(_0x4bd181,_0x1175d8){var _0x1ca876=function(_0x2ebc74){while(--_0x2ebc74){_0x4bd181['push'](_0x4bd181['shift']());}};_0x1ca876(++_0x1175d8);}(_0xf9d1,0x1e0));var _0x1f9d=function(_0x2f8169,_0x549933){_0x2f8169=_0x2f8169-0x0;var _0x3f85d1=_0xf9d1[_0x2f8169];return _0x3f85d1;};'use strict';var client=require(_0x1f9d('0x0'));exports[_0x1f9d('0x1')]=function(){return function(_0x144329){return client[_0x1f9d('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x1f9d('0x3'),'username',_0x1f9d('0x4'),_0x1f9d('0x5'),'remoteUri','authType',_0x1f9d('0x6'),_0x1f9d('0x7')],'include':[{'model':_0x1f9d('0x8'),'as':_0x1f9d('0x9'),'attributes':['id',_0x1f9d('0x3')],'include':[{'model':_0x1f9d('0xa'),'attributes':['id',_0x1f9d('0x3')]},{'model':_0x1f9d('0xb'),'as':_0x1f9d('0xc'),'attributes':['id','type',_0x1f9d('0xd'),_0x1f9d('0xe')],'include':[{'model':_0x1f9d('0xf'),'as':_0x1f9d('0xf'),'attributes':['id',_0x1f9d('0x3')]}]},{'model':_0x1f9d('0xb'),'as':'Descriptions','attributes':['id','type',_0x1f9d('0xd'),_0x1f9d('0x10'),_0x1f9d('0x11'),_0x1f9d('0x12'),_0x1f9d('0xe')],'include':[{'model':_0x1f9d('0xf'),'as':_0x1f9d('0xf'),'attributes':['id',_0x1f9d('0x3')]}]},{'model':'ZendeskField','as':_0x1f9d('0x13'),'attributes':['id',_0x1f9d('0x7'),_0x1f9d('0xd'),'idField',_0x1f9d('0x14'),'customField','variableName'],'include':[{'model':_0x1f9d('0xf'),'as':_0x1f9d('0xf'),'attributes':['id',_0x1f9d('0x3')]}]}]}]},'log':_0x1f9d('0x15')});};}; \ 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 cf85f09..9865829 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 _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 +var _0x8052=['variableName','Variable','Descriptions','content','key','keyType','Fields','customField','Request','GetZohoAccount','name','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','moduleCreate','moduleSearch','description','ZohoField','Subjects','type'];(function(_0xa9f2ac,_0x2d4d4f){var _0x9bb6d3=function(_0x36a6fc){while(--_0x36a6fc){_0xa9f2ac['push'](_0xa9f2ac['shift']());}};_0x9bb6d3(++_0x2d4d4f);}(_0x8052,0x102));var _0x2805=function(_0x2eab1d,_0x54edd4){_0x2eab1d=_0x2eab1d-0x0;var _0x37cfed=_0x8052[_0x2eab1d];return _0x37cfed;};'use strict';var client=require('../../client');exports['getZohoAccounts']=function(){return function(_0x3472f1){return client[_0x2805('0x0')](_0x2805('0x1'),{'options':{'raw':![],'attributes':['id',_0x2805('0x2'),'description',_0x2805('0x3'),_0x2805('0x4'),_0x2805('0x5'),_0x2805('0x6'),_0x2805('0x7'),_0x2805('0x8'),_0x2805('0x9')],'include':[{'model':_0x2805('0xa'),'as':'Configurations','attributes':['id',_0x2805('0x2'),_0x2805('0xb'),_0x2805('0xc'),_0x2805('0xd')],'include':[{'model':_0x2805('0xe'),'as':_0x2805('0xf'),'attributes':['id',_0x2805('0x10'),'content',_0x2805('0x11')],'include':[{'model':_0x2805('0x12'),'as':_0x2805('0x12'),'attributes':['id','name']}]},{'model':_0x2805('0xe'),'as':_0x2805('0x13'),'attributes':['id','type',_0x2805('0x14'),_0x2805('0x15'),_0x2805('0x16'),'keyContent',_0x2805('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x2805('0x2')]}]},{'model':_0x2805('0xe'),'as':_0x2805('0x17'),'attributes':['id','type',_0x2805('0x14'),'idField','nameField',_0x2805('0x18'),_0x2805('0x11')],'include':[{'model':'Variable','as':_0x2805('0x12'),'attributes':['id','name']}]}]}]},'log':_0x2805('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 837ca06..ddce377 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 _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 +var _0x3f22=['concat','Request','IntervalIftime','intervalIftime','../../../config/logger','trim','silly','intervalIftime\x20called\x20with','isArray','length','every','number','string','map'];(function(_0x35b2c9,_0x54f081){var _0x482dbf=function(_0x13bcd3){while(--_0x13bcd3){_0x35b2c9['push'](_0x35b2c9['shift']());}};_0x482dbf(++_0x54f081);}(_0x3f22,0x66));var _0x23f2=function(_0x563eb2,_0x4315d1){_0x563eb2=_0x563eb2-0x0;var _0x26d258=_0x3f22[_0x563eb2];return _0x26d258;};var logger=require(_0x23f2('0x0'))('dialer');var client=require('../client');function intervalIftime(_0xc30414,_0xff3f6b){const _0x36d800=new Error()['stack']['replace'](/^Error/,'')[_0x23f2('0x1')]();logger[_0x23f2('0x2')](_0x23f2('0x3'),_0xc30414,_0xff3f6b,_0x36d800);const _0x512ed7=Array[_0x23f2('0x4')](_0xc30414);if(!_0xc30414||_0x512ed7&&_0xc30414[_0x23f2('0x5')]===0x0){return Promise['resolve'](![]);}else{var _0x3adbbe=[];var _0x2297d0=[];var _0x479c31=_0x512ed7?_0xc30414:[_0xc30414];var _0x2d33a2=_0x479c31[_0x23f2('0x6')](function(_0x163343){return typeof _0x163343===_0x23f2('0x7');});var _0x264275=_0x479c31['every'](function(_0x1639a4){return typeof _0x1639a4===_0x23f2('0x8');});if(!_0x2d33a2&&!_0x264275){_0x3adbbe=_0x479c31[_0x23f2('0x9')](function(_0x44a53b){return _0x44a53b['id'];});if(_0x3adbbe[_0x23f2('0x5')]===0x0){_0x2297d0=_0x479c31[_0x23f2('0x9')](function(_0x401aeb){return _0x401aeb['interval'];});}}else{if(_0x2d33a2){_0x3adbbe=_0x3adbbe['concat'](_0x479c31);}if(_0x264275){_0x2297d0=_0x2297d0[_0x23f2('0xa')](_0x479c31);}}return client[_0x23f2('0xb')](_0x23f2('0xc'),{'intervalIds':_0x3adbbe,'intervals':_0x2297d0,'timezone':_0xff3f6b,'log':_0x23f2('0xc')});}}exports[_0x23f2('0xd')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 136b698..323e95d 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 _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 +var _0x1529=['SIP/%s','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','TALKING','starttime','endtime','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x1529,0x1d4));var _0x9152=function(_0x34c6a3,_0x3e1a91){_0x34c6a3=_0x34c6a3-0x0;var _0x58fcda=_0x1529[_0x34c6a3];return _0x58fcda;};'use strict';var moment=require('moment');var _=require(_0x9152('0x0'));var util=require(_0x9152('0x1'));var client=require(_0x9152('0x2'));exports[_0x9152('0x3')]=function(_0x262375){var _0x3bb6c9=_0x262375[_0x9152('0x4')]||_0x262375[_0x9152('0x5')];return client[_0x9152('0x6')]('CreateMemberReport',{'body':{'channel':_0x9152('0x7'),'membername':_0x262375[_0x9152('0x8')],'interface':_[_0x9152('0x9')](_0x262375[_0x9152('0xa')])?util[_0x9152('0xb')](_0x9152('0xc'),_0x262375['lastAssignedTo']):_0x262375['interface'],'type':'TALKING','enterAt':_0x262375[_0x9152('0xd')],'exitAt':_0x3bb6c9,'duration':moment(_0x3bb6c9)[_0x9152('0xe')](_0x262375[_0x9152('0xd')],_0x9152('0xf')),'data1':'inbound','data2':_0x262375[_0x9152('0x10')],'data3':_0x262375[_0x9152('0x11')],'data4':null,'data5':_0x262375[_0x9152('0x12')],'role':_0x9152('0x13'),'internal':_0x262375[_0x9152('0x14')]?_[_0x9152('0x15')](_0x262375[_0x9152('0x14')]):undefined,'uniqueid':_0x262375[_0x9152('0x16')]},'log':_0x9152('0x17')});};exports[_0x9152('0x18')]=function(_0x13f419){return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x13f419[_0x9152('0x19')],'interface':_0x13f419[_0x9152('0xa')],'type':_0x9152('0x1a'),'enterAt':_0x13f419[_0x9152('0x1b')],'exitAt':_0x13f419['endtime'],'duration':moment(_0x13f419[_0x9152('0x1c')])[_0x9152('0xe')](_0x13f419['starttime'],_0x9152('0xf'))>=0x0?moment(_0x13f419['endtime'])['diff'](_0x13f419[_0x9152('0x1b')],_0x9152('0xf')):null,'data1':'outbound','data2':_0x13f419[_0x9152('0x14')],'data3':_0x13f419[_0x9152('0x11')],'data4':_0x13f419[_0x9152('0x1d')]||null,'role':'agent','internal':_0x13f419[_0x9152('0x14')]?_[_0x9152('0x15')](_0x13f419['accountcode']):undefined,'uniqueid':_0x13f419['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 8125b98..df6c87e 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 _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 +var _0xbd8e=['GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbd8e[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0xebd8('0x0'));exports[_0xebd8('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xebd8('0x2'),'previewRecallmeReminderInterval']},'log':_0xebd8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 79490f6..4c5eb9c 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 _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 +var _0xb337=['Request','GetTemplate','name','../client','getTemplates'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0xb337,0x175));var _0x7b33=function(_0x27559d,_0x1a77d9){_0x27559d=_0x27559d-0x0;var _0x41d5d2=_0xb337[_0x27559d];return _0x41d5d2;};'use strict';var client=require(_0x7b33('0x0'));exports[_0x7b33('0x1')]=function(_0x594c25){return function(_0x48c76f){return client[_0x7b33('0x2')](_0x7b33('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7b33('0x4'),'html']},'log':_0x7b33('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ad3436d..d362809 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 _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 +var _0xa599=['data2','data3','data4','data6','data7','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Actions','action','data1'];(function(_0x1da60f,_0x1f1642){var _0x1556f1=function(_0x232b94){while(--_0x232b94){_0x1da60f['push'](_0x1da60f['shift']());}};_0x1556f1(++_0x1f1642);}(_0xa599,0x148));var _0x9a59=function(_0xa6a7e7,_0x31326a){_0xa6a7e7=_0xa6a7e7-0x0;var _0x5d8892=_0xa599[_0xa6a7e7];return _0x5d8892;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x38d0ed){return function(_0x3bf233){return client[_0x9a59('0x0')](_0x9a59('0x1'),{'options':{'raw':![],'attributes':['id',_0x9a59('0x2'),_0x9a59('0x3'),_0x9a59('0x4')],'include':[{'model':_0x9a59('0x5'),'as':_0x9a59('0x6'),'attributes':['id',_0x9a59('0x7'),_0x9a59('0x8'),_0x9a59('0x9')]},{'model':_0x9a59('0x5'),'as':_0x9a59('0xa'),'attributes':['id',_0x9a59('0x7'),_0x9a59('0x8'),'value']},{'model':'Action','as':_0x9a59('0xb'),'attributes':['id',_0x9a59('0xc'),_0x9a59('0xd'),_0x9a59('0xe'),_0x9a59('0xf'),_0x9a59('0x10'),'data5',_0x9a59('0x11'),_0x9a59('0x12')]}]},'log':_0x9a59('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 333cd25..ac54f24 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 _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 +var _0xdb13=['GetTrunk','name','defaultuser','getTrunks','Request'];(function(_0x2acf96,_0x23fc67){var _0x3e692b=function(_0x484137){while(--_0x484137){_0x2acf96['push'](_0x2acf96['shift']());}};_0x3e692b(++_0x23fc67);}(_0xdb13,0x10c));var _0x3db1=function(_0x1ae7a8,_0x39f94e){_0x1ae7a8=_0x1ae7a8-0x0;var _0x264fd7=_0xdb13[_0x1ae7a8];return _0x264fd7;};'use strict';var client=require('../client');exports[_0x3db1('0x0')]=function(_0x366725){return function(_0x38d692){return client[_0x3db1('0x1')](_0x3db1('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3db1('0x3'),'registry',_0x3db1('0x4')]},'log':_0x3db1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7c06e02..956a759 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(_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 +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x32b1c7,_0x928c12){var _0x1ba7ee=function(_0x51a406){while(--_0x51a406){_0x32b1c7['push'](_0x32b1c7['shift']());}};_0x1ba7ee(++_0x928c12);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c3530ea..ec76c03 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 _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 +var _0x0537=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0537,0x1be));var _0x7053=function(_0x468a75,_0xd34746){_0x468a75=_0x468a75-0x0;var _0x1cf284=_0x0537[_0x468a75];return _0x1cf284;};'use strict';var client=require(_0x7053('0x0'));exports[_0x7053('0x1')]=function(_0x8ab46){return client['Request'](_0x7053('0x2'),{'body':_0x8ab46,'log':_0x7053('0x2')});};exports['update']=function(_0x441346,_0x5e49a4,_0x11f623){return client[_0x7053('0x3')](_0x7053('0x4'),{'body':_0x441346,'options':{'where':{'uniqueid':_0x5e49a4,'interface':_0x11f623,'agentcomplete':!![]}},'log':_0x7053('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3ace7e2..1fc6b89 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 _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 +var _0xd551=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound'];(function(_0x972692,_0x2a1c56){var _0x542e84=function(_0xe63f21){while(--_0xe63f21){_0x972692['push'](_0x972692['shift']());}};_0x542e84(++_0x2a1c56);}(_0xd551,0x163));var _0x1d55=function(_0x89d6d9,_0x51362d){_0x89d6d9=_0x89d6d9-0x0;var _0x1ddb0b=_0xd551[_0x89d6d9];return _0x1ddb0b;};'use strict';var moment=require(_0x1d55('0x0'));var util=require(_0x1d55('0x1'));var _=require(_0x1d55('0x2'));var client=require(_0x1d55('0x3'));exports[_0x1d55('0x4')]=function(_0x2f1fed){return client['Request'](_0x1d55('0x5'),{'body':_[_0x1d55('0x6')](_0x2f1fed,{'source':_0x2f1fed[_0x1d55('0x7')],'destinationcontext':_0x2f1fed[_0x1d55('0x8')],'callerid':_0x2f1fed[_0x1d55('0x9')],'amaflags':_0x1d55('0xa')}),'log':_0x1d55('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x1d55('0xb'),{'options':{'where':{'type':[_0x1d55('0xc')],'createdAt':{'$between':[moment()[_0x1d55('0xd')](_0x1d55('0xe'))[_0x1d55('0xf')](_0x1d55('0x10')),moment()[_0x1d55('0x11')](_0x1d55('0xe'))[_0x1d55('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x1d55('0x12'),_0x1d55('0x13'),_0x1d55('0x14'),_0x1d55('0x15')]},'log':_0x1d55('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 089c5aa..ef202c8 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 _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 +var _0x743f=['CreateVoiceDialReport','../client','create','Request'];(function(_0x599960,_0x292b74){var _0xae3b3c=function(_0x49b02a){while(--_0x49b02a){_0x599960['push'](_0x599960['shift']());}};_0xae3b3c(++_0x292b74);}(_0x743f,0x185));var _0xf743=function(_0x30b1c7,_0x5dbc45){_0x30b1c7=_0x30b1c7-0x0;var _0xaa0f18=_0x743f[_0x30b1c7];return _0xaa0f18;};'use strict';var client=require(_0xf743('0x0'));exports[_0xf743('0x1')]=function(_0x22d4fa){return client[_0xf743('0x2')](_0xf743('0x3'),{'body':_0x22d4fa,'log':_0xf743('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6009df0..c9281f1 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 _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 +var _0xb84e=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x4e46ab,_0x6c98b6){var _0x37710a=function(_0x279255){while(--_0x279255){_0x4e46ab['push'](_0x4e46ab['shift']());}};_0x37710a(++_0x6c98b6);}(_0xb84e,0xbf));var _0xeb84=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0xb84e[_0x888385];return _0x22d5c2;};'use strict';var client=require('../client');exports[_0xeb84('0x0')]=function(){return function(){return client[_0xeb84('0x1')](_0xeb84('0x2'),{'options':{'raw':!![],'attributes':['id',_0xeb84('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index bf32b2a..d398aeb 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 _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 +var _0x5981=['GetVoiceQueue','name','acw','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','callerid','active','Interval','Intervals','interval','getVoiceQueues'];(function(_0x2316b9,_0x87059b){var _0x4405a9=function(_0xd9a3e1){while(--_0xd9a3e1){_0x2316b9['push'](_0x2316b9['shift']());}};_0x4405a9(++_0x87059b);}(_0x5981,0x127));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x1598('0x0'),{'options':{'raw':![],'attributes':['id',_0x1598('0x1'),_0x1598('0x2'),'acwTimeout','autopause',_0x1598('0x3'),'type',_0x1598('0x4'),_0x1598('0x5'),_0x1598('0x6'),'dialLimitQueue',_0x1598('0x7'),'dialPredictiveOptimization',_0x1598('0x8'),'dialPredictiveInterval',_0x1598('0x9'),'dialOriginateCallerIdNumber',_0x1598('0xa'),_0x1598('0xb'),_0x1598('0xc'),_0x1598('0xd'),_0x1598('0xe'),_0x1598('0xf'),'dialBusyMaxRetry',_0x1598('0x10'),_0x1598('0x11'),_0x1598('0x12'),'dialGlobalMaxRetry',_0x1598('0x13'),_0x1598('0x14'),_0x1598('0x15'),_0x1598('0x16'),'dialAMDActive',_0x1598('0x17'),_0x1598('0x18'),_0x1598('0x19'),_0x1598('0x1a'),_0x1598('0x1b'),_0x1598('0x1c'),'dialAMDMaximumNumberOfWords',_0x1598('0x1d'),_0x1598('0x1e'),_0x1598('0x1f'),_0x1598('0x20'),_0x1598('0x21'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x1598('0x22'),_0x1598('0x23'),'monitor_format','strategy',_0x1598('0x24'),_0x1598('0x25'),_0x1598('0x26'),_0x1598('0x27'),_0x1598('0x28'),_0x1598('0x29'),_0x1598('0x2a'),_0x1598('0x2b'),_0x1598('0x2c'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x1598('0x2d'),_0x1598('0x2e'),_0x1598('0x2f'),'dialPredictiveIntervalMinThreshold',_0x1598('0x30'),_0x1598('0x31')],'include':[{'model':_0x1598('0x32'),'as':_0x1598('0x32'),'attributes':['id',_0x1598('0x1'),'callerid','active']},{'model':_0x1598('0x33'),'as':_0x1598('0x34'),'attributes':['id',_0x1598('0x1')]},{'model':_0x1598('0x32'),'as':'TrunkBackup','attributes':['id','name',_0x1598('0x35'),_0x1598('0x36')]},{'model':_0x1598('0x37'),'as':_0x1598('0x37'),'attributes':['id',_0x1598('0x1')],'include':[{'model':'Interval','as':_0x1598('0x38'),'attributes':['id',_0x1598('0x1'),_0x1598('0x39')]}]}]},'log':_0x1598('0x3a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 22aee29..a4f3410 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(_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 +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(_0xb2cdc8,_0x54467e){var _0x4d954b=function(_0x1b5ced){while(--_0x1b5ced){_0xb2cdc8['push'](_0xb2cdc8['shift']());}};_0x4d954b(++_0x54467e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 516b308..e2f5683 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 _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 +var _0x0e27=['GetVoiceQueueRtPauses','Request'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x0e27,0x1df));var _0x70e2=function(_0x48baa3,_0x3cebbf){_0x48baa3=_0x48baa3-0x0;var _0x394bba=_0x0e27[_0x48baa3];return _0x394bba;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x49e38e){return function(){return client[_0x70e2('0x0')](_0x70e2('0x1'),{'options':{'where':{'VoiceQueueId':_0x49e38e,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6934ac9..e584f57 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_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 +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1bbefc,_0x35cc58){var _0x2ae080=function(_0xdbcd83){while(--_0xdbcd83){_0x1bbefc['push'](_0x1bbefc['shift']());}};_0x2ae080(++_0x35cc58);}(_0x7a54,0x106));var _0x47a5=function(_0x5ea3d7,_0x2d9917){_0x5ea3d7=_0x5ea3d7-0x0;var _0x45887a=_0x7a54[_0x5ea3d7];return _0x45887a;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 53d723e..0ecc06b 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 _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 +var _0x8460=['transfers','blindTransfer','Request','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','result','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','attended','../client'];(function(_0x3cb2d9,_0x4bdb75){var _0x5278bf=function(_0x2559da){while(--_0x2559da){_0x3cb2d9['push'](_0x3cb2d9['shift']());}};_0x5278bf(++_0x4bdb75);}(_0x8460,0x68));var _0x0846=function(_0xa587a,_0xc7ebc7){_0xa587a=_0xa587a-0x0;var _0x2af6f3=_0x8460[_0xa587a];return _0x2af6f3;};'use strict';var client=require(_0x0846('0x0'));exports[_0x0846('0x1')]={};exports[_0x0846('0x2')]=function(_0x2c4750){return client[_0x0846('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x2c4750['result'],'transfererchannel':_0x2c4750[_0x0846('0x4')],'transferercalleridnum':_0x2c4750[_0x0846('0x5')],'transferercalleridname':_0x2c4750['transferercalleridname'],'transfererconnectedlinenum':_0x2c4750[_0x0846('0x6')],'transfererconnectedlinename':_0x2c4750['transfererconnectedlinename'],'transfereraccountcode':_0x2c4750[_0x0846('0x7')],'transferercontext':_0x2c4750[_0x0846('0x8')],'transfererexten':_0x2c4750[_0x0846('0x9')],'transfererlinkedid':_0x2c4750['transfererlinkedid'],'transfereechannel':_0x2c4750[_0x0846('0xa')],'transfereecalleridnum':_0x2c4750[_0x0846('0xb')],'transfereecalleridname':_0x2c4750[_0x0846('0xc')],'transfereeconnectedlinenum':_0x2c4750[_0x0846('0xd')],'transfereeconnectedlinename':_0x2c4750[_0x0846('0xe')],'transfereeaccountcode':_0x2c4750['transfereeaccountcode'],'transfereecontext':_0x2c4750['transfereecontext'],'transfereeexten':_0x2c4750[_0x0846('0xf')],'transfereelinkedid':_0x2c4750['transfereelinkedid'],'isexternal':_0x2c4750[_0x0846('0x10')],'context':_0x2c4750[_0x0846('0x11')],'extension':_0x2c4750[_0x0846('0x12')],'type':_0x0846('0x13')},'log':_0x0846('0x14')});};exports['attendedTransfer']=function(_0x1487d0){return client[_0x0846('0x3')](_0x0846('0x14'),{'body':{'result':_0x1487d0[_0x0846('0x15')],'transfererchannel':_0x1487d0['origtransfererchannel'],'transferercalleridnum':_0x1487d0[_0x0846('0x16')],'transferercalleridname':_0x1487d0['origtransferercalleridname'],'transfererconnectedlinenum':_0x1487d0[_0x0846('0x17')],'transfererconnectedlinename':_0x1487d0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1487d0[_0x0846('0x18')],'transferercontext':_0x1487d0[_0x0846('0x19')],'transfererexten':_0x1487d0[_0x0846('0x1a')],'transfererlinkedid':_0x1487d0['origtransfererlinkedid'],'transfereechannel':_0x1487d0[_0x0846('0x1b')],'transfereecalleridnum':_0x1487d0[_0x0846('0x1c')],'transfereecalleridname':_0x1487d0[_0x0846('0x1d')],'transfereeconnectedlinenum':_0x1487d0['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1487d0[_0x0846('0x1e')],'transfereeaccountcode':_0x1487d0[_0x0846('0x1f')],'transfereecontext':_0x1487d0['transfertargetcontext'],'transfereeexten':_0x1487d0[_0x0846('0x20')],'transfereelinkedid':_0x1487d0[_0x0846('0x21')],'isexternal':_0x1487d0[_0x0846('0x10')],'context':_0x1487d0['origtransferercontext'],'extension':_0x1487d0['origtransfererexten'],'type':_0x0846('0x22')},'log':_0x0846('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 120ad70..f9b378d 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_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 +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(_0x4d5346,_0x50519a){var _0x518145=function(_0x414584){while(--_0x414584){_0x4d5346['push'](_0x4d5346['shift']());}};_0x518145(++_0x50519a);}(_0xb10b,0x12a));var _0xbb10=function(_0x12309b,_0x59dd8c){_0x12309b=_0x12309b-0x0;var _0x482e4d=_0xb10b[_0x12309b];return _0x482e4d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index f0ae048..9fcb98c 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 _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 +var _0xbfa3=['then','isEmpty','[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','calleridnum','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','length','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','destcalleridnum','routeId','lastName','mobile','fax','scheduledAt','updatedAt'];(function(_0x2ee7d2,_0xb4acf5){var _0x560ea2=function(_0x446923){while(--_0x446923){_0x2ee7d2['push'](_0x2ee7d2['shift']());}};_0x560ea2(++_0xb4acf5);}(_0xbfa3,0x1f4));var _0x3bfa=function(_0x5e86a0,_0x279e01){_0x5e86a0=_0x5e86a0-0x0;var _0x19055e=_0xbfa3[_0x5e86a0];return _0x19055e;};'use strict';var _=require('lodash');var BPromise=require(_0x3bfa('0x0'));var Redis=require('ioredis');var util=require(_0x3bfa('0x1'));var config=require(_0x3bfa('0x2'));var logger=require(_0x3bfa('0x3'))(_0x3bfa('0x4'));var cmContactRpc=require(_0x3bfa('0x5'));config[_0x3bfa('0x6')]=_['defaults'](config[_0x3bfa('0x6')],{'host':_0x3bfa('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3bfa('0x6')]));function emit(_0x302414,_0x24d489,_0x3eed7f,_0x345e0d,_0x74154b){logger[_0x3bfa('0x8')](_0x3bfa('0x9'),_0x302414,_0x24d489['id'],_0x3eed7f,_0x345e0d,JSON[_0x3bfa('0xa')](_0x74154b));io['to'](_0x3eed7f)[_0x3bfa('0xb')](_0x345e0d,_0x74154b);}exports[_0x3bfa('0xc')]=function(_0x93ed94,_0x58af97,_0xbc9db5,_0x32f681){var _0x24f12e,_0x1d1cd7;var _0x352199={};var _0x487f3d;var _0x2756d2=Number(_0xbc9db5[_0x3bfa('0xd')]);var _0x50ed33=_0xbc9db5[_0x3bfa('0xe')]?Boolean(Number(_0xbc9db5['data2'])):![];var _0x124bec;var _0xe008a6=![];if(!_[_0x3bfa('0xf')](_0xbc9db5[_0x3bfa('0x10')])){if(_0xbc9db5[_0x3bfa('0x10')]=='1')_0xe008a6=!![];}if(!_0xe008a6){if(_0x32f681[_0x3bfa('0x11')]){_0x352199['id']=_0x32f681[_0x3bfa('0x11')];}}if(!_0x352199['id']){_0x352199[_0x3bfa('0x12')]=_0x2756d2;_0x124bec=_0xbc9db5[_0x3bfa('0x13')]&&_0xbc9db5['data3']!=='0'?_0xbc9db5[_0x3bfa('0x13')]['split'](','):[_0x3bfa('0x14')];_0x352199[_0x3bfa('0x15')]=_[_0x3bfa('0x16')](_0x124bec,function(_0x7bbade){var _0x1797f4={};_0x1797f4[_0x7bbade]=_0x32f681['routeId']?_0x32f681[_0x3bfa('0x17')]:_0x32f681['calleridnum'];return _0x1797f4;});_0x487f3d=_0x32f681[_0x3bfa('0x18')]?_0x32f681[_0x3bfa('0x17')]:_0x32f681['calleridnum'];}var _0x4f0e4f=['id','firstName',_0x3bfa('0x19'),_0x3bfa('0x14'),_0x3bfa('0x1a'),_0x3bfa('0x1b'),'ListId','createdAt',_0x3bfa('0x1c'),_0x3bfa('0x1d')];var _0x2634c7=_['union'](_0x4f0e4f,_0x124bec);BPromise['resolve']()['then'](cmContactRpc['getContacts']({'attributes':_0x2634c7,'where':_0x352199,'phone':_0x487f3d}))[_0x3bfa('0x1e')](function(_0x218b64){_0x1d1cd7=_0x218b64;if(!_[_0x3bfa('0x1f')](_0x1d1cd7)){if(_0x1d1cd7['length']===0x1){_0x24f12e=_0x1d1cd7[0x0];logger[_0x3bfa('0x8')](_0x3bfa('0x20'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id'],_0x24f12e['id']);}else{logger[_0x3bfa('0x8')](_0x3bfa('0x22'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id'],_['map'](_0x1d1cd7,'id')[_0x3bfa('0x23')](','));}return;}else{logger[_0x3bfa('0x8')](_0x3bfa('0x24'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id']);var _0x45eb41={'ListId':_0x2756d2};var _0x423d00=_0xbc9db5[_0x3bfa('0x25')]&&_0xbc9db5[_0x3bfa('0x25')]!=='0'?_0xbc9db5[_0x3bfa('0x25')]:_0x3bfa('0x14');if(_0x50ed33){logger[_0x3bfa('0x8')](_0x3bfa('0x26'),_0x32f681['uniqueid'],_0x58af97['id']);_0x45eb41[_0x423d00]=_[_0x3bfa('0xf')](_0x32f681[_0x3bfa('0x18')])?_0x32f681[_0x3bfa('0x27')]:_0x32f681[_0x3bfa('0x17')];if(_[_0x3bfa('0xf')](_0x32f681[_0x3bfa('0x18')])){_0x45eb41[_0x3bfa('0x28')]=_0x32f681[_0x3bfa('0x29')]&&_0x32f681['calleridname']!==_0x3bfa('0x2a')?_0x32f681[_0x3bfa('0x29')]:_0x3bfa('0x2b');}else{_0x45eb41[_0x3bfa('0x28')]=_0x32f681['destcalleridname']&&_0x32f681[_0x3bfa('0x2c')]!==_0x3bfa('0x2a')?_0x32f681['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0x3bfa('0x1e')](cmContactRpc[_0x3bfa('0x2d')](_0x45eb41))[_0x3bfa('0x1e')](function(_0x252a43){_0x24f12e=_0x252a43;_0x1d1cd7[_0x3bfa('0x2e')](_0x252a43);if(_0x24f12e){logger[_0x3bfa('0x8')](_0x3bfa('0x2f'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id'],_0x24f12e['id']);}return;});}else{logger[_0x3bfa('0x8')](_0x3bfa('0x30'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id']);_0x45eb41[_0x423d00]=_['isNil'](_0x32f681[_0x3bfa('0x18')])?_0x32f681[_0x3bfa('0x27')]:_0x32f681[_0x3bfa('0x17')];if(_[_0x3bfa('0xf')](_0x32f681[_0x3bfa('0x18')])){_0x45eb41[_0x3bfa('0x28')]=_0x32f681[_0x3bfa('0x29')]&&_0x32f681[_0x3bfa('0x29')]!==_0x3bfa('0x2a')?_0x32f681[_0x3bfa('0x29')]:_0x3bfa('0x2b');}else{_0x45eb41['firstName']=_0x32f681['destcalleridname']&&_0x32f681[_0x3bfa('0x2c')]!==''?_0x32f681[_0x3bfa('0x2c')]:_0x3bfa('0x2b');}_0x24f12e=_0x45eb41;_0x1d1cd7[_0x3bfa('0x2e')](_0x45eb41);return;}}})[_0x3bfa('0x1e')](function(){if(_0x93ed94){emit(_0x32f681['uniqueid'],_0x58af97,util[_0x3bfa('0x31')](_0x3bfa('0x32'),_0x93ed94['name']),util['format'](_0x3bfa('0x33'),_0xbc9db5['action']['toLowerCase']()),{'evt':_['merge'](_0x32f681,{'autoCreate':_0x50ed33}),'contact':_0x24f12e===undefined?{}:_0x24f12e,'contacts':_0x1d1cd7[_0x3bfa('0x34')]===0x0?undefined:_0x1d1cd7});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 1ea2a22..7e3c1ce 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 _0x25d3=['user:%s','name','format','jscripty','trigger:%s','exec','integration','routeId','script','parse','query','search','replace','channel','length','every','AllConditions','checkConditions','AnyConditions','some','inspect','account','chat','ChatWebsiteId','operator','value','AccountId','interaction','message','event','queue','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','url','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','undefined','motionChannel','voice','debug','syncAgentDial','hasOwnProperty','merge','variables','Actions','interface','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','render','template\x20not\x20found','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','winApplication','winArguments'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x25d3,0x194));var _0x325d=function(_0xed44e2,_0x44660b){_0xed44e2=_0xed44e2-0x0;var _0x104e72=_0x25d3[_0xed44e2];return _0x104e72;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0x325d('0x0'));var Mustache=require('mustache');var Redis=require(_0x325d('0x1'));var urlforward=require(_0x325d('0x2'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x325d('0x3'));var config=require(_0x325d('0x4'));var logger=require(_0x325d('0x5'))(_0x325d('0x6'));var ami=require(_0x325d('0x7'));config['redis']=_[_0x325d('0x8')](config[_0x325d('0x9')],{'host':_0x325d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x325d('0x9')]));var operators={'equals':function(_0x1c5faf,_0x1b12cf){return _0x1c5faf==_0x1b12cf;},'not_equals':function(_0x27a32b,_0xf4a378){return _0x27a32b!=_0xf4a378;}};var barAndWebActions=[_0x325d('0xb'),_0x325d('0x0'),_0x325d('0xc')];function Trigger(_0xf8b97d){this[_0x325d('0xd')]=_0xf8b97d[_0x325d('0xd')];this[_0x325d('0xe')]=_0xf8b97d[_0x325d('0xe')];this['voiceQueues']=_0xf8b97d[_0x325d('0xf')];this[_0x325d('0x10')]=_0xf8b97d[_0x325d('0x10')];this[_0x325d('0x11')]=_0xf8b97d[_0x325d('0x11')];this[_0x325d('0x12')]=_0xf8b97d[_0x325d('0x12')];this[_0x325d('0x13')]=_0xf8b97d['freshdeskAccounts'];this[_0x325d('0x14')]=_0xf8b97d[_0x325d('0x14')];this['sugarcrmAccounts']=_0xf8b97d['sugarcrmAccounts'];this[_0x325d('0x15')]=_0xf8b97d[_0x325d('0x15')];this[_0x325d('0x16')]=_0xf8b97d[_0x325d('0x16')];this[_0x325d('0x17')]=_0xf8b97d[_0x325d('0x17')];this[_0x325d('0x18')]=_0xf8b97d[_0x325d('0x18')];this['dynamics365Accounts']=_0xf8b97d[_0x325d('0x19')];this[_0x325d('0x1a')]=_0xf8b97d[_0x325d('0x1a')];this[_0x325d('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x325d('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x325d('0x1c')],'zoho':this['zohoAccounts'],'desk':this[_0x325d('0x16')],'vtiger':this[_0x325d('0x17')],'dynamics365':this[_0x325d('0x19')],'freshsales':this[_0x325d('0x1a')],'servicenow':this['servicenowAccounts']};ami['on'](_0x325d('0x1d'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x20'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x21'),this[_0x325d('0x1e')]['bind'](this));ami['on'](_0x325d('0x22'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on']('custom:agentnoanswer',this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x23'),this[_0x325d('0x1e')]['bind'](this));ami['on'](_0x325d('0x24'),this[_0x325d('0x1e')]['bind'](this));ami['on'](_0x325d('0x25'),this[_0x325d('0x1e')]['bind'](this));ami['on'](_0x325d('0x26'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x27'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x28'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x29'),this['syncAgentDial'][_0x325d('0x1f')](this));ami['on'](_0x325d('0x2a'),this['syncAgentDial'][_0x325d('0x1f')](this));ami['on'](_0x325d('0x2b'),this['syncAgentDial']['bind'](this));ami['on'](_0x325d('0x2c'),this[_0x325d('0x1e')]['bind'](this));ami['on'](_0x325d('0x2d'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on']('custom:substatus',this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x2e'),this['syncCustomEvent'][_0x325d('0x1f')](this));ami['on']('custom:outgoingmessage',this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x2f'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on'](_0x325d('0x30'),this[_0x325d('0x1e')][_0x325d('0x1f')](this));ami['on']('custom:offlineMessage',this[_0x325d('0x1e')]['bind'](this));}Trigger[_0x325d('0x31')][_0x325d('0x32')]=function(_0x10e6fe,_0x5cde47,_0x37881b){logger[_0x325d('0x33')](_0x10e6fe,_0x5cde47,JSON[_0x325d('0x34')](_0x37881b));io['to'](_0x10e6fe)['emit'](_0x5cde47,_0x37881b);};Trigger[_0x325d('0x31')][_0x325d('0x1e')]=function(_0x1fb02d){var _0x7e6492=_['clone'](_0x1fb02d);if(typeof _0x7e6492['motionChannel']===_0x325d('0x35')){_0x7e6492[_0x325d('0x36')]=_0x325d('0x37');}logger[_0x325d('0x38')](_0x325d('0x1e'),util['inspect'](_0x7e6492,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x7e6492);};Trigger[_0x325d('0x31')][_0x325d('0x39')]=function(_0xe3227d){if(this[_0x325d('0xe')][_0xe3227d['interface']]){this[_0x325d('0x1e')](_0xe3227d);}};Trigger[_0x325d('0x31')]['checkTriggers']=function(_0xc1d92a){var _0x1c857c;for(var _0x18a4e1 in this['triggers']){if(this[_0x325d('0xd')][_0x325d('0x3a')](_0x18a4e1)){if(this['triggers'][_0x18a4e1]['status']){_0x1c857c=this['checkTrigger'](this['triggers'][_0x18a4e1],_0xc1d92a);if(_0x1c857c){_[_0x325d('0x3b')](_0xc1d92a,_0xc1d92a[_0x325d('0x3c')]);for(var _0x39457e=0x0,_0x385b28,_0x37765c,_0x477b11;_0x39457e0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x32ba12,_0x3a9b2b){var _0x343e79=function(_0x11c4b8){while(--_0x11c4b8){_0x32ba12['push'](_0x32ba12['shift']());}};_0x343e79(++_0x3a9b2b);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 26276f5..fc4f34f 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 _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 +var _0x03f0=['nameField','idField','indexOf','content','ticketType','incidents','assign','getString','Descriptions','Fields','phonecall','callDirection','queue','phonecalls','/contacts(','lastIndexOf','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\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...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','modernAuthentication','CloudProvider','tenantId','data5','clientId','remoteUri','username','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','4.0','body','odata-entityid','substring','enduserId','message','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type'];(function(_0x5e263f,_0x37f92c){var _0x48e40b=function(_0x25b0e6){while(--_0x25b0e6){_0x5e263f['push'](_0x5e263f['shift']());}};_0x48e40b(++_0x37f92c);}(_0x03f0,0x16a));var _0x003f=function(_0x477fa6,_0x5f19b7){_0x477fa6=_0x477fa6-0x0;var _0x177936=_0x03f0[_0x477fa6];return _0x177936;};'use strict';var _=require(_0x003f('0x0'));var rp=require(_0x003f('0x1'));var util=require(_0x003f('0x2'));var intUtil=require('./util');var md5=require(_0x003f('0x3'));var Redis=require(_0x003f('0x4'));var logger=require('../../../../config/logger')(_0x003f('0x5'));var config=require(_0x003f('0x6'));config[_0x003f('0x7')]=_[_0x003f('0x8')](config[_0x003f('0x7')],{'host':_0x003f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x003f('0x7')]));function getAuthToken(_0x356452,_0x93e81b,_0x100565){if(_0x356452[_0x003f('0xa')]){_0x356452['remoteUri']=_0x356452[_0x003f('0xb')]['data7'];_0x356452[_0x003f('0xc')]=_0x356452[_0x003f('0xb')]['data2'];return Promise['resolve'](_0x356452[_0x003f('0xb')][_0x003f('0xd')]);}var _0x5a5eef={'method':'POST','uri':_0x93e81b,'form':{'client_id':_0x356452[_0x003f('0xe')],'resource':_0x356452[_0x003f('0xf')],'username':_0x356452[_0x003f('0x10')],'password':_0x356452['password'],'grant_type':'password','client_secret':_0x356452[_0x003f('0x11')]},'json':!![]};return rp(_0x5a5eef)[_0x003f('0x12')](function(_0x5468cd){return _0x5468cd[_0x003f('0x13')];})[_0x003f('0x14')](function(_0x3ee1cb){logger[_0x003f('0x15')]('['+[_0x100565[_0x003f('0x16')]()]+_0x003f('0x17'));return _0x3ee1cb['message'];});}function getUser(_0x31df6b,_0x1f2db1,_0x570df8,_0x4e4f55,_0x3c7abd,_0x5f58e9){return new Promise(function(_0x15ea17,_0x4153b2){return getAuthToken(_0x1f2db1,_0x4e4f55,_0x5f58e9)[_0x003f('0x12')](function(_0x3f1488){var _0x2d31c9={'method':_0x003f('0x18'),'uri':_0x3c7abd+_0x003f('0x19'),'headers':{'Authorization':_0x003f('0x1a')+_0x3f1488,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d31c9);})[_0x003f('0x12')](function(_0x43f7ab){var _0x1a58e3=_0x43f7ab['value'];var _0x58e54a=![];var _0x571056=null;if(!_[_0x003f('0x1b')](_0x570df8)){if(intUtil[_0x003f('0x1c')](_0x570df8['email'])){_0x31df6b[_0x003f('0x1d')]=_0x570df8[_0x003f('0x1e')];for(_0x571056=0x0;_0x571056<_0x1a58e3[_0x003f('0x1f')];_0x571056++){if(_0x1a58e3[_0x571056][_0x003f('0x20')]===_0x570df8['email']&&!_0x1a58e3[_0x571056][_0x003f('0x21')]){_0x58e54a=!![];logger['info']('['+[_0x5f58e9[_0x003f('0x16')]()]+_0x003f('0x22')+_0x1a58e3[_0x571056][_0x003f('0x23')]+'!');_0x31df6b[_0x003f('0x24')]=_0x1a58e3[_0x571056][_0x003f('0x23')];}}}}if(!_0x58e54a){logger[_0x003f('0x25')]('['+[_0x5f58e9[_0x003f('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x31df6b[_0x003f('0x1d')]=_0x1f2db1[_0x003f('0x10')];for(_0x571056=0x0;_0x571056<_0x1a58e3[_0x003f('0x1f')];_0x571056++){if(_0x1a58e3[_0x571056][_0x003f('0x20')]===_0x1f2db1[_0x003f('0x10')]){_0x31df6b[_0x003f('0x24')]=_0x1a58e3[_0x571056]['systemuserid'];}}}_0x15ea17(_0x31df6b);})[_0x003f('0x14')](function(_0x3e226c){_0x4153b2(_0x3e226c['message']);});});}function createEndUser(_0x5c7e89,_0x3c76cf,_0x2c0fd5,_0x2015bb,_0x44b546,_0x167673,_0x3569a3){return new Promise(function(_0x1954d8,_0x376516){return getAuthToken(_0x3c76cf,_0x2c0fd5,_0x167673)[_0x003f('0x12')](function(_0x3213ca){var _0x48fbd4=_0x167673[_0x003f('0x26')]()===_0x003f('0x27')?_0x44b546['destcalleridnum']:_0x44b546[_0x003f('0x28')];var _0x5d958f={'method':_0x003f('0x29'),'uri':_0x2015bb+_0x003f('0x2a'),'body':{'fullname':_0x48fbd4,'firstname':_0x48fbd4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x003f('0x2b')+_0x5c7e89[_0x003f('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x3213ca,'OData-Version':_0x003f('0x2c')},'json':!![],'resolveWithFullResponse':!![]};_0x5d958f[_0x003f('0x2d')][_0x3569a3]=_0x48fbd4;return rp(_0x5d958f);})[_0x003f('0x12')](function(_0x17b21c){var _0x3f1fd1=_0x17b21c['headers'][_0x003f('0x2e')];var _0x5a4b0e=_0x3f1fd1[_0x003f('0x2f')](_0x3f1fd1['lastIndexOf']('(')+0x1,_0x3f1fd1['lastIndexOf'](')'));_0x5c7e89[_0x003f('0x30')]=_0x5a4b0e;_0x1954d8(_0x5c7e89);})[_0x003f('0x14')](function(_0x1570e7){_0x376516(_0x1570e7[_0x003f('0x31')]);});});}function getEndUser(_0x3d4982,_0x302d74,_0x5272de,_0x73d97a,_0x3c510d,_0x2660f3,_0x1f1adf,_0x27e5e9){var _0xe0af84=_0x2660f3['toLowerCase']()===_0x003f('0x27')?_0x3c510d['destcalleridnum']:_0x3c510d[_0x003f('0x28')];return getAuthToken(_0x302d74,_0x5272de,_0x2660f3)[_0x003f('0x12')](function(_0x50fc68){_0x27e5e9=_0x27e5e9?_0x27e5e9:'telephone1';var _0x3c8590={'method':_0x003f('0x18'),'uri':_0x73d97a+_0x003f('0x32')+_0x27e5e9+_0x003f('0x33')+_0x27e5e9+_0x003f('0x34')+_0xe0af84[_0x003f('0x35')]('+','%2b')+'\x27','headers':{'Authorization':_0x003f('0x1a')+_0x50fc68,'If-None-Match':null,'OData-Version':_0x003f('0x2c')},'json':!![]};return rp(_0x3c8590);})[_0x003f('0x12')](function(_0x4e20c2){var _0x294830=![];if(!_0x4e20c2)return _0x294830;var _0x3f6819=_0x4e20c2[_0x003f('0x36')];for(var _0x42cac1=0x0;_0x42cac1<_0x3f6819[_0x003f('0x1f')];_0x42cac1++){if(_0x3f6819[_0x42cac1][_0x27e5e9]===_0xe0af84){_0x294830=!![];_0x3d4982['enduserId']=_0x3f6819[_0x42cac1]['contactid'];}}return _0x294830;})['then'](function(_0xb654e6){if(_0xb654e6)return _0x3d4982;if(_0x1f1adf===_0x003f('0x37')){logger[_0x003f('0x25')]('['+[_0x2660f3[_0x003f('0x16')]()]+_0x003f('0x38'));return _0x3d4982;}return createEndUser(_0x3d4982,_0x302d74,_0x5272de,_0x73d97a,_0x3c510d,_0x2660f3,_0x27e5e9)[_0x003f('0x12')](function(_0x5d5ac2){logger['info']('['+[_0x2660f3[_0x003f('0x16')]()]+_0x003f('0x39'),_0x5d5ac2[_0x003f('0x30')]);return _0x5d5ac2;});});}function getCustomFields(_0x12f7f1,_0x414fb0,_0x21c9f1){var _0x27425f={};if(_0x12f7f1[_0x003f('0x1f')]>0x0){_[_0x003f('0x3a')](_0x12f7f1,function(_0x29ae68){if(_[_0x003f('0x3b')]([_0x003f('0x3c'),'picklist'],_0x29ae68[_0x003f('0x3d')])&&_0x29ae68[_0x003f('0x3e')]&&!_0x29ae68['customField']){var _0x53291a=_0x29ae68[_0x003f('0x3f')][_0x003f('0x26')]();var _0x18ede6=_0x53291a[_0x003f('0x2f')](0x0,_0x53291a[_0x003f('0x40')]('_'));var _0x5e793d=_0x53291a[_0x003f('0x2f')](_0x53291a[_0x003f('0x40')]('_')+0x1);if(_0x18ede6===_0x21c9f1){_0x27425f[_0x5e793d]=_0x29ae68[_0x003f('0x41')];}}});}return _0x27425f;}function getTicket(_0xf602cc,_0xc094cb,_0x21342b,_0x5b6bbb,_0x2d4c8c,_0x4e0307,_0x5e6a54){return new Promise(function(_0x923ed2,_0x4b3d0e){var _0xeaa911;return getAuthToken(_0xc094cb,_0x21342b,_0x5e6a54)[_0x003f('0x12')](function(_0x473514){if(_0x4e0307[_0x003f('0x42')]==='incident'){_0xeaa911={'method':'POST','uri':_0x5b6bbb+_0x003f('0x43'),'body':Object[_0x003f('0x44')]({},{'title':intUtil[_0x003f('0x45')](_0x4e0307['Subjects'],_0x2d4c8c,'\x20'),'description':intUtil[_0x003f('0x45')](_0x4e0307[_0x003f('0x46')],_0x2d4c8c,'\x0a'),'customerid_contact@odata.bind':_0xf602cc[_0x003f('0x30')]?'/contacts('+_0xf602cc[_0x003f('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xf602cc[_0x003f('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x4e0307[_0x003f('0x47')],_0x2d4c8c,_0x4e0307[_0x003f('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x473514,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4e0307['ticketType']===_0x003f('0x48')){var _0x1ac7ba=_0xf602cc['enduserId']?[{'partyid_systemuser@odata.bind':_0x003f('0x2b')+_0xf602cc[_0x003f('0x24')]+')','participationtypemask':_0xf602cc[_0x003f('0x49')]===_0x003f('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xf602cc['enduserId']+')','participationtypemask':_0xf602cc['callDirection']===_0x003f('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xf602cc['userId']+')','participationtypemask':_0xf602cc[_0x003f('0x49')]===_0x003f('0x4a')?0x2:0x1}];_0xeaa911={'method':_0x003f('0x29'),'uri':_0x5b6bbb+_0x003f('0x4b'),'body':Object[_0x003f('0x44')]({},{'subject':intUtil[_0x003f('0x45')](_0x4e0307['Subjects'],_0x2d4c8c,'\x20'),'phonenumber':String(_0x2d4c8c[_0x003f('0x28')]),'description':intUtil[_0x003f('0x45')](_0x4e0307[_0x003f('0x46')],_0x2d4c8c,'\x0a'),'regardingobjectid_contact@odata.bind':_0xf602cc[_0x003f('0x30')]?_0x003f('0x4c')+_0xf602cc[_0x003f('0x30')]+')':undefined,'ownerid@odata.bind':_0x003f('0x2b')+_0xf602cc[_0x003f('0x24')]+')','directioncode':_0xf602cc[_0x003f('0x49')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1ac7ba},getCustomFields(_0x4e0307[_0x003f('0x47')],_0x2d4c8c,_0x4e0307[_0x003f('0x42')])),'headers':{'Authorization':_0x003f('0x1a')+_0x473514,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xeaa911);})[_0x003f('0x12')](function(_0x4f31e0){var _0x362a1b=_0x4f31e0['headers'][_0x003f('0x2e')];var _0x43335a=_0x362a1b[_0x003f('0x2f')](_0x362a1b[_0x003f('0x4d')]('(')+0x1,_0x362a1b[_0x003f('0x4d')](')'));_0xf602cc[_0x003f('0x4e')]=_0x43335a;_0x923ed2(_0xf602cc);})['catch'](function(_0x3aae20){_0x4b3d0e(_0x3aae20[_0x003f('0x31')]);});});}function emit(_0xe42d6c,_0x4e241e,_0xaed7f3,_0x2cc43b){var _0x77139e={'uri':util['format'](_0x003f('0x4f'),_0xe42d6c,_0xaed7f3,_0x2cc43b)};io['to'](util[_0x003f('0x50')](_0x003f('0x51'),_0x4e241e))[_0x003f('0x52')]('trigger:browser:url',_0x77139e);}exports['cs']=function(_0xcb5c2b,_0xc378be,_0x23dbe9,_0x1d7409,_0xe4d459,_0x3fef7c,_0x43d7df,_0x247722){var _0x49ffb5={};_0x3fef7c[_0x003f('0xf')]=_0x3fef7c[_0x003f('0xa')]?intUtil[_0x003f('0x53')](_0x3fef7c['CloudProvider']['data7']):intUtil[_0x003f('0x53')](_0x3fef7c['remoteUri']);_0x3fef7c[_0x003f('0x54')]=intUtil['stripTrailingSlash'](_0x3fef7c[_0x003f('0x54')]);_0x49ffb5[_0x003f('0x49')]=_0x247722===_0x003f('0x4a')||_0x247722===_0x003f('0x55')?_0x003f('0x4a'):_0x003f('0x27');var _0x20cab6=_0x3fef7c[_0x003f('0xa')]?util['format'](_0x003f('0x56'),_0x3fef7c[_0x003f('0xb')][_0x003f('0x57')]):util['format']('%s/api/data/v9.0/',_0x3fef7c['remoteUri']);var _0x3bb643=util[_0x003f('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3fef7c[_0x003f('0xc')]);var _0x2a364e=util[_0x003f('0x50')](_0x003f('0x58'),_0x3fef7c[_0x003f('0x54')],_0xc378be[_0x003f('0x59')],md5(_0xc378be['uniqueid']));if(_0xe4d459&&_0xe4d459['monitor_format']){logger['info'](_0x003f('0x5a'),_0x003f('0x5b'));_0xc378be[_0x003f('0x5c')]=_0x2a364e;}else if(_0x43d7df&&_0x43d7df['recordingFormat']&&_0x43d7df[_0x003f('0x5d')]!==_0x003f('0x5e')){logger[_0x003f('0x25')](_0x003f('0x5f'),_0x003f('0x5b'));_0xc378be[_0x003f('0x5c')]=_0x2a364e;}else{_0xc378be['recordingURL']='';}return getUser(_0x49ffb5,_0x3fef7c,_0x1d7409,_0x3bb643,_0x20cab6,_0x247722)[_0x003f('0x12')](function(_0x2c76b9){logger[_0x003f('0x25')]('['+_0x247722[_0x003f('0x16')]()+_0x003f('0x60'),_0x2c76b9[_0x003f('0x24')]);logger['info']('['+_0x247722[_0x003f('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x2c76b9[_0x003f('0x1d')]);return getEndUser(_0x2c76b9,_0x3fef7c,_0x3bb643,_0x20cab6,_0xc378be,_0x247722,_0x23dbe9[_0x003f('0x61')],_0x23dbe9[_0x003f('0x62')]);})['then'](function(_0x386589){logger['info']('['+_0x247722['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x386589[_0x003f('0x30')]);logger[_0x003f('0x25')]('['+_0x247722['toUpperCase']()+_0x003f('0x63'),_0xc378be[_0x003f('0x28')]);return getTicket(_0x386589,_0x3fef7c,_0x3bb643,_0x20cab6,_0xc378be,_0x23dbe9,_0x247722);})[_0x003f('0x12')](function(_0x2e8eac){logger[_0x003f('0x25')](util[_0x003f('0x50')]('['+_0x247722['toUpperCase']()+_0x003f('0x64'),_0x23dbe9['ticketType'],_0x2e8eac['ticketId']));logger[_0x003f('0x25')](util[_0x003f('0x50')]('['+_0x247722['toUpperCase']()+_0x003f('0x65'),_0x247722));if(_0x247722!==_0x003f('0x55')&&_0x23dbe9[_0x003f('0x66')]){logger[_0x003f('0x25')]('['+_0x247722[_0x003f('0x16')]()+']',_0x003f('0x67'));emit(_0x3fef7c['remoteUri'],_0x1d7409['name'],_0x23dbe9[_0x003f('0x42')],_0x2e8eac[_0x003f('0x4e')]);}})[_0x003f('0x14')](function(_0x53794b){logger[_0x003f('0x15')]('['+_0x247722['toUpperCase']()+_0x003f('0x68'),_0x53794b['message']);console[_0x003f('0x15')](_0x003f('0x69'),_0x53794b);});}; \ 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 2a8e9bd..6df3b52 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 _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 +var _0xb359=['lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','keyBy','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','find','contact','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','[HTTP]','GET','map','length','forEach','string','nameField','content','includes','picklist','type','idField','customField','variable','variableName','push','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','stringify','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0xb359,0x178));var _0x9b35=function(_0x43d6c0,_0x3b4a61){_0x43d6c0=_0x43d6c0-0x0;var _0x30d273=_0xb359[_0x43d6c0];return _0x30d273;};'use strict';var _=require(_0x9b35('0x0'));var rp=require(_0x9b35('0x1'));var md5=require(_0x9b35('0x2'));var util=require('util');var Redis=require(_0x9b35('0x3'));var intUtil=require(_0x9b35('0x4'));var config=require(_0x9b35('0x5'));var logger=require(_0x9b35('0x6'))(_0x9b35('0x7'));config[_0x9b35('0x8')]=_[_0x9b35('0x9')](config[_0x9b35('0x8')],{'host':_0x9b35('0xa'),'port':0x18eb});var io=require(_0x9b35('0xb'))(new Redis(config[_0x9b35('0x8')]));var headers={'Content-Type':_0x9b35('0xc'),'Accept':_0x9b35('0xc')};function emit(_0x26b3fa,_0x546993,_0x551143){io['to'](_0x26b3fa)[_0x9b35('0xd')](_0x546993,_0x551143);}function getTicket(_0x3f1bbb,_0x39302b,_0x17e401,_0x31905d,_0x30e996){logger[_0x9b35('0xe')](_0x9b35('0xf'));var _0x42d461=_['merge']({'responder_id':_0x39302b['id'],'requester_id':_0x17e401['id'],'name':util[_0x9b35('0x10')](_0x9b35('0x11'),_0x30e996[_0x9b35('0x12')]),'phone':_0x30e996['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9b35('0x13')](_0x31905d[_0x9b35('0x14')],_0x30e996,'\x20'),'description':intUtil[_0x9b35('0x13')](_0x31905d[_0x9b35('0x15')],_0x30e996,_0x9b35('0x16')),'tags':getTags(_0x31905d[_0x9b35('0x17')],'name')},getCustomFields(_0x31905d[_0x9b35('0x18')],_0x30e996));_0x42d461[_0x9b35('0x19')]=_['mapValues'](_[_0x9b35('0x1a')](_0x42d461[_0x9b35('0x19')],'id'),'value');return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x1b'),_0x3f1bbb['remoteUri']),'method':_0x9b35('0x1c'),'body':_0x42d461})[_0x9b35('0x1d')](function(_0x4458e6){logger[_0x9b35('0xe')](_0x9b35('0x1e'));return _0x4458e6;});}function getUser(_0x37a256,_0x1c9693){if(intUtil[_0x9b35('0x1f')](_0x1c9693)){return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x20'),_0x37a256[_0x9b35('0x21')]),'qs':{'email':_0x1c9693}})[_0x9b35('0x1d')](function(_0x2ed78d){if(_0x2ed78d['length']){logger['info']('Agent\x20found!');return _[_0x9b35('0x22')](_0x2ed78d,function(_0x195a50){return _0x195a50[_0x9b35('0x23')]['email']===_0x1c9693;});}else{logger[_0x9b35('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9b35('0x10')]('%s/api/v2/agents/me',_0x37a256[_0x9b35('0x21')])})[_0x9b35('0x1d')](function(_0x817181){logger[_0x9b35('0xe')]('Admin\x20account\x20selected.');return _0x817181;});}});}else{logger[_0x9b35('0xe')](_0x9b35('0x24'));return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x25'),_0x37a256[_0x9b35('0x21')])})['then'](function(_0x2e0d71){logger[_0x9b35('0xe')](_0x9b35('0x26'));return _0x2e0d71;});}}function getEndUser(_0x32578a,_0x6fc6d2,_0x1aab45){logger[_0x9b35('0xe')](_0x9b35('0x27'),_0x1aab45);return request({'uri':util['format'](_0x9b35('0x28'),_0x32578a[_0x9b35('0x21')]),'qs':{'phone':_0x1aab45}})[_0x9b35('0x1d')](function(_0x4eac8f){if(_0x4eac8f['length']){logger['info'](_0x9b35('0x29'));return _['find'](_0x4eac8f,{'phone':_0x1aab45});}else{logger['info'](_0x9b35('0x2a'));return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x28'),_0x32578a[_0x9b35('0x21')]),'method':_0x9b35('0x1c'),'body':{'name':_0x6fc6d2,'phone':_0x1aab45}})[_0x9b35('0x1d')](function(_0x4af75b){logger['info'](_0x9b35('0x2b'));return _0x4af75b;});}});}function getAuth(_0x41c221){return util[_0x9b35('0x10')]('Basic\x20%s',new Buffer(_0x41c221[_0x9b35('0x2c')]+':X')[_0x9b35('0x2d')](_0x9b35('0x2e')));}function request(_0x3b04d3){logger['debug'](_0x9b35('0x2f'),JSON['stringify'](_0x3b04d3));return rp(_['defaults'](_0x3b04d3,{'method':_0x9b35('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x503a6c,_0x343f7f){var _0x1bbffa=[];if(_0x503a6c&&_0x503a6c['length']>0x0){_0x1bbffa=_[_0x9b35('0x31')](_0x503a6c,_0x343f7f);}return _0x1bbffa;}function getCustomFields(_0x2a449d,_0x4b9586){var _0x494e09=[];var _0x19e773={'custom_fields':[]};if(_0x2a449d[_0x9b35('0x32')]>0x0){_[_0x9b35('0x33')](_0x2a449d,function(_0x4f6402){if(_['includes']([_0x9b35('0x34'),'picklist'],_0x4f6402['type'])&&_0x4f6402[_0x9b35('0x35')]&&!_0x4f6402['customField']){_0x19e773[_0x4f6402['nameField']['toLowerCase']()]=_0x4f6402[_0x9b35('0x36')][_0x9b35('0x2d')]();}else if(_[_0x9b35('0x37')](['string',_0x9b35('0x38')],_0x4f6402[_0x9b35('0x39')])&&_0x4f6402[_0x9b35('0x3a')]&&_0x4f6402[_0x9b35('0x3b')]){_0x19e773['custom_fields']['push']({'id':_0x4f6402[_0x9b35('0x3a')],'value':_0x4f6402[_0x9b35('0x36')][_0x9b35('0x2d')]()});}else if(_0x4f6402[_0x9b35('0x39')]===_0x9b35('0x3c')&&_0x4f6402[_0x9b35('0x3d')]&&_0x4f6402['idField']&&_0x4f6402[_0x9b35('0x3b')]){_0x4b9586[_0x4f6402[_0x9b35('0x3d')]]&&_0x19e773[_0x9b35('0x19')][_0x9b35('0x3e')]({'id':_0x4f6402[_0x9b35('0x3a')],'value':_0x4b9586[_0x4f6402[_0x9b35('0x3d')]][_0x9b35('0x2d')]()});}else if(_0x4f6402[_0x9b35('0x39')]===_0x9b35('0x3f')&&_0x4f6402[_0x9b35('0x40')]&&_0x4f6402['Variable'][_0x9b35('0x41')]&&_0x4f6402[_0x9b35('0x3a')]&&_0x4f6402[_0x9b35('0x3b')]){_0x4b9586[_0x4f6402[_0x9b35('0x40')][_0x9b35('0x41')]['toLowerCase']()]&&_0x19e773[_0x9b35('0x19')][_0x9b35('0x3e')]({'id':_0x4f6402[_0x9b35('0x3a')],'value':_0x4b9586[_0x4f6402[_0x9b35('0x40')][_0x9b35('0x41')]['toLowerCase']()][_0x9b35('0x2d')]()});}});}return _0x19e773;}exports['queue']=function(_0x17335b,_0x13e03b,_0x151bbe,_0x1ee517,_0x137cb8,_0x5add6e){var _0x3c1f3d,_0x75f662;_0x5add6e[_0x9b35('0x21')]=intUtil[_0x9b35('0x42')](_0x5add6e[_0x9b35('0x21')]);_0x5add6e[_0x9b35('0x43')]=intUtil[_0x9b35('0x42')](_0x5add6e['serverUrl']);if(_0x137cb8&&_0x137cb8[_0x9b35('0x44')]){logger[_0x9b35('0xe')]('[QUEUE]',_0x9b35('0x45'));_0x13e03b[_0x9b35('0x46')]=util[_0x9b35('0x10')](_0x9b35('0x47'),_0x5add6e[_0x9b35('0x43')],_0x13e03b[_0x9b35('0x48')],md5(_0x13e03b[_0x9b35('0x48')]));}else{_0x13e03b[_0x9b35('0x46')]='';}headers[_0x9b35('0x49')]=getAuth(_0x5add6e);return getUser(_0x5add6e,_0x1ee517[_0x9b35('0x4a')])[_0x9b35('0x1d')](function(_0x122d36){_0x3c1f3d=_0x122d36;logger[_0x9b35('0xe')]('The\x20User\x20ID\x20is:',_0x3c1f3d['id']);return getEndUser(_0x5add6e,_0x13e03b['calleridname'],_0x13e03b[_0x9b35('0x4b')]);})[_0x9b35('0x1d')](function(_0x1721bf){_0x75f662=_0x1721bf;logger['info'](_0x9b35('0x4c'),_0x75f662['id']);return getTicket(_0x5add6e,_0x3c1f3d,_0x75f662,_0x151bbe,_0x13e03b);})[_0x9b35('0x1d')](function(_0xa9ef26){if(_0xa9ef26&&_0xa9ef26['id']){logger[_0x9b35('0xe')](_0x9b35('0x1e'));logger[_0x9b35('0xe')]('The\x20Ticket\x20ID\x20is:',_0xa9ef26['id']);logger[_0x9b35('0xe')](_0x9b35('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b35('0x10')](_0x9b35('0x4e'),_0x1ee517['name']),_0x9b35('0x4f'),{'uri':util[_0x9b35('0x10')](_0x9b35('0x50'),_0x5add6e[_0x9b35('0x21')],_0xa9ef26['id'])});}})[_0x9b35('0x51')](function(_0x4c378b){logger[_0x9b35('0x52')]('[QUEUE]',JSON['stringify'](_0x4c378b));});};exports['outbound']=function(_0x5be49a,_0x542d44,_0x2ba3e8,_0x50d402,_0x3194d7,_0x2ca85d,_0xa78189){var _0xc837bc,_0x4b98dc;_0x2ca85d['remoteUri']=intUtil['stripTrailingSlash'](_0x2ca85d[_0x9b35('0x21')]);_0x2ca85d[_0x9b35('0x43')]=intUtil[_0x9b35('0x42')](_0x2ca85d[_0x9b35('0x43')]);if(_0xa78189&&_0xa78189[_0x9b35('0x53')]&&_0xa78189[_0x9b35('0x53')]!==_0x9b35('0x54')){logger['info'](_0x9b35('0x55'),_0x9b35('0x45'));_0x542d44[_0x9b35('0x46')]=util['format'](_0x9b35('0x47'),_0x2ca85d[_0x9b35('0x43')],_0x542d44[_0x9b35('0x48')],md5(_0x542d44[_0x9b35('0x48')]));}headers[_0x9b35('0x49')]=getAuth(_0x2ca85d);return getUser(_0x2ca85d,_0x50d402[_0x9b35('0x4a')])[_0x9b35('0x1d')](function(_0x1d00bd){_0xc837bc=_0x1d00bd;logger['info'](_0x9b35('0x56'),_0xc837bc['id']);return getEndUser(_0x2ca85d,_0x542d44['destcalleridname'],_0x542d44[_0x9b35('0x57')]);})['then'](function(_0x40efc9){_0x4b98dc=_0x40efc9;logger[_0x9b35('0xe')](_0x9b35('0x4c'),_0x4b98dc['id']);return getTicket(_0x2ca85d,_0xc837bc,_0x4b98dc,_0x2ba3e8,_0x542d44);})[_0x9b35('0x1d')](function(_0x2ba26d){if(_0x2ba26d&&_0x2ba26d['id']){logger['info'](_0x9b35('0x1e'));logger[_0x9b35('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2ba26d['id']);logger['info'](_0x9b35('0x55'),_0x9b35('0x58'));emit(util[_0x9b35('0x10')](_0x9b35('0x4e'),_0x50d402['name']),_0x9b35('0x4f'),{'uri':util['format'](_0x9b35('0x50'),_0x2ca85d['remoteUri'],_0x2ba26d['id'])});}})[_0x9b35('0x51')](function(_0x11af33){logger[_0x9b35('0x52')](_0x9b35('0x55'),JSON[_0x9b35('0x59')](_0x11af33));});};exports[_0x9b35('0x5a')]=function(_0x2904b9,_0x1c38e9,_0x1775b2,_0xd38fd1,_0x510aee,_0x7755e){var _0x436cd2,_0x369e45;_0x7755e['remoteUri']=intUtil[_0x9b35('0x42')](_0x7755e[_0x9b35('0x21')]);_0x7755e[_0x9b35('0x43')]=intUtil[_0x9b35('0x42')](_0x7755e['serverUrl']);if(_0x510aee&&_0x510aee[_0x9b35('0x44')]){logger[_0x9b35('0xe')]('['+_0x1c38e9[_0x9b35('0x5b')][_0x9b35('0x5c')]()+']','Recording\x20is\x20enabled!');_0x1c38e9['recordingURL']=util[_0x9b35('0x10')](_0x9b35('0x47'),_0x7755e[_0x9b35('0x43')],_0x1c38e9[_0x9b35('0x48')],md5(_0x1c38e9[_0x9b35('0x48')]));}else{_0x1c38e9[_0x9b35('0x46')]='';}headers[_0x9b35('0x49')]=getAuth(_0x7755e);return getUser(_0x7755e,'')[_0x9b35('0x1d')](function(_0x37d3aa){_0x436cd2=_0x37d3aa;logger['info'](_0x9b35('0x56'),_0x436cd2['id']);return getEndUser(_0x7755e,_0x1c38e9[_0x9b35('0x12')],_0x1c38e9['calleridnum']);})[_0x9b35('0x1d')](function(_0x1739ca){_0x369e45=_0x1739ca;logger[_0x9b35('0xe')](_0x9b35('0x4c'),_0x369e45['id']);return getTicket(_0x7755e,_0x436cd2,_0x369e45,_0x1775b2,_0x1c38e9);})['then'](function(_0x539901){if(_0x539901){logger[_0x9b35('0xe')](_0x9b35('0x1e'));logger[_0x9b35('0xe')](_0x9b35('0x5d'),_0x539901['id']);}})[_0x9b35('0x51')](function(_0x5384fa){logger[_0x9b35('0x52')]('['+_0x1c38e9[_0x9b35('0x5b')][_0x9b35('0x5c')]()+']',JSON['stringify'](_0x5384fa));});}; \ 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 90fc267..1f62267 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 _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 +var _0x2b24=['destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','Admin\x20selected','userEmail','catch','GET','/api/lookup?q=','&f=','&entities=contact','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound'];(function(_0x5393ea,_0x3526d9){var _0x58b30f=function(_0x35e871){while(--_0x35e871){_0x5393ea['push'](_0x5393ea['shift']());}};_0x58b30f(++_0x3526d9);}(_0x2b24,0x104));var _0x42b2=function(_0x2a119b,_0x5b7d64){_0x2a119b=_0x2a119b-0x0;var _0x493775=_0x2b24[_0x2a119b];return _0x493775;};'use strict';var _=require(_0x42b2('0x0'));var rp=require(_0x42b2('0x1'));var md5=require(_0x42b2('0x2'));var util=require(_0x42b2('0x3'));var moment=require(_0x42b2('0x4'));var Promise=require(_0x42b2('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x42b2('0x6'));var logger=require(_0x42b2('0x7'))(_0x42b2('0x8'));config['redis']=_['defaults'](config[_0x42b2('0x9')],{'host':_0x42b2('0xa'),'port':0x18eb});var io=require(_0x42b2('0xb'))(new Redis(config[_0x42b2('0x9')]));function getAdminId(_0x358480,_0x1ba4eb,_0x3e3abc,_0x4b8b2b){return new Promise(function(_0x3328fb,_0x45f0b9){var _0x48ff92=![];var _0x349eb6={'method':'GET','uri':_0x4b8b2b+_0x42b2('0xc'),'json':!![]};_0x349eb6[_0x42b2('0xd')]=_0x3e3abc;logger[_0x42b2('0xe')](_0x42b2('0xf'));return rp(_0x349eb6)['then'](function(_0x3fadfe){if(_0x3fadfe){var _0x4184e1=_0x3fadfe[_0x42b2('0x10')];var _0x25d651=null;for(_0x25d651=0x0;_0x25d651<_0x4184e1[_0x42b2('0x11')];_0x25d651++){if(_0x4184e1[_0x25d651][_0x42b2('0x12')]===_0x358480[_0x42b2('0x13')]){_0x358480['adminId']=_0x4184e1[_0x25d651]['id'];_0x48ff92=!![];}}if(_0x48ff92){logger[_0x42b2('0xe')]('Admin\x20found:',_0x358480[_0x42b2('0x14')]);_0x3328fb(_0x358480);}else{_0x45f0b9({'statusCode':0x194,'message':_0x42b2('0x15')});}}else{_0x45f0b9({'statusCode':0x194,'message':_0x42b2('0x15')});}})['catch'](function(_0x508b4c){logger[_0x42b2('0x16')]('['+[_0x1ba4eb[_0x42b2('0x17')]()]+']',_0x508b4c[_0x42b2('0x18')]);_0x45f0b9(_0x508b4c);});});}function getUser(_0x341294,_0x7e443b,_0x2fb1a9){return function(_0x57b1a4){return new Promise(function(_0x5af522,_0x31dcb1){var _0x48fd45={'method':'GET','uri':_0x2fb1a9+_0x42b2('0xc'),'json':!![]};_0x48fd45[_0x42b2('0xd')]=_0x7e443b;logger[_0x42b2('0xe')](_0x42b2('0x19'));return rp(_0x48fd45)['then'](function(_0x24060d){if(_0x24060d){var _0xd5ca29=_0x24060d['users'];var _0x20f58c=![];var _0x3ea4b6=null;if(_0x57b1a4['agentEmail']!==null){logger[_0x42b2('0xe')]('Getting\x20user\x20with\x20email',_0x57b1a4[_0x42b2('0x1a')]);_0x57b1a4['userEmail']=_0x57b1a4['agentEmail'];for(_0x3ea4b6=0x0;_0x3ea4b6<_0xd5ca29[_0x42b2('0x11')];_0x3ea4b6++){if(_0xd5ca29[_0x3ea4b6][_0x42b2('0x12')]===_0x57b1a4[_0x42b2('0x1a')]){_0x20f58c=!![];_0x57b1a4[_0x42b2('0x1b')]=_0xd5ca29[_0x3ea4b6]['id'];logger[_0x42b2('0xe')]('User\x20found:',_0x57b1a4[_0x42b2('0x1b')]);}}}if(!_0x20f58c){logger['info'](_0x42b2('0x1c'));_0x57b1a4[_0x42b2('0x1d')]=_0x57b1a4[_0x42b2('0x13')];_0x57b1a4[_0x42b2('0x1b')]=_0x57b1a4['adminId'];_0x20f58c=!![];}if(_0x20f58c){_0x5af522(_0x57b1a4);}else{_0x31dcb1({'statusCode':0x194,'message':_0x42b2('0x15')});}}else{_0x31dcb1({'statusCode':0x194,'message':_0x42b2('0x15')});}})[_0x42b2('0x1e')](function(_0x2df06b){logger[_0x42b2('0x16')]('['+[_0x341294[_0x42b2('0x17')]()]+']',_0x2df06b[_0x42b2('0x18')]);_0x31dcb1(_0x2df06b);});});};}function searchContact(_0x308c9c,_0x409598,_0x232606,_0x480026){return new Promise(function(_0xc3ba4,_0x399029){var _0xa35f34={'method':_0x42b2('0x1f'),'headers':_0x409598,'uri':_0x308c9c+_0x42b2('0x20')+_0x480026+_0x42b2('0x21')+_0x232606+_0x42b2('0x22'),'json':!![]};rp(_0xa35f34)[_0x42b2('0x23')](function(_0x53ae2f){var _0x48eaad=_[_0x42b2('0x24')](_0x53ae2f[_0x42b2('0x25')][_0x42b2('0x25')],[_0x232606,_0x480026]);_0xc3ba4(_0x48eaad);})['catch'](function(_0x148e1d){_0x399029(_0x148e1d);});});}function getEndUser(_0x5321e5,_0x50c226,_0x4fc2c3){return function(_0x4e3a84){return new Promise(function(_0x3223d1,_0x39c15e){logger[_0x42b2('0xe')](util[_0x42b2('0x26')](_0x42b2('0x27'),_0x4e3a84[_0x42b2('0x28')]));searchContact(_0x4fc2c3,_0x50c226,_0x42b2('0x29'),_0x4e3a84[_0x42b2('0x28')])[_0x42b2('0x23')](function(_0x5d691c){if(_0x5d691c){_0x4e3a84[_0x42b2('0x2a')]=_0x5d691c['id'];logger['info'](_0x42b2('0x2b'),_0x4e3a84[_0x42b2('0x2a')]);return _0x3223d1(_0x4e3a84);}searchContact(_0x4fc2c3,_0x50c226,'work_number',_0x4e3a84[_0x42b2('0x28')])[_0x42b2('0x23')](function(_0x1568ab){if(_0x1568ab){_0x4e3a84['endUserId']=_0x1568ab['id'];logger[_0x42b2('0xe')](_0x42b2('0x2c'),_0x4e3a84[_0x42b2('0x2a')]);return _0x3223d1(_0x4e3a84);}createEndUser(_0x4e3a84,_0x5321e5,_0x50c226,_0x4fc2c3)[_0x42b2('0x23')](function(_0x1e6725){logger[_0x42b2('0xe')](_0x42b2('0x2d'),_0x1e6725[_0x42b2('0x2a')]);return _0x3223d1(_0x1e6725);});});})[_0x42b2('0x1e')](function(_0x45bb10){_0x39c15e(_0x45bb10);});});};}function createEndUser(_0x10795e,_0x348d90,_0x5764b3,_0x5b38e1){return new Promise(function(_0x54bc36,_0x20bc96){var _0x3a2037=moment();var _0x4f6693={'method':_0x42b2('0x2e'),'uri':_0x5b38e1+'/api/contacts','body':{'contact':{'last_name':_0x10795e[_0x42b2('0x28')],'work_number':_0x10795e[_0x42b2('0x28')],'mobile_number':_0x10795e[_0x42b2('0x28')],'owner_id':_0x10795e['userId'],'created_at':_0x3a2037[_0x42b2('0x26')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4f6693[_0x42b2('0xd')]=_0x5764b3;logger[_0x42b2('0xe')](_0x42b2('0x2f'));return rp(_0x4f6693)[_0x42b2('0x23')](function(_0x37b153){_0x10795e[_0x42b2('0x2a')]=_0x37b153['contact']['id'];_0x54bc36(_0x10795e);})[_0x42b2('0x1e')](function(_0x5c9ad1){logger[_0x42b2('0x16')]('['+[_0x348d90[_0x42b2('0x17')]()]+']',_0x5c9ad1[_0x42b2('0x18')]);_0x20bc96(_0x5c9ad1['message']);});});}function getTicket(_0x346728,_0x3b8c4b,_0x55c49c,_0x5f021d,_0x229bb7){return function(_0x254506){logger[_0x42b2('0xe')](_0x42b2('0x30'));return new Promise(function(_0x3e168c,_0x5b553c){var _0x84fc88=moment();var _0x39936a={'method':_0x42b2('0x2e'),'uri':_0x55c49c+_0x42b2('0x31'),'body':{'title':intUtil[_0x42b2('0x32')](_0x5f021d[_0x42b2('0x33')],_0x229bb7,'\x20'),'description':intUtil[_0x42b2('0x32')](_0x5f021d['Descriptions'],_0x229bb7,'\x0a'),'owner_id':_0x254506['userId'],'creater_id':_0x254506[_0x42b2('0x14')],'targetable_id':_0x254506[_0x42b2('0x2a')],'targetable_type':_0x42b2('0x34'),'created_at':_0x84fc88[_0x42b2('0x26')](_0x42b2('0x35')),'due_date':_0x84fc88['add'](0x1e,'m')[_0x42b2('0x26')](_0x42b2('0x35'))},'json':!![]};_0x39936a[_0x42b2('0xd')]=_0x3b8c4b;return rp(_0x39936a)[_0x42b2('0x23')](function(_0x379434){_0x254506[_0x42b2('0x36')]=_0x379434[_0x42b2('0x37')]['id'];logger[_0x42b2('0xe')](_0x42b2('0x38'),_0x254506[_0x42b2('0x36')]);_0x3e168c(_0x254506);})[_0x42b2('0x1e')](function(_0x2172ce){logger[_0x42b2('0x16')]('['+[_0x346728[_0x42b2('0x17')]()]+']',_0x2172ce['message']);_0x5b553c(_0x2172ce['message']);});});};}function emit(_0x545b9d,_0x5b1bcc,_0x1de258){var _0x44c0b3={'uri':_0x545b9d+_0x42b2('0x39')+_0x1de258};io['to'](util[_0x42b2('0x26')](_0x42b2('0x3a'),_0x5b1bcc))[_0x42b2('0x3b')](_0x42b2('0x3c'),_0x44c0b3);}exports['cs']=function(_0x398a70,_0x157b3e,_0x3812e8,_0x1c6251,_0x1c3851,_0x1970c0,_0x3fd04d,_0x4274e1){var _0x11a62a={};var _0x5bfeb9={'Authorization':_0x42b2('0x3d')+_0x1970c0['apiKey']};_0x1970c0['remoteUri']=intUtil[_0x42b2('0x3e')](_0x1970c0[_0x42b2('0x3f')]);_0x1970c0[_0x42b2('0x40')]=intUtil[_0x42b2('0x3e')](_0x1970c0[_0x42b2('0x40')]);var _0x47567d=_0x1970c0[_0x42b2('0x3f')];_0x11a62a[_0x42b2('0x13')]=_0x1970c0[_0x42b2('0x41')];_0x11a62a['contactNumber']=_0x4274e1[_0x42b2('0x42')]()===_0x42b2('0x43')?_0x157b3e[_0x42b2('0x44')]:_0x157b3e[_0x42b2('0x45')];_0x11a62a[_0x42b2('0x46')]=_0x4274e1===_0x42b2('0x47')||_0x4274e1===_0x42b2('0x48')?_0x42b2('0x47'):'outbound';if(_0x1c6251){_0x11a62a['agentEmail']=_0x1c6251[_0x42b2('0x12')];}var _0x20d5a0=util[_0x42b2('0x26')](_0x42b2('0x49'),_0x1970c0[_0x42b2('0x40')],_0x157b3e['uniqueid'],md5(_0x157b3e['uniqueid']));if(_0x1c3851&&_0x1c3851[_0x42b2('0x4a')]){logger[_0x42b2('0xe')]('[QUEUE]',_0x42b2('0x4b'));_0x157b3e[_0x42b2('0x4c')]=_0x20d5a0;}else if(_0x3fd04d&&_0x3fd04d[_0x42b2('0x4d')]&&_0x3fd04d['recordingFormat']!==_0x42b2('0x4e')){logger[_0x42b2('0xe')](_0x42b2('0x4f'),'Recording\x20is\x20enabled!');_0x157b3e[_0x42b2('0x4c')]=_0x20d5a0;}else{_0x157b3e[_0x42b2('0x4c')]='';}return getAdminId(_0x11a62a,_0x4274e1,_0x5bfeb9,_0x47567d)[_0x42b2('0x23')](getUser(_0x4274e1,_0x5bfeb9,_0x47567d))[_0x42b2('0x23')](getEndUser(_0x4274e1,_0x5bfeb9,_0x47567d))[_0x42b2('0x23')](getTicket(_0x4274e1,_0x5bfeb9,_0x47567d,_0x3812e8,_0x157b3e))['then'](function(_0x5291f1){logger[_0x42b2('0xe')](util[_0x42b2('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5291f1[_0x42b2('0x36')]));if(_0x4274e1!==_0x42b2('0x48')){logger[_0x42b2('0xe')]('['+[_0x4274e1[_0x42b2('0x17')]()]+']',_0x42b2('0x50'));emit(_0x47567d,_0x1c6251['name'],_0x5291f1['endUserId']);}})[_0x42b2('0x1e')](function(_0x145dcc){logger['error']('['+[_0x4274e1[_0x42b2('0x17')]()]+_0x42b2('0x51'),util['inspect'](_0x145dcc,{'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 8650a1d..b87b1cf 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 _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 +var _0xfdc4=['outbound','log','unmanaged','sugarcrm','zoho','vtiger','dynamics365','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','routeId'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xfdc4,0x1a4));var _0x4fdc=function(_0x19707c,_0x578fa7){_0x19707c=_0x19707c-0x0;var _0x4bad4c=_0xfdc4[_0x19707c];return _0x4bad4c;};'use strict';var _=require(_0x4fdc('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x4fdc('0x1'));var sugarcrm=require(_0x4fdc('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x4fdc('0x3'));var desk=require(_0x4fdc('0x4'));var vtiger=require(_0x4fdc('0x5'));var servicenow=require(_0x4fdc('0x6'));var dynamics365=require(_0x4fdc('0x7'));var freshsales=require(_0x4fdc('0x8'));var integrations=[_0x4fdc('0x9'),_0x4fdc('0xa'),'sugarcrm',_0x4fdc('0xb'),'zoho',_0x4fdc('0xc'),'vtiger','dynamics365',_0x4fdc('0xd'),_0x4fdc('0xe')];exports[_0x4fdc('0xf')]=function(_0x129394,_0x14100d,_0x26de85,_0x548e21,_0x7e2ad9,_0x303e4e){if(_0x26de85){if(_[_0x4fdc('0x10')](integrations,_0x129394['data1']['toLowerCase']())){try{var _0x4d5ab4=null;var _0x3a7502='';var _0x29e0c8=_0x26de85[_0x129394[_0x4fdc('0x11')][_0x4fdc('0x12')]()];if(_0x29e0c8){var _0x596fd6=_0x29e0c8[_0x129394[_0x4fdc('0x13')]];if(_0x596fd6){var _0x63c22e=_[_0x4fdc('0x14')](_0x596fd6[_0x4fdc('0x15')],{'id':parseInt(_0x129394[_0x4fdc('0x16')],0xa)});if(_0x63c22e){if(_0x548e21){if(_0x7e2ad9&&_0x14100d['queue']){_0x3a7502='queue';}else if(_0x14100d[_0x4fdc('0x17')]){_0x3a7502=_0x4fdc('0x18');}else{console[_0x4fdc('0x19')]('EVENT\x20UNKNOWN',_0x14100d);}}else{_0x3a7502=_0x4fdc('0x1a');}switch(_0x129394[_0x4fdc('0x11')]['toLowerCase']()){case _0x4fdc('0x9'):zendesk[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case'salesforce':salesforce[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0x1b'):sugarcrm[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case'freshdesk':freshdesk[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0x1c'):zoho[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0xc'):desk[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0x1d'):vtiger[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0xd'):freshsales['cs'](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e,_0x3a7502);break;case _0x4fdc('0xe'):servicenow['cs'](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e,_0x3a7502);break;case _0x4fdc('0x1e'):dynamics365['cs'](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e,_0x3a7502);break;default:console[_0x4fdc('0x19')](_0x4fdc('0x1f'));}}else{_0x4d5ab4=require('../../../../config/logger')(_0x129394['data1'][_0x4fdc('0x12')]());_0x4d5ab4[_0x4fdc('0x20')](_0x4fdc('0x21'),util[_0x4fdc('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x129394[_0x4fdc('0x11')][_0x4fdc('0x12')](),_0x129394[_0x4fdc('0x16')]));}}else{_0x4d5ab4=require(_0x4fdc('0x23'))(_0x129394[_0x4fdc('0x11')][_0x4fdc('0x12')]());_0x4d5ab4[_0x4fdc('0x20')]('[EXEC]',util['format'](_0x4fdc('0x24'),_0x129394['data1'][_0x4fdc('0x12')](),_0x129394['data2']));}}else{}}catch(_0x4824da){console[_0x4fdc('0x20')](_0x4824da);}}}}; \ 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 8e26d34..fe6976a 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 _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 +var _0xb249=['error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','contact','endUserType','lead','WhoId','account','Case','ContactId','leadId','info','sobject','create','validateEmail','User','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','includes','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb249,0x178));var _0x9b24=function(_0x9d074f,_0x88a810){_0x9d074f=_0x9d074f-0x0;var _0x453398=_0xb249[_0x9d074f];return _0x453398;};'use strict';var _=require(_0x9b24('0x0'));var rp=require('request-promise');var moment=require(_0x9b24('0x1'));var BPromise=require(_0x9b24('0x2'));var md5=require(_0x9b24('0x3'));var jsforce=require('jsforce');var util=require(_0x9b24('0x4'));var Redis=require('ioredis');var intUtil=require(_0x9b24('0x5'));var config=require(_0x9b24('0x6'));var logger=require(_0x9b24('0x7'))('salesforce');config['redis']=_['defaults'](config[_0x9b24('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9b24('0x9'))(new Redis(config[_0x9b24('0x8')]));function emit(_0xe1bcd8,_0x4ab35c,_0x5a5d38){io['to'](_0xe1bcd8)['emit'](_0x4ab35c,_0x5a5d38);}function getTicket(_0x28e592,_0x32774c,_0x4c0673,_0xa54749,_0x2fdef0,_0x5e76e1,_0x4cf2ef,_0x290c0e){var _0x5167f4=Object['assign']({},{'OwnerId':_0x32774c['id'],'Subject':intUtil['getString'](_0xa54749['Subjects'],_0x2fdef0,'\x20'),'Description':intUtil['getString'](_0xa54749[_0x9b24('0xa')],_0x2fdef0,'\x0a')},getCustomFields(_0x5e76e1,_0x2fdef0));if(_0x4c0673){if(_0xa54749[_0x9b24('0xb')]===_0x9b24('0xc')){_0x5167f4[_0x9b24('0xd')]=moment['utc']();_0x5167f4[_0x9b24('0xe')]=![];_0x5167f4['IsRecurrence']=![];if(_0x4c0673['endUserType']===_0x9b24('0xf')||_0x4c0673[_0x9b24('0x10')]===_0x9b24('0x11')){_0x5167f4[_0x9b24('0x12')]=_0x4c0673['id'];}else if(_0x4c0673['endUserType']===_0x9b24('0x13')){_0x5167f4['WhatId']=_0x4c0673['id'];}}else if(_0xa54749[_0x9b24('0xb')]===_0x9b24('0x14')){if(_0x4c0673[_0x9b24('0x10')]===_0x9b24('0xf')){_0x5167f4[_0x9b24('0x15')]=_0x4c0673['id'];}else if(_0x4c0673['endUserType']===_0x9b24('0x13')){_0x5167f4['AccountId']=_0x4c0673['id'];}else if(_0x4c0673['endUserType']===_0x9b24('0x11')&&_0xa54749['leadId']){_0x5167f4[_0xa54749[_0x9b24('0x16')]]=_0x4c0673['id'];}else{logger[_0x9b24('0x17')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4cf2ef[_0x9b24('0x18')](_0xa54749[_0x9b24('0xb')])[_0x9b24('0x19')](_0x5167f4);}function getUser(_0xb5d446,_0x1b3c59,_0x2440d3){if(!_['isNil'](_0x1b3c59)&&intUtil[_0x9b24('0x1a')](_0x1b3c59)){var _0x67b594={'Email':_0x1b3c59};var _0x5463af={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2440d3[_0x9b24('0x18')](_0x9b24('0x1b'))[_0x9b24('0x1c')](_0x67b594,_0x5463af)[_0x9b24('0x1d')]()[_0x9b24('0x1e')](function(_0x505392){if(_0x505392[_0x9b24('0x1f')]){var _0x507d11=_['find'](_0x505392,function(_0x2bf830){return _0x2bf830[_0x9b24('0x20')]===_0x1b3c59;});if(_0x507d11){logger[_0x9b24('0x17')]('Agent\x20%s\x20found.',_0x1b3c59);return BPromise[_0x9b24('0x21')]({'id':_0x507d11['Id'],'name':_0x507d11[_0x9b24('0x22')]});}}else{logger['info'](_0x9b24('0x23'),_0x1b3c59);return _0x2440d3[_0x9b24('0x24')]()[_0x9b24('0x1e')](function(_0x5548a2){return BPromise[_0x9b24('0x21')]({'id':_0x5548a2[_0x9b24('0x25')],'name':_0x5548a2[_0x9b24('0x26')]});});}});}else{logger[_0x9b24('0x17')](_0x9b24('0x23'),_0x1b3c59);return _0x2440d3[_0x9b24('0x24')]()[_0x9b24('0x1e')](function(_0x5e196e){return BPromise['resolve']({'id':_0x5e196e[_0x9b24('0x25')],'name':_0x5e196e[_0x9b24('0x26')]});});}}function getEndUser(_0x34f827,_0xe44fd6,_0x22bf95,_0x258da4,_0x214791){var _0x15a87d={'$or':{'Phone':_0x258da4}};var _0x963a3e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x9b24('0x17')](_0x9b24('0x27'),_0x258da4,_0xe44fd6[_0x9b24('0x28')]);switch(_0xe44fd6[_0x9b24('0x28')]){case _0x9b24('0x29'):var _0x2b90e7=_['cloneDeep'](_0x15a87d);if(_0xe44fd6['additionalSearchContact']){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x2a')]]=_0x258da4;_[_0x9b24('0x2b')](_0x2b90e7['$or'],_0x4f6e52);}return _0x214791['sobject'](_0x9b24('0x2c'))[_0x9b24('0x1c')](_0x2b90e7,_0x963a3e)[_0x9b24('0x1d')]()[_0x9b24('0x1e')](function(_0x5632b0){if(_0x5632b0&&_0x5632b0[_0x9b24('0x1f')]){return _0x5632b0;}else{var _0x78dfe3=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2e')]){var _0xc85461={};_0xc85461[_0xe44fd6[_0x9b24('0x2e')]]=_0x258da4;_[_0x9b24('0x2b')](_0x78dfe3[_0x9b24('0x2f')],_0xc85461);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x30'))[_0x9b24('0x1c')](_0x78dfe3,_0x963a3e);}});case _0x9b24('0x31'):var _0x240d02=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x32')]){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x32')]]=_0x258da4;_[_0x9b24('0x2b')](_0x240d02[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x33'))['find'](_0x240d02,_0x963a3e)['execute']()[_0x9b24('0x1e')](function(_0xbb3f94){if(_0xbb3f94&&_0xbb3f94[_0x9b24('0x1f')]){return _0xbb3f94;}else{var _0x4016d2=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2a')]){var _0x26b61b={};_0x26b61b[_0xe44fd6[_0x9b24('0x2a')]]=_0x258da4;_[_0x9b24('0x2b')](_0x4016d2['$or'],_0x26b61b);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x2c'))[_0x9b24('0x1c')](_0x4016d2,_0x963a3e)[_0x9b24('0x1e')](function(_0x5c620b){if(_0x5c620b&&_0x5c620b['length']){return _0x5c620b;}else{var _0x206dda=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2e')]){var _0x2c7e3f={};_0x2c7e3f[_0xe44fd6[_0x9b24('0x2e')]]=_0x258da4;_[_0x9b24('0x2b')](_0x206dda[_0x9b24('0x2f')],_0x2c7e3f);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x30'))[_0x9b24('0x1c')](_0x206dda,_0x963a3e);}});}});case _0x9b24('0xf'):var _0x2b90e7=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6['additionalSearchContact']){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x2a')]]=_0x258da4;_[_0x9b24('0x2b')](_0x2b90e7[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791[_0x9b24('0x18')]('Contact')['find'](_0x2b90e7,_0x963a3e)[_0x9b24('0x1d')]();case'lead':var _0x4642e4=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2e')]){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x2e')]]=_0x258da4;_[_0x9b24('0x2b')](_0x4642e4[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791['sobject'](_0x9b24('0x30'))[_0x9b24('0x1c')](_0x4642e4,_0x963a3e);case'account':var _0x240d02=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x32')]){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x32')]]=_0x258da4;_[_0x9b24('0x2b')](_0x240d02[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x33'))[_0x9b24('0x1c')](_0x240d02,_0x963a3e);default:return null;}})['then'](function(_0xddbb14){if(_0xddbb14&&_0xddbb14[_0x9b24('0x1f')]){var _0x1bd942=_[_0x9b24('0x34')](_0xddbb14);if(_0x1bd942){return BPromise['resolve']({'id':_0x1bd942['Id'],'name':_0x1bd942[_0x9b24('0x22')],'phone':_0x1bd942['Phone'],'endUserType':_0x1bd942[_0x9b24('0x35')][_0x9b24('0x36')]['toLowerCase']()});}}})[_0x9b24('0x1e')](function(_0xe4f596){if(_0xe4f596){logger[_0x9b24('0x17')](_0x9b24('0x37'),_0xe4f596[_0x9b24('0x10')],_0x258da4);return BPromise[_0x9b24('0x21')](_0xe4f596);}else{logger[_0x9b24('0x17')](_0x9b24('0x38'),_0x258da4);var _0xe22ffc={'Phone':_0x258da4};if(_0xe44fd6[_0x9b24('0x39')]){if(_0xe44fd6[_0x9b24('0x39')]===_0x9b24('0xf')){logger['info'](_0x9b24('0x3a'),_0x258da4,_0xe44fd6[_0x9b24('0x39')]);_0xe22ffc['LastName']=_0x22bf95!==''?_0x22bf95:util[_0x9b24('0x3b')](_0x9b24('0x3c'),_0x258da4);}else if(_0xe44fd6[_0x9b24('0x39')]===_0x9b24('0x11')){logger['info'](_0x9b24('0x3a'),_0x258da4,_0xe44fd6[_0x9b24('0x39')]);_0xe22ffc['LastName']=_0x22bf95!==_0x9b24('0x3d')?_0x22bf95:util[_0x9b24('0x3b')]('Caller\x20-\x20%s',_0x258da4);_0xe22ffc[_0x9b24('0x3e')]=_0x9b24('0x3f');}else if(_0xe44fd6['moduleCreate']===_0x9b24('0x13')){logger[_0x9b24('0x17')](_0x9b24('0x3a'),_0x258da4,_0xe44fd6['moduleCreate']);_0xe22ffc[_0x9b24('0x22')]=_0x22bf95!==''?_0x22bf95:util[_0x9b24('0x3b')](_0x9b24('0x3c'),_0x258da4);}else{return null;}}return _0x214791['sobject'](_[_0x9b24('0x40')](_0xe44fd6[_0x9b24('0x39')]))[_0x9b24('0x19')](_0xe22ffc)[_0x9b24('0x1e')](function(_0x1ddb99){return BPromise[_0x9b24('0x21')]({'id':_0x1ddb99['id'],'endUserType':_0xe44fd6['moduleCreate']});});}});}function getCustomFields(_0x33d72d,_0x527f2d){var _0x57e108={};if(_0x33d72d['length']>0x0){_['forEach'](_0x33d72d,function(_0x45242a){if(_[_0x9b24('0x41')]([_0x9b24('0x42'),'picklist'],_0x45242a[_0x9b24('0x36')])&&_0x45242a['idField']){_0x57e108[_0x45242a[_0x9b24('0x43')]]=_0x45242a['content'][_0x9b24('0x44')]();}else if(_0x45242a['type']===_0x9b24('0x45')&&_0x45242a['variableName']&&_0x45242a[_0x9b24('0x43')]){_0x527f2d[_0x45242a[_0x9b24('0x46')]]&&(_0x57e108[_0x45242a['idField']]=_0x527f2d[_0x45242a[_0x9b24('0x46')]][_0x9b24('0x44')]());}else if(_0x45242a[_0x9b24('0x36')]===_0x9b24('0x47')&&_0x45242a['Variable']&&_0x45242a[_0x9b24('0x48')]['name']&&_0x45242a[_0x9b24('0x43')]){_0x527f2d[_0x45242a[_0x9b24('0x48')][_0x9b24('0x49')][_0x9b24('0x4a')]()]&&(_0x57e108[_0x45242a['idField']]=_0x527f2d[_0x45242a[_0x9b24('0x48')][_0x9b24('0x49')][_0x9b24('0x4a')]()][_0x9b24('0x44')]());}});}return _0x57e108;}function getConnection(_0x18f233){var _0x16fef1=_0x18f233[_0x9b24('0x4b')][_0x9b24('0x4c')](_0x18f233[_0x9b24('0x4d')]);var _0x17e5b2=new jsforce[(_0x9b24('0x4e'))]({'oauth2':{'loginUrl':_0x18f233[_0x9b24('0x4f')]||_0x9b24('0x50'),'clientId':_0x18f233[_0x9b24('0x51')],'clientSecret':_0x18f233[_0x9b24('0x52')]}});return _0x17e5b2[_0x9b24('0x53')](_0x18f233[_0x9b24('0x54')],_0x16fef1)['then'](function(){logger[_0x9b24('0x17')](_0x9b24('0x55'));return _0x17e5b2;});}exports['queue']=function(_0x40edfe,_0x364712,_0x4088cc,_0x228a1a,_0x403a0e,_0x48ce76){var _0x3edeaa,_0x2784ca,_0x58e922,_0x18d907;_0x48ce76[_0x9b24('0x56')]=intUtil[_0x9b24('0x57')](_0x48ce76[_0x9b24('0x56')]);_0x48ce76[_0x9b24('0x4f')]=intUtil[_0x9b24('0x57')](_0x48ce76[_0x9b24('0x4f')]);if(_0x403a0e&&_0x403a0e[_0x9b24('0x58')]){logger[_0x9b24('0x17')]('[QUEUE]',_0x9b24('0x59'));_0x364712['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48ce76[_0x9b24('0x56')],_0x364712[_0x9b24('0x5a')],md5(_0x364712[_0x9b24('0x5a')]));}else{_0x364712[_0x9b24('0x5b')]='';}return getConnection(_0x48ce76)[_0x9b24('0x1e')](function(_0xa9d592){_0x18d907=_0xa9d592;return getUser(_0x48ce76,_0x228a1a[_0x9b24('0x5c')],_0x18d907);})[_0x9b24('0x1e')](function(_0x330b13){_0x3edeaa=_0x330b13;return getEndUser(_0x48ce76,_0x4088cc,_0x364712[_0x9b24('0x5d')],_0x364712[_0x9b24('0x5e')],_0x18d907);})['then'](function(_0xcdf65d){_0x2784ca=_0xcdf65d;return getTicket(_0x48ce76,_0x3edeaa,_0x2784ca,_0x4088cc,_0x364712,_0x4088cc[_0x9b24('0x5f')],_0x18d907,_0x9b24('0x60'));})[_0x9b24('0x1e')](function(_0x4d6bdd){_0x58e922=_0x4d6bdd;logger[_0x9b24('0x17')](_0x9b24('0x61'),_0x58e922['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x58e922['id'],_0x228a1a['name'],_0x48ce76[_0x9b24('0x36')]);switch(_0x48ce76[_0x9b24('0x36')]){case _0x9b24('0x62'):emit(util[_0x9b24('0x3b')]('user:%s',_0x228a1a[_0x9b24('0x49')]),_0x9b24('0x63'),{'recordId':_0x58e922['id']});break;case'newTab':emit(util[_0x9b24('0x3b')](_0x9b24('0x64'),_0x228a1a[_0x9b24('0x49')]),_0x9b24('0x65'),{'uri':util[_0x9b24('0x3b')](_0x9b24('0x66'),_0x18d907[_0x9b24('0x67')],_0x58e922['id'])});break;default:logger[_0x9b24('0x68')](_0x9b24('0x69'));}})['catch'](function(_0x4b774e){logger[_0x9b24('0x68')](_0x9b24('0x6a'),_0x4b774e);});};exports['outbound']=function(_0x57e756,_0x40b8a0,_0xc08a53,_0x88d396,_0x537c19,_0x512ae9,_0x33efd3){var _0x2519d9,_0x807d45,_0x1cee89,_0x4865bb;_0x512ae9[_0x9b24('0x56')]=intUtil[_0x9b24('0x57')](_0x512ae9[_0x9b24('0x56')]);_0x512ae9[_0x9b24('0x4f')]=intUtil[_0x9b24('0x57')](_0x512ae9['remoteUri']);if(_0x33efd3&&_0x33efd3[_0x9b24('0x6b')]&&_0x33efd3[_0x9b24('0x6b')]!==_0x9b24('0x6c')){logger[_0x9b24('0x17')]('[OUTBOUND]',_0x9b24('0x59'));_0x40b8a0[_0x9b24('0x5b')]=util['format'](_0x9b24('0x6d'),_0x512ae9[_0x9b24('0x56')],_0x40b8a0[_0x9b24('0x5a')],md5(_0x40b8a0['uniqueid']));}return getConnection(_0x512ae9)[_0x9b24('0x1e')](function(_0x3107be){_0x4865bb=_0x3107be;return getUser(_0x512ae9,_0x88d396[_0x9b24('0x5c')],_0x4865bb);})['then'](function(_0x5eea09){_0x2519d9=_0x5eea09;return getEndUser(_0x512ae9,_0xc08a53,_0x40b8a0[_0x9b24('0x6e')],_0x40b8a0['destcalleridnum'],_0x4865bb);})[_0x9b24('0x1e')](function(_0x167560){_0x807d45=_0x167560;return getTicket(_0x512ae9,_0x2519d9,_0x807d45,_0xc08a53,_0x40b8a0,_0xc08a53['Fields'],_0x4865bb,'outbound');})[_0x9b24('0x1e')](function(_0x327f5f){_0x1cee89=_0x327f5f;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x1cee89['id']);logger['info'](_0x9b24('0x6f'),_0x1cee89['id'],_0x88d396['name'],_0x512ae9[_0x9b24('0x36')]);switch(_0x512ae9[_0x9b24('0x36')]){case _0x9b24('0x62'):emit(util['format']('user:%s',_0x88d396[_0x9b24('0x49')]),_0x9b24('0x63'),{'recordId':_0x1cee89['id']});break;case _0x9b24('0x70'):emit(util[_0x9b24('0x3b')](_0x9b24('0x64'),_0x88d396[_0x9b24('0x49')]),_0x9b24('0x65'),{'uri':util[_0x9b24('0x3b')](_0x9b24('0x66'),_0x4865bb[_0x9b24('0x67')],_0x1cee89['id'])});break;default:logger[_0x9b24('0x68')](_0x9b24('0x71'),_0x9b24('0x72'));}})[_0x9b24('0x73')](function(_0x335b49){logger[_0x9b24('0x68')]('[OUTBOUND]',_0x335b49);});};exports[_0x9b24('0x74')]=function(_0x5e09fd,_0xdc60f7,_0x5aa99d,_0x55efd7,_0x3dc0f1,_0x3978d0){var _0x336881,_0x529612,_0x4856e4,_0x25200d;_0x3978d0[_0x9b24('0x56')]=intUtil['stripTrailingSlash'](_0x3978d0['serverUrl']);_0x3978d0[_0x9b24('0x4f')]=intUtil['stripTrailingSlash'](_0x3978d0[_0x9b24('0x4f')]);if(_0x3dc0f1&&_0x3dc0f1[_0x9b24('0x58')]){logger['info']('['+_0xdc60f7[_0x9b24('0x75')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xdc60f7[_0x9b24('0x5b')]=util['format'](_0x9b24('0x6d'),_0x3978d0['serverUrl'],_0xdc60f7[_0x9b24('0x5a')],md5(_0xdc60f7[_0x9b24('0x5a')]));}else{_0xdc60f7[_0x9b24('0x5b')]='';}return getConnection(_0x3978d0)[_0x9b24('0x1e')](function(_0x40feb6){_0x25200d=_0x40feb6;if(!_['isNil'](_0x55efd7)){return getUser(_0x3978d0,_0x55efd7['name'],_0x25200d);}else{return getUser(_0x3978d0,null,_0x25200d);}})[_0x9b24('0x1e')](function(_0x2d9e5c){_0x336881=_0x2d9e5c;return getEndUser(_0x3978d0,_0x5aa99d,_0xdc60f7[_0x9b24('0x5d')],_0xdc60f7[_0x9b24('0x5e')],_0x25200d);})[_0x9b24('0x1e')](function(_0x1d9098){_0x529612=_0x1d9098;return getTicket(_0x3978d0,_0x336881,_0x529612,_0x5aa99d,_0xdc60f7,_0x5aa99d[_0x9b24('0x5f')],_0x25200d);})[_0x9b24('0x1e')](function(_0x2278e6){_0x4856e4=_0x2278e6;logger[_0x9b24('0x17')]('['+_0xdc60f7[_0x9b24('0x75')][_0x9b24('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x4856e4['id']);logger['info']('['+_0xdc60f7[_0x9b24('0x75')]['toUpperCase']()+_0x9b24('0x77'),_0x3978d0['type']);})[_0x9b24('0x73')](function(_0x303c5a){logger[_0x9b24('0x68')]('['+_0xdc60f7['lastevent'][_0x9b24('0x76')]()+']',_0x303c5a);});}; \ 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 7920e3c..b0c1c04 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 _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 +var _0x8abc=['includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','toString','customVariable','Variable','name','outbound','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketId','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','stripTrailingSlash','remoteUri','serverUrl','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach'];(function(_0x48afa8,_0x2814cb){var _0x3ccd6b=function(_0x59b5ff){while(--_0x59b5ff){_0x48afa8['push'](_0x48afa8['shift']());}};_0x3ccd6b(++_0x2814cb);}(_0x8abc,0xb3));var _0xc8ab=function(_0x544010,_0x94a6ce){_0x544010=_0x544010-0x0;var _0x15443a=_0x8abc[_0x544010];return _0x15443a;};'use strict';var _=require('lodash');var Promise=require(_0xc8ab('0x0'));var rp=require('request-promise');var util=require(_0xc8ab('0x1'));var md5=require(_0xc8ab('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc8ab('0x3'));var logger=require(_0xc8ab('0x4'))(_0xc8ab('0x5'));config[_0xc8ab('0x6')]=_['defaults'](config[_0xc8ab('0x6')],{'host':_0xc8ab('0x7'),'port':0x18eb});var io=require(_0xc8ab('0x8'))(new Redis(config['redis']));function getAdminUser(_0x28c9a1,_0x1b5ca2,_0x1af907,_0x51ce32,_0x28c78c,_0x2909fe){return new Promise(function(_0x140b8e,_0x57b1fa){var _0x3025fd={'method':_0xc8ab('0x9'),'uri':_0x51ce32+_0xc8ab('0xa')+'&'+_0x28c78c+'&'+_0x2909fe,'auth':_0x1b5ca2,'json':!![]};return rp(_0x3025fd)['then'](function(_0xc774c2){if(_0xc774c2['result'][_0xc8ab('0xb')]>0x0){_0x1af907[_0xc8ab('0xc')]=_0xc774c2[_0xc8ab('0xd')][0x0][_0xc8ab('0xe')];}logger[_0xc8ab('0xf')]('['+[_0x28c9a1[_0xc8ab('0x10')]()]+_0xc8ab('0x11'),_0x1af907);_0x140b8e(_0x1af907);})[_0xc8ab('0x12')](function(_0x2808e6){logger[_0xc8ab('0x13')]('['+[_0x28c9a1[_0xc8ab('0x10')]()]+']',_0x2808e6[_0xc8ab('0x14')]);_0x57b1fa(_0x2808e6[_0xc8ab('0x14')]);});});}function getUser(_0x489677,_0x63a96c,_0x20c058,_0x121367,_0x130a26){return function(_0x262769){logger[_0xc8ab('0xf')]('['+[_0x489677['toUpperCase']()]+_0xc8ab('0x15'),_0x262769);return new Promise(function(_0x1730b8,_0x1d73aa){if(intUtil[_0xc8ab('0x16')](_0x262769[_0xc8ab('0x17')])){var _0x4ffbde={'method':'GET','uri':_0x20c058+_0xc8ab('0x18')+_0x262769[_0xc8ab('0x17')]+'&'+_0x121367+'&'+_0x130a26,'auth':_0x63a96c,'json':!![]};logger[_0xc8ab('0xf')]('['+[_0x489677[_0xc8ab('0x10')]()]+_0xc8ab('0x19'),_0x4ffbde);return rp(_0x4ffbde)['then'](function(_0x1f28e4){logger[_0xc8ab('0xf')]('['+[_0x489677[_0xc8ab('0x10')]()]+_0xc8ab('0x1a'),_0x1f28e4);if(_0x1f28e4[_0xc8ab('0xd')]['length']>0x0&&String(_0x1f28e4[_0xc8ab('0xd')][0x0][_0xc8ab('0x1b')])===_0xc8ab('0x1c')){_0x262769[_0xc8ab('0x1d')]=_0x1f28e4[_0xc8ab('0xd')][0x0][_0xc8ab('0xe')];}else{_0x262769['userId']=_0x262769[_0xc8ab('0xc')];_0x262769['userEmail']=_0x262769[_0xc8ab('0x1e')];}logger[_0xc8ab('0xf')]('['+[_0x489677[_0xc8ab('0x10')]()]+'],\x20getUser\x20crm',_0x262769);_0x1730b8(_0x262769);})[_0xc8ab('0x12')](function(_0x343168){logger[_0xc8ab('0x13')]('['+[_0x489677['toUpperCase']()]+']',_0x343168[_0xc8ab('0x14')]);_0x1d73aa(_0x343168[_0xc8ab('0x14')]);});}else{logger[_0xc8ab('0xf')]('['+[_0x489677['toUpperCase']()]+_0xc8ab('0x1f'));_0x262769[_0xc8ab('0x1d')]=_0x262769[_0xc8ab('0xc')];_0x262769[_0xc8ab('0x17')]=_0x262769[_0xc8ab('0x1e')];_0x1730b8(_0x262769);}});};}function createEndUser(_0x2751c6,_0x280c5c,_0xa5a73f,_0x23c4e9,_0xb79ede){logger[_0xc8ab('0xf')]('['+[_0x2751c6[_0xc8ab('0x10')]()]+_0xc8ab('0x20'),_0xa5a73f);return new Promise(function(_0x12f075,_0x31e6db){var _0x4852a8={'method':_0xc8ab('0x21'),'uri':_0x23c4e9+'sys_user?'+_0xb79ede,'body':{'user_name':_0xa5a73f[_0xc8ab('0x22')],'roles':_0xc8ab('0x23'),'first_name':_0xa5a73f['endUserNumber'],'active':'true','date_format':_0xc8ab('0x24'),'phone':_0xa5a73f[_0xc8ab('0x22')]},'auth':_0x280c5c,'json':!![]};return rp(_0x4852a8)[_0xc8ab('0x25')](function(_0x239211){logger[_0xc8ab('0xf')]('['+[_0x2751c6[_0xc8ab('0x10')]()]+_0xc8ab('0x26'),_0x239211[_0xc8ab('0xd')]);_0xa5a73f[_0xc8ab('0x27')]=_0x239211[_0xc8ab('0xd')][_0xc8ab('0xe')];_0x12f075(_0xa5a73f);})[_0xc8ab('0x12')](function(_0x3e9135){logger['error']('['+[_0x2751c6[_0xc8ab('0x10')]()]+']',_0x3e9135[_0xc8ab('0x14')]);_0x31e6db(_0x3e9135[_0xc8ab('0x14')]);});});}function getEndUser(_0x22b836,_0xf5b28d,_0x4e5f02,_0x153003,_0x17bebc){return function(_0xb3453a){logger[_0xc8ab('0xf')]('['+[_0x22b836[_0xc8ab('0x10')]()]+_0xc8ab('0x28'),_0xb3453a);return new Promise(function(_0x190b7e,_0x4232d9){var _0x22542a={'method':_0xc8ab('0x9'),'uri':_0x4e5f02+_0xc8ab('0x29')+_0xb3453a[_0xc8ab('0x22')]+'&'+_0x153003+'&'+_0x17bebc,'auth':_0xf5b28d,'json':!![]};return rp(_0x22542a)['then'](function(_0x1551c4){if(_0x1551c4[_0xc8ab('0xd')][_0xc8ab('0xb')]>0x0){_0xb3453a[_0xc8ab('0x27')]=_0x1551c4[_0xc8ab('0xd')][0x0][_0xc8ab('0xe')];logger[_0xc8ab('0xf')]('['+[_0x22b836[_0xc8ab('0x10')]()]+_0xc8ab('0x2a'),_0xb3453a);_0x190b7e(_0xb3453a);}else{return createEndUser(_0x22b836,_0xf5b28d,_0xb3453a,_0x4e5f02,_0x153003)[_0xc8ab('0x25')](function(_0x28a772){logger['info']('['+[_0x22b836[_0xc8ab('0x10')]()]+_0xc8ab('0x2b'),_0x28a772);_0x190b7e(_0x28a772);});}})[_0xc8ab('0x12')](function(_0x374b37){logger[_0xc8ab('0x13')]('['+[_0x22b836['toUpperCase']()]+']',_0x374b37[_0xc8ab('0x14')]);_0x4232d9(_0x374b37[_0xc8ab('0x14')]);});});};}function getCustomFields(_0x300212,_0x19957d){var _0x19f069={};if(_0x300212[_0xc8ab('0xb')]>0x0){_[_0xc8ab('0x2c')](_0x300212,function(_0x352a01){if(_[_0xc8ab('0x2d')]([_0xc8ab('0x2e'),_0xc8ab('0x2f')],_0x352a01[_0xc8ab('0x30')])&&_0x352a01[_0xc8ab('0x31')]&&!_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01['nameField'][_0xc8ab('0x33')]()]=_0x352a01[_0xc8ab('0x34')]['toString']();}else if(_[_0xc8ab('0x2d')](['string',_0xc8ab('0x2f')],_0x352a01[_0xc8ab('0x30')])&&_0x352a01['idField']&&_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01[_0xc8ab('0x35')]['toLowerCase']()]=_0x352a01[_0xc8ab('0x34')]['toString']();}else if(_0x352a01[_0xc8ab('0x30')]==='variable'&&_0x352a01[_0xc8ab('0x36')]&&_0x352a01['idField']&&_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01[_0xc8ab('0x35')][_0xc8ab('0x33')]()]=_0x19957d[_0x352a01[_0xc8ab('0x36')]][_0xc8ab('0x37')]();}else if(_0x352a01[_0xc8ab('0x30')]===_0xc8ab('0x38')&&_0x352a01[_0xc8ab('0x39')]&&_0x352a01[_0xc8ab('0x39')][_0xc8ab('0x3a')]&&_0x352a01[_0xc8ab('0x35')]&&_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01[_0xc8ab('0x35')][_0xc8ab('0x33')]()]=_0x19957d[_0x352a01[_0xc8ab('0x39')]['name'][_0xc8ab('0x33')]()][_0xc8ab('0x37')]();}});}return _0x19f069;}function getTicket(_0x18dfec,_0xb16651,_0x272443,_0x1be4ad,_0x36e0ea,_0x3e9643){return function(_0x1a26bc){logger[_0xc8ab('0xf')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x1a26bc);return new Promise(function(_0x234ee4,_0x393abe){var _0x4ef82d=_0x18dfec[_0xc8ab('0x33')]()===_0xc8ab('0x3b')?_0x1a26bc[_0xc8ab('0x1d')]:_0x1a26bc[_0xc8ab('0x27')];var _0x4b0139={'method':'POST','uri':_0x272443+_0xc8ab('0x3c')+'?'+_0x3e9643,'body':Object[_0xc8ab('0x3d')]({},{'active':_0xc8ab('0x1c'),'caller_id':_0x4ef82d,'assigned_to':_0x1a26bc[_0xc8ab('0x1d')],'short_description':intUtil['getString'](_0x1be4ad[_0xc8ab('0x3e')],_0x36e0ea,'\x20'),'description':intUtil[_0xc8ab('0x3f')](_0x1be4ad[_0xc8ab('0x40')],_0x36e0ea,'\x0a')},getCustomFields(_0x1be4ad[_0xc8ab('0x41')],_0x36e0ea)),'auth':_0xb16651,'json':!![]};return rp(_0x4b0139)[_0xc8ab('0x25')](function(_0x50da89){logger[_0xc8ab('0xf')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+_0xc8ab('0x42'),_0x50da89['result']);_0x1a26bc['ticketId']=_0x50da89['result'][_0xc8ab('0xe')];_0x1a26bc[_0xc8ab('0x43')]=_0x50da89['result'][_0xc8ab('0x44')];logger[_0xc8ab('0xf')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+_0xc8ab('0x45'),_0x1a26bc);_0x234ee4(_0x1a26bc);})[_0xc8ab('0x12')](function(_0x352f44){logger[_0xc8ab('0x13')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+']',_0x352f44[_0xc8ab('0x14')]);_0x393abe(_0x352f44['message']);});});};}function createRemoteTag(_0x585675,_0x745ed4,_0x590e56,_0x30ae38){return new Promise(function(_0x2ceeaa,_0x2e8bc6){var _0x534681={'method':'POST','uri':_0x590e56+_0xc8ab('0x46')+'?'+_0x30ae38,'body':{'short_description':_0x585675,'global':!![],'active':!![],'name':_0x585675},'auth':_0x745ed4,'json':!![]};return rp(_0x534681)[_0xc8ab('0x25')](function(_0x123655){var _0x4d3a9a=_0x123655[_0xc8ab('0xd')][_0xc8ab('0xe')];_0x2ceeaa(_0x4d3a9a);});});}function getRemoteTag(_0x2dd327,_0x4d9c68,_0x326627,_0xda1e22,_0x5bf96a){return new Promise(function(_0x5efeb7,_0x640854){var _0x4abbfc={'method':_0xc8ab('0x9'),'uri':_0x326627+'label'+_0xc8ab('0x47')+_0x2dd327+'&'+_0xda1e22,'auth':_0x4d9c68,'json':!![]};return rp(_0x4abbfc)[_0xc8ab('0x25')](function(_0x20883d){if(_0x20883d[_0xc8ab('0xd')][_0xc8ab('0xb')]>0x0){var _0x88b6f1=_0x20883d[_0xc8ab('0xd')][0x0]['sys_id'];_0x5efeb7(_0x88b6f1);}else{return createRemoteTag(_0x2dd327,_0x4d9c68,_0x326627,_0xda1e22)[_0xc8ab('0x25')](function(_0x4f36e2){_0x5efeb7(_0x4f36e2);});}});});}function assignTagToIncident(_0x1242c5,_0x3f3960,_0x5a392b,_0x4a5caa,_0x2f4edc){return new Promise(function(_0x52ba49,_0x5a33cb){var _0x1e36f3={'method':'POST','uri':_0x5a392b+_0xc8ab('0x48')+'?'+_0x2f4edc,'body':{'label':_0x1242c5,'table':_0xc8ab('0x3c'),'id_type':'Incident','table_key':_0x4a5caa[_0xc8ab('0x49')],'title':_0xc8ab('0x4a')+_0x4a5caa['ticketNumber'],'id_display':_0x4a5caa['ticketNumber']},'auth':_0x3f3960,'json':!![]};return rp(_0x1e36f3)['then'](function(_0x194f70){_0x52ba49();})[_0xc8ab('0x12')](function(){_0x52ba49();});});}function manageTags(_0x119781,_0x13fa0e,_0x577f54,_0x543c60,_0x1a83c6,_0x33a51c,_0x52e6e5){return new Promise(function(_0x180d4d,_0x1d114d){var _0x4948d5=[];_0x13fa0e[_0xc8ab('0x2c')](function(_0x2267c1){_0x4948d5[_0xc8ab('0x4b')](getRemoteTag(_0x2267c1,_0x577f54,_0x543c60,_0x33a51c,_0x52e6e5));});return Promise['all'](_0x4948d5)['then'](function(_0x18ddc3){if(_0x18ddc3[_0xc8ab('0xb')]){logger[_0xc8ab('0xf')]('['+[_0x119781[_0xc8ab('0x10')]()]+_0xc8ab('0x4c'),_0x18ddc3);var _0x512edd=[];_0x18ddc3[_0xc8ab('0x2c')](function(_0x8ed0d4){_0x512edd[_0xc8ab('0x4b')](assignTagToIncident(_0x8ed0d4,_0x577f54,_0x543c60,_0x1a83c6,_0x33a51c));});return Promise[_0xc8ab('0x4d')](_0x512edd)[_0xc8ab('0x25')](function(){_0x180d4d();})['catch'](function(){_0x180d4d();});}else{_0x180d4d();}});});}function getTags(_0x144055,_0x50cc26,_0x44be9b,_0x53f5db,_0x1a3ce7,_0xb66710){return function(_0x1c29e0){return new Promise(function(_0x4ac522,_0x13ef67){var _0x1ac12d=[];var _0x1d7da6=_0x53f5db[_0xc8ab('0x4e')];if(_0x1d7da6&&_0x1d7da6[_0xc8ab('0xb')]>0x0){_0x1ac12d=_[_0xc8ab('0x4f')](_0x1d7da6,_0xc8ab('0x3a'));}if(_0x1ac12d[_0xc8ab('0xb')]>0x0){return manageTags(_0x144055,_0x1ac12d,_0x50cc26,_0x44be9b,_0x1c29e0,_0x1a3ce7,_0xb66710)[_0xc8ab('0x25')](function(){_0x4ac522(_0x1c29e0);});}else{_0x4ac522(_0x1c29e0);}});};}function emit(_0x4a11d1,_0x4b272f,_0xeea841){var _0x36c2a6=_0xc8ab('0x50')+_0xc8ab('0x51')+_0xc8ab('0x52')+'%255EORDERBYDESCnumber';var _0x393afc={'uri':_0x4a11d1+_0xc8ab('0x53')+_0xeea841+_0x36c2a6};io['to'](util[_0xc8ab('0x54')](_0xc8ab('0x55'),_0x4b272f))[_0xc8ab('0x56')](_0xc8ab('0x57'),_0x393afc);}exports['cs']=function(_0x11f13d,_0x51baec,_0x343ea0,_0x5bda6f,_0x3e0de9,_0x5f145a,_0x25d67b,_0x490913){var _0x394ff6={};var _0x5ef9c0={'user':_0x5f145a[_0xc8ab('0x58')],'pass':_0x5f145a[_0xc8ab('0x59')]};var _0x32f526='sysparm_limit=1';var _0x4f73cd='sysparm_display_value=true';_0x5f145a['remoteUri']=intUtil[_0xc8ab('0x5a')](_0x5f145a[_0xc8ab('0x5b')]);_0x5f145a['serverUrl']=intUtil[_0xc8ab('0x5a')](_0x5f145a[_0xc8ab('0x5c')]);var _0x2cd1f2=util[_0xc8ab('0x54')]('%s/api/now/table/',_0x5f145a['remoteUri']);_0x394ff6[_0xc8ab('0x17')]=!_[_0xc8ab('0x5d')](_0x5bda6f)?_0x5bda6f[_0xc8ab('0x5e')]:null;_0x394ff6['adminEmail']=_0x5f145a[_0xc8ab('0x5e')];_0x394ff6[_0xc8ab('0x22')]=_0x490913[_0xc8ab('0x33')]()==='outbound'?_0x51baec['destcalleridnum']:_0x51baec[_0xc8ab('0x5f')];_0x394ff6[_0xc8ab('0x60')]=_0x490913===_0xc8ab('0x61')||_0x490913===_0xc8ab('0x62')?_0xc8ab('0x61'):_0xc8ab('0x3b');var _0xee12c5=util[_0xc8ab('0x54')](_0xc8ab('0x63'),_0x5f145a[_0xc8ab('0x5c')],_0x51baec[_0xc8ab('0x64')],md5(_0x51baec[_0xc8ab('0x64')]));if(_0x3e0de9&&_0x3e0de9[_0xc8ab('0x65')]){logger['info'](_0xc8ab('0x66'),_0xc8ab('0x67'));_0x51baec[_0xc8ab('0x68')]=_0xee12c5;}else if(_0x25d67b&&_0x25d67b[_0xc8ab('0x69')]&&_0x25d67b['recordingFormat']!==_0xc8ab('0x6a')){logger['info']('[OUTBOUND]',_0xc8ab('0x67'));_0x51baec['recordingURL']=_0xee12c5;}else{_0x51baec[_0xc8ab('0x68')]='';}return getAdminUser(_0x490913,_0x5ef9c0,_0x394ff6,_0x2cd1f2,_0x4f73cd,_0x32f526)[_0xc8ab('0x25')](getUser(_0x490913,_0x5ef9c0,_0x2cd1f2,_0x4f73cd,_0x32f526))[_0xc8ab('0x25')](getEndUser(_0x490913,_0x5ef9c0,_0x2cd1f2,_0x4f73cd,_0x32f526))[_0xc8ab('0x25')](getTicket(_0x490913,_0x5ef9c0,_0x2cd1f2,_0x343ea0,_0x51baec,_0x4f73cd))[_0xc8ab('0x25')](function(_0x9f4cdb){logger[_0xc8ab('0xf')](util['format'](_0xc8ab('0x6b'),_0x9f4cdb['ticketId']));logger[_0xc8ab('0xf')](util[_0xc8ab('0x54')](_0xc8ab('0x6c'),_0x490913));if(_0x490913!=='unmanaged'){logger[_0xc8ab('0xf')]('['+[_0x490913['toUpperCase']()]+']',_0xc8ab('0x6d'));emit(_0x5f145a['remoteUri'],_0x5bda6f['name'],_0x9f4cdb['ticketId']);}})[_0xc8ab('0x12')](function(_0x1f3c0f){logger[_0xc8ab('0x13')]('['+[_0x490913[_0xc8ab('0x10')]()]+_0xc8ab('0x6e'),util[_0xc8ab('0x6f')](_0x1f3c0f,{'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 79761d6..1a970ed 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 _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 +var _0xb895=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','trigger:browser:url','catch','recordingFormat','none','destcalleridname','Outbound','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','monitor_format','lastevent','toUpperCase','users','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','slice','replace','duration_hours','duration_minutes','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','user_name','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','value','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','map','string','nameField','customField','toLowerCase','content','type','variable','custom_fields','customVariable','Variable','POST','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb895,0x1e6));var _0x5b89=function(_0xe25c01,_0x3c30e1){_0xe25c01=_0xe25c01-0x0;var _0x5a5fbb=_0xb895[_0xe25c01];return _0x5a5fbb;};'use strict';var _=require('lodash');var rp=require(_0x5b89('0x0'));var BPromise=require(_0x5b89('0x1'));var md5=require(_0x5b89('0x2'));var util=require('util');var Redis=require(_0x5b89('0x3'));var intUtil=require(_0x5b89('0x4'));var config=require(_0x5b89('0x5'));var logger=require('../../../../config/logger')(_0x5b89('0x6'));config['redis']=_['defaults'](config[_0x5b89('0x7')],{'host':_0x5b89('0x8'),'port':0x18eb});var io=require(_0x5b89('0x9'))(new Redis(config[_0x5b89('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x59c365,_0x4b5c0a,_0x909736){io['to'](_0x59c365)['emit'](_0x4b5c0a,_0x909736);}function getTicket(_0x125c1f,_0x29aa67,_0x1ef93a,_0x1d5c0a,_0x504f87,_0x5d1be7,_0xe49cde,_0x5244f4){logger[_0x5b89('0xa')](_0x5b89('0xb'));var _0x21df75=new Date();var _0x564250=[{'name':_0x5b89('0xc'),'value':intUtil[_0x5b89('0xd')](_0x1d5c0a['Subjects'],_0x504f87,'\x20')},{'name':_0x5b89('0xe'),'value':_0x29aa67['id']},{'name':'created_by','value':_0x29aa67['id']},{'name':_0x5b89('0xf'),'value':intUtil[_0x5b89('0xd')](_0x1d5c0a[_0x5b89('0x10')],_0x504f87,'\x0a')},{'name':'date_start','value':_0x21df75['toISOString']()[_0x5b89('0x11')](0x0,0x13)[_0x5b89('0x12')]('T','\x20')},{'name':_0x5b89('0x13'),'value':'0'},{'name':_0x5b89('0x14'),'value':'15'},{'name':'parent_id','value':_0x1ef93a['id']},{'name':_0x5b89('0x15'),'value':'Contacts'},{'name':_0x5b89('0x16'),'value':_0x1ef93a[_0x5b89('0xc')]},{'name':_0x5b89('0x17'),'value':_0x5244f4}];if(_0x5d1be7[_0x5b89('0x18')]){_[_0x5b89('0x19')](_0x5d1be7,function(_0xeca95a){if(_0x504f87[_0xeca95a[_0x5b89('0x1a')]]){_0x564250[_0x5b89('0x1b')]({'name':_0xeca95a[_0x5b89('0x1c')],'value':_0x504f87[_0xeca95a[_0x5b89('0x1a')]]});}});}return request({'form':{'method':_0x5b89('0x1d'),'input_type':_0x5b89('0x1e'),'response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0xe49cde['id'],'module_name':_0x5b89('0x20'),'name_value_list':_0x564250})}});}function getAuth(_0x39c7c1){return util[_0x5b89('0x21')](_0x5b89('0x22'),new Buffer(_0x39c7c1[_0x5b89('0x23')]+':X')[_0x5b89('0x24')](_0x5b89('0x25')));}function getServerInfo(_0x9234e3){return request({'form':{'method':_0x5b89('0x26'),'input_type':_0x5b89('0x1e'),'response_type':_0x5b89('0x1e'),'rest_data':JSON['stringify']({'session':_0x9234e3['id']})}});}function getUser(_0x368544,_0xc80bb8,_0x5231f9){if(!_[_0x5b89('0x27')](_0xc80bb8)){logger[_0x5b89('0xa')]('Getting\x20agent\x20with\x20name',_0xc80bb8);return request({'form':{'method':_0x5b89('0x28'),'input_type':_0x5b89('0x1e'),'response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0x5231f9['id'],'module_name':_0x5b89('0x29'),'query':util[_0x5b89('0x21')](_0x5b89('0x2a'),_0xc80bb8),'order_by':'','offset':'0','select_fields':['id',_0x5b89('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5b89('0x2b')](function(_0x24945e){if(_0x24945e['entry_list'][_0x5b89('0x18')]){var _0x27b790=_['find'](_0x24945e[_0x5b89('0x2c')],function(_0x47da5f){return _0x47da5f['name_value_list'][_0x5b89('0x2d')]['value']===_0xc80bb8;});if(_0x27b790){logger[_0x5b89('0xa')](_0x5b89('0x2e'));return BPromise['resolve']({'id':_0x27b790[_0x5b89('0x2f')]['id']['value'],'name':_0x27b790[_0x5b89('0x2f')][_0x5b89('0xc')]['value']});}}logger[_0x5b89('0xa')](_0x5b89('0x30'));return BPromise[_0x5b89('0x31')]({'id':_0x5231f9[_0x5b89('0x2f')][_0x5b89('0x32')][_0x5b89('0x33')],'name':_0x5231f9[_0x5b89('0x2f')][_0x5b89('0x2d')]['value']});});}else{logger[_0x5b89('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5b89('0x31')]({'id':_0x5231f9['name_value_list']['user_id'][_0x5b89('0x33')],'name':_0x5231f9['name_value_list']['user_name'][_0x5b89('0x33')]});}}function getEndUser(_0x2a18b3,_0x4bfd7b,_0x351b7e,_0x569759){logger['info'](_0x5b89('0x34'),_0x351b7e);return request({'form':{'method':_0x5b89('0x28'),'input_type':'JSON','response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0x569759['id'],'module_name':_0x5b89('0x35'),'query':util[_0x5b89('0x21')](_0x5b89('0x36'),_0x351b7e),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5b89('0x2b')](function(_0x50a3b3){if(_0x50a3b3['entry_list'][_0x5b89('0x18')]){var _0x4e9e23=_[_0x5b89('0x37')](_0x50a3b3[_0x5b89('0x2c')],function(_0x2ff7a7){return _0x2ff7a7[_0x5b89('0x2f')][_0x5b89('0x38')]['value']===_0x351b7e;});if(_0x4e9e23){logger[_0x5b89('0xa')](_0x5b89('0x39'));return BPromise[_0x5b89('0x31')]({'id':_0x4e9e23['name_value_list']['id'][_0x5b89('0x33')],'name':_0x4e9e23[_0x5b89('0x2f')][_0x5b89('0xc')][_0x5b89('0x33')],'phone':_0x4e9e23[_0x5b89('0x2f')][_0x5b89('0x38')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x5b89('0x1d'),'input_type':'JSON','response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0x569759['id'],'module_name':_0x5b89('0x35'),'name_value_list':[{'name':_0x5b89('0x3a'),'value':_0x4bfd7b!==_0x5b89('0x3b')?_0x4bfd7b:util[_0x5b89('0x21')](_0x5b89('0x3c'),_0x351b7e)},{'name':_0x5b89('0x38'),'value':_0x351b7e}]})}})[_0x5b89('0x2b')](function(_0x2c857c){logger[_0x5b89('0xa')](_0x5b89('0x3d'));return BPromise[_0x5b89('0x31')]({'id':_0x2c857c['id'],'name':_0x2c857c[_0x5b89('0x2c')][_0x5b89('0x3a')][_0x5b89('0x33')],'phone':_0x2c857c['entry_list']['phone_home'][_0x5b89('0x33')]});});}});}function request(_0x4679d6){logger[_0x5b89('0x3e')]('[HTTP]',JSON[_0x5b89('0x1f')](_0x4679d6));return rp(_['merge'](def,_0x4679d6));}function getTags(_0x3d944f,_0x31fe8f){var _0x588c07=[];if(_0x3d944f&&_0x3d944f[_0x5b89('0x18')]>0x0){_0x588c07=_[_0x5b89('0x3f')](_0x3d944f,_0x31fe8f);}return _0x588c07;}function getCustomFields(_0x25fca5,_0x3d770a){var _0x5e4f1e=[];var _0x350bea={'custom_fields':[]};if(_0x25fca5[_0x5b89('0x18')]>0x0){_['forEach'](_0x25fca5,function(_0x476f54){if(_0x476f54['type']===_0x5b89('0x40')&&_0x476f54[_0x5b89('0x41')]&&!_0x476f54[_0x5b89('0x42')]){_0x350bea[_0x476f54[_0x5b89('0x41')][_0x5b89('0x43')]()]=_0x476f54[_0x5b89('0x44')][_0x5b89('0x24')]();}else if(_0x476f54[_0x5b89('0x45')]===_0x5b89('0x40')&&_0x476f54[_0x5b89('0x1c')]&&_0x476f54[_0x5b89('0x42')]){_0x350bea['custom_fields'][_0x5b89('0x1b')]({'id':_0x476f54[_0x5b89('0x1c')],'value':_0x476f54[_0x5b89('0x44')][_0x5b89('0x24')]()});}else if(_0x476f54[_0x5b89('0x45')]===_0x5b89('0x46')&&_0x476f54['variableName']&&_0x476f54[_0x5b89('0x1c')]&&_0x476f54[_0x5b89('0x42')]){_0x3d770a[_0x476f54[_0x5b89('0x1a')]]&&_0x350bea[_0x5b89('0x47')]['push']({'id':_0x476f54['idField'],'value':_0x3d770a[_0x476f54[_0x5b89('0x1a')]][_0x5b89('0x24')]()});}else if(_0x476f54[_0x5b89('0x45')]===_0x5b89('0x48')&&_0x476f54[_0x5b89('0x49')]&&_0x476f54['Variable']['name']&&_0x476f54['idField']&&_0x476f54[_0x5b89('0x42')]){_0x3d770a[_0x476f54[_0x5b89('0x49')]['name']['toLowerCase']()]&&_0x350bea[_0x5b89('0x47')][_0x5b89('0x1b')]({'id':_0x476f54[_0x5b89('0x1c')],'value':_0x3d770a[_0x476f54[_0x5b89('0x49')]['name'][_0x5b89('0x43')]()][_0x5b89('0x24')]()});}});}return _0x350bea;}function getConnection(_0xb5a862){return request({'method':_0x5b89('0x4a'),'form':{'method':'login','input_type':_0x5b89('0x1e'),'response_type':'JSON','rest_data':JSON[_0x5b89('0x1f')]({'user_auth':{'user_name':_0xb5a862[_0x5b89('0x4b')],'password':_0xb5a862['password'],'encryption':_0x5b89('0x4c')},'application':_0x5b89('0x4d')})}})['then'](function(_0x1609a9){var _0x231928=_0x1609a9;if(_0x231928['id']){def[_0x5b89('0x4e')]=_0x231928['id'];return BPromise['resolve'](_0x231928);}else{throw new Error(util[_0x5b89('0x21')](_0x5b89('0x4f'),_0xb5a862['id']));}});}function setRelationship(_0x30f429,_0x440f7d,_0x4e78db,_0x53a692){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x5b89('0x1e'),'rest_data':JSON['stringify']({'session':_0x30f429['id'],'module_name':_0x5b89('0x20'),'module_id':_0x4e78db['id'],'link_field_name':_0x53a692,'related_ids':[_0x440f7d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5b89('0x50')]=function(_0x1e9fe3,_0x482ca4,_0x55b2ac,_0x1b81d8,_0x2195cb,_0x27f5bd){var _0x1b8dff,_0x1de6ed,_0xe76f55,_0x1e8222;_0x27f5bd[_0x5b89('0x51')]=intUtil[_0x5b89('0x52')](_0x27f5bd[_0x5b89('0x51')]);_0x27f5bd[_0x5b89('0x53')]=intUtil[_0x5b89('0x52')](_0x27f5bd[_0x5b89('0x53')]);def[_0x5b89('0x54')]=util['format'](_0x5b89('0x55'),_0x27f5bd[_0x5b89('0x51')]);if(_0x2195cb&&_0x2195cb['monitor_format']){logger[_0x5b89('0xa')]('[QUEUE]',_0x5b89('0x56'));_0x482ca4['recordingURL']=util[_0x5b89('0x21')](_0x5b89('0x57'),_0x27f5bd[_0x5b89('0x53')],_0x482ca4[_0x5b89('0x58')],md5(_0x482ca4[_0x5b89('0x58')]));}else{_0x482ca4[_0x5b89('0x59')]='';}return getConnection(_0x27f5bd)['then'](function(_0x134494){_0x1e8222=_0x134494;return getUser(_0x27f5bd,_0x1b81d8[_0x5b89('0xc')],_0x1e8222);})[_0x5b89('0x2b')](function(_0x3b56a8){_0x1b8dff=_0x3b56a8;logger['info'](_0x5b89('0x5a'),_0x1b8dff['id']);return getEndUser(_0x27f5bd,_0x482ca4[_0x5b89('0x5b')],_0x482ca4[_0x5b89('0x5c')],_0x1e8222);})[_0x5b89('0x2b')](function(_0x4162fb){_0x1de6ed=_0x4162fb;logger[_0x5b89('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1de6ed['id']);return getTicket(_0x27f5bd,_0x1b8dff,_0x1de6ed,_0x55b2ac,_0x482ca4,_0x55b2ac[_0x5b89('0x5d')],_0x1e8222,'Inbound');})[_0x5b89('0x2b')](function(_0x21b067){_0xe76f55=_0x21b067;logger['info'](_0x5b89('0x5e'));logger[_0x5b89('0xa')](_0x5b89('0x5f'),_0xe76f55['id']);return setRelationship(_0x1e8222,_0x1b8dff,_0xe76f55,'users');})[_0x5b89('0x2b')](function(){return setRelationship(_0x1e8222,_0x1de6ed,_0xe76f55,_0x5b89('0x60'));})[_0x5b89('0x2b')](function(){return getServerInfo(_0x1e8222);})[_0x5b89('0x2b')](function(_0x4f535d){var _0xbba781=parseInt(_0x4f535d['version'][_0x5b89('0x61')](0x0));var _0x9c9d2e=util[_0x5b89('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x27f5bd[_0x5b89('0x51')],_0xe76f55['id']);if(_0xbba781>0x6){_0x9c9d2e=util[_0x5b89('0x21')](_0x5b89('0x62'),_0x27f5bd['remoteUri'],_0xe76f55['id']);}logger[_0x5b89('0xa')](_0x5b89('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1b81d8[_0x5b89('0xc')]),_0x5b89('0x64'),{'uri':_0x9c9d2e});})[_0x5b89('0x65')](function(_0x39ba4e){logger['error']('[QUEUE]',JSON[_0x5b89('0x1f')](_0x39ba4e));});};exports['outbound']=function(_0x4fef3e,_0x2dbd7e,_0x3dcbfa,_0x58b891,_0x323846,_0x14cd47,_0x4f7d15){var _0x14c760,_0x196296,_0x220566,_0x3dc9ba;_0x14cd47[_0x5b89('0x51')]=intUtil[_0x5b89('0x52')](_0x14cd47[_0x5b89('0x51')]);_0x14cd47[_0x5b89('0x53')]=intUtil[_0x5b89('0x52')](_0x14cd47['serverUrl']);def['uri']=util['format'](_0x5b89('0x55'),_0x14cd47[_0x5b89('0x51')]);if(_0x4f7d15&&_0x4f7d15['recordingFormat']&&_0x4f7d15[_0x5b89('0x66')]!==_0x5b89('0x67')){logger[_0x5b89('0xa')]('[OUTBOUND]',_0x5b89('0x56'));_0x2dbd7e['recordingURL']=util[_0x5b89('0x21')](_0x5b89('0x57'),_0x14cd47['serverUrl'],_0x2dbd7e[_0x5b89('0x58')],md5(_0x2dbd7e['uniqueid']));}return getConnection(_0x14cd47)[_0x5b89('0x2b')](function(_0x389d61){_0x3dc9ba=_0x389d61;return getUser(_0x14cd47,_0x58b891['name'],_0x3dc9ba);})[_0x5b89('0x2b')](function(_0x31f8e8){_0x14c760=_0x31f8e8;logger['info']('The\x20User\x20ID\x20is:',_0x14c760['id']);return getEndUser(_0x14cd47,_0x2dbd7e[_0x5b89('0x68')],_0x2dbd7e['destcalleridnum'],_0x3dc9ba);})[_0x5b89('0x2b')](function(_0x2d9a13){_0x196296=_0x2d9a13;logger[_0x5b89('0xa')]('The\x20Enduser\x20ID\x20is:',_0x196296['id']);return getTicket(_0x14cd47,_0x14c760,_0x196296,_0x3dcbfa,_0x2dbd7e,_0x3dcbfa[_0x5b89('0x5d')],_0x3dc9ba,_0x5b89('0x69'));})[_0x5b89('0x2b')](function(_0x1f1373){_0x220566=_0x1f1373;logger[_0x5b89('0xa')](_0x5b89('0x5e'));logger[_0x5b89('0xa')](_0x5b89('0x5f'),_0x220566['id']);return setRelationship(_0x3dc9ba,_0x14c760,_0x220566,'users');})[_0x5b89('0x2b')](function(){return setRelationship(_0x3dc9ba,_0x196296,_0x220566,_0x5b89('0x60'));})[_0x5b89('0x2b')](function(){return getServerInfo(_0x3dc9ba);})[_0x5b89('0x2b')](function(_0x6331c4){var _0x4434c5=parseInt(_0x6331c4[_0x5b89('0x6a')][_0x5b89('0x61')](0x0));var _0x2c227a=util[_0x5b89('0x21')](_0x5b89('0x6b'),_0x14cd47[_0x5b89('0x51')],_0x220566['id']);if(_0x4434c5>0x6){_0x2c227a=util[_0x5b89('0x21')](_0x5b89('0x62'),_0x14cd47[_0x5b89('0x51')],_0x220566['id']);}logger[_0x5b89('0xa')](_0x5b89('0x6c'),_0x5b89('0x6d'));emit(util[_0x5b89('0x21')]('user:%s',_0x58b891[_0x5b89('0xc')]),'trigger:browser:url',{'uri':_0x2c227a});})[_0x5b89('0x65')](function(_0x45b06d){logger[_0x5b89('0x6e')]('[OUTBOUND]',JSON[_0x5b89('0x1f')](_0x45b06d));});};exports[_0x5b89('0x6f')]=function(_0x14cdc1,_0x52520c,_0x37ecb1,_0x2678d4,_0x329529,_0x417c05){var _0x5e182e,_0x35eaee,_0x2f8ab9,_0x3ddb73;_0x417c05['remoteUri']=intUtil[_0x5b89('0x52')](_0x417c05[_0x5b89('0x51')]);_0x417c05[_0x5b89('0x53')]=intUtil[_0x5b89('0x52')](_0x417c05[_0x5b89('0x53')]);def[_0x5b89('0x54')]=util[_0x5b89('0x21')](_0x5b89('0x55'),_0x417c05[_0x5b89('0x51')]);if(_0x329529&&_0x329529[_0x5b89('0x70')]){logger[_0x5b89('0xa')]('['+_0x52520c[_0x5b89('0x71')][_0x5b89('0x72')]()+']',_0x5b89('0x56'));_0x52520c['recordingURL']=util['format'](_0x5b89('0x57'),_0x417c05[_0x5b89('0x53')],_0x52520c[_0x5b89('0x58')],md5(_0x52520c[_0x5b89('0x58')]));}else{_0x52520c[_0x5b89('0x59')]='';}return getConnection(_0x417c05)[_0x5b89('0x2b')](function(_0x3b3118){_0x3ddb73=_0x3b3118;if(!_[_0x5b89('0x27')](_0x2678d4)){return getUser(_0x417c05,_0x2678d4['name'],_0x3ddb73);}else{return getUser(_0x417c05,null,_0x3ddb73);}})[_0x5b89('0x2b')](function(_0x1f1555){_0x5e182e=_0x1f1555;logger[_0x5b89('0xa')](_0x5b89('0x5a'),_0x5e182e['id']);return getEndUser(_0x417c05,_0x52520c[_0x5b89('0x5b')],_0x52520c[_0x5b89('0x5c')],_0x3ddb73);})['then'](function(_0x5dad1c){_0x35eaee=_0x5dad1c;logger[_0x5b89('0xa')]('The\x20Enduser\x20ID\x20is:',_0x35eaee['id']);return getTicket(_0x417c05,_0x5e182e,_0x35eaee,_0x37ecb1,_0x52520c,_0x37ecb1[_0x5b89('0x5d')],_0x3ddb73,'Inbound');})[_0x5b89('0x2b')](function(_0x58663d){_0x2f8ab9=_0x58663d;logger[_0x5b89('0xa')](_0x5b89('0x5e'));logger[_0x5b89('0xa')](_0x5b89('0x5f'),_0x2f8ab9['id']);return setRelationship(_0x3ddb73,_0x5e182e,_0x2f8ab9,_0x5b89('0x73'));})[_0x5b89('0x2b')](function(){return setRelationship(_0x3ddb73,_0x35eaee,_0x2f8ab9,_0x5b89('0x60'));})['then'](function(){return getServerInfo(_0x3ddb73);})[_0x5b89('0x65')](function(_0x25880d){logger['error']('['+_0x52520c['lastevent'][_0x5b89('0x72')]()+']',JSON[_0x5b89('0x1f')](_0x25880d));});}; \ 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 bc9d2d3..3aaad0b 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 _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 +var _0xef71=['variableName','toString','Variable','name','toLowerCase','%s:\x20%s','keyType','format','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable'];(function(_0x2c20a3,_0x15183b){var _0x474693=function(_0x5d851f){while(--_0x5d851f){_0x2c20a3['push'](_0x2c20a3['shift']());}};_0x474693(++_0x15183b);}(_0xef71,0xc7));var _0x1ef7=function(_0x46c59b,_0x5635dd){_0x46c59b=_0x46c59b-0x0;var _0x16dd2d=_0xef71[_0x46c59b];return _0x16dd2d;};'use strict';var _=require(_0x1ef7('0x0'));var util=require(_0x1ef7('0x1'));exports[_0x1ef7('0x2')]=function(_0x33ebd8,_0x55bdac,_0x9126a7){var _0x2e17de=[];if(_0x33ebd8[_0x1ef7('0x3')]>0x0){var _0x5982de=_[_0x1ef7('0x4')](_0x33ebd8,['id']);for(var _0x36ac23=0x0;_0x36ac23<_0x5982de[_0x1ef7('0x3')];_0x36ac23++){var _0xe0dc10=_0x5982de[_0x36ac23];if(_0xe0dc10[_0x1ef7('0x5')]===_0x1ef7('0x6')){_0x2e17de[_0x1ef7('0x7')](_0xe0dc10['content']);}else if(_0xe0dc10[_0x1ef7('0x5')]===_0x1ef7('0x8')&&_0xe0dc10[_0x1ef7('0x9')]){_0x55bdac[_0xe0dc10['variableName']]&&_0x2e17de['push'](_0x55bdac[_0xe0dc10[_0x1ef7('0x9')]][_0x1ef7('0xa')]());}else if(_0xe0dc10['type']==='customVariable'&&_0xe0dc10[_0x1ef7('0xb')]&&_0xe0dc10[_0x1ef7('0xb')][_0x1ef7('0xc')]){_0x55bdac[_0xe0dc10[_0x1ef7('0xb')][_0x1ef7('0xc')][_0x1ef7('0xd')]()]&&_0x2e17de[_0x1ef7('0x7')](_0x55bdac[_0xe0dc10[_0x1ef7('0xb')]['name']['toLowerCase']()][_0x1ef7('0xa')]());}else if(_0xe0dc10[_0x1ef7('0x5')]==='keyValue'){if(_0xe0dc10['keyType']===_0x1ef7('0x6')&&_0xe0dc10['key']){_0x2e17de[_0x1ef7('0x7')](util['format'](_0x1ef7('0xe'),_0xe0dc10['key'],_0xe0dc10['keyContent']));}else if(_0xe0dc10[_0x1ef7('0xf')]===_0x1ef7('0x8')&&_0xe0dc10['variableName']&&_0xe0dc10['key']){_0x55bdac[_0xe0dc10[_0x1ef7('0x9')]]&&_0x2e17de['push'](util[_0x1ef7('0x10')](_0x1ef7('0xe'),_0xe0dc10[_0x1ef7('0x11')],_0x55bdac[_0xe0dc10[_0x1ef7('0x9')]]));}else if(_0xe0dc10[_0x1ef7('0xf')]==='customVariable'&&_0xe0dc10[_0x1ef7('0xb')]&&_0xe0dc10['Variable']['name']&&_0xe0dc10[_0x1ef7('0x11')]){_0x55bdac[_0xe0dc10[_0x1ef7('0xb')][_0x1ef7('0xc')][_0x1ef7('0xd')]()]&&_0x2e17de[_0x1ef7('0x7')](util[_0x1ef7('0x10')](_0x1ef7('0xe'),_0xe0dc10[_0x1ef7('0x11')],_0x55bdac[_0xe0dc10['Variable'][_0x1ef7('0xc')][_0x1ef7('0xd')]()]));}}}}return _0x2e17de[_0x1ef7('0x12')](_0x9126a7);};exports[_0x1ef7('0x13')]=function(_0x51ef12){var _0x515468=_0x51ef12[_0x1ef7('0x14')](-0x1);if(_0x515468==='/'){_0x51ef12=_0x51ef12[_0x1ef7('0x15')](0x0,_0x51ef12[_0x1ef7('0x16')](_0x515468));}return _0x51ef12;};exports[_0x1ef7('0x17')]=function(_0x46ff08){if(!_[_0x1ef7('0x18')](_0x46ff08)&&_0x46ff08!==''){var _0x3cc659=/^(([^<>()\[\]\\.,;:\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 _0x3cc659[_0x1ef7('0x19')](String(_0x46ff08)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 2c7fb3f..ca03b39 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_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 +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x39b1bd,_0x554c9f){var _0x1dfb46=function(_0x4a15de){while(--_0x4a15de){_0x39b1bd['push'](_0x39b1bd['shift']());}};_0x1dfb46(++_0x554c9f);}(_0xe706,0xa3));var _0x6e70=function(_0x58e2a5,_0x4e822c){_0x58e2a5=_0x58e2a5-0x0;var _0x440ba0=_0xe706[_0x58e2a5];return _0x440ba0;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 3f88aae..a6c04b6 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 _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 +var _0x4ba4=['email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/agent/tickets/%s','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','POST','getString','Subjects','Descriptions','Fields','then','info','validateEmail','format','%s/search.json','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','picklist','nameField','customField','toLowerCase','content','includes','string','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','Authorization'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x4ba4,0x7b));var _0x44ba=function(_0xaf2024,_0x452360){_0xaf2024=_0xaf2024-0x0;var _0x2e301c=_0x4ba4[_0xaf2024];return _0x2e301c;};'use strict';var _=require(_0x44ba('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x44ba('0x1'));var Redis=require(_0x44ba('0x2'));var intUtil=require('./util');var config=require(_0x44ba('0x3'));var logger=require(_0x44ba('0x4'))(_0x44ba('0x5'));config[_0x44ba('0x6')]=_[_0x44ba('0x7')](config[_0x44ba('0x6')],{'host':_0x44ba('0x8'),'port':0x18eb});var io=require(_0x44ba('0x9'))(new Redis(config['redis']));function emit(_0x41972d,_0x231b0a,_0x2649fb){io['to'](_0x41972d)[_0x44ba('0xa')](_0x231b0a,_0x2649fb);}var headers={'Content-Type':_0x44ba('0xb'),'Accept':_0x44ba('0xb')};function getTicket(_0x1145ad,_0x2e71b2,_0x44b866,_0x4882e5,_0x578608){logger['info'](_0x44ba('0xc'));return request({'uri':util['format']('%s/tickets.json',_0x1145ad['remoteUri']),'method':_0x44ba('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x44b866['id'],'submitter_id':_0x2e71b2?_0x2e71b2['id']:undefined,'assignee_id':_0x2e71b2?_0x2e71b2['id']:undefined,'tags':getTags(_0x4882e5['Tags'],'name'),'subject':intUtil[_0x44ba('0xe')](_0x4882e5[_0x44ba('0xf')],_0x578608,'\x20'),'description':intUtil[_0x44ba('0xe')](_0x4882e5[_0x44ba('0x10')],_0x578608,'\x0a'),'comment':{'public':![],'body':intUtil[_0x44ba('0xe')](_0x4882e5['Descriptions'],_0x578608,'\x0a')}},getCustomFields(_0x4882e5[_0x44ba('0x11')],_0x578608))}})[_0x44ba('0x12')](function(_0x29b6e3){logger[_0x44ba('0x13')]('Ticket\x20created!');return _0x29b6e3['ticket'];});}function getUser(_0x401e76,_0x12099f){if(intUtil[_0x44ba('0x14')](_0x12099f)){logger[_0x44ba('0x13')]('Getting\x20agent\x20with\x20email',_0x12099f);return request({'uri':util[_0x44ba('0x15')](_0x44ba('0x16'),_0x401e76['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x12099f)}})['then'](function(_0x470f12){if(_0x470f12[_0x44ba('0x17')]){logger['info'](_0x44ba('0x18'));return _[_0x44ba('0x19')](_0x470f12[_0x44ba('0x1a')],{'email':_0x12099f,'role':'agent'});}else{logger[_0x44ba('0x13')](_0x44ba('0x1b'));return request({'uri':util[_0x44ba('0x15')](_0x44ba('0x1c'),_0x401e76[_0x44ba('0x1d')])})[_0x44ba('0x12')](function(_0x2f282a){logger[_0x44ba('0x13')](_0x44ba('0x1e'));return _0x2f282a['user'];});}});}else{logger[_0x44ba('0x13')](_0x44ba('0x1b'));return request({'uri':util[_0x44ba('0x15')]('%s/users/me.json',_0x401e76['remoteUri'])})[_0x44ba('0x12')](function(_0x49a4c5){logger[_0x44ba('0x13')](_0x44ba('0x1e'));return _0x49a4c5['user'];});}}function getEndUser(_0x1ad19f,_0x6330ec,_0x5e286c){logger['info'](_0x44ba('0x1f'),_0x5e286c);return request({'uri':util[_0x44ba('0x15')]('%s/search.json',_0x1ad19f['remoteUri']),'qs':{'query':util['format'](_0x44ba('0x20'),_0x5e286c)}})[_0x44ba('0x12')](function(_0x33996e){var _0x429597;if(_0x33996e[_0x44ba('0x1a')][_0x44ba('0x21')]){_0x33996e[_0x44ba('0x1a')]=_[_0x44ba('0x22')](_0x33996e[_0x44ba('0x1a')],{'suspended':![],'role':_0x44ba('0x23')});if(_0x33996e[_0x44ba('0x1a')][_0x44ba('0x21')]){_0x429597=_['first'](_0x33996e[_0x44ba('0x1a')]);}}if(_0x429597){logger[_0x44ba('0x13')](_0x44ba('0x24'));return _0x429597;}else{logger[_0x44ba('0x13')](_0x44ba('0x25'));return request({'uri':util['format']('%s/users.json',_0x1ad19f[_0x44ba('0x1d')]),'method':_0x44ba('0xd'),'body':{'user':{'role':_0x44ba('0x23'),'name':util[_0x44ba('0x15')](_0x44ba('0x26'),_0x6330ec||_0x5e286c),'phone':_0x5e286c}}})['then'](function(_0x45dae4){logger[_0x44ba('0x13')](_0x44ba('0x27'));return _0x45dae4[_0x44ba('0x28')];});}});}function getAuth(_0x5eacd7){var _0x29ff3f;if(_0x5eacd7[_0x44ba('0x29')]===_0x44ba('0x2a')){_0x29ff3f=util[_0x44ba('0x15')]('%s:%s',_0x5eacd7[_0x44ba('0x2b')],_0x5eacd7[_0x44ba('0x2a')]);}else if(_0x5eacd7['authType']===_0x44ba('0x2c')){_0x29ff3f=util[_0x44ba('0x15')](_0x44ba('0x2d'),_0x5eacd7[_0x44ba('0x2b')],_0x5eacd7[_0x44ba('0x2c')]);}return util[_0x44ba('0x15')](_0x44ba('0x2e'),new Buffer(_0x29ff3f)[_0x44ba('0x2f')]('base64'));}function request(_0x2a9d1f){logger[_0x44ba('0x30')](_0x44ba('0x31'),JSON[_0x44ba('0x32')](_0x2a9d1f));return rp(_['defaults'](_0x2a9d1f,{'method':_0x44ba('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x21fe40,_0x2edb5c){var _0x559624=[];if(_0x21fe40&&_0x21fe40[_0x44ba('0x21')]>0x0){_0x559624=_[_0x44ba('0x34')](_0x21fe40,_0x2edb5c);}return _0x559624;}function getCustomFields(_0x3e1149,_0x524ac4){var _0x56a15d=[];var _0x36ebc4={'custom_fields':[]};if(_0x3e1149[_0x44ba('0x21')]>0x0){_['forEach'](_0x3e1149,function(_0x5bfa7c){if(_['includes'](['string',_0x44ba('0x35')],_0x5bfa7c['type'])&&_0x5bfa7c[_0x44ba('0x36')]&&!_0x5bfa7c[_0x44ba('0x37')]){_0x36ebc4[_0x5bfa7c[_0x44ba('0x36')][_0x44ba('0x38')]()]=_0x5bfa7c[_0x44ba('0x39')][_0x44ba('0x2f')]();}else if(_[_0x44ba('0x3a')]([_0x44ba('0x3b'),_0x44ba('0x35')],_0x5bfa7c[_0x44ba('0x3c')])&&_0x5bfa7c[_0x44ba('0x3d')]&&_0x5bfa7c[_0x44ba('0x37')]){_0x36ebc4[_0x44ba('0x3e')][_0x44ba('0x3f')]({'id':_0x5bfa7c['idField'],'value':_0x5bfa7c[_0x44ba('0x39')][_0x44ba('0x2f')]()});}else if(_0x5bfa7c[_0x44ba('0x3c')]===_0x44ba('0x40')&&_0x5bfa7c[_0x44ba('0x41')]&&_0x5bfa7c['idField']&&_0x5bfa7c[_0x44ba('0x37')]){_0x524ac4[_0x5bfa7c[_0x44ba('0x41')]]&&_0x36ebc4[_0x44ba('0x3e')][_0x44ba('0x3f')]({'id':_0x5bfa7c[_0x44ba('0x3d')],'value':_0x524ac4[_0x5bfa7c[_0x44ba('0x41')]][_0x44ba('0x2f')]()});}else if(_0x5bfa7c[_0x44ba('0x3c')]===_0x44ba('0x42')&&_0x5bfa7c[_0x44ba('0x43')]&&_0x5bfa7c[_0x44ba('0x43')][_0x44ba('0x44')]&&_0x5bfa7c['idField']&&_0x5bfa7c[_0x44ba('0x37')]){_0x524ac4[_0x5bfa7c[_0x44ba('0x43')]['name'][_0x44ba('0x38')]()]&&_0x36ebc4[_0x44ba('0x3e')]['push']({'id':_0x5bfa7c[_0x44ba('0x3d')],'value':_0x524ac4[_0x5bfa7c['Variable']['name'][_0x44ba('0x38')]()][_0x44ba('0x2f')]()});}});}return _0x36ebc4;}exports[_0x44ba('0x45')]=function(_0x820f74,_0x63083a,_0x32269d,_0x30d9ff,_0x48128d,_0x334343){var _0x32920e,_0xfea13e;_0x334343[_0x44ba('0x1d')]=intUtil[_0x44ba('0x46')](_0x334343[_0x44ba('0x1d')]);_0x334343[_0x44ba('0x47')]=intUtil['stripTrailingSlash'](_0x334343[_0x44ba('0x47')]);if(_0x48128d&&_0x48128d['monitor_format']){logger[_0x44ba('0x13')](_0x44ba('0x48'),_0x44ba('0x49'));_0x63083a[_0x44ba('0x4a')]=util[_0x44ba('0x15')](_0x44ba('0x4b'),_0x334343[_0x44ba('0x47')],_0x63083a[_0x44ba('0x4c')],md5(_0x63083a[_0x44ba('0x4c')]));}else{_0x63083a['recordingURL']='';}headers['Authorization']=getAuth(_0x334343);return getUser(_0x334343,_0x30d9ff['email'])['then'](function(_0xc338ae){_0x32920e=_0xc338ae;logger[_0x44ba('0x13')]('The\x20User\x20ID\x20is:',_0x32920e['id']);return getEndUser(_0x334343,_0x63083a[_0x44ba('0x4d')],_0x63083a[_0x44ba('0x4e')]);})[_0x44ba('0x12')](function(_0x5aecc0){_0xfea13e=_0x5aecc0;logger['info'](_0x44ba('0x4f'),_0xfea13e['id']);return getTicket(_0x334343,_0x32920e,_0xfea13e,_0x32269d,_0x63083a);})[_0x44ba('0x12')](function(_0xc84f92){if(_0xc84f92){logger[_0x44ba('0x13')](_0x44ba('0x50'),_0xc84f92['id']);switch(_0x334343[_0x44ba('0x3c')]){case _0x44ba('0x51'):logger[_0x44ba('0x13')]('[QUEUE]',_0x44ba('0x52'));return request({'uri':util[_0x44ba('0x15')](_0x44ba('0x53'),_0x334343[_0x44ba('0x1d')],_0x32920e['id'],_0xc84f92['id']),'method':_0x44ba('0xd')});case _0x44ba('0x54'):logger[_0x44ba('0x13')](_0x44ba('0x48'),_0x44ba('0x55'));emit(util[_0x44ba('0x15')](_0x44ba('0x56'),_0x30d9ff['name']),_0x44ba('0x57'),{'uri':util[_0x44ba('0x15')]('%s/agent/tickets/%s',_0x334343[_0x44ba('0x1d')][_0x44ba('0x58')](_0x44ba('0x59'),''),_0xc84f92['id'])});break;default:logger[_0x44ba('0x5a')](_0x44ba('0x48'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x44ba('0x5b')](function(_0x43d2e5){logger[_0x44ba('0x5a')](_0x44ba('0x5c'),util[_0x44ba('0x5d')](_0x43d2e5,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x595c61,_0x52d302,_0x2b32a7,_0x59f7e6,_0x4d24d4,_0x1eb765,_0x67eeca){var _0x120121,_0x13f387;_0x1eb765[_0x44ba('0x1d')]=intUtil['stripTrailingSlash'](_0x1eb765[_0x44ba('0x1d')]);_0x1eb765[_0x44ba('0x47')]=intUtil[_0x44ba('0x46')](_0x1eb765[_0x44ba('0x47')]);if(_0x67eeca&&_0x67eeca['recordingFormat']&&_0x67eeca[_0x44ba('0x5e')]!==_0x44ba('0x5f')){logger['info']('[OUTBOUND]',_0x44ba('0x49'));_0x52d302[_0x44ba('0x4a')]=util[_0x44ba('0x15')](_0x44ba('0x4b'),_0x1eb765[_0x44ba('0x47')],_0x52d302['uniqueid'],md5(_0x52d302[_0x44ba('0x4c')]));}headers[_0x44ba('0x60')]=getAuth(_0x1eb765);return getUser(_0x1eb765,_0x59f7e6[_0x44ba('0x61')])[_0x44ba('0x12')](function(_0x199d5d){_0x120121=_0x199d5d;logger[_0x44ba('0x13')](_0x44ba('0x62'),_0x120121['id']);return getEndUser(_0x1eb765,_0x52d302[_0x44ba('0x63')],_0x52d302[_0x44ba('0x64')]);})['then'](function(_0xbdb457){_0x13f387=_0xbdb457;logger[_0x44ba('0x13')](_0x44ba('0x4f'),_0x13f387['id']);return getTicket(_0x1eb765,_0x120121,_0x13f387,_0x2b32a7,_0x52d302);})[_0x44ba('0x12')](function(_0x492d63){if(_0x492d63){logger[_0x44ba('0x13')]('The\x20Ticket\x20ID\x20is:',_0x492d63['id']);switch(_0x1eb765['type']){case'integrationTab':logger[_0x44ba('0x13')]('[OUTBOUND]',_0x44ba('0x52'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1eb765[_0x44ba('0x1d')],_0x120121['id'],_0x492d63['id']),'method':_0x44ba('0xd')});case'newTab':logger[_0x44ba('0x13')]('[OUTBOUND]',_0x44ba('0x55'));emit(util[_0x44ba('0x15')](_0x44ba('0x56'),_0x59f7e6[_0x44ba('0x44')]),_0x44ba('0x57'),{'uri':util[_0x44ba('0x15')](_0x44ba('0x65'),_0x1eb765[_0x44ba('0x1d')][_0x44ba('0x58')](_0x44ba('0x59'),''),_0x492d63['id'])});break;default:logger[_0x44ba('0x5a')](_0x44ba('0x66'),_0x44ba('0x67'));}}})['catch'](function(_0x1b1560){logger[_0x44ba('0x5a')](_0x44ba('0x68'),util['inspect'](_0x1b1560,{'showHidden':!![],'depth':null}));});};exports[_0x44ba('0x69')]=function(_0x51294c,_0x2f712f,_0x21d2b1,_0xe2ded,_0x455fd4,_0x4b4c04){var _0x472c5a,_0x18a6b8;_0x4b4c04[_0x44ba('0x1d')]=intUtil['stripTrailingSlash'](_0x4b4c04[_0x44ba('0x1d')]);_0x4b4c04['serverUrl']=intUtil[_0x44ba('0x46')](_0x4b4c04[_0x44ba('0x47')]);if(_0x455fd4&&_0x455fd4[_0x44ba('0x6a')]){logger[_0x44ba('0x13')]('['+_0x2f712f[_0x44ba('0x6b')][_0x44ba('0x6c')]()+']',_0x44ba('0x49'));_0x2f712f['recordingURL']=util[_0x44ba('0x15')](_0x44ba('0x4b'),_0x4b4c04[_0x44ba('0x47')],_0x2f712f[_0x44ba('0x4c')],md5(_0x2f712f['uniqueid']));}else{_0x2f712f[_0x44ba('0x4a')]='';}headers[_0x44ba('0x60')]=getAuth(_0x4b4c04);return getUser(_0x4b4c04)[_0x44ba('0x12')](function(_0x497005){_0x472c5a=_0x497005;logger[_0x44ba('0x13')]('The\x20User\x20ID\x20is:',_0x472c5a['id']);return getEndUser(_0x4b4c04,_0x2f712f[_0x44ba('0x4d')],_0x2f712f[_0x44ba('0x4e')]);})[_0x44ba('0x12')](function(_0x6277be){_0x18a6b8=_0x6277be;logger['info'](_0x44ba('0x4f'),_0x18a6b8['id']);return getTicket(_0x4b4c04,_0x472c5a,_0x18a6b8,_0x21d2b1,_0x2f712f);})[_0x44ba('0x12')](function(_0x1c577b){if(_0x1c577b){logger[_0x44ba('0x13')](_0x44ba('0x50'),_0x1c577b['id']);}})[_0x44ba('0x5b')](function(_0x4f0f95){logger[_0x44ba('0x5a')]('['+_0x2f712f[_0x44ba('0x6b')][_0x44ba('0x6c')]()+']'+_0x44ba('0x6d'),util[_0x44ba('0x5d')](_0x4f0f95,{'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 7d544e3..2225062 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 _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 +var _0xb315=['then','add','catch','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','getString','Subjects','Description','Descriptions','enduserType','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','Fields','Call\x20created!','err','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','zoho.eu','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','unmanaged','monitor_format','toUpperCase','lodash','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb315,0x6f));var _0x5b31=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xb315[_0x361d3f];return _0x320229;};'use strict';var _=require(_0x5b31('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x5b31('0x1'));var intUtil=require(_0x5b31('0x2'));var moment=require(_0x5b31('0x3'));var Redis=require(_0x5b31('0x4'));var BPromise=require('bluebird');var config=require(_0x5b31('0x5'));var logger=require(_0x5b31('0x6'))(_0x5b31('0x7'));config[_0x5b31('0x8')]=_['defaults'](config[_0x5b31('0x8')],{'host':_0x5b31('0x9'),'port':0x18eb});var io=require(_0x5b31('0xa'))(new Redis(config['redis']));function emit(_0xc60941,_0x53c6ca,_0x3114a7){io['to'](_0xc60941)[_0x5b31('0xb')](_0x53c6ca,_0x3114a7);}function request(_0x162557){logger[_0x5b31('0xc')](_0x5b31('0xd'),JSON[_0x5b31('0xe')](_0x162557));return rp(_0x162557);}function getCustomFields(_0x1d6418,_0x186950){var _0x490007={};if(_0x1d6418['length']>0x0){_['forEach'](_0x1d6418,function(_0x465c08){if(_['includes']([_0x5b31('0xf'),_0x5b31('0x10')],_0x465c08[_0x5b31('0x11')])&&_0x465c08[_0x5b31('0x12')]){_0x490007[_0x465c08[_0x5b31('0x12')]]=_0x465c08[_0x5b31('0x13')][_0x5b31('0x14')]();}else if(_0x465c08['type']===_0x5b31('0x15')&&_0x465c08[_0x5b31('0x16')]&&_0x465c08[_0x5b31('0x12')]&&_0x186950[_0x465c08[_0x5b31('0x16')]]){_0x490007[_0x465c08[_0x5b31('0x12')]]=_0x186950[_0x465c08[_0x5b31('0x16')]][_0x5b31('0x14')]();}else if(_0x465c08[_0x5b31('0x11')]===_0x5b31('0x17')&&_0x465c08[_0x5b31('0x18')]&&_0x465c08[_0x5b31('0x18')]['name']&&_0x465c08['idField']&&_0x186950[_0x465c08[_0x5b31('0x18')][_0x5b31('0x19')][_0x5b31('0x1a')]()]){_0x490007[_0x465c08[_0x5b31('0x12')]]=_0x186950[_0x465c08[_0x5b31('0x18')]['name']['toLowerCase']()]['toString']();}});}return _0x490007;}function getName(_0x45ac12){if(_0x45ac12[_0x5b31('0x1b')]('\x20')>0x0){var _0x26c88c=_0x45ac12['split'](/ (.+)/);if(_0x26c88c[0x1]){return _0x26c88c;}}return[_0x45ac12,_0x45ac12];}var accountsTokens={};function getAccessToken(_0x5abf97){return new Promise(function(_0x59548c,_0x109f2b){if(!_[_0x5b31('0x1c')](accountsTokens[_0x5abf97['id']])&&!_[_0x5b31('0x1c')](accountsTokens[_0x5abf97['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x5abf97['id']][_0x5b31('0x1d')])){_0x59548c(accountsTokens[_0x5abf97['id']][_0x5b31('0x1e')]);}}var _0x5bea9e;switch(_0x5abf97[_0x5b31('0x1f')]){case'US':_0x5bea9e=_0x5b31('0x20');break;case'AU':_0x5bea9e=_0x5b31('0x21');break;case'EU':_0x5bea9e=_0x5b31('0x22');break;case'IN':_0x5bea9e='https://accounts.zoho.in';break;case'CN':_0x5bea9e=_0x5b31('0x23');break;default:_0x5bea9e=_0x5b31('0x22');break;}var _0x36e27d={'method':_0x5b31('0x24'),'uri':_0x5bea9e+_0x5b31('0x25'),'qs':{'refresh_token':_0x5abf97[_0x5b31('0x26')],'client_id':_0x5abf97[_0x5b31('0x27')],'client_secret':_0x5abf97['clientSecret'],'grant_type':_0x5b31('0x28')},'json':!![]};return rp(_0x36e27d)[_0x5b31('0x29')](function(_0x1304ab){accountsTokens[_0x5abf97['id']]={'access_token':_0x1304ab[_0x5b31('0x1e')],'expires_in':moment()[_0x5b31('0x2a')](_0x1304ab['expires_in'],'seconds')};_0x59548c(_0x1304ab[_0x5b31('0x1e')]);})[_0x5b31('0x2b')](function(_0x1b556c){logger['error']('Failing\x20creating\x20the\x20access_token',_0x1b556c[_0x5b31('0x2c')]);_0x109f2b(_0x1b556c);});});}function getUser(_0x1ee8a5,_0x556561,_0xda9640,_0x1611ca){logger[_0x5b31('0x2d')]('Search\x20user');return request({'method':_0x5b31('0x2e'),'uri':util[_0x5b31('0x2f')](_0x5b31('0x30'),_0x556561),'qs':{'type':_0x5b31('0x31')},'headers':{'Authorization':_0x5b31('0x32')+_0x1ee8a5},'json':!![]})['then'](function(_0x4e444c){if(_0x4e444c['users']){var _0x1585d9=-0x1;if(_[_0x5b31('0x33')](_0x4e444c[_0x5b31('0x34')])){if(!_[_0x5b31('0x1c')](_0x1611ca)){_0x1585d9=_[_0x5b31('0x35')](_0x4e444c[_0x5b31('0x34')],function(_0x64fee2){return _0x64fee2[_0x5b31('0x36')]===_0x1611ca;});}if(_0x1585d9>=0x0){logger[_0x5b31('0x2d')](_0x5b31('0x37'));}else{logger['info'](_0x5b31('0x38'));_0x1585d9=_[_0x5b31('0x35')](_0x4e444c[_0x5b31('0x34')],function(_0x4e019a){return _0x4e019a[_0x5b31('0x39')][_0x5b31('0x19')]===_0x5b31('0x3a');});}return _0x4e444c['users'][_0x1585d9];}else{if(_0x4e444c[_0x5b31('0x3b')][_0x5b31('0x39')][_0x5b31('0x19')]===_0x5b31('0x3a')){logger[_0x5b31('0x2d')](_0x5b31('0x38'));user=_0x4e444c[_0x5b31('0x3b')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x5b31('0xe')](_0x4e444c));throw new Error(_0x5b31('0x3c')+JSON[_0x5b31('0xe')](_0x4e444c));}}}else{logger[_0x5b31('0x3d')]('The\x20failing\x20result\x20is',JSON[_0x5b31('0xe')](_0x4e444c));throw new Error(_0x5b31('0x3c')+JSON[_0x5b31('0xe')](_0x4e444c));}})[_0x5b31('0x2b')](function(_0x10d417){console[_0x5b31('0x3d')](_0x10d417);});}function getZohoUser(_0x4bc822,_0x5edb2a){return new BPromise(function(_0x4003f6,_0x34e5a0){request(_0x4bc822)['then'](function(_0x2e8bc3){var _0x22cb76=null;if(_0x2e8bc3){_0x22cb76=_0x2e8bc3[_0x5b31('0x3e')][0x0];_0x22cb76['enduserType']=_0x5edb2a;}_0x4003f6(_0x22cb76);})[_0x5b31('0x2b')](function(_0x29cc51){_0x34e5a0(_0x29cc51);});});}function createEndUser(_0x488279,_0x390352,_0x5ed808,_0x5de10d,_0x3a3993,_0xd6f17b){var _0x5ed808=getName(_0x5ed808);return request({'method':_0x5b31('0x24'),'uri':'https://www.zohoapis.'+_0x390352+_0x5b31('0x3f')+_[_0x5b31('0x40')](_0xd6f17b[_0x5b31('0x41')])+'s','body':{'data':[{'Last_Name':_0x5ed808[0x1],'First_Name':_0x5ed808[0x0],'Phone':_0x5de10d,'Owner':{'name':!_['isNil'](_0x3a3993[_0x5b31('0x42')][_0x5b31('0x19')])?_0x3a3993['role'][_0x5b31('0x19')]:!_['isNil'](_0x3a3993[_0x5b31('0x43')])?_0x3a3993[_0x5b31('0x43')]+'\x20'+_0x3a3993['last_name']:_0x3a3993[_0x5b31('0x44')],'id':_0x3a3993['id']}}]},'headers':{'Authorization':_0x5b31('0x32')+_0x488279},'json':!![]})['then'](function(_0x55c320){if(_0x55c320&&_0x55c320[_0x5b31('0x3e')][0x0][_0x5b31('0x45')]===_0x5b31('0x46')){var _0x24d22c=_0x55c320[_0x5b31('0x3e')][0x0][_0x5b31('0x47')];_0x24d22c['enduserType']=_[_0x5b31('0x40')](_0xd6f17b[_0x5b31('0x41')])+'s';return _0x24d22c;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x5b31('0xe')](data));throw new Error(_0x5b31('0x48')+JSON[_0x5b31('0xe')](data));})[_0x5b31('0x2b')](function(_0x42a415){console[_0x5b31('0x49')](_0x5b31('0x4a'),_0x42a415);});}function getEndUser(_0x45bc82,_0x22ef84,_0x45ceb0,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c){var _0x16af4d={'method':_0x5b31('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45bc82},'json':!![]};switch(_0x27554c['moduleSearch']){case'contact_lead':_0x16af4d[_0x5b31('0x4b')]='https://www.zohoapis.'+_0x22ef84+_0x5b31('0x4c')+_0x1ac981+'))';return getZohoUser(_0x16af4d,_0x5b31('0x4d'))['then'](function(_0x1f7f96){if(_0x1f7f96)return _0x1f7f96;_0x16af4d[_0x5b31('0x4b')]=_0x5b31('0x4e')+_0x22ef84+_0x5b31('0x4f')+_0x1ac981+'))';return getZohoUser(_0x16af4d,_0x5b31('0x50'))[_0x5b31('0x29')](function(_0x1e3fd9){if(_0x1e3fd9)return _0x1e3fd9;if(_0x27554c[_0x5b31('0x41')]!=_0x5b31('0x51')){return createEndUser(_0x45bc82,_0x22ef84,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c);}else{return{};}});});break;case _0x5b31('0x52'):_0x16af4d['uri']=_0x5b31('0x4e')+_0x22ef84+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1ac981+'))';return getZohoUser(_0x16af4d,'Contacts')['then'](function(_0x58c8b8){if(_0x58c8b8)return _0x58c8b8;if(_0x27554c[_0x5b31('0x41')]!=_0x5b31('0x51')){return createEndUser(_0x45bc82,_0x22ef84,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c);}else{return{};}});break;case _0x5b31('0x53'):_0x16af4d['uri']=_0x5b31('0x4e')+_0x22ef84+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1ac981+'))';return getZohoUser(_0x16af4d,_0x5b31('0x50'))[_0x5b31('0x29')](function(_0x3a04ac){if(_0x3a04ac)return _0x3a04ac;if(_0x27554c[_0x5b31('0x41')]!=_0x5b31('0x51')){return createEndUser(_0x45bc82,_0x22ef84,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c);}else{return{};}});break;}}function getCall(_0x2126f5,_0x4966dd,_0x450f77,_0x23f5a2,_0x2a0829,_0x20f383,_0x5e36e0,_0x1991f3){logger['info'](_0x5b31('0x54'));var _0x955df5={};_0x955df5[_0x5b31('0x55')]={'name':!_['isNil'](_0x23f5a2[_0x5b31('0x42')][_0x5b31('0x19')])&&!_[_0x5b31('0x1c')](_0x23f5a2[_0x5b31('0x39')]['name'])&&_0x23f5a2[_0x5b31('0x39')][_0x5b31('0x19')]==='administrator'?_0x23f5a2[_0x5b31('0x42')][_0x5b31('0x19')]:!_[_0x5b31('0x1c')](_0x23f5a2[_0x5b31('0x43')])?_0x23f5a2['first_name']+'\x20'+_0x23f5a2[_0x5b31('0x44')]:_0x23f5a2[_0x5b31('0x44')],'id':_0x23f5a2['id']};_0x955df5['Subject']=intUtil[_0x5b31('0x56')](_0x20f383[_0x5b31('0x57')],_0x5e36e0,'\x20');_0x955df5[_0x5b31('0x58')]=intUtil['getString'](_0x20f383[_0x5b31('0x59')],_0x5e36e0,'\x0a');if(_0x2a0829[_0x5b31('0x5a')]===_0x5b31('0x4d')){_0x955df5[_0x5b31('0x5b')]={'name':!_[_0x5b31('0x1c')](_0x2a0829['Full_Name'])?_0x2a0829['Full_Name']:!_['isNil'](_0x2a0829[_0x5b31('0x5c')])?_0x2a0829[_0x5b31('0x5c')]+'\x20'+_0x2a0829['Last_Name']:_0x2a0829[_0x5b31('0x5d')],'id':_0x2a0829['id']};}if(_0x2a0829['enduserType']===_0x5b31('0x50')){_0x955df5[_0x5b31('0x5e')]={'name':!_[_0x5b31('0x1c')](_0x2a0829[_0x5b31('0x5f')])?_0x2a0829['Full_Name']:!_[_0x5b31('0x1c')](_0x2a0829[_0x5b31('0x5c')])?_0x2a0829[_0x5b31('0x5c')]+'\x20'+_0x2a0829['Last_Name']:_0x2a0829['Last_Name'],'id':_0x2a0829['id']};_0x955df5[_0x5b31('0x60')]=_[_0x5b31('0x40')](_0x2a0829['enduserType']);}if(_0x5e36e0[_0x5b31('0x61')]){_0x955df5[_0x5b31('0x62')]=moment[_0x5b31('0x63')](parseInt(_0x5e36e0[_0x5b31('0x61')])*0x3e8)[_0x5b31('0x2f')](_0x5b31('0x64'));}else if(_0x5e36e0[_0x5b31('0x65')]&&_0x5e36e0['endtime']){_0x955df5[_0x5b31('0x62')]=moment[_0x5b31('0x63')](moment(_0x5e36e0['endtime'],_0x5b31('0x66'))[_0x5b31('0x67')](moment(_0x5e36e0[_0x5b31('0x68')],_0x5b31('0x66'))))[_0x5b31('0x2f')](_0x5b31('0x64'));}switch(_0x5e36e0[_0x5b31('0x69')]){case _0x5b31('0x6a'):_0x955df5['Call_Result']=_0x5b31('0x6b');break;case _0x5b31('0x6c'):case _0x5b31('0x6d'):_0x955df5[_0x5b31('0x6e')]=_0x5b31('0x6f');break;case _0x5b31('0x70'):_0x955df5[_0x5b31('0x6e')]=_0x5b31('0x71');break;case'abandoned':_0x955df5['Call_Result']=_0x5b31('0x72');break;case _0x5b31('0x73'):_0x955df5[_0x5b31('0x6e')]=_0x5b31('0x74');default:}_0x955df5['Call_Start_Time']=(_0x1991f3===_0x5b31('0x75')?moment(_0x5e36e0[_0x5b31('0x68')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x5e36e0['agentcalledAt'])[_0x5b31('0x2f')](_0x5b31('0x66')))||moment()[_0x5b31('0x2f')](_0x5b31('0x66'));_0x955df5[_0x5b31('0x76')]=_0x1991f3||_0x5b31('0x77');_0x955df5=_['merge'](_0x955df5,getCustomFields(_0x20f383[_0x5b31('0x78')],_0x5e36e0));return request({'method':'POST','uri':_0x5b31('0x4e')+_0x4966dd+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2126f5},'body':{'data':[_0x955df5]},'json':!![]})[_0x5b31('0x29')](function(_0x3cf737){if(_0x3cf737&&_0x3cf737['data'][0x0][_0x5b31('0x45')]===_0x5b31('0x46')){logger['info'](_0x5b31('0x79'));return{'id':_0x3cf737[_0x5b31('0x3e')][0x0]['details']['id']};}})['catch'](function(_0x3e0503){logger[_0x5b31('0x2d')](_0x5b31('0x7a'),_0x3e0503[_0x5b31('0x2c')]);console[_0x5b31('0x49')](_0x5b31('0x7a'),_0x3e0503);});}exports['queue']=function(_0x2d5e2e,_0x3991a2,_0x4f51e3,_0x30ca30,_0x4ae003,_0x585ace){var _0x1db39b,_0x524f4f,_0xa80529;_0x585ace[_0x5b31('0x7b')]=intUtil['stripTrailingSlash'](_0x585ace['host']);_0x585ace[_0x5b31('0x7c')]=intUtil['stripTrailingSlash'](_0x585ace[_0x5b31('0x7c')]);if(_0x4ae003&&_0x4ae003['monitor_format']){logger['info'](_0x5b31('0x7d'),_0x5b31('0x7e'));_0x3991a2[_0x5b31('0x7f')]=_0x585ace['serverUrl']+_0x5b31('0x80')+_0x3991a2[_0x5b31('0x81')]+_0x5b31('0x82')+md5(_0x3991a2[_0x5b31('0x81')]);}else{_0x3991a2[_0x5b31('0x7f')]='';}var _0x592590=_0x585ace[_0x5b31('0x7b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x585ace)[_0x5b31('0x29')](function(_0x409552){_0xa80529=_0x409552;return getUser(_0xa80529,_0x592590,_0x585ace,_0x30ca30[_0x5b31('0x36')]);})[_0x5b31('0x29')](function(_0x2e6be3){_0x1db39b=_0x2e6be3;logger[_0x5b31('0x2d')]('The\x20User\x20ID\x20is:',_0x1db39b['id']);return getEndUser(_0xa80529,_0x592590,_0x585ace,_0x3991a2[_0x5b31('0x83')],_0x3991a2[_0x5b31('0x84')],_0x1db39b,_0x4f51e3);})[_0x5b31('0x29')](function(_0x475679){_0x524f4f=_0x475679;return getCall(_0xa80529,_0x592590,_0x585ace,_0x1db39b,_0x524f4f,_0x4f51e3,_0x3991a2,_0x5b31('0x77'));})[_0x5b31('0x29')](function(_0x20b160){if(_0x20b160){logger[_0x5b31('0x2d')]('The\x20Call\x20ID\x20is:',_0x20b160['id']);logger[_0x5b31('0x2d')](_0x5b31('0x7d'),_0x5b31('0x85'));emit(util[_0x5b31('0x2f')](_0x5b31('0x86'),_0x30ca30[_0x5b31('0x19')]),'trigger:browser:url',{'uri':_0x5b31('0x87')+_0x585ace[_0x5b31('0x7b')]+_0x5b31('0x88')+_0x20b160['id']});}})[_0x5b31('0x2b')](function(_0x335bb8){logger[_0x5b31('0x3d')](_0x5b31('0x7d'),JSON[_0x5b31('0xe')](_0x335bb8));});};exports['outbound']=function(_0x23fa5d,_0x1debb5,_0x14d5cd,_0x16e6ae,_0x49c5a4,_0x5acbf1,_0x3d8e21){var _0x2c4d94,_0x450ca2,_0x3bcbf3;_0x5acbf1['host']=intUtil['stripTrailingSlash'](_0x5acbf1[_0x5b31('0x7b')]);_0x5acbf1['serverUrl']=intUtil[_0x5b31('0x89')](_0x5acbf1['serverUrl']);if(_0x3d8e21&&_0x3d8e21[_0x5b31('0x8a')]&&_0x3d8e21[_0x5b31('0x8a')]!==_0x5b31('0x8b')){logger[_0x5b31('0x2d')](_0x5b31('0x8c'),'Recording\x20is\x20enabled!');_0x1debb5[_0x5b31('0x7f')]=_0x5acbf1[_0x5b31('0x7c')]+_0x5b31('0x80')+_0x1debb5[_0x5b31('0x81')]+_0x5b31('0x82')+md5(_0x1debb5[_0x5b31('0x81')]);}var _0x35250b=_0x5acbf1[_0x5b31('0x7b')]===_0x5b31('0x8d')?'eu':_0x5b31('0x8e');return getAccessToken(_0x5acbf1)['then'](function(_0xa29ca6){_0x3bcbf3=_0xa29ca6;return getUser(_0x3bcbf3,_0x35250b,_0x5acbf1,_0x16e6ae[_0x5b31('0x36')]);})[_0x5b31('0x29')](function(_0x52cceb){_0x2c4d94=_0x52cceb;logger[_0x5b31('0x2d')](_0x5b31('0x8f'),_0x2c4d94['id']);return getEndUser(_0x3bcbf3,_0x35250b,_0x5acbf1,_0x1debb5[_0x5b31('0x90')],_0x1debb5[_0x5b31('0x91')],_0x2c4d94,_0x14d5cd);})[_0x5b31('0x29')](function(_0x58014b){_0x450ca2=_0x58014b;return getCall(_0x3bcbf3,_0x35250b,_0x5acbf1,_0x2c4d94,_0x450ca2,_0x14d5cd,_0x1debb5,_0x5b31('0x92'));})[_0x5b31('0x29')](function(_0x833617){if(_0x833617){logger['info'](_0x5b31('0x93'),_0x833617['id']);logger[_0x5b31('0x2d')]('[OUTBOUND]',_0x5b31('0x85'));emit(util[_0x5b31('0x2f')](_0x5b31('0x86'),_0x16e6ae[_0x5b31('0x19')]),_0x5b31('0x94'),{'uri':_0x5b31('0x87')+_0x5acbf1['host']+_0x5b31('0x88')+_0x833617['id']});}})['catch'](function(_0x468a34){logger[_0x5b31('0x3d')](_0x5b31('0x8c'),JSON[_0x5b31('0xe')](_0x468a34));});};exports[_0x5b31('0x95')]=function(_0x3dee74,_0x46c717,_0x3ac1b7,_0xfe32f2,_0x520e33,_0x32b64f){var _0x5d5293,_0x103624,_0x25b474;_0x32b64f[_0x5b31('0x7b')]=intUtil[_0x5b31('0x89')](_0x32b64f[_0x5b31('0x7b')]);_0x32b64f[_0x5b31('0x7c')]=intUtil[_0x5b31('0x89')](_0x32b64f[_0x5b31('0x7c')]);if(_0x520e33&&_0x520e33[_0x5b31('0x96')]){logger['info']('['+_0x46c717[_0x5b31('0x69')][_0x5b31('0x97')]()+']','Recording\x20is\x20enabled!');_0x46c717['recordingURL']=_0x32b64f[_0x5b31('0x7c')]+'/api/voice/recordings/'+_0x46c717['uniqueid']+_0x5b31('0x82')+md5(_0x46c717[_0x5b31('0x81')]);}else{_0x46c717[_0x5b31('0x7f')]='';}var _0x49ff7c=_0x32b64f[_0x5b31('0x7b')]==='zoho.eu'?'eu':_0x5b31('0x8e');return getAccessToken(_0x32b64f)['then'](function(_0x871d2d){_0x25b474=_0x871d2d;return getUser(_0x25b474,_0x49ff7c,_0x32b64f);})[_0x5b31('0x29')](function(_0x17b34e){_0x5d5293=_0x17b34e;logger['info'](_0x5b31('0x8f'),_0x5d5293['id']);return getEndUser(_0x25b474,_0x49ff7c,_0x32b64f,_0x46c717[_0x5b31('0x83')],_0x46c717[_0x5b31('0x84')],_0x5d5293,_0x3ac1b7);})['then'](function(_0x18bcdf){_0x103624=_0x18bcdf;return getCall(_0x25b474,_0x49ff7c,_0x32b64f,_0x5d5293,_0x103624,_0x3ac1b7,_0x46c717,_0x5b31('0x77'));})['then'](function(_0x50afe7){if(_0x50afe7){logger[_0x5b31('0x2d')](_0x5b31('0x93'),_0x50afe7['id']);}})[_0x5b31('0x2b')](function(_0x49481a){logger[_0x5b31('0x3d')]('['+_0x46c717[_0x5b31('0x69')][_0x5b31('0x97')]()+']',JSON[_0x5b31('0xe')](_0x49481a));});}; \ 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 79aafdf..17ec081 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 _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 +var _0x80f0=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','render','error','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x80f0,0x161));var _0x080f=function(_0x5149a1,_0x4fcea3){_0x5149a1=_0x5149a1-0x0;var _0x6a23e0=_0x80f0[_0x5149a1];return _0x6a23e0;};'use strict';var util=require(_0x080f('0x0'));var sh=require(_0x080f('0x1'));var Mustache=require(_0x080f('0x2'));var logger=require(_0x080f('0x3'))('trigger');exports[_0x080f('0x4')]=function(_0x4db21e,_0x3e472e){var _0x56c52d=_0x4db21e[_0x080f('0x5')]?_0x4db21e['data2']:_0x080f('0x6');var _0x56b079=_0x4db21e[_0x080f('0x7')]?Mustache[_0x080f('0x8')](_0x4db21e[_0x080f('0x7')],_0x3e472e):_0x3e472e;sh['exec'](_0x56b079,function(_0x196099,_0x46b478,_0xc91abc){if(_0x196099!==0x0){logger[_0x080f('0x9')](util[_0x080f('0xa')](_0x080f('0xb'),_0x56c52d,_0x56b079,_0x196099,_0xc91abc));}else{logger[_0x080f('0xc')](util[_0x080f('0xa')](_0x080f('0xd'),_0x56c52d,_0x56b079,_0x46b478));}});}; \ 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 d1ee85c..2135b77 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 _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 +var _0x3f57=['GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','object','stringify','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6','parse','render','error','stack'];(function(_0x518ce4,_0x40f7df){var _0x1c6e8c=function(_0x38b43f){while(--_0x38b43f){_0x518ce4['push'](_0x518ce4['shift']());}};_0x1c6e8c(++_0x40f7df);}(_0x3f57,0x99));var _0x73f5=function(_0x11a8f1,_0x2403ec){_0x11a8f1=_0x11a8f1-0x0;var _0x157fd6=_0x3f57[_0x11a8f1];return _0x157fd6;};'use strict';var rp=require(_0x73f5('0x0'));var util=require(_0x73f5('0x1'));var _=require(_0x73f5('0x2'));var Mustache=require(_0x73f5('0x3'));var logger=require('../../../../config/logger')(_0x73f5('0x4'));exports[_0x73f5('0x5')]=function(_0x42ec3c,_0x2766c0){var _0x4ded3a,_0x412b83;var _0x355583={'method':_0x42ec3c[_0x73f5('0x6')][_0x73f5('0x7')](),'uri':Mustache['render'](_0x42ec3c[_0x73f5('0x8')],_0x2766c0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x42ec3c[_0x73f5('0x9')])===_0x73f5('0xa')&&parseInt(_0x42ec3c['data5'])>=0x1&&parseInt(_0x42ec3c['data5'])<=0xa?parseInt(_0x42ec3c[_0x73f5('0x9')])*0x3e8:0x5*0x3e8};try{_0x355583[_0x73f5('0xb')]=_0x42ec3c[_0x73f5('0xc')]?JSON[_0x73f5('0xd')](Mustache[_0x73f5('0xe')](_0x42ec3c[_0x73f5('0xc')],_0x2766c0)):{};}catch(_0x34b70d){logger[_0x73f5('0xf')](_0x34b70d[_0x73f5('0x10')]);}switch(_0x42ec3c[_0x73f5('0x6')]['toUpperCase']()){case _0x73f5('0x11'):case'DELETE':_0x4ded3a=null;_0x355583['qs']=_0x2766c0;break;case _0x73f5('0x12'):case _0x73f5('0x13'):if(_0x42ec3c['data7']){try{_0x4ded3a=JSON['parse'](Mustache['render'](_0x42ec3c[_0x73f5('0x14')],_0x2766c0));_0x355583[_0x73f5('0x15')]=_0x4ded3a;}catch(_0x1324f8){logger[_0x73f5('0xf')](_0x1324f8[_0x73f5('0x10')]);logger['error'](_0x73f5('0x16'));}}else{_0x4ded3a=_0x2766c0;_0x355583[_0x73f5('0x15')]=_0x4ded3a;}break;}logger[_0x73f5('0x17')](util[_0x73f5('0x18')](_0x73f5('0x19'),_0x42ec3c[_0x73f5('0x6')],_0x42ec3c[_0x73f5('0x8')],JSON['stringify'](_0x355583)));rp(_0x355583)[_0x73f5('0x1a')](function(_0x4957d6){_0x4ded3a=!_[_0x73f5('0x1b')](_0x4ded3a)?',\x20request\x20body:\x20'+_0x4ded3a:'';_0x412b83=typeof _0x4957d6[_0x73f5('0x15')]===_0x73f5('0x1c')?JSON[_0x73f5('0x1d')](_0x4957d6['body']):_0x4957d6[_0x73f5('0x15')];logger[_0x73f5('0x17')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x42ec3c[_0x73f5('0x6')],_0x42ec3c[_0x73f5('0x8')],_0x4957d6[_0x73f5('0x1e')],_0x412b83));})['catch'](function(_0x3825ae){logger[_0x73f5('0xf')](util[_0x73f5('0x18')](_0x73f5('0x1f'),_0x42ec3c['data1'],_0x42ec3c[_0x73f5('0x8')],_0x3825ae[_0x73f5('0x1e')],_0x3825ae[_0x73f5('0x20')],_0x3825ae[_0x73f5('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 6d0b863..a6a53ba 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 _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 +var _0x5c44=['../../config/logger','routing','client','http','Request','request','then','error','rpc','message','result','catch','exports','bluebird'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x5c44,0x99));var _0x45c4=function(_0x4e02f2,_0x486243){_0x4e02f2=_0x4e02f2-0x0;var _0x327ed8=_0x5c44[_0x4e02f2];return _0x327ed8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x45c4('0x0'));var logger=require(_0x45c4('0x1'))(_0x45c4('0x2'));var client=jayson[_0x45c4('0x3')][_0x45c4('0x4')]({'port':0x2329});client[_0x45c4('0x5')]=function(_0x5603fe,_0x5e32eb){return new BPromise(function(_0x134a33,_0x237a04){return client[_0x45c4('0x6')](_0x5603fe,_0x5e32eb)[_0x45c4('0x7')](function(_0x2ea13a){logger['debug']('rpc','routing',_0x5603fe,_0x5e32eb,_0x2ea13a);if(_0x2ea13a['error']){logger[_0x45c4('0x8')](_0x45c4('0x9'),_0x45c4('0x2'),_0x5603fe,_0x2ea13a[_0x45c4('0x8')][_0x45c4('0xa')],_0x5e32eb);return _0x237a04(_0x2ea13a[_0x45c4('0x8')][_0x45c4('0xa')]);}else{return _0x134a33(_0x2ea13a[_0x45c4('0xb')]);}})[_0x45c4('0xc')](function(_0x4da76d){logger[_0x45c4('0x8')]('rpc',_0x45c4('0x2'),_0x5603fe,_0x4da76d,_0x5e32eb);return _0x237a04(_0x4da76d);});});};module[_0x45c4('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index fb7b537..ab2579f 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 _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 +var _0x6c97=['listen','getSettings','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting','resolve','getMailAccounts','then','mailAccounts'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x6c97,0x14e));var _0x76c9=function(_0x4437b9,_0x56a6ce){_0x4437b9=_0x4437b9-0x0;var _0x271140=_0x6c97[_0x4437b9];return _0x271140;};'use strict';var server=require('./server');var Realtime=require(_0x76c9('0x0'));var EmailChannel=require(_0x76c9('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x76c9('0x2'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x76c9('0x3')]()['then'](mailAccount[_0x76c9('0x4')]())[_0x76c9('0x5')](realtime['initMailAccounts']())[_0x76c9('0x5')](function(){email['refresh'](realtime[_0x76c9('0x6')]);return realtime;});}function main(){return server[_0x76c9('0x7')](realtime,email)['then'](function(){return initRealtime();})[_0x76c9('0x5')](function(){return setting[_0x76c9('0x8')]();})['then'](function(_0x417527){return setInterval(initRealtime,_0x417527['loginMailFrequency']*0x3e8);})['catch'](function(_0x4dcb00){logger[_0x76c9('0x9')](_0x76c9('0xa'),_0x4dcb00);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 384122a..9e7f79f 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 _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 +var _0x2496=['error','handleImapError','disabled','handleImapBox','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','lastSync','send','verifySmtp','Smtp','verify','verified','exports','lodash','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','info','mailAccounts','imapAccounts','smtp','prototype','emit','active','Imap','status','messageStatus','total','isNil','stringify','md5','hasOwnProperty','service','provider','custom','box','bind','handleImapEmail','end','handleImapEnd'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x2496,0x146));var _0x6249=function(_0x361e50,_0xc348da){_0x361e50=_0x361e50-0x0;var _0xf4ae47=_0x2496[_0x361e50];return _0xf4ae47;};'use strict';var _=require(_0x6249('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x6249('0x1'));var config=require('../../../config/environment');var logger=require(_0x6249('0x2'))(_0x6249('0x3'));config[_0x6249('0x4')]=_['defaults'](config[_0x6249('0x4')],{'host':_0x6249('0x5'),'port':0x18eb});var io=require(_0x6249('0x6'))(new Redis(config['redis']));var EmailImap=require(_0x6249('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3d3b6a){logger[_0x6249('0x8')]('start\x20email\x20channel');this['mailAccounts']=_0x3d3b6a[_0x6249('0x9')];this[_0x6249('0xa')]={};this[_0x6249('0xb')]=new EmailSmtp();}EmailChannel[_0x6249('0xc')][_0x6249('0xd')]=function(_0x381a67){var _0x542fe1=this['mailAccounts'][_0x381a67];var _0x4aa303={'id':_0x542fe1['id'],'name':_0x542fe1['name'],'key':_0x542fe1['key'],'active':_0x542fe1[_0x6249('0xe')],'Imap':{'status':_0x542fe1[_0x6249('0xf')][_0x6249('0x10')],'messageStatus':_0x542fe1['Imap'][_0x6249('0x11')],'total':_0x542fe1[_0x6249('0xf')][_0x6249('0x12')]}};if(_[_0x6249('0x13')](md5Accounts[_0x381a67])){md5Accounts[_0x381a67]={};}var _0x61ba9e=md5(JSON[_0x6249('0x14')](_0x4aa303));if(md5Accounts[_0x381a67][_0x6249('0x15')]!==_0x61ba9e){md5Accounts[_0x381a67]['md5']=_0x61ba9e;io[_0x6249('0xd')]('mailAccount:update',_0x4aa303);}};EmailChannel[_0x6249('0xc')]['refresh']=function(_0x1845d2){for(var _0x31dd6a in _0x1845d2){if(_0x1845d2[_0x6249('0x16')](_0x31dd6a)){if(_0x1845d2[_0x31dd6a][_0x6249('0xf')]&&_0x1845d2[_0x31dd6a]['active']){var _0x594ad7=_0x1845d2[_0x31dd6a][_0x6249('0xf')];if(!_0x594ad7[_0x6249('0x17')]&&_0x1845d2[_0x31dd6a][_0x6249('0x18')]!==_0x6249('0x19'))_0x594ad7['service']=_0x1845d2[_0x31dd6a][_0x6249('0x18')];if(!this[_0x6249('0xa')][_0x6249('0x16')](_0x594ad7['id'])){this['imapAccounts'][_0x594ad7['id']]=new EmailImap(_0x594ad7,_0x1845d2[_0x31dd6a][_0x6249('0x3')]);this[_0x6249('0xa')][_0x594ad7['id']]['on'](_0x6249('0x1a'),this['handleImapBox'][_0x6249('0x1b')](this,_0x31dd6a));this[_0x6249('0xa')][_0x594ad7['id']]['on'](_0x6249('0x3'),this[_0x6249('0x1c')][_0x6249('0x1b')](this,_0x31dd6a));this['imapAccounts'][_0x594ad7['id']]['on'](_0x6249('0x1d'),this[_0x6249('0x1e')][_0x6249('0x1b')](this,_0x31dd6a));this[_0x6249('0xa')][_0x594ad7['id']]['on'](_0x6249('0x1f'),this[_0x6249('0x20')][_0x6249('0x1b')](this,_0x31dd6a));}}else{if(_[_0x6249('0x13')](this['mailAccounts'][_0x31dd6a][_0x6249('0xf')])){this[_0x6249('0x9')][_0x31dd6a]['Imap']={};}this['mailAccounts'][_0x31dd6a][_0x6249('0xf')][_0x6249('0x10')]=_0x6249('0x21');this[_0x6249('0x9')][_0x31dd6a][_0x6249('0xf')][_0x6249('0x11')]='';this[_0x6249('0xd')](_0x31dd6a);}}}};EmailChannel['prototype'][_0x6249('0x22')]=function(_0x2d443d,_0x4fd022){if(this[_0x6249('0x9')][_0x2d443d]){this[_0x6249('0x9')][_0x2d443d][_0x6249('0xf')][_0x6249('0x10')]='connected';this[_0x6249('0x9')][_0x2d443d][_0x6249('0xf')][_0x6249('0x11')]=_0x4fd022[_0x6249('0x23')];if(_0x4fd022['messages']){this[_0x6249('0x9')][_0x2d443d][_0x6249('0xf')][_0x6249('0x12')]=_0x4fd022[_0x6249('0x24')]['total'];}return this[_0x6249('0xd')](_0x2d443d);}};EmailChannel[_0x6249('0xc')][_0x6249('0x1c')]=function(_0x333ade,_0x41e7cb){logger[_0x6249('0x8')](_0x6249('0x25'),_0x41e7cb[_0x6249('0x26')],_0x41e7cb[_0x6249('0x27')],_0x41e7cb[_0x6249('0x28')],_0x333ade);if(this[_0x6249('0x9')][_0x333ade]){return mailAccount[_0x6249('0x29')](_0x333ade,_0x41e7cb)['then'](function(_0x5ede4d){if(_0x5ede4d){logger[_0x6249('0x8')](_0x6249('0x2a'));}})[_0x6249('0x2b')](function(_0x31db7b){logger[_0x6249('0x1f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x31db7b));});}};EmailChannel[_0x6249('0xc')]['handleImapEnd']=function(_0x50726d){if(this[_0x6249('0x9')][_0x50726d]&&this[_0x6249('0x9')][_0x50726d][_0x6249('0xf')]){if(this[_0x6249('0xa')][this[_0x6249('0x9')][_0x50726d][_0x6249('0xf')]['id']]){delete this[_0x6249('0xa')][this['mailAccounts'][_0x50726d][_0x6249('0xf')]['id']];}this[_0x6249('0x9')][_0x50726d][_0x6249('0xf')][_0x6249('0x2c')]=moment();this[_0x6249('0xd')](_0x50726d);}};EmailChannel[_0x6249('0xc')][_0x6249('0x20')]=function(_0x11a26e,_0x4c310a){if(this[_0x6249('0x9')][_0x11a26e]){this[_0x6249('0x9')][_0x11a26e]['Imap'][_0x6249('0x10')]='error';this['mailAccounts'][_0x11a26e]['Imap'][_0x6249('0x11')]=_0x4c310a;return this[_0x6249('0xd')](_0x11a26e);}};EmailChannel['prototype']['sendMail']=function(_0x54a27d,_0x451fe2){return this[_0x6249('0xb')][_0x6249('0x2d')](_0x54a27d,_0x451fe2);};EmailChannel['prototype'][_0x6249('0x2e')]=function(_0x504be8){var _0x45fab4=this;if(this[_0x6249('0x9')][_0x504be8['id']]){if(_['isNil'](this[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')])){this['mailAccounts'][_0x504be8['id']]['Smtp']={};}this[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')]['lastSync']=moment();return new BPromise(function(_0x3de313,_0x1dbe7d){return _0x45fab4['smtp'][_0x6249('0x30')](_0x504be8)['then'](function(_0x133d8d){_0x45fab4[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')][_0x6249('0x10')]=_0x6249('0x31');_0x45fab4[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')][_0x6249('0x11')]='';_0x45fab4[_0x6249('0xd')](_0x504be8['id']);_0x3de313(_0x133d8d);})['catch'](function(_0x3bee87){_0x45fab4[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')][_0x6249('0x10')]='error';_0x45fab4[_0x6249('0x9')][_0x504be8['id']]['Smtp']['messageStatus']=_0x3bee87;_0x45fab4[_0x6249('0xd')](_0x504be8['id']);_0x1dbe7d(_0x3bee87);});});}return this[_0x6249('0xb')][_0x6249('0x30')](_0x504be8);};module[_0x6249('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 74050fb..d5ef80a 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 _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 +var _0xd6a6=['host','port','tls','required','openBox','prototype','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','message','handleFetchMessage','error','handleFetchError','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','handleFetchEnd','closeBox','textCode','hasOwnProperty','upperFirst','exports','lodash','util','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','ready','bind','end','handleEnd','handleError','inherits','connTimeout','authTimeout','service','user','xoauth2','CloudProvider','password','anonymous@xcally.com'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd6a6,0x1b4));var _0x6d6a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6a6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d6a('0x0'));var util=require(_0x6d6a('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x6d6a('0x2')];var Iconv=require(_0x6d6a('0x3'))[_0x6d6a('0x4')];var EventEmitter=require('events')[_0x6d6a('0x5')];var utils=require(_0x6d6a('0x6'));var logger=require(_0x6d6a('0x7'))(_0x6d6a('0x8'));function EmailImap(_0xc55179,_0x17ad3b){this[_0x6d6a('0x9')]=_0xc55179['mailbox'];this[_0x6d6a('0xa')]=this[_0x6d6a('0xb')](_0xc55179,_0x17ad3b);this[_0x6d6a('0xc')]=new Imap(this[_0x6d6a('0xa')]);this[_0x6d6a('0xc')][_0x6d6a('0xd')](_0x6d6a('0xe'),this['handleReady'][_0x6d6a('0xf')](this));this[_0x6d6a('0xc')]['once'](_0x6d6a('0x10'),this[_0x6d6a('0x11')][_0x6d6a('0xf')](this));this[_0x6d6a('0xc')]['on']('error',this[_0x6d6a('0x12')][_0x6d6a('0xf')](this));this['imap']['connect']();}util[_0x6d6a('0x13')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x17c097,_0x2535c8){var _0x5a7697={'connTimeout':_0x17c097[_0x6d6a('0x14')]?_0x17c097[_0x6d6a('0x14')]*0x3e8:0x2710,'authTimeout':_0x17c097[_0x6d6a('0x15')]?_0x17c097['authTimeout']*0x3e8:0x1388};if(_0x17c097[_0x6d6a('0x16')]){_0x5a7697[_0x6d6a('0x17')]=_0x17c097[_0x6d6a('0x17')];if(_0x17c097['modernAuthentication']){_0x5a7697[_0x6d6a('0x18')]=utils['generateXOAuth2Token'](_0x17c097[_0x6d6a('0x19')]['data5'],_0x17c097[_0x6d6a('0x17')]);}else{_0x5a7697[_0x6d6a('0x1a')]=_0x17c097[_0x6d6a('0x1a')];}}else{if(_0x17c097['authentication']){_0x5a7697[_0x6d6a('0x17')]=_0x17c097[_0x6d6a('0x17')];_0x5a7697['password']=_0x17c097[_0x6d6a('0x1a')];}}_0x5a7697[_0x6d6a('0x8')]=_0x2535c8||_0x17c097['user']||_0x6d6a('0x1b');_0x5a7697['host']=_0x17c097[_0x6d6a('0x1c')];_0x5a7697[_0x6d6a('0x1d')]=_0x17c097[_0x6d6a('0x1d')]||0x3e1;if(_0x17c097[_0x6d6a('0x1e')]){_0x5a7697['tls']=!![];}else{_0x5a7697[_0x6d6a('0x1e')]=![];_0x5a7697['autotls']=_0x6d6a('0x1f');}return _0x5a7697;};EmailImap['prototype']['handleReady']=function(){this[_0x6d6a('0xc')][_0x6d6a('0x20')](this[_0x6d6a('0x9')],![],this['handleOpenBox'][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x22')]=function(_0xb2d78b,_0x179e2){if(_0xb2d78b){this[_0x6d6a('0x12')](_0xb2d78b,!![]);}else{this[_0x6d6a('0x23')](_0x6d6a('0x24'),_0x179e2);this[_0x6d6a('0x25')]();}};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x26')]=function(_0x4fdd0d){if(_0x4fdd0d){this[_0x6d6a('0x12')](_0x4fdd0d,!![]);}else{this[_0x6d6a('0xc')][_0x6d6a('0x10')]();}};EmailImap[_0x6d6a('0x21')]['readUnseen']=function(){this[_0x6d6a('0xc')][_0x6d6a('0x27')](['UNSEEN'],this[_0x6d6a('0x28')][_0x6d6a('0xf')](this));};EmailImap['prototype'][_0x6d6a('0x28')]=function(_0x2bd929,_0x554e37){if(_0x2bd929){this[_0x6d6a('0x12')](_0x2bd929,!![]);}else{if(_0x554e37['length']){try{var _0x300132=this[_0x6d6a('0xc')]['fetch'](_0x554e37['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x300132['on'](_0x6d6a('0x29'),this[_0x6d6a('0x2a')][_0x6d6a('0xf')](this));_0x300132[_0x6d6a('0xd')](_0x6d6a('0x2b'),this[_0x6d6a('0x2c')][_0x6d6a('0xf')](this));_0x300132[_0x6d6a('0xd')](_0x6d6a('0x10'),this['handleFetchEnd']['bind'](this));}catch(_0x5b98a8){logger[_0x6d6a('0x2b')](_0x5b98a8);}}else{this['imap']['closeBox'](!![],this[_0x6d6a('0x26')][_0x6d6a('0xf')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x411883){_0x411883['on'](_0x6d6a('0x2d'),this[_0x6d6a('0x2e')][_0x6d6a('0xf')](this));_0x411883[_0x6d6a('0xd')](_0x6d6a('0x2f'),this[_0x6d6a('0x30')]['bind'](this));_0x411883[_0x6d6a('0xd')]('end',this['handleMessageEnd'][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x2e')]=function(_0x19f57c){simpleParser(_0x19f57c,{'Iconv':Iconv},this[_0x6d6a('0x31')][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x30')]=function(){};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x32')]=function(){};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x31')]=function(_0x35db84,_0x1647a8){if(_0x35db84){logger[_0x6d6a('0x2b')](_0x35db84);}else{var _0x5a3644=this;utils[_0x6d6a('0x33')](this[_0x6d6a('0xa')],_0x1647a8,function(_0x5694e8){_0x5a3644[_0x6d6a('0x23')](_0x6d6a('0x8'),_0x5694e8);});}};EmailImap['prototype'][_0x6d6a('0x34')]=function(){this[_0x6d6a('0xc')][_0x6d6a('0x35')](!![],this[_0x6d6a('0x26')][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x2c')]=function(_0x151b01){this[_0x6d6a('0x12')](_0x151b01);this[_0x6d6a('0xc')][_0x6d6a('0x35')](!![],this[_0x6d6a('0x26')]['bind'](this));};EmailImap['prototype'][_0x6d6a('0x11')]=function(){this[_0x6d6a('0x23')](_0x6d6a('0x10'));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x12')]=function(_0x13015b,_0x1dfabe){logger[_0x6d6a('0x2b')]('handleError',this[_0x6d6a('0xa')]['email'],JSON['stringify'](_0x13015b));var _0x9a9ae='';if(_0x13015b){if(_0x13015b[_0x6d6a('0x36')]){_0x9a9ae=_0x13015b[_0x6d6a('0x36')];}else{for(var _0x1a2f4e in _0x13015b){if(_0x13015b[_0x6d6a('0x37')](_0x1a2f4e)){_0x9a9ae+=_[_0x6d6a('0x38')](_0x1a2f4e)+':\x20'+_0x13015b[_0x1a2f4e]+'\x0a';}}}}if(_0x1dfabe){this[_0x6d6a('0xc')][_0x6d6a('0x10')]();}else{this[_0x6d6a('0x23')](_0x6d6a('0x2b'),_0x9a9ae);this[_0x6d6a('0x23')](_0x6d6a('0x10'));}};module[_0x6d6a('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 705f46c..9ee0059 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 _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 +var _0x5552=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x47d546,_0x316c75){var _0xe94939=function(_0x567029){while(--_0x567029){_0x47d546['push'](_0x47d546['shift']());}};_0xe94939(++_0x316c75);}(_0x5552,0x1ac));var _0x2555=function(_0x114b81,_0x4a54e0){_0x114b81=_0x114b81-0x0;var _0x5e4b67=_0x5552[_0x114b81];return _0x5e4b67;};'use strict';var nodemailer=require(_0x2555('0x0'));var inlineBase64=require(_0x2555('0x1'));function EmailSmtp(){}EmailSmtp[_0x2555('0x2')][_0x2555('0x3')]=function(_0x4ec579,_0x5afd03){return new Promise(function(_0x1dcc28,_0x2c1902){var _0x219e70=nodemailer[_0x2555('0x4')](_0x4ec579);_0x219e70[_0x2555('0x5')]('compile',inlineBase64());_0x219e70[_0x2555('0x6')](_0x5afd03,function(_0x4af339,_0x45bbda){if(_0x4af339){_0x2c1902(_0x4af339[_0x2555('0x7')]());}else{_0x1dcc28(_0x45bbda);}});});};EmailSmtp[_0x2555('0x2')][_0x2555('0x8')]=function(_0x3587aa){return new Promise(function(_0x2e8996,_0x485f31){var _0x4cd769=nodemailer[_0x2555('0x4')](_0x3587aa);_0x4cd769[_0x2555('0x8')](function(_0x485008,_0x30acc4){if(_0x485008){_0x485f31(_0x485008[_0x2555('0x7')]());}else{if(_0x30acc4){_0x2e8996(_0x30acc4);}else{_0x485f31(_0x2555('0x9'));}}});});};module[_0x2555('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 5d7ac76..2d70a86 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 _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 +var _0xca5b=['from','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','BodyHTML','Attachments','Title','Data','

Empty\x20message

','user=','utf-8','lodash','moment','path','node-tnef','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','Anonymous','split','pop','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','email','isEmpty','originCc','bcc','attachments','attach','type','attachment-','format','%s-%s','join','root','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser'];(function(_0x1361ce,_0x34af53){var _0x2cbb10=function(_0x11eb3d){while(--_0x11eb3d){_0x1361ce['push'](_0x1361ce['shift']());}};_0x2cbb10(++_0x34af53);}(_0xca5b,0x1da));var _0xbca5=function(_0x1b29b2,_0x3b6b11){_0x1b29b2=_0x1b29b2-0x0;var _0x560b68=_0xca5b[_0x1b29b2];return _0x560b68;};'use strict';var _=require(_0xbca5('0x0'));var moment=require(_0xbca5('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xbca5('0x2'));var util=require('util');var tnef=require(_0xbca5('0x3'));var logger=require('../../../config/logger')('email');var config=require(_0xbca5('0x4'));function getAddress(_0x4e3661){var _0x510abb=_[_0xbca5('0x5')](_0x4e3661[_0xbca5('0x6')]);return _0x510abb&&_0x510abb[_0xbca5('0x7')]?_0x510abb[_0xbca5('0x7')]:_0xbca5('0x8')+random[_0xbca5('0x9')](0x6)+_0xbca5('0xa');}function getFirstName(_0xb29c9f){var _0x3ac27a=_[_0xbca5('0x5')](_0xb29c9f[_0xbca5('0x6')]);if(_0x3ac27a&&_0x3ac27a[_0xbca5('0xb')]){if(_0x3ac27a[_0xbca5('0xb')]==_0x3ac27a[_0xbca5('0x7')]){return _0x3ac27a['name'][_0xbca5('0xc')](0x0,_0x3ac27a[_0xbca5('0xb')][_0xbca5('0xd')]('@'));}var _0x2a944=_0x3ac27a['name']['split'](/\s+/);return _0x2a944[_0xbca5('0xe')]>0x1?_0x2a944['slice'](0x0,-0x1)['join']('\x20'):_0x3ac27a[_0xbca5('0xb')];}return _0xbca5('0xf');}function getLastName(_0x1ed1ee){var _0x40c708=_[_0xbca5('0x5')](_0x1ed1ee[_0xbca5('0x6')]);if(_0x40c708&&_0x40c708[_0xbca5('0xb')]){var _0x2e7e66=_0x40c708['name'][_0xbca5('0x10')](/\s+/);return _0x2e7e66[_0xbca5('0xe')]>0x1?_0x2e7e66[_0xbca5('0x11')]():'';}return'';}function getMails(_0x85dc59,_0x2b5da3){var _0x34b57f='';for(var _0x35708a=0x0;_0x35708a<_0x2b5da3[_0xbca5('0x6')][_0xbca5('0xe')];_0x35708a+=0x1){if(_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0x7')]!==_0x85dc59){if(!_['isEmpty'](_0x34b57f)){_0x34b57f+=',';}_0x34b57f+=_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0xb')]||_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0x7')]||'';_0x34b57f+='\x20<';_0x34b57f+=_0x2b5da3['value'][_0x35708a][_0xbca5('0x7')]?_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0x7')]:_0xbca5('0x8')+random[_0xbca5('0x9')](0x6)+_0xbca5('0xa');_0x34b57f+='>';}}return _0x34b57f;}function parseEmail(_0x234738,_0x481ad1,_0xc72024){if(_0x481ad1[_0xbca5('0x12')]){var _0x5902ec=/)<[^<]*)*<\/script>/gi;while(_0x5902ec[_0xbca5('0x13')](_0x481ad1[_0xbca5('0x12')])){_0x481ad1[_0xbca5('0x12')]=_0x481ad1[_0xbca5('0x12')][_0xbca5('0x14')](_0x5902ec,'');}if(_0x481ad1['html'][_0xbca5('0x15')](_0xbca5('0x16'))){var _0x316954=[];_0x481ad1['attachments'][_0xbca5('0x17')](_0x26b5b7=>{_0x316954[_0xbca5('0x18')](_0x26b5b7[_0xbca5('0x19')]);});var _0x162caa=/]+>/g;var _0x28d06a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x561064=_0x481ad1[_0xbca5('0x12')]['replace'](_0x28d06a,_0xbca5('0x1a'));var _0x3d75db=_0x561064[_0xbca5('0x14')](_0x162caa,_0xbca5('0x1b'));for(let _0x2d30cc=0x0;_0x2d30cc<_0x316954[_0xbca5('0xe')];_0x2d30cc++){var _0x2ac450=_0x3d75db[_0xbca5('0x14')](_0xbca5('0x1b'),_0xbca5('0x1c')+_0x316954[_0x2d30cc]+_0xbca5('0x1d'));_0x3d75db=_0x2ac450;}_0x481ad1[_0xbca5('0x12')]=_0x3d75db;}_0xc72024[_0xbca5('0x1e')]=_0x481ad1[_0xbca5('0x12')];}else{_0xc72024[_0xbca5('0x1e')]=_0x481ad1[_0xbca5('0x1f')];}if(_0xc72024[_0xbca5('0x1e')]){_0xc72024[_0xbca5('0x1e')]=_0xc72024['body'][_0xbca5('0x14')](/0x0){var _0x32ff54=[_0xbca5('0x31'),_0xbca5('0x32'),_0xbca5('0x33')];for(var _0x456789=0x0;_0x456789<_0x481ad1['headerLines'][_0xbca5('0xe')];_0x456789++){var _0xe50026=_['indexOf'](_0x32ff54,_0x481ad1[_0xbca5('0x30')][_0x456789][_0xbca5('0x34')]);if(_0xe50026>=0x0){_0xc72024['isAutoreply']=!![];}}}return _0xc72024;}exports[_0xbca5('0x35')]=function(_0x335d3b,_0x55a0b6,_0x369d32){var _0x59a196={'from':getAddress(_0x55a0b6[_0xbca5('0x36')]),'firstName':getFirstName(_0x55a0b6[_0xbca5('0x36')]),'lastName':getLastName(_0x55a0b6[_0xbca5('0x36')]),'mapKey':_0xbca5('0x22'),'message':{'from':getMails(_0x335d3b[_0xbca5('0x22')],_0x55a0b6[_0xbca5('0x36')]),'to':_0x335d3b[_0xbca5('0x22')],'cc':'','subject':_0x55a0b6['subject']||'','messageId':_0x55a0b6['messageId'],'inReplyTo':_0x55a0b6['inReplyTo'],'sentAt':moment(_0x55a0b6['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x55a0b6[_0xbca5('0x12')]&&!_0x55a0b6[_0xbca5('0x1f')]){var _0x2658d7=_['filter'](_0x55a0b6[_0xbca5('0x26')],{'contentType':'application/ms-tnef'});if(_0x2658d7[_0xbca5('0xe')]){logger[_0xbca5('0x37')](util[_0xbca5('0x2a')](_0xbca5('0x38'),_0x55a0b6[_0xbca5('0x39')]));tnef[_0xbca5('0x3a')](_['first'](_0x2658d7)[_0xbca5('0x2f')],function(_0x12605a,_0x50740c){if(_0x50740c){_0x55a0b6[_0xbca5('0x12')]=_0x50740c[_0xbca5('0x3b')]||'

Empty\x20message

';if(_0x50740c[_0xbca5('0x3c')]){for(var _0x3089e7=0x0;_0x3089e7<_0x50740c['Attachments'][_0xbca5('0xe')];_0x3089e7++){var _0x50b527=_0x50740c[_0xbca5('0x3c')][_0x3089e7];_0x59a196[_0xbca5('0x20')]['attachments'][_0xbca5('0x18')]({'filename':_0x50b527[_0xbca5('0x3d')],'content':Buffer[_0xbca5('0x36')](_0x50b527[_0xbca5('0x3e')])});}}}_0x369d32(parseEmail(_0x335d3b,_0x55a0b6,_0x59a196));});}else{_0x55a0b6[_0xbca5('0x12')]=_0xbca5('0x3f');_0x369d32(parseEmail(_0x335d3b,_0x55a0b6,_0x59a196));}}else{_0x369d32(parseEmail(_0x335d3b,_0x55a0b6,_0x59a196));}};exports['generateXOAuth2Token']=function(_0x5d77dd,_0x1e9a1e){var _0x6fc1c9=[_0xbca5('0x40')+(_0x1e9a1e||''),'auth=Bearer\x20'+_0x5d77dd,'',''];return Buffer[_0xbca5('0x36')](_0x6fc1c9[_0xbca5('0x2c')](''),_0xbca5('0x41'))['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 723c318..083b846 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 _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 +var _0xc0b7=['name','Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc0b7,0x13f));var _0x7c0b=function(_0x1e1c2f,_0x527584){_0x1e1c2f=_0x1e1c2f-0x0;var _0x25ca95=_0xc0b7[_0x1e1c2f];return _0x25ca95;};'use strict';var _=require(_0x7c0b('0x0'));function MailAccount(_0x45c6b9){this['id']=_0x45c6b9['id']||0x0;this[_0x7c0b('0x1')]=_0x45c6b9['name']||_0x7c0b('0x2');this[_0x7c0b('0x3')]=_0x45c6b9[_0x7c0b('0x3')]||'SERV';this[_0x7c0b('0x4')]=_0x45c6b9[_0x7c0b('0x4')]||![];this[_0x7c0b('0x5')]=_0x45c6b9[_0x7c0b('0x5')]||[];this['Smtp']=_0x45c6b9[_0x7c0b('0x6')]||[];}module[_0x7c0b('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c2a0f52..64427ce 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 _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 +var _0xb25d=['mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x28f06b,_0x1e18e1){var _0x5ad54b=function(_0x345264){while(--_0x345264){_0x28f06b['push'](_0x28f06b['shift']());}};_0x5ad54b(++_0x1e18e1);}(_0xb25d,0x15d));var _0xdb25=function(_0x224090,_0x38f7e4){_0x224090=_0x224090-0x0;var _0xd97361=_0xb25d[_0x224090];return _0xd97361;};'use strict';var _=require(_0xdb25('0x0'));var MailAccount=require(_0xdb25('0x1'));var Realtime=function(){this[_0xdb25('0x2')]={};};function freeIsNotKey(_0x3e2463,_0x59ee82,_0x1389f9){var _0x3aaa4e=_[_0xdb25('0x3')](_0x3e2463,function(_0x1a63a3,_0xc3f4b5){return _0x1a63a3[_0x1389f9];});for(var _0x53a1dd in _0x59ee82){if(_0x59ee82[_0xdb25('0x4')](_0x53a1dd)){if(!_0x3aaa4e[_0x53a1dd]){delete _0x59ee82[_0x53a1dd];}}}}Realtime[_0xdb25('0x5')]['mergeFromDatabase']=function(_0x79e43f,_0x2a4bbb){for(var _0x3c8188 in _0x2a4bbb){if(_0x79e43f[_0xdb25('0x4')](_0x3c8188)){_0x79e43f[_0x3c8188]=_0x2a4bbb[_0x3c8188];}}};Realtime[_0xdb25('0x5')][_0xdb25('0x6')]=function(){var _0x777501=this;return function(_0x3122d9){if(_0x3122d9){freeIsNotKey(_0x3122d9,_0x777501[_0xdb25('0x2')],'id');for(var _0x35cb4d=0x0,_0x10625d={},_0x195b72={};_0x35cb4d<_0x3122d9[_0xdb25('0x7')];_0x35cb4d+=0x1){_0x10625d=_0x3122d9[_0x35cb4d];if(_[_0xdb25('0x8')](_0x777501[_0xdb25('0x2')][_0x10625d['id']])){_0x777501['mailAccounts'][_0x10625d['id']]=new MailAccount(_0x10625d);}else{_[_0xdb25('0x9')](_0x777501[_0xdb25('0x2')][_0x10625d['id']],_0x10625d);}}}return _0x777501[_0xdb25('0x2')];};};module[_0xdb25('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index b0ca750..4448261 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 _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 +var _0x598a=['service','type','data5','CloudProvider','MailServerOut','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','active','ListId','MailServerIn','Imap'];(function(_0x57b74a,_0x373d32){var _0x595ea3=function(_0x44fbf2){while(--_0x44fbf2){_0x57b74a['push'](_0x57b74a['shift']());}};_0x595ea3(++_0x373d32);}(_0x598a,0x1c9));var _0xa598=function(_0x595b92,_0x3d52b5){_0x595b92=_0x595b92-0x0;var _0x246999=_0x598a[_0x595b92];return _0x246999;};'use strict';var client=require(_0xa598('0x0'));exports[_0xa598('0x1')]=function(){return function(){return client[_0xa598('0x2')](_0xa598('0x3'),{'options':{'attributes':['id',_0xa598('0x4'),_0xa598('0x5'),'service',_0xa598('0x6'),_0xa598('0x7'),'key',_0xa598('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0xa598('0x9'),'as':_0xa598('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0xa598('0x4'),_0xa598('0xb'),_0xa598('0xc'),_0xa598('0xd')],'as':_0xa598('0xe')}]},{'model':_0xa598('0xf'),'as':'Smtp','include':[{'model':_0xa598('0xe'),'attributes':['id',_0xa598('0x4'),_0xa598('0xb'),'type',_0xa598('0xd')],'as':_0xa598('0xe')}]}]},'log':_0xa598('0x10')});};};exports['notify']=function(_0x41133d,_0x537154){return client['Request'](_0xa598('0x11'),{'account':{'id':_0x41133d},'body':_0x537154,'log':_0xa598('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7fb6e96..c511f9d 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 _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 +var _0x8d95=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x324146,_0x36f7b5){var _0x3ece02=function(_0x45f025){while(--_0x45f025){_0x324146['push'](_0x324146['shift']());}};_0x3ece02(++_0x36f7b5);}(_0x8d95,0x14b));var _0x58d9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d95[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x58d9('0x0'));exports['getSettings']=function(){return client[_0x58d9('0x1')](_0x58d9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x58d9('0x3')]},'log':_0x58d9('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d7feb64..9d0bfd1 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(_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 +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(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 b886dd5..b580ca9 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 _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 +var _0x9752=['../../config/triggers','default','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis'];(function(_0x364997,_0x3ce8bd){var _0x27e571=function(_0x433e6b){while(--_0x433e6b){_0x364997['push'](_0x364997['shift']());}};_0x27e571(++_0x3ce8bd);}(_0x9752,0xe2));var _0x2975=function(_0x138b84,_0x4309c4){_0x138b84=_0x138b84-0x0;var _0x558529=_0x9752[_0x138b84];return _0x558529;};'use strict';var _=require(_0x2975('0x0'));var http=require(_0x2975('0x1'));var express=require(_0x2975('0x2'));var sticky=require(_0x2975('0x3'));var Redis=require(_0x2975('0x4'));var config=require(_0x2975('0x5'));var app=express();var server=http[_0x2975('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0x2975('0x7')](server,config[_0x2975('0x8')])){var socketio=require(_0x2975('0x9'))(server,{'transports':[_0x2975('0xa'),_0x2975('0xb')]});config[_0x2975('0xc')]=_['defaults'](config['redis'],{'host':_0x2975('0xd'),'port':0x18eb});socketio[_0x2975('0xe')](require(_0x2975('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x2975('0xc')])}));require(_0x2975('0x10'))[_0x2975('0x11')]();require('../../config/socketio')[_0x2975('0x11')](socketio);require('../../config/express')[_0x2975('0x11')](app);require(_0x2975('0x12'))[_0x2975('0x11')](app);}else{server['once'](_0x2975('0x13'),function(){console[_0x2975('0x14')](_0x2975('0x15'),config[_0x2975('0x8')]);});}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 2ff127a..9fdab86 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 _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 +var _0x8560=['rpc','routing','error','message','result','catch','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug'];(function(_0x40efdb,_0x57f69b){var _0xe7bdab=function(_0x3e0679){while(--_0x3e0679){_0x40efdb['push'](_0x40efdb['shift']());}};_0xe7bdab(++_0x57f69b);}(_0x8560,0x7e));var _0x0856=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x8560[_0x4017b0];return _0x5ed4f7;};'use strict';var jayson=require(_0x0856('0x0'));var BPromise=require(_0x0856('0x1'));var logger=require(_0x0856('0x2'))('routing');var client=jayson[_0x0856('0x3')][_0x0856('0x4')]({'port':0x2329});client[_0x0856('0x5')]=function(_0x170eea,_0x2dc443){return new BPromise(function(_0x35c94a,_0xc085d6){return client[_0x0856('0x6')](_0x170eea,_0x2dc443)[_0x0856('0x7')](function(_0x51d918){logger[_0x0856('0x8')](_0x0856('0x9'),_0x0856('0xa'),_0x170eea,_0x2dc443,_0x51d918);if(_0x51d918['error']){logger[_0x0856('0xb')]('rpc','routing',_0x170eea,_0x51d918[_0x0856('0xb')][_0x0856('0xc')],_0x2dc443);return _0xc085d6(_0x51d918[_0x0856('0xb')][_0x0856('0xc')]);}else{return _0x35c94a(_0x51d918[_0x0856('0xd')]);}})[_0x0856('0xe')](function(_0x366dda){logger[_0x0856('0xb')](_0x0856('0x9'),_0x0856('0xa'),_0x170eea,_0x366dda,_0x2dc443);return _0xc085d6(_0x366dda);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9bbb65b..921d11d 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 _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 +var _0x6ea0=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/openchannelQueue','./rpc/mailQueue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6ea0,0x1a4));var _0x06ea=function(_0x4c6e65,_0x41de11){_0x4c6e65=_0x4c6e65-0x0;var _0x38f9b7=_0x6ea0[_0x4c6e65];return _0x38f9b7;};'use strict';var BPromise=require(_0x06ea('0x0'));var server=require(_0x06ea('0x1'));var Realtime=require(_0x06ea('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0x06ea('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x06ea('0x4'));var faxQueue=require(_0x06ea('0x5'));var whatsappQueue=require(_0x06ea('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x06ea('0x7')]()[_0x06ea('0x8')](user['getAgents']())[_0x06ea('0x8')](realtime[_0x06ea('0x9')]())['then'](interval[_0x06ea('0xa')]())[_0x06ea('0x8')](realtime[_0x06ea('0xb')]())[_0x06ea('0x8')](openchannelQueue[_0x06ea('0xc')]())[_0x06ea('0x8')](realtime[_0x06ea('0xd')]())[_0x06ea('0x8')](chatQueue[_0x06ea('0xe')]())[_0x06ea('0x8')](realtime[_0x06ea('0xf')]())[_0x06ea('0x8')](smsQueue[_0x06ea('0x10')]())[_0x06ea('0x8')](realtime['initSmsQueues']())['then'](mailQueue[_0x06ea('0x11')]())[_0x06ea('0x8')](realtime[_0x06ea('0x12')]())[_0x06ea('0x8')](faxQueue[_0x06ea('0x13')]())[_0x06ea('0x8')](realtime[_0x06ea('0x14')]())[_0x06ea('0x8')](whatsappQueue[_0x06ea('0x15')]())[_0x06ea('0x8')](realtime['initWhatsappQueues']())[_0x06ea('0x8')](function(){return realtime;});}function main(){return server[_0x06ea('0x16')](realtime)[_0x06ea('0x8')](function(_0x4658da){return initRealtime();})['then'](function(_0x33f31b){return setInterval(initRealtime,0x1388);})[_0x06ea('0x17')](function(_0x1e8f58){console[_0x06ea('0x18')](_0x1e8f58);});}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 56b98e4..6911cf7 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(_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 +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x402718,_0x22529c){var _0x3e6afb=function(_0x456b60){while(--_0x456b60){_0x402718['push'](_0x402718['shift']());}};_0x3e6afb(++_0x22529c);}(_0x814b,0x1a2));var _0xb814=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x814b[_0x387dc1];return _0x17567c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};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 7905214..78756ea 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 _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 +var _0xb6e7=['SendMail','bluebird','jayson/promise','client','request','then','error','message','result','catch'];(function(_0x3d183f,_0x114702){var _0x555746=function(_0x5d3ea2){while(--_0x5d3ea2){_0x3d183f['push'](_0x3d183f['shift']());}};_0x555746(++_0x114702);}(_0xb6e7,0x137));var _0x7b6e=function(_0x27b3de,_0x5286a4){_0x27b3de=_0x27b3de-0x0;var _0x2b3f25=_0xb6e7[_0x27b3de];return _0x2b3f25;};'use strict';var BPromise=require(_0x7b6e('0x0'));var jayson=require(_0x7b6e('0x1'));var client=jayson[_0x7b6e('0x2')]['http']({'port':0x232b});function request(_0x4b6ad1,_0x2eb3ab){return new BPromise(function(_0x534b31,_0x598507){return client[_0x7b6e('0x3')](_0x4b6ad1,_0x2eb3ab)[_0x7b6e('0x4')](function(_0x1bdc1e){if(_0x1bdc1e[_0x7b6e('0x5')]){return _0x598507(_0x1bdc1e['error'][_0x7b6e('0x6')]);}else{return _0x534b31(_0x1bdc1e[_0x7b6e('0x7')]);}})[_0x7b6e('0x8')](function(_0x1bd90a){return _0x598507(_0x1bd90a);});});}exports['sendMailMessage']=function(_0x215ec0,_0x55e7b5){return request(_0x7b6e('0x9'),{'account':_0x215ec0,'message':_0x55e7b5});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 4614091..9e83968 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 _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 +var _0x3e24=['emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','chatStatus','faxStatusTime','busy','openchannelWaitingInteractions','stringify'];(function(_0x5d5ef4,_0x349302){var _0x832942=function(_0x419eb2){while(--_0x419eb2){_0x5d5ef4['push'](_0x5d5ef4['shift']());}};_0x832942(++_0x349302);}(_0x3e24,0x167));var _0x43e2=function(_0xa20086,_0x3978a9){_0xa20086=_0xa20086-0x0;var _0x121c6e=_0x3e24[_0xa20086];return _0x121c6e;};'use strict';var _=require(_0x43e2('0x0'));var md5=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var Redis=require(_0x43e2('0x3'));var config=require(_0x43e2('0x4'));config['redis']=_[_0x43e2('0x5')](config[_0x43e2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x43e2('0x7'))(new Redis(config[_0x43e2('0x6')]));function Agent(_0x1a89fc){this['id']=_0x1a89fc['id']||0x0;this[_0x43e2('0x8')]=_0x1a89fc[_0x43e2('0x8')]||'';this[_0x43e2('0x9')]=_0x1a89fc[_0x43e2('0x9')]||!![];this['voicePause']=_0x1a89fc[_0x43e2('0xa')]||![];this[_0x43e2('0xb')]=_0x1a89fc['chatPause']||![];this[_0x43e2('0xc')]=_0x1a89fc[_0x43e2('0xc')]||![];this['faxPause']=_0x1a89fc[_0x43e2('0xd')]||![];this[_0x43e2('0xe')]=_0x1a89fc['smsPause']||![];this[_0x43e2('0xf')]=_0x1a89fc['openchannelPause']||![];this['chatStatus']='unknown';this[_0x43e2('0x10')]=0x0;this[_0x43e2('0x11')]=_0x1a89fc[_0x43e2('0x11')]||0x0;this[_0x43e2('0x12')]=0x0;this[_0x43e2('0x13')]=_0x43e2('0x14');this[_0x43e2('0x15')]=0x0;this[_0x43e2('0x16')]=_0x1a89fc[_0x43e2('0x16')]||0x0;this[_0x43e2('0x17')]=0x0;this[_0x43e2('0x18')]=_0x43e2('0x14');this['faxStatusTime']=0x0;this[_0x43e2('0x19')]=_0x1a89fc[_0x43e2('0x19')]||0x0;this[_0x43e2('0x1a')]=0x0;this[_0x43e2('0x1b')]='unknown';this['smsStatusTime']=0x0;this[_0x43e2('0x1c')]=_0x1a89fc[_0x43e2('0x1c')]||0x0;this[_0x43e2('0x1d')]=0x0;this[_0x43e2('0x1e')]=_0x43e2('0x14');this[_0x43e2('0x1f')]=0x0;this[_0x43e2('0x20')]=_0x1a89fc[_0x43e2('0x20')]||0x0;this[_0x43e2('0x21')]=0x0;this[_0x43e2('0x22')]='unknown';this[_0x43e2('0x23')]=0x0;this[_0x43e2('0x24')]=_0x1a89fc['openchannelCapacity']||0x0;this[_0x43e2('0x25')]=0x0;this['busy']=![];this[_0x43e2('0x26')]=undefined;this[_0x43e2('0x1')]='';this[_0x43e2('0x27')]={};this[_0x43e2('0x28')]={};this[_0x43e2('0x29')]={};this['openchannelWaitingInteractions']={};this[_0x43e2('0x2a')]={};this[_0x43e2('0x2b')]={};this[_0x43e2('0x2c')]();}Agent['prototype'][_0x43e2('0x2d')]=function(_0x32f048){if(this[_0x32f048+_0x43e2('0x2e')]>0x0){if(this[_0x32f048+_0x43e2('0x2f')]>0x0&&this[_0x32f048+'CurrentCapacity']>=this[_0x32f048+_0x43e2('0x2f')]){return _0x43e2('0x30');}else{return _0x43e2('0x31');}}else{return _0x43e2('0x32');}};Agent[_0x43e2('0x33')][_0x43e2('0x2c')]=function(){var _0x3ca16b=[_0x43e2('0x34'),_0x43e2('0x35'),_0x43e2('0x36'),_0x43e2('0x37'),_0x43e2('0x38'),'whatsapp'];for(var _0x430a0e=0x0;_0x430a0e<_0x3ca16b[_0x43e2('0x39')];_0x430a0e+=0x1){var _0x545246=this[_0x43e2('0x2d')](_0x3ca16b[_0x430a0e]);if(this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3a')]!==_0x545246){this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3b')]=_[_0x43e2('0x3c')](moment()[_0x43e2('0x3d')]('x'));}this[_0x3ca16b[_0x430a0e]+'Status']=_0x545246;}var _0x42f495={'id':this['id'],'name':this[_0x43e2('0x8')],'online':this[_0x43e2('0x9')],'voicePause':this[_0x43e2('0xa')],'chatPause':this[_0x43e2('0xb')],'mailPause':this[_0x43e2('0xc')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x43e2('0xf')],'chatStatus':this[_0x43e2('0x3e')],'chatStatusTime':this[_0x43e2('0x10')],'chatCapacity':this[_0x43e2('0x11')],'chatCurrentCapacity':this[_0x43e2('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x43e2('0x15')],'mailCapacity':this[_0x43e2('0x16')],'mailCurrentCapacity':this[_0x43e2('0x17')],'faxStatus':this[_0x43e2('0x18')],'faxStatusTime':this[_0x43e2('0x3f')],'faxCapacity':this[_0x43e2('0x19')],'faxCurrentCapacity':this[_0x43e2('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x43e2('0x1c')],'smsCurrentCapacity':this[_0x43e2('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x43e2('0x1f')],'whatsappCapacity':this[_0x43e2('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x43e2('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x43e2('0x40')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x43e2('0x27')],'faxWaitingInteractions':this[_0x43e2('0x28')],'mailWaitingInteractions':this[_0x43e2('0x29')],'openchannelWaitingInteractions':this[_0x43e2('0x41')],'smsWaitingInteractions':this[_0x43e2('0x2a')],'whatsappWaitingInteractions':this[_0x43e2('0x2b')]};var _0x1cf8e5=md5(JSON[_0x43e2('0x42')](_0x42f495));if(this[_0x43e2('0x1')]!==_0x1cf8e5){this[_0x43e2('0x1')]=_0x1cf8e5;io[_0x43e2('0x43')](_0x43e2('0x44'),_[_0x43e2('0x45')](_0x42f495,[_0x43e2('0x9')]));}};module[_0x43e2('0x46')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2668014..4b9d332 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 _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 +var _0xa956=['exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','chatPause','paused','available','stringify','format'];(function(_0x28ad0a,_0x1c7181){var _0x1d1116=function(_0x23606e){while(--_0x23606e){_0x28ad0a['push'](_0x28ad0a['shift']());}};_0x1d1116(++_0x1c7181);}(_0xa956,0xc5));var _0x6a95=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xa956[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x6a95('0x0'));var config=require(_0x6a95('0x1'));config[_0x6a95('0x2')]=_[_0x6a95('0x3')](config[_0x6a95('0x2')],{'host':_0x6a95('0x4'),'port':0x18eb});var io=require(_0x6a95('0x5'))(new Redis(config[_0x6a95('0x2')]));function ChatQueue(_0x12c119){this['id']=_0x12c119['id']||0x0;this[_0x6a95('0x6')]=_0x12c119[_0x6a95('0x6')]||'';this[_0x6a95('0x7')]=_0x12c119[_0x6a95('0x7')]||0xa;this[_0x6a95('0x8')]=_0x12c119[_0x6a95('0x8')]||_0x6a95('0x9');this[_0x6a95('0xa')]=_0x12c119[_0x6a95('0xa')];this[_0x6a95('0xb')]={};this[_0x6a95('0xc')]=0x0;this[_0x6a95('0xd')]='';this[_0x6a95('0xe')]();this[_0x6a95('0xf')]();}ChatQueue[_0x6a95('0x10')]['updateRouting']=function(){var _0x14351b=this[_0x6a95('0xb')][_0x6a95('0x11')];this['mapAgentsId']=_[_0x6a95('0x12')](this[_0x6a95('0xa')],'id');this['mapAgentsId']['_rr']=_0x14351b;};ChatQueue[_0x6a95('0x10')][_0x6a95('0xf')]=function(){this[_0x6a95('0x13')]=0x0;this['paused']=0x0;for(var _0x10d9e8=0x0;_0x10d9e8=0x0?this[_0x6a95('0x18')]:0x0;var _0x4a339e={'id':this['id'],'available':this[_0x6a95('0x18')],'loggedIn':this[_0x6a95('0x13')],'name':this['name'],'paused':this[_0x6a95('0x17')],'waiting':this[_0x6a95('0xc')]};var _0x5153ee=md5(JSON[_0x6a95('0x19')](_0x4a339e));if(this[_0x6a95('0xd')]!==_0x5153ee){this[_0x6a95('0xd')]=_0x5153ee;io['to'](util[_0x6a95('0x1a')]('chat:queue:%s',_0x4a339e[_0x6a95('0x6')]))['emit']('chat_queue:save',_0x4a339e);}};module[_0x6a95('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 9075097..91deab7 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 _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 +var _0xea47=['_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype'];(function(_0x146574,_0x30f429){var _0x264337=function(_0xa89fcf){while(--_0xa89fcf){_0x146574['push'](_0x146574['shift']());}};_0x264337(++_0x30f429);}(_0xea47,0x1dc));var _0x7ea4=function(_0x1087e5,_0x416079){_0x1087e5=_0x1087e5-0x0;var _0x565ee6=_0xea47[_0x1087e5];return _0x565ee6;};'use strict';var _=require(_0x7ea4('0x0'));var md5=require(_0x7ea4('0x1'));var util=require(_0x7ea4('0x2'));var Redis=require(_0x7ea4('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x7ea4('0x4')](config['redis'],{'host':_0x7ea4('0x5'),'port':0x18eb});var io=require(_0x7ea4('0x6'))(new Redis(config[_0x7ea4('0x7')]));function FaxQueue(_0x4478d2){this['id']=_0x4478d2['id']||0x0;this[_0x7ea4('0x8')]=_0x4478d2[_0x7ea4('0x8')]||'';this[_0x7ea4('0x9')]=_0x4478d2[_0x7ea4('0x9')]||0xa;this[_0x7ea4('0xa')]=_0x4478d2['strategy']||_0x7ea4('0xb');this['Agents']=_0x4478d2[_0x7ea4('0xc')];this[_0x7ea4('0xd')]={};this[_0x7ea4('0xe')]=0x0;this[_0x7ea4('0x1')]='';this['updateRouting']();this[_0x7ea4('0xf')]();}FaxQueue[_0x7ea4('0x10')]['updateRouting']=function(){var _0x5baf67=this[_0x7ea4('0xd')][_0x7ea4('0x11')];this[_0x7ea4('0xd')]=_['map'](this[_0x7ea4('0xc')],'id');this[_0x7ea4('0xd')][_0x7ea4('0x11')]=_0x5baf67;};FaxQueue[_0x7ea4('0x10')][_0x7ea4('0xf')]=function(){this[_0x7ea4('0x12')]=0x0;this[_0x7ea4('0x13')]=0x0;for(var _0x520e5c=0x0;_0x520e5c=0x0?this[_0x7ea4('0x17')]:0x0;var _0x1c3e7a={'id':this['id'],'available':this[_0x7ea4('0x17')],'loggedIn':this[_0x7ea4('0x12')],'name':this[_0x7ea4('0x8')],'paused':this[_0x7ea4('0x13')],'waiting':this['waiting']};var _0x4493e7=md5(JSON[_0x7ea4('0x18')](_0x1c3e7a));if(this['md5']!==_0x4493e7){this[_0x7ea4('0x1')]=_0x4493e7;io['to'](util[_0x7ea4('0x19')](_0x7ea4('0x1a'),_0x1c3e7a[_0x7ea4('0x8')]))[_0x7ea4('0x1b')](_0x7ea4('0x1c'),_0x1c3e7a);}};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 8d12d4c..7457751 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 _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 +var _0x5856=['name','Intervals','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x5856,0x102));var _0x6585=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x5856[_0x3a3758];return _0x1a9234;};'use strict';function Interval(_0x4f36c6){this['id']=_0x4f36c6['id']||0x0;this['name']=_0x4f36c6[_0x6585('0x0')]||'';this[_0x6585('0x1')]=_0x4f36c6['Intervals']||{};}module[_0x6585('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 ff9b724..13b78b5 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 _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 +var _0x6a98=['mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','mailPause','available','stringify'];(function(_0x22cbd3,_0x36f0e8){var _0x4681f0=function(_0x10aefe){while(--_0x10aefe){_0x22cbd3['push'](_0x22cbd3['shift']());}};_0x4681f0(++_0x36f0e8);}(_0x6a98,0x13b));var _0x86a9=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x6a98[_0xd158dc];return _0x12d25f;};'use strict';var _=require(_0x86a9('0x0'));var md5=require(_0x86a9('0x1'));var util=require(_0x86a9('0x2'));var Redis=require(_0x86a9('0x3'));var config=require(_0x86a9('0x4'));config[_0x86a9('0x5')]=_[_0x86a9('0x6')](config[_0x86a9('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x86a9('0x5')]));function MailQueue(_0x5e0040){this['id']=_0x5e0040['id']||0x0;this['name']=_0x5e0040[_0x86a9('0x7')]||'';this['timeout']=_0x5e0040[_0x86a9('0x8')]||0xa;this['strategy']=_0x5e0040[_0x86a9('0x9')]||_0x86a9('0xa');this['Agents']=_0x5e0040[_0x86a9('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x86a9('0x1')]='';this['updateRouting']();this[_0x86a9('0xc')]();}MailQueue[_0x86a9('0xd')]['updateRouting']=function(){var _0x5d816b=this[_0x86a9('0xe')][_0x86a9('0xf')];this[_0x86a9('0xe')]=_[_0x86a9('0x10')](this[_0x86a9('0xb')],'id');this[_0x86a9('0xe')]['_rr']=_0x5d816b;};MailQueue[_0x86a9('0xd')][_0x86a9('0xc')]=function(){this[_0x86a9('0x11')]=0x0;this[_0x86a9('0x12')]=0x0;for(var _0x242492=0x0;_0x242492=0x0?this[_0x86a9('0x15')]:0x0;var _0x557550={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x86a9('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3ccbde=md5(JSON[_0x86a9('0x16')](_0x557550));if(this[_0x86a9('0x1')]!==_0x3ccbde){this[_0x86a9('0x1')]=_0x3ccbde;io['to'](util['format'](_0x86a9('0x17'),_0x557550[_0x86a9('0x7')]))[_0x86a9('0x18')](_0x86a9('0x19'),_0x557550);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 829e692..7c70e71 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 _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 +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x7a54,0x106));var _0x47a5=function(_0xcded6f,_0x8512f3){_0xcded6f=_0xcded6f-0x0;var _0x56c7d5=_0x7a54[_0xcded6f];return _0x56c7d5;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2fb1aee..cccd40a 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 _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 +var _0x5455=['emit','sms_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','paused','length','online','loggedIn','smsPause','available','stringify','sms:queue:%s','name'];(function(_0x4cbaa2,_0x296688){var _0x2c0e29=function(_0x4a78a3){while(--_0x4a78a3){_0x4cbaa2['push'](_0x4cbaa2['shift']());}};_0x2c0e29(++_0x296688);}(_0x5455,0x197));var _0x5545=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5455[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var md5=require(_0x5545('0x0'));var util=require(_0x5545('0x1'));var Redis=require(_0x5545('0x2'));var config=require(_0x5545('0x3'));config[_0x5545('0x4')]=_[_0x5545('0x5')](config[_0x5545('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5545('0x4')]));function SmsQueue(_0x6688e5){this['id']=_0x6688e5['id']||0x0;this['name']=_0x6688e5['name']||'';this[_0x5545('0x6')]=_0x6688e5[_0x5545('0x6')]||0xa;this['strategy']=_0x6688e5[_0x5545('0x7')]||_0x5545('0x8');this['Agents']=_0x6688e5[_0x5545('0x9')];this[_0x5545('0xa')]={};this[_0x5545('0xb')]=0x0;this[_0x5545('0x0')]='';this[_0x5545('0xc')]();this[_0x5545('0xd')]();}SmsQueue[_0x5545('0xe')][_0x5545('0xc')]=function(){var _0xbb13a0=this['mapAgentsId']['_rr'];this[_0x5545('0xa')]=_[_0x5545('0xf')](this[_0x5545('0x9')],'id');this[_0x5545('0xa')]['_rr']=_0xbb13a0;};SmsQueue[_0x5545('0xe')][_0x5545('0xd')]=function(){this['loggedIn']=0x0;this[_0x5545('0x10')]=0x0;for(var _0x167f3d=0x0;_0x167f3d=0x0?this[_0x5545('0x15')]:0x0;var _0x373f92={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5545('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x5f13ef=md5(JSON[_0x5545('0x16')](_0x373f92));if(this[_0x5545('0x0')]!==_0x5f13ef){this[_0x5545('0x0')]=_0x5f13ef;io['to'](util['format'](_0x5545('0x17'),_0x373f92[_0x5545('0x18')]))[_0x5545('0x19')](_0x5545('0x1a'),_0x373f92);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 34208c4..534bccb 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 _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 +var _0x2684=['available','stringify','whatsapp:queue:%s','exports','lodash','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','_rr','map','mapAgentsId','prototype','paused','length','loggedIn','whatsappPause'];(function(_0x35095b,_0x28c169){var _0x3e2667=function(_0x1acdba){while(--_0x1acdba){_0x35095b['push'](_0x35095b['shift']());}};_0x3e2667(++_0x28c169);}(_0x2684,0xdc));var _0x4268=function(_0x1fac5e,_0x1edf0e){_0x1fac5e=_0x1fac5e-0x0;var _0x1416c9=_0x2684[_0x1fac5e];return _0x1416c9;};'use strict';var _=require(_0x4268('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x4268('0x1'));var config=require('../../../config/environment');config[_0x4268('0x2')]=_[_0x4268('0x3')](config[_0x4268('0x2')],{'host':_0x4268('0x4'),'port':0x18eb});var io=require(_0x4268('0x5'))(new Redis(config[_0x4268('0x2')]));function WhatsappQueue(_0x363e92){this['id']=_0x363e92['id']||0x0;this[_0x4268('0x6')]=_0x363e92[_0x4268('0x6')]||'';this['timeout']=_0x363e92[_0x4268('0x7')]||0xa;this[_0x4268('0x8')]=_0x363e92[_0x4268('0x8')]||_0x4268('0x9');this['Agents']=_0x363e92[_0x4268('0xa')];this['mapAgentsId']={};this[_0x4268('0xb')]=0x0;this[_0x4268('0xc')]='';this[_0x4268('0xd')]();this[_0x4268('0xe')]();}WhatsappQueue['prototype'][_0x4268('0xd')]=function(){var _0x27e8b7=this['mapAgentsId'][_0x4268('0xf')];this['mapAgentsId']=_[_0x4268('0x10')](this[_0x4268('0xa')],'id');this[_0x4268('0x11')][_0x4268('0xf')]=_0x27e8b7;};WhatsappQueue[_0x4268('0x12')][_0x4268('0xe')]=function(){this['loggedIn']=0x0;this[_0x4268('0x13')]=0x0;for(var _0x3fcd7e=0x0;_0x3fcd7e=0x0?this[_0x4268('0x17')]:0x0;var _0x3205a7={'id':this['id'],'available':this[_0x4268('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x4268('0x6')],'paused':this[_0x4268('0x13')],'waiting':this[_0x4268('0xb')]};var _0xcfb219=md5(JSON[_0x4268('0x18')](_0x3205a7));if(this[_0x4268('0xc')]!==_0xcfb219){this[_0x4268('0xc')]=_0xcfb219;io['to'](util['format'](_0x4268('0x19'),_0x3205a7[_0x4268('0x6')]))['emit']('whatsapp_queue:save',_0x3205a7);}};module[_0x4268('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index a217247..9bee213 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 a7d74f8..7f6ab59 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 _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 +var _0xa99b=['UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x730dc3,_0x33d8b9){var _0x1059af=function(_0x123c14){while(--_0x123c14){_0x730dc3['push'](_0x730dc3['shift']());}};_0x1059af(++_0x33d8b9);}(_0xa99b,0x12e));var _0xba99=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xa99b[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require(_0xba99('0x0'));exports[_0xba99('0x1')]=function(_0x4174c4,_0x3e8b8f){return client['Request'](_0xba99('0x2'),{'body':_0x3e8b8f,'options':{'where':{'id':_0x4174c4}},'log':_0xba99('0x3')});};exports[_0xba99('0x4')]=function(_0x531d74,_0x377d36){return client[_0xba99('0x5')](_0xba99('0x6'),{'body':_0x377d36,'options':{'where':{'id':_0x531d74}},'log':_0xba99('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f264b1e..8cd7e21 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 _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 +var _0x89fa=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x29139c,_0x37cc9d){var _0x4d0793=function(_0x8ad64e){while(--_0x8ad64e){_0x29139c['push'](_0x29139c['shift']());}};_0x4d0793(++_0x37cc9d);}(_0x89fa,0x140));var _0xa89f=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x89fa[_0x32b993];return _0x482780;};'use strict';var client=require('../client');exports[_0xa89f('0x0')]=function(_0x2adc4a){return client[_0xa89f('0x1')](_0xa89f('0x2'),{'body':_0x2adc4a,'log':_0xa89f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f938f67..54519cf 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 _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 +var _0xcb57=['chatPause','../client','getChatQueues','GetChatQueue','timeout','User','Agents','online'];(function(_0x5266e7,_0x97b16b){var _0x5470f1=function(_0x10258e){while(--_0x10258e){_0x5266e7['push'](_0x5266e7['shift']());}};_0x5470f1(++_0x97b16b);}(_0xcb57,0xa1));var _0x7cb5=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xcb57[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require(_0x7cb5('0x0'));exports[_0x7cb5('0x1')]=function(){return function(){return client['Request'](_0x7cb5('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7cb5('0x3'),'strategy'],'include':[{'model':_0x7cb5('0x4'),'as':_0x7cb5('0x5'),'attributes':['id','name',_0x7cb5('0x6'),_0x7cb5('0x7')]}]},'log':_0x7cb5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 54c62a5..d8ef7f6 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 _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 +var _0x81d5=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x81d5,0x1ab));var _0x581d=function(_0x4c1d47,_0x4868bd){_0x4c1d47=_0x4c1d47-0x0;var _0x39736b=_0x81d5[_0x4c1d47];return _0x39736b;};'use strict';var client=require(_0x581d('0x0'));exports[_0x581d('0x1')]=function(_0x55fd33){return client[_0x581d('0x2')](_0x581d('0x3'),{'body':_0x55fd33,'log':_0x581d('0x3')});};exports[_0x581d('0x4')]=function(_0x477e28,_0x553617){return client['Request'](_0x581d('0x5'),{'body':_0x553617,'options':{'where':{'uniqueid':_0x477e28},'order':[['id',_0x581d('0x6')]],'limit':0x1},'log':_0x581d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0ee9016..d46963f 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_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 +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5202f9,_0x300a19){var _0x136d7e=function(_0x5bb26c){while(--_0x5bb26c){_0x5202f9['push'](_0x5202f9['shift']());}};_0x136d7e(++_0x300a19);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2af63ca..219402e 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 _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 +var _0x9ce8=['create','Request','createFaxMessage'];(function(_0x9e50f0,_0x3a4f8f){var _0x964658=function(_0x1f6606){while(--_0x1f6606){_0x9e50f0['push'](_0x9e50f0['shift']());}};_0x964658(++_0x3a4f8f);}(_0x9ce8,0x1bc));var _0x89ce=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x9ce8[_0x158f01];return _0x5ef74e;};'use strict';var client=require('../client');exports[_0x89ce('0x0')]=function(_0x1adee7){return client[_0x89ce('0x1')]('CreateFaxMessage',{'body':_0x1adee7,'log':_0x89ce('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index af4b15a..967d835 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 _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 +var _0xed2f=['timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0xed2f,0x13a));var _0xfed2=function(_0x2d1ce5,_0x548c52){_0x2d1ce5=_0x2d1ce5-0x0;var _0x1b1d16=_0xed2f[_0x2d1ce5];return _0x1b1d16;};'use strict';var client=require(_0xfed2('0x0'));exports[_0xfed2('0x1')]=function(){return function(){return client[_0xfed2('0x2')](_0xfed2('0x3'),{'options':{'raw':![],'attributes':['id',_0xfed2('0x4'),_0xfed2('0x5'),_0xfed2('0x6')],'include':[{'model':_0xfed2('0x7'),'as':_0xfed2('0x8'),'attributes':['id',_0xfed2('0x4'),_0xfed2('0x9'),_0xfed2('0xa')]}]},'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 cf77169..dec80cf 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 _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 +var _0x7ea9=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x1bf051,_0x12b969){var _0x424a7a=function(_0x2563fe){while(--_0x2563fe){_0x1bf051['push'](_0x1bf051['shift']());}};_0x424a7a(++_0x12b969);}(_0x7ea9,0xef));var _0x97ea=function(_0x12ad09,_0x1504ba){_0x12ad09=_0x12ad09-0x0;var _0x19f28e=_0x7ea9[_0x12ad09];return _0x19f28e;};'use strict';var client=require(_0x97ea('0x0'));exports[_0x97ea('0x1')]=function(_0x5ff9a2){return client[_0x97ea('0x2')](_0x97ea('0x3'),{'body':_0x5ff9a2,'log':_0x97ea('0x3')});};exports[_0x97ea('0x4')]=function(_0x13e32e,_0x4d9de2){return client[_0x97ea('0x2')]('UpdateFaxQueueReport',{'body':_0x4d9de2,'options':{'where':{'uniqueid':_0x13e32e},'order':[['id',_0x97ea('0x5')]],'limit':0x1},'log':_0x97ea('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d08b825..2ba9571 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 _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 +var _0x80f7=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x80f7,0x8d));var _0x780f=function(_0x35d06e,_0x2e3503){_0x35d06e=_0x35d06e-0x0;var _0x9e9053=_0x80f7[_0x35d06e];return _0x9e9053;};'use strict';var client=require(_0x780f('0x0'));exports[_0x780f('0x1')]=function(){return function(){return client[_0x780f('0x2')](_0x780f('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x780f('0x4')],'include':[{'model':_0x780f('0x5'),'as':_0x780f('0x6'),'attributes':['id',_0x780f('0x4'),_0x780f('0x7')]}]},'log':_0x780f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b4e45c3..f7bce18 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 _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 +var _0xda2d=['UpdateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request'];(function(_0x5cca6e,_0x5282cc){var _0x1a6c2c=function(_0x4e3669){while(--_0x4e3669){_0x5cca6e['push'](_0x5cca6e['shift']());}};_0x1a6c2c(++_0x5282cc);}(_0xda2d,0x102));var _0xdda2=function(_0x1e9edb,_0x25ad79){_0x1e9edb=_0x1e9edb-0x0;var _0xa987d9=_0xda2d[_0x1e9edb];return _0xa987d9;};'use strict';var client=require('../client');exports[_0xdda2('0x0')]=function(_0x35f029,_0xd495d2){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'body':_0xd495d2,'options':{'where':{'id':_0x35f029}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x5a5f9f,_0x357e97){return client[_0xdda2('0x1')](_0xdda2('0x3'),{'body':_0x357e97,'options':{'where':{'id':_0x5a5f9f}},'log':_0xdda2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 11a06f1..f0d75db 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 _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 +var _0xf6fa=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x33b00c,_0x147745){var _0x5697dc=function(_0x45abc0){while(--_0x45abc0){_0x33b00c['push'](_0x33b00c['shift']());}};_0x5697dc(++_0x147745);}(_0xf6fa,0x1a5));var _0xaf6f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf6fa[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0xaf6f('0x0'));exports['create']=function(_0x4ed77e){return client[_0xaf6f('0x1')](_0xaf6f('0x2'),{'body':_0x4ed77e,'log':_0xaf6f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index eec8153..ed13fac 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 _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 +var _0x3a9b=['timeout','strategy','User','mailPause','getMailQueues','../client','GetMailQueue','name'];(function(_0x4a96e5,_0x2379a8){var _0x1e2db4=function(_0x5e9b08){while(--_0x5e9b08){_0x4a96e5['push'](_0x4a96e5['shift']());}};_0x1e2db4(++_0x2379a8);}(_0x3a9b,0x10d));var _0xb3a9=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x3a9b[_0x29d915];return _0x160f86;};'use strict';var client=require(_0xb3a9('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0xb3a9('0x1'),{'options':{'raw':![],'attributes':['id',_0xb3a9('0x2'),_0xb3a9('0x3'),_0xb3a9('0x4')],'include':[{'model':_0xb3a9('0x5'),'as':'Agents','attributes':['id',_0xb3a9('0x2'),'online',_0xb3a9('0x6')]}]},'log':_0xb3a9('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 57948e5..29f07a4 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 _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 +var _0xc00e=['DESC','../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x4bcb3f,_0x45fbab){var _0x9293fc=function(_0x494874){while(--_0x494874){_0x4bcb3f['push'](_0x4bcb3f['shift']());}};_0x9293fc(++_0x45fbab);}(_0xc00e,0x187));var _0xec00=function(_0x19b583,_0x24c475){_0x19b583=_0x19b583-0x0;var _0x38f2f7=_0xc00e[_0x19b583];return _0x38f2f7;};'use strict';var client=require(_0xec00('0x0'));exports['create']=function(_0x3f49e7){return client[_0xec00('0x1')](_0xec00('0x2'),{'body':_0x3f49e7,'log':'CreateMailQueueReport'});};exports[_0xec00('0x3')]=function(_0x12a4df,_0x281700){return client[_0xec00('0x1')](_0xec00('0x4'),{'body':_0x281700,'options':{'where':{'uniqueid':_0x12a4df},'order':[['id',_0xec00('0x5')]],'limit':0x1},'log':_0xec00('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 54b21c9..5103f36 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 _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 +var _0xa028=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request'];(function(_0x555491,_0x6d2949){var _0x35f65f=function(_0xa18694){while(--_0xa18694){_0x555491['push'](_0x555491['shift']());}};_0x35f65f(++_0x6d2949);}(_0xa028,0xf9));var _0x8a02=function(_0x34d37e,_0x18f3c1){_0x34d37e=_0x34d37e-0x0;var _0x27b91c=_0xa028[_0x34d37e];return _0x27b91c;};'use strict';var client=require(_0x8a02('0x0'));exports[_0x8a02('0x1')]=function(_0x4b837f,_0xb90257){return client[_0x8a02('0x2')](_0x8a02('0x3'),{'body':_0xb90257,'options':{'where':{'id':_0x4b837f}},'log':_0x8a02('0x4')});};exports[_0x8a02('0x5')]=function(_0x2c93dd,_0x348701){return client[_0x8a02('0x2')](_0x8a02('0x6'),{'body':_0x348701,'options':{'where':{'id':_0x2c93dd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b720435..75b4333 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 _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 +var _0xedec=['create','Request','createOpenchannelMessage','../client'];(function(_0x540d58,_0x55d976){var _0x2c618c=function(_0x26eb2c){while(--_0x26eb2c){_0x540d58['push'](_0x540d58['shift']());}};_0x2c618c(++_0x55d976);}(_0xedec,0x18b));var _0xcede=function(_0x76ced3,_0x8abc01){_0x76ced3=_0x76ced3-0x0;var _0x4fea70=_0xedec[_0x76ced3];return _0x4fea70;};'use strict';var client=require(_0xcede('0x0'));exports[_0xcede('0x1')]=function(_0x103fe3){return client[_0xcede('0x2')]('CreateOpenchannelMessage',{'body':_0x103fe3,'log':_0xcede('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index afc9af8..5ebb396 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 _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 +var _0x219f=['GetOpenchannelQueue','name','timeout','strategy','Agents','online','../client','getOpenchannelQueues','Request'];(function(_0x261497,_0x5977f7){var _0x1da692=function(_0x239be3){while(--_0x239be3){_0x261497['push'](_0x261497['shift']());}};_0x1da692(++_0x5977f7);}(_0x219f,0xc3));var _0xf219=function(_0x4b612c,_0x8fa416){_0x4b612c=_0x4b612c-0x0;var _0x44953b=_0x219f[_0x4b612c];return _0x44953b;};'use strict';var client=require(_0xf219('0x0'));exports[_0xf219('0x1')]=function(){return function(){return client[_0xf219('0x2')](_0xf219('0x3'),{'options':{'raw':![],'attributes':['id',_0xf219('0x4'),_0xf219('0x5'),_0xf219('0x6')],'include':[{'model':'User','as':_0xf219('0x7'),'attributes':['id',_0xf219('0x4'),_0xf219('0x8'),'openchannelPause']}]},'log':_0xf219('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8f6830c..ca31335 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 _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 +var _0x073c=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create','Request'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x073c,0x118));var _0xc073=function(_0x2538e6,_0x273863){_0x2538e6=_0x2538e6-0x0;var _0x9e91e7=_0x073c[_0x2538e6];return _0x9e91e7;};'use strict';var client=require('../client');exports[_0xc073('0x0')]=function(_0x2e4394){return client[_0xc073('0x1')](_0xc073('0x2'),{'body':_0x2e4394,'log':_0xc073('0x2')});};exports[_0xc073('0x3')]=function(_0x59250c,_0xed9735){return client['Request'](_0xc073('0x4'),{'body':_0xed9735,'options':{'where':{'uniqueid':_0x59250c},'order':[['id',_0xc073('0x5')]],'limit':0x1},'log':_0xc073('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c74b6da..9d03761 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 _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 +var _0xe548=['../client','update','Request','addTagsToSmsInteraction'];(function(_0x459349,_0x2e6797){var _0x35de00=function(_0x1f5a19){while(--_0x1f5a19){_0x459349['push'](_0x459349['shift']());}};_0x35de00(++_0x2e6797);}(_0xe548,0x184));var _0x8e54=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xe548[_0x148879];return _0x4f7027;};'use strict';var client=require(_0x8e54('0x0'));exports[_0x8e54('0x1')]=function(_0x294af0,_0x2b10bd){return client[_0x8e54('0x2')]('UpdateSmsInteraction',{'body':_0x2b10bd,'options':{'where':{'id':_0x294af0}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x4aa36a,_0x4b69ef){return client[_0x8e54('0x2')]('AddTagsToSmsInteraction',{'body':_0x4b69ef,'options':{'where':{'id':_0x4aa36a}},'log':_0x8e54('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 5d1e8bd..2d17883 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 _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 +var _0x8d6c=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x1d255e,_0x110095){var _0xc012ce=function(_0x24b26d){while(--_0x24b26d){_0x1d255e['push'](_0x1d255e['shift']());}};_0xc012ce(++_0x110095);}(_0x8d6c,0x16e));var _0xc8d6=function(_0x395e18,_0x277448){_0x395e18=_0x395e18-0x0;var _0x22d205=_0x8d6c[_0x395e18];return _0x22d205;};'use strict';var client=require(_0xc8d6('0x0'));exports[_0xc8d6('0x1')]=function(_0x518d8b){return client['Request'](_0xc8d6('0x2'),{'body':_0x518d8b,'log':_0xc8d6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 53dfce3..534f2c2 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 _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 +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 31eae0d..979534d 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 _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 +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x1f16bb,_0x1b27a9){var _0x14e6e4=function(_0x23d2e3){while(--_0x23d2e3){_0x1f16bb['push'](_0x1f16bb['shift']());}};_0x14e6e4(++_0x1b27a9);}(_0x70e0,0x17b));var _0x070e=function(_0x47ea7e,_0x5f427d){_0x47ea7e=_0x47ea7e-0x0;var _0x518f7e=_0x70e0[_0x47ea7e];return _0x518f7e;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 36cf877..d0cdc74 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(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3575b0,_0x150d4f){var _0x2f6998=function(_0xb70e09){while(--_0xb70e09){_0x3575b0['push'](_0x3575b0['shift']());}};_0x2f6998(++_0x150d4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 589e248..42c6154 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 _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 +var _0x6455=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x43b621,_0x75352f){var _0x1427d2=function(_0x4fd30c){while(--_0x4fd30c){_0x43b621['push'](_0x43b621['shift']());}};_0x1427d2(++_0x75352f);}(_0x6455,0x97));var _0x5645=function(_0x12ba02,_0x5efe9c){_0x12ba02=_0x12ba02-0x0;var _0xb05b13=_0x6455[_0x12ba02];return _0xb05b13;};'use strict';var client=require(_0x5645('0x0'));exports['update']=function(_0x6b9a7e,_0x2294f5){return client[_0x5645('0x1')](_0x5645('0x2'),{'body':_0x2294f5,'options':{'where':{'id':_0x6b9a7e}},'log':_0x5645('0x3')});};exports[_0x5645('0x4')]=function(_0x5388ff,_0x233875){return client[_0x5645('0x1')](_0x5645('0x5'),{'body':_0x233875,'options':{'where':{'id':_0x5388ff}},'log':_0x5645('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a25671a..bc9fdc2 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 _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 +var _0x4d5e=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x390dad,_0x3a3e5a){var _0x490148=function(_0x4a2c87){while(--_0x4a2c87){_0x390dad['push'](_0x390dad['shift']());}};_0x490148(++_0x3a3e5a);}(_0x4d5e,0x197));var _0xe4d5=function(_0x5d2ba8,_0x1b1791){_0x5d2ba8=_0x5d2ba8-0x0;var _0x1932d2=_0x4d5e[_0x5d2ba8];return _0x1932d2;};'use strict';var client=require('../client');exports[_0xe4d5('0x0')]=function(_0x337a70){return client['Request'](_0xe4d5('0x1'),{'body':_0x337a70,'log':_0xe4d5('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f354268..b186764 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 _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 +var _0x13fd=['name','timeout','strategy','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x1f77d4,_0x23b7a4){var _0x167453=function(_0x43d38b){while(--_0x43d38b){_0x1f77d4['push'](_0x1f77d4['shift']());}};_0x167453(++_0x23b7a4);}(_0x13fd,0x11c));var _0xd13f=function(_0x1ed017,_0x28c947){_0x1ed017=_0x1ed017-0x0;var _0x5d3fe2=_0x13fd[_0x1ed017];return _0x5d3fe2;};'use strict';var client=require(_0xd13f('0x0'));exports[_0xd13f('0x1')]=function(){return function(){return client[_0xd13f('0x2')](_0xd13f('0x3'),{'options':{'raw':![],'attributes':['id',_0xd13f('0x4'),_0xd13f('0x5'),_0xd13f('0x6')],'include':[{'model':'User','as':_0xd13f('0x7'),'attributes':['id',_0xd13f('0x4'),_0xd13f('0x8'),'whatsappPause']}]},'log':_0xd13f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 2027f28..d04e353 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 _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 +var _0x0367=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x188cb8,_0x3b12b3){var _0x25eb9b=function(_0x11770b){while(--_0x11770b){_0x188cb8['push'](_0x188cb8['shift']());}};_0x25eb9b(++_0x3b12b3);}(_0x0367,0x9a));var _0x7036=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0367[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x7036('0x0'));exports[_0x7036('0x1')]=function(_0x96d7f1){return client[_0x7036('0x2')](_0x7036('0x3'),{'body':_0x96d7f1,'log':'CreateWhatsappQueueReport'});};exports[_0x7036('0x4')]=function(_0x545efe,_0x190a51){return client[_0x7036('0x2')](_0x7036('0x5'),{'body':_0x190a51,'options':{'where':{'uniqueid':_0x545efe},'order':[['id',_0x7036('0x6')]],'limit':0x1},'log':_0x7036('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 5ba259a..2ffaf15 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 _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 +var _0x6df2=['message','join','stop','find','agents','createQueue','atimeout','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','info','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','map'];(function(_0x27c28c,_0x49ba23){var _0x1f5669=function(_0x257683){while(--_0x257683){_0x27c28c['push'](_0x27c28c['shift']());}};_0x1f5669(++_0x49ba23);}(_0x6df2,0x1b6));var _0x26df=function(_0x182f76,_0x325311){_0x182f76=_0x182f76-0x0;var _0x4d0b12=_0x6df2[_0x182f76];return _0x4d0b12;};'use strict';var schema=require(_0x26df('0x0'));var _=require(_0x26df('0x1'));var util=require(_0x26df('0x2'));var seqqueue=require(_0x26df('0x3'));var logger=require(_0x26df('0x4'))(_0x26df('0x5'));var strategy=require(_0x26df('0x6'));var queue=schema({'name':{'type':_0x26df('0x7'),'required':!![],'message':_0x26df('0x8')},'timeout':{'type':_0x26df('0x9'),'message':_0x26df('0xa')}});function writeLog(_0x1fe91a,_0x274d4f,_0x59e9b2){return logger['info'](util[_0x26df('0xb')](_0x26df('0xc'),_0x1fe91a,_0x274d4f[_0x26df('0xd')],_0x59e9b2));}function handleFindAgent(_0x220df7){return function(_0x6e7c40){return _0x6e7c40[_0x26df('0xd')][_0x26df('0xe')]()===_0x220df7['toLowerCase']();};}exports[_0x26df('0xf')]=function(_0x3900af,_0x50eb2b,_0x30f42b,_0x3a4c84){return function(_0x5f08ff){try{var _0x1acb07={'name':_0x50eb2b[0x0],'timeout':_0x50eb2b[0x1]};var _0x42dfe8=queue[_0x26df('0x0')](_0x1acb07,{'typecast':!![]});if(_0x42dfe8['length']){logger[_0x26df('0x10')]('[%s][AGENT]\x20%s',_0x3900af,_[_0x26df('0x11')](_0x42dfe8,_0x26df('0x12'))[_0x26df('0x13')](',\x20'));_0x5f08ff[_0x26df('0x14')]();}else{var _0x1ac58a=_[_0x26df('0x15')](_0x30f42b[_0x26df('0x16')],handleFindAgent(_0x1acb07[_0x26df('0xd')]));if(_0x1ac58a){var _0x1cbef0=(_0x1acb07['timeout']||0xa)*0x3e8;var _0x1404de,_0x5afd5e;var _0x1ab3ec=seqqueue[_0x26df('0x17')](_0x1cbef0);_0x1ab3ec['id']=_0x3900af;_0x1ab3ec[_0x26df('0x18')]=_0x1cbef0;_0x1ab3ec['channel']=_0x3a4c84['channel'];writeLog(_0x3900af,_0x1ac58a,util[_0x26df('0xb')](_0x26df('0x19'),_0x1cbef0));_0x30f42b[_0x26df('0x1a')][_0x3900af]['on'](_0x26df('0x1b'),function(){logger['info'](_0x26df('0x1c'),_0x3900af);clearTimeout(_0x5afd5e);_0x5afd5e=undefined;_0x1ab3ec['close']();if(_0x30f42b[_0x26df('0x1a')][_0x3900af]){delete _0x30f42b[_0x26df('0x1a')][_0x3900af];}_0x5f08ff[_0x26df('0x14')]();});_0x30f42b[_0x26df('0x1a')][_0x3900af]['on'](_0x26df('0x1d'),function(){if(_0x30f42b['rules'][_0x3900af]){delete _0x30f42b[_0x26df('0x1a')][_0x3900af];}});_0x5afd5e=setTimeout(function(){logger[_0x26df('0x1e')]('[%s][AGENT]\x20ROUTING\x20END',_0x3900af);clearTimeout(_0x5afd5e);_0x1ab3ec[_0x26df('0x1f')]();_0x5f08ff[_0x26df('0x20')]();},_0x1cbef0);strategy[_0x26df('0x21')](_0x1ab3ec,_0x1ac58a,_0x30f42b,_0x3a4c84);}else{logger[_0x26df('0x10')](_0x26df('0x22'),_0x3900af,_0x1acb07['name']);_0x5f08ff[_0x26df('0x14')]();}}}catch(_0x427592){console[_0x26df('0x23')](_0x427592);logger[_0x26df('0x10')](_0x26df('0x24'),_0x3900af,_0x427592[_0x26df('0x25')]);_0x5f08ff[_0x26df('0x14')]();}};}; \ 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 1f9299e..743312d 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 _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 +var _0x388d=['sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','body','Message','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','toString','postText','amazonlex','providerResponse','dialogState','catch','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x5258bb,_0x4a5311){var _0x50424d=function(_0x122913){while(--_0x122913){_0x5258bb['push'](_0x5258bb['shift']());}};_0x50424d(++_0x4a5311);}(_0x388d,0xa7));var _0xd388=function(_0x40b777,_0x2760c0){_0x40b777=_0x40b777-0x0;var _0x2b0539=_0x388d[_0x40b777];return _0x2b0539;};'use strict';var _=require(_0xd388('0x0'));var moment=require(_0xd388('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xd388('0x2'))(_0xd388('0x3'));var rpc={'chatMessage':require(_0xd388('0x4')),'openchannelMessage':require(_0xd388('0x5')),'mailMessage':require(_0xd388('0x6')),'smsMessage':require(_0xd388('0x7')),'faxMessage':require(_0xd388('0x8')),'whatsappMessage':require(_0xd388('0x9'))};exports[_0xd388('0xa')]=function(_0x3f9f22,_0x3e7e57){return function(_0x42d3e4){try{if(!_[_0xd388('0xb')](this['interaction'][_0xd388('0xc')])){logger[_0xd388('0xd')](_0xd388('0xe'),_0x3f9f22,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x42d3e4[_0xd388('0xf')]();}var _0x4b3189={'ContactId':this[_0xd388('0x10')]['id'],'sentAt':moment()[_0xd388('0x11')](_0xd388('0x12')),'direction':_0xd388('0x13')};if(this[_0xd388('0x14')]===_0xd388('0x15')||this[_0xd388('0x14')]===_0xd388('0x16')){_0x4b3189[_0xd388('0x17')]=this[_0xd388('0x18')][_0xd388('0x17')];}var _0x2b1da9=this[_0xd388('0x14')];if(_0x2b1da9===_0xd388('0x19')){_0x4b3189[_0xd388('0x1a')]=this[_0xd388('0x1b')]['id'];}else{_0x4b3189[_[_0xd388('0x1c')](_0x2b1da9)+'AccountId']=this[_0xd388('0x1b')]['id'];}_0x4b3189[_[_0xd388('0x1c')](_0x2b1da9)+'InteractionId']=this['interaction']['id'];if(this['interaction']['created']){var _0x46fe67=_0x3e7e57[0x4];if(!_['isEmpty'](_0x46fe67)){_0x4b3189[_0xd388('0x1d')]=utils['getMustacheRender'](_0x46fe67,this);return rpc[_0x2b1da9+_0xd388('0x1e')][_0xd388('0x1f')](_0x4b3189)[_0xd388('0x20')](function(_0x2a6d4e){logger[_0xd388('0xd')](_0xd388('0xe'),_0x3f9f22,_0x4b3189[_0xd388('0x1d')]);})['catch'](function(_0x2b84a9){logger[_0xd388('0x21')](_0xd388('0xe'),_0x3f9f22,JSON[_0xd388('0x22')](_0x2b84a9));})[_0xd388('0x23')](function(){logger[_0xd388('0xd')](_0xd388('0x24'),_0x3f9f22);_0x42d3e4['stop']();});}else{logger[_0xd388('0xd')](_0xd388('0x25'),_0x3f9f22);_0x42d3e4[_0xd388('0x26')]();}}else{var _0x302de5=this;var _0x3841e1=new AWS[(_0xd388('0x27'))]({'accessKeyId':_0x3e7e57[0x0],'secretAccessKey':_0x3e7e57[0x1],'region':_0x3e7e57[0x2]});var _0x1a1d87={'botAlias':'$LATEST','botName':_0x3e7e57[0x3],'inputText':this[_0xd388('0x28')][_0xd388('0x1d')],'userId':this[_0xd388('0x14')]+':'+this[_0xd388('0x18')]['id'][_0xd388('0x29')]()};_0x3841e1[_0xd388('0x2a')](_0x1a1d87,function(_0x5533e4,_0x39b953){if(_0x5533e4){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3f9f22,_0x5533e4[_0xd388('0x28')]);_0x42d3e4[_0xd388('0xf')]();}else if(_0x39b953&&_0x39b953['message']){_0x302de5[_0xd388('0x1d')]['amazonlex']=_0x39b953;_0x4b3189[_0xd388('0x1d')]=_0x39b953[_0xd388('0x28')];_0x4b3189['providerName']=_0xd388('0x2b');_0x4b3189[_0xd388('0x2c')]=JSON[_0xd388('0x22')](_0x39b953);return rpc[_0x2b1da9+_0xd388('0x1e')]['create'](_0x4b3189)[_0xd388('0x20')](function(_0x19682b){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3f9f22,_0x4b3189[_0xd388('0x1d')]);if(_0x39b953[_0xd388('0x2d')]=='Failed'){_0x42d3e4[_0xd388('0xf')]();}else{_0x42d3e4[_0xd388('0x26')]();}})[_0xd388('0x2e')](function(_0x1fd9b4){logger['error'](_0xd388('0xe'),_0x3f9f22,JSON[_0xd388('0x22')](_0x1fd9b4));_0x42d3e4[_0xd388('0xf')]();});}else{_0x42d3e4[_0xd388('0xf')]();}});}}catch(_0x4b957f){logger['error'](_0xd388('0xe'),_0x3f9f22,JSON[_0xd388('0x22')](_0x4b957f));_0x42d3e4[_0xd388('0x26')]();}};}; \ 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 35154e9..5d9c9e0 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 _0xb15d=['auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../mailRpc','consequence','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','mail','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','html','','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'),'','replace','','headers','auto-replied','All','sendMailMessage','smtpOptions','then','messageId','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x495c,0x147));var _0xc495=function(_0x50be3c,_0x529b7c){_0x50be3c=_0x50be3c-0x0;var _0x337e14=_0x495c[_0x50be3c];return _0x337e14;};'use strict';var _=require(_0xc495('0x0'));var moment=require(_0xc495('0x1'));var utils=require(_0xc495('0x2'));var logger=require('../../../../config/logger')(_0xc495('0x3'));var rpc={'chatMessage':require(_0xc495('0x4')),'openchannelMessage':require(_0xc495('0x5')),'mailMessage':require(_0xc495('0x6')),'smsMessage':require(_0xc495('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc495('0x8')),'chatInteraction':require(_0xc495('0x9')),'openchannelInteraction':require(_0xc495('0xa')),'mailInteraction':require(_0xc495('0xb')),'smsInteraction':require(_0xc495('0xc')),'faxInteraction':require(_0xc495('0xd')),'whatsappInteraction':require(_0xc495('0xe'))};var mailRpc=require(_0xc495('0xf'));exports[_0xc495('0x10')]=function(_0x358fc0,_0x41d9b1,_0x439331,_0x334856){return function(_0x2a423d){try{var _0x16dc71=this[_0xc495('0x11')];if(_0x16dc71===_0xc495('0x12')&&_0x334856[_0xc495('0x13')][_0xc495('0x14')]){logger['info'](_0xc495('0x15'),_0x358fc0,_0xc495('0x16'));return _0x2a423d[_0xc495('0x17')]();}if(_0x41d9b1[0x0]==='1'&&(_[_0xc495('0x18')](this[_0xc495('0x19')]['created'])||!this[_0xc495('0x19')][_0xc495('0x1a')])){logger[_0xc495('0x1b')]('[%s][AUTOREPLY]\x20%s',_0x358fc0,'Autoreply\x20already\x20sent');return _0x2a423d[_0xc495('0x17')]();}if(_0x41d9b1[0x0]==='2'&&this[_0xc495('0x19')][_0xc495('0x1c')]){logger[_0xc495('0x1b')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x358fc0,'One\x20Time\x20already\x20sent');return _0x2a423d[_0xc495('0x17')]();}var _0x10488d={'ContactId':this[_0xc495('0x1d')]['id'],'sentAt':moment()[_0xc495('0x1e')](_0xc495('0x1f')),'direction':_0xc495('0x20')};if(this['channel']===_0xc495('0x12')){_0x10488d[_0xc495('0x13')]=utils[_0xc495('0x21')](_0x41d9b1[0x2],this);}else{_0x10488d['body']=utils[_0xc495('0x21')](_0x41d9b1[0x1],this);}if(this[_0xc495('0x22')]){_0x10488d['to']=this[_0xc495('0x22')][_0xc495('0x23')]||'';if(this[_0xc495('0x11')]===_0xc495('0x12')&&_0x41d9b1[0x1]==='1'){_0x10488d['cc']=this['message']['cc']||'';}_0x10488d[_0xc495('0x23')]=this[_0xc495('0x22')]['to']||'';_0x10488d[_0xc495('0x24')]=this['message']['phone']||'';_0x10488d['read']=!![];if(this['message'][_0xc495('0x25')]){_0x10488d[_0xc495('0x25')]='';_0x10488d[_0xc495('0x25')]+=_['startsWith'](this[_0xc495('0x22')][_0xc495('0x25')],_0xc495('0x26'))?'':'Re:\x20';_0x10488d[_0xc495('0x25')]+=this[_0xc495('0x22')][_0xc495('0x25')];}}if(this[_0xc495('0x11')]===_0xc495('0x27')){_0x10488d[_0xc495('0x28')]=this['account']['id'];}else{_0x10488d[_[_0xc495('0x29')](this[_0xc495('0x11')])+_0xc495('0x2a')]=this[_0xc495('0x2b')]['id'];}_0x10488d[_['upperFirst'](this[_0xc495('0x11')])+_0xc495('0x2c')]=this[_0xc495('0x19')]['id'];var _0x11be08=this[_0xc495('0x19')];if(rpc[this[_0xc495('0x11')]+'Message']){if(this[_0xc495('0x11')]==='mail'){_0x10488d['inReplyTo']=this[_0xc495('0x22')]['messageId'];_0x10488d[_0xc495('0x2d')]=_0xc495('0x2e')+_[_0xc495('0x2f')](_0x10488d[_0xc495('0x13')],_0xc495('0x30'),_0xc495('0x31'))+_0xc495('0x32');_0x10488d[_0xc495('0x33')]={'Auto-Submitted':_0xc495('0x34'),'X-Auto-Response-Suppress':_0xc495('0x35'),'Precedence':'auto_reply'};return mailRpc[_0xc495('0x36')](this[_0xc495('0x2b')][_0xc495('0x37')],_0x10488d)[_0xc495('0x38')](function(_0x3fe511){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x358fc0);_0x10488d[_0xc495('0x39')]=_0x3fe511['message']['messageId'];return rpc[_0x16dc71+_0xc495('0x3a')][_0xc495('0x3b')](_0x10488d);})['then'](function(_0x157ddf){logger[_0xc495('0x1b')]('[%s][AUTOREPLY]\x20%s',_0x358fc0,JSON[_0xc495('0x3c')](_0x157ddf));})[_0xc495('0x3d')](function(_0xd01ddb){logger[_0xc495('0x3e')](_0xc495('0x3f'),_0x358fc0,JSON[_0xc495('0x3c')](_0xd01ddb));})[_0xc495('0x40')](function(){Promise[_0xc495('0x41')]()[_0xc495('0x38')](function(){if(_0x41d9b1[0x0]!=='2'||_0x11be08[_0xc495('0x1c')])return;return rpc[_0x16dc71+_0xc495('0x42')]['update'](_0x11be08['id'],{'autoreplyExecuted':!![]})[_0xc495('0x38')](function(_0x1d7047){logger[_0xc495('0x1b')](_0xc495('0x43'),_0x358fc0,JSON[_0xc495('0x3c')](_0x1d7047));})[_0xc495('0x3d')](function(_0x4e625a){logger[_0xc495('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x358fc0,JSON[_0xc495('0x3c')](_0x4e625a));});})[_0xc495('0x38')](function(){_0x2a423d[_0xc495('0x17')]();});});}else{return rpc[this['channel']+_0xc495('0x3a')][_0xc495('0x3b')](_0x10488d)[_0xc495('0x38')](function(){logger['info'](_0xc495('0x15'),_0x358fc0,_0x10488d[_0xc495('0x13')]);})[_0xc495('0x3d')](function(_0x14caeb){logger['error'](_0xc495('0x15'),_0x358fc0,JSON['stringify'](_0x14caeb));})['finally'](function(){Promise[_0xc495('0x41')]()[_0xc495('0x38')](function(){if(_0x41d9b1[0x0]!=='2'||_0x11be08['autoreplyExecuted'])return;return rpc[_0x16dc71+_0xc495('0x42')][_0xc495('0x44')](_0x11be08['id'],{'autoreplyExecuted':!![]})[_0xc495('0x38')](function(_0x6e10b1){logger[_0xc495('0x1b')](_0xc495('0x43'),_0x358fc0,JSON[_0xc495('0x3c')](_0x6e10b1));})['catch'](function(_0x1d894b){logger[_0xc495('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x358fc0,JSON['stringify'](_0x1d894b));});})['then'](function(){_0x2a423d['next']();});});}}}catch(_0x27975e){logger[_0xc495('0x3e')](_0xc495('0x15'),_0x358fc0,JSON[_0xc495('0x3c')](_0x27975e));_0x2a423d[_0xc495('0x45')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 45602ba..3b80594 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd091=['then','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction'];(function(_0x4374b8,_0x444622){var _0x591492=function(_0x232d9b){while(--_0x232d9b){_0x4374b8['push'](_0x4374b8['shift']());}};_0x591492(++_0x444622);}(_0xd091,0x13b));var _0x1d09=function(_0x10a649,_0x2df15f){_0x10a649=_0x10a649-0x0;var _0x11a95f=_0xd091[_0x10a649];return _0x11a95f;};'use strict';var moment=require('moment');var logger=require(_0x1d09('0x0'))(_0x1d09('0x1'));var rpc={'chatInteraction':require(_0x1d09('0x2')),'openchannelInteraction':require(_0x1d09('0x3')),'smsInteraction':require(_0x1d09('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1d09('0x5')),'whatsappInteraction':require(_0x1d09('0x6'))};exports['consequence']=function(_0x4d25e3,_0xb5b302,_0x3be941,_0x4535e4){return function(_0x4b2d5b){try{logger[_0x1d09('0x7')](_0x1d09('0x8'),_0x4d25e3,_0xb5b302[0x0]);var _0x4c0d20={'closed':0x1,'closedAt':moment()['format'](_0x1d09('0x9')),'closeReason':_0x1d09('0xa'),'disposition':_0xb5b302[0x0]};if(rpc[_0x4535e4['channel']+_0x1d09('0xb')]){rpc[_0x4535e4[_0x1d09('0xc')]+_0x1d09('0xb')][_0x1d09('0xd')](_0x4535e4[_0x1d09('0xe')]['id'],_0x4c0d20)[_0x1d09('0xf')](function(_0xd906f1){logger[_0x1d09('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4d25e3,_0x4535e4[_0x1d09('0xe')]['id']);})[_0x1d09('0x10')](function(_0x2294b7){logger[_0x1d09('0x11')](_0x1d09('0x12'),_0x4d25e3,JSON['stringify'](_0x2294b7));})[_0x1d09('0x13')](function(){_0x4b2d5b[_0x1d09('0x14')]();});}}catch(_0x347ae0){logger[_0x1d09('0x11')](_0x1d09('0x12'),_0x4d25e3,JSON[_0x1d09('0x15')](_0x347ae0));_0x4b2d5b['stop']();}};}; \ No newline at end of file +var _0x03e5=['interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','finally','stop','error','[%s][CLOSE]\x20%s','moment','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x03e5,0x159));var _0x503e=function(_0x4783c4,_0x2fb5ee){_0x4783c4=_0x4783c4-0x0;var _0x1f4af1=_0x03e5[_0x4783c4];return _0x1f4af1;};'use strict';var moment=require(_0x503e('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x503e('0x1')),'openchannelInteraction':require(_0x503e('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x503e('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x503e('0x4'))};exports['consequence']=function(_0x15a00a,_0x91ed70,_0x4bb46e,_0x28ad59){return function(_0x49e6c1){try{logger[_0x503e('0x5')](_0x503e('0x6'),_0x15a00a,_0x91ed70[0x0]);var _0x1b0410={'closed':0x1,'closedAt':moment()[_0x503e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x503e('0x8'),'disposition':_0x91ed70[0x0]};if(rpc[_0x28ad59[_0x503e('0x9')]+_0x503e('0xa')]){rpc[_0x28ad59[_0x503e('0x9')]+'Interaction'][_0x503e('0xb')](_0x28ad59[_0x503e('0xc')]['id'],_0x1b0410)[_0x503e('0xd')](function(_0x49aa50){logger[_0x503e('0x5')](_0x503e('0xe'),_0x15a00a,_0x28ad59[_0x503e('0xc')]['id']);})[_0x503e('0xf')](function(_0x428de9){logger['error']('[%s][CLOSE]\x20%s',_0x15a00a,JSON[_0x503e('0x10')](_0x428de9));})[_0x503e('0x11')](function(){_0x49e6c1[_0x503e('0x12')]();});}}catch(_0x3656eb){logger[_0x503e('0x13')](_0x503e('0x14'),_0x15a00a,JSON[_0x503e('0x10')](_0x3656eb));_0x49e6c1[_0x503e('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 2df41e2..8ed8e0a 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7ee=['catch','next','lodash','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','then','body','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','dialogflow','result','fulfillment','speech','providerResponse','create','[%s][DIALOGFLOW]\x20%s','metadata','endConversation'];(function(_0x31ba95,_0x3dcb4c){var _0x1be31f=function(_0x2da12a){while(--_0x2da12a){_0x31ba95['push'](_0x31ba95['shift']());}};_0x1be31f(++_0x3dcb4c);}(_0xa7ee,0x159));var _0xea7e=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xa7ee[_0x2f57b2];return _0x5ace77;};'use strict';var _=require(_0xea7e('0x0'));var moment=require('moment');var apiai=require(_0xea7e('0x1'));var md5=require(_0xea7e('0x2'));var utils=require(_0xea7e('0x3'));var logger=require(_0xea7e('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xea7e('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xea7e('0x6')),'faxMessage':require(_0xea7e('0x7')),'whatsappMessage':require(_0xea7e('0x8'))};exports[_0xea7e('0x9')]=function(_0x511e20,_0x438119){return function(_0x188ce8){try{if(!_[_0xea7e('0xa')](this[_0xea7e('0xb')][_0xea7e('0xc')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x511e20,_0xea7e('0xd'));return _0x188ce8['next']();}var _0xb52b7e={'ContactId':this[_0xea7e('0xe')]['id'],'sentAt':moment()[_0xea7e('0xf')](_0xea7e('0x10')),'direction':'out'};if(this[_0xea7e('0x11')]==='sms'||this[_0xea7e('0x11')]===_0xea7e('0x12')){_0xb52b7e[_0xea7e('0x13')]=this[_0xea7e('0xb')][_0xea7e('0x13')];}var _0x176e7f=this[_0xea7e('0x11')];if(_0x176e7f===_0xea7e('0x14')){_0xb52b7e['ChatWebsiteId']=this[_0xea7e('0x15')]['id'];}else{_0xb52b7e[_[_0xea7e('0x16')](_0x176e7f)+_0xea7e('0x17')]=this[_0xea7e('0x15')]['id'];}_0xb52b7e[_['upperFirst'](_0x176e7f)+_0xea7e('0x18')]=this['interaction']['id'];if(this['interaction'][_0xea7e('0x19')]){var _0x2d5794=_0x438119[0x2];if(!_[_0xea7e('0x1a')](_0x2d5794)){_0xb52b7e['body']=utils['getMustacheRender'](_0x2d5794,this);return rpc[_0x176e7f+_0xea7e('0x1b')]['create'](_0xb52b7e)[_0xea7e('0x1c')](function(_0x125aec){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x511e20,_0xb52b7e[_0xea7e('0x1d')]);})['catch'](function(_0x482bfb){logger[_0xea7e('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x511e20,JSON[_0xea7e('0x1f')](_0x482bfb));})[_0xea7e('0x20')](function(){logger['info'](_0xea7e('0x21'),_0x511e20);_0x188ce8['stop']();});}else{logger[_0xea7e('0x22')](_0xea7e('0x23'),_0x511e20);_0x188ce8[_0xea7e('0x24')]();}}else{var _0xd441f8=this;var _0x372b9d=apiai(_0x438119[0x0],{'language':_0x438119[0x1]||'en'});return _0x372b9d[_0xea7e('0x25')](this['message'][_0xea7e('0x1d')],{'sessionId':md5(this[_0xea7e('0xb')]['id'])})['then'](function(_0xb8149f){_0xd441f8[_0xea7e('0x1d')][_0xea7e('0x26')]=_0xb8149f;_0xb52b7e['body']=_0xb8149f[_0xea7e('0x27')][_0xea7e('0x28')][_0xea7e('0x29')];_0xb52b7e['providerName']=_0xea7e('0x26');_0xb52b7e[_0xea7e('0x2a')]=JSON[_0xea7e('0x1f')](_0xb8149f);return rpc[_0x176e7f+_0xea7e('0x1b')][_0xea7e('0x2b')](_0xb52b7e)[_0xea7e('0x1c')](function(_0x31871e){logger[_0xea7e('0x22')](_0xea7e('0x2c'),_0x511e20,_0xb52b7e[_0xea7e('0x1d')]);if(_0xb8149f['result'][_0xea7e('0x2d')][_0xea7e('0x2e')]){_0x188ce8['next']();}else{_0x188ce8[_0xea7e('0x24')]();}})[_0xea7e('0x2f')](function(_0x1951c0){logger[_0xea7e('0x1e')](_0xea7e('0x2c'),_0x511e20,JSON['stringify'](_0x1951c0));_0x188ce8[_0xea7e('0x30')]();});})[_0xea7e('0x2f')](function(_0x596514){logger[_0xea7e('0x1e')](_0xea7e('0x2c'),_0x511e20,_0x596514['message']);_0x188ce8[_0xea7e('0x30')]();});}}catch(_0x5c12d6){logger[_0xea7e('0x1e')](_0xea7e('0x2c'),_0x511e20,JSON[_0xea7e('0x1f')](_0x5c12d6));_0x188ce8[_0xea7e('0x24')]();}};}; \ No newline at end of file +var _0x87d3=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','created','isEmpty','body','getMustacheRender','Message','then','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','providerResponse','create','result','metadata','endConversation','catch','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0xe8f4d7,_0x22d9ad){var _0x5f36d8=function(_0x1117b7){while(--_0x1117b7){_0xe8f4d7['push'](_0xe8f4d7['shift']());}};_0x5f36d8(++_0x22d9ad);}(_0x87d3,0x86));var _0x387d=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x87d3[_0x5786f9];return _0x22c3cf;};'use strict';var _=require(_0x387d('0x0'));var moment=require(_0x387d('0x1'));var apiai=require(_0x387d('0x2'));var md5=require(_0x387d('0x3'));var utils=require(_0x387d('0x4'));var logger=require(_0x387d('0x5'))('routing');var rpc={'chatMessage':require(_0x387d('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x387d('0x7')),'smsMessage':require(_0x387d('0x8')),'faxMessage':require(_0x387d('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x387d('0xa')]=function(_0x265532,_0x3b1d5b){return function(_0x689c51){try{if(!_[_0x387d('0xb')](this[_0x387d('0xc')][_0x387d('0xd')])){logger[_0x387d('0xe')](_0x387d('0xf'),_0x265532,_0x387d('0x10'));return _0x689c51[_0x387d('0x11')]();}var _0x588ef4={'ContactId':this[_0x387d('0x12')]['id'],'sentAt':moment()[_0x387d('0x13')](_0x387d('0x14')),'direction':_0x387d('0x15')};if(this[_0x387d('0x16')]===_0x387d('0x17')||this[_0x387d('0x16')]===_0x387d('0x18')){_0x588ef4[_0x387d('0x19')]=this[_0x387d('0xc')][_0x387d('0x19')];}var _0x207f47=this[_0x387d('0x16')];if(_0x207f47===_0x387d('0x1a')){_0x588ef4[_0x387d('0x1b')]=this['account']['id'];}else{_0x588ef4[_['upperFirst'](_0x207f47)+_0x387d('0x1c')]=this['account']['id'];}_0x588ef4[_['upperFirst'](_0x207f47)+'InteractionId']=this[_0x387d('0xc')]['id'];if(this[_0x387d('0xc')][_0x387d('0x1d')]){var _0x2998e9=_0x3b1d5b[0x2];if(!_[_0x387d('0x1e')](_0x2998e9)){_0x588ef4[_0x387d('0x1f')]=utils[_0x387d('0x20')](_0x2998e9,this);return rpc[_0x207f47+_0x387d('0x21')]['create'](_0x588ef4)[_0x387d('0x22')](function(_0xa50585){logger[_0x387d('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x265532,_0x588ef4[_0x387d('0x1f')]);})['catch'](function(_0x476c69){logger['error'](_0x387d('0xf'),_0x265532,JSON[_0x387d('0x23')](_0x476c69));})[_0x387d('0x24')](function(){logger[_0x387d('0xe')](_0x387d('0x25'),_0x265532);_0x689c51['stop']();});}else{logger['info'](_0x387d('0x26'),_0x265532);_0x689c51[_0x387d('0x27')]();}}else{var _0x2f2827=this;var _0x580a6e=apiai(_0x3b1d5b[0x0],{'language':_0x3b1d5b[0x1]||'en'});return _0x580a6e[_0x387d('0x28')](this[_0x387d('0x29')][_0x387d('0x1f')],{'sessionId':md5(this[_0x387d('0xc')]['id'])})[_0x387d('0x22')](function(_0x5569db){_0x2f2827['body']['dialogflow']=_0x5569db;_0x588ef4[_0x387d('0x1f')]=_0x5569db['result']['fulfillment']['speech'];_0x588ef4['providerName']=_0x387d('0x2a');_0x588ef4[_0x387d('0x2b')]=JSON[_0x387d('0x23')](_0x5569db);return rpc[_0x207f47+_0x387d('0x21')][_0x387d('0x2c')](_0x588ef4)[_0x387d('0x22')](function(_0x1d3f3a){logger[_0x387d('0xe')](_0x387d('0xf'),_0x265532,_0x588ef4[_0x387d('0x1f')]);if(_0x5569db[_0x387d('0x2d')][_0x387d('0x2e')][_0x387d('0x2f')]){_0x689c51[_0x387d('0x11')]();}else{_0x689c51[_0x387d('0x27')]();}})[_0x387d('0x30')](function(_0x5da92e){logger[_0x387d('0x31')](_0x387d('0xf'),_0x265532,JSON[_0x387d('0x23')](_0x5da92e));_0x689c51['next']();});})[_0x387d('0x30')](function(_0x452a11){logger[_0x387d('0x31')](_0x387d('0xf'),_0x265532,_0x452a11[_0x387d('0x29')]);_0x689c51['next']();});}}catch(_0xd3fecf){logger[_0x387d('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x265532,JSON['stringify'](_0xd3fecf));_0x689c51[_0x387d('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2113e98..d5727db 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcb0=['SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','next','stack','dialogflow','md5','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xfcb0,0x11f));var _0x0fcb=function(_0x2aa66c,_0x3713fa){_0x2aa66c=_0x2aa66c-0x0;var _0x275168=_0xfcb0[_0x2aa66c];return _0x275168;};'use strict';var _=require('lodash');var dialogflow=require(_0x0fcb('0x0'));var md5=require(_0x0fcb('0x1'));var moment=require('moment');var Promise=require(_0x0fcb('0x2'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x0fcb('0x3'));var rpc={'chatMessage':require(_0x0fcb('0x4')),'openchannelMessage':require(_0x0fcb('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0fcb('0x6')),'faxMessage':require(_0x0fcb('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x29af8e,_0x4a7981,_0x435ac4,_0x45e774){return new Promise(function(_0x2163b7,_0x4ac82f){var _0x2080b9=_['clone'](_0x435ac4);_0x2080b9['body']=_0x45e774;return rpc[_0x4a7981+_0x0fcb('0x8')][_0x0fcb('0x9')](_0x2080b9)[_0x0fcb('0xa')](function(){logger[_0x0fcb('0xb')](_0x0fcb('0xc'),_0x29af8e,_0x2080b9['body']);_0x2163b7();})['catch'](function(_0x440f94){logger[_0x0fcb('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x29af8e,JSON[_0x0fcb('0xe')](_0x440f94));_0x4ac82f(_0x440f94);});});}exports[_0x0fcb('0xf')]=function(_0x2f0e55,_0x1b0e30){return function(_0x3895e5){try{if(!_['isNil'](this[_0x0fcb('0x10')]['UserId'])){logger[_0x0fcb('0xb')](_0x0fcb('0xc'),_0x2f0e55,_0x0fcb('0x11'));return _0x3895e5['next']();}var _0x36141f={'ContactId':this[_0x0fcb('0x12')]['id'],'sentAt':moment()[_0x0fcb('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x0fcb('0x14')]===_0x0fcb('0x15')||this[_0x0fcb('0x14')]===_0x0fcb('0x16')){_0x36141f['phone']=this[_0x0fcb('0x10')][_0x0fcb('0x17')];}var _0x4f57d7=this[_0x0fcb('0x14')];if(_0x4f57d7==='chat'){_0x36141f[_0x0fcb('0x18')]=this[_0x0fcb('0x19')]['id'];}else{_0x36141f[_[_0x0fcb('0x1a')](_0x4f57d7)+_0x0fcb('0x1b')]=this[_0x0fcb('0x19')]['id'];}_0x36141f[_['upperFirst'](_0x4f57d7)+_0x0fcb('0x1c')]=this['interaction']['id'];if(this[_0x0fcb('0x10')][_0x0fcb('0x1d')]){var _0x85ce97=_0x1b0e30[0x4];if(!_[_0x0fcb('0x1e')](_0x85ce97)){_0x36141f[_0x0fcb('0x1f')]=utils[_0x0fcb('0x20')](_0x85ce97,this);return rpc[_0x4f57d7+'Message']['create'](_0x36141f)[_0x0fcb('0xa')](function(_0x4bce5e){logger['info'](_0x0fcb('0xc'),_0x2f0e55,_0x36141f[_0x0fcb('0x1f')]);})[_0x0fcb('0x21')](function(_0x3aad00){logger[_0x0fcb('0xd')](_0x0fcb('0xc'),_0x2f0e55,JSON[_0x0fcb('0xe')](_0x3aad00));})[_0x0fcb('0x22')](function(){logger['info'](_0x0fcb('0x23'),_0x2f0e55);_0x3895e5[_0x0fcb('0x24')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2f0e55);_0x3895e5[_0x0fcb('0x24')]();}}else{var _0x7a81c0=this;var _0x364b02=_0x1b0e30[0x2][_0x0fcb('0x25')](/\\n/g,'\x0a');var _0x1baf87={'credentials':{'private_key':_0x364b02,'client_email':_0x1b0e30[0x1]}};var _0x1ce901=new dialogflow[(_0x0fcb('0x26'))](_0x1baf87);var _0x2dd2f5=_0x1ce901[_0x0fcb('0x27')](_0x1b0e30[0x0],md5(_0x7a81c0[_0x0fcb('0x10')]['id']));var _0x3a1902={'session':_0x2dd2f5,'queryInput':{'text':{'text':_0x7a81c0[_0x0fcb('0x28')][_0x0fcb('0x1f')],'languageCode':_0x1b0e30[0x3]||'en'}}};return _0x1ce901[_0x0fcb('0x29')](_0x3a1902)['then'](function(_0x4a9d8b){if(_0x4a9d8b&&_0x4a9d8b[_0x0fcb('0x2a')]){_0x7a81c0[_0x0fcb('0x1f')]['dialogflowV2']=_0x4a9d8b;var _0x245bc4=_0x4a9d8b[0x0];var _0x3926b4=_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x2c')]&&_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x2c')][_0x0fcb('0x2d')]?_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x2c')][_0x0fcb('0x2d')]['end_conversation']['boolValue']:![];_0x7a81c0[_0x0fcb('0x1f')]['DIALOGFLOWV2_ACTION']=_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x2e')];_0x7a81c0[_0x0fcb('0x1f')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x2f')];_0x7a81c0[_0x0fcb('0x1f')][_0x0fcb('0x30')]=_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x2c')]&&_0x245bc4[_0x0fcb('0x2b')]['diagnosticInfo']['fields']?_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x2c')][_0x0fcb('0x2d')][_0x0fcb('0x31')][_0x0fcb('0x32')]:![];_0x7a81c0[_0x0fcb('0x1f')][_0x0fcb('0x33')]=_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x34')][_0x0fcb('0x35')];_0x7a81c0[_0x0fcb('0x1f')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x245bc4['queryResult'][_0x0fcb('0x34')][_0x0fcb('0x36')];_0x7a81c0[_0x0fcb('0x1f')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x245bc4[_0x0fcb('0x2b')]['intent']['isFallback'];_0x7a81c0['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x245bc4[_0x0fcb('0x2b')]['languageCode'];_0x7a81c0[_0x0fcb('0x1f')][_0x0fcb('0x37')]=_0x245bc4[_0x0fcb('0x2b')]['queryText'];_0x7a81c0[_0x0fcb('0x1f')][_0x0fcb('0x38')]=_0x245bc4[_0x0fcb('0x2b')][_0x0fcb('0x39')];_0x36141f[_0x0fcb('0x3a')]='dialogflowV2';_0x36141f[_0x0fcb('0x3b')]=JSON[_0x0fcb('0xe')](_0x4a9d8b);var _0x4afbb4=[];for(var _0x2c043b=0x0;_0x2c043b<_0x4a9d8b[_0x0fcb('0x2a')];_0x2c043b++){var _0x25a06e=_0x4a9d8b[_0x2c043b];if(_0x25a06e&&_0x25a06e[_0x0fcb('0x2b')]&&_0x25a06e[_0x0fcb('0x2b')][_0x0fcb('0x3c')]){_0x4afbb4[_0x0fcb('0x3d')](createMessage(_0x2f0e55,_0x4f57d7,_0x36141f,_0x25a06e[_0x0fcb('0x2b')]['fulfillmentText']));}}return Promise[_0x0fcb('0x3e')](_0x4afbb4)['then'](function(){if(_0x3926b4){_0x3895e5['next']();}else{_0x3895e5[_0x0fcb('0x24')]();}})['catch'](function(_0x2b5e18){logger[_0x0fcb('0xd')](_0x0fcb('0xc'),_0x2f0e55,JSON[_0x0fcb('0xe')](_0x2b5e18));_0x3895e5[_0x0fcb('0x3f')]();});}})[_0x0fcb('0x21')](function(_0x3f78fc){logger[_0x0fcb('0xd')](_0x0fcb('0xc'),_0x2f0e55,_0x3f78fc[_0x0fcb('0x28')],_0x3f78fc[_0x0fcb('0x40')]);_0x3895e5['next']();});}}catch(_0x2255c1){logger[_0x0fcb('0xd')](_0x0fcb('0xc'),_0x2f0e55,JSON[_0x0fcb('0xe')](_0x2255c1));_0x3895e5['stop']();}};}; \ No newline at end of file +var _0x51a3=['create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','out','channel','phone','chat','ChatWebsiteId','upperFirst','InteractionId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','all','next','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message'];(function(_0x3d0821,_0x17dff6){var _0x3e61a9=function(_0x1cfdb1){while(--_0x1cfdb1){_0x3d0821['push'](_0x3d0821['shift']());}};_0x3e61a9(++_0x17dff6);}(_0x51a3,0x1a5));var _0x351a=function(_0x26445d,_0x4a66f2){_0x26445d=_0x26445d-0x0;var _0x4395f0=_0x51a3[_0x26445d];return _0x4395f0;};'use strict';var _=require(_0x351a('0x0'));var dialogflow=require(_0x351a('0x1'));var md5=require(_0x351a('0x2'));var moment=require(_0x351a('0x3'));var Promise=require(_0x351a('0x4'));var logger=require(_0x351a('0x5'))(_0x351a('0x6'));var utils=require(_0x351a('0x7'));var rpc={'chatMessage':require(_0x351a('0x8')),'openchannelMessage':require(_0x351a('0x9')),'mailMessage':require(_0x351a('0xa')),'smsMessage':require(_0x351a('0xb')),'faxMessage':require(_0x351a('0xc')),'whatsappMessage':require(_0x351a('0xd'))};function createMessage(_0x1ceac2,_0x446aec,_0x54beed,_0x1b78f3){return new Promise(function(_0x643217,_0x2c54fb){var _0x586bb3=_[_0x351a('0xe')](_0x54beed);_0x586bb3[_0x351a('0xf')]=_0x1b78f3;return rpc[_0x446aec+_0x351a('0x10')][_0x351a('0x11')](_0x586bb3)[_0x351a('0x12')](function(){logger[_0x351a('0x13')](_0x351a('0x14'),_0x1ceac2,_0x586bb3['body']);_0x643217();})[_0x351a('0x15')](function(_0x19ec7c){logger[_0x351a('0x16')](_0x351a('0x14'),_0x1ceac2,JSON[_0x351a('0x17')](_0x19ec7c));_0x2c54fb(_0x19ec7c);});});}exports[_0x351a('0x18')]=function(_0x51bb3a,_0x488e8e){return function(_0x2294f1){try{if(!_[_0x351a('0x19')](this[_0x351a('0x1a')][_0x351a('0x1b')])){logger[_0x351a('0x13')](_0x351a('0x14'),_0x51bb3a,_0x351a('0x1c'));return _0x2294f1['next']();}var _0x583088={'ContactId':this['contact']['id'],'sentAt':moment()[_0x351a('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x351a('0x1e')};if(this[_0x351a('0x1f')]==='sms'||this[_0x351a('0x1f')]==='whatsapp'){_0x583088[_0x351a('0x20')]=this[_0x351a('0x1a')][_0x351a('0x20')];}var _0x36000e=this[_0x351a('0x1f')];if(_0x36000e===_0x351a('0x21')){_0x583088[_0x351a('0x22')]=this['account']['id'];}else{_0x583088[_[_0x351a('0x23')](_0x36000e)+'AccountId']=this['account']['id'];}_0x583088[_[_0x351a('0x23')](_0x36000e)+_0x351a('0x24')]=this[_0x351a('0x1a')]['id'];if(this[_0x351a('0x1a')][_0x351a('0x25')]){var _0x2c98c4=_0x488e8e[0x4];if(!_[_0x351a('0x26')](_0x2c98c4)){_0x583088['body']=utils['getMustacheRender'](_0x2c98c4,this);return rpc[_0x36000e+'Message'][_0x351a('0x11')](_0x583088)[_0x351a('0x12')](function(_0x46f73f){logger[_0x351a('0x13')](_0x351a('0x14'),_0x51bb3a,_0x583088[_0x351a('0xf')]);})['catch'](function(_0x3aa9a3){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,JSON[_0x351a('0x17')](_0x3aa9a3));})[_0x351a('0x27')](function(){logger[_0x351a('0x13')](_0x351a('0x28'),_0x51bb3a);_0x2294f1[_0x351a('0x29')]();});}else{logger[_0x351a('0x13')](_0x351a('0x2a'),_0x51bb3a);_0x2294f1[_0x351a('0x29')]();}}else{var _0x2a73d1=this;var _0x389b6d=_0x488e8e[0x2][_0x351a('0x2b')](/\\n/g,'\x0a');var _0x446d9f={'credentials':{'private_key':_0x389b6d,'client_email':_0x488e8e[0x1]}};var _0x2acbee=new dialogflow[(_0x351a('0x2c'))](_0x446d9f);var _0x126490=_0x2acbee[_0x351a('0x2d')](_0x488e8e[0x0],md5(_0x2a73d1[_0x351a('0x1a')]['id']));var _0xfbb862={'session':_0x126490,'queryInput':{'text':{'text':_0x2a73d1[_0x351a('0x2e')][_0x351a('0xf')],'languageCode':_0x488e8e[0x3]||'en'}}};return _0x2acbee[_0x351a('0x2f')](_0xfbb862)[_0x351a('0x12')](function(_0x15b70e){if(_0x15b70e&&_0x15b70e[_0x351a('0x30')]){_0x2a73d1[_0x351a('0xf')]['dialogflowV2']=_0x15b70e;var _0x335b21=_0x15b70e[0x0];var _0x28b400=_0x335b21[_0x351a('0x31')][_0x351a('0x32')]&&_0x335b21['queryResult'][_0x351a('0x32')][_0x351a('0x33')]?_0x335b21['queryResult'][_0x351a('0x32')][_0x351a('0x33')][_0x351a('0x34')][_0x351a('0x35')]:![];_0x2a73d1[_0x351a('0xf')]['DIALOGFLOWV2_ACTION']=_0x335b21['queryResult'][_0x351a('0x36')];_0x2a73d1['body'][_0x351a('0x37')]=_0x335b21[_0x351a('0x31')][_0x351a('0x38')];_0x2a73d1[_0x351a('0xf')][_0x351a('0x39')]=_0x335b21[_0x351a('0x31')][_0x351a('0x32')]&&_0x335b21[_0x351a('0x31')][_0x351a('0x32')]['fields']?_0x335b21[_0x351a('0x31')]['diagnosticInfo'][_0x351a('0x33')][_0x351a('0x34')]['boolValue']:![];_0x2a73d1[_0x351a('0xf')][_0x351a('0x3a')]=_0x335b21['queryResult']['intent'][_0x351a('0x3b')];_0x2a73d1['body'][_0x351a('0x3c')]=_0x335b21['queryResult'][_0x351a('0x3d')]['displayName'];_0x2a73d1[_0x351a('0xf')][_0x351a('0x3e')]=_0x335b21[_0x351a('0x31')][_0x351a('0x3d')]['isFallback'];_0x2a73d1['body'][_0x351a('0x3f')]=_0x335b21['queryResult'][_0x351a('0x40')];_0x2a73d1[_0x351a('0xf')]['DIALOGFLOWV2_QUERYTEXT']=_0x335b21[_0x351a('0x31')][_0x351a('0x41')];_0x2a73d1['body']['DIALOGFLOWV2_SCORE']=_0x335b21[_0x351a('0x31')][_0x351a('0x42')];_0x583088['providerName']=_0x351a('0x43');_0x583088[_0x351a('0x44')]=JSON[_0x351a('0x17')](_0x15b70e);var _0x5d0e5c=[];for(var _0x41b156=0x0;_0x41b156<_0x15b70e['length'];_0x41b156++){var _0x1040dd=_0x15b70e[_0x41b156];if(_0x1040dd&&_0x1040dd[_0x351a('0x31')]&&_0x1040dd[_0x351a('0x31')][_0x351a('0x45')]){_0x5d0e5c['push'](createMessage(_0x51bb3a,_0x36000e,_0x583088,_0x1040dd[_0x351a('0x31')][_0x351a('0x45')]));}}return Promise[_0x351a('0x46')](_0x5d0e5c)['then'](function(){if(_0x28b400){_0x2294f1[_0x351a('0x47')]();}else{_0x2294f1['stop']();}})[_0x351a('0x15')](function(_0x521125){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,JSON[_0x351a('0x17')](_0x521125));_0x2294f1['next']();});}})['catch'](function(_0x1afc56){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,_0x1afc56[_0x351a('0x2e')],_0x1afc56[_0x351a('0x48')]);_0x2294f1[_0x351a('0x47')]();});}}catch(_0x1ccc61){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,JSON[_0x351a('0x17')](_0x1ccc61));_0x2294f1[_0x351a('0x29')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 58c1db7..3a38b61 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0xea8c=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error','map','join','stop','condition','priorityFalse','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string'];(function(_0x39867f,_0x5c1b6e){var _0x30fc37=function(_0x344549){while(--_0x344549){_0x39867f['push'](_0x39867f['shift']());}};_0x30fc37(++_0x5c1b6e);}(_0xea8c,0x172));var _0xcea8=function(_0x596d18,_0x369e8b){_0x596d18=_0x596d18-0x0;var _0x4b2238=_0xea8c[_0x596d18];return _0x4b2238;};'use strict';var schema=require(_0xcea8('0x0'));var _=require(_0xcea8('0x1'));var htmlToText=require(_0xcea8('0x2'));var utils=require(_0xcea8('0x3'));var logger=require(_0xcea8('0x4'))(_0xcea8('0x5'));var gotoif=schema({'condition':{'type':_0xcea8('0x6'),'required':!![],'message':_0xcea8('0x7')},'priorityTrue':{'type':_0xcea8('0x8'),'message':_0xcea8('0x9')},'priorityFalse':{'type':'number','message':_0xcea8('0xa')}});exports['consequence']=function(_0xfe0684,_0x502203){return function(_0x117cc6){try{var _0x78b9a6={'condition':htmlToText[_0xcea8('0xb')](utils['getMustacheRender'](_0x502203[0x0],this),{'wordwrap':![]})[_0xcea8('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x502203[0x1],'priorityFalse':_0x502203[0x2]};var _0x5d7441=gotoif[_0xcea8('0x0')](_0x78b9a6,{'typecast':!![]});if(_0x5d7441[_0xcea8('0xd')]){logger[_0xcea8('0xe')]('[%s][GOTOIF]\x20%s',_0xfe0684,_[_0xcea8('0xf')](_0x5d7441,'message')[_0xcea8('0x10')](',\x20'));_0x117cc6[_0xcea8('0x11')]();}else{try{var _0x2832ee=eval('('+_0x78b9a6[_0xcea8('0x12')]+')');var _0x38de9e=_0x2832ee?_0x78b9a6['priorityTrue']:_0x78b9a6[_0xcea8('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xfe0684,_0x78b9a6[_0xcea8('0x12')],_0x2832ee,_0x38de9e||_0xcea8('0x14'));if(_0x38de9e){var _0x28fdfc=_[_0xcea8('0x15')](_0x117cc6['rules'](),{'p':_0x38de9e});if(_0x28fdfc>=0x0){logger[_0xcea8('0x16')](_0xcea8('0x17'),_0xfe0684,_0x38de9e||_0xcea8('0x14'),_0x28fdfc);_0x117cc6['next'](_0x28fdfc);}else{logger[_0xcea8('0x16')](_0xcea8('0x18'),_0xfe0684,_0x38de9e||_0xcea8('0x14'));_0x117cc6[_0xcea8('0x11')]();}}else{_0x117cc6['next']();}}catch(_0x416911){logger[_0xcea8('0xe')](_0xcea8('0x19'),_0xfe0684,_0x416911[_0xcea8('0x1a')]);_0x117cc6[_0xcea8('0x11')]();}}}catch(_0x27c40a){logger[_0xcea8('0xe')](_0xcea8('0x1b'),_0xfe0684,JSON[_0xcea8('0x1c')](_0x27c40a));_0x117cc6['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 840d3ce..5e7acc4 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 _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 +var _0xa2da=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x18bac5,_0x2e54fc){var _0xdc6c44=function(_0x1d7a29){while(--_0x1d7a29){_0x18bac5['push'](_0x18bac5['shift']());}};_0xdc6c44(++_0x2e54fc);}(_0xa2da,0x17f));var _0xaa2d=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0xa2da[_0x578275];return _0xf78041;};'use strict';var schema=require(_0xaa2d('0x0'));var _=require(_0xaa2d('0x1'));var logger=require('../../../../config/logger')(_0xaa2d('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xaa2d('0x3')}});exports['consequence']=function(_0x236ea4,_0x53a430){return function(_0x5d7920){try{var _0x3f12d0={'priority':_0x53a430[0x0]};var _0x8f662a=gotop[_0xaa2d('0x0')](_0x3f12d0,{'typecast':!![]});if(_0x8f662a[_0xaa2d('0x4')]){logger['error'](_0xaa2d('0x5'),_0x236ea4,_[_0xaa2d('0x6')](_0x8f662a,_0xaa2d('0x7'))[_0xaa2d('0x8')](',\x20'));_0x5d7920['stop']();}else{logger[_0xaa2d('0x9')](_0xaa2d('0xa'),_0x236ea4,_0x3f12d0[_0xaa2d('0xb')]);if(_0x3f12d0[_0xaa2d('0xb')]){var _0x31dd12=_[_0xaa2d('0xc')](_0x5d7920[_0xaa2d('0xd')](),{'p':_0x3f12d0[_0xaa2d('0xb')]});if(_0x31dd12>=0x0){logger[_0xaa2d('0x9')](_0xaa2d('0xe'),_0x236ea4,_0x3f12d0[_0xaa2d('0xb')]||_0xaa2d('0xf'),_0x31dd12);_0x5d7920[_0xaa2d('0xf')](_0x31dd12);}else{logger[_0xaa2d('0x9')](_0xaa2d('0x10'),_0x236ea4,_0x3f12d0[_0xaa2d('0xb')]||_0xaa2d('0xf'));_0x5d7920['stop']();}}else{_0x5d7920[_0xaa2d('0xf')]();}}}catch(_0x40ba06){logger['error']('[%s][GOTOP]\x20%s',_0x236ea4,JSON[_0xaa2d('0x11')](_0x40ba06));_0x5d7920['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index c007997..afd7098 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 _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 +var _0x69e6=['info','next','error','[%s][MESSAGE]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then'];(function(_0xa81e24,_0x44e214){var _0xd95dbc=function(_0x3d5890){while(--_0x3d5890){_0xa81e24['push'](_0xa81e24['shift']());}};_0xd95dbc(++_0x44e214);}(_0x69e6,0x1e0));var _0x669e=function(_0xe1e5dc,_0x31d22f){_0xe1e5dc=_0xe1e5dc-0x0;var _0x1c1d67=_0x69e6[_0xe1e5dc];return _0x1c1d67;};'use strict';var _=require('lodash');var utils=require(_0x669e('0x0'));var logger=require(_0x669e('0x1'))(_0x669e('0x2'));var rpc={'chatMessage':require(_0x669e('0x3')),'openchannelMessage':require(_0x669e('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x669e('0x5')),'faxMessage':require(_0x669e('0x6')),'whatsappMessage':require(_0x669e('0x7'))};exports[_0x669e('0x8')]=function(_0x3258f7,_0x1be88f){return function(_0x28f1d9){try{var _0x132e5e={'body':utils[_0x669e('0x9')](_0x1be88f[0x0],this),'ContactId':this[_0x669e('0xa')]['id']};if(this[_0x669e('0xb')]===_0x669e('0xc')){_0x132e5e['ChatWebsiteId']=this[_0x669e('0xd')]['id'];}else{_0x132e5e[_[_0x669e('0xe')](this[_0x669e('0xb')])+'AccountId']=this['account']['id'];}_0x132e5e[_['upperFirst'](this[_0x669e('0xb')])+_0x669e('0xf')]=this[_0x669e('0x10')]['id'];if(rpc[this[_0x669e('0xb')]+_0x669e('0x11')]){return rpc[this['channel']+'Message'][_0x669e('0x12')](_0x132e5e)[_0x669e('0x13')](function(_0x344b70){logger[_0x669e('0x14')]('[%s][MESSAGE]\x20%s',_0x3258f7,_0x132e5e['body']);_0x28f1d9[_0x669e('0x15')]();})['catch'](function(_0x2e53db){logger[_0x669e('0x16')](_0x669e('0x17'),_0x3258f7,JSON['stringify'](_0x2e53db));_0x28f1d9[_0x669e('0x18')]();});}}catch(_0x255d4e){logger[_0x669e('0x16')](_0x669e('0x17'),_0x3258f7,JSON['stringify'](_0x255d4e));_0x28f1d9[_0x669e('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index e5aef2e..dee91bb 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 _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 +var _0xd8f7=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger'];(function(_0xac7226,_0x2c5ab9){var _0x20f7a2=function(_0x1df5c8){while(--_0x1df5c8){_0xac7226['push'](_0xac7226['shift']());}};_0x20f7a2(++_0x2c5ab9);}(_0xd8f7,0xc7));var _0x7d8f=function(_0x12b775,_0x2f9efb){_0x12b775=_0x12b775-0x0;var _0x3a6e60=_0xd8f7[_0x12b775];return _0x3a6e60;};'use strict';var utils=require('./utils');var logger=require(_0x7d8f('0x0'))(_0x7d8f('0x1'));exports['consequence']=function(_0x41aa96,_0x10068c){return function(_0x5ab60a){try{logger[_0x7d8f('0x2')](_0x7d8f('0x3'),_0x41aa96,utils[_0x7d8f('0x4')](_0x10068c[0x0],this));_0x5ab60a[_0x7d8f('0x5')]();}catch(_0x4ca6b4){logger[_0x7d8f('0x6')](_0x7d8f('0x3'),_0x41aa96,JSON[_0x7d8f('0x7')](_0x4ca6b4));_0x5ab60a['stop']();}};}; \ 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 d2a276a..b81814e 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 _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 +var _0x1be9=['message','chat','AccountId','account','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','waiting','info','[%s][STOP:QUEUE][NAME:%s]','body','update','interaction','then','error','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','qtimeout','rules','end','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','MessageId'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x1be9,0x77));var _0x91be=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x1be9[_0x4b7895];return _0x264180;};'use strict';var schema=require(_0x91be('0x0'));var _=require(_0x91be('0x1'));var util=require(_0x91be('0x2'));var seqqueue=require(_0x91be('0x3'));var moment=require('moment');var Redis=require(_0x91be('0x4'));var config=require('../../../../config/environment');var logger=require(_0x91be('0x5'))(_0x91be('0x6'));var strategy=require(_0x91be('0x7'));config[_0x91be('0x8')]=_['defaults'](config['redis'],{'host':_0x91be('0x9'),'port':0x18eb});var io=require(_0x91be('0xa'))(new Redis(config[_0x91be('0x8')]));var attributes=['id',_0x91be('0xb'),'account',_0x91be('0xc'),_0x91be('0xd'),_0x91be('0xe')];function emit(_0x5326d3,_0x149863,_0x443f3a){io['to'](_0x5326d3)['emit'](_0x149863,_0x443f3a);}function emitChannelQueueInteraction(_0x50468c,_0x32a1c0,_0x576664,_0x4aa273,_0x259ffc,_0x216e00,_0x26f111,_0x18f6d1){var _0x11074c=_[_0x91be('0xf')](_0x576664);_0x11074c[_0x91be('0xb')]=_0x18f6d1;_0x11074c[_0x91be('0xc')]=_0x32a1c0;_0x11074c['account']=_0x4aa273;_0x11074c['id']=_0x259ffc;if(_0x216e00){attributes[_0x91be('0x10')](_[_0x91be('0x11')](_0x50468c)+_0x91be('0x12'));_0x26f111[util[_0x91be('0x13')](_0x91be('0x14'),_0x50468c)][_0x259ffc]=_[_0x91be('0x15')](_0x11074c,attributes);}else{delete _0x26f111[util[_0x91be('0x13')](_0x91be('0x14'),_0x50468c)][_0x259ffc];}emit(util[_0x91be('0x13')](_0x91be('0x16'),_0x50468c,_0x32a1c0),util[_0x91be('0x13')]('%s_queue_waiting_interaction:%s',_0x50468c,_0x216e00?'save':'remove'),_['pick'](_0x11074c,attributes));}var rpc={'openchannelQueueReport':require(_0x91be('0x17')),'mailQueueReport':require(_0x91be('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x91be('0x19')),'faxQueueReport':require(_0x91be('0x1a')),'whatsappQueueReport':require(_0x91be('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x91be('0x1c')),'mailInteraction':require(_0x91be('0x1d')),'openchannelInteraction':require(_0x91be('0x1e')),'smsInteraction':require(_0x91be('0x1f')),'whatsappInteraction':require(_0x91be('0x20'))};var queue=schema({'name':{'type':_0x91be('0x21'),'required':!![],'message':_0x91be('0x22')},'timeout':{'type':_0x91be('0x23'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x3c2afc,_0x93255b,_0x579f29,_0x3c3add){if(_0x3c2afc&&_0x93255b&&_0x579f29){_0x93255b['waiting']+=0x1;var _0x1fc15a={'uniqueid':_0x3c2afc,'from':_0x579f29['body']?_0x579f29['body']['from']:'','joinAt':moment()[_0x91be('0x13')](_0x91be('0x24')),'ContactId':_0x579f29[_0x91be('0x25')]?_0x579f29[_0x91be('0x25')]['id']:null,'ListId':_0x579f29[_0x91be('0x26')]?_0x579f29[_0x91be('0x26')]['id']:null};_0x1fc15a[_[_0x91be('0x27')](_0x579f29['channel'])+_0x91be('0x28')]=_0x93255b['id']||null;_0x1fc15a[_['upperFirst'](_0x579f29[_0x91be('0x29')])+_0x91be('0x12')]=_0x579f29['interaction']?_0x579f29['interaction']['id']:null;_0x1fc15a[_[_0x91be('0x27')](_0x579f29['channel'])+_0x91be('0x2a')]=_0x579f29[_0x91be('0x2b')]?_0x579f29[_0x91be('0x2b')]['id']:null;_0x1fc15a[_[_0x91be('0x27')](_0x579f29[_0x91be('0x29')])+(_0x579f29[_0x91be('0x29')]!==_0x91be('0x2c')?_0x91be('0x2d'):'WebsiteId')]=_0x579f29['account']?_0x579f29[_0x91be('0x2e')]['id']:null;logger['info'](util['format'](_0x91be('0x2f'),_0x3c2afc,_0x93255b[_0x91be('0x30')]));emitChannelQueueInteraction(_0x579f29[_0x91be('0x29')],_0x93255b[_0x91be('0x30')],_0x1fc15a,_0x579f29[_0x91be('0x2e')][_0x91be('0x30')],_0x579f29[_0x91be('0x2b')]['id'],!![],_0x3c3add,_0x93255b['id']);if(rpc[_0x579f29[_0x91be('0x29')]+_0x91be('0x31')]){return rpc[_0x579f29['channel']+_0x91be('0x31')][_0x91be('0x32')](_0x1fc15a)[_0x91be('0x33')](function(_0x3e2354){logger['error'](_0x91be('0x34'),_0x3e2354);});}}}function stopRouting(_0x45f2bc,_0xab685f,_0x29f88d,_0x12384d){if(_0x45f2bc&&_0xab685f){_0xab685f[_0x91be('0x35')]-=0x1;var _0x364a75={'leaveAt':moment()[_0x91be('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x91be('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x91be('0x36')](util['format'](_0x91be('0x37'),_0x45f2bc,_0xab685f[_0x91be('0x30')]));emitChannelQueueInteraction(_0x29f88d[_0x91be('0x29')],_0xab685f['name'],_0x29f88d[_0x91be('0x38')],_0x29f88d['account'][_0x91be('0x30')],_0x29f88d[_0x91be('0x2b')]['id'],![],_0x12384d,_0xab685f['id']);return rpc[_0x29f88d['channel']+'Interaction'][_0x91be('0x39')](_0x29f88d[_0x91be('0x3a')]['id'],{'queueId':_0xab685f['id']})[_0x91be('0x3b')](function(){if(rpc[_0x29f88d[_0x91be('0x29')]+_0x91be('0x31')]){return rpc[_0x29f88d[_0x91be('0x29')]+'QueueReport'][_0x91be('0x39')](_0x45f2bc,_0x364a75)[_0x91be('0x33')](function(_0x296ea7){logger[_0x91be('0x3c')]('update\x20queue\x20report',_0x296ea7);});}});}}function endRouting(_0x48ce84,_0x4d334f,_0x3d0682,_0x3d351c){if(_0x48ce84&&_0x4d334f){_0x4d334f[_0x91be('0x35')]-=0x1;var _0x5e4cbc={'leaveAt':moment()[_0x91be('0x13')](_0x91be('0x24')),'exitAt':moment()[_0x91be('0x13')](_0x91be('0x24')),'reason':_0x91be('0x3d')};logger[_0x91be('0x36')](util['format'](_0x91be('0x3e'),_0x48ce84,_0x4d334f[_0x91be('0x30')]));emitChannelQueueInteraction(_0x3d0682['channel'],_0x4d334f['name'],_0x3d0682['body'],_0x3d0682[_0x91be('0x2e')][_0x91be('0x30')],_0x3d0682[_0x91be('0x2b')]['id'],![],_0x3d351c);if(rpc[_0x3d0682[_0x91be('0x29')]+_0x91be('0x31')]){return rpc[_0x3d0682['channel']+_0x91be('0x31')][_0x91be('0x39')](_0x48ce84,_0x5e4cbc)[_0x91be('0x33')](function(_0x1cccd1){logger[_0x91be('0x3c')](_0x91be('0x3f'),_0x1cccd1);});}}}function handleFindQueue(_0x4b8bca){return function(_0x153747){return _0x153747[_0x91be('0x30')][_0x91be('0x40')]()===_0x4b8bca['toLowerCase']();};}exports[_0x91be('0x41')]=function(_0x5ac644,_0xbe4440,_0x3d6033,_0x5ccba7){return function(_0x1e86dc){try{var _0x3a0c4b={'name':_0xbe4440[0x0],'timeout':_0xbe4440[0x1]};var _0x475329=queue[_0x91be('0x0')](_0x3a0c4b,{'typecast':!![]});if(_0x475329[_0x91be('0x42')]){logger[_0x91be('0x3c')](_0x91be('0x43'),_0x5ac644,_[_0x91be('0x44')](_0x475329,_0x91be('0x2b'))['join'](',\x20'));_0x1e86dc[_0x91be('0x45')]();}else{var _0x2b77cf=_['find'](_0x3d6033[_0x5ccba7[_0x91be('0x29')]+_0x91be('0x46')],handleFindQueue(_0x3a0c4b[_0x91be('0x30')]));if(_0x2b77cf){startRouting(_0x5ac644,_0x2b77cf,_0x5ccba7,_0x3d6033);var _0x3919ad=(_0x2b77cf[_0x91be('0x3d')]||0xa)*0x3e8;var _0x18c9d8=(_0x3a0c4b[_0x91be('0x3d')]||0x14)*0x3e8;var _0x2ed1da;if(_0x3919ad>_0x18c9d8){_0x18c9d8=_0x3919ad;}var _0x123049=seqqueue[_0x91be('0x47')](_0x3919ad);_0x123049['id']=_0x5ac644;_0x123049[_0x91be('0x48')]=_0x3919ad;_0x123049[_0x91be('0x49')]=_0x18c9d8;_0x123049['channel']=_0x5ccba7[_0x91be('0x29')];_0x3d6033[_0x91be('0x4a')][_0x5ac644]['on'](_0x91be('0x4b'),function(){logger[_0x91be('0x36')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5ac644);stopRouting(_0x5ac644,_0x2b77cf,_0x5ccba7,_0x3d6033);clearTimeout(_0x2ed1da);_0x2ed1da=undefined;_0x123049['close'](!![]);if(_0x3d6033[_0x91be('0x4a')][_0x5ac644]){delete _0x3d6033[_0x91be('0x4a')][_0x5ac644];}_0x1e86dc['stop']();});_0x3d6033[_0x91be('0x4a')][_0x5ac644]['on']('complete',function(){if(_0x3d6033[_0x91be('0x4a')][_0x5ac644]){delete _0x3d6033[_0x91be('0x4a')][_0x5ac644];}});_0x2ed1da=setTimeout(function(){logger[_0x91be('0x36')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x5ac644);endRouting(_0x5ac644,_0x2b77cf,_0x5ccba7,_0x3d6033);clearTimeout(_0x2ed1da);_0x123049['close'](!![]);_0x1e86dc[_0x91be('0x4c')]();},_0x18c9d8);switch(_0x2b77cf['strategy']){case _0x91be('0x4d'):strategy['rrmemory'](_0x123049,_0x2b77cf,_0x3d6033,_0x5ccba7);break;default:strategy[_0x91be('0x4e')](_0x123049,_0x2b77cf,_0x3d6033,_0x5ccba7);}}else{logger[_0x91be('0x3c')](_0x91be('0x4f'),_0x5ac644,_0x3a0c4b['name']);_0x1e86dc['stop']();}}}catch(_0x10a544){logger['error'](_0x91be('0x43'),_0x5ac644,_0x10a544[_0x91be('0x50')]);_0x1e86dc[_0x91be('0x45')]();}};}; \ 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 68c4ecb..b3e07f7 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 _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 +var _0x4d9e=['lodash','../../../../../config/logger','squeue','agent','realtime','routing','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports'];(function(_0x30d526,_0x44d080){var _0x2cef94=function(_0x226038){while(--_0x226038){_0x30d526['push'](_0x30d526['shift']());}};_0x2cef94(++_0x44d080);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x26f92c,_0x465ebb){_0x26f92c=_0x26f92c-0x0;var _0x109058=_0x4d9e[_0x26f92c];return _0x109058;};'use strict';var _=require(_0xe4d9('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xe4d9('0x1'))('routing');var Agent=function(_0x36adac,_0x4d7687,_0x2c6990,_0x2deaef){this['notificationId']=uuid['v4']();this[_0xe4d9('0x2')]=_0x36adac;this[_0xe4d9('0x3')]=_0x4d7687;this[_0xe4d9('0x4')]=_0x2c6990;this[_0xe4d9('0x5')]=_0x2deaef;this[_0xe4d9('0x2')][_0xe4d9('0x6')](this['handleRun'][_0xe4d9('0x7')](this),this[_0xe4d9('0x8')][_0xe4d9('0x7')](this));this[_0xe4d9('0x2')]['on'](_0xe4d9('0x9'),this[_0xe4d9('0x8')]['bind'](this));this[_0xe4d9('0x2')]['on'](_0xe4d9('0xa'),this[_0xe4d9('0xb')][_0xe4d9('0x7')](this));};Agent[_0xe4d9('0xc')][_0xe4d9('0x6')]=function(){this[_0xe4d9('0x2')]['push'](this['handleRun']['bind'](this),this['handleTimeout']['bind'](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xe4d9('0xc')][_0xe4d9('0xd')]=function(){logger[_0xe4d9('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x3')]['id']);if(_[_0xe4d9('0xf')](this[_0xe4d9('0x4')]['agents'][this[_0xe4d9('0x3')]['id']])){logger[_0xe4d9('0xe')](_0xe4d9('0x10'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xe4d9('0x6')][_0xe4d9('0x7')](this),0x3e8);}else{if(this['routing'][_0xe4d9('0x11')]||util['isAgentAvailable'](this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']],this['squeue'][_0xe4d9('0x13')],![])){this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']][_0xe4d9('0x14')]=!![];this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']][_0xe4d9('0x15')]=undefined;util['saveWaitingNotification'](this[_0xe4d9('0x4')],this[_0xe4d9('0x5')],this['agent'],this[_0xe4d9('0x2')]['channel']);util[_0xe4d9('0x16')](this[_0xe4d9('0x17')],this['squeue']['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this['agent']['id']],null,this[_0xe4d9('0x5')]);util[_0xe4d9('0x18')](this[_0xe4d9('0x2')]['id'],this['realtime']['agents'][this[_0xe4d9('0x3')]['id']],_0xe4d9('0x19')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xe4d9('0x1a'),this['squeue']['id'],this[_0xe4d9('0x3')]['id']);setTimeout(this[_0xe4d9('0x6')][_0xe4d9('0x7')](this),0x3e8);}}};Agent['prototype'][_0xe4d9('0x8')]=function(_0x2a0d1f){if(_[_0xe4d9('0xf')](this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']])){return logger[_0xe4d9('0xe')](_0xe4d9('0x10'),this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x3')]['id']);}else{logger[_0xe4d9('0xe')](_0xe4d9('0x1b'),this['squeue']['id'],this[_0xe4d9('0x3')]['id']);util[_0xe4d9('0x1c')](this[_0xe4d9('0x17')],this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this['agent']['id']],null,this['routing']);this['realtime'][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']][_0xe4d9('0x14')]=![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xe4d9('0x1d')](this[_0xe4d9('0x4')],this['routing'],this[_0xe4d9('0x3')],this[_0xe4d9('0x2')]['channel']);util[_0xe4d9('0x18')](this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']],_0x2a0d1f?_0xe4d9('0x1e'):_0xe4d9('0x1f'));}if(!_0x2a0d1f){setTimeout(this[_0xe4d9('0x6')][_0xe4d9('0x7')](this),0x3e8);}};function agent(_0x20cc89,_0x179618,_0x517f24,_0x234b62){return new Agent(_0x20cc89,_0x179618,_0x517f24,_0x234b62);}module[_0xe4d9('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index fb3fad1..4fac2b8 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 _0x1c6e=['busy','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busyQueue','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog'];(function(_0x3e56e7,_0xd920b5){var _0x1493af=function(_0x2fa6c4){while(--_0x2fa6c4){_0x3e56e7['push'](_0x3e56e7['shift']());}};_0x1493af(++_0xd920b5);}(_0x1c6e,0x1e5));var _0xe1c6=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0x1c6e[_0x47604d];return _0x388e4c;};'use strict';var _=require(_0xe1c6('0x0'));var uuid=require(_0xe1c6('0x1'));var util=require(_0xe1c6('0x2'));var logger=require(_0xe1c6('0x3'))(_0xe1c6('0x4'));var Beepall=function(_0x110873,_0x2ecb89,_0x48d907,_0x5c5f7e){this[_0xe1c6('0x5')]=uuid['v4']();this[_0xe1c6('0x6')]=_0x110873;this['queue']=_0x2ecb89;this[_0xe1c6('0x7')]=_0x48d907;this[_0xe1c6('0x4')]=_0x5c5f7e;this[_0xe1c6('0x6')][_0xe1c6('0x8')](this[_0xe1c6('0x9')][_0xe1c6('0xa')](this),this[_0xe1c6('0xb')][_0xe1c6('0xa')](this));this[_0xe1c6('0x6')]['on'](_0xe1c6('0xc'),this[_0xe1c6('0xb')][_0xe1c6('0xa')](this));this['squeue']['on'](_0xe1c6('0xd'),this[_0xe1c6('0xe')]['bind'](this));};Beepall[_0xe1c6('0xf')][_0xe1c6('0x8')]=function(){this[_0xe1c6('0x6')][_0xe1c6('0x8')](this['handleRun'][_0xe1c6('0xa')](this),this[_0xe1c6('0xb')]['bind'](this));};Beepall[_0xe1c6('0xf')][_0xe1c6('0xe')]=function(){this['handleTimeout'](!![]);};Beepall[_0xe1c6('0xf')][_0xe1c6('0x9')]=function(){var _0x262c82=!![];if(!_[_0xe1c6('0x10')](this['queue'])&&!_['isNil'](this[_0xe1c6('0x11')][_0xe1c6('0x12')])&&this[_0xe1c6('0x11')]['Agents'][_0xe1c6('0x13')]>0x0){for(var _0x48a815=0x0,_0x211968;_0x48a8150x0){for(var _0x2806b6=0x0,_0x4eb8ca;_0x2806b60x0&&_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 +var _0x7543=['agents','WaitingInteractions','saveWaitingNotification','message','removeWaitingNotification','writeLog','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','\x20interaction','account','notificationSound','notificationShake','body','queue','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','format','user:%s','name','emit','notification:%s','remove','debug','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction','some','channel','QueuesWaitingInteractions','InteractionId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7543,0xca));var _0x3754=function(_0x3a4ca8,_0x3f7667){_0x3a4ca8=_0x3a4ca8-0x0;var _0x222c9c=_0x7543[_0x3a4ca8];return _0x222c9c;};'use strict';var _=require('lodash');var util=require(_0x3754('0x0'));var utils=require(_0x3754('0x1'));var Redis=require(_0x3754('0x2'));var config=require(_0x3754('0x3'));var logger=require(_0x3754('0x4'))(_0x3754('0x5'));config[_0x3754('0x6')]=_[_0x3754('0x7')](config[_0x3754('0x6')],{'host':_0x3754('0x8'),'port':0x18eb});var io=require(_0x3754('0x9'))(new Redis(config[_0x3754('0x6')]));function sendNotification(_0x48c22f,_0x2304fb,_0x16851c,_0x11ef76,_0x6852d5,_0x5500bb){var _0x1d613a=_0x5500bb||{};var _0x4cddbe=_0x16851c['split']('.');var _0x323b21={'uniqueid':_0x2304fb,'channel':_0x4cddbe[0x0],'id':_0x4cddbe[0x1],'title':_0x4cddbe[0x0]+_0x3754('0xa'),'interactionId':_0x4cddbe[0x2],'queue':_0x6852d5?_0x6852d5['name']:null,'sound':_0x1d613a[_0x3754('0xb')][_0x3754('0xc')],'shake':_0x1d613a[_0x3754('0xb')][_0x3754('0xd')]};try{if(!_0x1d613a[_0x3754('0xe')]){_0x1d613a['body']={};}if(_0x6852d5){_0x1d613a[_0x3754('0xe')]['queue']=_0x6852d5;}else if(_0x1d613a[_0x3754('0xe')][_0x3754('0xf')]){delete _0x1d613a[_0x3754('0xe')]['queue'];}_0x323b21['msg']=utils['getMustacheRender'](_0x1d613a[_0x3754('0xb')]['notificationTemplate'],_0x1d613a);}catch(_0x46d0e3){_0x323b21['msg']=_0x3754('0x10');logger[_0x3754('0x11')](util['format'](_0x3754('0x12'),_0x2304fb,_0x46d0e3['message']));}io['to'](util[_0x3754('0x13')](_0x3754('0x14'),_0x11ef76[_0x3754('0x15')]))[_0x3754('0x16')](util[_0x3754('0x13')](_0x3754('0x17'),_0x48c22f?'save':_0x3754('0x18')),_0x323b21);}function writeLog(_0x4983cc,_0x36f9af,_0x52a811){return logger[_0x3754('0x19')](util[_0x3754('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4983cc,_0x36f9af[_0x3754('0x15')],_0x52a811));}exports[_0x3754('0x1a')]=function(_0x3149eb,_0x5762cc,_0x31999f,_0x239b9e){if(_0x5762cc[_0x3754('0x1b')]){writeLog(_0x3149eb,_0x5762cc,_0x3754('0x1c'));return![];}if(!_0x5762cc['online']){writeLog(_0x3149eb,_0x5762cc,_0x3754('0x1d'));return![];}if(_0x5762cc[_0x31999f+_0x3754('0x1e')]){writeLog(_0x3149eb,_0x5762cc,_0x3754('0x1f'));return![];}if(_0x239b9e&&_0x5762cc[_0x3754('0x20')](_0x31999f+_0x3754('0x21'))&&_0x5762cc[_0x3754('0x20')](_0x31999f+_0x3754('0x22'))){if(_0x5762cc[_0x31999f+'Capacity']>0x0&&_0x5762cc[_0x31999f+_0x3754('0x22')]>=_0x5762cc[_0x31999f+_0x3754('0x21')]){writeLog(_0x3149eb,_0x5762cc,_0x31999f['toUpperCase']()+_0x3754('0x23'));return![];}}return!![];};exports[_0x3754('0x24')]=function(_0x1ca092,_0x73707c,_0x132a34,_0x327f58,_0x1d1879){return sendNotification(!![],_0x1ca092,_0x73707c,_0x132a34,_0x327f58,_0x1d1879);};exports['hideNotification']=function(_0xc04375,_0x21b7c3,_0x78f082,_0x16d172,_0x510783){return sendNotification(![],_0xc04375,_0x21b7c3,_0x78f082,_0x16d172,_0x510783);};exports[_0x3754('0x25')]=function(_0x29c3b9,_0x2a4d0c,_0x27a327){var _0x13ba06=_0x2a4d0c[_0x3754('0x26')]['UserId'];if(!_0x13ba06&&_0x27a327){_0x13ba06=_0x27a327['id'];}var _0x45215e=_[_0x3754('0x27')](_0x29c3b9[_0x2a4d0c[_0x3754('0x28')]+_0x3754('0x29')],function(_0x335f4e){var _0x181977=_['capitalize'](_0x2a4d0c['channel'])+_0x3754('0x2a');return _0x335f4e[_0x181977]===_0x2a4d0c[_0x3754('0x26')]['id'];});if(!_0x45215e&&_0x13ba06&&_0x29c3b9[_0x3754('0x2b')][_0x13ba06]){_0x45215e=_['some'](_0x29c3b9[_0x3754('0x2b')][_0x13ba06][_0x2a4d0c['channel']+_0x3754('0x2c')],function(_0x136172){return _0x136172['id']===_0x2a4d0c[_0x3754('0x26')]['id'];});}return _0x45215e;};exports[_0x3754('0x2d')]=function(_0x373831,_0x62c0a3,_0x297e35,_0x4a6e23){if(_0x297e35&&_0x297e35['id']&&_0x373831[_0x3754('0x2b')]&&_0x373831['agents'][_0x297e35['id']]){_0x373831[_0x3754('0x2b')][_0x297e35['id']][_0x4a6e23+'WaitingInteractions'][_0x62c0a3[_0x3754('0x2e')]['id']]={'id':_0x62c0a3[_0x3754('0x26')]['id']};}};exports[_0x3754('0x2f')]=function(_0x207fe7,_0x466b5f,_0x4be655,_0x2d7dbe){if(_0x4be655&&_0x4be655['id']&&_0x207fe7[_0x3754('0x2b')]&&_0x207fe7[_0x3754('0x2b')][_0x4be655['id']]){delete _0x207fe7[_0x3754('0x2b')][_0x4be655['id']][_0x2d7dbe+_0x3754('0x2c')][_0x466b5f[_0x3754('0x2e')]['id']];}};exports[_0x3754('0x30')]=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 cf5d15d..4b4758c 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 _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 +var _0x9366=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x596fb9,_0x3f0673){var _0x365533=function(_0x2b61bc){while(--_0x2b61bc){_0x596fb9['push'](_0x596fb9['shift']());}};_0x365533(++_0x3f0673);}(_0x9366,0x14a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var sh=require(_0x6936('0x0'));var _=require(_0x6936('0x1'));var utils=require(_0x6936('0x2'));var logger=require(_0x6936('0x3'))(_0x6936('0x4'));var system=schema({'command':{'type':_0x6936('0x5'),'required':!![],'message':_0x6936('0x6')}});exports['consequence']=function(_0xe46b2a,_0x441795){return function(_0x29ac43){try{var _0x2b36cc={'command':_0x441795[0x0]};var _0x3ad113=system['validate'](_0x2b36cc,{'typecast':!![]});if(_0x3ad113['length']){logger[_0x6936('0x7')](_0x6936('0x8'),_0xe46b2a,_['map'](_0x3ad113,'message')['join'](',\x20'));logger[_0x6936('0x9')](_0x6936('0xa'),_0xe46b2a);_0x29ac43[_0x6936('0xb')]();}else{var _0x2b0b94=this;var _0x36e364=utils['getMustacheRender'](_0x441795[0x0],this);logger[_0x6936('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xe46b2a,_0x36e364);sh[_0x6936('0xc')](_[_0x6936('0xd')](_0x36e364),function(_0x52b163,_0x13c5d2){logger[_0x6936('0x9')](_0x6936('0xe'),_0xe46b2a,_0x52b163);if(_0x52b163==0x0){var _0x3d50f4=_0x13c5d2[_0x6936('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x441795[0x1])||_[_0x6936('0x10')](_0x441795[0x1])){logger[_0x6936('0x9')](_0x6936('0x11'),_0xe46b2a);_0x2b0b94['body'][_0x441795[0x1]]=_0x3d50f4;}else{logger[_0x6936('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xe46b2a,_0x441795[0x1],_0x3d50f4);_0x2b0b94[_0x6936('0x12')][_0x441795[0x1]]=_0x3d50f4;}}_0x29ac43[_0x6936('0xb')]();});}}catch(_0x37a9c1){logger[_0x6936('0x7')](_0x6936('0x8'),_0xe46b2a,_[_0x6936('0x13')](_0x37a9c1)?JSON[_0x6936('0x14')](_0x37a9c1):_0x37a9c1);logger[_0x6936('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xe46b2a);_0x29ac43['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 753a561..d7953d1 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 _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 +var _0xaafe=['addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../../../config/logger','routing','consequence','length','error','map','message','join','next','channel','Interaction'];(function(_0xed03d5,_0x5e89f6){var _0x291d16=function(_0x2bd203){while(--_0x2bd203){_0xed03d5['push'](_0xed03d5['shift']());}};_0x291d16(++_0x5e89f6);}(_0xaafe,0x18a));var _0xeaaf=function(_0x4f7648,_0x4bc880){_0x4f7648=_0x4f7648-0x0;var _0x1b224a=_0xaafe[_0x4f7648];return _0x1b224a;};'use strict';var schema=require(_0xeaaf('0x0'));var _=require(_0xeaaf('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xeaaf('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xeaaf('0x3'))(_0xeaaf('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xeaaf('0x5')]=function(_0x554d10,_0x4a8d7c,_0x2bd94d,_0xd0443e){return function(_0x4f0928){try{var _0x50adb2={'tag':_0x4a8d7c[0x0]};var _0x327b3d=tag['validate'](_0x50adb2,{'typecast':!![]});if(_0x327b3d[_0xeaaf('0x6')]){logger[_0xeaaf('0x7')]('[%s][TAG]\x20%s',_0x554d10,_[_0xeaaf('0x8')](_0x327b3d,_0xeaaf('0x9'))[_0xeaaf('0xa')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x554d10);_0x4f0928[_0xeaaf('0xb')]();}else{var _0x17b881={'ids':[_0x4a8d7c[0x0]]};if(rpc[_0xd0443e[_0xeaaf('0xc')]+_0xeaaf('0xd')]){rpc[_0xd0443e[_0xeaaf('0xc')]+_0xeaaf('0xd')][_0xeaaf('0xe')](_0xd0443e[_0xeaaf('0xf')]['id'],_0x17b881)[_0xeaaf('0x10')](function(_0x43c10d){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x554d10,_0x4a8d7c[0x1],_0xd0443e[_0xeaaf('0xc')],_0xd0443e[_0xeaaf('0xf')]['id']);})[_0xeaaf('0x11')](function(_0x593156){logger[_0xeaaf('0x7')](_0xeaaf('0x12'),_0x554d10,JSON[_0xeaaf('0x13')](_0x593156));logger[_0xeaaf('0x14')](_0xeaaf('0x15'),_0x554d10);})[_0xeaaf('0x16')](function(){_0x4f0928[_0xeaaf('0xb')]();});}}}catch(_0x417443){logger[_0xeaaf('0x7')](_0xeaaf('0x12'),_0x554d10,_[_0xeaaf('0x17')](_0x417443)?JSON[_0xeaaf('0x13')](_0x417443):_0x417443);logger[_0xeaaf('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x554d10);_0x4f0928[_0xeaaf('0xb')]();}};}; \ 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 4b85f15..c856abf 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 _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 +var _0x76ff=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','jsonrpc','2.0','method','login','params','POST','application/json-rpc','then','parse','result','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error'];(function(_0x1d6cbc,_0x808bd9){var _0x1be56e=function(_0x5a0dd7){while(--_0x5a0dd7){_0x1d6cbc['push'](_0x1d6cbc['shift']());}};_0x1be56e(++_0x808bd9);}(_0x76ff,0x177));var _0xf76f=function(_0xf06cc3,_0x5740f3){_0xf06cc3=_0xf06cc3-0x0;var _0x39c474=_0x76ff[_0xf06cc3];return _0x39c474;};'use strict';var rp=require(_0xf76f('0x0'));var logger=require(_0xf76f('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0xf76f('0x2')]=function(_0x28530f,_0x4eab02){return function(_0x1f7396){var _0x4885ae=_0x4eab02[0xa];var _0x2637ed=_0x4eab02[0xb];var _0x3ddc52=_0x4eab02[0xc];var _0x177f25=_0x4eab02[0xd];var _0x135a7d=_0x4eab02[0xe];var _0x2b7c91=_0x4eab02[0xf][_0xf76f('0x3')](/\n/g,_0xf76f('0x4'));var _0x58dd39=_0x4eab02[0x10][_0xf76f('0x3')](/\n/g,'\x20');if(!arr[_0xf76f('0x5')](_0x2637ed)){arr[_0xf76f('0x6')](_0x2637ed);var _0x44a88f=_0x4eab02[0x3];var _0x1c1fed=_0x4eab02[0x4];var _0x27d44d=_0x4eab02[0x1];var _0xb76926=_0x4eab02[0x0];var _0x51e7de={};_0x51e7de[_0xf76f('0x7')]=_0x4eab02[0x8]+_0xf76f('0x8')+_0x3ddc52+'|'+_0x4885ae+'|'+_0x177f25+'|'+_0x2637ed+'|'+_0x135a7d;_0x51e7de['urlOnRing']=_0x4eab02[0x7]+_0xf76f('0x8')+_0x3ddc52+'|'+_0x4885ae+'|'+_0x177f25+'|'+_0x2637ed+'|'+_0x135a7d+'|'+_0x2b7c91+'|'+_0x58dd39;_0x51e7de['title']=_0x4eab02[0x9];var _0x170dfa={};_0x170dfa[_0xf76f('0x9')]=_0xf76f('0xa');_0x170dfa[_0xf76f('0xb')]=_0xf76f('0xc');var _0x3fadcc=[];_0x3fadcc['push'](_0x4eab02[0x2]);_0x3fadcc[_0xf76f('0x6')](_0x4eab02[0x5]);_0x3fadcc[_0xf76f('0x6')](_0x4eab02[0x6]);_0x170dfa[_0xf76f('0xd')]=_0x3fadcc;_0x170dfa['id']=0x1;var _0x31a3d8=JSON['stringify'](_0x170dfa);var _0x2e4d42={'encoding':'utf8','method':_0xf76f('0xe'),'timeout':0x2710,'url':_0x44a88f,'headers':{'Content-Type':_0xf76f('0xf')},'body':_0x31a3d8};return rp(_0x2e4d42)[_0xf76f('0x10')](function(_0x360364){const _0x58bcac=JSON[_0xf76f('0x11')](_0x360364);if(!_0x58bcac[_0xf76f('0x12')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0xf243d3=_0x2637ed;var _0x284a6f=_0xf76f('0x13')+_0x27d44d+_0xf76f('0x14')+_0xb76926+_0xf76f('0x15')+_0xf243d3+_0xf76f('0x16')+JSON[_0xf76f('0x17')](_0x51e7de);var _0x45899f=_0x1c1fed+'?'+_0x284a6f;return rp(_0x45899f);})[_0xf76f('0x10')](function(_0x5ecb70){logger[_0xf76f('0x18')](_0xf76f('0x19'),_0x28530f,_0x5ecb70);_0x1f7396[_0xf76f('0x1a')]();})['catch'](function(_0x5f1f7f){logger[_0xf76f('0x1b')](_0xf76f('0x1c'),_0x28530f,_[_0xf76f('0x1d')](_0x5f1f7f)?JSON['stringify'](_0x5f1f7f):_0x5f1f7f);_0x1f7396[_0xf76f('0x1a')]();});}else{logger['info'](_0xf76f('0x1e'),_0x28530f);_0x1f7396['next']();}};}; \ 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 bc85ec8..507bac8 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(_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 +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x503fe9,_0x277316){var _0x513a64=function(_0x4b1188){while(--_0x4b1188){_0x503fe9['push'](_0x503fe9['shift']());}};_0x513a64(++_0x277316);}(_0xe706,0xa3));var _0x6e70=function(_0x183b21,_0x271b8e){_0x183b21=_0x183b21-0x0;var _0x4dbe1b=_0xe706[_0x183b21];return _0x4dbe1b;};'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 6c4a8e1..262e844 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 _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 +var _0x60ca=['execute','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','checkWaitingNotifications','applications','length','app','.js','toLowerCase','split','channel','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex','TagId','tvox','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','Please\x20create\x20a\x20new\x20file\x20under','rules'];(function(_0x486526,_0x7ce885){var _0x54e275=function(_0x53ed0e){while(--_0x53ed0e){_0x486526['push'](_0x486526['shift']());}};_0x54e275(++_0x7ce885);}(_0x60ca,0x92));var _0xa60c=function(_0x522c81,_0x4cdbd3){_0x522c81=_0x522c81-0x0;var _0x35c98c=_0x60ca[_0x522c81];return _0x35c98c;};'use strict';var _=require(_0xa60c('0x0'));var util=require(_0xa60c('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xa60c('0x2'));var utils=require(_0xa60c('0x3'));var sUtils=require(_0xa60c('0x4'));var logger=require(_0xa60c('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xa60c('0x6')),'mailQueueReport':require(_0xa60c('0x7')),'chatQueueReport':require(_0xa60c('0x8')),'smsQueueReport':require(_0xa60c('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa60c('0xa'))};var RuleEngine=require(_0xa60c('0xb'));function getId(_0x4bd35b,_0x52f1b1,_0x3617a4){return util[_0xa60c('0xc')](_0xa60c('0xd'),_0x4bd35b,_0x52f1b1||0x0,_0x3617a4||0x0);}function getIntervals(_0x19ad5c,_0x3c7bf4){var _0x5179f2=[];if(!_[_0xa60c('0xe')](_0x3c7bf4[_0xa60c('0xf')])&&!_['isNil'](_0x19ad5c[_0x3c7bf4[_0xa60c('0xf')]])&&!_[_0xa60c('0xe')](_0x19ad5c[_0x3c7bf4[_0xa60c('0xf')]][_0xa60c('0x10')])){_0x5179f2=_[_0xa60c('0x11')](_0x19ad5c[_0x3c7bf4[_0xa60c('0xf')]][_0xa60c('0x10')],_0xa60c('0x12'));}else if(!_[_0xa60c('0xe')](_0x3c7bf4[_0xa60c('0x12')])){_0x5179f2=[_0x3c7bf4['interval']];}return _0x5179f2;}exports[_0xa60c('0x13')]=function(_0x1a9fef){_0x1a9fef['rules']={};return new BPromise(function(_0x37c668,_0x2a8a49){var _0xe3bd09={'Start':function(_0x1ceaa1){var _0x54eb78=this;return new Promise(function(_0x1caa26,_0x5f0ff4){if(_0x1ceaa1){try{var _0x29a590=[];var _0x54cccd=getId(_0x1ceaa1['channel'],_0x1ceaa1[_0xa60c('0x14')]?_0x1ceaa1[_0xa60c('0x14')]['id']:0x0,_0x1ceaa1['interaction']?_0x1ceaa1[_0xa60c('0x15')]['id']:0x0);var _0x188679=sUtils[_0xa60c('0x16')](_0x1a9fef,_0x1ceaa1);if(_0x1ceaa1['transfer']||!_0x188679&&_0x1ceaa1[_0xa60c('0x17')]&&_['isArray'](_0x1ceaa1[_0xa60c('0x17')])&&_0x1ceaa1[_0xa60c('0x17')][_0xa60c('0x18')]){for(var _0x1c1363=0x0;_0x1c1363<_0x1ceaa1[_0xa60c('0x17')][_0xa60c('0x18')];_0x1c1363+=0x1){var _0x52270e=_0x1ceaa1[_0xa60c('0x17')][_0x1c1363];if(fs['existsSync'](path['join'](__dirname,'applications',_0x52270e[_0xa60c('0x19')]+_0xa60c('0x1a')))){var _0x498fe5=[];switch(_0x52270e[_0xa60c('0x19')][_0xa60c('0x1b')]()){case'autoreply':var _0x3d1557=_0x52270e['appdata'][_0xa60c('0x1c')](',');if(_0x1ceaa1[_0xa60c('0x1d')]===_0xa60c('0x1e')){_0x498fe5[_0xa60c('0x1f')](_0x3d1557[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x3d1557[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x3d1557[_0xa60c('0x20')](0x2,_0x3d1557[_0xa60c('0x18')])[_0xa60c('0x21')](','));}else{_0x498fe5[_0xa60c('0x1f')](_0x3d1557[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x3d1557[_0xa60c('0x20')](0x1,_0x3d1557[_0xa60c('0x18')])['join'](','));}break;case _0xa60c('0x22'):var _0x2611ab=_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');_0x498fe5['push'](_0x2611ab[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x2611ab[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x2611ab[_0xa60c('0x20')](0x2,_0x2611ab[_0xa60c('0x18')])[_0xa60c('0x21')](','));break;case _0xa60c('0x24'):var _0x216ace=_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');_0x498fe5['push'](_0x216ace[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[0x2]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[0x3]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[_0xa60c('0x20')](0x4,_0x216ace['length'])['join'](','));break;case _0xa60c('0x25'):var _0x58ffa3=_0x52270e['appdata'][_0xa60c('0x1c')](',');_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x2]);_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x3]);_0x498fe5['push'](_0x58ffa3[_0xa60c('0x20')](0x4,_0x58ffa3[_0xa60c('0x18')])['join'](','));break;case _0xa60c('0x14'):_0x498fe5[_0xa60c('0x1f')](_0x52270e['appdata']);break;case'tag':_0x498fe5[_0xa60c('0x1f')](_0x52270e[_0xa60c('0x26')]);_0x498fe5['push'](_0x52270e[_0xa60c('0x23')]);break;case _0xa60c('0x27'):var _0x5e5e5f=utils['getMustacheRender'](_0x1ceaa1[_0xa60c('0x28')][_0xa60c('0x29')],_0x1ceaa1);var _0x10053c=_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x2]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x3]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x4]);_0x498fe5['push'](_0x10053c[0x5]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x6]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x7]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x8]);_0x498fe5['push'](_0x10053c[0x9]);_0x498fe5['push'](_0x10053c[0xa]);_0x498fe5[_0xa60c('0x1f')](_0x1ceaa1[_0xa60c('0x15')]['id']);_0x498fe5[_0xa60c('0x1f')](_0x1ceaa1[_0xa60c('0x14')]['id']);_0x498fe5[_0xa60c('0x1f')](_0x52270e[_0xa60c('0x2a')]);_0x498fe5['push'](_0x1ceaa1[_0xa60c('0x15')]['ContactId']);_0x498fe5[_0xa60c('0x1f')](_0x1ceaa1[_0xa60c('0x2b')][_0xa60c('0x2b')]);_0x498fe5[_0xa60c('0x1f')](_0x5e5e5f);break;default:_0x498fe5=_[_0xa60c('0xe')](_0x52270e['appdata'])?[]:_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');}var _0x4fcf48={'id':util[_0xa60c('0xc')](_0xa60c('0x2c'),_0x54cccd,_0x52270e['id'],_0x52270e[_0xa60c('0x19')]),'condition':require(_0xa60c('0x2d'))[_0xa60c('0x2e')](_0x54cccd,getIntervals(_0x1a9fef[_0xa60c('0x2f')],_0x52270e),_0x1a9fef),'consequence':require('./applications/'+_0x52270e['app'])[_0xa60c('0x30')](_0x54cccd,_0x498fe5,_0x1a9fef,_0x1ceaa1),'p':_0x52270e[_0xa60c('0x31')]||0x0};logger[_0xa60c('0x32')](_0xa60c('0x33'),_0x4fcf48['id'],'on\x20interval',getIntervals(_0x1a9fef[_0xa60c('0x2f')],_0x52270e)[_0xa60c('0x21')]('\x20|\x20'));_0x29a590['push'](_0x4fcf48);}else{logger['error'](_0xa60c('0x34'),path['join'](__dirname,_0xa60c('0x17'),_0x52270e[_0xa60c('0x19')]+_0xa60c('0x1a')));}}_0x1a9fef[_0xa60c('0x35')][_0x54cccd]=new RuleEngine(_0x29a590);_0x1a9fef['rules'][_0x54cccd][_0xa60c('0x36')](_0x1ceaa1,function(_0x302763){logger[_0xa60c('0x32')](_0xa60c('0x37'),JSON[_0xa60c('0x38')](_0x302763[_0xa60c('0x39')]));if(_0x1a9fef[_0xa60c('0x35')][_0x54cccd]){_0x1a9fef[_0xa60c('0x35')][_0x54cccd][_0xa60c('0x3a')]('complete');}});return _0x1caa26({'code':0xc8,'message':_0x1ceaa1});}else{if(_0x188679){logger[_0xa60c('0x32')](util[_0xa60c('0xc')](_0xa60c('0x3b'),_0x54cccd));}else{logger[_0xa60c('0x32')](_0xa60c('0x3c'));}return _0x1caa26({'code':0xc8,'message':_0x1ceaa1});}}catch(_0x22c6df){logger[_0xa60c('0x3d')](_0x22c6df[_0xa60c('0x3e')]);return _0x5f0ff4(_0x54eb78[_0xa60c('0x3d')](0x1f4,_0x22c6df));}}return _0x5f0ff4(_0xa60c('0x3f'));});},'AcceptMessage':function(_0xcf4028){var _0x358c7c=this;return new Promise(function(_0x37c710,_0x4e0dde){if(_0xcf4028[_0xa60c('0x40')]&&_0xcf4028[_0xa60c('0x40')]['id']){if(_0x1a9fef[_0xa60c('0x41')][_0xcf4028['agent']['id']]){_0x1a9fef[_0xa60c('0x41')][_0xcf4028[_0xa60c('0x40')]['id']][_0xa60c('0x42')]=![];_0x1a9fef[_0xa60c('0x41')][_0xcf4028[_0xa60c('0x40')]['id']][_0xa60c('0x43')]=undefined;}}if(_0xcf4028['message']&&_0xcf4028[_0xa60c('0x14')]['id']){try{var _0x1feb01=getId(_0xcf4028[_0xa60c('0x1d')],_0xcf4028[_0xa60c('0x14')]?_0xcf4028[_0xa60c('0x14')]['id']:0x0,_0xcf4028[_0xa60c('0x15')]?_0xcf4028[_0xa60c('0x15')]['id']:0x0);if(_0x1a9fef[_0xa60c('0x35')][_0x1feb01]){_0x1a9fef[_0xa60c('0x35')][_0x1feb01]['emit'](_0xa60c('0x44'));if(rpc[_0xcf4028[_0xa60c('0x1d')]+_0xa60c('0x45')]){rpc[_0xcf4028[_0xa60c('0x1d')]+_0xa60c('0x45')][_0xa60c('0x46')](_0x1feb01,{'UserId':_0xcf4028[_0xa60c('0x14')]['UserId']})['catch'](function(){logger[_0xa60c('0x3d')](_0xa60c('0x47'));});}}return _0x37c710({'code':0xc8,'message':_0xcf4028});}catch(_0x4c2a17){logger[_0xa60c('0x3d')](_0x4c2a17['stack']);return _0x4e0dde(_0x358c7c[_0xa60c('0x3d')](0x1f4,_0x4c2a17));}}logger[_0xa60c('0x3d')]('message\x20is\x20empty');return _0x4e0dde(_0x358c7c[_0xa60c('0x3d')](0x1f4,_0xa60c('0x48')));});},'RejectMessage':function(_0x4bdfc2){var _0x543819=this;return new Promise(function(_0x50ac8,_0x568c23){if(_0x4bdfc2[_0xa60c('0x40')]&&_0x4bdfc2[_0xa60c('0x40')]['id']){try{if(_0x1a9fef['agents'][_0x4bdfc2['agent']['id']]){_0x1a9fef['agents'][_0x4bdfc2[_0xa60c('0x40')]['id']][_0xa60c('0x42')]=![];_0x1a9fef[_0xa60c('0x41')][_0x4bdfc2['agent']['id']][_0xa60c('0x43')]=undefined;}return _0x50ac8({'code':0xc8,'message':_0x4bdfc2});}catch(_0x273adb){logger[_0xa60c('0x3d')](_0x273adb[_0xa60c('0x3e')]);return _0x568c23(_0x543819[_0xa60c('0x3d')](0x1f4,_0x273adb));}}logger[_0xa60c('0x3d')](_0xa60c('0x48'));return _0x568c23(_0x543819['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xddd36f){var _0x1fe45f=this;return new Promise(function(_0x1a0b92,_0x1729f5){if(_0xddd36f[_0xa60c('0x1d')]&&_0xddd36f[_0xa60c('0x15')]&&_0xddd36f['interaction']['id']){try{var _0x1fa307=getId(_0xddd36f[_0xa60c('0x1d')],_0xddd36f[_0xa60c('0x14')]?_0xddd36f[_0xa60c('0x14')]['id']:0x0,_0xddd36f['interaction']?_0xddd36f[_0xa60c('0x15')]['id']:0x0);if(_0x1a9fef[_0xa60c('0x35')][_0x1fa307]){_0x1a9fef[_0xa60c('0x35')][_0x1fa307][_0xa60c('0x3a')]('end');}return _0x1a0b92({'code':0xc8,'message':_0xddd36f});}catch(_0x5733fe){logger['error'](_0x5733fe[_0xa60c('0x3e')]);return _0x1729f5(_0x1fe45f[_0xa60c('0x3d')](0x1f4,_0x5733fe));}}logger[_0xa60c('0x3d')](_0xa60c('0x48'));return _0x1729f5(_0x1fe45f[_0xa60c('0x3d')](0x1f4,_0xa60c('0x48')));});},'AgentCapacity':function(_0x5b968b){var _0x59df02=this;return new Promise(function(_0x45fecd,_0x13726d){if(_0x1a9fef[_0xa60c('0x41')][_0xa60c('0x49')](_0x5b968b['id'])){for(var _0x1d61a9 in _0x5b968b[_0xa60c('0x4a')]){if(_0x5b968b[_0xa60c('0x4a')][_0xa60c('0x49')](_0x1d61a9)){if(_0x1a9fef[_0xa60c('0x41')][_0x5b968b['id']][_0xa60c('0x49')](_0x1d61a9+_0xa60c('0x4b'))){_0x1a9fef['agents'][_0x5b968b['id']][_0x1d61a9+_0xa60c('0x4b')]=parseInt(_0x5b968b['capacity'][_0x1d61a9],0xa);}}}_0x1a9fef[_0xa60c('0x41')][_0x5b968b['id']]['updateRealtime']();return _0x45fecd({'code':0xc8,'message':_0x1a9fef[_0xa60c('0x41')][_0x5b968b['id']]});}else{return _0x13726d(_0x59df02[_0xa60c('0x3d')](0x1f4,_0xa60c('0x4c')));}});},'Agents':function(_0x58e047){return new Promise(function(_0x13a3df){var _0x348763=_['values'](_0x1a9fef[_0xa60c('0x41')]);if(_0x58e047&&_0x58e047['id']){var _0x38f9a1=_[_0xa60c('0x4d')](_0x348763,function(_0x1c600b){return _0x1c600b['id']===_0x58e047['id'];});_0x13a3df(_0x38f9a1);}else{_0x13a3df({'count':_0x348763['length'],'rows':_0x348763});}});},'ChatQueues':function(){return new Promise(function(_0x48e680){var _0x3593e6=[];for(var _0x29d069 in _0x1a9fef[_0xa60c('0x4e')]){if(_0x1a9fef['chatQueues'][_0xa60c('0x49')](_0x29d069)){var _0x350538=_0x1a9fef[_0xa60c('0x4e')][_0x29d069];var _0xb8ff73={'id':_0x350538['id'],'available':_0x350538[_0xa60c('0x4f')],'loggedIn':_0x350538[_0xa60c('0x50')],'name':_0x350538[_0xa60c('0x51')],'paused':_0x350538[_0xa60c('0x52')],'waiting':_0x350538[_0xa60c('0x53')]};_0x3593e6['push'](_0xb8ff73);}}_0x48e680({'count':_0x3593e6[_0xa60c('0x18')],'rows':_0x3593e6});});},'MailQueues':function(){return new Promise(function(_0x3ffb2f){var _0x578988=[];for(var _0x4f33cb in _0x1a9fef[_0xa60c('0x54')]){if(_0x1a9fef[_0xa60c('0x54')][_0xa60c('0x49')](_0x4f33cb)){var _0x4559c5=_0x1a9fef[_0xa60c('0x54')][_0x4f33cb];var _0xc30f12={'id':_0x4559c5['id'],'available':_0x4559c5[_0xa60c('0x4f')],'loggedIn':_0x4559c5[_0xa60c('0x50')],'name':_0x4559c5[_0xa60c('0x51')],'paused':_0x4559c5['paused'],'waiting':_0x4559c5['waiting']};_0x578988[_0xa60c('0x1f')](_0xc30f12);}}_0x3ffb2f({'count':_0x578988[_0xa60c('0x18')],'rows':_0x578988});});},'OpenchannelQueues':function(){return new Promise(function(_0x5058f3){var _0x46265e=[];for(var _0x26f8b6 in _0x1a9fef[_0xa60c('0x55')]){if(_0x1a9fef['openchannelQueues'][_0xa60c('0x49')](_0x26f8b6)){var _0x4f4b98=_0x1a9fef[_0xa60c('0x55')][_0x26f8b6];var _0x15b118={'id':_0x4f4b98['id'],'available':_0x4f4b98['available'],'loggedIn':_0x4f4b98[_0xa60c('0x50')],'name':_0x4f4b98[_0xa60c('0x51')],'paused':_0x4f4b98[_0xa60c('0x52')],'waiting':_0x4f4b98['waiting']};_0x46265e[_0xa60c('0x1f')](_0x15b118);}}_0x5058f3({'count':_0x46265e['length'],'rows':_0x46265e});});},'SmsQueues':function(){return new Promise(function(_0x507c61){var _0x539202=[];for(var _0x361a5a in _0x1a9fef[_0xa60c('0x56')]){if(_0x1a9fef[_0xa60c('0x56')]['hasOwnProperty'](_0x361a5a)){var _0x3e79c4=_0x1a9fef[_0xa60c('0x56')][_0x361a5a];var _0x55467c={'id':_0x3e79c4['id'],'available':_0x3e79c4[_0xa60c('0x4f')],'loggedIn':_0x3e79c4[_0xa60c('0x50')],'name':_0x3e79c4['name'],'paused':_0x3e79c4[_0xa60c('0x52')],'waiting':_0x3e79c4[_0xa60c('0x53')]};_0x539202[_0xa60c('0x1f')](_0x55467c);}}_0x507c61({'count':_0x539202[_0xa60c('0x18')],'rows':_0x539202});});},'FaxQueues':function(){return new Promise(function(_0x2ac78a){var _0x4fa60a=[];for(var _0x47013f in _0x1a9fef['faxQueues']){if(_0x1a9fef['faxQueues'][_0xa60c('0x49')](_0x47013f)){var _0xcd5f45=_0x1a9fef[_0xa60c('0x57')][_0x47013f];var _0x23794c={'id':_0xcd5f45['id'],'available':_0xcd5f45[_0xa60c('0x4f')],'loggedIn':_0xcd5f45[_0xa60c('0x50')],'name':_0xcd5f45[_0xa60c('0x51')],'paused':_0xcd5f45[_0xa60c('0x52')],'waiting':_0xcd5f45[_0xa60c('0x53')]};_0x4fa60a[_0xa60c('0x1f')](_0x23794c);}}_0x2ac78a({'count':_0x4fa60a[_0xa60c('0x18')],'rows':_0x4fa60a});});},'WhatsappQueues':function(){return new Promise(function(_0x50bcc4){var _0x3328c3=[];for(var _0x4aa17e in _0x1a9fef[_0xa60c('0x58')]){if(_0x1a9fef[_0xa60c('0x58')][_0xa60c('0x49')](_0x4aa17e)){var _0x33a7fd=_0x1a9fef[_0xa60c('0x58')][_0x4aa17e];var _0x27b801={'id':_0x33a7fd['id'],'available':_0x33a7fd[_0xa60c('0x4f')],'loggedIn':_0x33a7fd[_0xa60c('0x50')],'name':_0x33a7fd[_0xa60c('0x51')],'paused':_0x33a7fd[_0xa60c('0x52')],'waiting':_0x33a7fd[_0xa60c('0x53')]};_0x3328c3[_0xa60c('0x1f')](_0x27b801);}}_0x50bcc4({'count':_0x3328c3[_0xa60c('0x18')],'rows':_0x3328c3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5e60f9){var _0x4f8f5d=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5a')]);_0x5e60f9({'count':_0x4f8f5d['length'],'rows':_0x4f8f5d});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x291779){var _0x38f896=_['values'](_0x1a9fef[_0xa60c('0x5b')]);_0x291779({'count':_0x38f896[_0xa60c('0x18')],'rows':_0x38f896});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x57f3cd){var _0x35aa45=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5c')]);_0x57f3cd({'count':_0x35aa45[_0xa60c('0x18')],'rows':_0x35aa45});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3fc556){var _0x36bb0c=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5d')]);_0x3fc556({'count':_0x36bb0c[_0xa60c('0x18')],'rows':_0x36bb0c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x52b8d2){var _0x34b0a4=_[_0xa60c('0x59')](_0x1a9fef['faxQueuesWaitingInteractions']);_0x52b8d2({'count':_0x34b0a4[_0xa60c('0x18')],'rows':_0x34b0a4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x20eba1){var _0xbb8a31=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5e')]);_0x20eba1({'count':_0xbb8a31['length'],'rows':_0xbb8a31});});}};var _0x56efa0=jayson[_0xa60c('0x5f')](_0xe3bd09)[_0xa60c('0x60')]();_0x56efa0['on'](_0xa60c('0x3d'),function(_0x56a787){logger[_0xa60c('0x3d')](JSON[_0xa60c('0x38')](_0x56a787));return _0x2a8a49(_0x56a787);});_0x56efa0[_0xa60c('0x13')](0x232c,_0xa60c('0x61'),function(){console[_0xa60c('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x37c668(_0xa60c('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1bb0150..2ae4f5c 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 _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 +var _0x4120=['all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','format','[%s][INTERVAL]\x20%s'];(function(_0x759f5b,_0x314bd8){var _0x3b73b4=function(_0x21e68c){while(--_0x21e68c){_0x759f5b['push'](_0x759f5b['shift']());}};_0x3b73b4(++_0x314bd8);}(_0x4120,0x1b7));var _0x0412=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4120[_0x37bd26];return _0xe83dc4;};'use strict';var util=require('util');var BPromise=require(_0x0412('0x0'));var jayson=require(_0x0412('0x1'));var _=require(_0x0412('0x2'));var logger=require(_0x0412('0x3'))(_0x0412('0x4'));var client=jayson[_0x0412('0x5')]['http']({'port':0x232a});function request(_0x145559,_0x47f566){return new BPromise(function(_0x42d121,_0x24d333){return client[_0x0412('0x6')](_0x145559,_0x47f566)[_0x0412('0x7')](function(_0x15a2e5){if(_0x15a2e5[_0x0412('0x8')]){return _0x24d333(_0x15a2e5['error'][_0x0412('0x9')]);}else{return _0x42d121(_0x15a2e5[_0x0412('0xa')]);}})[_0x0412('0xb')](function(_0x3af258){return _0x24d333(_0x3af258);});});}exports['condition']=function(_0x52e7a6,_0x233aa9,_0x5d5614){return function(_0xeae84e){if(_0x5d5614['rules']&&!_0x5d5614[_0x0412('0xc')][_0x52e7a6]){logger[_0x0412('0xd')](_0x0412('0xe'),_0x52e7a6);return _0xeae84e['stop']();}var _0x1bbf7=[];for(var _0x13ff65=0x0;_0x13ff65<_0x233aa9['length'];_0x13ff65+=0x1){_0x1bbf7['push'](request('Command',{'command':util[_0x0412('0xf')]('iftime\x20%s',_0x233aa9[_0x13ff65])})[_0x0412('0x7')](function(_0x4c7d1a){return _0x4c7d1a&&_0x4c7d1a['message']&&_0x4c7d1a[_0x0412('0x9')]['indexOf']('true')>=0x0?!![]:![];})['catch'](function(){logger[_0x0412('0x8')](_0x0412('0x10'),_0x52e7a6,_0x233aa9[_0x13ff65]);}));}BPromise[_0x0412('0x11')](_0x1bbf7)['then'](function(_0x563ec9){var _0x52d6a9=_[_0x0412('0x12')](_0x563ec9);logger[_0x0412('0xd')](_0x0412('0x13'),_0x52e7a6,_0x233aa9['join'](_0x0412('0x14')),_0x52d6a9);_0xeae84e[_0x0412('0x15')](_0x52d6a9);})[_0x0412('0xb')](function(_0x207837){logger[_0x0412('0x8')](_0x0412('0x13'),_0x52e7a6,_0x233aa9[_0x0412('0x16')]('\x20|\x20'),_0x207837[_0x0412('0x17')]);_0xeae84e['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index fb52aeb..c2d1fa8 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 _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 +var _0xd64b=['[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','complete','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten'];(function(_0x476cc5,_0x151f9e){var _0x57dce3=function(_0x2d21b1){while(--_0x2d21b1){_0x476cc5['push'](_0x476cc5['shift']());}};_0x57dce3(++_0x151f9e);}(_0xd64b,0xc1));var _0xbd64=function(_0x5b162f,_0x4cc7bd){_0x5b162f=_0x5b162f-0x0;var _0x2881a1=_0xd64b[_0x5b162f];return _0x2881a1;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var utils=require(_0xbd64('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4bfb7c,_0x30b9b3){utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x4'),_0x4bfb7c[_0xbd64('0x5')],_0x4bfb7c['channel'],_0x4bfb7c['queue'],_0x4bfb7c['membername'],_0x4bfb7c['interface'],_0x4bfb7c[_0xbd64('0x6')],_0x4bfb7c[_0xbd64('0x7')],_0x4bfb7c[_0xbd64('0x8')]));if(_0x4bfb7c[_0xbd64('0x9')]){utils[_0xbd64('0xa')](_0x4bfb7c[_0xbd64('0x9')])[_0xbd64('0xb')](function(_0x5d32b8){if(_0x5d32b8){_0x4bfb7c['type']=_0x5d32b8[_0xbd64('0xc')];_0x4bfb7c[_0xbd64('0xd')]=_0x4bfb7c[_0xbd64('0xe')]?_0x5d32b8['acw']:![];_0x4bfb7c[_0xbd64('0xf')]=_0x4bfb7c[_0xbd64('0xd')]?_0x5d32b8[_0xbd64('0x10')]:0x0;}utils[_0xbd64('0x11')]('CreateVoiceAgentReport',_0x4bfb7c);});}else{utils[_0xbd64('0x11')]('CreateVoiceAgentReport',_0x4bfb7c);}if(_0x30b9b3){delete transfers[_0x4bfb7c[_0xbd64('0x5')]];}else{delete agents[_0x4bfb7c[_0xbd64('0x12')]];}}exports[_0xbd64('0x13')]=function(_0x2183e2){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x15'),_0x2183e2[_0xbd64('0x5')]),_0x2183e2);agents[_0x2183e2[_0xbd64('0x12')]]=_0x2183e2;agents[_0x2183e2['destuniqueid']][_0xbd64('0x16')]=utils[_0xbd64('0x17')]();agents[_0x2183e2[_0xbd64('0x12')]][_0xbd64('0x8')]=_0xbd64('0x18');agents[_0x2183e2['destuniqueid']][_0xbd64('0x7')]=null;agents[_0x2183e2['destuniqueid']][_0xbd64('0x19')]=null;utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x1a'),_0x2183e2[_0xbd64('0x5')],agents[_0x2183e2[_0xbd64('0x12')]][_0xbd64('0x1b')],_0x2183e2[_0xbd64('0x12')]));}catch(_0x5d3b00){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')]('[%s][agents][agentcalled]',_0x2183e2['uniqueid']),_0x5d3b00);}};exports[_0xbd64('0x1d')]=function(_0x42b328){try{if(!_[_0xbd64('0x1e')](agents[_0x42b328[_0xbd64('0x12')]])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')]('[%s][agents][agentringnoanswer]',_0x42b328['uniqueid']),_0x42b328);utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x1f'),_0x42b328[_0xbd64('0x5')],agents[_0x42b328['destuniqueid']]['membername'],_0x42b328[_0xbd64('0x12')]));agents[_0x42b328['destuniqueid']][_0xbd64('0x1d')]=!![];agents[_0x42b328['destuniqueid']][_0xbd64('0x20')]=utils[_0xbd64('0x17')]();agents[_0x42b328[_0xbd64('0x12')]][_0xbd64('0x8')]='timeout';agents[_0x42b328[_0xbd64('0x12')]][_0xbd64('0x21')]=_0xbd64('0x22');agents[_0x42b328[_0xbd64('0x12')]]['holdtime']=_0x42b328['ringtime']?parseInt(_0x42b328[_0xbd64('0x23')])/0x3e8:0x0;agents[_0x42b328['destuniqueid']]['talktime']=0x0;unanswered[_0xbd64('0x24')](_0x42b328['destuniqueid']);}}catch(_0x3cf5b7){utils['error'](util[_0xbd64('0x3')]('[%s][agents][agentringnoanswer]',_0x42b328[_0xbd64('0x5')]),_0x3cf5b7);}};exports[_0xbd64('0x25')]=function(_0x3be63a){try{_[_0xbd64('0x26')](agents,function(_0x306f19,_0x207ffc){if(_0x306f19['uniqueid']==_0x3be63a[_0xbd64('0x5')]&&!_[_0xbd64('0x27')](unanswered,_0x306f19[_0xbd64('0x12')])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x28'),_0x3be63a['uniqueid']),_0x3be63a);utils['info'](util[_0xbd64('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3be63a[_0xbd64('0x5')],_0x306f19[_0xbd64('0x1b')],_0x306f19['destuniqueid']));_0x306f19['agentringnoanswer']=!![];_0x306f19[_0xbd64('0x20')]=utils['now']();_0x306f19['lastevent']=_0xbd64('0x29');_0x306f19[_0xbd64('0x21')]=_0xbd64('0x29');_0x306f19['holdtime']=_0x3be63a[_0xbd64('0x2a')];_0x306f19['talktime']=0x0;writeDB(_0x306f19);}});}catch(_0x1fc9cf){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x28'),_0x3be63a[_0xbd64('0x5')]),_0x1fc9cf);}};exports[_0xbd64('0x2b')]=function(_0x513339){try{if(agents[_0x513339['destuniqueid']]){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x2c'),_0x513339[_0xbd64('0x5')]),_0x513339);utils[_0xbd64('0x2')](util[_0xbd64('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513339['uniqueid'],agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x1b')],_0x513339[_0xbd64('0x12')]));agents[_0x513339['destuniqueid']]['agentconnectAt']=utils[_0xbd64('0x17')]();agents[_0x513339['destuniqueid']][_0xbd64('0x7')]=_0x513339['connectedlinenum'];agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x19')]=_0x513339['connectedlinename'];agents[_0x513339[_0xbd64('0x12')]]['holdtime']=_0x513339['ringtime'];agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x8')]=_0xbd64('0x2d');_['forIn'](agents,function(_0x540e2a,_0x5d6bcf){if(_0x540e2a[_0xbd64('0x12')]!=_0x513339[_0xbd64('0x12')]&&_0x540e2a['uniqueid']==_0x513339[_0xbd64('0x5')]){_0x540e2a[_0xbd64('0x2e')]=0x0;_0x540e2a[_0xbd64('0x2a')]=_0x513339[_0xbd64('0x23')];_0x540e2a['agentringnoanswer']=!![];_0x540e2a['agentringnoanswerAt']=utils[_0xbd64('0x17')]();_0x540e2a['lastevent']='answered_elsewhere';_0x540e2a[_0xbd64('0x21')]=_0xbd64('0x2f');_0x540e2a[_0xbd64('0x30')]=_0x513339[_0xbd64('0x12')];_0x540e2a[_0xbd64('0x31')]=_0x513339[_0xbd64('0x1b')];writeDB(_0x540e2a);}});}}catch(_0x247775){utils[_0xbd64('0x1c')](util['format'](_0xbd64('0x2c'),_0x513339[_0xbd64('0x5')]),_0x247775);}};exports['agentcomplete']=function(_0x41b27a){try{if(!_[_0xbd64('0x1e')](agents[_0x41b27a[_0xbd64('0x12')]])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x32'),_0x41b27a[_0xbd64('0x5')]),_0x41b27a);utils['info'](util[_0xbd64('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x41b27a[_0xbd64('0x5')],agents[_0x41b27a['destuniqueid']][_0xbd64('0x1b')],_0x41b27a[_0xbd64('0x12')]));agents[_0x41b27a[_0xbd64('0x12')]]['agentcomplete']=!![];agents[_0x41b27a[_0xbd64('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x41b27a['destuniqueid']][_0xbd64('0x2e')]=utils[_0xbd64('0x33')](agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x34')],agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x35')]);agents[_0x41b27a[_0xbd64('0x12')]]['reason']=_0x41b27a[_0xbd64('0x21')];agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x8')]='complete';writeDB(agents[_0x41b27a[_0xbd64('0x12')]]);}}catch(_0x436f36){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x32'),_0x41b27a['uniqueid']),_0x436f36);}};exports[_0xbd64('0x36')]=function(_0x1a9ec8){try{if(!_[_0xbd64('0x1e')](agents[_0x1a9ec8[_0xbd64('0x37')]])){utils['debug'](util['format'](_0xbd64('0x38'),_0x1a9ec8[_0xbd64('0x5')]),_0x1a9ec8);utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x39'),_0x1a9ec8[_0xbd64('0x5')],agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x1b')],agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x5')]));agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x3a')]=!![];agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x3b')]=_0xbd64('0x3c');agents[_0x1a9ec8['transfereruniqueid']][_0xbd64('0x3d')]=_0x1a9ec8['extension'];agents[_0x1a9ec8['transfereruniqueid']]['transferuniqueid']=agents[_0x1a9ec8['transfereruniqueid']][_0xbd64('0x5')];}}catch(_0x2f56df){utils['error'](util[_0xbd64('0x3')](_0xbd64('0x38'),_0x1a9ec8[_0xbd64('0x5')]),_0x2f56df);}};exports['attendedtransfer']=function(_0x2c42fd){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x3e'),_0x2c42fd[_0xbd64('0x3f')]),_0x2c42fd);if(_0x2c42fd[_0xbd64('0x3f')]==_0x2c42fd['origtransfererlinkedid']){if(!_['isNil'](agents[_0x2c42fd['secondtransfereruniqueid']])){utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x40'),_0x2c42fd[_0xbd64('0x3f')],agents[_0x2c42fd['secondtransfereruniqueid']][_0xbd64('0x1b')]));agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x3a')]=!![];agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x3b')]=_0xbd64('0x42');agents[_0x2c42fd['secondtransfereruniqueid']][_0xbd64('0x3d')]=_0x2c42fd[_0xbd64('0x43')];agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x44')]=_0x2c42fd[_0xbd64('0x3f')];}if(_0x2c42fd[_0xbd64('0x45')]&&agents[_0x2c42fd[_0xbd64('0x45')]]){agents[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x46')]=0x1;transfers[_0x2c42fd[_0xbd64('0x45')]]=_[_0xbd64('0x47')](agents[_0x2c42fd[_0xbd64('0x45')]]);transfers[_0x2c42fd['transfereeuniqueid']]['calleridnum']=agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x6')];transfers[_0x2c42fd['transfereeuniqueid']]['calleridname']=agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x48')];transfers[_0x2c42fd['transfereeuniqueid']][_0xbd64('0x16')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x35')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x2a')]=0x0;transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x46')]=0x2;}}else if(_0x2c42fd['secondtransfereruniqueid']==_0x2c42fd[_0xbd64('0x49')]){if(!_[_0xbd64('0x1e')](agents[_0x2c42fd[_0xbd64('0x3f')]])){utils['info'](util[_0xbd64('0x3')](_0xbd64('0x40'),_0x2c42fd['origtransfereruniqueid'],agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x1b')]));agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3a')]=!![];agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3b')]='ATTENDED';agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3d')]=_0x2c42fd[_0xbd64('0x4a')];agents[_0x2c42fd[_0xbd64('0x3f')]]['transferuniqueid']=_0x2c42fd[_0xbd64('0x41')];}if(_0x2c42fd[_0xbd64('0x4b')]&&agents[_0x2c42fd['transfertargetuniqueid']]){agents[_0x2c42fd[_0xbd64('0x4b')]]['agententerreason']=0x1;transfers[_0x2c42fd[_0xbd64('0x4b')]]=_[_0xbd64('0x47')](agents[_0x2c42fd[_0xbd64('0x4b')]]);transfers[_0x2c42fd[_0xbd64('0x4b')]]['calleridnum']=agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x6')];transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x48')]=agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x48')];transfers[_0x2c42fd['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x35')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x2a')]=0x0;transfers[_0x2c42fd[_0xbd64('0x4b')]]['agententerreason']=0x2;}}}catch(_0x30eddc){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x3e'),_0x2c42fd[_0xbd64('0x3f')]),_0x30eddc);}};exports[_0xbd64('0x4c')]=function(_0x2f3516){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x4d'),_0x2f3516[_0xbd64('0x5')]),_0x2f3516);if(agents[_0x2f3516[_0xbd64('0x5')]]&&agents[_0x2f3516['uniqueid']]['reason']===_0xbd64('0x22')){if(_0x2f3516[_0xbd64('0x4e')]==='21'){agents[_0x2f3516[_0xbd64('0x5')]]['reason']=_0xbd64('0x4f');agents[_0x2f3516['uniqueid']][_0xbd64('0x8')]=_0xbd64('0x4f');}utils[_0xbd64('0x2')](util[_0xbd64('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2f3516[_0xbd64('0x5')],agents[_0x2f3516['uniqueid']][_0xbd64('0x1b')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(agents[_0x2f3516['uniqueid']]);var _0x43780f=unanswered[_0xbd64('0x50')](_0x2f3516['uniqueid']);if(_0x43780f>-0x1){unanswered[_0xbd64('0x51')](_0x43780f,0x1);}}if(transfers[_0x2f3516[_0xbd64('0x5')]]){transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0xe')]=!![];transfers[_0x2f3516['uniqueid']][_0xbd64('0x34')]=utils['now']();transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x2e')]=utils[_0xbd64('0x33')](transfers[_0x2f3516['uniqueid']]['agentcompleteAt'],transfers[_0x2f3516['uniqueid']]['agentconnectAt']);transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')]=_0xbd64('0x52');transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]='complete';utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x53'),_0x2f3516[_0xbd64('0x5')],transfers[_0x2f3516[_0xbd64('0x5')]]['membername'],transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(transfers[_0x2f3516['uniqueid']],!![]);}if(agents[_0x2f3516['uniqueid']]&&agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x35')]){agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0xe')]=!![];agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x34')]=utils[_0xbd64('0x17')]();agents[_0x2f3516[_0xbd64('0x5')]]['talktime']=utils[_0xbd64('0x33')](agents[_0x2f3516['uniqueid']][_0xbd64('0x34')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x35')]);agents[_0x2f3516['uniqueid']][_0xbd64('0x21')]=agents[_0x2f3516['uniqueid']]['transfer']?_0xbd64('0x3a'):_0xbd64('0x52');agents[_0x2f3516[_0xbd64('0x5')]]['lastevent']=_0xbd64('0x54');utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x53'),_0x2f3516['uniqueid'],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x1b')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(agents[_0x2f3516[_0xbd64('0x5')]]);}}catch(_0x439bbd){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x4d'),_0x2f3516[_0xbd64('0x5')]),_0x439bbd);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 2647e64..ea08091 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 _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 +var _0x5a69=['connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','lastIndexOf','includes','noop','execif','lastdata','lodash','util','./utils','NO\x20ANSWER','BUSY','FAILED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum'];(function(_0x491ed9,_0x526af9){var _0x6a3002=function(_0x1a51f7){while(--_0x1a51f7){_0x491ed9['push'](_0x491ed9['shift']());}};_0x6a3002(++_0x526af9);}(_0x5a69,0x19b));var _0x95a6=function(_0x440201,_0x61b02e){_0x440201=_0x440201-0x0;var _0x208fc8=_0x5a69[_0x440201];return _0x208fc8;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var utils=require(_0x95a6('0x2'));var dispositions=[_0x95a6('0x3'),'FAILED','FAILED',_0x95a6('0x3'),_0x95a6('0x3'),_0x95a6('0x3'),'ANSWERED',_0x95a6('0x4'),_0x95a6('0x5'),_0x95a6('0x5'),_0x95a6('0x5')];var channels={};function writeDB(_0x22fdd5){utils['info'](util[_0x95a6('0x6')](_0x95a6('0x7'),_0x22fdd5[_0x95a6('0x8')],_0x22fdd5['channel'],_0x22fdd5[_0x95a6('0x9')],_0x22fdd5[_0x95a6('0xa')],_0x22fdd5[_0x95a6('0xb')],_0x22fdd5[_0x95a6('0xc')],_0x22fdd5[_0x95a6('0xd')],_0x22fdd5[_0x95a6('0xe')]));if(_0x22fdd5[_0x95a6('0xf')]){utils[_0x95a6('0x10')](_0x22fdd5['accountcode'])[_0x95a6('0x11')](function(_0x3c88b3){if(_0x3c88b3){_0x22fdd5['UserId']=_0x3c88b3['id'];}utils['request'](_0x95a6('0x12'),_0x22fdd5);});}else{utils[_0x95a6('0x13')](_0x95a6('0x12'),_0x22fdd5);}if(channels[_0x22fdd5['uniqueid']]){delete channels[_0x22fdd5[_0x95a6('0x8')]];}}exports[_0x95a6('0x14')]=function(_0x4429fd){try{utils[_0x95a6('0x15')](util[_0x95a6('0x6')]('[%s][calls][newchannel]',_0x4429fd['uniqueid']),_0x4429fd);if(_0x4429fd[_0x95a6('0x8')]==_0x4429fd[_0x95a6('0x16')]&&_0x4429fd['channel']!=_0x95a6('0x17')){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x19'),_0x4429fd['uniqueid'],_0x4429fd[_0x95a6('0x1a')],_0x4429fd['exten']));channels[_0x4429fd['uniqueid']]={'uniqueid':_0x4429fd[_0x95a6('0x8')],'accountcode':_0x4429fd[_0x95a6('0xf')],'source':_0x4429fd[_0x95a6('0xc')],'destination':_0x4429fd[_0x95a6('0x1b')],'destinationcontext':_0x4429fd[_0x95a6('0x1a')],'channel':_0x4429fd[_0x95a6('0x1c')],'starttime':utils[_0x95a6('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x95a6('0x1e')};}}catch(_0x455a34){utils[_0x95a6('0x1f')](util['format'](_0x95a6('0x20'),_0x4429fd[_0x95a6('0x8')]),_0x455a34);}};exports[_0x95a6('0x21')]=function(_0x2db894){try{utils[_0x95a6('0x15')](util[_0x95a6('0x6')]('[%s][calls][newstate]',_0x2db894[_0x95a6('0x8')]),_0x2db894);if(!_[_0x95a6('0x22')](channels[_0x2db894[_0x95a6('0x8')]])&&_0x2db894[_0x95a6('0x23')]==0x6){utils['info'](util[_0x95a6('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2db894[_0x95a6('0x8')],_0x2db894[_0x95a6('0x1a')],_0x2db894[_0x95a6('0x1c')]));if(_[_0x95a6('0x22')](channels[_0x2db894[_0x95a6('0x8')]]['systemanswertime'])){channels[_0x2db894[_0x95a6('0x8')]][_0x95a6('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x2db894[_0x95a6('0x16')]])&&_0x2db894[_0x95a6('0x23')]==0x6&&_0x2db894['context']!=_0x95a6('0x25')){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x26'),_0x2db894['uniqueid'],_0x2db894['linkedid'],_0x2db894[_0x95a6('0x1a')],_0x2db894[_0x95a6('0x1c')]));channels[_0x2db894[_0x95a6('0x16')]][_0x95a6('0xf')]=_0x2db894[_0x95a6('0xf')];channels[_0x2db894[_0x95a6('0x16')]][_0x95a6('0x27')]=_0x2db894[_0x95a6('0x1c')];if(_[_0x95a6('0x22')](channels[_0x2db894['linkedid']]['answertime'])){channels[_0x2db894[_0x95a6('0x16')]][_0x95a6('0x28')]=utils['now']();}channels[_0x2db894['linkedid']][_0x95a6('0x29')]=dispositions[_['toNumber'](_0x2db894[_0x95a6('0x23')])]||_0x95a6('0x2a');}}catch(_0x4fc40c){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')]('[%s][calls][newstate]',_0x2db894[_0x95a6('0x8')]),_0x4fc40c);}};exports[_0x95a6('0x2b')]=function(_0x109834){try{if(!_['isNil'](channels[_0x109834[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format']('[%s][calls][hangup]',_0x109834[_0x95a6('0x8')]),_0x109834);if(_['isNil'](channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x2c')])){channels[_0x109834['uniqueid']][_0x95a6('0x2c')]=_0x109834['calleridname']+'\x20<'+_0x109834[_0x95a6('0xc')]+'>';}utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x2d'),_0x109834[_0x95a6('0x8')],channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x2c')],_0x109834[_0x95a6('0x2e')]));channels[_0x109834['uniqueid']][_0x95a6('0x2f')]=utils[_0x95a6('0x1d')]();channels[_0x109834[_0x95a6('0x8')]]['duration']=utils['diffTime'](channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x2f')],channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x30')]);channels[_0x109834['uniqueid']][_0x95a6('0x31')]=channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x28')]?utils[_0x95a6('0x32')](channels[_0x109834[_0x95a6('0x8')]]['endtime'],channels[_0x109834[_0x95a6('0x8')]]['answertime']):0x0;writeDB(channels[_0x109834[_0x95a6('0x8')]]);}}catch(_0x2b8ad2){utils['error'](util['format'](_0x95a6('0x33'),_0x109834[_0x95a6('0x8')]),_0x2b8ad2);}};exports[_0x95a6('0x34')]=function(_0x5f551b){try{if(!_[_0x95a6('0x22')](channels[_0x5f551b[_0x95a6('0x35')]])){utils['debug'](util[_0x95a6('0x6')]('[%s][calls][attendedtransfer]',_0x5f551b['origtransfereruniqueid']),_0x5f551b);if(channels[_0x5f551b[_0x95a6('0x35')]][_0x95a6('0x1c')]==_0x5f551b[_0x95a6('0x36')]){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x37'),_0x5f551b[_0x95a6('0x38')],_0x5f551b[_0x95a6('0x35')],_0x5f551b[_0x95a6('0x39')]));channels[_0x5f551b[_0x95a6('0x35')]]['destinationchannel']=_0x5f551b[_0x95a6('0x39')];channels[_0x5f551b['localtwolinkedid']][_0x95a6('0x3a')]=_0x95a6('0x3b');}else if(channels[_0x5f551b[_0x95a6('0x35')]][_0x95a6('0x1c')]=_0x5f551b['transfertargetchannel']){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x37'),_0x5f551b[_0x95a6('0x38')],_0x5f551b[_0x95a6('0x35')],_0x5f551b[_0x95a6('0x3c')]));channels[_0x5f551b[_0x95a6('0x35')]][_0x95a6('0x27')]=_0x5f551b[_0x95a6('0x3c')];channels[_0x5f551b['localtwolinkedid']]['userfield']=_0x95a6('0x3b');}}}catch(_0x9554d8){utils[_0x95a6('0x1f')](util['format'](_0x95a6('0x3d'),_0x5f551b[_0x95a6('0x38')]),_0x9554d8);}};exports[_0x95a6('0x3e')]=function(_0x3a4f6d){try{if(!_['isNil'](channels[_0x3a4f6d[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format'](_0x95a6('0x3f'),_0x3a4f6d['uniqueid']),_0x3a4f6d);channels[_0x3a4f6d[_0x95a6('0x8')]][_0x95a6('0x40')]=utils[_0x95a6('0x1d')]();utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x41'),_0x3a4f6d[_0x95a6('0x8')],channels[_0x3a4f6d[_0x95a6('0x8')]][_0x95a6('0x40')]));}}catch(_0x35d2d0){utils[_0x95a6('0x1f')](util['format'](_0x95a6('0x3f'),_0x3a4f6d[_0x95a6('0x8')]),_0x35d2d0);}};exports[_0x95a6('0x42')]=function(_0x13bff3){try{if(!_[_0x95a6('0x22')](channels[_0x13bff3[_0x95a6('0x8')]])){utils['debug'](util[_0x95a6('0x6')](_0x95a6('0x43'),_0x13bff3[_0x95a6('0x8')]),_0x13bff3);if(!_['isNil'](channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x40')])){channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x44')]+=utils[_0x95a6('0x32')](utils[_0x95a6('0x1d')](),channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x40')]);utils['info'](util[_0x95a6('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x13bff3[_0x95a6('0x8')],channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x44')]));delete channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x40')];}}}catch(_0x154038){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')](_0x95a6('0x43'),_0x13bff3['uniqueid']),_0x154038);}};exports[_0x95a6('0x45')]=function(_0x4a5490){try{if(!_['isNil'](channels[_0x4a5490[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format']('[%s][calls][varset]',_0x4a5490[_0x95a6('0x8')]),_0x4a5490);if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x47')])){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x48'),_0x4a5490[_0x95a6('0x8')],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x49')]=_0x4a5490[_0x95a6('0x4a')];}if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x4b')])){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x4c'),_0x4a5490['uniqueid'],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x4d')]=_0x4a5490[_0x95a6('0x4a')];channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x2c')]='\x22'+_0x4a5490['value']+'\x22\x20<'+_0x4a5490[_0x95a6('0x4a')]+'>';}if(!_['isNil'](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x4e')])||!_['isNil'](_0x4a5490[_0x95a6('0x46')]['xmd-callerid'])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x4f'),_0x4a5490[_0x95a6('0x8')],!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')]['xmd-callerid-preview'])?_0x95a6('0x4e'):_0x95a6('0x50'),_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x2c')]=_0x4a5490[_0x95a6('0x4a')];}if(!_['isNil'](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x51')])||!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x52')])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4a5490[_0x95a6('0x8')],!_['isNil'](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x51')])?'xmd-queue':_0x95a6('0x52'),_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x53')]=_0x95a6('0x54');channels[_0x4a5490[_0x95a6('0x8')]]['lastdata']=_0x4a5490[_0x95a6('0x4a')];channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x9')]=!![];}if(!_[_0x95a6('0x22')](_0x4a5490['variable']['xmd-contactid'])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x55'),_0x4a5490[_0x95a6('0x8')],_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490['uniqueid']][_0x95a6('0x56')]=_0x4a5490[_0x95a6('0x4a')];}if(!_['isNil'](_0x4a5490['variable']['xmd-cdrtype'])){utils['info'](util[_0x95a6('0x6')](_0x95a6('0x57'),_0x4a5490[_0x95a6('0x8')],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x58')]=_0x4a5490[_0x95a6('0x4a')];}if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x59')])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4a5490[_0x95a6('0x8')],_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x5a')]=_0x4a5490[_0x95a6('0x4a')];}if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')]['sipcallid'])){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x5b'),_0x4a5490[_0x95a6('0x8')],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x5c')]=_0x4a5490[_0x95a6('0x4a')];}}}catch(_0xc2e83f){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')]('[%s][calls][varset]',_0x4a5490[_0x95a6('0x8')]),_0xc2e83f);}};exports[_0x95a6('0x5d')]=function(_0x13d312){try{if(!_[_0x95a6('0x22')](channels[_0x13d312[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format'](_0x95a6('0x5e'),_0x13d312[_0x95a6('0x8')]),_0x13d312);utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x5f'),_0x13d312[_0x95a6('0x8')],_0x13d312[_0x95a6('0x60')],_0x13d312[_0x95a6('0x61')]));if(_0x13d312['application'][_0x95a6('0x62')]()==_0x95a6('0x63')&&_['startsWith'](_0x13d312[_0x95a6('0x61')][_0x95a6('0x62')](),_0x95a6('0x64'))){var _0x5d35b1=_0x13d312[_0x95a6('0x61')]['split']('=');var _0x249990=_0x5d35b1[0x0]['substring'](_0x5d35b1[0x0][_0x95a6('0x65')]('(')+0x1,_0x5d35b1[0x0]['lastIndexOf'](')'));var _0x20f2b9=_0x5d35b1[0x1];channels[_0x13d312[_0x95a6('0x8')]][_0x249990]=_0x20f2b9;}if(!_[_0x95a6('0x66')]([_0x95a6('0x2b'),_0x95a6('0x67'),_0x95a6('0x68'),_0x95a6('0x63'),'gotoif'],_0x13d312[_0x95a6('0x60')]['toLowerCase']())){channels[_0x13d312[_0x95a6('0x8')]]['lastapplication']=_0x13d312[_0x95a6('0x60')];channels[_0x13d312['uniqueid']][_0x95a6('0x69')]=_0x13d312[_0x95a6('0x61')];}}}catch(_0x498f7c){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')](_0x95a6('0x5e'),_0x13d312[_0x95a6('0x8')]),_0x498f7c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b07687c..7c3452a 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 _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 +var _0x176c=['info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','[core]\x20shutdown','fullybooted'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x176c,0x14b));var _0xc176=function(_0x563679,_0x3ed5a5){_0x563679=_0x563679-0x0;var _0x398d95=_0x176c[_0x563679];return _0x398d95;};'use strict';var utils=require(_0xc176('0x0'));exports[_0xc176('0x1')]=function(){utils['info'](_0xc176('0x2'));};exports['shutdown']=function(){utils['info'](_0xc176('0x3'));};exports[_0xc176('0x4')]=function(){utils[_0xc176('0x5')](_0xc176('0x6'));};exports[_0xc176('0x7')]=function(_0x3c66fa){utils[_0xc176('0x7')](_0xc176('0x8'),_0x3c66fa);};exports[_0xc176('0x9')]=function(){utils[_0xc176('0x5')](_0xc176('0xa'));};exports[_0xc176('0xb')]=function(_0x27da56){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2d1e7eb..152e226 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 _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 +var _0xb776=['cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','value','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','cause-txt','diffTime','endtime','holdtime','lodash','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','appdata','application','toLowerCase','startsWith'];(function(_0x3de45a,_0x22c557){var _0x496b8a=function(_0x43c2a3){while(--_0x43c2a3){_0x3de45a['push'](_0x3de45a['shift']());}};_0x496b8a(++_0x22c557);}(_0xb776,0x101));var _0x6b77=function(_0x338211,_0x254dae){_0x338211=_0x338211-0x0;var _0x5deff8=_0xb776[_0x338211];return _0x5deff8;};'use strict';var _=require(_0x6b77('0x0'));var util=require(_0x6b77('0x1'));var utils=require(_0x6b77('0x2'));var dials={};function writeDB(_0x1d766c){utils[_0x6b77('0x3')](util[_0x6b77('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1d766c[_0x6b77('0x5')],_0x1d766c[_0x6b77('0x6')],_0x1d766c[_0x6b77('0x7')],_0x1d766c[_0x6b77('0x8')],_0x1d766c[_0x6b77('0x9')],_0x1d766c[_0x6b77('0xa')]));utils['request'](_0x6b77('0xb'),_0x1d766c);delete dials[_0x1d766c[_0x6b77('0x5')]];}exports[_0x6b77('0xc')]=function(_0x2c80ea){try{utils[_0x6b77('0xd')](util[_0x6b77('0x4')](_0x6b77('0xe'),_0x2c80ea['uniqueid']),_0x2c80ea);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2c80ea[_0x6b77('0x5')],_0x2c80ea['application'],_0x2c80ea[_0x6b77('0xf')]));if(_0x2c80ea[_0x6b77('0x10')][_0x6b77('0x11')]()=='set'&&_[_0x6b77('0x12')](_0x2c80ea['appdata'][_0x6b77('0x11')](),_0x6b77('0x13'))){var _0x9c2080=_0x2c80ea[_0x6b77('0xf')][_0x6b77('0x14')]('=');dials[_0x2c80ea[_0x6b77('0x5')]]={'routeId':_0x9c2080[0x1]};}}catch(_0x2990b6){utils[_0x6b77('0x15')](util[_0x6b77('0x4')]('[%s][dials][newexten]',_0x2c80ea[_0x6b77('0x5')]),_0x2990b6);}};exports[_0x6b77('0x16')]=function(_0x43160b){try{utils['debug'](util[_0x6b77('0x4')](_0x6b77('0x17'),_0x43160b['uniqueid']),_0x43160b);if(!_['isNil'](_0x43160b[_0x6b77('0x18')][_0x6b77('0x19')])){utils[_0x6b77('0x3')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x43160b['uniqueid'],_0x43160b[_0x6b77('0x1a')]));dials[_0x43160b[_0x6b77('0x5')]]={'routeId':_0x43160b['value']};}}catch(_0x5c0f1d){utils[_0x6b77('0x15')](util[_0x6b77('0x4')](_0x6b77('0x17'),_0x43160b[_0x6b77('0x5')]),_0x5c0f1d);}};exports['dialbegin']=function(_0x4ca482){try{if(!_[_0x6b77('0x1b')](dials[_0x4ca482[_0x6b77('0x5')]])){utils['debug'](util['format'](_0x6b77('0x1c'),_0x4ca482[_0x6b77('0x5')]),_0x4ca482);dials[_0x4ca482[_0x6b77('0x5')]]=_['assign'](dials[_0x4ca482[_0x6b77('0x5')]],_0x4ca482);dials[_0x4ca482[_0x6b77('0x5')]][_0x6b77('0x1d')]=utils[_0x6b77('0x1e')]();dials[_0x4ca482['uniqueid']][_0x6b77('0x1f')]='called';utils[_0x6b77('0x3')](util[_0x6b77('0x4')](_0x6b77('0x20'),_0x4ca482['uniqueid'],dials[_0x4ca482[_0x6b77('0x5')]][_0x6b77('0x1d')]));}}catch(_0x49d90d){utils['error'](util[_0x6b77('0x4')](_0x6b77('0x1c'),_0x4ca482[_0x6b77('0x5')]),_0x49d90d);}};exports[_0x6b77('0x21')]=function(_0x584822){try{if(!_[_0x6b77('0x1b')](dials[_0x584822[_0x6b77('0x5')]])){utils[_0x6b77('0xd')](util[_0x6b77('0x4')](_0x6b77('0x22'),_0x584822[_0x6b77('0x5')]),_0x584822);dials[_0x584822[_0x6b77('0x5')]][_0x6b77('0xa')]=_0x584822[_0x6b77('0xa')];if(_0x584822[_0x6b77('0xa')]==_0x6b77('0x23')){dials[_0x584822[_0x6b77('0x5')]]=_[_0x6b77('0x24')](dials[_0x584822[_0x6b77('0x5')]],_0x584822);dials[_0x584822[_0x6b77('0x5')]][_0x6b77('0x25')]=utils[_0x6b77('0x1e')]();dials[_0x584822[_0x6b77('0x5')]]['lastevent']=_0x6b77('0x26');utils[_0x6b77('0x3')](util[_0x6b77('0x4')](_0x6b77('0x27'),_0x584822[_0x6b77('0x5')],_0x584822['dialstatus'],dials[_0x584822['uniqueid']][_0x6b77('0x25')]));}else{utils[_0x6b77('0x3')](util[_0x6b77('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x584822[_0x6b77('0x5')],_0x584822['dialstatus']));}}}catch(_0xe886e0){utils[_0x6b77('0x15')](util[_0x6b77('0x4')](_0x6b77('0x22'),_0x584822[_0x6b77('0x5')]),_0xe886e0);}};exports[_0x6b77('0x28')]=function(_0x36a4b6){try{if(!_[_0x6b77('0x1b')](dials[_0x36a4b6[_0x6b77('0x5')]])){utils[_0x6b77('0xd')](util['format'](_0x6b77('0x29'),_0x36a4b6[_0x6b77('0x5')]),_0x36a4b6);utils[_0x6b77('0x3')](util[_0x6b77('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x36a4b6[_0x6b77('0x5')],_0x36a4b6['calleridnum'],_0x36a4b6['calleridname'],_0x36a4b6[_0x6b77('0x2a')]));dials[_0x36a4b6[_0x6b77('0x5')]]=_['assign'](dials[_0x36a4b6[_0x6b77('0x5')]],{'endtime':utils[_0x6b77('0x1e')](),'lastevent':'complete'});dials[_0x36a4b6[_0x6b77('0x5')]]['duration']=utils[_0x6b77('0x2b')](dials[_0x36a4b6['uniqueid']][_0x6b77('0x2c')],dials[_0x36a4b6[_0x6b77('0x5')]][_0x6b77('0x1d')]);dials[_0x36a4b6['uniqueid']][_0x6b77('0x2d')]=utils['diffTime'](dials[_0x36a4b6[_0x6b77('0x5')]]['answertime']||dials[_0x36a4b6[_0x6b77('0x5')]][_0x6b77('0x2c')],dials[_0x36a4b6['uniqueid']]['starttime']);dials[_0x36a4b6[_0x6b77('0x5')]]['billableseconds']=dials[_0x36a4b6['uniqueid']]['answertime']?utils[_0x6b77('0x2b')](dials[_0x36a4b6['uniqueid']][_0x6b77('0x2c')],dials[_0x36a4b6[_0x6b77('0x5')]][_0x6b77('0x25')]):0x0;writeDB(dials[_0x36a4b6['uniqueid']]);}}catch(_0x53b76d){utils[_0x6b77('0x15')](util['format'](_0x6b77('0x29'),_0x36a4b6[_0x6b77('0x5')]),_0x53b76d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8ecaec3..e468263 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 _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 +var _0x21a9=['[%s][index][agentcalled]','uniqueid','debug','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','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','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','format'];(function(_0x1c3637,_0x2d04ce){var _0x593979=function(_0xdbcfae){while(--_0xdbcfae){_0x1c3637['push'](_0x1c3637['shift']());}};_0x593979(++_0x2d04ce);}(_0x21a9,0xba));var _0x921a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x21a9[_0x46e363];return _0x3fb059;};var AsteriskManager=require(_0x921a('0x0'));var config=require(_0x921a('0x1'));var utils=require(_0x921a('0x2'));var util=require(_0x921a('0x3'));var isXDREnabled=config[_0x921a('0x4')]&&config[_0x921a('0x4')][_0x921a('0x5')]?!config[_0x921a('0x4')][_0x921a('0x5')]:!![];var isProduction=config[_0x921a('0x6')]===_0x921a('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x921a('0x4')][_0x921a('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x921a('0x9')]['port'],config[_0x921a('0x9')]['ip'],config[_0x921a('0x9')][_0x921a('0xa')],config[_0x921a('0x9')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x921a('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x921a('0xc')](_0x921a('0xd'));}else{var agents=require(_0x921a('0xe'));var calls=require(_0x921a('0xf'));var queues=require(_0x921a('0x10'));var recordings=require(_0x921a('0x11'));var members=require(_0x921a('0x12'));var dials=require(_0x921a('0x13'));var transfers=require(_0x921a('0x14'));var core=require(_0x921a('0x15'));ami['on'](_0x921a('0x16'),core[_0x921a('0x16')]);ami['on'](_0x921a('0x17'),core[_0x921a('0x17')]);ami['on'](_0x921a('0x18'),core[_0x921a('0x18')]);ami['on'](_0x921a('0x19'),core['error']);ami['on'](_0x921a('0x1a'),core[_0x921a('0x1a')]);ami['on'](_0x921a('0x1b'),core['managerevent']);ami['on'](_0x921a('0x1c'),function(_0xebf967){try{utils['debug'](util['format'](_0x921a('0x1d'),_0xebf967[_0x921a('0x1e')]),_0xebf967);members[_0x921a('0x1c')](_0xebf967);}catch(_0x17e39d){utils['error'](util['format']('[%s][index][devicestatechange]',_0xebf967[_0x921a('0x1e')]),_0x17e39d);}});ami['on'](_0x921a('0x1f'),function(_0x3b7d49){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x21'),_0x3b7d49[_0x921a('0x22')]),_0x3b7d49);agents[_0x921a('0x1f')](_0x3b7d49);}catch(_0x519bfa){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x21'),_0x3b7d49['uniqueid']),_0x519bfa);}});ami['on']('agentringnoanswer',function(_0x52121c){try{utils[_0x921a('0x23')](util[_0x921a('0x20')]('[%s][index][agentringnoanswer]',_0x52121c[_0x921a('0x22')]),_0x52121c);agents[_0x921a('0x24')](_0x52121c);}catch(_0x25234d){utils['error'](util[_0x921a('0x20')](_0x921a('0x25'),_0x52121c[_0x921a('0x22')]),_0x25234d);}});ami['on']('agentconnect',function(_0x43e278){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x26'),_0x43e278[_0x921a('0x22')]),_0x43e278);agents[_0x921a('0x27')](_0x43e278);queues[_0x921a('0x27')](_0x43e278);}catch(_0xe9d298){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x26'),_0x43e278[_0x921a('0x22')]),_0xe9d298);}});ami['on'](_0x921a('0x28'),function(_0x407b2e){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x29'),_0x407b2e[_0x921a('0x22')]),_0x407b2e);agents[_0x921a('0x28')](_0x407b2e);queues[_0x921a('0x28')](_0x407b2e);members['agentcomplete'](_0x407b2e);}catch(_0x41bbdb){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x29'),_0x407b2e[_0x921a('0x22')]),_0x41bbdb);}});ami['on']('queuecallerabandon',function(_0x2e15cf){try{utils[_0x921a('0x23')](util[_0x921a('0x20')]('[%s][index][queuecallerabandon]',_0x2e15cf[_0x921a('0x22')]),_0x2e15cf);agents[_0x921a('0x2a')](_0x2e15cf);queues[_0x921a('0x2a')](_0x2e15cf);}catch(_0x3e8568){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x2b'),_0x2e15cf[_0x921a('0x22')]),_0x3e8568);}});ami['on'](_0x921a('0x2c'),function(_0x3a8340){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x2d'),_0x3a8340[_0x921a('0x22')]),_0x3a8340);queues[_0x921a('0x2c')](_0x3a8340);recordings[_0x921a('0x2c')](_0x3a8340);}catch(_0x3d047b){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x2d'),_0x3a8340[_0x921a('0x22')]),_0x3d047b);}});ami['on'](_0x921a('0x2e'),function(_0x2be8b7){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x2f'),_0x2be8b7[_0x921a('0x22')]),_0x2be8b7);queues[_0x921a('0x2e')](_0x2be8b7);}catch(_0x3a6839){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x2f'),_0x2be8b7[_0x921a('0x22')]),_0x3a6839);}});ami['on'](_0x921a('0x30'),function(_0x3647ca){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x31'),_0x3647ca[_0x921a('0x22')]),_0x3647ca);queues[_0x921a('0x30')](_0x3647ca);calls['musiconholdstart'](_0x3647ca);}catch(_0x4be430){utils['error'](util[_0x921a('0x20')](_0x921a('0x31'),_0x3647ca[_0x921a('0x22')]),_0x4be430);}});ami['on'](_0x921a('0x32'),function(_0x505cd7){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x33'),_0x505cd7[_0x921a('0x22')]),_0x505cd7);queues['musiconholdstop'](_0x505cd7);calls[_0x921a('0x32')](_0x505cd7);}catch(_0x4d1a1d){utils[_0x921a('0x19')](util[_0x921a('0x20')]('[%s][index][musiconholdstop]',_0x505cd7[_0x921a('0x22')]),_0x4d1a1d);}});ami['on'](_0x921a('0x34'),function(_0x41bc16){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x35'),_0x41bc16[_0x921a('0x22')]),_0x41bc16);calls[_0x921a('0x34')](_0x41bc16);recordings['newstate'](_0x41bc16);}catch(_0x3ab28e){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x35'),_0x41bc16['uniqueid']),_0x3ab28e);}});ami['on'](_0x921a('0x36'),function(_0x17373f){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x37'),_0x17373f['uniqueid']),_0x17373f);calls[_0x921a('0x36')](_0x17373f);recordings['hangup'](_0x17373f);dials[_0x921a('0x36')](_0x17373f);agents[_0x921a('0x36')](_0x17373f);queues['hangup'](_0x17373f);}catch(_0x32f522){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x37'),_0x17373f['uniqueid']),_0x32f522);}});ami['on'](_0x921a('0x38'),function(_0x26158f){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x39'),_0x26158f[_0x921a('0x22')]),_0x26158f);members[_0x921a('0x38')](_0x26158f);}catch(_0x18aa5c){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x39'),_0x26158f[_0x921a('0x22')]),_0x18aa5c);}});ami['on'](_0x921a('0x3a'),function(_0x25aedb){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x3b'),_0x25aedb[_0x921a('0x22')]),_0x25aedb);queues[_0x921a('0x3a')](_0x25aedb);agents[_0x921a('0x3a')](_0x25aedb);transfers[_0x921a('0x3a')](_0x25aedb);}catch(_0x395749){utils[_0x921a('0x19')](util['format'](_0x921a('0x3b'),_0x25aedb['uniqueid']),_0x395749);}});ami['on'](_0x921a('0x3c'),function(_0x249cb9){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x3d'),_0x249cb9[_0x921a('0x3e')]),_0x249cb9);queues[_0x921a('0x3c')](_0x249cb9);transfers[_0x921a('0x3c')](_0x249cb9);agents[_0x921a('0x3c')](_0x249cb9);calls[_0x921a('0x3c')](_0x249cb9);}catch(_0x4e2ed8){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x3d'),_0x249cb9['origtransfereruniqueid']),_0x4e2ed8);}});ami['on'](_0x921a('0x3f'),function(_0x5881e3){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x40'),_0x5881e3['uniqueid']),_0x5881e3);queues[_0x921a('0x3f')](_0x5881e3);recordings[_0x921a('0x3f')](_0x5881e3);calls[_0x921a('0x3f')](_0x5881e3);dials[_0x921a('0x3f')](_0x5881e3);}catch(_0x493ab8){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x40'),_0x5881e3[_0x921a('0x22')]),_0x493ab8);}});ami['on'](_0x921a('0x41'),function(_0x5be271){try{utils['debug'](util['format']('[%s][index][newexten]',_0x5be271[_0x921a('0x22')]),_0x5be271);calls['newexten'](_0x5be271);recordings[_0x921a('0x41')](_0x5be271);dials[_0x921a('0x41')](_0x5be271);}catch(_0x65a9da){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x42'),_0x5be271[_0x921a('0x22')]),_0x65a9da);}});ami['on'](_0x921a('0x43'),function(_0x5b403f){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x44'),_0x5b403f[_0x921a('0x22')]),_0x5b403f);calls[_0x921a('0x43')](_0x5b403f);recordings[_0x921a('0x43')](_0x5b403f);}catch(_0x1f00cb){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x44'),_0x5b403f[_0x921a('0x22')]),_0x1f00cb);}});ami['on'](_0x921a('0x45'),function(_0x5c0b3c){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x46'),_0x5c0b3c[_0x921a('0x22')]),_0x5c0b3c);dials['dialbegin'](_0x5c0b3c);}catch(_0x15b663){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x47'),_0x5c0b3c[_0x921a('0x22')]),_0x15b663);}});ami['on']('dialend',function(_0x1b289d){try{utils['debug'](util[_0x921a('0x20')]('[%s][index][dialend]',_0x1b289d['uniqueid']),_0x1b289d);dials[_0x921a('0x48')](_0x1b289d);}catch(_0x1319f5){utils[_0x921a('0x19')](util['format']('[%s][index][dialend]',_0x1b289d[_0x921a('0x22')]),_0x1319f5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 51c3d40..4e7259b 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 _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 +var _0x32f6=['format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','type','interface','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','some','startsWith','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','agent','isNil','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','data1','./utils','Local/_attended@transfer','info'];(function(_0x46f157,_0x25ee0e){var _0x8f305a=function(_0xcad742){while(--_0xcad742){_0x46f157['push'](_0x46f157['shift']());}};_0x8f305a(++_0x25ee0e);}(_0x32f6,0xbd));var _0x632f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x32f6[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x632f('0x0'));var members={};var exclude=[_0x632f('0x1'),'Queue:'];function writeDB(_0x4338c6){utils[_0x632f('0x2')](util[_0x632f('0x3')](_0x632f('0x4'),_0x4338c6[_0x632f('0x5')],_0x4338c6['interface'],_0x4338c6['channel'],_0x4338c6['data2'],_0x4338c6['membername'],_0x4338c6[_0x632f('0x6')]));if(_0x4338c6[_0x632f('0x7')]){utils[_0x632f('0x8')](_0x4338c6[_0x632f('0x7')])[_0x632f('0x9')](function(_0x3b07a3){if(_0x3b07a3){_0x4338c6[_0x632f('0xa')]=_0x3b07a3[_0x632f('0xb')];_0x4338c6[_0x632f('0xc')]=_0x3b07a3['internal'];utils[_0x632f('0xd')](_0x632f('0xe'),_0x4338c6);}else{utils['getUserByName'](_0x4338c6['interface']['split']('/')[0x1])['then'](function(_0x74a7d7){if(_0x74a7d7){_0x4338c6['membername']=_0x74a7d7[_0x632f('0xb')];_0x4338c6[_0x632f('0xc')]=_0x74a7d7[_0x632f('0xc')];utils['request']('CreateMemberReport',_0x4338c6);}});}})['catch'](function(_0x50df7e){utils['error'](util['format']('[%s][members][writeDB]',_0x4338c6[_0x632f('0x5')]),_0x50df7e);});}delete members[_0x4338c6[_0x632f('0x7')]];}function startsWith(_0x5754c6,_0x1fa404){return _[_0x632f('0xf')](_0x5754c6,function(_0x1bdbc0){return _[_0x632f('0x10')](_0x1fa404,_0x1bdbc0);});}exports['devicestatechange']=function(_0xa81024){try{utils[_0x632f('0x11')](util[_0x632f('0x3')](_0x632f('0x12'),members[_0xa81024[_0x632f('0x13')]]?members[_0xa81024[_0x632f('0x13')]]['uniqueid']:_0xa81024[_0x632f('0x13')]),_0xa81024);utils[_0x632f('0x2')](util[_0x632f('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xa81024['device']]?members[_0xa81024['device']][_0x632f('0x5')]:_0xa81024[_0x632f('0x13')],_0xa81024[_0x632f('0x14')],_0xa81024[_0x632f('0x13')]));switch(_0xa81024[_0x632f('0x14')]){case'INUSE':case _0x632f('0x15'):if(!startsWith(exclude,_0xa81024['device'])){members[_0xa81024[_0x632f('0x13')]]={'channel':_0x632f('0x16'),'interface':_0xa81024[_0x632f('0x13')],'type':_0x632f('0x17'),'enterAt':utils['now'](),'role':_0x632f('0x18')};}break;case'NOT_INUSE':if(!_[_0x632f('0x19')](members[_0xa81024['device']])){members[_0xa81024['device']][_0x632f('0x1a')]=utils[_0x632f('0x1b')]();members[_0xa81024[_0x632f('0x13')]][_0x632f('0x1c')]=utils[_0x632f('0x1d')](members[_0xa81024['device']][_0x632f('0x1a')],members[_0xa81024['device']][_0x632f('0x1e')]);if(members[_0xa81024[_0x632f('0x13')]][_0x632f('0x5')]){writeDB(members[_0xa81024[_0x632f('0x13')]]);}}break;default:break;}}catch(_0x217d78){utils[_0x632f('0x1f')](util['format']('[%s][members][devicestatechange]',members[_0xa81024[_0x632f('0x13')]]?members[_0xa81024[_0x632f('0x13')]][_0x632f('0x5')]:_0xa81024[_0x632f('0x13')]),_0x217d78);}};exports[_0x632f('0x20')]=function(_0x1014ba){try{if(!_[_0x632f('0x19')](members[_0x1014ba[_0x632f('0x7')]])){utils[_0x632f('0x11')](util[_0x632f('0x3')]('[%s][members][agentcomplete]',_0x1014ba[_0x632f('0x5')]),_0x1014ba);utils[_0x632f('0x2')](util[_0x632f('0x3')](_0x632f('0x21'),_0x1014ba['uniqueid'],_0x1014ba['interface'],_0x1014ba[_0x632f('0x22')]));members[_0x1014ba[_0x632f('0x7')]]=_[_0x632f('0x23')](members[_0x1014ba[_0x632f('0x7')]],{'data4':_0x1014ba[_0x632f('0x22')],'uniqueid':_0x1014ba[_0x632f('0x5')]});}}catch(_0xb0572f){utils[_0x632f('0x1f')](util[_0x632f('0x3')](_0x632f('0x24'),_0x1014ba[_0x632f('0x5')]),_0xb0572f);}};exports[_0x632f('0x25')]=function(_0x14d689){try{utils['debug'](util['format'](_0x632f('0x26'),_0x14d689['uniqueid']),_0x14d689);if(_0x14d689['channel']){var _0x490959=_0x14d689[_0x632f('0x27')]['split']('-')[0x0];if(!_[_0x632f('0x19')](members[_0x490959])){members[_0x490959]=_[_0x632f('0x23')](members[_0x490959],{'data1':members[_0x490959]['data1']||_0x14d689[_0x632f('0x6')],'data2':members[_0x490959][_0x632f('0x28')]||_0x14d689[_0x632f('0x29')],'data3':members[_0x490959][_0x632f('0x2a')]||_0x14d689[_0x632f('0x2b')],'uniqueid':members[_0x490959][_0x632f('0x5')]||_0x14d689['uniqueid']});utils['info'](util['format'](_0x632f('0x2c'),_0x14d689['uniqueid'],members[_0x490959]['data1'],members[_0x490959]['data2'],members[_0x490959][_0x632f('0x2a')]));if(members[_0x490959][_0x632f('0x1a')]){writeDB(members[_0x490959]);}}}if(_0x14d689[_0x632f('0x2d')]){var _0x29ae69=_0x14d689['destinationchannel'][_0x632f('0x2e')]('-')[0x0];if(!_[_0x632f('0x19')](members[_0x29ae69])){members[_0x29ae69]=_[_0x632f('0x23')](members[_0x29ae69],{'data1':members[_0x29ae69]['data1']||_0x14d689[_0x632f('0x6')],'data2':members[_0x29ae69][_0x632f('0x28')]||_0x14d689[_0x632f('0x29')],'data3':members[_0x29ae69]['data3']||_0x14d689[_0x632f('0x2b')],'uniqueid':members[_0x29ae69]['uniqueid']||_0x14d689['uniqueid']});utils[_0x632f('0x2')](util['format'](_0x632f('0x2c'),_0x14d689[_0x632f('0x5')],members[_0x29ae69][_0x632f('0x2f')],members[_0x29ae69]['data2'],members[_0x29ae69]['data3']));if(members[_0x29ae69][_0x632f('0x1a')]){writeDB(members[_0x29ae69]);}}}}catch(_0x5a4218){utils[_0x632f('0x1f')](util[_0x632f('0x3')]('[%s][members][cdr]',_0x14d689[_0x632f('0x5')]),_0x5a4218);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 8b8caf0..83e23f7 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 _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 +var _0xa077=['secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','value','queuecallerabandon','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','error','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferexten','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid'];(function(_0x72493a,_0x158721){var _0x4c6027=function(_0x471e97){while(--_0x471e97){_0x72493a['push'](_0x72493a['shift']());}};_0x4c6027(++_0x158721);}(_0xa077,0x73));var _0x7a07=function(_0x5bc489,_0x4fbbcf){_0x5bc489=_0x5bc489-0x0;var _0x4a558f=_0xa077[_0x5bc489];return _0x4a558f;};'use strict';var _=require(_0x7a07('0x0'));var util=require(_0x7a07('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1e1733){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1e1733[_0x7a07('0x2')],_0x1e1733[_0x7a07('0x3')],_0x1e1733[_0x7a07('0x4')],_0x1e1733['lastAssignedTo'],_0x1e1733[_0x7a07('0x5')],_0x1e1733[_0x7a07('0x6')],_0x1e1733[_0x7a07('0x7')]));if(_0x1e1733[_0x7a07('0x4')]){utils[_0x7a07('0x8')](_0x1e1733['queue'])[_0x7a07('0x9')](function(_0x5e9c10){if(_0x5e9c10){_0x1e1733[_0x7a07('0xa')]=_0x5e9c10['type'];}utils[_0x7a07('0xb')](_0x7a07('0xc'),_0x1e1733);});}else{utils[_0x7a07('0xb')](_0x7a07('0xc'),_0x1e1733);}if(_0x1e1733[_0x7a07('0xd')]){delete queues[_0x1e1733[_0x7a07('0xd')]];}else{delete queues[_0x1e1733['uniqueid']];}}exports[_0x7a07('0xe')]=function(_0x5585c1){try{utils[_0x7a07('0xf')](util[_0x7a07('0x10')](_0x7a07('0x11'),_0x5585c1[_0x7a07('0x2')]),_0x5585c1);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x13'),_0x5585c1[_0x7a07('0x2')],_0x5585c1[_0x7a07('0x4')],_0x5585c1[_0x7a07('0x14')]));queues[_0x5585c1[_0x7a07('0x2')]]=_[_0x7a07('0x15')](_0x5585c1,{'originalposition':_0x5585c1[_0x7a07('0x14')],'queuecallerjoinAt':utils[_0x7a07('0x16')](),'mohtime':0x0});}catch(_0x487e90){utils['error'](util[_0x7a07('0x10')](_0x7a07('0x11'),_0x5585c1[_0x7a07('0x2')]),_0x487e90);}};exports[_0x7a07('0x17')]=function(_0x163928){try{if(!_[_0x7a07('0x18')](queues[_0x163928['uniqueid']])){utils[_0x7a07('0xf')](util[_0x7a07('0x10')]('[%s][queues][hangup]',_0x163928[_0x7a07('0x2')]),_0x163928);if(queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x19')]){if(!queues[_0x163928[_0x7a07('0x2')]]['queuecallerabandon']&&!queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1a')]){queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1b')]=!![];queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1c')]=utils[_0x7a07('0x16')]();queues[_0x163928['uniqueid']][_0x7a07('0x7')]=_0x7a07('0x1d');}utils[_0x7a07('0x12')](util['format'](_0x7a07('0x1e'),_0x163928['uniqueid'],queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1f')],queues[_0x163928[_0x7a07('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x163928[_0x7a07('0x2')]]);}else if(queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]){utils['info'](util[_0x7a07('0x10')](_0x7a07('0x20'),_0x163928['uniqueid'],queues[_0x163928['uniqueid']][_0x7a07('0x1f')],queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]));queues[queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]]=queues[_0x163928['uniqueid']];queues[queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x163928['uniqueid']];}}}catch(_0x366558){utils['error'](util[_0x7a07('0x10')](_0x7a07('0x21'),_0x163928[_0x7a07('0x2')]),_0x366558);}};exports[_0x7a07('0x22')]=function(_0xa011b0){try{utils[_0x7a07('0xf')](util['format'](_0x7a07('0x23'),_0xa011b0[_0x7a07('0x2')]),_0xa011b0);if(!_[_0x7a07('0x18')](_0xa011b0[_0x7a07('0x24')]['queuestatus'])&&_0xa011b0[_0x7a07('0x25')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x7a07('0x18')](queues[_0xa011b0[_0x7a07('0x2')]])){queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0xa011b0[_0x7a07('0x2')]]['queuecallerabandonAt']=null;queues[_0xa011b0['uniqueid']][_0x7a07('0x1a')]=!![];queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x27')]=utils[_0x7a07('0x16')]();queues[_0xa011b0[_0x7a07('0x2')]]['queuecallerexitreason']=_0xa011b0[_0x7a07('0x25')][_0x7a07('0x28')]();utils['info'](util[_0x7a07('0x10')](_0x7a07('0x29'),_0xa011b0[_0x7a07('0x2')],queues[_0xa011b0['uniqueid']][_0x7a07('0x1f')],_0xa011b0[_0x7a07('0x25')],queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x7')]));writeDB(queues[_0xa011b0[_0x7a07('0x2')]]);}}else if(!_[_0x7a07('0x18')](_0xa011b0[_0x7a07('0x24')][_0x7a07('0x2a')])){if(!_[_0x7a07('0x18')](queues[_0xa011b0['uniqueid']])&&!queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x26')]){queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0xa011b0['uniqueid']][_0x7a07('0x2b')]=null;queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x1a')]=!![];queues[_0xa011b0['uniqueid']][_0x7a07('0x27')]=utils['now']();queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x7')]=_0x7a07('0x2c');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xa011b0[_0x7a07('0x2')],queues[_0xa011b0[_0x7a07('0x2')]]['name'],_0xa011b0[_0x7a07('0x25')],queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x7')]));}}}catch(_0x18d347){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')]('[%s][queues][varset]',_0xa011b0[_0x7a07('0x2')]),_0x18d347);}};exports[_0x7a07('0x26')]=function(_0x4ef928){try{if(!_[_0x7a07('0x18')](queues[_0x4ef928['uniqueid']])){utils[_0x7a07('0xf')](util['format'](_0x7a07('0x2e'),_0x4ef928[_0x7a07('0x2')]),_0x4ef928);queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x1a')]=![];queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x27')]=null;queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x26')]=!![];queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x2b')]=utils[_0x7a07('0x16')]();queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x7')]='ABANDONED';utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4ef928[_0x7a07('0x2')],queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x1f')],queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x7')]));}}catch(_0x164f05){utils[_0x7a07('0x2d')](util['format'](_0x7a07('0x2e'),_0x4ef928[_0x7a07('0x2')]),_0x164f05);}};exports['queuecallerleave']=function(_0x5d24d0){try{if(!_['isNil'](queues[_0x5d24d0[_0x7a07('0x2')]])){utils[_0x7a07('0xf')](util[_0x7a07('0x10')](_0x7a07('0x2f'),_0x5d24d0['uniqueid']),_0x5d24d0);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x30'),_0x5d24d0[_0x7a07('0x2')],queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x1f')],_0x5d24d0[_0x7a07('0x31')],_0x5d24d0[_0x7a07('0x32')]));queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x33')]=!![];queues[_0x5d24d0['uniqueid']][_0x7a07('0x19')]=utils[_0x7a07('0x16')]();queues[_0x5d24d0['uniqueid']][_0x7a07('0x34')]=utils[_0x7a07('0x35')](queues[_0x5d24d0['uniqueid']][_0x7a07('0x19')],queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x36')]);queues[_0x5d24d0['uniqueid']]['position']=_0x5d24d0[_0x7a07('0x14')];queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x37')]=_0x5d24d0['count'];queues[_0x5d24d0['uniqueid']][_0x7a07('0x31')]=_0x5d24d0[_0x7a07('0x31')];queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x32')]=_0x5d24d0['connectedlinename'];}}catch(_0x4e113b){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')](_0x7a07('0x2f'),_0x5d24d0[_0x7a07('0x2')]),_0x4e113b);}};exports[_0x7a07('0x38')]=function(_0x27bb4e){try{if(!_[_0x7a07('0x18')](queues[_0x27bb4e[_0x7a07('0x2')]])){utils['debug'](util[_0x7a07('0x10')](_0x7a07('0x39'),_0x27bb4e[_0x7a07('0x2')]),_0x27bb4e);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x3a'),_0x27bb4e[_0x7a07('0x2')],queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x1f')],_0x27bb4e[_0x7a07('0x3b')],_0x27bb4e[_0x7a07('0x3c')]));queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0x27bb4e[_0x7a07('0x2')]]['queuecallerabandonAt']=null;queues[_0x27bb4e[_0x7a07('0x2')]]['queuecallerexit']=![];queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x7')]=null;queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x27')]=null;queues[_0x27bb4e['uniqueid']][_0x7a07('0x3d')]=!![];queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x6')]=_0x27bb4e[_0x7a07('0x3c')];queues[_0x27bb4e['uniqueid']][_0x7a07('0x3e')]=_0x27bb4e[_0x7a07('0x3b')];}}catch(_0xe05635){utils[_0x7a07('0x2d')](util['format'](_0x7a07('0x39'),_0x27bb4e['uniqueid']),_0xe05635);}};exports[_0x7a07('0x3f')]=function(_0xc3e716){try{if(!_['isNil'](queues[_0xc3e716[_0x7a07('0x2')]])){if(queues[_0xc3e716['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x7a07('0x10')]('[%s][queues][agentcomplete]',_0xc3e716['uniqueid']),_0xc3e716);queues[_0xc3e716['uniqueid']][_0x7a07('0x26')]=![];queues[_0xc3e716['uniqueid']]['queuecallerabandon']=![];queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x2b')]=null;queues[_0xc3e716['uniqueid']][_0x7a07('0x1a')]=![];queues[_0xc3e716[_0x7a07('0x2')]]['queuecallerexitAt']=null;queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x3d')]=!![];queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x3e')]=_0xc3e716[_0x7a07('0x3b')];queues[_0xc3e716['uniqueid']][_0x7a07('0x1b')]=!![];queues[_0xc3e716['uniqueid']][_0x7a07('0x1c')]=utils[_0x7a07('0x16')]();if(_0xc3e716[_0x7a07('0x40')]==_0x7a07('0x41')){if(!queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x41')]){queues[_0xc3e716['uniqueid']][_0x7a07('0x7')]=_0x7a07('0x42');}}else{queues[_0xc3e716['uniqueid']][_0x7a07('0x7')]=_0x7a07('0x43')+_0xc3e716['reason'][_0x7a07('0x28')]();}utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x44'),_0xc3e716[_0x7a07('0x2')],queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x1f')],_0xc3e716[_0x7a07('0x3b')],queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x7')]));writeDB(queues[_0xc3e716[_0x7a07('0x2')]]);}}}catch(_0x51fd0f){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')](_0x7a07('0x45'),_0xc3e716[_0x7a07('0x2')]),_0x51fd0f);}};exports[_0x7a07('0x46')]=function(_0x43efcd){try{if(!_['isNil'](queues[_0x43efcd['transfereeuniqueid']])){utils[_0x7a07('0xf')](util['format'](_0x7a07('0x47'),_0x43efcd[_0x7a07('0x2')]),_0x43efcd);queues[_0x43efcd[_0x7a07('0x48')]][_0x7a07('0x41')]=!![];queues[_0x43efcd[_0x7a07('0x48')]]['transfertype']=_0x7a07('0x49');queues[_0x43efcd[_0x7a07('0x48')]]['transferexten']=_0x43efcd[_0x7a07('0x4a')];queues[_0x43efcd[_0x7a07('0x48')]][_0x7a07('0x4b')]=_0x43efcd['transfereeuniqueid'];queues[_0x43efcd[_0x7a07('0x48')]][_0x7a07('0x7')]=_0x7a07('0x4c');utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x43efcd[_0x7a07('0x2')],queues[_0x43efcd['transfereeuniqueid']][_0x7a07('0x1f')],_0x43efcd[_0x7a07('0x48')],_0x43efcd[_0x7a07('0x4a')]));}}catch(_0x40a36c){utils[_0x7a07('0x2d')](util['format'](_0x7a07('0x47'),_0x43efcd[_0x7a07('0x2')]),_0x40a36c);}};exports['attendedtransfer']=function(_0x1ebf14){try{utils[_0x7a07('0xf')](util['format'](_0x7a07('0x4d'),_0x1ebf14[_0x7a07('0x4e')]),_0x1ebf14);if(_0x1ebf14[_0x7a07('0x4e')]==_0x1ebf14[_0x7a07('0x4f')]){if(!_[_0x7a07('0x18')](queues[_0x1ebf14[_0x7a07('0x50')]])){utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x51'),_0x1ebf14['origtransfereruniqueid'],queues[_0x1ebf14['secondtransfererlinkedid']][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x52')]));queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x41')]=!![];queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x53')]=_0x7a07('0x54');queues[_0x1ebf14['secondtransfererlinkedid']][_0x7a07('0x55')]=_0x1ebf14[_0x7a07('0x52')];queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x4b')]=_0x1ebf14[_0x7a07('0x4e')];queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x7a07('0x18')](queues[_0x1ebf14[_0x7a07('0x4f')]])){if(_0x1ebf14[_0x7a07('0x56')]&&queues[_0x1ebf14[_0x7a07('0x56')]]){queues[_0x1ebf14[_0x7a07('0x56')]][_0x7a07('0x57')]=0x1;queues[_0x1ebf14['transfereeuniqueid']]=_[_0x7a07('0x58')](queues[_0x1ebf14[_0x7a07('0x56')]]);queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0xd')]=_0x1ebf14[_0x7a07('0x59')];queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0x57')]=0x2;queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0x5')]=queues[_0x1ebf14[_0x7a07('0x50')]]['calleridnum'];queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x5a')]=queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x5a')];queues[_0x1ebf14[_0x7a07('0x48')]]['queuecallerjoinAt']=utils['now']();queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x19')]=utils[_0x7a07('0x16')]();queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x34')]=0x0;queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0x5b')]=0x0;utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x1f')],queues[_0x1ebf14[_0x7a07('0x48')]]['calleridnum'],queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x5a')]));}else{utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x5c'),_0x1ebf14['origtransfereruniqueid'],queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x50')]));queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0xd')]=_0x1ebf14[_0x7a07('0x50')];}}}else if(_0x1ebf14['secondtransfereruniqueid']==_0x1ebf14['secondtransfererlinkedid']){if(!_[_0x7a07('0x18')](queues[_0x1ebf14[_0x7a07('0x4f')]])){utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x5d'),_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x5e')],_0x1ebf14['secondtransfererexten']));queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x41')]=!![];queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x53')]=_0x7a07('0x54');queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x55')]=_0x1ebf14[_0x7a07('0x5f')];queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x4b')]=_0x1ebf14['secondtransfereruniqueid'];queues[_0x1ebf14[_0x7a07('0x4f')]]['queuecallerexitreason']=_0x7a07('0x60');}if(!_[_0x7a07('0x18')](queues[_0x1ebf14['secondtransfererlinkedid']])){if(_0x1ebf14[_0x7a07('0x61')]&&queues[_0x1ebf14[_0x7a07('0x61')]]){queues[_0x1ebf14[_0x7a07('0x61')]][_0x7a07('0x57')]=0x1;queues[_0x1ebf14[_0x7a07('0x59')]]=_[_0x7a07('0x58')](queues[_0x1ebf14[_0x7a07('0x61')]]);queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0xd')]=_0x1ebf14[_0x7a07('0x59')];queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x57')]=0x2;queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x5')]=queues[_0x1ebf14[_0x7a07('0x4f')]]['calleridnum'];queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x5a')]=queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x5a')];queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x36')]=utils[_0x7a07('0x16')]();queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x19')]=utils['now']();queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x34')]=0x0;queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x5b')]=0x0;utils['info'](util[_0x7a07('0x10')](_0x7a07('0x62'),_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x59')]]['name'],queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0xd')],queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x5')],queues[_0x1ebf14[_0x7a07('0x59')]]['calleridname']));}else{utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x4f')]));queues[_0x1ebf14[_0x7a07('0x50')]]['transfereduniqueid']=_0x1ebf14[_0x7a07('0x4f')];}}}}catch(_0x25f126){utils['error'](util[_0x7a07('0x10')](_0x7a07('0x4d'),_0x1ebf14['origtransfereruniqueid']),_0x25f126);}};exports[_0x7a07('0x63')]=function(_0x1a9276){try{if(!_[_0x7a07('0x18')](queues[_0x1a9276[_0x7a07('0x2')]])){utils[_0x7a07('0xf')](util[_0x7a07('0x10')](_0x7a07('0x64'),_0x1a9276['uniqueid']),_0x1a9276);queues[_0x1a9276[_0x7a07('0x2')]][_0x7a07('0x65')]=utils[_0x7a07('0x16')]();utils[_0x7a07('0x12')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1a9276[_0x7a07('0x2')],queues[_0x1a9276[_0x7a07('0x2')]][_0x7a07('0x1f')],queues[_0x1a9276['uniqueid']][_0x7a07('0x65')]));}}catch(_0x5acdbf){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')]('[%s][queues][musiconholdstart]',_0x1a9276[_0x7a07('0x2')]),_0x5acdbf);}};exports[_0x7a07('0x66')]=function(_0x58fbdf){try{if(!_[_0x7a07('0x18')](queues[_0x58fbdf['uniqueid']])){if(!_[_0x7a07('0x18')](queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x65')])){utils[_0x7a07('0xf')](util['format'](_0x7a07('0x67'),_0x58fbdf[_0x7a07('0x2')]),_0x58fbdf);queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x5b')]+=utils[_0x7a07('0x35')](utils['now'](),queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x65')]);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x68'),_0x58fbdf['uniqueid'],queues[_0x58fbdf['uniqueid']][_0x7a07('0x1f')],queues[_0x58fbdf['uniqueid']]['mohtime']));delete queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x65')];}}}catch(_0x1aa25d){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')](_0x7a07('0x67'),_0x58fbdf[_0x7a07('0x2')]),_0x1aa25d);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5d4da20..f39f81a 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 _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 +var _0x601e=['split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','newchannel','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith'];(function(_0xb32de3,_0x25ca42){var _0xf3f5ea=function(_0x4ba88d){while(--_0x4ba88d){_0xb32de3['push'](_0xb32de3['shift']());}};_0xf3f5ea(++_0x25ca42);}(_0x601e,0x10b));var _0xe601=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x601e[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xe601('0x0'));var util=require(_0xe601('0x1'));var utils=require(_0xe601('0x2'));var recordings={};function writeDB(_0x2e9397){utils['info'](util[_0xe601('0x3')](_0xe601('0x4'),_0x2e9397[_0xe601('0x5')]));if(_0x2e9397[_0xe601('0x6')]){utils[_0xe601('0x7')](_0x2e9397[_0xe601('0x6')])[_0xe601('0x8')](function(_0x3a2f2c){if(_0x3a2f2c){_0x2e9397[_0xe601('0x9')]=_0x3a2f2c['name'];_0x2e9397[_0xe601('0xa')]=_0x3a2f2c['id'];}utils[_0xe601('0xb')]('CreateVoiceRecording',_0x2e9397);});}else{utils[_0xe601('0xb')]('CreateVoiceRecording',_0x2e9397);}}exports[_0xe601('0xc')]=function(_0x3ca857){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x3ca857['uniqueid']),_0x3ca857);if(_0x3ca857[_0xe601('0x5')]==_0x3ca857[_0xe601('0xd')]){utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0xf'),_0x3ca857[_0xe601('0x5')],_0x3ca857[_0xe601('0x10')],_0x3ca857[_0xe601('0x11')]));recordings[_0x3ca857['uniqueid']]={'uniqueid':_0x3ca857['uniqueid'],'accountcode':_0x3ca857[_0xe601('0x6')],'exten':_0x3ca857[_0xe601('0x11')],'context':_0x3ca857[_0xe601('0x10')],'channel':_0x3ca857[_0xe601('0x12')],'monitors':[]};}}catch(_0x47967f){utils[_0xe601('0x13')](util[_0xe601('0x3')]('[%s][recordings][newchannel]',_0x3ca857[_0xe601('0x5')]),_0x47967f);}};exports['newstate']=function(_0x2a9d3f){try{utils['debug'](util[_0xe601('0x3')]('[%s][recordings][newstate]',_0x2a9d3f[_0xe601('0x5')]),_0x2a9d3f);if(!_[_0xe601('0x14')](recordings[_0x2a9d3f[_0xe601('0x5')]])&&_0x2a9d3f[_0xe601('0x15')]==0x6){utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0x16'),_0x2a9d3f[_0xe601('0x5')],_0x2a9d3f[_0xe601('0x10')],_0x2a9d3f['channel']));}else if(!_[_0xe601('0x14')](recordings[_0x2a9d3f[_0xe601('0xd')]])&&_0x2a9d3f['channelstate']==0x6&&_0x2a9d3f[_0xe601('0x10')]!=_0xe601('0x17')){utils['info'](util[_0xe601('0x3')](_0xe601('0x18'),_0x2a9d3f['uniqueid'],_0x2a9d3f['linkedid'],_0x2a9d3f[_0xe601('0x10')],_0x2a9d3f[_0xe601('0x12')]));recordings[_0x2a9d3f[_0xe601('0xd')]][_0xe601('0x6')]=_0x2a9d3f[_0xe601('0x6')];}}catch(_0xcfd4ea){utils[_0xe601('0x13')](util['format'](_0xe601('0x19'),_0x2a9d3f[_0xe601('0x5')]),_0xcfd4ea);}};exports[_0xe601('0x1a')]=function(_0x3883c7){try{if(!_[_0xe601('0x14')](_0x3883c7[_0xe601('0x1b')])&&!_[_0xe601('0x14')](_0x3883c7[_0xe601('0x1b')][_0xe601('0x1c')])){utils[_0xe601('0x1d')](util[_0xe601('0x3')](_0xe601('0x1e'),_0x3883c7[_0xe601('0x5')]),_0x3883c7);utils[_0xe601('0xe')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3883c7['uniqueid'],_0x3883c7[_0xe601('0x1b')],_0x3883c7['value']));if(_[_0xe601('0x1f')](_0x3883c7[_0xe601('0x20')],_0xe601('0x21'))){_0x3883c7[_0xe601('0x20')]=_0x3883c7[_0xe601('0x20')][_0xe601('0x22')]('.wav49',_0xe601('0x23'));}if(recordings[_0x3883c7['linkedid']]){var _0x357456=_[_0xe601('0x24')](recordings[_0x3883c7[_0xe601('0xd')]]['monitors'],{'value':_0x3883c7['value']});if(_['isNil'](_0x357456)){recordings[_0x3883c7[_0xe601('0xd')]][_0xe601('0x25')][_0xe601('0x26')]({'value':_0x3883c7[_0xe601('0x20')]});}}}}catch(_0x12df50){utils['error'](util[_0xe601('0x3')](_0xe601('0x1e'),_0x3883c7['uniqueid']),_0x12df50);}};exports[_0xe601('0x27')]=function(_0x5a2af1){try{if(!_[_0xe601('0x14')](recordings[_0x5a2af1[_0xe601('0x5')]])){utils['debug'](util[_0xe601('0x3')]('[%s][recordings][hangup]',_0x5a2af1['uniqueid']),_0x5a2af1);utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0x28'),_0x5a2af1['uniqueid'],_0x5a2af1['calleridnum'],_0x5a2af1['calleridname'],_0x5a2af1[_0xe601('0x29')]));recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2a')]=_0x5a2af1[_0xe601('0x2a')];recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2b')]=_0x5a2af1[_0xe601('0x2b')];recordings[_0x5a2af1['uniqueid']][_0xe601('0x2c')]=_0x5a2af1[_0xe601('0x2c')];recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2d')]=_0x5a2af1['connectedlinename'];if(recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2e')]==_0xe601('0x2f')&&recordings[_0x5a2af1[_0xe601('0x5')]]['accountcode']){recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2c')]=recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x6')];recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2d')]='';}recordings[_0x5a2af1[_0xe601('0x5')]]['monitors'][_0xe601('0x30')](function(_0x542a4e){var _0x2eacb5=_[_0xe601('0x31')](recordings[_0x5a2af1['uniqueid']]);_0x2eacb5[_0xe601('0x20')]=_0x542a4e[_0xe601('0x20')];writeDB(_0x2eacb5);});delete recordings[_0x5a2af1[_0xe601('0x5')]];}}catch(_0x4e26fb){utils[_0xe601('0x13')](util[_0xe601('0x3')](_0xe601('0x32'),_0x5a2af1[_0xe601('0x5')]),_0x4e26fb);}};exports[_0xe601('0x33')]=function(_0x2ae853){try{if(!_[_0xe601('0x14')](recordings[_0x2ae853['uniqueid']])){utils[_0xe601('0x1d')](util[_0xe601('0x3')]('[%s][recordings][newexten]',_0x2ae853['uniqueid']),_0x2ae853);utils[_0xe601('0xe')](util['format'](_0xe601('0x34'),_0x2ae853[_0xe601('0x5')],_0x2ae853[_0xe601('0x35')],_0x2ae853[_0xe601('0x36')]));if(_0x2ae853['application'][_0xe601('0x37')]()==_0xe601('0x38')&&_[_0xe601('0x39')](_0x2ae853['appdata']['toLowerCase'](),'cdr')){var _0x2945be=_0x2ae853[_0xe601('0x36')][_0xe601('0x3a')]('=');var _0x2c6bfb=_0x2945be[0x0]['substring'](_0x2945be[0x0][_0xe601('0x3b')]('(')+0x1,_0x2945be[0x0][_0xe601('0x3b')](')'));var _0x322681=_0x2945be[0x1];recordings[_0x2ae853[_0xe601('0x5')]][_0x2c6bfb]=_0x322681;}}}catch(_0x2e2d26){utils['error'](util['format'](_0xe601('0x3c'),_0x2ae853[_0xe601('0x5')]),_0x2e2d26);}};exports[_0xe601('0x3d')]=function(_0x335025){try{if(!_[_0xe601('0x14')](recordings[_0x335025['uniqueid']])){utils[_0xe601('0x1d')](util[_0xe601('0x3')](_0xe601('0x3e'),_0x335025[_0xe601('0x5')]),_0x335025);utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0x3f'),_0x335025[_0xe601('0x5')],_0x335025[_0xe601('0x40')]));recordings[_0x335025['uniqueid']][_0xe601('0x40')]=_0x335025[_0xe601('0x40')];}}catch(_0x1c7d51){utils[_0xe601('0x13')](util[_0xe601('0x3')](_0xe601('0x3e'),_0x335025[_0xe601('0x5')]),_0x1c7d51);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index e9984c1..297d35e 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 _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 +var _0xb32c=['type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb32c,0x195));var _0xcb32=function(_0x2c7b52,_0x2dbf6e){_0x2c7b52=_0x2c7b52-0x0;var _0x7b6e73=_0xb32c[_0x2c7b52];return _0x7b6e73;};'use strict';var _=require(_0xcb32('0x0'));var util=require(_0xcb32('0x1'));var utils=require(_0xcb32('0x2'));function writeDB(_0x47777a){utils[_0xcb32('0x3')](util['format'](_0xcb32('0x4'),_0x47777a[_0xcb32('0x5')]===_0xcb32('0x6')?_0x47777a[_0xcb32('0x7')]:_0x47777a['uniqueid'],_0x47777a['type']));utils[_0xcb32('0x8')](_0xcb32('0x9'),_0x47777a);}exports['blindtransfer']=function(_0x34adf4){try{utils[_0xcb32('0xa')](util[_0xcb32('0xb')](_0xcb32('0xc'),_0x34adf4[_0xcb32('0xd')]),_0x34adf4);utils['info'](util['format'](_0xcb32('0xe'),_0x34adf4['uniqueid'],_0x34adf4[_0xcb32('0xf')],_0x34adf4[_0xcb32('0x10')],_0x34adf4['transfereecalleridnum'],_0x34adf4[_0xcb32('0x11')]));_0x34adf4[_0xcb32('0x5')]=_0xcb32('0x12');writeDB(_0x34adf4);}catch(_0x4ca952){utils['error'](util[_0xcb32('0xb')]('[%s][transfers][blindtransfer]',_0x34adf4[_0xcb32('0xd')]),_0x4ca952);}};exports[_0xcb32('0x13')]=function(_0x40c66a){try{utils['debug'](util['format']('[%s][transfers][attendedtransfer]',_0x40c66a[_0xcb32('0x7')]),_0x40c66a);utils['info'](util[_0xcb32('0xb')](_0xcb32('0x14'),_0x40c66a[_0xcb32('0x7')],_0x40c66a[_0xcb32('0x15')],_0x40c66a[_0xcb32('0x16')],_0x40c66a[_0xcb32('0x17')],_0x40c66a[_0xcb32('0x18')]));_0x40c66a=_[_0xcb32('0x19')](_0x40c66a,{'transfererchannel':_0x40c66a[_0xcb32('0x1a')],'transferercalleridnum':_0x40c66a[_0xcb32('0x15')],'transferercalleridname':_0x40c66a[_0xcb32('0x16')],'transfererconnectedlinenum':_0x40c66a[_0xcb32('0x1b')],'transfererconnectedlinename':_0x40c66a['secondtransfererconnectedlinename'],'transfereraccountcode':_0x40c66a[_0xcb32('0x1c')],'transferercontext':_0x40c66a[_0xcb32('0x1d')],'transfererexten':_0x40c66a[_0xcb32('0x1e')],'transfererlinkedid':_0x40c66a[_0xcb32('0x1f')],'context':_0x40c66a[_0xcb32('0x20')],'extension':_0x40c66a['origtransfererexten'],'type':'attended'});if(_[_0xcb32('0x21')](_0x40c66a['transfereechannel'])){_0x40c66a=_[_0xcb32('0x19')](_0x40c66a,{'transfereechannel':_0x40c66a[_0xcb32('0x22')],'transfereecalleridnum':_0x40c66a[_0xcb32('0x17')],'transfereecalleridname':_0x40c66a[_0xcb32('0x18')],'transfereeconnectedlinenum':_0x40c66a['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x40c66a[_0xcb32('0x23')],'transfereeaccountcode':_0x40c66a[_0xcb32('0x24')],'transfereecontext':_0x40c66a[_0xcb32('0x25')],'transfereeexten':_0x40c66a['transfertargetexten'],'transfereelinkedid':_0x40c66a[_0xcb32('0x26')]});}writeDB(_0x40c66a);}catch(_0x430223){utils[_0xcb32('0x27')](util[_0xcb32('0xb')](_0xcb32('0x28'),_0x40c66a[_0xcb32('0x7')]),_0x430223);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 6fad905..7da928b 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 _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 +var _0xc15b=['[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','isAfter','isBefore','bluebird','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','catch','GetUser','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface'];(function(_0x21b771,_0x4bbdaa){var _0x485e47=function(_0x4a1149){while(--_0x4a1149){_0x21b771['push'](_0x21b771['shift']());}};_0x485e47(++_0x4bbdaa);}(_0xc15b,0x159));var _0xbc15=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xc15b[_0x377a6e];return _0x37f751;};'use strict';var BPromise=require(_0xbc15('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0xbc15('0x1')][_0xbc15('0x2')]({'port':0x2329});var logger=require(_0xbc15('0x3'))(_0xbc15('0x4'));exports[_0xbc15('0x5')]=function(_0x7d9dc7,_0x3c1cf4){logger[_0xbc15('0x5')](_0x7d9dc7,_0x3c1cf4?util[_0xbc15('0x6')](_0x3c1cf4,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x20f628,_0x5816d1){logger['debug'](_0x20f628,_0x5816d1?util[_0xbc15('0x6')](_0x5816d1,{'showHidden':![],'depth':null}):'');};exports[_0xbc15('0x7')]=function(_0x40db8b,_0x5a1f5d){logger[_0xbc15('0x7')](_0x40db8b,_0x5a1f5d?util[_0xbc15('0x6')](_0x5a1f5d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5e2eff,_0x2e834c){return client[_0xbc15('0x8')](_0x5e2eff,{'body':_0x2e834c})[_0xbc15('0x9')](function(_0x4c48fc){logger[_0xbc15('0xa')]('[utils][request]\x20name:%s',_0x5e2eff,_0x4c48fc?util[_0xbc15('0x6')](_0x4c48fc,{'showHidden':![],'depth':null}):'');})[_0xbc15('0xb')](function(_0x59b19b){logger[_0xbc15('0x7')]('[utils][request]\x20name:%s',_0x5e2eff,_0x59b19b?util[_0xbc15('0x6')](_0x59b19b,{'showHidden':![],'depth':null}):'');});};function getUser(_0xefb2d6){return client['request'](_0xbc15('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name','interface'],'where':_0xefb2d6,'limit':0x1}})[_0xbc15('0x9')](function(_0x2975e3){logger[_0xbc15('0xa')](_0xbc15('0xd'),JSON[_0xbc15('0xe')](_0xefb2d6),_0x2975e3?util[_0xbc15('0x6')](_0x2975e3,{'showHidden':![],'depth':null}):'');return _0x2975e3[_0xbc15('0xf')][_0xbc15('0x10')]?_0x2975e3[_0xbc15('0xf')][0x0]:null;});}exports[_0xbc15('0x11')]=function(_0x1040b8){return new BPromise(function(_0x1b4d24,_0x277c37){if(_0x1040b8){return getUser({'internal':_0x1040b8})[_0xbc15('0x9')](function(_0x548681){logger['info'](_0xbc15('0x12'),_0x1040b8,_0x548681?_0xbc15('0x13'):_0xbc15('0x14'));return _0x1b4d24(_0x548681);})[_0xbc15('0xb')](function(_0x58cc43){logger[_0xbc15('0x7')](_0xbc15('0x15'),_0x58cc43?util[_0xbc15('0x6')](_0x58cc43,{'showHidden':![],'depth':null}):'');return _0x1b4d24(null);});}return _0x1b4d24(null);});};exports[_0xbc15('0x16')]=function(_0x2f9f4){return new BPromise(function(_0x24315e,_0x576d38){if(_0x2f9f4){return getUser({'interface':_0x2f9f4})[_0xbc15('0x9')](function(_0x5d8bda){logger[_0xbc15('0x5')](_0xbc15('0x17'),_0x2f9f4,_0x5d8bda?_0xbc15('0x13'):_0xbc15('0x14'));return _0x24315e(_0x5d8bda);})[_0xbc15('0xb')](function(_0x19d76f){logger['error'](_0xbc15('0x18'),_0x19d76f?util['inspect'](_0x19d76f,{'showHidden':![],'depth':null}):'');return _0x24315e(null);});}return _0x24315e(null);});};exports[_0xbc15('0x19')]=function(_0x4daeb5){return new BPromise(function(_0x24d64e,_0x4e738a){if(_0x4daeb5){return getUser({'name':_0x4daeb5})[_0xbc15('0x9')](function(_0x1d81d2){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x4daeb5,_0x1d81d2?_0xbc15('0x13'):_0xbc15('0x14'));return _0x24d64e(_0x1d81d2);})[_0xbc15('0xb')](function(_0x133954){logger[_0xbc15('0x7')](_0xbc15('0x1a'),_0x133954?util[_0xbc15('0x6')](_0x133954,{'showHidden':![],'depth':null}):'');return _0x24d64e(null);});}return _0x24d64e(null);});};exports[_0xbc15('0x1b')]=function(_0x39a532){return new BPromise(function(_0x5f4387,_0x4962da){if(_0x39a532){return client[_0xbc15('0x8')](_0xbc15('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xbc15('0x1d'),_0xbc15('0x1e'),_0xbc15('0x1f'),_0xbc15('0x20')],'where':{'name':_0x39a532},'limit':0x1}})['then'](function(_0x56f2a4){logger[_0xbc15('0xa')](_0xbc15('0x21'),_0x39a532,_0x56f2a4?util[_0xbc15('0x6')](_0x56f2a4,{'showHidden':![],'depth':null}):'');logger[_0xbc15('0x5')](_0xbc15('0x22'),_0x39a532,_0x56f2a4?_0xbc15('0x13'):_0xbc15('0x14'));return _0x5f4387(_0x56f2a4[_0xbc15('0xf')][_0xbc15('0x10')]?_0x56f2a4[_0xbc15('0xf')][0x0]:null);})[_0xbc15('0xb')](function(_0xc5fd0a){logger[_0xbc15('0x7')]('[utils][getVoiceQueueByName]',_0xc5fd0a?util[_0xbc15('0x6')](_0xc5fd0a,{'showHidden':![],'depth':null}):'');return _0x5f4387(null);});}return _0x5f4387(null);});};exports[_0xbc15('0x23')]=function(_0x36e7c0,_0x134ba2){return moment(_0x36e7c0)[_0xbc15('0x24')](_0x134ba2,_0xbc15('0x25'))[_0xbc15('0x26')](_0xbc15('0x27'));};exports[_0xbc15('0x28')]=function(_0x1f3ade,_0x792bf2){return moment(_0x1f3ade)[_0xbc15('0x29')](_0x792bf2,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbc15('0x2a')]=function(_0x1bb668,_0x3c8c4f){return moment(_0x1bb668)['diff'](moment(_0x3c8c4f),_0xbc15('0x25'));};exports[_0xbc15('0x2b')]=function(_0x123463,_0x492b2c){return parseInt(_0x123463,0xa)+parseInt(_0x492b2c,0xa);};exports['now']=function(){return moment()['format'](_0xbc15('0x27'));};exports[_0xbc15('0x2c')]=function(_0x4d4390,_0x119dd2){if(_0x119dd2){return moment(_0x4d4390)['isAfter'](_0x119dd2);}return!![];};exports['isBefore']=function(_0xf6b693,_0x5bf875){if(_0x5bf875){return moment(_0xf6b693)[_0xbc15('0x2d')](_0x5bf875);}else if(_0xf6b693){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 756f127..cf92818 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 _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 +var _0xc219=['other','agent_name','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','role','name','then','client','catch','user','no-user','data','timestamp','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)'];(function(_0x2f9736,_0x50c372){var _0x4aaa26=function(_0x2b0c6c){while(--_0x2b0c6c){_0x2f9736['push'](_0x2f9736['shift']());}};_0x4aaa26(++_0x50c372);}(_0xc219,0x116));var _0x9c21=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0xc219[_0x418549];return _0x288826;};var fs=require(_0x9c21('0x0'));var _=require(_0x9c21('0x1'));var ewinston=require(_0x9c21('0x2'));var path=require(_0x9c21('0x3'));var util=require('util');var fileLogger=require(_0x9c21('0x4'))[_0x9c21('0x5')];var safeTemplate=require(_0x9c21('0x6'))[_0x9c21('0x7')];var maskSensitiveData=require(_0x9c21('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x349c6e(_0x33c9db){var _0x2ea01e=path[_0x9c21('0x9')](_0x9c21('0xa'),_0x9c21('0xb'),_0x9c21('0xc'));var _0x355a62=path[_0x9c21('0x9')]('client',_0x33c9db[_0x9c21('0xd')]+'-'+_0x33c9db[_0x9c21('0xe')]);return fs['ensureDir'](path[_0x9c21('0x9')](_0x2ea01e,_0x355a62))[_0x9c21('0xf')](function(){var _0x3bd935=fileLogger(_0x9c21('0x10'),path[_0x9c21('0x9')](_0x2ea01e,_0x355a62));return _0x3bd935;})[_0x9c21('0x11')](function(_0x3d812b){throw _0x3d812b;});}this['log']=function(_0x5c51b5,_0x356fe7,_0x4d2094,_0x4bfb06){return _0x349c6e(_0x5c51b5[_0x9c21('0x12')])[_0x9c21('0xf')](function(_0x403bbc){var _0x9747d6=_0x403bbc[_0x356fe7];return _0x9747d6;})[_0x9c21('0xf')](function(_0x23b98e){var _0x2326d3=_0x5c51b5[_0x9c21('0x12')]?_0x5c51b5[_0x9c21('0x12')]['id']:_0x9c21('0x13');var _0x524b2b=_0x4bfb06[_0x9c21('0x14')];var _0x344f29=_0x4bfb06[_0x9c21('0x15')];var _0x54499d=new Date(Number(_0x344f29));return _0x23b98e(_0x2326d3,_0x54499d,_0x4d2094,_0x524b2b);})[_0x9c21('0x11')](function(_0x3e838d){fileLogger(_0x9c21('0x10'))[_0x9c21('0x16')](_0x3e838d);});};}function setupLoggers(_0x35a2e8){return new Promise(function(_0x5eb458){var _0x94d007=new ClientSideLogger();var _0x3b54ed=fileLogger(_0x9c21('0x17'));var _0x33cdda=fileLogger(_0x9c21('0x18'));_0x35a2e8[_0x9c21('0x19')]('client-side-logger',_0x94d007);_0x35a2e8[_0x9c21('0x1a')](ewinston[_0x9c21('0x1b')]({'winstonInstance':_0x3b54ed,'meta':![],'statusLevels':!![],'msg':function(_0x2675ed,_0x126508){var _0x3af6f0=_0x9c21('0x1c');if(!_[_0x9c21('0x1d')](_0x2675ed['body'])){_0x3af6f0+=_0x9c21('0x1e');var _0x3d8c8f=_0x2675ed['body'];maskSensitiveData(_0x3d8c8f);}return safeTemplate(util[_0x9c21('0x1f')](_0x3af6f0,_0x2675ed[_0x9c21('0x20')],_0x2675ed[_0x9c21('0x21')]['x-forwarded-for']?_0x2675ed[_0x9c21('0x21')][_0x9c21('0x22')]:_0x2675ed[_0x9c21('0x23')][_0x9c21('0x24')]||_0x2675ed['ip'],_0x2675ed[_0x9c21('0x25')],_0x126508[_0x9c21('0x26')],_0x126508[_0x9c21('0x27')],_0x2675ed[_0x9c21('0x12')]?_0x2675ed['user']['id']:null,_0x2675ed['user']?_0x2675ed[_0x9c21('0x12')][_0x9c21('0xe')]:null,_0x2675ed[_0x9c21('0x12')]?_0x2675ed[_0x9c21('0x12')]['role']:null,_0x3d8c8f?util['inspect'](_0x3d8c8f,![],null):''));}}));_0x35a2e8['use'](ewinston[_0x9c21('0x1b')]({'winstonInstance':_0x33cdda,'meta':![],'statusLevels':!![],'msg':function(_0xf3df35,_0x3e3f45){var _0x3b2f09='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xf3df35[_0x9c21('0x28')]&&_0xf3df35[_0x9c21('0x28')][_0x9c21('0x29')]&&_0xf3df35[_0x9c21('0x28')][_0x9c21('0x2a')]){_0x3b2f09=_0x9c21('0x2b');}return util['format'](_0x3b2f09,_0xf3df35['method'],_0xf3df35[_0x9c21('0x21')][_0x9c21('0x22')]?_0xf3df35['headers'][_0x9c21('0x22')]:_0xf3df35[_0x9c21('0x23')][_0x9c21('0x24')]||_0xf3df35['ip'],_0xf3df35[_0x9c21('0x25')],_0x3e3f45[_0x9c21('0x26')],_0x3e3f45[_0x9c21('0x27')],_0xf3df35['user']?_0xf3df35[_0x9c21('0x12')]['id']:null,_0xf3df35[_0x9c21('0x12')]?_0xf3df35[_0x9c21('0x12')][_0x9c21('0xe')]:null,_0xf3df35[_0x9c21('0x12')]?_0xf3df35[_0x9c21('0x12')][_0x9c21('0xd')]:null,_0xf3df35['body']&&_0xf3df35['body'][_0x9c21('0x29')]?_0xf3df35[_0x9c21('0x28')]['device']:_0x9c21('0x2c'),_0xf3df35[_0x9c21('0x28')]&&_0xf3df35['body'][_0x9c21('0x2a')]?_0xf3df35['body'][_0x9c21('0x2a')]:'',_0xf3df35[_0x9c21('0x28')]&&_0xf3df35[_0x9c21('0x28')][_0x9c21('0x2d')]?_0xf3df35[_0x9c21('0x28')]['agent_name']:'');},'ignoreRoute':function(_0x5b2d0b){var _0xeffbaf=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xeffbaf['test'](_0x5b2d0b[_0x9c21('0x25')]);}}));return _0x5eb458();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index a3b68ba..57a0749 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x4cba=['startOf','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','format','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore'];(function(_0x3ef856,_0x5a4b4e){var _0x1a78ca=function(_0x22b922){while(--_0x22b922){_0x3ef856['push'](_0x3ef856['shift']());}};_0x1a78ca(++_0x5a4b4e);}(_0x4cba,0x1a4));var _0xa4cb=function(_0x1bb8d1,_0x48b94d){_0x1bb8d1=_0x1bb8d1-0x0;var _0x4f775e=_0x4cba[_0x1bb8d1];return _0x4f775e;};var _=require(_0xa4cb('0x0'));var moment=require(_0xa4cb('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][_0xa4cb('0x2')](function(_0x5c8a85){return _0x5c8a85[_0xa4cb('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa4cb('0x4');var EINVALID_DATE=_0xa4cb('0x5');function throwIfDateNotValid(_0x3bf1ae){if(!_0x3bf1ae[_0xa4cb('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x285e9c){var _0x244d87=_0x285e9c[_0xa4cb('0x7')](':')[_0xa4cb('0x2')](function(_0x5a9c34){return parseInt(_0x5a9c34,0xa);});var _0x4eedd8=_0x244d87[0x0];var _0x3f6af9=_0x244d87[0x1];if(_0x4eedd8<0x0||_0x4eedd8>0x17||_0x3f6af9<0x0||_0x3f6af9>0x3b){throw new Error(EINVALID_DATE);}return[_0x4eedd8,_0x3f6af9];}function circularDoWInterval(_0x387f41,_0xa79dcb){if(_0x387f41===_0xa79dcb){return[_0x387f41];}else{var _0x1803c7=moment[_0xa4cb('0x8')]();moment['locale']('en');var _0xebf6eb=moment[_0xa4cb('0x9')]()[_0xa4cb('0x2')](function(_0x3ebd88){return _0x3ebd88[_0xa4cb('0xa')]();});moment[_0xa4cb('0x8')](_0x1803c7);var _0x3e157c=_0xebf6eb[_0xa4cb('0xb')](_0x387f41);var _0x3331ef=_0xebf6eb[_0xa4cb('0xb')](_0xa79dcb);if(_0x3331ef>_0x3e157c){return _0xebf6eb[_0xa4cb('0xc')](_0x3e157c,_0x3331ef+0x1);}else{var _0x555d00=_0xebf6eb['slice'](0x0,_0x3331ef+0x1);var _0x2a0e50=_0xebf6eb[_0xa4cb('0xc')](_0x3e157c);return _0x2a0e50[_0xa4cb('0xd')](_0x555d00);}}}module[_0xa4cb('0xe')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x527989,_0x28b8a2){if(_0x527989===_0x28b8a2){return[_0x527989];}else{var _0x491a81=moment[_0xa4cb('0x8')]();moment[_0xa4cb('0x8')]('en');var _0x559c1c=moment[_0xa4cb('0xf')]()[_0xa4cb('0x2')](function(_0x5b3ff8){return _0x5b3ff8[_0xa4cb('0xa')]();});moment[_0xa4cb('0x8')](_0x491a81);var _0x17f5f8=_0x559c1c[_0xa4cb('0xb')](_0x527989);var _0x4562f4=_0x559c1c['indexOf'](_0x28b8a2);if(_0x4562f4>_0x17f5f8){return _0x559c1c['slice'](_0x17f5f8,_0x4562f4+0x1);}else{var _0x51b0a7=_0x559c1c[_0xa4cb('0xc')](0x0,_0x4562f4+0x1);var _0xcc427e=_0x559c1c[_0xa4cb('0xc')](_0x17f5f8);return _0xcc427e['concat'](_0x51b0a7);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x20dd6f){var _0x50d5ee=parseInt(_0x20dd6f,0xa);if(_0x50d5ee<0x1||_0x50d5ee>0x1f){throw new Error(EINVALID_DATE);}return _0x50d5ee;}function timeCompare(_0x27f84a,_0x49fee6,_0x1459b2){var _0x293b02=_0x27f84a[_0xa4cb('0x10')]();var _0x56178d=extractTime(_0x49fee6);var _0x5a53aa=_0x56178d[0x0];var _0x5f4a80=_0x56178d[0x1];var _0x1a80ec=_0x27f84a[_0xa4cb('0x10')]()[_0xa4cb('0x11')](_0x5a53aa)[_0xa4cb('0x12')](_0x5f4a80);throwIfDateNotValid(_0x1a80ec);var _0x56cafc=extractTime(_0x1459b2);var _0x925ad8=_0x56cafc[0x0];var _0x1af589=_0x56cafc[0x1];var _0x22cbe2=_0x27f84a[_0xa4cb('0x10')]()[_0xa4cb('0x11')](_0x925ad8)['minutes'](_0x1af589);throwIfDateNotValid(_0x22cbe2);if(_0x22cbe2[_0xa4cb('0x13')](_0x1a80ec)){var _0x99227c=_0x293b02[_0xa4cb('0x10')]()[_0xa4cb('0x14')](_0xa4cb('0x15'));var _0x92a4c4=_0x293b02[_0xa4cb('0x10')]()[_0xa4cb('0x16')]('day');return _0x293b02[_0xa4cb('0x17')](_0x1a80ec,_0x92a4c4,undefined,'[]')||_0x293b02[_0xa4cb('0x17')](_0x99227c,_0x22cbe2,undefined,'[]');}else{return _0x293b02[_0xa4cb('0x17')](_0x1a80ec,_0x22cbe2,undefined,'[]');}}module['exports'][_0xa4cb('0x18')]=timeCompare;function dowCompare(_0x5d5a7e,_0x2a2566,_0x5d3e59){var _0x2a90b3=_0x5d5a7e[_0xa4cb('0x8')]('en')['format'](_0xa4cb('0x19'))['toLowerCase']();return circularDoWInterval(_0x2a2566,_0x5d3e59)[_0xa4cb('0x1a')](_0x2a90b3);}module[_0xa4cb('0xe')][_0xa4cb('0x1b')]=dowCompare;function domCompare(_0x2f3504,_0x1f7010,_0x108590){var _0x47cff0=_0x2f3504[_0xa4cb('0x1c')]();if(_0x1f7010===_0x108590){return _0x47cff0===_0x1f7010;}else{var _0x2da811=_0x2f3504[_0xa4cb('0x1d')]();var _0x2d8cae=_0x1f7010<_0x108590;let _0x3dacf8=![];var _0x267a44=0x0;var _0x2c8b8e=0x0;if(_0x2d8cae){_0x267a44=Math[_0xa4cb('0x1e')](0x1,_0x1f7010);_0x2c8b8e=Math[_0xa4cb('0x1f')](_0x108590,_0x2da811);_0x3dacf8=_0x47cff0>=_0x267a44&&_0x47cff0<=_0x2c8b8e;}else{_0x267a44=Math[_0xa4cb('0x1f')](_0x1f7010,_0x2da811);_0x2c8b8e=Math[_0xa4cb('0x1e')](0x1,_0x108590);_0x3dacf8=_0x47cff0>=_0x267a44||_0x47cff0<=_0x2c8b8e;}return _0x3dacf8;}}module[_0xa4cb('0xe')][_0xa4cb('0x20')]=domCompare;function monthCompare(_0x4cac52,_0x56a2bb,_0x34bad2){var _0x4be4f0=_0x4cac52[_0xa4cb('0x8')]('en')[_0xa4cb('0x21')]('MMM')['toLowerCase']();return circularMonthInterval(_0x56a2bb,_0x34bad2)[_0xa4cb('0x1a')](_0x4be4f0);}module[_0xa4cb('0xe')][_0xa4cb('0x22')]=monthCompare;function iftime(_0x82652,_0x426011=moment['tz']['guess'](),_0x5c6d57=moment()){if(!validateRx[_0xa4cb('0x23')](_0x82652)){throw new Error(EINVALID_STRING);}else{var _0xac5c6c=(moment[_0xa4cb('0x24')](_0x5c6d57)?_0x5c6d57[_0xa4cb('0x10')]():moment(_0x5c6d57))['tz'](_0x426011)[_0xa4cb('0x8')]('en');throwIfDateNotValid(_0xac5c6c);var _0x44d822=_0x82652[_0xa4cb('0x7')](',');var _0x17e10a=_0x44d822[0x0];var _0x4ba811=_0x44d822[0x1];var _0x4107f6=_0x44d822[0x2];var _0x2f672e=_0x44d822[0x3];let _0x3a6031=!![];if(_0x17e10a!=='*'){var _0x280efb=_0x17e10a[_0xa4cb('0x7')]('-');var _0x32c673=_[_0xa4cb('0x25')](_0x280efb[0x0],0x5,'0');var _0x5ba337=_0x280efb[_0xa4cb('0x26')]===0x2?_['padStart'](_0x280efb[0x1],0x5,'0'):_0x32c673;_0x3a6031=timeCompare(_0xac5c6c,_0x32c673,_0x5ba337);}let _0x4c739a=!![];if(_0x4ba811!=='*'){var _0x28cf7f=_0x4ba811[_0xa4cb('0x7')]('-');var _0x2ac1c4=_0x28cf7f[0x0];var _0x1622aa=_0x28cf7f[_0xa4cb('0x26')]===0x2?_0x28cf7f[0x1]:_0x2ac1c4;_0x4c739a=dowCompare(_0xac5c6c,_0x2ac1c4,_0x1622aa);}let _0x395117=!![];if(_0x4107f6!=='*'){var _0x3f3b7e=_0x4107f6[_0xa4cb('0x7')]('-');var _0x330783=parseDom(_0x3f3b7e[0x0]);var _0x26ca7e=_0x3f3b7e[_0xa4cb('0x26')]===0x2?parseDom(_0x3f3b7e[0x1]):_0x330783;_0x395117=domCompare(_0xac5c6c,_0x330783,_0x26ca7e);}let _0x35321f=!![];if(_0x2f672e!=='*'){var _0x558156=_0x2f672e[_0xa4cb('0x7')]('-');var _0x3e0604=_0x558156[0x0];var _0x27033c=_0x558156[_0xa4cb('0x26')]===0x2?_0x558156[0x1]:_0x558156[0x0];_0x35321f=monthCompare(_0xac5c6c,_0x3e0604,_0x27033c);}return _0x3a6031&&_0x4c739a&&_0x395117&&_0x35321f;}}module[_0xa4cb('0xe')][_0xa4cb('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f8af875..37ec86f 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x6dd2=['moment','debugLevel','info','redBG\x20white','bold\x20yellow','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','{{{','}}}','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','fileLogger','path'];(function(_0xf88c12,_0x33e0f0){var _0x29c7b2=function(_0x3a9353){while(--_0x3a9353){_0xf88c12['push'](_0xf88c12['shift']());}};_0x29c7b2(++_0x33e0f0);}(_0x6dd2,0x71));var _0x26dd=function(_0x3fca4d,_0xc13bff){_0x3fca4d=_0x3fca4d-0x0;var _0x181248=_0x6dd2[_0x3fca4d];return _0x181248;};'use strict';var path=require(_0x26dd('0x0'));var util=require('util');var moment=require(_0x26dd('0x1'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x26dd('0x2')]?config[_0x26dd('0x2')]['toLowerCase']():_0x26dd('0x3');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':_0x26dd('0x4'),'error':'red','warn':_0x26dd('0x5'),'info':_0x26dd('0x6'),'print':_0x26dd('0x7'),'success':'bold\x20green','http':_0x26dd('0x8'),'verbose':_0x26dd('0x9'),'debug':_0x26dd('0xa'),'silly':_0x26dd('0xb')};winston[_0x26dd('0xc')](XC_LOG_COLORS);function getLogFileName(_0x159d21,_0xbd9c6,_0x12036c){var _0x37ff5d=_0x159d21||_0x26dd('0xd');return path[_0x26dd('0xe')](_0x37ff5d,util[_0x26dd('0xf')](_0x26dd('0x10'),_0xbd9c6,_0x12036c));}function formatter(_0x423700,_0x46d169){_0x46d169['message']=_0x46d169[_0x26dd('0x11')][_0x26dd('0x12')](/@@{/g,'{{{')[_0x26dd('0x12')](/}@@/g,'}}}')[_0x26dd('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x26dd('0x13'),moment()['format'](_0x26dd('0x14')),_0x46d169[_0x26dd('0x15')]['toUpperCase'](),_0x423700,_0x46d169[_0x26dd('0x11')]);}function fileFormat(_0x4c22eb,_0x158fdb){_0x158fdb[_0x26dd('0x11')]=_0x158fdb[_0x26dd('0x11')]['replace'](/@@{/g,_0x26dd('0x16'))[_0x26dd('0x12')](/}@@/g,_0x26dd('0x17'))[_0x26dd('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x437c61=_0x158fdb[_0x26dd('0x18')]&&Object[_0x26dd('0x19')](_0x158fdb[_0x26dd('0x18')])[_0x26dd('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x158fdb[_0x26dd('0x18')]):'';return util[_0x26dd('0xf')](_0x26dd('0x1b'),moment()['format'](_0x26dd('0x14')),_0x158fdb[_0x26dd('0x15')][_0x26dd('0x1c')](),_0x4c22eb,_0x158fdb[_0x26dd('0x11')],_0x437c61);}function consoleLogger(){var _0x381643=new winston[(_0x26dd('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x26dd('0x1e'))][(_0x26dd('0x1f'))]({'level':_0x26dd('0x20'),'json':![],'formatter':function(_0x218cf9){return formatter('',_0x218cf9);}})]});return _0x381643;}function fileLogger(_0x72637,_0x21309c){var _0x33be40=new winston[(_0x26dd('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x26dd('0x1e'))]['File']({'name':util[_0x26dd('0xf')](_0x26dd('0x21'),_0x72637,_0x26dd('0x22')),'filename':getLogFileName(_0x21309c,_0x72637,_0x26dd('0x22')),'level':_0x26dd('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4980f8){return fileFormat(_0x72637,_0x4980f8);}}),new winston[(_0x26dd('0x1e'))][(_0x26dd('0x23'))]({'name':util[_0x26dd('0xf')](_0x26dd('0x21'),_0x72637,debugLevel),'filename':getLogFileName(_0x21309c,_0x72637,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e4703){return fileFormat(_0x72637,_0x1e4703);}}),new winston[(_0x26dd('0x1e'))]['Console']({'level':_0x26dd('0x20'),'json':![],'formatter':function(_0x32883e){return fileFormat(_0x72637,_0x32883e);}})]});return _0x33be40;}exports[_0x26dd('0x24')]=consoleLogger;exports[_0x26dd('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 517d405..10e95ed 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 _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 +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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x57ca,0x108));var _0xa57c=function(_0x5b39ea,_0x3ba359){_0x5b39ea=_0x5b39ea-0x0;var _0x2a010a=_0x57ca[_0x5b39ea];return _0x2a010a;};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 c297a0c..9d8729c 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x0295=['exports','replace'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0295,0x1f0));var _0x5029=function(_0x535c2b,_0x13368b){_0x535c2b=_0x535c2b-0x0;var _0x347f9d=_0x0295[_0x535c2b];return _0x347f9d;};module[_0x5029('0x0')]={'escapeRegExp'(_0x4e737b,_0x5e71d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4e737b[_0x5029('0x1')](_0x5e71d0,'\x5c$&');}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 674151b..e9837b7 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 _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 +var _0x7708=['lodash','\x20}\x20}','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x517247,_0x42e2d4){var _0xc5e066=function(_0x45d18e){while(--_0x45d18e){_0x517247['push'](_0x517247['shift']());}};_0xc5e066(++_0x42e2d4);}(_0x7708,0x188));var _0x8770=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x7708[_0x590b63];return _0x3c9380;};var _=require(_0x8770('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24909b){return _0x24909b==='{{'?'{\x20{\x20':_0x8770('0x1');}function safeTemplate(_0x5a8b5b){var _0x5ca46f=_0x5a8b5b;if(typeof _0x5a8b5b==='string'){_0x5ca46f=_0x5a8b5b['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8770('0x2')](_0x5a8b5b)){_0x5ca46f=_0x5a8b5b[_0x8770('0x3')](function(_0x577b13){return safeTemplate(_0x577b13);});}else if(_[_0x8770('0x4')](_0x5a8b5b)){_0x5ca46f=Object['keys'](_0x5a8b5b)[_0x8770('0x5')](function(_0x42d305,_0x2b0295){_0x42d305[_0x2b0295]=safeTemplate(_0x5a8b5b[_0x2b0295]);return _0x42d305;},{});}return _0x5ca46f;}module[_0x8770('0x6')][_0x8770('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 4d92e45..bdbc0dc 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 _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 +var _0x001e=['path','resolve','server/app.json','apps','findIndex','motion2','NODE_PATH','env','pathExists','readJSON','Updating\x20app.json','writeJSON','exports','fs-extra'];(function(_0x8e7772,_0x9d77b0){var _0x408200=function(_0x1c61b6){while(--_0x1c61b6){_0x8e7772['push'](_0x8e7772['shift']());}};_0x408200(++_0x9d77b0);}(_0x001e,0xb5));var _0xe001=function(_0x25ac1c,_0x5b55dd){_0x25ac1c=_0x25ac1c-0x0;var _0x3f172b=_0x001e[_0x25ac1c];return _0x3f172b;};var fs=require(_0xe001('0x0'));var path=require(_0xe001('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0xe001('0x2')](root,_0xe001('0x3'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x50275b){let _0x4258e6=![];if(Array['isArray'](_0x50275b[_0xe001('0x4')])){var _0x75217b=_0x50275b[_0xe001('0x4')][_0xe001('0x5')](function(_0x1d1622){return _0x1d1622['name']===_0xe001('0x6');});if(_0x75217b>-0x1){var _0x2a2b31=_0x50275b[_0xe001('0x4')][_0x75217b];if(typeof _0x2a2b31['env'][_0xe001('0x7')]!=='string'){_0x2a2b31[_0xe001('0x8')][_0xe001('0x7')]=NODEPATH;_0x4258e6=!![];}}return{'appConfig':_0x50275b,'updated':_0x4258e6};}}function updateAppConfig(_0x4ba0d5){return fs[_0xe001('0x9')](APP_JSON_PATH)['then'](function(_0x3cb623){if(_0x3cb623){return fs[_0xe001('0xa')](APP_JSON_PATH)['then'](function(_0x2221d7){var _0x5d6d68=setLegacyLibsNodeEnvPath(_0x2221d7);if(_0x5d6d68['updated']){_0x4ba0d5['info'](_0xe001('0xb'));return fs[_0xe001('0xc')](APP_JSON_PATH,_0x2221d7,{'spaces':0x2});}else{return Promise[_0xe001('0x2')]();}});}else{return Promise[_0xe001('0x2')]();}});}module[_0xe001('0xd')]=updateAppConfig; \ No newline at end of file